diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86602774..b346a3e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: os: - macOS-15-intel # with intel processors - ubuntu-latest + # - windows-latest # Disabled: Windows PETSc_jll built without MPI, requires WSL for testing arch: - x64 include: diff --git a/.gitignore b/.gitignore index 0b279ce1..7d095569 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ deps/petsc-*.tar.gz *.jl.mem docs/build/ docs/site/ -Manifest.toml \ No newline at end of file +Manifest.toml +wrapping/.CondaPkg \ No newline at end of file diff --git a/Project.toml b/Project.toml index 39c3e57f..de8908ce 100644 --- a/Project.toml +++ b/Project.toml @@ -1,16 +1,21 @@ name = "PETSc" uuid = "ace2c81b-2b5f-4b1e-a30d-d662738edfe0" -authors = ["Simon Byrne "] -version = "0.3.1" +authors = ["Boris Kaus ", "Viral B. Shah ", "Erik Schnetter ", "Jeremy E. Kozdon ", "Simon Byrne "] +version = "0.4.0" [deps] +ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" MPIPreferences = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267" +OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" PETSc_jll = "8fa3689e-f0b9-5420-9873-adf6ccf46f2d" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" +SparseDiffTools = "47a9eef4-7e08-11e9-0b38-333d64bd3804" +Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" [compat] MPI = "0.20" @@ -20,12 +25,14 @@ SparseArrays = "1.10" julia = "1.10" [extras] +CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" +Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SparseDiffTools = "47a9eef4-7e08-11e9-0b38-333d64bd3804" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" [targets] -test = ["ForwardDiff", "UnicodePlots", "Test", "Plots", "SparseDiffTools", "Printf"] +test = ["ForwardDiff", "UnicodePlots", "Test", "Plots", "SparseDiffTools", "Printf", "Random", "CairoMakie"] diff --git a/README.md b/README.md index 932e22d4..23fcfa10 100644 --- a/README.md +++ b/README.md @@ -3,38 +3,52 @@ [![Build Status](https://github.com/JuliaParallel/PETSc.jl/workflows/CI/badge.svg)](https://github.com/JuliaParallel/PETSc.jl/actions/workflows/ci.yml) [![doc dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliaparallel.github.io/PETSc.jl/dev/) -This package provides a low level interface for [PETSc](https://www.mcs.anl.gov/petsc/) and allows combining julia features (such as automatic differentiation) with the PETSc infrastructure and nonlinear solvers. +`PETSc.jl` provides an interface to the Portable, Extensible Toolkit for Scientific Computation ([PETSc](https://petsc.org)) library, allowing the combination of Julia features (such as automatic differentiation) with the PETSc's infrastructure, including linear, nonlinear, and optimization solvers, timesteppers, domain management (DM), and more, in a distributed-memory (MPI) environment. -## Installation +This package comprises two main components: + +1. An automatically generated, low-level interface for large parts of the PETSc API (see `PETSc.LibPETSc`). +2. A curated, high-level, more Julianic interface for selected functionality. + +The low-level interface covers nearly the entire PETSc API, but may be awkward to work with and likely requires previous experience with PETSc to use effectively. The high level interface is designed to be more familiar and convenient for Julia users, and allows, for example, to set matrix entries with `A[1,2] = 3.0`, rather than having to call `LibPETSc.MatSetValue`. It, however, exposes only a small portion of the functionality of the underlying library. +## Installation This package can be added with the julia command: ```julia -]add PETSc +julia>]add PETSc ``` The installation can be tested with ```julia -]test PETSc +julia>]test PETSc ``` ## PETSc binaries -By default, the package uses a pre-built binary of (see [PETSc_jll](https://github.com/JuliaBinaryWrappers/PETSc_jll.jl)) along with a default installation of `MPI.jl`, so you don't have to install it on your machine. +By default, the package uses a pre-built binary of PETSc (see [PETSc_jll](https://github.com/JuliaBinaryWrappers/PETSc_jll.jl)) along with a default installation of `MPI.jl`, so you don't have to install it on your machine. -If you want to use the package with custom builds of the PETSc library, this can be done by specifying the environment variable `JULIA_PETSC_LIBRARY`. This is a colon separated list of paths to custom builds of PETSc; the reason for using multiple builds is to enable single, double, and complex numbers in the same julia session. These should be built against the same version of MPI as used with `MPI.jl` +If you want to use the package with custom builds of the PETSc library, this can be done by using the function `set_petsclib` which requires you to point to the correct dynamic library (which should be compatible with the MPI version used by `MPI.jl`) -After setting the variable you should ```julia -]build PETSc -``` -and the library will be persistently set until the next time the build command is issued. +using PETSc -To see the currently set library use +# Create custom library instance +petsclib = set_petsclib("/path/to/custom/libpetsc.so"; + PetscScalar=Float64, PetscInt=Int64) +# Use it like any precompiled library +PETSc.initialize(petsclib, log_view=true) +# ... your code ... +PETSc.finalize(petsclib) +``` +To get an overview of available precompiled libraries: ```julia -using PETSc -PETSc.libs +julia>using PETSc +julia>[PETSc.petsclibs...] ``` + ## Windows users The package currently does not work on windows, mainly because `MicrosoftMPI_jll` does not function when used along with the precompiled version used in `PETSc_jll`. Windows users are therefore advised to install the [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) (WSL) and run PETSc through there. ## Getting started -The documentation is currently rather minimalistic; yet, if you want to see what is possible have a look at the [examples](./examples/) directory or at the tests in the [test](./test) directory. We do keep the tests up to date, so that is a good starting point. +The documentation is currently rather minimalistic; yet, if you want to see what is possible have a look at the [examples](./examples/) directory or at the tests in the [test](./test) directory. We do keep the tests up to date, so that is a good starting point. + +Note, that we do not have tests in place for the whole library at this stage. The best supported parts are `DMDA`,`DMStag`, `KSP`,`SNES`,`Vec` and `Mat` interfaces, while other parts such as `DMPlex` do not have a high-level interface or tests yet. Users will thus have to rely on the low-level interface. \ No newline at end of file diff --git a/docs/Project.toml b/docs/Project.toml index dfa65cd1..ca8b47cd 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,2 +1,4 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" +PETSc = "ace2c81b-2b5f-4b1e-a30d-d662738edfe0" diff --git a/docs/make.jl b/docs/make.jl index 4d5088ff..858d9bd4 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -3,17 +3,52 @@ using Documenter, PETSc makedocs(; modules=[PETSc], sitename="PETSc.jl", + checkdocs=:exports, # Only check exported functions, skip LibPETSc internals + warnonly=true, # Warn but don't error for any documentation issues format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", + size_threshold_warn = nothing, # Disable size warnings for large low-level API pages + size_threshold = nothing, # Disable size errors for large low-level API pages ), pages=[ "Home" => "index.md", "Getting Started" => "man/getting_started.md", - "PETSc" => Any[ + "High-level interface" => Any[ + "Vec" => "man/vec.md", "Mat" => "man/mat.md", + "DM" => "man/dm.md", + "DMDA" => "man/dmda.md", "DMStag" => "man/dmstag.md", + "KSP" => "man/ksp.md", + "SNES" => "man/snes.md", ], - "List of functions" => "man/listfunctions.md" + "Low-level interface (LibPETSc)" => Any[ + "Introduction" => "man/lowlevel_intro.md", + "Vec" => "man/vec_lowlevel.md", + "Mat" => "man/mat_lowlevel.md", + "DM" => Any[ + "DM" => "man/dm_lowlevel.md", + "DMDA" => "man/dmda_lowlevel.md", + "DMPlex" => "man/dmplex_lowlevel.md", + "DMStag" => "man/dmstag_lowlevel.md", + "DMSwarm" => "man/dmswarm_lowlevel.md", + "DMForest" => "man/dmforest_lowlevel.md", + "DMNetwork" => "man/dmnetwork_lowlevel.md", + "DMShell and others" => "man/dmshell_lowlevel.md", + ], + "KSP" => "man/ksp_lowlevel.md", + "SNES" => "man/snes_lowlevel.md", + "TS (Time Stepping)" => "man/ts_lowlevel.md", + "Tao (Optimization)" => "man/tao_lowlevel.md", + "IS (Index Sets)" => "man/is_lowlevel.md", + "PetscViewer (I/O)" => "man/petscviewer_lowlevel.md", + "PetscSection (DOF Layout)" => "man/petscsection_lowlevel.md", + "PetscSF (Communication)" => "man/petscsf_lowlevel.md", + "AO (Application Ordering)" => "man/ao_lowlevel.md", + ], + "Utilities" => "man/utilities.md", + "FAQ" => "man/FAQ.md", + "Contributing" => "man/contributing.md", ], ) diff --git a/docs/src/index.md b/docs/src/index.md index 86a91ad4..8b1a3d40 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,7 +1,42 @@ # PETSc.jl - [PETSc.jl](https://github.com/JuliaParallel/PETSc.jl) is a Julia wrapper for the Portable, Extensible Toolkit for Scientific Computation [PETSc](https://petsc.org/release/documentation/manual/) package, which allows solving ordinary and partial differential equations in parallel on laptops or massively parallel high-performance systems. +[PETSc.jl](https://github.com/JuliaParallel/PETSc.jl) is a Julia wrapper for the Portable, Extensible Toolkit for Scientific Computation [PETSc](https://petsc.org/) package, which allows solving ordinary and partial differential equations in parallel on laptops or massively parallel high-performance systems. - The use of Julia greatly simplifies the code that developers have to write, while allowing to employ Julia features such as automatic differentiation. The Julia wrapper also comes with a pre-built library, which greatly simplifies the process of getting your first code working in parallel, on different operating systems. In many cases, the Julia code is significantly shorter than its C counterpart. +The use of Julia greatly simplifies the code that developers have to write, while allowing them to employ Julia features such as automatic differentiation. The Julia wrapper also comes with a pre-built library, which greatly simplifies the process of getting your first code working in parallel on different operating systems. In many cases, the Julia code is significantly shorter than its C counterpart. - This wrapper mimics the PETSc-functionality as closely as possible, but remains work in progress (meaning that not everything has been translated yet). See the official [user guide](https://petsc.org/release/overview/) if you want to learn more about PETSc in general. For Julia-specific examples, have a look at our [examples](https://github.com/JuliaParallel/PETSc.jl/tree/main/examples) or [tests](https://github.com/JuliaParallel/PETSc.jl/tree/main/test). +This wrapper mimics the PETSc functionality as closely as possible, but remains work in progress. We have (semi-automatically) translated most of the functionality of PETSc, along with help docstrings. Yet, the higher-level interface is only available for part of the library. Likewise, the tests currently only cover part of the library, so we can only guarantee that this part works. + +See the official [user guide](https://petsc.org/release/overview/) if you want to learn more about PETSc in general. For Julia-specific examples, have a look at our [examples](https://github.com/JuliaParallel/PETSc.jl/tree/main/examples) or [tests](https://github.com/JuliaParallel/PETSc.jl/tree/main/test). + +## The High-Level Interface + +The high-level interface is designed to be familiar and convenient for Julia users, but exposes only a small portion of the functionality of the underlying PETSc library. + +For example, with this interface, PETSc's [KSP](https://petsc.org/release/docs/manual/ksp) linear solvers (including Krylov methods) can be used in a way similar to solvers from other Julia packages. See the example in [Getting started](@ref) and the API in [KSP](@ref). + +## The Low-Level Interface + +The low-level interface covers most of the PETSc API, but may be awkward to work with and likely requires previous experience with PETSc to use effectively. It is (mostly) automatically generated by borrowing the Python code that creates Fortran wrappers for PETSc. + +The high-level interface described in [KSP](@ref) creates a [KSP](https://petsc.org/release/docs/manual/ksp) linear solver object via the low-level interface to [`KSPSolve()`](https://petsc.org/release/docs/manualpages/KSP/KSPCreate.html), with the use of constructs which require knowledge of PETSc's nature as a [C library](https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/). Expert users are of course free to directly use the low-level interface, as in this simple example which directly calls [`PetscGetVersionNumber()`](https://petsc.org/release/docs/manualpages/PetscGetVersionNumber.html). + +```julia +using MPI +MPI.Initialized() || MPI.Init() +using PETSc + +# Select the appropriate library +petsclib = PETSc.petsclibs[1] + +# Initialize PETSc (with logging turned off; the default) +PETSc.initialize(petsclib, log_view=false) + +# Call the low-level interface (which always starts with petsclib) +version = LibPETSc.PetscGetVersionNumber(petsclib) + +# Print result +println("PETSc $(version[1]).$(version[2]).$(version[3])") + +# Finalize +PETSc.finalize(petsclib) +``` diff --git a/docs/src/man/FAQ.md b/docs/src/man/FAQ.md new file mode 100644 index 00000000..25c5f1d1 --- /dev/null +++ b/docs/src/man/FAQ.md @@ -0,0 +1,18 @@ +# Frequently Asked Questions + + +## 1. Can I use my own PETSc library? +Yes, see the function `set_petsclib`. You do need to compile this library as a dynamic library, and `MPI.jl` must be configured to be compatible with the MPI library used to compile PETSc. If you run this on a HPC system, and you don't know exactly which options were used, you can compile one of the PETSc examples and run it with the `-log_view` command line option. At the end of the simulation, it will give you the configuration options used on that machine. + +Please note that the version of PETSc should be compatible with the version used for the wrapper. + +## 2. Help, my code crashes? +That is very possible. If you provide a *short* minimum working example (MWE), feel free to open an issue on the github repo, so we can check it out. + +## 3. What about the garbage collector in Julia? +Using the GC in combination with MPI code is a tricky business. The users are therefore responsible to free PETSc objects in the code, as shown in the various examples. We have some help for that: +1. The julia function `PETSc.audit_petsc_file("path/to/your/file.jl")` which scans your julia file and tries to guess whether objects are destroyed. +2. You can initialize the PETSc library with `log_view=true`. At the end of the code, it will give an + +## 4. Is it compatible with GPUs? +The precompiled `PETSc_jll` binaries are currently not compatible with GPUs. You can, however, use your own PETSc compilation and things should be fine. diff --git a/docs/src/man/ao_lowlevel.md b/docs/src/man/ao_lowlevel.md new file mode 100644 index 00000000..f39a4b08 --- /dev/null +++ b/docs/src/man/ao_lowlevel.md @@ -0,0 +1,200 @@ +# AO (Application Ordering) - Low-level Interface + +The AO (Application Ordering) component provides mappings between the natural "application" ordering of unknowns and the PETSc parallel ordering, which is optimized for parallel sparse matrix operations. + +## Overview + +Application orderings are used when: +- **Natural ordering differs from parallel ordering**: Your application uses a different numbering scheme +- **I/O operations**: Reading/writing data in application order +- **User interaction**: Displaying results in familiar ordering +- **Legacy code integration**: Interfacing with existing applications + +The AO object maintains bidirectional mappings: +- **Application → PETSc**: Convert from your numbering to PETSc's +- **PETSc → Application**: Convert from PETSc's numbering to yours + +## Basic Usage + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Define the mapping +# application[i] is the application index for PETSc index i +n = 10 +application = Int32[9, 8, 7, 6, 5, 4, 3, 2, 1, 0] # Reverse ordering +petsc = Int32[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] # Natural PETSc ordering + +# Create AO object +ao = LibPETSc.AOCreateBasic(petsclib, LibPETSc.PETSC_COMM_SELF, n, application, petsc) + +# Convert application indices to PETSc indices +app_indices = Int32[0, 5, 9] +LibPETSc.AOApplicationToPetsc(petsclib, ao, length(app_indices), app_indices) +# app_indices now contains corresponding PETSc indices + +# Convert PETSc indices to application indices +petsc_indices = Int32[0, 1, 2] +LibPETSc.AOPetscToApplication(petsclib, ao, length(petsc_indices), petsc_indices) +# petsc_indices now contains corresponding application indices + +# Cleanup +LibPETSc.AODestroy(petsclib, ao) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Creating AO Objects + +### Basic AO + +Most common: explicit mapping arrays: + +```julia +# Create from application and PETSc index arrays +ao = LibPETSc.AOCreateBasic(petsclib, comm, n, app_indices, petsc_indices) +``` + +### Identity Mapping + +When application and PETSc orderings are the same: + +```julia +# Create identity mapping (no conversion needed) +ao = LibPETSc.AOCreateIdentity(petsclib, comm, n) +``` + +### Memory Scalable + +For large problems where storing full mapping is expensive: + +```julia +# Create memory-scalable AO (uses hash table) +ao = LibPETSc.AOCreateMemoryScalable(petsclib, comm, n, app_indices, petsc_indices) +``` + +## Conversion Operations + +### Forward Conversion (Application → PETSc) + +```julia +# Convert array of application indices to PETSc indices +indices = Int32[10, 20, 30, 40] +# Create forward conversion example +LibPETSc.AOApplicationToPetsc(petsclib, ao, length(indices), indices) +# indices are now in PETSc ordering (modified in-place) +``` + +### Reverse Conversion (PETSc → Application) + +```julia +# Convert array of PETSc indices to application indices +indices = Int32[0, 5, 10, 15] +# Reverse conversion example +LibPETSc.AOPetscToApplication(petsclib, ao, length(indices), indices) +# indices are now in application ordering (modified in-place) +``` + +### Index Set Conversion + +```julia +# Convert IS (index set) from application to PETSc ordering +is_app = Ref{LibPETSc.IS}() +# ... create IS with application indices ... + +LibPETSc.AOApplicationToPetscIS(petsclib, ao, is_app[]) +# is_app now contains PETSc indices +``` + +## Parallel Considerations + +- Each processor has its own local application ordering +- AO objects handle parallel communication automatically +- Indices not owned locally are mapped via MPI communication + +```julia +# Create parallel AO +ao = LibPETSc.AOCreateBasic(petsclib, MPI.COMM_WORLD, local_n, + local_app_indices, local_petsc_indices) +``` + +## Common Use Cases + +### 1. Reading Data in Application Order + +```julia +# Read matrix entries in application ordering +# Then convert to PETSc ordering for assembly + +# Application-ordered rows/cols +app_rows = Int32[...] +app_cols = Int32[...] + +# Convert to PETSc ordering +LibPETSc.AOApplicationToPetsc(petsclib, ao, length(app_rows), app_rows) +LibPETSc.AOApplicationToPetsc(petsclib, ao, length(app_cols), app_cols) + +# Now use app_rows, app_cols (which are now in PETSc ordering) for MatSetValues +``` + +### 2. Displaying Results + +```julia +# After solve, convert solution indices for output +solution_indices = Int32[0, 1, 2, 3, 4] # PETSc ordering + +# Convert to application ordering for display +LibPETSc.AOPetscToApplication(petsclib, ao, length(solution_indices), solution_indices) + +# Display in application order +# for i in solution_indices +# println("Application DOF $i: value = ", solution[i]) +# end +``` + +### 3. Integration with DM + +```julia +# Get AO from DM +dm_ao = Ref{LibPETSc.AO}() +# LibPETSc.DMGetAO(petsclib, dm, dm_ao) + +# Use for converting between natural and distributed orderings +``` + +## Viewing and Debugging + +```julia +# View the mapping (for debugging) +viewer = LibPETSc.PETSC_VIEWER_STDOUT_SELF(petsclib) +LibPETSc.AOView(petsclib, ao, viewer) +``` + +## AO Types + +Available types (set with `AOSetType`): +- **AOBASIC**: Hash table based, good for general use +- **AOMEMSCALABLE**: Memory efficient for large problems +- **AOMAPPING1TO1**: Optimized for one-to-one mappings + +## Performance Tips + +- **Reuse AO objects**: Creation can be expensive for large problems +- **Batch conversions**: Convert arrays rather than individual indices +- **Use identity when possible**: Skip AO entirely if orderings match +- **Choose appropriate type**: `AOMEMSCALABLE` for very large problems + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/AO_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/contributing.md b/docs/src/man/contributing.md new file mode 100644 index 00000000..3d4bd36b --- /dev/null +++ b/docs/src/man/contributing.md @@ -0,0 +1,24 @@ +# Contributing + +Contributions are highly welcome, in particular since only part of the PETSc functionality is currently being tested and has high-level interfaces. + +You can thus help in many ways: +1) Add more examples +2) Add new tests +3) Update documentation +4) Report bugs +5) Add a high-level interface for unsupported features +6) Keep the routines up to date with future PETSc versions +7) Keep the precompiled binaries in [PETSc_jll](https://github.com/JuliaBinaryWrappers/PETSc_jll.jl) up to date. + + +#### Autowrappers +We originally used the function `/wrapping/generatejuliabindings.jl` to wrap the whole PETSc library, which borrows python routines by Barry Smith. The PETSc version for which we generated these original wrappers was 3.23.6. + +Note, however, that a range of additional changes were necessary and we thus had manually fix a number of things. It is therefore *not* recommended to rerun these autowrappers for newer versions of PETSc. +Since there are usually only a limited number of new or updated functions between PETSc releases, it is recommended to run the a wrapper only for these new functions and replace those affected accordingly. + +Make sure that the tests work! + +#### Adding new functionality +Please open a pull request to add any of the above contributions. \ No newline at end of file diff --git a/docs/src/man/dm.md b/docs/src/man/dm.md new file mode 100644 index 00000000..907692a3 --- /dev/null +++ b/docs/src/man/dm.md @@ -0,0 +1,64 @@ +# DM + +The `DM` (Data Management) module provides the base functionality for managing distributed data structures in PETSc. It serves as a foundation for various grid managers. + +## Overview + +A `DM` object encapsulates the topology and data layout of a computational grid, enabling: +- Parallel data distribution across MPI processes +- Ghost point management for communication +- Creation of vectors and matrices with appropriate parallel layouts +- Multigrid hierarchy management + +## DM Types in PETSc + +PETSc provides several DM implementations for different mesh types: + +### High-Level Interface Available in PETSc.jl + +| DM Type | Description | Status | +|---------|-------------|--------| +| **DMDA** | Distributed arrays for structured grids (1D/2D/3D) | ✅ Full support | +| **DMStag** | Staggered grids for finite volume/difference methods | ✅ Full support | + +### Low-Level Interface Only (via LibPETSc) + +The following DM types are available through the low-level `LibPETSc` wrapper but do not yet have a convenient high-level Julia interface: + +| DM Type | Description | Use Case | +|---------|-------------|----------| +| **DMPlex** | Unstructured meshes with arbitrary topology | Finite elements, complex geometries | +| **DMForest** | Adaptive mesh refinement (AMR) via p4est/p8est | Octree-based adaptivity | +| **DMNetwork** | Graph/network structures | Power grids, pipe networks | +| **DMSwarm** | Particle data management | PIC methods, Lagrangian particles | +| **DMProduct** | Tensor product of DMs | Semi-structured problems | +| **DMSliced** | Sliced representation | Legacy, specialized uses | +| **DMShell** | User-defined DM | Custom implementations | +| **DMComposite** | Composition of multiple DMs | Multi-physics coupling | +| **DMRedundant** | Redundant storage on all ranks | Small coupled systems | + +### Using Low-Level DM Types + +For DM types without high-level wrappers, you can use the `LibPETSc` module directly: + +```julia +using PETSc +using PETSc.LibPETSc + +# Example: Create a DMPlex (low-level) +petsclib = PETSc.petsclibs[1] +dm = LibPETSc.DMPlexCreate(petsclib, MPI.COMM_WORLD) +# ... configure using LibPETSc functions ... +LibPETSc.DMDestroy(petsclib, dm) +``` + +!!! note "Contributing" + Contributions to add high-level interfaces for additional DM types are welcome! + See the [Contributing](@ref) page for guidelines. + +## Functions + +```@autodocs +Modules = [PETSc] +Pages = ["dm.jl"] +``` diff --git a/docs/src/man/dm_lowlevel.md b/docs/src/man/dm_lowlevel.md new file mode 100644 index 00000000..ad731709 --- /dev/null +++ b/docs/src/man/dm_lowlevel.md @@ -0,0 +1,80 @@ +# DM (Domain Management) + +The DM (Domain Management) object encapsulates the relationship between a mesh data structure and the algebraic objects (vectors, matrices). It provides a common interface for structured and unstructured meshes, particles, networks, and other geometric/topological structures. + +## Overview + +The DM abstraction in PETSc manages: +- Topology and geometry of computational domains +- Mapping between geometric entities and degrees of freedom +- Distribution of data across MPI processes +- Multi-level representations for multigrid +- Field definitions and discretizations + +## Basic Usage Pattern + +```julia +using PETSc, MPI + +# Initialize +petsclib = PETSc.petsclibs[1] +PETSc.initialize(petsclib) + +# Create a DM (specific type created via DMDACreate, DMPlexCreate, etc.) +# See subtype-specific pages for creation functions + +# Setup the DM +LibPETSc.DMSetFromOptions(petsclib, dm) +LibPETSc.DMSetUp(petsclib, dm) + +# Create global vectors +x = LibPETSc.DMCreateGlobalVector(petsclib, dm) + +# Create matrices +A = LibPETSc.DMCreateMatrix(petsclib, dm) + +# Use the DM... + +# Cleanup +LibPETSc.VecDestroy(petsclib, x) +LibPETSc.MatDestroy(petsclib, A) +LibPETSc.DMDestroy(petsclib, dm) +PETSc.finalize(petsclib) +``` + +## DM Subtypes + +PETSc provides several DM implementations for different problem types: + +- **[DMDA](dmda_lowlevel.md)**: Structured grids (1D, 2D, 3D) with regular topology +- **[DMPlex](dmplex_lowlevel.md)**: Unstructured meshes using Sieve/DMPlex topology +- **[DMStag](dmstag_lowlevel.md)**: Staggered grids for staggered finite differences +- **[DMSwarm](dmswarm_lowlevel.md)**: Particle methods and particle-in-cell +- **[DMForest](dmforest_lowlevel.md)**: Adaptive mesh refinement with forest-of-octrees +- **[DMNetwork](dmnetwork_lowlevel.md)**: Network/graph-based problems +- **[DMShell and others](dmshell_lowlevel.md)**: User-defined and composite DM types + +## General DM Functions + +The following functions work across all DM types: + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl", "DMaddons_wrappers.jl"] +Order = [:function] +Filter = t -> begin + name = string(nameof(t)) + # Include only general DM functions, exclude subtype-specific ones + startswith(name, "DM") && + !startswith(name, "DMDA") && + !startswith(name, "DMPlex") && + !startswith(name, "DMStag") && + !startswith(name, "DMSwarm") && + !startswith(name, "DMForest") && + !startswith(name, "DMNetwork") && + !startswith(name, "DMShell") && + !startswith(name, "DMProduct") && + !startswith(name, "DMRedundant") && + !startswith(name, "DMComposite") +end +``` diff --git a/docs/src/man/dmda.md b/docs/src/man/dmda.md new file mode 100644 index 00000000..39e1d3e1 --- /dev/null +++ b/docs/src/man/dmda.md @@ -0,0 +1,32 @@ +# DMDA + +The `DMDA` (Distributed Array) module provides functionality for creating and managing structured grids in 1D, 2D, or 3D. + +## Overview + +`DMDA` is ideal for problems on regular structured grids where: +- The grid is logically rectangular +- Each grid point has the same number of degrees of freedom +- Stencil operations follow a regular pattern (star or box stencils) + +## Creating a DMDA + +```julia +# 2D grid example +da = DMDA( + petsclib, + MPI.COMM_WORLD, + (DM_BOUNDARY_NONE, DM_BOUNDARY_NONE), # boundary types + (nx, ny), # global dimensions + 1, # degrees of freedom per node + 1, # stencil width + DMDA_STENCIL_STAR # stencil type +) +``` + +## Functions + +```@autodocs +Modules = [PETSc] +Pages = ["dmda.jl"] +``` diff --git a/docs/src/man/dmda_lowlevel.md b/docs/src/man/dmda_lowlevel.md new file mode 100644 index 00000000..580abcc0 --- /dev/null +++ b/docs/src/man/dmda_lowlevel.md @@ -0,0 +1,63 @@ +# DMDA (Structured Grids) + +DMDA manages structured grids with regular topology in 1D, 2D, and 3D. It's designed for finite difference and finite volume methods on Cartesian grids. + +## Overview + +DMDA provides: +- Regular grid topology in 1D, 2D, or 3D +- Efficient stencil-based communication +- Natural ordering and ghost point management +- Support for multiple degrees of freedom per grid point +- Boundary type specification (periodic, ghosted, none) + +## Basic Usage Pattern + +```julia +using PETSc, MPI + +petsclib = PETSc.petsclibs[1] +PETSc.initialize(petsclib) + +# Get PETSc types +PetscInt = petsclib.PetscInt + +# Create a 2D structured grid: 10x10 global size, 1 dof per point +dm = LibPETSc.DMDACreate2d( + petsclib, + MPI.COMM_WORLD, + LibPETSc.DM_BOUNDARY_NONE, # x boundary + LibPETSc.DM_BOUNDARY_NONE, # y boundary + LibPETSc.DMDA_STENCIL_STAR, # stencil type + PetscInt(10), PetscInt(10), # global dimensions + PetscInt(LibPETSc.PETSC_DECIDE), # processes in x + PetscInt(LibPETSc.PETSC_DECIDE), # processes in y + PetscInt(1), # dof per node + PetscInt(1), # stencil width + C_NULL, C_NULL # nodes per process +) + +# Set up and use +LibPETSc.DMSetFromOptions(petsclib, dm) +LibPETSc.DMSetUp(petsclib, dm) + +# Get local vector with ghost points +local_vec = LibPETSc.DMCreateLocalVector(petsclib, dm) + +# Get global vector +global_vec = LibPETSc.DMCreateGlobalVector(petsclib, dm) + +# Cleanup +LibPETSc.VecDestroy(petsclib, local_vec) +LibPETSc.VecDestroy(petsclib, global_vec) +LibPETSc.DMDestroy(petsclib, dm) +``` + +## DMDA Functions + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl"] +Order = [:function] +Filter = t -> startswith(string(nameof(t)), "DMDA") +``` diff --git a/docs/src/man/dmforest_lowlevel.md b/docs/src/man/dmforest_lowlevel.md new file mode 100644 index 00000000..3837fef7 --- /dev/null +++ b/docs/src/man/dmforest_lowlevel.md @@ -0,0 +1,77 @@ +# DMForest (Adaptive Mesh Refinement) + +DMForest manages adaptive mesh refinement (AMR) using forest-of-octrees (2D: quadtrees, 3D: octrees). It provides hierarchical mesh adaptation with efficient parallel implementation. + +## Overview + +DMForest provides: +- Adaptive mesh refinement and coarsening +- Forest-of-octrees topology +- Integration with p4est library +- Multi-level mesh hierarchies for multigrid +- Metric-based adaptation +- Label-based adaptation + +## Basic Usage Pattern + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Create a DMForest +forest = LibPETSc.DMCreate(petsclib, MPI.COMM_WORLD) +LibPETSc.DMSetType(petsclib, forest, "forest") # String convenience wrapper +# Set^ the geometric/topological dimension (e.g., 2 for a surface) +LibPETSc.DMSetDimension(petsclib, forest, 2) + +# Set forest topology (e.g., unit square/cube) +# Set topology by name (e.g., "brick") +LibPETSc.DMForestSetTopology(petsclib, forest, "brick") + +# Set base DM (initial coarse mesh) using a simple DMPlex box mesh +base_dm = LibPETSc.DMPlexCreateBoxMesh( + petsclib, MPI.COMM_WORLD, 2, LibPETSc.PETSC_FALSE, + [2, 2], [0.0, 0.0], [1.0, 1.0], [LibPETSc.DM_BOUNDARY_NONE, LibPETSc.DM_BOUNDARY_NONE], LibPETSc.PETSC_TRUE, 0, LibPETSc.PETSC_FALSE +) +LibPETSc.DMForestSetBaseDM(petsclib, forest, base_dm) + +# Set initial refinement level +LibPETSc.DMForestSetInitialRefinement(petsclib, forest, 2) + +# Ensure adjacency dimension and partition overlap are non-negative (some builds may leave them unset) +LibPETSc.DMForestSetAdjacencyDimension(petsclib, forest, 0) +LibPETSc.DMForestSetPartitionOverlap(petsclib, forest, 0) + +# Set up +# (Skip DMSetFromOptions in this simple example to avoid parsing unexpected runtime options) +LibPETSc.DMSetUp(petsclib, forest) + +# Adapt based on some criterion +# Create adapted forest (returns via out-parameter) +tdm = LibPETSc.PetscDM(C_NULL, petsclib) +LibPETSc.DMForestTemplate(petsclib, forest, MPI.COMM_WORLD, tdm) +adapted = tdm +# `adapted` now points to the adapted DM (if any) and should be checked before use. + +# Cleanup +LibPETSc.DMDestroy(petsclib, adapted) +LibPETSc.DMDestroy(petsclib, forest) +LibPETSc.DMDestroy(petsclib, base_dm) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## DMForest Functions + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl"] +Order = [:function] +Filter = t -> startswith(string(nameof(t)), "DMForest") +``` diff --git a/docs/src/man/dmnetwork_lowlevel.md b/docs/src/man/dmnetwork_lowlevel.md new file mode 100644 index 00000000..7552569c --- /dev/null +++ b/docs/src/man/dmnetwork_lowlevel.md @@ -0,0 +1,64 @@ +# DMNetwork (Network/Graph Problems) + +DMNetwork manages network and graph-based problems, such as power grids, transportation networks, and general graph computations with edge and vertex data. + +## Overview + +DMNetwork provides: +- Network topology with edges and vertices +- Component registration for edges and vertices +- Coupling of network problems with other DM types +- Distribution across MPI processes +- Support for algebraic constraints at vertices + +## Basic Usage Pattern + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Create a DMNetwork (returns a PetscDM) +network = LibPETSc.DMNetworkCreate(petsclib, MPI.COMM_WORLD) + +# Set network sizes +# For simple examples, provide a name and an explicit edge list vector +nedges = 2 +nvertices = 3 +LibPETSc.DMNetworkSetNumSubNetworks(petsclib, network, 1, 1) +edgelist = [1, 2, 2, 3] # pairs of vertex global indices +LibPETSc.DMNetworkAddSubnetwork(petsclib, network, "main", nedges, edgelist) + +# Register components (size in bytes; use appropriate struct size in real examples) +# Register a component; the function returns a component key (PetscInt) +compkey = LibPETSc.DMNetworkRegisterComponent(petsclib, network, "bus", Csize_t(0)) + +# Add components to vertices/edges using DMNetworkAddComponent (omitted here) + +# Finalize network and set up +LibPETSc.DMNetworkLayoutSetUp(petsclib, network) +LibPETSc.DMSetUp(petsclib, network) + +# Create vectors +x = LibPETSc.DMCreateGlobalVector(petsclib, network) + +# Cleanup +LibPETSc.VecDestroy(petsclib, x) +LibPETSc.DMDestroy(petsclib, network) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## DMNetwork Functions + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl"] +Order = [:function] +Filter = t -> startswith(string(nameof(t)), "DMNetwork") +``` diff --git a/docs/src/man/dmplex_lowlevel.md b/docs/src/man/dmplex_lowlevel.md new file mode 100644 index 00000000..bd5495a4 --- /dev/null +++ b/docs/src/man/dmplex_lowlevel.md @@ -0,0 +1,73 @@ +# DMPlex (Unstructured Meshes) + +DMPlex manages unstructured meshes using a flexible topology representation. It supports finite element methods, finite volume methods, and general mesh-based computations. + +## Overview + +DMPlex provides: +- General unstructured mesh topology (simplices, tensor products, polyhedra) +- Point-based topological representation (vertices, edges, faces, cells) +- Mesh partitioning and distribution +- Overlap and ghost cell management +- Section-based field layout +- Support for FEM assembly via PetscDS and PetscFE +- Mesh refinement and adaptation + +## Basic Usage Pattern + +```julia +using PETSc, MPI + +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Create a simple 2D quadrilateral mesh +dm = LibPETSc.DMPlexCreateBoxMesh( + petsclib, + MPI.COMM_WORLD, + 2, # dimension + LibPETSc.PETSC_FALSE, # simplex (false = tensor/quad) + [5, 5], # faces per dimension + [0.0, 0.0], # lower bounds + [1.0, 1.0], # upper bounds + [LibPETSc.DM_BOUNDARY_NONE, LibPETSc.DM_BOUNDARY_NONE], # boundary types + LibPETSc.PETSC_TRUE, # interpolate + 0, # localizationHeight + LibPETSc.PETSC_FALSE # sparseLocalize +) + +# Distribute mesh across processes (for serial, this is a no-op) +dmParallel = LibPETSc.PetscDM(C_NULL, petsclib) +LibPETSc.DMPlexDistribute(petsclib, dm, 0, C_NULL, dmParallel) +if dmParallel.ptr != C_NULL + LibPETSc.DMDestroy(petsclib, dm) + dm = dmParallel +end + +# Set up +LibPETSc.DMSetFromOptions(petsclib, dm) +LibPETSc.DMSetUp(petsclib, dm) + +# Create section to define field layout +section = Ref{LibPETSc.PetscSection}() +LibPETSc.DMGetLocalSection(petsclib, dm, section) + +# Create vectors and matrices +x = LibPETSc.DMCreateGlobalVector(petsclib, dm) + +# Cleanup +LibPETSc.VecDestroy(petsclib, x) +LibPETSc.DMDestroy(petsclib, dm) +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## DMPlex Functions + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl"] +Order = [:function] +Filter = t -> startswith(string(nameof(t)), "DMPlex") +``` diff --git a/docs/src/man/dmshell_lowlevel.md b/docs/src/man/dmshell_lowlevel.md new file mode 100644 index 00000000..1e39fc4b --- /dev/null +++ b/docs/src/man/dmshell_lowlevel.md @@ -0,0 +1,135 @@ +# DMShell and Other DM Types + +This page documents DMShell (user-defined DM), DMProduct (Cartesian product of DMs), DMRedundant (redundantly-stored DM), and DMComposite (deprecated composite DM). + +## DMShell + +DMShell allows users to define custom DM implementations by providing callback functions for operations like creating vectors, matrices, and managing topology. + +### Basic DMShell Usage + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Create a DMShell (returns a PetscDM) and set callbacks +shell = LibPETSc.DMShellCreate(petsclib, MPI.COMM_WORLD) +# Set callbacks on the returned DM, for example: +# LibPETSc.DMShellSetCreateGlobalVector(petsclib, shell, ...) +# LibPETSc.DMShellSetCreateLocalVector(petsclib, shell, ...) +# LibPETSc.DMShellSetCreateMatrix(petsclib, shell, ...) + +# Set up +LibPETSc.DMSetUp(petsclib, shell) + +# Cleanup +LibPETSc.DMDestroy(petsclib, shell) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## DMProduct + +DMProduct represents a Cartesian product of multiple DMs, useful for coupled multi-physics problems. + +### Basic DMProduct Usage + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Create component DMs +dm1 = Ref{LibPETSc.CDM}() +dm2 = Ref{LibPETSc.CDM}() +# ... create dm1 and dm2 ... + +# Create DMProduct +# Create two simple component DMs (here using small box DMPlex meshes) +dm1 = LibPETSc.DMPlexCreateBoxMesh( + petsclib, MPI.COMM_WORLD, 2, LibPETSc.PETSC_FALSE, + [1,1], [0.0,0.0], [1.0,1.0], [LibPETSc.DM_BOUNDARY_NONE, LibPETSc.DM_BOUNDARY_NONE], LibPETSc.PETSC_TRUE, 0, LibPETSc.PETSC_FALSE +) +dm2 = LibPETSc.DMPlexCreateBoxMesh( + petsclib, MPI.COMM_WORLD, 2, LibPETSc.PETSC_FALSE, + [1,1], [0.0,0.0], [1.0,1.0], [LibPETSc.DM_BOUNDARY_NONE, LibPETSc.DM_BOUNDARY_NONE], LibPETSc.PETSC_TRUE, 0, LibPETSc.PETSC_FALSE +) + +# Create a DMProduct and attach component DMs +product = LibPETSc.DMCreate(petsclib, MPI.COMM_WORLD) +LibPETSc.DMSetType(petsclib, product, "product") +# Set the product 'topological' dimension to the number of component DMs +LibPETSc.DMSetDimension(petsclib, product, 2) +# Map product slots to sub-DM dimensions (index mapping); then attach sub-DMs +LibPETSc.DMProductSetDimensionIndex(petsclib, product, 0, 0) +LibPETSc.DMProductSetDimensionIndex(petsclib, product, 1, 0) +LibPETSc.DMProductSetDM(petsclib, product, 0, dm1) +LibPETSc.DMProductSetDM(petsclib, product, 1, dm2) + +# Set up +LibPETSc.DMSetUp(petsclib, product) + +# Cleanup +LibPETSc.DMDestroy(petsclib, product) +LibPETSc.DMDestroy(petsclib, dm1) +LibPETSc.DMDestroy(petsclib, dm2) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## DMRedundant + +DMRedundant stores data redundantly across all processes, useful for small shared data. + +## DMComposite + +DMComposite (deprecated, use DMProduct instead) manages multiple DMs as separate fields. + +## Functions + +### DMShell Functions + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl"] +Order = [:function] +Filter = t -> startswith(string(nameof(t)), "DMShell") +``` + +### DMProduct Functions + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl"] +Order = [:function] +Filter = t -> startswith(string(nameof(t)), "DMProduct") +``` + +### DMRedundant Functions + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl"] +Order = [:function] +Filter = t -> startswith(string(nameof(t)), "DMRedundant") +``` + +### DMComposite Functions + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl"] +Order = [:function] +Filter = t -> startswith(string(nameof(t)), "DMComposite") +``` diff --git a/docs/src/man/dmstag.md b/docs/src/man/dmstag.md index a1399492..1b30def5 100644 --- a/docs/src/man/dmstag.md +++ b/docs/src/man/dmstag.md @@ -1,6 +1,132 @@ # DMStag -The following `DMStag` routines are available: +The DMStag (Staggered Grid DM) module provides data management for staggered grids, commonly used in finite difference/volume methods for fluid dynamics and similar applications. + +## Overview + +DMStag is designed for problems where: +- Variables live at different grid locations (vertices, edges, faces, cell centers) +- Staggered grids provide better stability for incompressible flow +- Multiple degrees of freedom per grid location are needed + +### Staggered Grid Layout + +In a staggered grid, different physical quantities are stored at different locations: + +**1D**: +- Vertices: Scalar quantities (pressure, temperature) +- Elements: Flux quantities + +**2D**: +- Vertices: Corner values +- Edges: Face-normal velocities (u on vertical edges, v on horizontal edges) +- Elements: Cell-centered values (pressure) + +**3D**: +- Vertices: Corner values +- Edges: Edge-centered values +- Faces: Face-normal quantities +- Elements: Cell-centered values + +## Creating a DMStag + +```julia +# 2D staggered grid +dm = DMStag( + petsclib, + MPI.COMM_WORLD, + (DM_BOUNDARY_NONE, DM_BOUNDARY_NONE), # boundary types + (nx, ny), # global dimensions + (dof_vertex, dof_edge, dof_element), # DOF at each location + 1, # stencil width + DMSTAG_STENCIL_BOX # stencil type +) + +# 3D staggered grid +dm = DMStag( + petsclib, + MPI.COMM_WORLD, + (DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE), + (nx, ny, nz), + (dof_vertex, dof_edge, dof_face, dof_element), + 1, + DMSTAG_STENCIL_BOX +) +``` + +## Accessing Data + +### Grid Corners and Sizes + +```julia +# Get local grid extent (without ghost points) +corners = getcorners_dmstag(dm) +# Returns (lower=CartesianIndex, upper=CartesianIndex, size=Tuple) + +# Get local grid extent (with ghost points) +ghost_corners = getghostcorners_dmstag(dm) +``` + +### Working with Vectors + +```julia +# Create global and local vectors +global_vec = DMGlobalVec(dm) +local_vec = DMLocalVec(dm) + +# Transfer data between global and local +dm_global_to_local!(dm, global_vec, INSERT_VALUES, local_vec) +dm_local_to_global!(dm, local_vec, ADD_VALUES, global_vec) +``` + +### Getting Location Indices + +```julia +# Get indices for accessing specific DOF locations +indices = DMStagGetIndices(dm) +# Use indices to access vertex, edge, face, or element DOFs +``` + +## Setting Coordinates + +```julia +# Set uniform coordinates +setuniformcoordinates_stag!(dm, xmin, xmax) # 1D +setuniformcoordinates_stag!(dm, xmin, xmax, ymin, ymax) # 2D +setuniformcoordinates_stag!(dm, xmin, xmax, ymin, ymax, zmin, zmax) # 3D + +# Get local coordinate array +coords = getlocalcoordinatearray(dm) +``` + +## Stencil Types + +- `DMSTAG_STENCIL_BOX` - Full box stencil (includes diagonals) +- `DMSTAG_STENCIL_STAR` - Star stencil (axis-aligned neighbors only) + +## Example: 2D Stokes Flow Setup + +```julia +# Create staggered grid for Stokes: velocity on edges, pressure in cells +dm = DMStag( + petsclib, + MPI.COMM_WORLD, + (DM_BOUNDARY_NONE, DM_BOUNDARY_NONE), + (64, 64), # 64x64 grid + (0, 1, 1), # 0 DOF at vertices, 1 at edges (velocity), 1 in elements (pressure) + 1, + DMSTAG_STENCIL_BOX +) + +setuniformcoordinates_stag!(dm, 0.0, 1.0, 0.0, 1.0) + +# Create vectors and matrix +x = DMGlobalVec(dm) +b = DMGlobalVec(dm) +A = DMCreateMatrix(dm) +``` + +## Functions ```@autodocs Modules = [PETSc] diff --git a/docs/src/man/dmstag_lowlevel.md b/docs/src/man/dmstag_lowlevel.md new file mode 100644 index 00000000..27e33698 --- /dev/null +++ b/docs/src/man/dmstag_lowlevel.md @@ -0,0 +1,66 @@ +# DMStag (Staggered Grids) + +DMStag manages staggered grid discretizations, commonly used in computational fluid dynamics and geophysics. It handles variables defined at different locations (vertices, edges, faces, element centers). + +## Overview + +DMStag provides: +- Staggered grid support for MAC/marker-and-cell schemes +- Multiple degrees of freedom at vertices, edges, faces, and element centers +- Efficient communication for staggered variables +- 1D, 2D, and 3D support +- Boundary type specification + +## Basic Usage Pattern + +```julia +using PETSc, MPI + +petsclib = PETSc.petsclibs[1] +PETSc.initialize(petsclib) + +# Get PETSc types +PetscInt = petsclib.PetscInt + +# Create a 2D staggered grid +# Velocity components on edges, pressure at cell centers +dm = LibPETSc.DMStagCreate2d( + petsclib, + MPI.COMM_WORLD, + LibPETSc.DM_BOUNDARY_NONE, + LibPETSc.DM_BOUNDARY_NONE, + PetscInt(10), PetscInt(10), # global dimensions + PetscInt(LibPETSc.PETSC_DECIDE), + PetscInt(LibPETSc.PETSC_DECIDE), + PetscInt(0), # dof per vertex + PetscInt(1), # dof per edge (velocity) + PetscInt(1), # dof per element (pressure) + LibPETSc.DMSTAG_STENCIL_BOX, + PetscInt(1), # stencil width + C_NULL, C_NULL +) + +# Set up +LibPETSc.DMSetFromOptions(petsclib, dm) +LibPETSc.DMSetUp(petsclib, dm) + +# Create vectors +x = LibPETSc.DMCreateGlobalVector(petsclib, dm) + +# Access staggered components +# Use DMStagGetLocationSlot to get indices for each component + +# Cleanup +LibPETSc.VecDestroy(petsclib, x) +LibPETSc.DMDestroy(petsclib, dm) +PETSc.finalize(petsclib) +``` + +## DMStag Functions + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl"] +Order = [:function] +Filter = t -> startswith(string(nameof(t)), "DMStag") +``` diff --git a/docs/src/man/dmswarm_lowlevel.md b/docs/src/man/dmswarm_lowlevel.md new file mode 100644 index 00000000..a4da6dd5 --- /dev/null +++ b/docs/src/man/dmswarm_lowlevel.md @@ -0,0 +1,86 @@ +# DMSwarm (Particle Methods) + +DMSwarm manages particle-based methods including particle-in-cell (PIC), smoothed particle hydrodynamics (SPH), and general particle simulations. + +## Overview + +DMSwarm provides: +- Dynamic particle creation and migration +- Field registration for particle data +- Particle-mesh coupling +- Particle migration across MPI processes +- Support for PIC and general particle methods +- Cell-based particle management + +## Basic Usage Pattern + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Create a DMSwarm in PIC mode +swarm = LibPETSc.DMCreate(petsclib, MPI.COMM_WORLD) +LibPETSc.DMSetType(petsclib, swarm, "swarm") # String convenience wrapper +# Set the geometric/topological dimension for the swarm (required) +LibPETSc.DMSetDimension(petsclib, swarm, 1) + +# Set swarm type to PIC +LibPETSc.DMSwarmSetType(petsclib, swarm, LibPETSc.DMSWARM_PIC) + +# Create background mesh (here we use a 1D DMDA for simplicity) +da = LibPETSc.DMDACreate1d(petsclib, MPI.COMM_WORLD, LibPETSc.DM_BOUNDARY_NONE, 10, 1, 1, C_NULL) + +# Set the cell DM for PIC +LibPETSc.DMSwarmSetCellDM(petsclib, swarm, da) + +# Register a particle field `velocity` with blocksize 3 (x,y,z components) +LibPETSc.DMSwarmRegisterPetscDatatypeField( + petsclib, swarm, + "velocity", 3, LibPETSc.PETSC_DOUBLE +) + +# Finalize field registration +LibPETSc.DMSwarmFinalizeFieldRegister(petsclib, swarm) + +# Set number of particles +nparticles = 100 +LibPETSc.DMSwarmSetLocalSizes(petsclib, swarm, nparticles, 0) + +# Access and set particle data using DMSwarmGetField / DMSwarmRestoreField +# `DMSwarmGetField` returns the blocksize and fills a pointer to the underlying +# data array. In Julia, pass a `Vector{Ptr{Cvoid}}(undef,1)` and a `Ref{PetscDataType}` +# to receive the out parameters and then wrap the returned pointer with `unsafe_wrap`. +ptr_store = Vector{Ptr{Cvoid}}(undef, 1) +type_store = Ref{LibPETSc.PetscDataType}() +blocksize = LibPETSc.DMSwarmGetField(petsclib, swarm, "velocity", type_store, pointer(ptr_store)) +# `ptr_store[1]` is a pointer to `PetscReal` (Float64 by default) array of length blocksize * nparticles +@assert type_store[] == LibPETSc.PETSC_DOUBLE +data = unsafe_wrap(Array, Ptr{Float64}(ptr_store[1]), (blocksize * nparticles,)) +# Initialize velocity values +for i in 1:length(data) + data[i] = 0.1 * i +end +# Restore the field when done (unlocks internal storage) +LibPETSc.DMSwarmRestoreField(petsclib, swarm, "velocity", type_store, pointer(ptr_store)) + +# Cleanup +LibPETSc.DMDestroy(petsclib, swarm) +LibPETSc.DMDestroy(petsclib, da) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## DMSwarm Functions + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["DM_wrappers.jl"] +Order = [:function] +Filter = t -> startswith(string(nameof(t)), "DMSwarm") +``` diff --git a/docs/src/man/getting_started.md b/docs/src/man/getting_started.md index 394e26e0..73d40011 100644 --- a/docs/src/man/getting_started.md +++ b/docs/src/man/getting_started.md @@ -11,23 +11,29 @@ The easiest way to install the package is: ```julia julia> ] -(@v1.6) pkg> add PETSc +(@v1.12) pkg> add PETSc ``` which will install a pre-built PETSc library (`PETSc_jll`) as well as `MPI.jl` on your system. This will work both in serial and in parallel on your machine. -### 1b. Installation using pre-built libraries -On many high-performance clusters, you will have to use the provided `MPI` installation for that cluster and the default download above will not be sufficient. Alternatively, you may be interested in a PETSc installation that comes with additional external packages. Ensure that this PETSc installation is compiled as a dynamic (and not a static) library, after which you need to set the environmental variable `JULIA_PETSC_LIBRARY` to link to your PETSc installation: +!!! warning "Windows Users" + The prebuild binaries currently do not work on Windows as we had to build `PETSc_jll` without MPI due to compatibility issues with `MicrosoftMPI_jll`. + + **Windows users are therefore advised to install the [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) (WSL) and run PETSc.jl from within WSL.** This will provide full functionality with both serial and parallel (MPI) support. -``` -$export JULIA_PETSC_LIBRARY = /path/to/your/petsc/installation: -``` +### 1b. Installation using pre-built libraries +On many high-performance clusters, you will have to use the provided `MPI` installation for that cluster and the default download above will not be sufficient. Alternatively, you may be interested in a PETSc installation that comes with additional external packages. Ensure that this PETSc installation is compiled as a dynamic (and not a static) library, after which you need to specify the correct library with: -Now rebuild the package: ```julia -julia> ] -pkg> build PETSc +# Create custom library instance +petsclib = set_petsclib("/path/to/custom/libpetsc.so"; + PetscScalar=Float64, PetscInt=Int64) +# Use it like any precompiled library +PETSc.initialize(petsclib, log_view=true) +# ... your code ... +PETSc.finalize(petsclib) ``` + ### 2. Solving a linear system of equations Lets consider the following elliptic equation: @@ -48,28 +54,16 @@ julia> Δx = 1. / (n - 1) Let's first define the matrix with coefficients: ```julia julia> nnz = ones(Int64,n); nnz[2:n-1] .= 3; -julia> A = PETSc.MatSeqAIJ{Float64}(n,n,nnz); +julia> A = PETSc.MatSeqAIJ(petsclib,n,n,nnz); julia> for i=2:n-1 A[i,i-1] = 1/Δx^2 A[i,i ] = -2/Δx^2 A[i,i+1] = 1/Δx^2 end; julia> A[1,1]=1; A[n,n]=1; -julia> PETSc.assemble(A) +julia> PETSc.assemble!(A) julia> A -Mat Object: 1 MPI processes - type: seqaij -row 0: (0, 1.) -row 1: (0, 100.) (1, -200.) (2, 100.) -row 2: (1, 100.) (2, -200.) (3, 100.) -row 3: (2, 100.) (3, -200.) (4, 100.) -row 4: (3, 100.) (4, -200.) (5, 100.) -row 5: (4, 100.) (5, -200.) (6, 100.) -row 6: (5, 100.) (6, -200.) (7, 100.) -row 7: (6, 100.) (7, -200.) (8, 100.) -row 8: (7, 100.) (8, -200.) (9, 100.) -row 9: (8, 100.) (9, -200.) (10, 100.) -row 10: (10, 1.) +PETSc seqaij Mat of size (11, 11) ``` Now, lets define the right-hand-size vector `rhs` as a julia vector: ```julia @@ -134,16 +128,11 @@ f = \binom{ x^2 + x y - 3} {x y + y^2 - 6} In order to solve this, we need to provide a residual function that computes ``f``: ```julia -julia> function F!(cfx, cx, args...) - x = PETSc.unsafe_localarray(Float64, cx; write=false) # read array - fx = PETSc.unsafe_localarray(Float64, cfx; read=false) # write array - - fx[1] = x[1]^2 + x[1]*x[2] - 3 - fx[2] = x[1]*x[2] + x[2]^2 - 6 - - Base.finalize(fx) - Base.finalize(x) - end +julia> function F!(fx, snes, x) + fx[1] = x[1]^2 + x[1] * x[2] - 3 + fx[2] = x[1] * x[2] + x[2]^2 - 6 + return PetscInt(0) # petsc success + end ``` In addition, we need to provide the Jacobian: @@ -161,31 +150,35 @@ y & x + 2y \\ ``` In Julia, this is: ```julia -julia> function updateJ!(cx, J, args...) - x = PETSc.unsafe_localarray(Float64, cx; write=false) - J[1,1] = 2x[1] + x[2] - J[1,2] = x[1] - J[2,1] = x[2] - J[2,2] = x[1] + 2x[2] - Base.finalize(x) - PETSc.assemble(J) +julia> function updateJ!(J, snes, x) + J[1, 1] = 2x[1] + x[2] + J[1, 2] = x[1] + J[2, 1] = x[2] + J[2, 2] = x[1] + 2x[2] + + PETSc.assemble!(J) + return PetscInt(0) end ``` In order to solve this using the PETSc nonlinear equation solvers, you first define the `SNES` solver together with the jacobian and residual functions as ```julia julia> using PETSc, MPI -julia> S = PETSc.SNES{Float64}(petsclib,MPI.COMM_SELF; ksp_rtol=1e-4, pc_type="none") -julia> PETSc.setfunction!(S, F!, PETSc.VecSeq(zeros(2))) +julia> snes = PETSc.SNES(petsclib,MPI.COMM_SELF; ksp_rtol=1e-4, pc_type="none") +julia> r = LibPETSc.VecSeq(petsclib, zeros(PetscScalar, 2)) +julia> PETSc.setfunction!(snes, F!, r) julia> J = zeros(2,2) -julia> PJ = PETSc.MatSeqDense(J) -julia> PETSc.setjacobian!(S, updateJ!, PJ, PJ) +julia> PJ = PETSc.MatSeqDense(petsclib,J) +julia> PETSc.setjacobian!(updateJ!, snes, PJ) ``` You can solve this as: ```julia -julia> PETSc.solve!([2.0,3.0], S) +julia> x = PETSc.VecSeq(petsclib, [2.0, 3.0]) +julia> b = PETSc.VecSeq(petsclib, [0.0, 0.0]) +julia> PETSc.solve!(x, snes, b) +julia> x[:] 2-element Vector{Float64}: - 1.000000003259629 - 1.999999998137355 + 2.0 + 3.0 ``` -which indeed recovers the analytical solution ``(x=1, y=2)``. +which indeed recovers the analytical solution ``(x=1, y=2)``. \ No newline at end of file diff --git a/docs/src/man/is_lowlevel.md b/docs/src/man/is_lowlevel.md new file mode 100644 index 00000000..4cd89fcc --- /dev/null +++ b/docs/src/man/is_lowlevel.md @@ -0,0 +1,152 @@ +# IS (Index Sets) - Low-level Interface + +The IS (Index Set) component provides data structures and operations for managing sets of indices, which are fundamental for parallel data distribution, matrix/vector assembly, and mapping between different numbering schemes. + +## Overview + +Index sets are used throughout PETSc for: +- **Parallel data distribution**: Specifying which indices are owned by each processor +- **Submatrix/subvector extraction**: Selecting specific rows/columns +- **Scatter/gather operations**: Defining communication patterns +- **Field splitting**: Identifying DOFs belonging to different fields +- **Reordering**: Specifying permutations for bandwidth reduction + +PETSc provides several IS types: +- **General IS**: Arbitrary list of indices +- **Stride IS**: Regularly spaced indices (start, step, length) +- **Block IS**: Block-structured indices +- **Complement IS**: All indices except specified ones + +## Basic Usage + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Get PETSc types +PetscInt = petsclib.PetscInt + +# Create an index set from an array of indices (0-based) +# Note: indices should be PetscInt type (typically Int64 or Int32 depending on PETSc configuration) +indices = PetscInt[0, 2, 4, 6, 8] +is = LibPETSc.ISCreateGeneral(petsclib, LibPETSc.PETSC_COMM_SELF, PetscInt(length(indices)), indices, LibPETSc.PETSC_COPY_VALUES) + +# Create a stride index set: indices = first:step:(first + step*(n-1)) +is_stride = LibPETSc.ISCreateStride(petsclib, LibPETSc.PETSC_COMM_SELF, PetscInt(10), PetscInt(0), PetscInt(2)) # 0, 2, 4, ..., 18 + +# Get the size of an index set (returns value directly) +n = LibPETSc.ISGetSize(petsclib, is) + +# Get local size (returns value directly) +local_n = LibPETSc.ISGetLocalSize(petsclib, is) + +# Get indices as an array +indices = LibPETSc.ISGetIndices(petsclib, is) +# ... use indices ... +LibPETSc.ISRestoreIndices(petsclib, is, indices) + +# Cleanup +LibPETSc.ISDestroy(petsclib, is) +LibPETSc.ISDestroy(petsclib, is_stride) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Common Operations + +### Creating Index Sets + +```julia +# General index set from array +LibPETSc.ISCreateGeneral(petsclib, comm, n, indices, copymode, is) + +# Stride index set: first, first+step, first+2*step, ... +LibPETSc.ISCreateStride(petsclib, comm, n, first, step, is) + +# Block index set: block-structured indices +LibPETSc.ISCreateBlock(petsclib, comm, blocksize, n, indices, copymode, is) +``` + +### Set Operations + +```julia +# Union of two index sets +LibPETSc.ISSum(petsclib, is1, is2, is_union) + +# Difference: is1 - is2 +LibPETSc.ISDifference(petsclib, is1, is2, is_diff) + +# Intersection +LibPETSc.ISIntersect(petsclib, is1, is2, is_intersect) + +# Complement: all indices in [0, n) not in is +LibPETSc.ISComplement(petsclib, is, nmin, nmax, is_complement) +``` + +### Querying Properties + +```julia +# Check if index set is sorted +is_sorted = Ref{PetscBool}() +LibPETSc.ISSorted(petsclib, is, is_sorted) + +# Check if identity permutation +is_identity = Ref{PetscBool}() +LibPETSc.ISIdentity(petsclib, is, is_identity) + +# Check if a permutation +is_perm = Ref{PetscBool}() +LibPETSc.ISPermutation(petsclib, is, is_perm) +``` + +## Index Set Types + +Available through `ISSetType`: +- **ISGENERAL**: General list of indices +- **ISSTRIDE**: Arithmetic sequence +- **ISBLOCK**: Block-structured indices + +## Scatter Context + +Index sets are used to create scatter contexts for moving data between vectors: + +```julia +# Create scatter context +scatter = Ref{LibPETSc.VecScatter}() +LibPETSc.VecScatterCreate(petsclib, vec_from, is_from, vec_to, is_to, scatter) + +# Perform scatter operation +LibPETSc.VecScatterBegin(petsclib, scatter[], vec_from, vec_to, INSERT_VALUES, SCATTER_FORWARD) +LibPETSc.VecScatterEnd(petsclib, scatter[], vec_from, vec_to, INSERT_VALUES, SCATTER_FORWARD) +``` + +## Parallel Considerations + +- Index sets use global indexing by default +- Each processor owns a portion of the index set +- Use `ISGetLocalSize` to get the local portion +- Scatter operations handle parallel communication automatically + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/IS_wrappers.jl"] +Order = [:function] +``` + +## IS Add-ons + +Additional IS utilities and helper functions: + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/ISaddons_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/ksp.md b/docs/src/man/ksp.md index 0558c889..9c48965e 100644 --- a/docs/src/man/ksp.md +++ b/docs/src/man/ksp.md @@ -1,6 +1,101 @@ # KSP -The following KSP routines are available: +The KSP (Krylov Subspace Methods) module provides iterative linear solvers for systems of the form `Ax = b`. PETSc offers a wide variety of Krylov methods and preconditioners. + +## Overview + +KSP provides: +- **Krylov methods**: GMRES, CG, BiCGStab, and many more +- **Preconditioners**: Jacobi, ILU, multigrid, direct solvers, etc. +- **Runtime configuration**: Choose methods via command-line options +- **Convergence monitoring**: Built-in residual tracking + +## Creating a KSP Solver + +### From a Matrix + +```julia +# Basic creation with default options +ksp = KSP(A) + +# With preconditioner matrix P (for different preconditioning) +ksp = KSP(A, P) + +# With options +ksp = KSP(A; + ksp_type = "gmres", + pc_type = "ilu", + ksp_rtol = 1e-8 +) +``` + +### From a DM + +```julia +# Create KSP associated with a DM (for multigrid, etc.) +ksp = KSP(dm; + ksp_type = "cg", + pc_type = "mg" +) +``` + +### From a Sparse Matrix + +```julia +# Directly from Julia SparseMatrixCSC +using SparseArrays +S = sprand(100, 100, 0.1) + 10I +ksp = KSP(petsclib, MPI.COMM_SELF, S) +``` + +## Solving + +```julia +# Solve Ax = b +solve!(x, ksp, b) + +# Or allocate solution vector +x = solve(ksp, b) +``` + +## Common Solver/Preconditioner Options + +### Krylov Methods (`ksp_type`) +- `cg` - Conjugate Gradient (symmetric positive definite) +- `gmres` - Generalized Minimum Residual +- `bicgstab` - BiConjugate Gradient Stabilized +- `richardson` - Richardson iteration +- `preonly` - Apply preconditioner only (for direct solvers) + +### Preconditioners (`pc_type`) +- `jacobi` - Diagonal scaling +- `ilu` - Incomplete LU factorization +- `lu` - Direct LU factorization +- `mg` - Geometric multigrid +- `gamg` - Algebraic multigrid +- `none` - No preconditioning + +### Convergence Options +- `ksp_rtol` - Relative tolerance (default: 1e-5) +- `ksp_atol` - Absolute tolerance +- `ksp_max_it` - Maximum iterations +- `ksp_monitor` - Print residual each iteration + +## Example: Multigrid Solver + +```julia +ksp = KSP(dm; + ksp_type = "cg", + pc_type = "mg", + pc_mg_levels = 4, + pc_mg_galerkin = true, + mg_levels_ksp_type = "richardson", + mg_levels_pc_type = "jacobi", + mg_coarse_pc_type = "lu" +) +``` + +## Functions ```@autodocs Modules = [PETSc] diff --git a/docs/src/man/ksp_lowlevel.md b/docs/src/man/ksp_lowlevel.md new file mode 100644 index 00000000..9b5d178b --- /dev/null +++ b/docs/src/man/ksp_lowlevel.md @@ -0,0 +1,53 @@ +# KSP - Low-level Interface + +This page documents the low-level, automatically wrapped PETSc KSP (Krylov Subspace Methods) functions available through `LibPETSc`. These functions provide direct access to the PETSc C API. + +For the high-level Julia interface, see [KSP](@ref). + +## Overview + +The KSP interface includes: +- **Core KSP operations**: Linear solver creation, configuration, and solution (~244 functions in `KSP_wrappers.jl`) +- **KSPGuess**: Initial guess generation for iterative solvers (~12 functions in `KSPGuess_wrappers.jl`) + +## Usage + +All low-level KSP functions require a `petsclib` parameter as the first argument: + +```julia +using PETSc + +# Get the library instance +petsclib = PETSc.petsclibs[1] +PETSc.initialize(petsclib) + +# Get PETSc types +PetscInt = petsclib.PetscInt + +# Assume mat, b, x are already created + +# Create KSP solver +ksp = LibPETSc.KSPCreate(petsclib, LibPETSc.PETSC_COMM_SELF) +LibPETSc.KSPSetOperators(petsclib, ksp, mat, mat) +LibPETSc.KSPSetFromOptions(petsclib, ksp) + +# Solve Ax = b +LibPETSc.KSPSolve(petsclib, ksp, b, x) + +# Get convergence info +reason = LibPETSc.KSPGetConvergedReason(petsclib, ksp) + +iterations = LibPETSc.KSPGetIterationNumber(petsclib, ksp) + +# Clean up +LibPETSc.KSPDestroy(petsclib, ksp) +PETSc.finalize(petsclib) +``` + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/KSP_wrappers.jl", "autowrapped/KSPGuess_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/listfunctions.md b/docs/src/man/listfunctions.md deleted file mode 100644 index 5b84847c..00000000 --- a/docs/src/man/listfunctions.md +++ /dev/null @@ -1,23 +0,0 @@ -# List of all functions - -Here a summary of all functions: - -```@index -``` - - ```@meta -CurrentModule = PETSc -``` - -```@autodocs -Modules = [PETSc] -``` - -```@index -Pages = ["vec.md", "mat.md"] -``` - -```@autodocs -Modules = [PETSc] -Order = [:function] -``` diff --git a/docs/src/man/lowlevel_intro.md b/docs/src/man/lowlevel_intro.md new file mode 100644 index 00000000..8d838c0c --- /dev/null +++ b/docs/src/man/lowlevel_intro.md @@ -0,0 +1,314 @@ +# Low-Level Interface (LibPETSc) + +PETSc.jl provides two ways to interact with the PETSc library: + +1. **High-level interface**: Julia-friendly wrappers that handle memory management, use 1-based indexing, and provide convenient syntax (e.g., `A[1,2] = 3.0`) +2. **Low-level interface** (`LibPETSc`): Direct access to nearly the entire PETSc C API (~13,000+ functions) + +This guide focuses on the low-level interface. + +## When to Use the Low-Level Interface + +Use the low-level `LibPETSc` interface when: + +- You need PETSc functionality not yet wrapped in the high-level interface +- You're porting existing PETSc C/Fortran code to Julia +- You need fine-grained control over PETSc objects +- You want to access advanced or experimental PETSc features +- Performance-critical code requires eliminating Julia wrapper overhead + +For most common tasks (creating vectors/matrices, solving linear systems), the high-level interface is recommended. + +## Basic Usage Pattern + +The low-level interface follows the PETSc C API closely. All functions require a `petsclib` parameter as the first argument: + +```julia +using PETSc + +# Get a library instance (usually you'll use the first one) +petsclib = PETSc.petsclibs[1] + +# Initialize PETSc +PETSc.initialize(petsclib) + +# Create and use PETSc objects +vec = LibPETSc.VecCreate(petsclib, LibPETSc.PETSC_COMM_SELF) +LibPETSc.VecSetSizes(petsclib, vec, 10, 10) +LibPETSc.VecSetType(petsclib, vec, "seq") # Set vector type +LibPETSc.VecSetFromOptions(petsclib, vec) + +# Work with the vector +LibPETSc.VecSet(petsclib, vec, 1.0) +println("Vector size: ", LibPETSc.VecGetSize(petsclib, vec)) + +# Clean up +LibPETSc.VecDestroy(petsclib, vec) +PETSc.finalize(petsclib) +``` + +## Key Concepts + +### 1. The `petsclib` Parameter + +Every low-level function requires a `petsclib` instance. This specifies which PETSc library variant to use (e.g., Float64 vs Float32, Int32 vs Int64): + +```julia +# Default libraries available (uses prebuilt PETSc binaries) +petsclib = PETSc.petsclibs[1] # Usually Float64, Int64 + +# Access the scalar and integer types +PetscScalar = petsclib.PetscScalar # The floating-point type (e.g., Float64) +PetscInt = petsclib.PetscInt # The integer type (e.g., Int64) +PetscReal = petsclib.PetscReal # The real type (real part of PetscScalar) +``` + +#### Using a Custom PETSc Build + +You can link to your own custom build of PETSc instead of using the prebuilt binaries. This is useful when you need: +- Specific configure options not available in the default build +- Custom optimizations for your hardware +- Debug builds for troubleshooting +- Integration with specific external packages + +To use a custom PETSc installation: + +```julia +using PETSc + +# Create a custom library instance pointing to your PETSc installation +petsclib = PETSc.set_petsclib("/path/to/your/libpetsc.so"; + PetscScalar=Float64, + PetscInt=Int64) + +# Initialize and use as normal +PETSc.initialize(petsclib) + +# ... your code using petsclib ... + +PETSc.finalize(petsclib) +``` + +**Important notes for custom builds:** +- The dynamic library path should point to `libpetsc.so` (Linux), `libpetsc.dylib` (macOS), or `libpetsc.dll` (Windows) +- The `PetscScalar` and `PetscInt` types must match how your PETSc was configured +- Your custom PETSc must be compatible with the MPI version used by `MPI.jl` +- You can check available precompiled libraries with `[PETSc.petsclibs...]` + +### 2. Zero-Based Indexing + +**Important**: The low-level interface uses 0-based indexing (C convention), while Julia uses 1-based indexing: + +```julia +# Low-level (0-based) +indices = PetscInt[0, 1, 2] # First three elements +LibPETSc.VecSetValues(petsclib, vec, 3, indices, values, INSERT_VALUES) + +# High-level (1-based) +vec[1] = value # First element +``` + +### 3. Error Handling + +Low-level functions return `PetscErrorCode`. Use the `@chk` macro to check for errors: + +```julia +using PETSc.LibPETSc: @chk + +err = LibPETSc.VecCreate(petsclib, MPI.COMM_SELF) +@chk err # Throws an error if PETSc returned non-zero +``` + +### 4. String Convenience Wrappers + +Many PETSc `SetType` functions accept C string pointers. For convenience, PETSc.jl provides Julia `String` overloads: + +```julia +# String convenience wrapper (recommended) +LibPETSc.MatSetType(petsclib, mat, "seqaij") +LibPETSc.VecSetType(petsclib, vec, "seq") +LibPETSc.KSPSetType(petsclib, ksp, "gmres") +LibPETSc.SNESSetType(petsclib, snes, "newtonls") +LibPETSc.PCSetType(petsclib, pc[], "ilu") +LibPETSc.TSSetType(petsclib, ts, "bdf") +LibPETSc.TaoSetType(petsclib, tao, "lmvm") +LibPETSc.DMSetType(petsclib, dm, "da") +LibPETSc.PetscViewerSetType(petsclib, viewer, "ascii") + +# Equivalent low-level C pointer syntax (not recommended unless necessary) +ptr = Base.unsafe_convert(Ptr{Int8}, pointer(Vector{UInt8}("seqaij\0"))) +LibPETSc.MatSetType(petsclib, mat, ptr) +``` + +The string wrappers handle the C string conversion internally, making the code cleaner and more Julia-friendly. + +Most wrapper functions already include error checking, but when calling C functions directly, use `@chk`. + +### 4. Memory Management + +PETSc objects created with `Create` functions must be destroyed with corresponding `Destroy` functions: + +```julia +# Create +mat = LibPETSc.MatCreate(petsclib, MPI.COMM_WORLD) +LibPETSc.MatSetSizes(petsclib, mat, m_local, n_local, m_global, n_global) + +# ... use mat ... + +# Destroy when done +LibPETSc.MatDestroy(petsclib, mat) +``` + +For serial (single-process) objects, the high-level interface handles this automatically via finalizers. + +### 5. Assembly + +After setting values in vectors or matrices, you must call assembly functions: + +```julia +# Set values +LibPETSc.VecSetValues(petsclib, vec, n, indices, values, INSERT_VALUES) + +# Assemble +LibPETSc.VecAssemblyBegin(petsclib, vec) +LibPETSc.VecAssemblyEnd(petsclib, vec) +``` + +## Common Patterns + +### Creating and Filling a Vector + +```julia +petsclib = PETSc.petsclibs[1] +PetscInt = petsclib.PetscInt +PetscScalar = petsclib.PetscScalar + +# Create vector +vec = LibPETSc.VecCreate(petsclib, MPI.COMM_SELF) +LibPETSc.VecSetSizes(petsclib, vec, 10, 10) +LibPETSc.VecSetType(petsclib, vec, "seq") # Set vector type +LibPETSc.VecSetFromOptions(petsclib, vec) + +# Set values (0-based indices!) +indices = PetscInt[0, 1, 2, 3, 4] +values = PetscScalar[1.0, 2.0, 3.0, 4.0, 5.0] +LibPETSc.VecSetValues(petsclib, vec, 5, indices, values, INSERT_VALUES) + +# Assemble +LibPETSc.VecAssemblyBegin(petsclib, vec) +LibPETSc.VecAssemblyEnd(petsclib, vec) + +# View (print to stdout) +LibPETSc.VecView(petsclib, vec, C_NULL) + +# Clean up +LibPETSc.VecDestroy(petsclib, vec) +``` + +### Creating a Sparse Matrix + +```julia +# Create matrix +mat = LibPETSc.MatCreate(petsclib, MPI.COMM_SELF) +LibPETSc.MatSetSizes(petsclib, mat, 5, 5, 5, 5) +LibPETSc.MatSetType(petsclib, mat, "seqaij") # String convenience wrapper +LibPETSc.MatSetUp(petsclib, mat) + +# Set values (0-based indexing!) +row = PetscInt[0] +cols = PetscInt[0, 1] +vals = PetscScalar[2.0, -1.0] +LibPETSc.MatSetValues(petsclib, mat, 1, row, 2, cols, vals, INSERT_VALUES) + +# Assemble +LibPETSc.MatAssemblyBegin(petsclib, mat, LibPETSc.MAT_FINAL_ASSEMBLY) +LibPETSc.MatAssemblyEnd(petsclib, mat, LibPETSc.MAT_FINAL_ASSEMBLY) + +# View +LibPETSc.MatView(petsclib, mat, C_NULL) + +# Clean up +LibPETSc.MatDestroy(petsclib, mat) +``` + +### Solving a Linear System + +```julia +# Create KSP solver +ksp = LibPETSc.KSPCreate(petsclib, MPI.COMM_SELF) +LibPETSc.KSPSetOperators(petsclib, ksp, mat, mat) +LibPETSc.KSPSetFromOptions(petsclib, ksp) + +# Solve Ax = b +LibPETSc.KSPSolve(petsclib, ksp, b, x) + +# Get convergence info +reason = LibPETSc.KSPGetConvergedReason(petsclib, ksp) + +iterations = LibPETSc.KSPGetIterationNumber(petsclib, ksp) + +println("Converged in $(iterations) iterations, reason: $(reason)") + +# Clean up +LibPETSc.KSPDestroy(petsclib, ksp) +``` + +## Mixing High-Level and Low-Level Interfaces + +You can mix both interfaces. High-level objects provide `.ptr` field to access the underlying C pointer: + +```julia +# Create with high-level interface +vec_high = VecSeq(petsclib, 10) + +# Use with low-level interface +LibPETSc.VecSet(petsclib, vec_high.ptr, 5.0) + +# Or use the object directly (if it's a compatible type) +LibPETSc.VecView(petsclib, vec_high, C_NULL) +``` + +## Finding Functions + +The low-level interface provides wrappers for most PETSc functions. To find a function: + +1. **Check the PETSc manual**: https://petsc.org/release/docs/ +2. **Use Julia's help system**: Type `?LibPETSc.FunctionName` +3. **Browse the documentation**: See the reference pages for each PETSc class (Vec, Mat, KSP, etc.) +4. **Autocomplete**: In the REPL, type `LibPETSc.Vec` and press Tab to see all Vec functions + +## Type Conventions + +Low-level functions use these type patterns: + +```julia +# PETSc objects (opaque pointers) +CVec = Ptr{Cvoid} # Vector +CMat = Ptr{Cvoid} # Matrix +CDM = Ptr{Cvoid} # DM (domain management) +CKSP = Ptr{Cvoid} # KSP (linear solver) +CSNES = Ptr{Cvoid} # SNES (nonlinear solver) + +# PETSc data types (depend on petsclib) +PetscInt # Integer type (Int32 or Int64) +PetscScalar # Scalar type (Float64, Float32, ComplexF64, etc.) +PetscReal # Real type (real part of PetscScalar) +``` + +## Reference Pages + +Detailed documentation for low-level functions by category: + +- [Vec (Vectors)](@ref vec_lowlevel.md) - ~293 functions for vector operations +- [Mat (Matrices)](@ref mat_lowlevel.md) - ~756 functions for matrix operations +- [KSP (Linear Solvers)](@ref ksp_lowlevel.md) - ~256 functions for iterative linear solvers +- [SNES (Nonlinear Solvers)](@ref snes_lowlevel.md) - ~333 functions for nonlinear solvers + +## Getting Help + +If you encounter issues: + +1. Check the [PETSc documentation](https://petsc.org/release/docs/) +2. Review the [examples](https://github.com/JuliaParallel/PETSc.jl/tree/main/examples) +3. Ask questions on [Julia Discourse](https://discourse.julialang.org/) with the `petsc` tag +4. Open an issue on [GitHub](https://github.com/JuliaParallel/PETSc.jl/issues) diff --git a/docs/src/man/mat.md b/docs/src/man/mat.md index dfed24cb..abc88ec3 100644 --- a/docs/src/man/mat.md +++ b/docs/src/man/mat.md @@ -1,6 +1,91 @@ # Mat -The following `Mat` routines are available: +PETSc matrices (`Mat`) provide sparse and dense matrix storage with efficient parallel operations. They are essential for discretizing PDEs and setting up linear/nonlinear systems. + +## Overview + +PETSc matrices support: +- **Sparse formats**: AIJ (CSR), BAIJ (block CSR), and more +- **Dense format**: For small matrices or dense operations +- **Parallel distribution**: Row-based distribution across MPI processes +- **Matrix-free operations**: Via MatShell for custom operators + +## Creating Matrices + +### Sparse Matrices (AIJ/CSR Format) + +```julia +# Create sparse matrix with estimated non-zeros per row +A = MatSeqAIJ(petsclib, num_rows, num_cols, nnz_per_row) + +# From Julia SparseMatrixCSC +using SparseArrays +S = sprand(100, 100, 0.1) +A = MatCreateSeqAIJ(petsclib, MPI.COMM_SELF, S) + +# With varying non-zeros per row +nnz = PetscInt[5, 3, 4, ...] # One value per row +A = MatSeqAIJ(petsclib, num_rows, num_cols, nnz) +``` + +### Dense Matrices + +```julia +# Wrap a Julia matrix (no copy) +julia_mat = rand(10, 10) +A = MatSeqDense(petsclib, julia_mat) +``` + +### From DM Objects + +```julia +# Create matrix with sparsity pattern from DM +A = DMCreateMatrix(dm) +``` + +### Matrix Shell (Matrix-Free) + +```julia +# Create a shell matrix with custom mult operation +A = MatShell(petsclib, m, n, mult_function, context) +``` + +## Setting Values + +```julia +# Set individual element (0-based internally, 1-based in Julia) +A[i, j] = value + +# Use setvalues! for efficient batch insertion +setvalues!(A, rows, cols, values, INSERT_VALUES) + +# For stencil-based assembly +setvalues!(A, stencil_row, stencil_col, value, INSERT_VALUES) +``` + +## Assembly + +Matrices must be assembled after setting values: + +```julia +# Set all values first +A[1, 1] = 2.0 +A[1, 2] = -1.0 +# ... + +# Then assemble +assemble!(A) +``` + +## Common Operations + +```julia +size(A) # Get (rows, cols) +ownershiprange(A) # Get rows owned by this process +setup!(A) # Complete matrix setup +``` + +## Functions ```@autodocs Modules = [PETSc] diff --git a/docs/src/man/mat_lowlevel.md b/docs/src/man/mat_lowlevel.md new file mode 100644 index 00000000..70183ae2 --- /dev/null +++ b/docs/src/man/mat_lowlevel.md @@ -0,0 +1,55 @@ +# Mat - Low-level Interface + +This page documents the low-level, automatically wrapped PETSc Mat (matrix) functions available through `LibPETSc`. These functions provide direct access to the PETSc C API. + +For the high-level Julia interface, see [Mat](@ref). + +## Overview + +The Mat interface includes: +- **Core Mat operations**: Creation, manipulation, and mathematical operations on matrices (~632 functions in `Mat_wrappers.jl`) +- **Mat utilities**: Additional matrix operations and conversions (~124 functions in `Mataddons_wrappers.jl`) + +## Usage + +All low-level Mat functions require a `petsclib` parameter as the first argument: + +```julia +using PETSc + +# Get the library instance +petsclib = PETSc.petsclibs[1] +PETSc.initialize(petsclib) + +# Get PETSc types +PetscInt = petsclib.PetscInt +PetscScalar = petsclib.PetscScalar + +# Create a sparse matrix +mat = LibPETSc.MatCreate(petsclib, LibPETSc.PETSC_COMM_SELF) +LibPETSc.MatSetSizes(petsclib, mat, PetscInt(10), PetscInt(10), PetscInt(10), PetscInt(10)) +LibPETSc.MatSetType(petsclib, mat, "seqaij") +LibPETSc.MatSetUp(petsclib, mat) + +# Set values (0-based indexing!) +row = PetscInt[0] +cols = PetscInt[0, 1] +vals = PetscScalar[2.0, -1.0] +LibPETSc.MatSetValues(petsclib, mat, PetscInt(1), row, PetscInt(2), cols, vals, LibPETSc.INSERT_VALUES) + +# Assemble +LibPETSc.MatAssemblyBegin(petsclib, mat, LibPETSc.MAT_FINAL_ASSEMBLY) +LibPETSc.MatAssemblyEnd(petsclib, mat, LibPETSc.MAT_FINAL_ASSEMBLY) + +# Clean up +LibPETSc.MatDestroy(petsclib, mat) +PETSc.finalize(petsclib) +``` + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/Mat_wrappers.jl", "autowrapped/Mataddons_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/pc_lowlevel.md b/docs/src/man/pc_lowlevel.md new file mode 100644 index 00000000..e8c4d4e9 --- /dev/null +++ b/docs/src/man/pc_lowlevel.md @@ -0,0 +1,176 @@ +# PC (Preconditioners) - Low-level Interface + +The PC (Preconditioner) component provides methods for preconditioning linear systems to accelerate the convergence of iterative solvers. Preconditioners are essential for efficiently solving large sparse linear systems with KSP. + +## Overview + +Preconditioners transform the linear system $Ax = b$ into an equivalent system that is easier to solve iteratively. PETSc provides a wide variety of preconditioners: + +- **Basic methods**: Jacobi, block Jacobi, SOR, ILU, ICC +- **Multigrid**: Algebraic multigrid (GAMG, HYPRE BoomerAMG), geometric multigrid (MG) +- **Domain decomposition**: Additive Schwarz (ASM), block Jacobi with local solves +- **Direct solvers**: LU, Cholesky (using external packages like MUMPS, SuperLU, UMFPACK) +- **Sparse approximations**: ILU(k), ICC(k), approximate inverses +- **Physics-based**: Field-split, composite preconditioners for coupled systems +- **Matrix-free**: Shell preconditioners for matrix-free implementations + +The PC object can be used standalone or automatically by KSP during the solution process. + +## Basic Usage + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Create a PC object +pc = Ref{LibPETSc.PC}() +LibPETSc.PCCreate(petsclib, LibPETSc.PETSC_COMM_SELF, pc) + +# Set the preconditioner type +LibPETSc.PCSetType(petsclib, pc[], "ilu") # String convenience wrapper + +# Set the operator matrix +# LibPETSc.PCSetOperators(petsclib, pc[], A, A) + +# Configure preconditioner-specific options +# For ILU: set fill level +# LibPETSc.PCFactorSetLevels(petsclib, pc[], 2) + +# Set options from command line/options database +LibPETSc.PCSetFromOptions(petsclib, pc[]) + +# Set up the preconditioner +LibPETSc.PCSetUp(petsclib, pc[]) + +# Apply the preconditioner: y = P^{-1} x +# LibPETSc.PCApply(petsclib, pc[], x_vec, y_vec) + +# Cleanup +LibPETSc.PCDestroy(petsclib, pc) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Integration with KSP + +Preconditioners are typically used with KSP solvers: + +```julia +# Create KSP and get its PC +ksp = Ref{LibPETSc.KSP}() +LibPETSc.KSPCreate(petsclib, LibPETSc.PETSC_COMM_SELF, ksp) + +pc = Ref{LibPETSc.PC}() +LibPETSc.KSPGetPC(petsclib, ksp[], pc) + +# Configure the preconditioner +LibPETSc.PCSetType(petsclib, pc[], "gamg") # String convenience wrapper + +# For GAMG, set additional options +LibPETSc.PCGAMGSetType(petsclib, pc[], LibPETSc.PCGAMGAGG) +LibPETSc.PCGAMGSetNlevels(petsclib, pc[], 10) +``` + +## Common Preconditioner Types + +Available through `PCSetType`: + +### Direct Solvers +- `PCLU`: LU factorization +- `PCCHOLESKY`: Cholesky factorization (symmetric positive definite) +- `PCQR`: QR factorization + +### Incomplete Factorizations +- `PCILU`: Incomplete LU factorization +- `PCICC`: Incomplete Cholesky factorization +- Configure fill with `PCFactorSetLevels` + +### Iterative/Relaxation Methods +- `PCJACOBI`: Jacobi (diagonal scaling) +- `PCSOR`: Successive over-relaxation +- `PCPBJACOBI`: Point-block Jacobi +- `PCBJACOBI`: Block Jacobi with local solves + +### Multigrid Methods +- `PCMG`: Geometric multigrid +- `PCGAMG`: Algebraic multigrid (PETSc's built-in) +- `PCHYPRE`: HYPRE preconditioners (BoomerAMG, ParaSails, etc.) +- `PCML`: ML algebraic multigrid (Trilinos) + +### Domain Decomposition +- `PCASM`: Additive Schwarz method +- `PCGASM`: Generalized additive Schwarz +- `PCBDDC`: Balancing domain decomposition by constraints + +### Physics-Based +- `PCFIELDSPLIT`: Field-split for coupled systems +- `PCLSC`: Least-squares commutators (for saddle-point problems) +- `PCCOMPOSITE`: Combine multiple preconditioners + +### Special Purpose +- `PCSHELL`: User-defined shell preconditioner +- `PCNONE`: No preconditioning (identity) +- `PCKSP`: Use another KSP as preconditioner +- `PCREDISTRIBUTE`: Redistribute matrix for better load balancing + +## Multigrid Configuration + +For geometric multigrid (PCMG): +```julia +LibPETSc.PCSetType(petsclib, pc[], LibPETSc.PCMG) +LibPETSc.PCMGSetLevels(petsclib, pc[], nlevels, C_NULL) +# Set up grid hierarchy, smoothers, coarse solver +``` + +For algebraic multigrid (PCGAMG): +```julia +LibPETSc.PCSetType(petsclib, pc[], LibPETSc.PCGAMG) +LibPETSc.PCGAMGSetType(petsclib, pc[], LibPETSc.PCGAMGAGG) # Aggregation +LibPETSc.PCGAMGSetNSmooths(petsclib, pc[], 1) +LibPETSc.PCGAMGSetThreshold(petsclib, pc[], [0.0], 1) +``` + +## Field Split for Coupled Systems + +For systems with multiple fields (e.g., velocity-pressure): +```julia +LibPETSc.PCSetType(petsclib, pc[], LibPETSc.PCFIELDSPLIT) +LibPETSc.PCFieldSplitSetType(petsclib, pc[], LibPETSc.PC_COMPOSITE_SCHUR) + +# Define fields using index sets +# LibPETSc.PCFieldSplitSetIS(petsclib, pc[], "velocity", velocity_is) +# LibPETSc.PCFieldSplitSetIS(petsclib, pc[], "pressure", pressure_is) +``` + +## External Solver Packages + +PETSc can use external direct solver packages: +- **MUMPS**: Parallel direct solver +- **SuperLU**: Sparse direct solver +- **UMFPACK**: Unsymmetric multifrontal solver +- **Pardiso**: Intel MKL parallel direct solver +- **STRUMPACK**: Structured sparse solver + +Set via `PCFactorSetMatSolverType` after choosing `PCLU` or `PCCHOLESKY`. + +## Performance Considerations + +- **Jacobi/Block Jacobi**: Fast to apply, limited effectiveness +- **ILU/ICC**: Good for moderately difficult problems, configure fill with `PCFactorSetLevels` +- **AMG**: Excellent for elliptic PDEs, automatic coarse grid construction +- **Direct solvers**: Robust but memory-intensive for large 3D problems +- **Field split**: Essential for coupled multi-physics problems + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/PC_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/petscsection_lowlevel.md b/docs/src/man/petscsection_lowlevel.md new file mode 100644 index 00000000..823c7d2a --- /dev/null +++ b/docs/src/man/petscsection_lowlevel.md @@ -0,0 +1,204 @@ +# PetscSection - Low-level Interface + +The PetscSection component provides a flexible mechanism for describing the layout of degrees of freedom (DOFs) in a discretization, particularly for finite element methods and other multi-field problems where different points have different numbers of DOFs. + +## Overview + +PetscSection is used to: +- **Define DOF layouts**: Specify how many DOFs exist at each point (vertex, edge, face, cell) +- **Multi-field problems**: Handle systems with multiple variables per point +- **Local-to-global mapping**: Convert between local and global numbering +- **FEM discretizations**: Manage DOF distributions for finite elements +- **DM integration**: Work with DM objects for mesh-based computations + +A section maps from points (mesh entities like vertices, cells) to DOF ranges, answering: +- How many DOFs are at point `p`? +- What is the offset of the DOFs for point `p`? +- Which field do specific DOFs belong to? + +## Basic Usage + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) +PetscInt = petsclib.PetscInt + +# Create a section +section = Ref{LibPETSc.PetscSection}() +LibPETSc.PetscSectionCreate(petsclib, LibPETSc.PETSC_COMM_SELF, section) + +# Set chart: range of valid point indices [pStart, pEnd) +LibPETSc.PetscSectionSetChart(petsclib, section[], 0, 10) + +# Set DOF count for each point +for p in 0:9 + num_dofs = (p < 4) ? 1 : 2 # Different DOFs per point + LibPETSc.PetscSectionSetDof(petsclib, section[], p, num_dofs) +end + +# Setup: compute offsets +LibPETSc.PetscSectionSetUp(petsclib, section[]) + +# Query the section +dof = LibPETSc.PetscSectionGetDof(petsclib, section[], 5) +println("DOF count for point 5: ", dof) + +offset = LibPETSc.PetscSectionGetOffset(petsclib, section[], 5) +println("Offset for point 5: ", offset) + +# Get total storage size +storage_size = LibPETSc.PetscSectionGetStorageSize(petsclib, section[]) +println("Total storage size: ", storage_size) + +# Cleanup +LibPETSc.PetscSectionDestroy(petsclib, section) # pass the Ref directly + +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Multi-Field Sections + +For problems with multiple fields (e.g., velocity + pressure): + +```julia +# Create section with 2 fields +section = Ref{LibPETSc.PetscSection}() +LibPETSc.PetscSectionCreate(petsclib, LibPETSc.PETSC_COMM_SELF, section) +@assert section[] != C_NULL + +LibPETSc.PetscSectionSetNumFields(petsclib, section[], 2) + +# Set field names +LibPETSc.PetscSectionSetFieldName(petsclib, section[], 0, "velocity") +LibPETSc.PetscSectionSetFieldName(petsclib, section[], 1, "pressure") + +# Set chart +LibPETSc.PetscSectionSetChart(petsclib, section[], 0, 10) + +# Set field components: velocity has 3 components (vx, vy, vz), pressure has 1 +LibPETSc.PetscSectionSetFieldComponents(petsclib, section[], 0, 3) +LibPETSc.PetscSectionSetFieldComponents(petsclib, section[], 1, 1) + +# Set DOFs per field per point +for p in 0:9 + LibPETSc.PetscSectionSetFieldDof(petsclib, section[], p, 0, 3) # 3 velocity DOFs + LibPETSc.PetscSectionSetFieldDof(petsclib, section[], p, 1, 1) # 1 pressure DOF + LibPETSc.PetscSectionSetDof(petsclib, section[], p, 4) # Total: 4 DOFs +end + +LibPETSc.PetscSectionSetUp(petsclib, section[]) +``` + +## Constrained DOFs + +Mark certain DOFs as constrained (e.g., for boundary conditions): + +```julia +# Set chart and DOFs... +# Note: Constraint-related functions may have wrapper issues + +# Set constraint DOF count +# LibPETSc.PetscSectionSetConstraintDof(petsclib, section[], point, num_constrained) + +# Specify which DOFs are constrained +# constrained_indices = PetscInt[0, 2] +# LibPETSc.PetscSectionSetConstraintIndices(petsclib, section[], point, constrained_indices) + +# Query constrained storage size +# LibPETSc.PetscSectionGetConstrainedStorageSize(petsclib, section[]) +``` + +## Integration with DM + +Sections are commonly used with DM objects: + +```julia +# Get section from DM +dm_section = Ref{LibPETSc.PetscSection}() +# LibPETSc.DMGetSection(petsclib, dm, dm_section) + +# Set section on DM +# LibPETSc.DMSetSection(petsclib, dm, section[]) + +# Get local section (ghosted) +# local_section = Ref{LibPETSc.PetscSection}() +# LibPETSc.DMGetLocalSection(petsclib, dm, local_section) +``` + +## Common Workflows + +### 1. FEM Discretization + +```julia +# Create section for Q1 finite elements on structured grid +# - Vertices: 1 DOF each +# - Cells: 0 DOFs + +section = Ref{LibPETSc.PetscSection}() +LibPETSc.PetscSectionCreate(petsclib, comm, section) +@assert section[] != C_NULL + +LibPETSc.PetscSectionSetChart(petsclib, section[], vStart, cEnd) + +# Set DOFs (vStart to vEnd are vertices, vEnd to cEnd are cells) +for v in vStart:vEnd-1 + LibPETSc.PetscSectionSetDof(petsclib, section[], v, 1) +end + +LibPETSc.PetscSectionSetUp(petsclib, section[]) +``` + +### 2. Point Closure + +Get all DOFs in the closure of a point (point + its boundary): + +```julia +# Get closure DOFs for a cell +closure_size = Ref{PetscInt}() +closure = Ref{Ptr{PetscInt}}() +# LibPETSc.DMPlexGetTransitiveClosure(petsclib, dm, cell, PETSC_TRUE, closure_size, closure) + +# Map closure points to DOF offsets using section +# ... use section to get DOF offsets for each point in closure ... + +# LibPETSc.DMPlexRestoreTransitiveClosure(petsclib, dm, cell, PETSC_TRUE, closure_size, closure) +``` + +## Querying Section Properties + +```julia +# Get total number of fields +num_fields = LibPETSc.PetscSectionGetNumFields(petsclib, section[]) + +# Get field components +components = LibPETSc.PetscSectionGetFieldComponents(petsclib, section[], field) + +# Get field name (returns String directly) +name = LibPETSc.PetscSectionGetFieldName(petsclib, section[], field) + +# Get maximum DOF count across all points +max_dof = LibPETSc.PetscSectionGetMaxDof(petsclib, section[]) +``` + +## Cloning and Permutation + +```julia +# Clone a section (wrapper may have issues, use with caution) +new_section = Ref{LibPETSc.PetscSection}() +# LibPETSc.PetscSectionClone(petsclib, section[], new_section) + +# Note: Clone/Permute functions may require direct ccall if wrapper signatures are incorrect +``` + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/PetscSection_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/petscsf_lowlevel.md b/docs/src/man/petscsf_lowlevel.md new file mode 100644 index 00000000..64b511a1 --- /dev/null +++ b/docs/src/man/petscsf_lowlevel.md @@ -0,0 +1,208 @@ +# PetscSF (Star Forest) - Low-level Interface + +The PetscSF (Star Forest) component provides efficient parallel communication patterns for distributed data structures. A star forest is a specialized graph structure optimized for scatter/gather operations in parallel computing. + +## Overview + +PetscSF enables: +- **Point-to-point communication**: Efficient MPI communication patterns +- **Scatter/gather operations**: Move data between processors +- **Halo exchange**: Update ghost/boundary values +- **Reduction operations**: Parallel sums, max, min across shared data +- **Irregular communication**: Handle non-uniform data distributions + +A star forest consists of: +- **Roots**: Data owned locally +- **Leaves**: Data needed from remote processes (or local) +- **Communication pattern**: Which leaves come from which roots + +PetscSF is the underlying communication layer for DM ghost point updates and other parallel operations. + +## Basic Usage + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) +PetscInt = petsclib.PetscInt + +# Create a star forest +sf = LibPETSc.PetscSFCreate(petsclib, MPI.COMM_WORLD) + +# Define communication pattern +# nleaves: number of leaves (data items we need) +# ilocal: local indices for leaves (can be C_NULL if identity) +# iremote: (rank, index) pairs specifying which process/index to get from + +nleaves = 5 +# number of roots owned locally (for this simple example set equal to nleaves) +nroots = 5 +ilocal = [0, 1, 2, 3, 4] # Local indices where data will be stored +iremote = [ + LibPETSc.PetscSFNode(0, 0), + LibPETSc.PetscSFNode(0, 1), + LibPETSc.PetscSFNode(0, 2), + LibPETSc.PetscSFNode(0, 3), + LibPETSc.PetscSFNode(0, 4), +] + +LibPETSc.PetscSFSetGraph(petsclib, sf, nroots, nleaves, ilocal, LibPETSc.PETSC_COPY_VALUES, + iremote, LibPETSc.PETSC_COPY_VALUES) + +# Setup +LibPETSc.PetscSFSetUp(petsclib, sf) + +# Cleanup +LibPETSc.PetscSFDestroy(petsclib, sf) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Communication Operations + +### Broadcast (Scatter) + +Send data from roots to leaves: + +```julia +# Root data: data we own +root_data = Float64[1.0, 2.0, 3.0, 4.0, 5.0] + +# Leaf data: buffer to receive data +leaf_data = zeros(Float64, nleaves) + +# Broadcast: send root data to leaves +LibPETSc.PetscSFBcastBegin(petsclib, sf, LibPETSc.MPI_DOUBLE, root_data, leaf_data, + LibPETSc.MPI_REPLACE) +LibPETSc.PetscSFBcastEnd(petsclib, sf, LibPETSc.MPI_DOUBLE, root_data, leaf_data, + LibPETSc.MPI_REPLACE) +``` + +### Reduce + +Accumulate data from leaves back to roots: + +```julia +# Leaf contributions +leaf_data = Float64[0.1, 0.2, 0.3, 0.4, 0.5] + +# Root accumulator +root_data = zeros(Float64, nroots) + +# Reduce: accumulate leaf data to roots +LibPETSc.PetscSFReduceBegin(petsclib, sf, LibPETSc.MPI_DOUBLE, leaf_data, root_data, + LibPETSc.MPI_SUM) +LibPETSc.PetscSFReduceEnd(petsclib, sf, LibPETSc.MPI_DOUBLE, leaf_data, root_data, + LibPETSc.MPI_SUM) +``` + +### Fetch and Operations + +Atomic operations for concurrent updates: + +```julia +# Fetch data and apply operation +LibPETSc.PetscSFFetchAndOpBegin(petsclib, sf, LibPETSc.MPI_DOUBLE, root_data, + leaf_data, leaf_updates, LibPETSc.MPI_SUM) +LibPETSc.PetscSFFetchAndOpEnd(petsclib, sf, LibPETSc.MPI_DOUBLE, root_data, + leaf_data, leaf_updates, LibPETSc.MPI_SUM) +``` + +## MPI Operations + +Supported MPI operations for reduce: +- `MPI_SUM`: Sum values +- `MPI_MAX`: Maximum value +- `MPI_MIN`: Minimum value +- `MPI_REPLACE`: Replace (last write wins) +- `MPI_PROD`: Product + +## Star Forest Types + +Available through `PetscSFSetType`: +- **PETSCSFBASIC**: Basic implementation +- **PETSCSFNEIGHBOR**: MPI neighborhood collectives (efficient for structured patterns) +- **PETSCSFALLGATHERV**: All-gather based +- **PETSCSFALLGATHER**: All-gather for small data +- **PETSCSFGATHERV**: Gather-based +- **PETSCSFGATHER**: Simple gather +- **PETSCSFALLTOALL**: All-to-all based + +## Graph Queries + +```julia +# Get number of roots (locally owned data) +nroots = Ref{PetscInt}() +LibPETSc.PetscSFGetGraph(petsclib, sf, nroots, C_NULL, C_NULL, C_NULL) + +# Get number of leaves +nleaves = Ref{PetscInt}() +LibPETSc.PetscSFGetGraph(petsclib, sf, C_NULL, nleaves, C_NULL, C_NULL) + +# Get full graph +ilocal_ptr = Ref{Ptr{PetscInt}}() +iremote_ptr = Ref{Ptr{LibPETSc.PetscSFNode}}() +LibPETSc.PetscSFGetGraph(petsclib, sf, nroots, nleaves, ilocal_ptr, iremote_ptr) +``` + +## Multi-Root Support + +Handle communication with multiple root data per point: + +```julia +# Create multi-SF for multiple DOFs per point +nroots_mult = nroots * num_components +multi_sf = LibPETSc.PetscSFCreateEmbeddedRootSF(petsclib, sf, nroots_mult, iroot_indices) +``` + +## Common Use Cases + +### 1. Ghost Point Updates (Halo Exchange) + +```julia +# After modifying owned data, update ghost points +# 1. Pack local data +# 2. Broadcast to leaves (ghost points) +LibPETSc.PetscSFBcastBegin(petsclib, sf, datatype, local_data, ghost_data, op) +LibPETSc.PetscSFBcastEnd(petsclib, sf, datatype, local_data, ghost_data, op) +``` + +### 2. Parallel Assembly + +```julia +# After local assembly, accumulate contributions from other processes +# 1. Each process computes local contributions +# 2. Reduce to accumulate at owners +LibPETSc.PetscSFReduceBegin(petsclib, sf, datatype, local_contrib, global_data, MPI_SUM) +LibPETSc.PetscSFReduceEnd(petsclib, sf, datatype, local_contrib, global_data, MPI_SUM) +``` + +### 3. DM Point Communication + +```julia +# Get natural SF for a DM (describes point distribution) +dm_sf = Ref{LibPETSc.PetscSF}() +# LibPETSc.DMGetPointSF(petsclib, dm, dm_sf) + +# Use to communicate point-based data +``` + +## Performance Considerations + +- **Choose appropriate type**: `PETSCSFNEIGHBOR` is often best for structured grids +- **Reuse SF objects**: Creating the communication pattern is expensive +- **Batch communications**: Combine multiple small messages when possible +- **Alignment**: Use properly aligned data types for better performance + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/PetscSF_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/petscviewer_lowlevel.md b/docs/src/man/petscviewer_lowlevel.md new file mode 100644 index 00000000..842c1a8a --- /dev/null +++ b/docs/src/man/petscviewer_lowlevel.md @@ -0,0 +1,274 @@ +# PetscViewer - Low-level Interface + +The PetscViewer component provides flexible I/O capabilities for visualizing and saving PETSc objects, including vectors, matrices, and other data structures. Viewers support multiple output formats for analysis, debugging, and post-processing. + +## Overview + +PETSc viewers enable: +- **Text output**: ASCII formatted data for debugging +- **Binary I/O**: Efficient storage and checkpointing +- **Visualization**: Integration with visualization tools (VTK, HDF5, MATLAB) +- **Monitoring**: Runtime inspection of solver progress +- **Logging**: Recording solver statistics and performance data + +Available viewer types: +- **PETSCVIEWERASCII**: Human-readable text output +- **PETSCVIEWERBINARY**: Platform-independent binary format +- **PETSCVIEWERVTK**: VTK format for ParaView, VisIt +- **PETSCVIEWERHDF5**: HDF5 hierarchical data format +- **PETSCVIEWERDRAW**: X-window graphics (2D plots, contours) +- **PETSCVIEWERSOCKET**: Network streaming to MATLAB, Python +- **PETSCVIEWERMATLAB**: MATLAB-compatible output + +## Basic Usage + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Create a viewer for ASCII output to stdout +viewer = LibPETSc.PetscViewerCreate(petsclib, LibPETSc.PETSC_COMM_SELF) +LibPETSc.PetscViewerSetType(petsclib, viewer, "ascii") # String convenience wrapper +LibPETSc.PetscViewerFileSetMode(petsclib, viewer, LibPETSc.FILE_MODE_WRITE) + +# View a vector +# LibPETSc.VecView(petsclib, vec, viewer) + +# View a matrix +# LibPETSc.MatView(petsclib, mat, viewer) + +# Cleanup - wrap in Ref since PetscViewerDestroy expects Ptr{PetscViewer} +viewer_ref = Ref(viewer) +LibPETSc.PetscViewerDestroy(petsclib, viewer_ref) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Convenience Functions + +For commonly used viewers, PETSc.jl provides convenience functions: + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Get stdout viewer (single process) +viewer_stdout_self = LibPETSc.PETSC_VIEWER_STDOUT_SELF(petsclib) + +# Get stdout viewer (all processes) +viewer_stdout_world = LibPETSc.PETSC_VIEWER_STDOUT_WORLD(petsclib) + +# Get stderr viewer (single process) +viewer_stderr_self = LibPETSc.PETSC_VIEWER_STDERR_SELF(petsclib) + +# Get stderr viewer (all processes) +viewer_stderr_world = LibPETSc.PETSC_VIEWER_STDERR_WORLD(petsclib) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() + +# Use them to view objects +# LibPETSc.VecView(petsclib, vec, viewer_stdout_self) +# LibPETSc.MatView(petsclib, mat, viewer_stderr_world) +``` + +## Output to Files + +### ASCII File Output + +```julia +# Create ASCII file viewer +viewer = Ref{LibPETSc.PetscViewer}() +LibPETSc.PetscViewerASCIIOpen(petsclib, LibPETSc.PETSC_COMM_SELF, "output.txt", viewer) + +# Set format (optional) +LibPETSc.PetscViewerPushFormat(petsclib, viewer[], LibPETSc.PETSC_VIEWER_ASCII_MATLAB) + +# View object +# LibPETSc.MatView(petsclib, mat, viewer[]) + +LibPETSc.PetscViewerDestroy(petsclib, viewer) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +### Binary File Output + +```julia +# Create binary viewer for checkpointing +viewer = Ref{LibPETSc.PetscViewer}() +LibPETSc.PetscViewerBinaryOpen(petsclib, MPI.COMM_WORLD, "checkpoint.dat", + LibPETSc.FILE_MODE_WRITE, viewer) + +# Save vector +# LibPETSc.VecView(petsclib, vec, viewer[]) + +# Save matrix +# LibPETSc.MatView(petsclib, mat, viewer[]) + +LibPETSc.PetscViewerDestroy(petsclib, viewer) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +### Loading from Binary Files + +```julia +# Open for reading +viewer = Ref{LibPETSc.PetscViewer}() +LibPETSc.PetscViewerBinaryOpen(petsclib, MPI.COMM_WORLD, "checkpoint.dat", + LibPETSc.FILE_MODE_READ, viewer) + +# Load vector +vec = LibPETSc.VecCreate(petsclib, MPI.COMM_WORLD) +LibPETSc.VecLoad(petsclib, vec, viewer[]) + +LibPETSc.PetscViewerDestroy(petsclib, viewer) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Visualization Formats + +### VTK Output + +```julia +# Create VTK viewer for ParaView/VisIt +viewer = Ref{LibPETSc.PetscViewer}() +LibPETSc.PetscViewerVTKOpen(petsclib, MPI.COMM_WORLD, "solution.vtu", + LibPETSc.FILE_MODE_WRITE, viewer) + +# View DM-based solution +# LibPETSc.DMView(petsclib, dm, viewer[]) +# LibPETSc.VecView(petsclib, solution, viewer[]) + +LibPETSc.PetscViewerDestroy(petsclib, viewer) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +### HDF5 Output + +```julia +# Create HDF5 viewer for hierarchical data +viewer = Ref{LibPETSc.PetscViewer}() +LibPETSc.PetscViewerHDF5Open(petsclib, MPI.COMM_WORLD, "data.h5", + LibPETSc.FILE_MODE_WRITE, viewer) + +# Organize data in groups +LibPETSc.PetscViewerHDF5PushGroup(petsclib, viewer[], "/timestep_001") +# LibPETSc.VecView(petsclib, vec, viewer[]) +LibPETSc.PetscViewerHDF5PopGroup(petsclib, viewer[]) + +LibPETSc.PetscViewerDestroy(petsclib, viewer) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Standard Viewers + +PETSc provides predefined viewers: + +```julia +# Standard output +LibPETSc.PETSC_VIEWER_STDOUT_SELF(petsclib) +LibPETSc.PETSC_VIEWER_STDOUT_WORLD(petsclib) + +# Standard error +LibPETSc.PETSC_VIEWER_STDERR_SELF(petsclib) +LibPETSc.PETSC_VIEWER_STDERR_WORLD(petsclib) + +# Example: view to stdout +# LibPETSc.VecView(petsclib, vec, LibPETSc.PETSC_VIEWER_STDOUT_WORLD(petsclib)) +``` + +## Format Options + +Control output detail with `PetscViewerPushFormat`: + +- **PETSC_VIEWER_DEFAULT**: Standard format +- **PETSC_VIEWER_ASCII_MATLAB**: MATLAB-compatible format +- **PETSC_VIEWER_ASCII_DENSE**: Dense matrix format +- **PETSC_VIEWER_ASCII_INFO**: Summary information only +- **PETSC_VIEWER_ASCII_INFO_DETAIL**: Detailed information + +## Draw Viewer (Graphics) + +For interactive 2D visualization: + +```julia +# Create draw viewer (X-window) +viewer = Ref{LibPETSc.PetscViewer}() +LibPETSc.PetscViewerDrawOpen(petsclib, LibPETSc.PETSC_COMM_SELF, C_NULL, "Plot", + 0, 0, 600, 600, viewer) + +# View vector as bar chart +# LibPETSc.VecView(petsclib, vec, viewer[]) + +# View matrix structure +# LibPETSc.MatView(petsclib, mat, viewer[]) + +LibPETSc.PetscViewerDestroy(petsclib, viewer) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Socket Viewer (MATLAB/Python) + +Stream data to external tools: + +```julia +# Create socket viewer +viewer = Ref{LibPETSc.PetscViewer}() +LibPETSc.PetscViewerSocketOpen(petsclib, MPI.COMM_WORLD, "localhost", 5000, viewer) + +# Send data +# LibPETSc.VecView(petsclib, vec, viewer[]) + +LibPETSc.PetscViewerDestroy(petsclib, viewer) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Monitoring Convergence + +Viewers are used with KSP/SNES monitors: + +```julia +# Monitor KSP residuals (automatic viewer to stdout) +# LibPETSc.KSPMonitorSet(petsclib, ksp, LibPETSc.KSPMonitorDefault, +# LibPETSc.PETSC_VIEWER_STDOUT_SELF(petsclib), C_NULL) +``` + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/PetscViewer_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/snes.md b/docs/src/man/snes.md index 6dd85787..e235fb0b 100644 --- a/docs/src/man/snes.md +++ b/docs/src/man/snes.md @@ -1,6 +1,123 @@ # SNES -The following `SNES` routines are available: +The SNES (Scalable Nonlinear Equations Solvers) module provides methods for solving nonlinear systems of the form `F(x) = 0`. It builds on KSP for the linear solves within Newton-like methods. + +## Overview + +SNES provides: +- **Newton methods**: Newton line search, Newton trust region +- **Quasi-Newton**: L-BFGS, Broyden +- **Nonlinear Richardson**: With various line search strategies +- **FAS multigrid**: Full Approximation Scheme for nonlinear problems +- **Composite solvers**: Combine multiple nonlinear solvers + +## Creating a SNES Solver + +```julia +# Basic creation +snes = SNES(petsclib, MPI.COMM_WORLD) + +# With options +snes = SNES(petsclib, MPI.COMM_WORLD; + snes_type = "newtonls", + snes_rtol = 1e-8, + snes_max_it = 50 +) +``` + +## Setting the Nonlinear Function + +Define the residual function `F(x)`: + +```julia +function residual!(fx, snes, x) + # Compute F(x) and store in fx + fx[1] = x[1]^2 + x[2] - 1 + fx[2] = x[1] + x[2]^2 - 1 + return 0 +end + +setfunction!(snes, residual!, f_vec) +``` + +## Setting the Jacobian + +Define the Jacobian `J = dF/dx`: + +```julia +function jacobian!(J, snes, x) + # Fill Jacobian matrix + J[1, 1] = 2*x[1] + J[1, 2] = 1.0 + J[2, 1] = 1.0 + J[2, 2] = 2*x[2] + assemble!(J) + return 0 +end + +setjacobian!(snes, jacobian!, J, J) # (J, P) where P is preconditioner matrix +``` + +## Using a DM + +For PDE problems, associate the SNES with a DM: + +```julia +setDM!(snes, dm) + +# Get the DM from SNES +dm = getDMDA(snes) +``` + +## Solving + +```julia +# Solve with initial guess x +solve!(x, snes) + +# Get solution vector +sol = get_solution(snes) +``` + +## Common Solver Options + +### Nonlinear Solver Types (`snes_type`) +- `newtonls` - Newton with line search (default) +- `newtontr` - Newton with trust region +- `nrichardson` - Nonlinear Richardson +- `qn` - Quasi-Newton (L-BFGS) +- `fas` - Full Approximation Scheme multigrid + +### Convergence Options +- `snes_rtol` - Relative tolerance +- `snes_atol` - Absolute tolerance +- `snes_stol` - Step tolerance +- `snes_max_it` - Maximum iterations +- `snes_monitor` - Print residual each iteration + +### Line Search Options +- `snes_linesearch_type` - `bt` (backtracking), `basic`, `l2`, `cp` + +## Example: Full Setup + +```julia +petsclib = PETSc.petsclibs[1] +PETSc.initialize(petsclib) + +snes = SNES(petsclib, MPI.COMM_WORLD; + snes_monitor = true, + ksp_type = "gmres", + pc_type = "ilu" +) + +setfunction!(snes, residual!, f) +setjacobian!(snes, jacobian!, J, J) +setfromoptions!(snes) + +solve!(x, snes) +``` + +## Functions ```@autodocs Modules = [PETSc] diff --git a/docs/src/man/snes_lowlevel.md b/docs/src/man/snes_lowlevel.md new file mode 100644 index 00000000..69d6e091 --- /dev/null +++ b/docs/src/man/snes_lowlevel.md @@ -0,0 +1,58 @@ +# SNES - Low-level Interface + +This page documents the low-level, automatically wrapped PETSc SNES (Scalable Nonlinear Equations Solvers) functions available through `LibPETSc`. These functions provide direct access to the PETSc C API. + +For the high-level Julia interface, see [SNES](@ref). + +## Overview + +The SNES interface includes: +- **Core SNES operations**: Nonlinear solver creation, configuration, and solution (~283 functions in `SNES_wrappers.jl`) +- **SNESLineSearch**: Line search methods for nonlinear solvers (~50 functions in `SNESLineSearch_wrappers.jl`) + +## Usage + +All low-level SNES functions require a `petsclib` parameter as the first argument: + +```julia +using PETSc + +# Get the library instance +petsclib = PETSc.petsclibs[1] +PETSc.initialize(petsclib) + +# Get PETSc types +PetscInt = petsclib.PetscInt + +# Create SNES solver +snes = LibPETSc.SNESCreate(petsclib, LibPETSc.PETSC_COMM_SELF) + +# Set function and Jacobian (callbacks would need to be defined) +# LibPETSc.SNESSetFunction(petsclib, snes, r, compute_function, ctx) +# LibPETSc.SNESSetJacobian(petsclib, snes, J, J, compute_jacobian, ctx) + +# Configure from command line +LibPETSc.SNESSetFromOptions(petsclib, snes) + +# Solve +# LibPETSc.SNESSolve(petsclib, snes, C_NULL, x) + +# Get convergence info +reason = LibPETSc.SNESGetConvergedReason(petsclib, snes) + +iterations = LibPETSc.SNESGetIterationNumber(petsclib, snes) + +println("SNES reason: $(reason), iterations: $(iterations)") + +# Clean up +LibPETSc.SNESDestroy(petsclib, snes) +PETSc.finalize(petsclib) +``` + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/SNES_wrappers.jl", "autowrapped/SNESLineSearch_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/tao_lowlevel.md b/docs/src/man/tao_lowlevel.md new file mode 100644 index 00000000..a5e374bb --- /dev/null +++ b/docs/src/man/tao_lowlevel.md @@ -0,0 +1,141 @@ +# Tao (Optimization) - Low-level Interface + +The Tao (Toolkit for Advanced Optimization) component provides methods for solving optimization problems, including unconstrained minimization, bound-constrained optimization, and constrained optimization. + +## Overview + +Tao supports various optimization algorithms: +- **Unconstrained**: Conjugate gradient (CG), limited-memory BFGS (BLMVM), Nelder-Mead +- **Bound-constrained**: Bound-constrained BFGS (BNCG, BNLS, BNTL), active-set methods +- **Constrained**: Augmented Lagrangian methods (ALMM), interior point methods +- **Least-squares**: Gauss-Newton methods, Levenberg-Marquardt +- **Complementarity**: Semismooth methods for complementarity problems +- **PDE-constrained**: Methods suitable for PDE-constrained optimization + +The Tao object manages the optimization process, line searches, convergence monitoring, and provides a unified interface across different optimization algorithms. + +## Basic Usage + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Create a Tao object +tao = LibPETSc.TaoCreate(petsclib, LibPETSc.PETSC_COMM_SELF) + +# Set the optimization algorithm (e.g., LMVM, BLMVM, NLS) +LibPETSc.TaoSetType(petsclib, tao, "lmvm") # String convenience wrapper + +# Set the objective function and gradient +# LibPETSc.TaoSetObjective(petsclib, tao, objective_function_ptr, C_NULL) +# LibPETSc.TaoSetGradient(petsclib, tao, C_NULL, gradient_function_ptr, C_NULL) + +# For bound-constrained problems, set variable bounds +# LibPETSc.TaoSetVariableBounds(petsclib, tao, lower_bound_vec, upper_bound_vec) + +# Set convergence tolerances +LibPETSc.TaoSetTolerances(petsclib, tao, 1e-8, 1e-8, 1e-8) + +# Set maximum iterations +LibPETSc.TaoSetMaximumIterations(petsclib, tao, 1000) + +# Set options from command line/options database +LibPETSc.TaoSetFromOptions(petsclib, tao) + +# Set initial guess +# LibPETSc.TaoSetSolution(petsclib, tao, initial_vec) + +# Solve the optimization problem +# LibPETSc.TaoSolve(petsclib, tao) + +# Get solution information +reason = LibPETSc.TaoGetConvergedReason(petsclib, tao) +iter = LibPETSc.TaoGetIterationNumber(petsclib, tao) + +println("Tao reason: $(reason), iterations: $(iter)") + +# Cleanup +LibPETSc.TaoDestroy(petsclib, tao) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Common Workflow + +1. **Create and configure Tao**: Use `TaoCreate`, `TaoSetType` +2. **Define objective**: `TaoSetObjective`, `TaoSetGradient`, optionally `TaoSetHessian` +3. **Set constraints** (if any): `TaoSetVariableBounds`, `TaoSetConstraints` +4. **Configure solver**: `TaoSetTolerances`, `TaoSetMaximumIterations` +5. **Set initial guess**: `TaoSetSolution` +6. **Solve**: `TaoSolve` +7. **Retrieve solution**: `TaoGetSolution`, `TaoGetConvergedReason` + +## Optimization Algorithms + +Available through `TaoSetType`: +- **Unconstrained**: + - `TAOLMVM`: Limited-memory variable metric (quasi-Newton) + - `TAOCG`: Conjugate gradient methods + - `TAONM`: Nelder-Mead simplex method + - `TAONLS`: Newton line search + - `TAONTL`: Newton trust-region with line search + +- **Bound-constrained**: + - `TAOBLMVM`: Bound-constrained limited-memory variable metric + - `TAOBNCG`: Bound-constrained conjugate gradient + - `TAOBQNLS`: Bound-constrained quasi-Newton line search + - `TAOBNTL`: Bound-constrained Newton trust-region + - `TAOTRON`: Trust-region Newton method + +- **Constrained**: + - `TAOALMM`: Augmented Lagrangian multiplier method + - `TAOIPM`: Interior point method + - `TAOPDIPM`: Primal-dual interior point method + +- **Least-squares**: + - `TAOPOUNDERS`: POUNDERs model-based method + - `TAOBRGN`: Bounded regularized Gauss-Newton + +- **Complementarity**: + - `TAOSSLS`: Semismooth least squares + - `TAOASLS`: Active-set least squares + +## Convergence Criteria + +Tao monitors several convergence criteria: +- **Gradient tolerance**: `||∇f|| < gatol` or `||∇f||/||f|| < grtol` +- **Function tolerance**: `|f - f_prev| < fatol` or `|f - f_prev|/|f| < frtol` +- **Step tolerance**: `||x - x_prev|| < steptol` + +Set using `TaoSetTolerances(tao, gatol, grtol, gttol)`. + +## Hessian Options + +For second-order methods: +- **Exact Hessian**: Provide via `TaoSetHessian` +- **Finite-difference approximation**: Use matrix-free approach +- **Quasi-Newton approximation**: LMVM methods build approximation automatically + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/Tao_wrappers.jl"] +Order = [:function] +``` + +## Tao Add-ons + +Additional Tao utilities and helper functions: + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/Tao_addons_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/ts_lowlevel.md b/docs/src/man/ts_lowlevel.md new file mode 100644 index 00000000..2f6b6fbe --- /dev/null +++ b/docs/src/man/ts_lowlevel.md @@ -0,0 +1,120 @@ +# TS (Time Stepping) - Low-level Interface + + + +The TS (Time Stepping) component provides methods for solving time-dependent differential equations, including ordinary differential equations (ODEs), differential-algebraic equations (DAEs), and time-dependent partial differential equations (PDEs). + +## Overview + +TS supports various time integration methods including: +- **Explicit methods**: Forward Euler, Runge-Kutta methods (RK2, RK3, RK4, etc.) +- **Implicit methods**: Backward Euler, Crank-Nicolson, BDF methods +- **IMEX methods**: Implicit-Explicit combinations for stiff-nonstiff problems +- **Adaptive methods**: Adaptive time stepping with error control +- **Specialized methods**: Theta methods, Rosenbrock methods, SSP methods + +The TS object manages the time integration loop, adaptive time stepping, event detection, and provides interfaces to various time stepping schemes. + +## Basic Usage + +```julia +using PETSc, MPI + +# Initialize MPI and PETSc +MPI.Init() +petsclib = PETSc.getlib() +PETSc.initialize(petsclib) + +# Create a TS object +ts = LibPETSc.TSCreate(petsclib, LibPETSc.PETSC_COMM_SELF) + +# Set the problem type (ODE or DAE) +LibPETSc.TSSetProblemType(petsclib, ts, LibPETSc.TS_NONLINEAR) + +# Set the time stepping method (e.g., BDF, RK, Theta) +LibPETSc.TSSetType(petsclib, ts, "bdf") # String convenience wrapper + +# Set time span +LibPETSc.TSSetTime(petsclib, ts, 0.0) # Initial time +LibPETSc.TSSetMaxTime(petsclib, ts, 1.0) # Final time +LibPETSc.TSSetExactFinalTime(petsclib, ts, LibPETSc.TS_EXACTFINALTIME_STEPOVER) + +# Set initial time step +LibPETSc.TSSetTimeStep(petsclib, ts, 0.01) + +# Set the right-hand side function (for ODE: du/dt = f(t,u)) +# LibPETSc.TSSetRHSFunction(petsclib, ts, C_NULL, rhs_function_ptr, C_NULL) + +# Set options from command line/options database +LibPETSc.TSSetFromOptions(petsclib, ts) + +# Set initial condition +# LibPETSc.TSSetSolution(petsclib, ts, initial_vec) + +# Solve +# LibPETSc.TSSolve(petsclib, ts, solution_vec) + +# Get solution time (returns value directly) +final_time = LibPETSc.TSGetSolveTime(petsclib, ts) + +# Cleanup +LibPETSc.TSDestroy(petsclib, ts) + +# Finalize PETSc and MPI +PETSc.finalize(petsclib) +MPI.Finalize() +``` + +## Common Workflow + +1. **Create and configure TS**: Use `TSCreate`, `TSSetType`, `TSSetProblemType` +2. **Set time parameters**: `TSSetTime`, `TSSetMaxTime`, `TSSetTimeStep`, `TSSetMaxSteps` +3. **Define equations**: `TSSetRHSFunction`, `TSSetIFunction`, `TSSetIJacobian` +4. **Configure adaptivity**: `TSAdaptSetType`, `TSSetTolerances` +5. **Set initial condition**: `TSSetSolution` +6. **Solve**: `TSSolve` +7. **Retrieve solution**: `TSGetSolution`, `TSGetTime`, `TSGetStepNumber` + +## Time Integration Schemes + +Available through `TSSetType`: +- `TSEULER`: Forward/Backward Euler +- `TSRK`: Runge-Kutta methods (various orders) +- `TSBDF`: Backward Differentiation Formulas +- `TSTHETA`: Theta method (generalizes Euler, Crank-Nicolson) +- `TSROSW`: Rosenbrock-W methods for stiff problems +- `TSARKIMEX`: Additive Runge-Kutta IMEX methods +- `TSGLEE`: Generalized Linear Evolution Equations +- `TSALPHA`: Alpha methods for second-order systems +- `TSSSP`: Strong Stability Preserving methods + +## Event Detection + +TS supports event detection (zero-crossing of event functions) during time integration: +- `TSSetEventHandler`: Configure events to detect +- Events can trigger actions like termination, adaptation, or post-event processing + +## Adaptive Time Stepping + +TS includes sophisticated adaptive time stepping: +- `TSAdaptChoose`: Select time step based on error estimates +- Various adapt types: `TSADAPTBASIC`, `TSADAPTNONE`, `TSADAPTDSP` +- Tolerance control: `TSSetTolerances` for absolute/relative error + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/TS_wrappers.jl"] +Order = [:function] +``` + +## TS Add-ons + +Additional TS utilities and helper functions: + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/TSaddons_wrappers.jl"] +Order = [:function] +``` diff --git a/docs/src/man/utilities.md b/docs/src/man/utilities.md new file mode 100644 index 00000000..08c23416 --- /dev/null +++ b/docs/src/man/utilities.md @@ -0,0 +1,39 @@ +# Utilities + +This page documents utility functions for initialization, options handling, system information, and code auditing. + +## Initialization + +The initialization functions manage PETSc's lifecycle, including MPI initialization and cleanup. + +```@autodocs +Modules = [PETSc] +Pages = ["init.jl"] +``` + +## Options + +PETSc uses an options database to configure solvers and other objects at runtime. These functions provide access to the options system. + +```@autodocs +Modules = [PETSc] +Pages = ["options.jl"] +``` + +## System Utilities + +General system-level utilities for working with PETSc objects. + +```@autodocs +Modules = [PETSc] +Pages = ["sys.jl"] +``` + +## Code Auditing + +The audit utilities help identify potential memory leaks by tracking PETSc object creation and destruction. + +```@autodocs +Modules = [PETSc] +Pages = ["audit.jl"] +``` diff --git a/docs/src/man/vec.md b/docs/src/man/vec.md index 96efea78..3f550b06 100644 --- a/docs/src/man/vec.md +++ b/docs/src/man/vec.md @@ -1,6 +1,73 @@ # Vec -The following Vec routines are available: +PETSc vectors (`Vec`) are the fundamental building blocks for storing solution data, right-hand sides, and other distributed arrays. PETSc.jl provides a Julia-friendly interface that makes `Vec` objects behave like native Julia arrays. + +## Overview + +PETSc vectors support: +- **Distributed parallel storage**: Split across MPI processes +- **Sequential storage**: For serial computations +- **Ghost points**: For communication in stencil operations +- **Julia array interface**: Use familiar indexing and broadcasting syntax + +## Creating Vectors + +### Sequential Vectors + +```julia +# Create a sequential vector of length n +v = VecSeq(petsclib, n) + +# Wrap an existing Julia array (no copy) +julia_array = zeros(100) +v = VecSeq(petsclib, julia_array) +``` + +### From DM Objects + +```julia +# Create global and local vectors from a DM +global_vec = DMGlobalVec(dm) +local_vec = DMLocalVec(dm) +``` + +## Julia Array Interface + +PETSc vectors implement the Julia array interface: + +```julia +v[1] = 1.0 # Set single element +v[1:10] .= 2.0 # Set range +x = v[5] # Get element +length(v) # Get length +size(v) # Get size tuple +``` + +## Assembly + +After setting values, vectors must be assembled: + +```julia +v[1] = 1.0 +v[2] = 2.0 +assemble!(v) # Finalize vector assembly +``` + +## Ghost Point Updates + +For vectors with ghost points (from DMDA/DMStag): + +```julia +# Update ghost values from neighboring processes +ghostupdate!(vec, INSERT_VALUES, SCATTER_FORWARD) + +# Or use begin/end for non-blocking: +ghostupdatebegin!(vec, INSERT_VALUES, SCATTER_FORWARD) +# ... do other work ... +ghostupdateend!(vec, INSERT_VALUES, SCATTER_FORWARD) +``` + +## Functions ```@autodocs Modules = [PETSc] diff --git a/docs/src/man/vec_lowlevel.md b/docs/src/man/vec_lowlevel.md new file mode 100644 index 00000000..cb77a249 --- /dev/null +++ b/docs/src/man/vec_lowlevel.md @@ -0,0 +1,57 @@ +# Vec - Low-level Interface + +This page documents the low-level, automatically wrapped PETSc Vec functions available through `LibPETSc`. These functions provide direct access to the PETSc C API. + +For the high-level Julia interface, see [Vec](@ref). + +## Overview + +The Vec interface includes: +- **Core Vec operations**: Creation, manipulation, and mathematical operations on vectors (~186 functions in `Vec_wrappers.jl`) +- **Vec utilities**: Scatter operations, FFTW integration, and advanced vector operations (~76 functions in `Vecs_wrappers.jl`) +- **VecTagger**: Tools for tagging/marking vector elements based on criteria (~31 functions in `VecTagger_wrappers.jl`) + +## Usage + +All low-level Vec functions require a `petsclib` parameter as the first argument: + +```julia +using PETSc + +# Get the library instance +petsclib = PETSc.petsclibs[1] +PETSc.initialize(petsclib) + +# Get PETSc types +PetscInt = petsclib.PetscInt + +# Create a vector +vec = LibPETSc.VecCreate(petsclib, LibPETSc.PETSC_COMM_SELF) +LibPETSc.VecSetSizes(petsclib, vec, PetscInt(10), PetscInt(10)) +LibPETSc.VecSetType(petsclib, vec, "seq") # Set vector type +LibPETSc.VecSetFromOptions(petsclib, vec) + +# Set values +LibPETSc.VecSet(petsclib, vec, 1.0) + +# Query the vector +size = LibPETSc.VecGetSize(petsclib, vec) +println("Vector size: $size") + +# Get values (0-based indexing!) +idx = PetscInt(0) +val = LibPETSc.VecGetValues(petsclib, vec, PetscInt(1), [idx]) +println("Value at index 0: $(val[1])") + +# Clean up +LibPETSc.VecDestroy(petsclib, vec) +PETSc.finalize(petsclib) +``` + +## Function Reference + +```@autodocs +Modules = [PETSc.LibPETSc] +Pages = ["autowrapped/Vec_wrappers.jl", "autowrapped/Vecs_wrappers.jl", "autowrapped/VecTagger_wrappers.jl"] +Order = [:function] +``` diff --git a/examples/DMSTAG_Stokes_2D.jl b/examples/DMSTAG_Stokes_2D.jl deleted file mode 100644 index 050c31ea..00000000 --- a/examples/DMSTAG_Stokes_2D.jl +++ /dev/null @@ -1,482 +0,0 @@ -# This shows how to solve the 2D incompressible Stokes equations using SNES solvers, -# using a staggered grid discretization and a Velocity-Pressure formulation -# -# Governing equations: -# -# dVx/dx + dVz/dz = 0 | Mass balance -# -dP/dx + dTxx/dx + dTxz/dz = 0 | Horizontal force balance -# -dP/dz + dTxz/dx + dTzz/dz = rho*g | Vertical force balance -# -# with: -# Exx = dVx/dx, Ezz = dVz/dz, Exz = 0.5*(dVx/dz + dVz/dx) | Strain rate definition -# -# | Txx | | 2*eta 0 0 | | Exx | -# | Tzz | = | 0 2*eta 0 | | Ezz | | Linear viscous (isotropic) rheology -# | Txz | | 0 0 2*eta | | Exz | -# -# This example also uses the Automatic differentiation package ForwardDiff - -using PETSc, MPI -using ForwardDiff, SparseArrays, SparseDiffTools - -petsclib = PETSc.petsclibs[1]; -PETSc.initialize(petsclib) - -function FormRes!(ptr_fx_g, ptr_x_g, user_ctx) - - # Copy global to local vectors - PETSc.update!(user_ctx.x_l, ptr_x_g, PETSc.INSERT_VALUES) - PETSc.update!(user_ctx.f_l, ptr_fx_g, PETSc.INSERT_VALUES) - - # Retrieve arrays from the local vectors - ArrayLocal_x = PETSc.DMStagVecGetArrayRead(user_ctx.dm, user_ctx.x_l); # array with all local x-data (solution array) - ArrayLocal_f = PETSc.DMStagVecGetArray(user_ctx.dm, user_ctx.f_l); # array with all local residual - - # Compute local residual - ComputeLocalResidual(user_ctx.dm, ArrayLocal_x, ArrayLocal_f, user_ctx) - - # Finalize local arrays - Base.finalize(ArrayLocal_x) - Base.finalize(ArrayLocal_f) - - # Copy local into global residual vector - PETSc.update!( ptr_fx_g, user_ctx.f_l, PETSc.INSERT_VALUES) - -end - -function ForwardDiff_res(x, user_ctx) - f = zero(x) # vector of zeros, of same type as x (local vector) - - ArrayLocal_x = PETSc.DMStagVecGetArray(user_ctx.dm, x); # array with all local x-data - ArrayLocal_f = PETSc.DMStagVecGetArray(user_ctx.dm, f); # array with all local residual - - ComputeLocalResidual(user_ctx.dm, ArrayLocal_x, ArrayLocal_f, user_ctx); - - # As the residual vector f is linked with ArrayLocal_f, we don't need to - # pass ArrayLocal_f back to f - - return f; -end - -function ComputeSparsityPatternJacobian_automatic(x_l, user_ctx) - # This computes the sparsity pattern and coloring of the jacobian automatically - # This will works for any equation but is slow @ high resolutions - - f_Residual = (x -> ForwardDiff_res(x, user_ctx)); # pass additional arguments into the routine - J_julia = ForwardDiff.jacobian(f_Residual,x_l*0 .+ 1);# Compute a "blank" jacobian - - # employ sparse structure to compute jacobian - to be moved inside routines - jac = sparse(J_julia); - colors = matrix_colors(jac) # the number of nonzeros per row - - return jac, colors -end - -function func(out, x, user_ctx) - - ArrayLocal_x = PETSc.DMStagVecGetArray(user_ctx.dm, x); # array with all local x-data (solition array) - ArrayLocal_f = PETSc.DMStagVecGetArray(user_ctx.dm, out); # array with all local residual - - ComputeLocalResidual(user_ctx.dm, ArrayLocal_x, ArrayLocal_f, user_ctx); - - return nothing -end - -function FormJacobian!(ptr_x_g, J, P, user_ctx) - # This requires several steps: - # - # 1) Extract local vector from global solution (x) vector - # 2) Compute local jacobian from the residual routine (note that - # this routine requires julia vectors as input) - # 3) Store the matrix inside the global Petsc matrix J - - # Extract the local vector - #PETSc.DMGlobalToLocal(user_ctx.dm, cx_g, PETSc.INSERT_VALUES, user_ctx.x_l) - PETSc.update!(user_ctx.x_l, ptr_x_g, PETSc.INSERT_VALUES) - x = PETSc.unsafe_localarray(Float64, user_ctx.x_l.ptr; write=false); - - # Check the sparsity pattern - if isnothing(user_ctx.jac) - error("You first have to define the sparsity pattern of the jacobian") - else - jac = user_ctx.jac; - colors = user_ctx.colors; - end - out = similar(x); - - f_Res = ((out,x)->func(out, x, user_ctx)); # pass additional arguments into the routine - - if isnothing(user_ctx.jac_cache) - # Allocate data required for jacobian computations - user_ctx.jac_cache = ForwardColorJacCache(f_Res,x; colorvec=colors, sparsity = jac); - end - - # Compute Jacobian using automatic differenciation - forwarddiff_color_jacobian!(jac, f_Res, x, user_ctx.jac_cache); - - - # Store global Jacobian inside Petsc Matrix - ind = PETSc.LocalInGlobalIndices(user_ctx.dm); - if PETSc.assembled(J) == false - println("Assembling J") - J = PETSc.MatSeqAIJ(sparse(jac[ind,ind])); - else - J .= sparse(jac[ind,ind]); - end - - # Store Julia matrix and coloring - user_ctx.jac = jac; - user_ctx.colors = colors; - - return jac, ind -end - -# Define a struct that holds data we need in the local SNES routines below -mutable struct Data_Stokes2D - # DMs and vectors - dm - dmCoeff - coeff_l - x_l - f_l - # physical parameters - eta1 - eta2 - rho1 - rho2 - gz - kappa - # dimensions - dx - dz - xlim - zlim - # jacobian and sparsity pattern - jac - jac_cache - colors -end -user_ctx = Data_Stokes2D(nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing); # holds data we need in the local - - -function ComputeLocalResidual(dm, ArrayLocal_x, ArrayLocal_f, user_ctx) - # Compute the local residual. The vectors include ghost points - - # Compute shear stresses - Txx,Tzz,Txz = ComputeStresses!(user_ctx, ArrayLocal_x); - - # Extracting arrays from the residual and solution vectors - P = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_x, PETSc.DMSTAG_ELEMENT, 0); - Vx = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_x, PETSc.DMSTAG_LEFT, 0); - Vz = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_x, PETSc.DMSTAG_DOWN, 0); - - f_p = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_f, PETSc.DMSTAG_ELEMENT, 0); - f_x = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_f, PETSc.DMSTAG_LEFT, 0); - f_z = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_f, PETSc.DMSTAG_DOWN, 0); - - # Extracting physical parameters - RhoC = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dmCoeff,user_ctx.coeff_l, PETSc.DMSTAG_DOWN_LEFT, 1); - - # Gettins sizes - dx = user_ctx.dx; - dz = user_ctx.dz; - - # Getting global indices for the local vectors - ind = PETSc.DMStagGetIndices(dm); # indices of (center/element) points, not including ghost values. - #sx, sn = PETSc.DMStagGetCentralNodes(user_ctx.dm); #indices of central points - - ix = ind.center[1]; - iz = ind.center[1]; - - # Horizontal force balance f(x) - - # Boundary conditions (Dirichlet with no normal velocity at boundary) - f_x[ix[1] ,:] .= Vx[ix[1] ,:] .- 0.0; - f_x[ix[end]+1,:] .= Vx[ix[end]+1,:] .+ 0.0; - - # -dP/dx + dTxx/dx + dTxz/dz = 0 - f_x[ix[2]:ix[end],iz] .= .-(P[ix[2]:ix[end],iz] .- P[ix[1]:ix[end-1],iz])./dx .+ - (Txx[2:end,:] .- Txx[1:end-1,:]) ./dx .+ - (Txz[2:end-1,2:end] .- Txz[2:end-1,1:end-1]) ./dz; - - # Vertical force balance f(z) - - # Boundary conditions (Dirichlet with no normal velocity at boundary) - f_z[:,iz[1] ] .= Vz[:,iz[1] ] .- 0.0; - f_z[:,iz[end]+1] .= Vz[:,iz[end]+1] .+ 0.0; - - # -dP/dz + dTxz/dx + dTzz/dz = rho*g - f_z[ix,iz[2]:iz[end]] .= .-(P[ix,iz[2]:iz[end]] .- P[ix,iz[1]:iz[end-1]])./dz .+ - (Tzz[:,2:end] .- Tzz[:,1:end-1]) ./dz .+ - (Txz[ 2:end,2:end-1] .- Txz[1:end-1,2:end-1]) ./dx .+ - (RhoC[ix.+1,iz[2]:iz[end]] .+ RhoC[ix,iz[2]:iz[end] ]) .* 0.5 .* user_ctx.gz; - - # Mass balance f(p) - # dVx/dx + dVz/dz = 0 - kappa = user_ctx.kappa; # penalty term to help solver - f_p[ix,iz] .= (Vx[ix.+1,iz].-Vx[ix,iz])./dx .+ (Vz[ix,iz.+1].-Vz[ix,iz])./dz .+ 1/kappa*P[ix,iz]; - - # Cleanup - Base.finalize(Vx); Base.finalize(Vz); - Base.finalize(P); Base.finalize(RhoC); - Base.finalize(f_x); Base.finalize(f_z); - Base.finalize(Txx); Base.finalize(Tzz); - Base.finalize(Txz); -end - -function ComputeStresses!(user_ctx, ArrayLocal_x) - - # Compute strain rates - Exx,Ezz,Exz = ComputeStrainRates!(user_ctx, ArrayLocal_x); - - # Getting Eta at the center and corner of the cells - EtaE = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dmCoeff,user_ctx.coeff_l, PETSc.DMSTAG_ELEMENT, 0); - EtaC = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dmCoeff,user_ctx.coeff_l, PETSc.DMSTAG_DOWN_LEFT, 0); - - # Getting indices for center nodes (not ghost) - ind = PETSc.DMStagGetIndices(user_ctx.dm); #indices of central points - #ix = sx[1]:sn[1]; - #iz = sx[2]:sn[2]; - ix = ind.center[1]; - iz = ind.center[1]; - - # Compute shear stresses - Txx = 2 .* EtaE[ix,iz] .* Exx; - Tzz = 2 .* EtaE[ix,iz] .* Ezz; - Txz = 2 .* EtaC[ix[1]:ix[end]+1,iz[1]:iz[end]+1] .* Exz; - - return Txx,Tzz,Txz - - Base.finalize(Exx); Base.finalize(Ezz); - Base.finalize(Exz); - -end - -function ComputeStrainRates!(user_ctx, ArrayLocal_x) - - # Getting velocity vectors - Vx = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_x, PETSc.DMSTAG_LEFT, 0); - Vz = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_x, PETSc.DMSTAG_DOWN, 0); - - # Gettind dimensions - dx = user_ctx.dx; - dz = user_ctx.dz; - - # Getting indices for center nodes (not ghost) - ind = PETSc.DMStagGetIndices(user_ctx.dm); #indices of central points - #ix = sx[1]:sn[1]; - #iz = sx[2]:sn[2]; - ix = ind.center[1]; - iz = ind.center[2]; - - - # Set ghost points (free slip) - Vx[:,iz[1]-1] .= Vx[:,iz[1]]; # ghost points on left and right size (here: free slip) - Vx[:,iz[end]+1] .= Vx[:,iz[end]]; - Vz[ix[1]-1,:] .= Vz[ix[1],:]; - Vz[ix[end]+1,:] .= Vz[ix[end],:]; - - # Compute deviatoric Strain rates - DivV = (Vx[ix.+1,iz].-Vx[ix,iz])./dx .+ (Vz[ix,iz.+1].-Vz[ix,iz])./dz; - Exx = (Vx[ix.+1,iz].-Vx[ix,iz])./dx .- 1/3 .* DivV; - Ezz = (Vz[ix,iz.+1].-Vz[ix,iz])./dz .- 1/3 .* DivV; - Exz = 0.5.*((Vx[ix[1]:ix[end].+1,iz[1]:iz[end].+1].-Vx[ix[1]:ix[end].+1,iz[1].-1:iz[end]])./dz .+ - (Vz[ix[1]:ix[end].+1,iz[1]:iz[end].+1].-Vz[ix[1].-1:ix[end],iz[1]:iz[end].+1])./dx); - - return Exx,Ezz,Exz - -end - -function PopulateCoefficientData!(user_ctx) - - # Create coefficient local vector and array (to store eta and rho) - user_ctx.coeff_l = PETSc.createlocalvector(user_ctx.dmCoeff); - coeff_array = PETSc.DMStagVecGetArray(user_ctx.dmCoeff,user_ctx.coeff_l); - - # Create Coordinates dm, local vector and array - dm_coord = PETSc.getcoordinateDM(user_ctx.dmCoeff); - vec_coord = PETSc.getcoordinateslocal(user_ctx.dmCoeff); - coord = PETSc.DMStagVecGetArray(dm_coord, vec_coord); - # start,n,nExtra = PETSc.DMStagGetCorners(user_ctx.dmCoeff); - - # Get the correct entries for each of our variables in local element-wise storage - iec = PETSc.DMStagGetLocationSlot(user_ctx.dmCoeff, PETSc.DMSTAG_DOWN_LEFT, 0); # location eta corner - irc = PETSc.DMStagGetLocationSlot(user_ctx.dmCoeff, PETSc.DMSTAG_DOWN_LEFT, 1); # location rho corner - iee = PETSc.DMStagGetLocationSlot(user_ctx.dmCoeff, PETSc.DMSTAG_ELEMENT, 0); # location eta element - ixc = PETSc.DMStagGetLocationSlot(dm_coord, PETSc.DMSTAG_DOWN_LEFT, 0); # location coord corner - ixe = PETSc.DMStagGetLocationSlot(dm_coord, PETSc.DMSTAG_ELEMENT, 0); # location coord element - - # Fill coefficient vectors with suitable value (determined by x-coordinate in function GetPhase()) - - # Element nodes (eta) - - Coeff = coeff_array[:,:,iee+1]; - X_coord = coord[:,:,ixe+1]; - index1 = findall(x -> GetPhase(user_ctx,x,1),X_coord); - Coeff[index1] .= user_ctx.eta1; - - index2 = findall(x -> GetPhase(user_ctx,x,2),X_coord); - Coeff[index2] .= user_ctx.eta2; - - coeff_array[:,:,iee+1] .= Coeff; - - # Corner nodes (rho and eta) - - CoeffE = coeff_array[:,:,iec+1]; - CoeffR = coeff_array[:,:,irc+1]; - X_coord = coord[:,:,ixc+1]; - index1 = findall(x -> GetPhase(user_ctx,x,1),X_coord); - CoeffE[index1].= user_ctx.eta1; - CoeffR[index1].= user_ctx.rho1; - - index2 = findall(x -> GetPhase(user_ctx,x,2),X_coord); - CoeffE[index2].= user_ctx.eta2; - CoeffR[index2].= user_ctx.rho2; - - coeff_array[:,:,iec+1] .= CoeffE; - coeff_array[:,:,irc+1] .= CoeffR; - - -end - -function GetPhase(ctx,x,n) - # Divide domain in phases according to x-coordinate (similar to SolCx benchmark) - if x < (ctx.xlim[2]-ctx.xlim[1])/2 - if n == 1 return true else return false end - else - if n == 1 return false else return true end - end -end - -function SetVecX!(user_ctx,x_g) - # Set first guess for vector x to 0 - user_ctx.x_l .= 0; - #PETSc.DMLocalToGlobal(user_ctx.dm,user_ctx.x_l, PETSc.INSERT_VALUES, x_g); - PETSc.update!(x_g,user_ctx.x_l, PETSc.INSERT_VALUES); - -end - - -# Main Solver -nx, nz = 32, 32; # number of nodes is x and z direction -#nx, nz = 8, 8; # number of nodes is x and z direction - -user_ctx.xlim = [0,2]; # x and z dimensions -user_ctx.zlim = [0,1]; -xlim = user_ctx.xlim; -zlim = user_ctx.zlim; -user_ctx.dx = (xlim[2]-xlim[1])/nx; # x-resolution -user_ctx.dz = (zlim[2]-zlim[1])/nz; # z-resolution -user_ctx.eta1 = 1; # viscosity phase 1 -user_ctx.eta2 = 2; # viscosity phase 2 -user_ctx.rho1 = 3; # density phase 1 -user_ctx.rho2 = 4; # density phase 2 -user_ctx.gz = -1; # gravity magnitude -user_ctx.kappa = 1e2; # incompressible penaly term - -# Create Solution and coefficient DMs -user_ctx.dm = PETSc.DMStagCreate2d(petsclib,MPI.COMM_SELF,PETSc.DM_BOUNDARY_GHOSTED,PETSc.DM_BOUNDARY_GHOSTED,nx,nz,1,1,0,1,1,PETSc.DMSTAG_STENCIL_BOX,1); # V edge, P Element -PETSc.DMStagSetUniformCoordinatesExplicit(user_ctx.dm, xlim[1], xlim[2], zlim[1], zlim[2]); # set coordinates -user_ctx.dmCoeff = PETSc.DMStagCreateCompatibleDMStag(user_ctx.dm,2,0,1,0); # rho and eta on VERTEX, eta on ELEMENT -PETSc.DMStagSetUniformCoordinatesExplicit(user_ctx.dmCoeff, xlim[1], xlim[2], zlim[1], zlim[2]); - -# Populate phases -PopulateCoefficientData!(user_ctx); - -# Create solution and residual vectors -x_g = PETSc.createglobalvector(user_ctx.dm); -f_g = PETSc.createglobalvector(user_ctx.dm); -user_ctx.x_l = PETSc.createlocalvector(user_ctx.dm); -user_ctx.f_l = PETSc.createlocalvector(user_ctx.dm); - -# Create Petsc matrix for Jacobian -J = PETSc.creatematrix(user_ctx.dm); - -# Set first guess values for solution vector -SetVecX!(user_ctx,x_g); - -# Compute jacobian sparcity pattern -x_l = PETSc.unsafe_localarray(Float64, user_ctx.x_l.ptr; write=false, read=true) - -user_ctx.jac, user_ctx.colors = ComputeSparsityPatternJacobian_automatic(user_ctx.x_l, user_ctx); -ind = PETSc.LocalInGlobalIndices(user_ctx.dm); # extract indices -J = PETSc.MatSeqAIJ(sparse(user_ctx.jac[ind,ind])); - - -#Setting up SNES -S = PETSc.SNES{Float64}(petsclib,MPI.COMM_SELF; - snes_rtol=1e-12, - snes_monitor=true, - snes_max_it = 500, - snes_monitor_true_residual=true, - snes_converged_reason=true); -S.user_ctx = user_ctx; - - -PETSc.setfunction!(S, FormRes!, f_g) -PETSc.setjacobian!(S, FormJacobian!, J, J) - -#Solve -PETSc.solve!(x_g, S); - -# Copy solution to local vector -PETSc.update!(user_ctx.x_l, x_g, PETSc.INSERT_VALUES); - -# Extract solution -Vx = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm, user_ctx.x_l, PETSc.DMSTAG_LEFT, 0); -Vz = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm, user_ctx.x_l, PETSc.DMSTAG_DOWN, 0); -P = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm, user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 0); -Eta = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dmCoeff, user_ctx.coeff_l, PETSc.DMSTAG_ELEMENT, 0); - -# Getting indices for center nodes (not ghost) -ind = PETSc.DMStagGetIndices(user_ctx.dm); -ix = ind.center[1]; -iz = ind.center[2]; - -# Getting rid of ghost points -Vx = Vx[ix[1]:ix[end]+1,iz]; -Vz = Vz[ix,iz[1]:iz[end]+1]; -P = P[ix,iz]; -Eta = Eta[ix,iz]; - -# Compute central average velocities -Vx_cen = (Vx[2:end,:] + Vx[1:end-1,:])/2; -Vz_cen = (Vz[:,2:end] + Vz[:,1:end-1])/2; - -#get coordinates -dm_coord = PETSc.getcoordinateDM(user_ctx.dmCoeff); -vec_coord = PETSc.getcoordinateslocal(user_ctx.dmCoeff); - -XCoord_e = PETSc.DMStagGetGhostArrayLocationSlot(dm_coord, vec_coord, PETSc.DMSTAG_ELEMENT , 0); # location coord corner -ZCoord_e = PETSc.DMStagGetGhostArrayLocationSlot(dm_coord, vec_coord, PETSc.DMSTAG_ELEMENT , 1); # location coord corner -XCoord_c = PETSc.DMStagGetGhostArrayLocationSlot(dm_coord, vec_coord, PETSc.DMSTAG_DOWN_LEFT, 0); # location coord element -ZCoord_c = PETSc.DMStagGetGhostArrayLocationSlot(dm_coord, vec_coord, PETSc.DMSTAG_DOWN_LEFT, 1); # location coord element - -XCoord_e = XCoord_e[ix,iz]; -ZCoord_e = ZCoord_e[ix,iz]; -XCoord_c = XCoord_c[ix[1]:ix[end]+1,iz[1]:iz[end]+1]; -ZCoord_c = ZCoord_c[ix[1]:ix[end]+1,iz[1]:iz[end]+1]; - -xe_1D = XCoord_e[:,1]; -ze_1D = ZCoord_e[1,:]; -xc_1D = XCoord_c[:,1]; -zc_1D = ZCoord_c[1,:]; - -# Plot -CreatePlots = false; # set to false by default such that testing does not require Plots -if CreatePlots==true - using Plots - - p1 = heatmap(xe_1D,ze_1D, P', xlabel="Width", ylabel="Depth", title="Pressure",aspect_ratio = 1) - p2 = heatmap(xe_1D,zc_1D, Vz', xlabel="Width", ylabel="Depth", title="Vz",aspect_ratio = 1) - p3 = heatmap(xc_1D,ze_1D, Vx', xlabel="Width", ylabel="Depth", title="Vx",aspect_ratio = 1) - quiver!(XCoord_e[:],ZCoord_e[:],quiver=(Vx_cen[:]*0.02,Vz_cen[:]*0.02), color=:white,aspect_ratio = 1) - p4 = heatmap(xe_1D,ze_1D, Eta', xlabel="Width", ylabel="Depth", title="Eta",aspect_ratio = 1) - plot(p1, p2, p3, p4, layout = (2, 2), legend = false) - -end - -# check if the solution makes sense -using LinearAlgebra, Test -check = norm(user_ctx.x_l) -@test check ≈ 31.54688642064483 \ No newline at end of file diff --git a/examples/DMSTAG_porwave_1D.jl b/examples/DMSTAG_porwave_1D.jl deleted file mode 100644 index ea5e95eb..00000000 --- a/examples/DMSTAG_porwave_1D.jl +++ /dev/null @@ -1,309 +0,0 @@ -# EXCLUDE FROM TESTING -# FIXME: This is excluded because it is failing right now. - -# This is an example of a 1D viscoelastic porosity wave as described in -# Vasyliev et al. Geophysical Research Letters (25), 17. p. 3239-3242 -# https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1029/98GL52358 -# -# It simulates how a pulse of magma migrates upwards in the Earth, which -# can be described by a set of coupled nonlinear PDE's -# -# This example only requires the specification of a residual routine; automatic -# differentiation is used to generate the jacobian. - -using PETSc, MPI - -using SparseArrays, SparseDiffTools, ForwardDiff - -petsclib = PETSc.petsclibs[1]; -PETSc.initialize(petsclib) - -CreatePlots = false; -if CreatePlots==true - using Plots -end - - -function FormRes!(ptr_fx_g, ptr_x_g, user_ctx) - - # Note that in PETSc, cx and cfx are pointers to global vectors. - - # Copy global to local vectors - PETSc.update!(user_ctx.x_l, ptr_x_g, PETSc.INSERT_VALUES) - PETSc.update!(user_ctx.f_l, ptr_fx_g, PETSc.INSERT_VALUES) - - # Retrieve arrays from the local vectors - ArrayLocal_x = PETSc.DMStagVecGetArrayRead(user_ctx.dm, user_ctx.x_l); # array with all local x-data - ArrayLocal_f = PETSc.DMStagVecGetArray(user_ctx.dm, user_ctx.f_l); # array with all local residual - - # Compute local residual - ComputeLocalResidual(user_ctx.dm, ArrayLocal_x, ArrayLocal_f, user_ctx) - - # Finalize local arrays - Base.finalize(ArrayLocal_x) - Base.finalize(ArrayLocal_f) - - # Copy local into global residual vector - PETSc.update!( ptr_fx_g, user_ctx.f_l, PETSc.INSERT_VALUES) - -end - -function ForwardDiff_res(x, user_ctx) - f = zero(x) # vector of zeros, of same type as x (local vector) - - ArrayLocal_x = PETSc.DMStagVecGetArray(user_ctx.dm, x); # array with all local x-data - ArrayLocal_f = PETSc.DMStagVecGetArray(user_ctx.dm, f); # array with all local residual - - ComputeLocalResidual(user_ctx.dm, ArrayLocal_x, ArrayLocal_f, user_ctx); - - # As the residual vector f is linked with ArrayLocal_f, we don't need to - # pass ArrayLocal_f back to f - - return f; -end - - -function func(out, x, user_ctx) - - ArrayLocal_x = PETSc.DMStagVecGetArray(user_ctx.dm, x); # array with all local x-data - ArrayLocal_f = PETSc.DMStagVecGetArray(user_ctx.dm, out); # array with all local residual - - ComputeLocalResidual(user_ctx.dm, ArrayLocal_x, ArrayLocal_f, user_ctx); - - return nothing -end - - - -function FormJacobian!(ptr_x_g, J, P, user_ctx) - # This requires several steps: - # - # 1) Extract local vector from global solution (x) vector - # 2) Compute local jacobian from the residual routine (note that - # this routine requires julia vectors as input) - - # Extract the local vector from pointer to global vector - PETSc.update!(user_ctx.x_l, ptr_x_g, PETSc.INSERT_VALUES) - x = PETSc.unsafe_localarray(Float64, user_ctx.x_l.ptr; write=false) - - if isnothing(user_ctx.jac) - # Compute sparsity pattern of jacobian. This is relatvely slow, but only has to be done once. - # Theoretically, more efficient tools for this exists (jacobian_sparsity in the SparsityDetection.jl package), - # but they don't seem to work with the PETSc approach we use. Therefore we employ - f_Residual = (x -> ForwardDiff_res(x, user_ctx)); # pass additional arguments into the routine - J_julia = ForwardDiff.jacobian(f_Residual,x); - - # employ sparse structure to compute jacobian - to be moved inside routines - jac = sparse(J_julia); - colors = matrix_colors(jac) # the number of nonzeros per row - - else - jac = user_ctx.jac; - colors = user_ctx.colors; - end - out = similar(x); - - f_Res = ((out,x)->func(out, x, user_ctx)); # pass additional arguments into the routine - forwarddiff_color_jacobian!(jac, f_Res, x, colorvec = colors) - - ind = PETSc.LocalInGlobalIndices(user_ctx.dm); # extract indices - if PETSc.assembled(J) == false - J = PETSc.MatSeqAIJ(sparse(jac[ind,ind])); - else - J .= sparse(jac[ind,ind]); - end - - user_ctx.jac = jac; - user_ctx.colors = colors; - - return jac[ind,ind], ind -end - -# Define a struct that holds data we need in the local SNES routines below -mutable struct Data_PorWav1D - dm - x_l - xold_l - xold_g - f_l - dt - dz - De - jac - colors -end -user_ctx = Data_PorWav1D(nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing); # holds data we need in the local - - -function ComputeLocalResidual(dm, ArrayLocal_x, ArrayLocal_f, user_ctx) - # Compute the local residual. The vectors include ghost points - n = 3.0 - m = 2.0 - dt = user_ctx.dt; - dz = user_ctx.dz; - De = user_ctx.De; - - Phi = PETSc.DMStagGetGhostArrayLocationSlot(dm,ArrayLocal_x , PETSc.DMSTAG_ELEMENT, 0); - Phi_old = PETSc.DMStagGetGhostArrayLocationSlot(dm,user_ctx.xold_l, PETSc.DMSTAG_ELEMENT, 0); - Pe = PETSc.DMStagGetGhostArrayLocationSlot(dm,ArrayLocal_x , PETSc.DMSTAG_ELEMENT, 1); - Pe_old = PETSc.DMStagGetGhostArrayLocationSlot(dm,user_ctx.xold_l, PETSc.DMSTAG_ELEMENT, 1); - - res_Phi = PETSc.DMStagGetGhostArrayLocationSlot(dm,ArrayLocal_f, PETSc.DMSTAG_ELEMENT, 0); - res_Pe = PETSc.DMStagGetGhostArrayLocationSlot(dm,ArrayLocal_f, PETSc.DMSTAG_ELEMENT, 1); - - # compute the FD stencil - ind = PETSc.DMStagGetIndices(dm); # indices of (center/element) points, not including ghost values. - - # Porosity residual @ center points - iz = ind.center[1]; # Phi is on center points - iz_c = iz[2:end-1]; # central points - res_Phi[iz[1]] = Phi[iz[1]] - 1.0; # Bottom BC - res_Phi[iz[end]] = Phi[iz[end]] - 1.0; # Top BC - res_Phi[iz_c] = (Phi[iz_c] - Phi_old[iz_c])/dt + De.*(Pe[iz_c]-Pe_old[iz_c])/dt + (Phi[iz_c].^m) .* Pe[iz_c] - - # Pressure update @ center points - iz = ind.center[1]; - iz_c = iz[2:end-1]; - res_Pe[iz[1]] = Pe[iz[1]] - 0.; # Bottom BC - res_Pe[iz[end]] = Pe[iz[end]] - 0.; # Top BC - res_Pe[iz_c] = De.*(Pe[iz_c]-Pe_old[iz_c])/dt - ( ((0.5*(Phi[iz_c .+ 1] + Phi[iz_c .+ 0])).^n) .* ( (Pe[iz_c .+ 1] - Pe[iz_c ])/dz .+ 1.0) - - ((0.5*(Phi[iz_c .- 1] + Phi[iz_c .+ 0])).^n) .* ( (Pe[iz_c ] - Pe[iz_c .- 1])/dz .+ 1.0))/dz + - (Phi[iz_c].^m) .* Pe[iz_c]; - - # Cleanup - Base.finalize(Phi); Base.finalize(Phi_old); - Base.finalize(Pe); Base.finalize(Pe_old); - -end - - -function SetInitialPerturbations(user_ctx, x_g) - # Computes the initial perturbations as in the paper - - # Retrieve coordinates from DMStag - DMcoord = PETSc.getcoordinateDM(user_ctx.dm) - vec_coord = PETSc.getcoordinateslocal(user_ctx.dm); - Coord = PETSc.DMStagVecGetArray(DMcoord, vec_coord); - Z_cen = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,Coord, PETSc.DMSTAG_ELEMENT, 0); # center (has 1 extra) - user_ctx.dz = Z_cen[2]-Z_cen[1]; - - Phi = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 0); - Pe = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 1); - Phi_old = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.xold_l, PETSc.DMSTAG_ELEMENT, 0); - Pe_old = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.xold_l, PETSc.DMSTAG_ELEMENT, 1); - - Phi0 =1.0; dPhi1=8.0; dPhi2=1.0; z1=0.0; z2=40.0; lambda=1.0 - dPe1 = dPhi1/user_ctx.De; - dPe2 = dPhi2/user_ctx.De; - - Phi .= Phi0 .+ dPhi1.*exp.( -((Z_cen .- z1).^2.0)/lambda^2) + dPhi2.*exp.( -((Z_cen .- z2).^2.0)/lambda^2); - Pe .= -dPe1 .*exp.( -((Z_cen .- z1).^2.0)/lambda^2) - dPe2.*exp.( -((Z_cen .- z2).^2.0)/lambda^2); - - Phi_old .= Phi0 .+ dPhi1.*exp.( -((Z_cen .- z1).^2.0)/lambda^2) + dPhi2.*exp.( -((Z_cen .- z2).^2.0)/lambda^2); - Pe_old .= -dPe1 .*exp.( -((Z_cen .- z1).^2.0)/lambda^2) - dPe2.*exp.( -((Z_cen .- z2).^2.0)/lambda^2); - - # Copy local into global residual vector - #PETSc.DMLocalToGlobal(user_ctx.dm,user_ctx.x_l, PETSc.INSERT_VALUES, x_g) - PETSc.update!(x_g, user_ctx.x_l, PETSc.INSERT_VALUES); - - # send back coordinates - return Z_cen -end - - -# Main Solver -nx = 1001; -L = 150; -#user_ctx.De = 1e-2; # Deborah number -#user_ctx.dt = 5e-5; # Note that the timestep has to be tuned a bit depending on De in order to obtain convergence -user_ctx.De = 1e2; -user_ctx.dt = 1e-2; # Note that the timestep has to be tuned a bit depending on De in order to obtain convergence - -user_ctx.dm = PETSc.DMStagCreate1d(petsclib, MPI.COMM_WORLD,PETSc.DM_BOUNDARY_NONE,nx,0,2); # both Phi and Pe are on center points -PETSc.DMStagSetUniformCoordinatesExplicit(user_ctx.dm, -20, L) # set coordinates -x_g = PETSc.createglobalvector(user_ctx.dm) - - -f_g = PETSc.createglobalvector(user_ctx.dm) -user_ctx.x_l = PETSc.createlocalvector(user_ctx.dm) -user_ctx.xold_l = PETSc.createlocalvector(user_ctx.dm) -user_ctx.xold_g = PETSc.createglobalvector(user_ctx.dm) -user_ctx.f_l = PETSc.createlocalvector(user_ctx.dm) -J = PETSc.creatematrix(user_ctx.dm); # Jacobian from DMStag - - -# initial non-zero structure of jacobian -Z_cen = SetInitialPerturbations(user_ctx, x_g) - -x0 = PETSc.createglobalvector(user_ctx.dm); -x0[1:length(x0)] .= 1 -J_julia,ind = FormJacobian!(x0, J, J, user_ctx) -J = PETSc.MatSeqAIJ(J_julia) - - -S = PETSc.SNES{Float64}(petsclib, MPI.COMM_SELF; - snes_rtol=1e-12, - snes_monitor=true, - snes_max_it = 500, - snes_monitor_true_residual=true, - snes_converged_reason=true); -S.user_ctx = user_ctx; - - -SetInitialPerturbations(user_ctx, x_g) - -PETSc.setfunction!(S, FormRes!, f_g) -PETSc.setjacobian!(S, FormJacobian!, J, J) - -# Preparation of visualisation -if CreatePlots - ENV["GKSwstype"]="nul"; - if isdir("viz_out")==true - rm("viz_out", recursive=true) - end - mkdir("viz_out") - loadpath = "./viz_out/"; anim = Animation(loadpath,String[]) -end - - -time = 0.0; -it = 1; -while time<2.5 - global time, Z, Z_cen, it - - # Solve one (nonlinear) timestep - PETSc.solve!(x_g, S); - - # Update old local values - user_ctx.xold_g = x_g; - PETSc.update!(user_ctx.x_l, x_g, PETSc.INSERT_VALUES, ) - PETSc.update!(user_ctx.xold_l, user_ctx.xold_g, PETSc.INSERT_VALUES, ) - - # Update time - time += user_ctx.dt; - it += 1; - - if (mod(it,20)==0) & (CreatePlots==true) # Visualisation - # Extract values and plot - Phi = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 0); - Pe = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 1); - - p1 = plot(Phi[1:end-1], Z_cen[1:end-1], ylabel="Z", xlabel="ϕ", xlims=( 0.0, 2.0), label=:none, title="De=$(user_ctx.De)"); - #p2 = plot(Pe[1:end-1], Z_cen[1:end-1] , xlabel="Pe", xlims=(-1.25, 1.25), label=:none, title="$(round(time;sigdigits=3))"); - p2 = plot(Pe[1:end-1], Z_cen[1:end-1] , xlabel="Pe", xlims=(-0.025, 0.01), label=:none, title="$(round(time;sigdigits=3))"); - - # p1 = plot(Phi[1:end-1], Z_cen[1:end-1], ylabel="Z", xlabel="ϕ", label=:none, title="De=$(user_ctx.De)"); - # p2 = plot(Pe[1:end-1], Z_cen[1:end-1] , xlabel="Pe", label=:none, title="$(round(time;sigdigits=3))"); - - plot(p1, p2, layout=(1,2)); frame(anim) - - Base.finalize(Pe); Base.finalize(Phi) - end - - println("Timestep $it, time=$time") - -end - -if CreatePlots==true - gif(anim, "Example_1D.gif", fps = 15) # create a gif animation -end diff --git a/examples/DMSTAG_porwave_2D.jl b/examples/DMSTAG_porwave_2D.jl deleted file mode 100644 index c626b9c9..00000000 --- a/examples/DMSTAG_porwave_2D.jl +++ /dev/null @@ -1,434 +0,0 @@ -# EXCLUDE FROM TESTING -# Note: this is excluded as it would slow doen the tests too much -# -# This is an example of a 2D viscoelastic porosity wave as described in -# Vasyliev et al. Geophysical Research Letters (25), 17. p. 3239-3242 -# -# -# This example only requires the specification of a residual routine; automatic -# differentiation is used to generate the jacobian. See the equivalent 1D version -# as well. -# This example also shows how to employ ghost points to set lateral boundary conditions - -using PETSc, MPI -using Plots -using SparseArrays, SparseDiffTools, ForwardDiff - -petsclib = PETSc.petsclibs[1]; -PETSc.initialize(petsclib) - -function FormRes!(ptr_fx_g, ptr_x_g, user_ctx) - - # Note that in PETSc, cx and cfx are pointers to global vectors. - - # Copy global to local vectors - PETSc.update!(user_ctx.x_l, ptr_x_g, PETSc.INSERT_VALUES) - PETSc.update!(user_ctx.f_l, ptr_fx_g, PETSc.INSERT_VALUES) - - # Retrieve arrays from the local vectors - ArrayLocal_x = PETSc.DMStagVecGetArrayRead(user_ctx.dm, user_ctx.x_l); # array with all local x-data - ArrayLocal_f = PETSc.DMStagVecGetArray(user_ctx.dm, user_ctx.f_l); # array with all local residual - - # Compute local residual - ComputeLocalResidual(user_ctx.dm, ArrayLocal_x, ArrayLocal_f, user_ctx) - - # Finalize local arrays - Base.finalize(ArrayLocal_x) - Base.finalize(ArrayLocal_f) - - # Copy local into global residual vector - PETSc.update!(ptr_fx_g, user_ctx.f_l, PETSc.INSERT_VALUES) - #PETSc.DMLocalToGlobal(user_ctx.dm,user_ctx.f_l, PETSc.INSERT_VALUES, cfx_g) - -end - -function ForwardDiff_res(x, user_ctx) - f = zero(x) # vector of zeros, of same type as x (local vector) - - ArrayLocal_x = PETSc.DMStagVecGetArray(user_ctx.dm, x); # array with all local x-data - ArrayLocal_f = PETSc.DMStagVecGetArray(user_ctx.dm, f); # array with all local residual - - ComputeLocalResidual(user_ctx.dm, ArrayLocal_x, ArrayLocal_f, user_ctx); - - # As the residual vector f is linked with ArrayLocal_f, we don't need to - # pass ArrayLocal_f back to f - - return f; -end - -function func(out, x, user_ctx) - - ArrayLocal_x = PETSc.DMStagVecGetArray(user_ctx.dm, x); # array with all local x-data - ArrayLocal_f = PETSc.DMStagVecGetArray(user_ctx.dm, out); # array with all local residual - - ComputeLocalResidual(user_ctx.dm, ArrayLocal_x, ArrayLocal_f, user_ctx); - - return nothing -end - - -function FormJacobian!(ptr_x_g, J, P, user_ctx) - # This requires several steps: - # - # 1) Extract local vector from global solution (x) vector - # 2) Compute local jacobian from the residual routine (note that - # this routine requires julia vectors as input) - - # Extract the local vector - PETSc.update!(user_ctx.x_l, ptr_x_g, PETSc.INSERT_VALUES) - x = PETSc.unsafe_localarray(Float64, user_ctx.x_l.ptr; write=false, read=true) - - if isnothing(user_ctx.jac) - # Compute sparsity pattern of jacobian. This is relatvely slow, but only has to be done once. - # Theoretically, more efficient tools for this exists (jacobian_sparsity in the SparsityDetection.jl package), - # but they don't seem to work with the PETSc approach we use. Therefore we employ - f_Residual = (x -> ForwardDiff_res(x, user_ctx)); # pass additional arguments into the routine - J_julia = ForwardDiff.jacobian(f_Residual,x); - - # employ sparse structure to compute jacobian - to be moved inside routines - jac = sparse(J_julia); - colors = matrix_colors(jac) # the number of nonzeros per row - - else - jac = user_ctx.jac; - colors = user_ctx.colors; - end - out = similar(x); - - f_Res = ((out,x)->func(out, x, user_ctx)); # pass additional arguments into the routine - forwarddiff_color_jacobian!(jac, f_Res, x, colorvec = colors) - - ind = PETSc.LocalInGlobalIndices(user_ctx.dm); # extract indices - if PETSc.assembled(J) == false - println("Assembling J") - J = PETSc.MatSeqAIJ(sparse(jac[ind,ind])); - else - J .= sparse(jac[ind,ind]); - end - - user_ctx.jac = jac; - user_ctx.colors = colors; - - return jac, ind -end - - -# Define a struct that holds data we need in the residual SNES routines below -mutable struct Data_PorWav2D - dm - x_l - xold_l - xold_g - f_l - dt - dx - dz - De - jac - colors - jac_cache -end -user_ctx = Data_PorWav2D(nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing); # holds data we need in the local - -function ComputeSparsityPatternJacobian(x_l_vec, user_ctx) - # This computes the sparsity pattern of our jacobian by hand. - # That is signficantly faster than the automatic method, yet you will have to analyze your residual routine for it. - # - # As you will see, there are however any similaries between the two routines, so it is usually not all that difficult - # to define this - x_l = PETSc.unsafe_localarray(Float64, x_l_vec.ptr; write=false, read=true) - - AddInd!(i, array) = append!(i,vec(array)); # small helper routine for readability of the lines below - - n = length(x_l); - ind_x = Vector(1:n); - ind_f = Vector(1:n); - ArrayLocal_x = PETSc.DMStagVecGetArray(user_ctx.dm, ind_x); # array with all local x-data - ArrayLocal_f = PETSc.DMStagVecGetArray(user_ctx.dm, ind_f); # array with all local residual - - Phi = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_x , PETSc.DMSTAG_ELEMENT, 0); - Pe = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_x , PETSc.DMSTAG_ELEMENT, 1); - res_Phi = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_f, PETSc.DMSTAG_ELEMENT, 0); - res_Pe = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,ArrayLocal_f, PETSc.DMSTAG_ELEMENT, 1); - - # compute the FD stencil - ind = PETSc.DMStagGetIndices(user_ctx.dm); # indices of (center/element) points, not including ghost values. - - # Porosity residual @ center points - ix = ind.center[1]; - iz = ind.center[2]; - - #res_Phi[ix,iz] = (Phi[ix,iz] - Phi_old[ix,iz])/dt + De.*(Pe[ix,iz]-Pe_old[ix,iz])/dt + (Phi[ix,iz].^m) .* Pe[ix,iz] - i,j = Vector{Int64}(), Vector{Int64}() - AddInd!(i,res_Phi[ix,iz]), AddInd!(j,Phi[ix,iz]); # (Phi[ix,iz])/dt term - AddInd!(i,res_Phi[ix,iz]), AddInd!(j,Pe[ix,iz]); # new non-zeros because of (Phi[ix,iz].^m) .* Pe[ix,iz] term - - # Pressure update @ nodal points - ix = ind.center[1]; # lateral BC's are set using ghost points - iz = ind.center[2]; # constant Pe on top and bottom, so this is only for center points - ix_c = ix[1:end]; - iz_c = iz[2:end-1]; - - - Pe[ix[1]-1,:] = Pe[ix[1],:]; # ghost points on left and right size (here: flux free) - Pe[ix[end]+1,:] = Pe[ix[end],:]; - - # BC's - AddInd!(i, res_Pe[:,iz[1]]), AddInd!(j,Pe[:,iz[1]]); # bottom BC - AddInd!(i, res_Pe[:,iz[end]]), AddInd!(j,Pe[:,iz[end]]); # top BC - - -# res_Pe[ix,iz] = De*( Pe[ix,iz] - Pe_old[ix,iz])/dt + -# (Phi[ix,iz].^m).* Pe[ix,iz] - -# (( ((0.5.*(Phi[ix,iz .+ 1] + Phi[ix ,iz ])).^n) .* ( (Pe[ix,iz .+ 1] - Pe[ix, iz ])/dz .+ 1.0) - -# ((0.5.*(Phi[ix,iz .- 1] + Phi[ix ,iz ])).^n) .* ( (Pe[ix,iz ] - Pe[ix, iz .- 1])/dz .+ 1.0))/dz) -# - (( ((0.5.*(Phi[ix,iz ] + Phi[ix.+ 1,iz ])).^n) .* ( (Pe[ix.+ 1,iz ] - Pe[ix, iz ])/dx ) - -# ((0.5.*(Phi[ix,iz ] + Phi[ix.- 1,iz ])).^n) .* ( (Pe[ix ,iz ] - Pe[ix.- 1,iz ])/dx ))/dx) - AddInd!(i, res_Pe[ix_c,iz_c]), AddInd!(j,Phi[ix_c,iz_c]); # new part of (Phi[ix,iz].^m).* Pe[ix,iz] - AddInd!(i, res_Pe[ix_c,iz_c]), AddInd!(j,Phi[ix_c,iz_c .+ 1 ]); # Phi[ix,iz .+ 1] - AddInd!(i, res_Pe[ix_c,iz_c]), AddInd!(j,Phi[ix_c,iz_c .- 1 ]); # - AddInd!(i, res_Pe[ix_c,iz_c]), AddInd!(j,Phi[ix_c .- 1, iz_c]); # - AddInd!(i, res_Pe[ix_c,iz_c]), AddInd!(j,Phi[ix_c .+ 1, iz_c]); # - AddInd!(i, res_Pe[ix_c,iz_c]), AddInd!(j, Pe[ix_c,iz_c] ); # De*( Pe[ix,iz] - Pe_old[ix,iz])/dt - AddInd!(i, res_Pe[ix_c,iz_c]), AddInd!(j, Pe[ix_c .+ 1, iz_c]); # Pe[ix.+ 1,iz ] - AddInd!(i, res_Pe[ix_c,iz_c]), AddInd!(j, Pe[ix_c .- 1, iz_c]); # Pe[ix.- 1,iz ] - AddInd!(i, res_Pe[ix_c,iz_c]), AddInd!(j, Pe[ix_c, iz_c .- 1]); # Pe[ix ,iz - 1] - AddInd!(i, res_Pe[ix_c,iz_c]), AddInd!(j, Pe[ix_c, iz_c .+ 1]); # Pe[ix ,iz + 1] - - jac = sparse(i,j,ones(Float64,length(i[:])),n,n); # create the sparse jacobian - colors = matrix_colors(jac) # the number of nonzeros per row - return jac, colors -end - - -function ComputeSparsityPatternJacobian_automatic(x_l, user_ctx) - # This computes the sparsity pattern and coloring of the jacobian automatically - # This will works for any equation but is slow @ high resolutions - - f_Residual = (x -> ForwardDiff_res(x, user_ctx)); # pass additional arguments into the routine - J_julia = ForwardDiff.jacobian(f_Residual,x_l*0 .+ 1); - - # employ sparse structure to compute jacobian - to be moved inside routines - jac = sparse(J_julia); - colors = matrix_colors(jac) # the number of nonzeros per row - - return jac, colors -end - -function ComputeLocalResidual(dm, ArrayLocal_x, ArrayLocal_f, user_ctx) - # Compute the local residual. The vectors include ghost points - n = 3.0 - m = 2.0 - dt = user_ctx.dt; - dz = user_ctx.dz; - dx = user_ctx.dx; - De = user_ctx.De; - - Phi = PETSc.DMStagGetGhostArrayLocationSlot(dm,ArrayLocal_x , PETSc.DMSTAG_ELEMENT, 0); - Phi_old = PETSc.DMStagGetGhostArrayLocationSlot(dm,user_ctx.xold_l, PETSc.DMSTAG_ELEMENT, 0); - Pe = PETSc.DMStagGetGhostArrayLocationSlot(dm,ArrayLocal_x , PETSc.DMSTAG_ELEMENT, 1); - Pe_old = PETSc.DMStagGetGhostArrayLocationSlot(dm,user_ctx.xold_l, PETSc.DMSTAG_ELEMENT, 1); - - res_Phi = PETSc.DMStagGetGhostArrayLocationSlot(dm,ArrayLocal_f, PETSc.DMSTAG_ELEMENT, 0); - res_Pe = PETSc.DMStagGetGhostArrayLocationSlot(dm,ArrayLocal_f, PETSc.DMSTAG_ELEMENT, 1); - - # compute the FD stencil - ind = PETSc.DMStagGetIndices(dm); # indices of (center/element) points, not including ghost values. - - # Porosity residual @ center points - ix = ind.center[1]; - iz = ind.center[2]; - ix_c = ix[1:end]; - iz_c = iz[1:end]; - res_Phi[ix_c,iz_c] = (Phi[ix_c,iz_c] - Phi_old[ix_c,iz_c])/dt + De.*(Pe[ix_c,iz_c]-Pe_old[ix_c,iz_c])/dt + (Phi[ix_c,iz_c].^m) .* Pe[ix_c,iz_c] - - # Pressure update @ center points - ix = ind.center[1]; # lateral BC's are set using ghost points - iz = ind.center[2]; # constant Pe on top and bottom, so this is only for center points - ix_c = ix[1:end]; - iz_c = iz[2:end-1]; - Pe[ix[1]-1,:] = Pe[ix[1],:]; # ghost points on left and right size (here: flux free) - Pe[ix[end]+1 ,:] = Pe[ix[end],:]; - res_Pe[:,iz[1]] = Pe[:,iz[1]] .- 0.; # bottom BC - res_Pe[:,iz[end]] = Pe[:,iz[end]] .- 0.; # top BC - - res_Pe[ix_c,iz_c] = De*( Pe[ix_c,iz_c] - Pe_old[ix_c,iz_c])/dt + - (Phi[ix_c,iz_c].^m).* Pe[ix_c,iz_c] - - (( ((0.5.*(Phi[ix_c,iz_c .+ 1] + Phi[ix_c ,iz_c ])).^n) .* ( (Pe[ix_c,iz_c .+ 1] - Pe[ix_c, iz_c ])/dz .+ 1.0) - - ((0.5.*(Phi[ix_c,iz_c .- 1] + Phi[ix_c ,iz_c ])).^n) .* ( (Pe[ix_c,iz_c ] - Pe[ix_c, iz_c .- 1])/dz .+ 1.0))/dz); # - - (( ((0.5.*(Phi[ix_c,iz_c ] + Phi[ix_c.+ 1,iz_c ])).^n) .* ( (Pe[ix_c.+ 1,iz_c ] - Pe[ix_c, iz_c ])/dx ) - - ((0.5.*(Phi[ix_c,iz_c ] + Phi[ix_c.- 1,iz_c ])).^n) .* ( (Pe[ix_c ,iz_c ] - Pe[ix_c.- 1,iz_c ])/dx ))/dx) - - - # remark to the lines above: these are long, multi line, expressions. For code readability, I chopped them up over several lines. - # In that case you MUST put the +/- sign at the end of every line. If not, some lines will not be evaluated but the code will still run, which is tricky to spot - - - # Cleanup - Base.finalize(Phi); Base.finalize(Phi_old); - Base.finalize(Pe); Base.finalize(Pe_old); - -end - - -function SetInitialPerturbations(user_ctx, x_g) - # Computes the initial perturbations as in the paper - - # Retrieve coordinates from DMStag - DMcoord = PETSc.getcoordinateDM(user_ctx.dm) - vec_coord = PETSc.getcoordinateslocal(user_ctx.dm); - Coord = PETSc.DMStagVecGetArray(DMcoord, vec_coord); - X_cen = Coord[:,:,1]; - Z_cen = Coord[:,:,2]; - - user_ctx.dz = Z_cen[2,2]-Z_cen[2,1]; - user_ctx.dx = X_cen[1,2]-X_cen[2,2]; - - Phi = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 0); # center - Pe = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 1); # center - - Phi_old = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.xold_l, PETSc.DMSTAG_ELEMENT, 0); - Pe_old = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.xold_l, PETSc.DMSTAG_ELEMENT, 1); - - Phi0 =1.0; dPhi1=8.0; dPhi2=1.0; z1=0.0; z2=40.0; x1=0.0; x2=0.0; lambda=1.0 - dPe1 = dPhi1/user_ctx.De; - dPe2 = dPhi2/user_ctx.De; - - Phi .= Phi0 .+ dPhi1.*exp.( -((Z_cen .- z1).^2.0)/lambda^2) + dPhi2.*exp.( -((Z_cen .- z2).^2.0)/lambda^2); - Pe .= -dPe1 .*exp.( -((Z_cen .- z1).^2.0)/lambda^2) - dPe2.*exp.( -((Z_cen .- z2).^2.0)/lambda^2); - - Phi_old .= Phi0 .+ dPhi1.*exp.( -((Z_cen .- z1).^2.0)/lambda^2) + dPhi2.*exp.( -((Z_cen .- z2).^2.0)/lambda^2); - Pe_old .= -dPe1 .*exp.( -((Z_cen .- z1).^2.0)/lambda^2) - dPe2.*exp.( -((Z_cen .- z2).^2.0)/lambda^2); - - # Copy local into global residual vector - PETSc.update!(x_g, user_ctx.x_l, PETSc.INSERT_VALUES); - - # send back coordinates (mainly for plotting) - return X_cen, Z_cen -end - - -# Main solver -nx, nz = 100, 500; -#nx, nz = 6, 5; -W, L = 100,150; - -#user_ctx.De = 1e-1; # Deborah number -#user_ctx.dt = 1e-5; # Note that the timestep has to be tuned a bit depending on the - -user_ctx.De = 1e2; -user_ctx.dt = 1e-2; # Note that the timestep has to be tuned a bit depending on De in order to obtain convergence - -# Both Pe and Phi are @ defined centers -user_ctx.dm = PETSc.DMStagCreate2d(petsclib,MPI.COMM_WORLD, - PETSc.DM_BOUNDARY_GHOSTED, - PETSc.DM_BOUNDARY_NONE, - nx,nz,1,1,0,0,2,PETSc.DMSTAG_STENCIL_BOX,1) - - -PETSc.DMStagSetUniformCoordinatesExplicit(user_ctx.dm, -W/2, W/2, -20, L) # set coordinates -x_g = PETSc.createglobalvector(user_ctx.dm) - - -f_g = PETSc.createglobalvector(user_ctx.dm) -user_ctx.x_l = PETSc.createlocalvector(user_ctx.dm) -user_ctx.xold_l = PETSc.createlocalvector(user_ctx.dm) -user_ctx.xold_g = PETSc.createglobalvector(user_ctx.dm) -user_ctx.f_l = PETSc.createlocalvector(user_ctx.dm) -J = PETSc.creatematrix(user_ctx.dm); # Jacobian from DMStag - - -# initial non-zero structure of jacobian -X_cen, Z_cen = SetInitialPerturbations(user_ctx, x_g) - -# plotting stuff initial setup -Phi = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 0); -Pe = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 1); -Phi_pl = Phi[2:end-1,2:end-1]; -Pe_pl = Pe[2:end-1,2:end-1] -xc_1D,zc_1D = X_cen[2:end-1,2], Z_cen[2,2:end-1]; - -#heatmap(xc_1D,zc_1D,Phi_pl', xlabel="Width", ylabel="Depth", title="Phi") -heatmap(xc_1D,zc_1D,Pe_pl', xlabel="Width", ylabel="Depth", title="Pe") - - -# Compute sparsity & coloring -# do this in case you solve new equations: -#@time user_ctx.jac, user_ctx.colors = ComputeSparsityPatternJacobian_automatic(user_ctx.x_l, user_ctx); - -# much faster, but requires reformulation in case you solve new equations: -@time user_ctx.jac, user_ctx.colors = ComputeSparsityPatternJacobian(user_ctx.x_l, user_ctx); - -ind = PETSc.LocalInGlobalIndices(user_ctx.dm); # extract indices -J = PETSc.MatSeqAIJ(sparse(user_ctx.jac[ind,ind])); - -# - - -S = PETSc.SNES{Float64}(petsclib,MPI.COMM_WORLD; - snes_rtol=1e-12, - snes_monitor=true, - snes_max_it = 500, - snes_monitor_true_residual=true, - snes_converged_reason=true); -S.user_ctx = user_ctx; - - -if true - - -#SetInitialPerturbations(user_ctx, x_g) - -PETSc.setfunction!(S, FormRes!, f_g) -PETSc.setjacobian!(S, FormJacobian!, J, J) - -# Preparation of visualisation -ENV["GKSwstype"]="nul"; -if isdir("viz2D_out")==true - rm("viz2D_out", recursive=true) -end -mkdir("viz2D_out") -loadpath = "./viz2D_out/"; anim = Animation(loadpath,String[]) - - -t = 0.0; -it = 1; -while t < 25.0 - global t, Z, Z_cen, it - - # Solve one (nonlinear) timestep - PETSc.solve!(x_g, S); - - # Update old local values - user_ctx.xold_g = x_g; - PETSc.update!(user_ctx.x_l, x_g, PETSc.INSERT_VALUES) - PETSc.update!(user_ctx.xold_l, user_ctx.xold_g, PETSc.INSERT_VALUES) - - # Update time - t += user_ctx.dt; - it += 1; - - if mod(it,20)==0 # Visualisation - # Extract values and plot - Phi = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 0); - Pe = PETSc.DMStagGetGhostArrayLocationSlot(user_ctx.dm,user_ctx.x_l, PETSc.DMSTAG_ELEMENT, 1); - - #p1 = plot(Phi[2,2:end-1], zc_1D, ylabel="Z", xlabel="ϕ", xlims=( 0.0, 2.0), label=:none, title="De=$(user_ctx.De)"); - #p2 = plot(Pe[2,2:end-1], zc_1D , xlabel="Pe", xlims=(-0.1, 0.1), label=:none, title="$(round(time;sigdigits=3))"); - p1 = plot(Phi[2,2:end-1], zc_1D, ylabel="Z", xlabel="ϕ", label=:none, title="De=$(user_ctx.De)"); - p2 = plot(Pe[2,2:end-1], zc_1D , xlabel="Pe", label=:none, title="$(round(t;sigdigits=3))"); - - #p1 = heatmap(xc_1D,zc_1D,Phi_pl', xlabel="Width", ylabel="Depth", title="Phi") - #p2 = heatmap(xc_1D,zc_1D,Pe_pl', xlabel="Width", ylabel="Depth", title="Pe") - - plot(p1, p2, layout=(1,2)); frame(anim) - - Base.finalize(Pe); Base.finalize(Phi) - end - - println("Timestep $it, time=$t") - -end - -gif(anim, "Example_2D.gif", fps = 15) # create a gif animation -end \ No newline at end of file diff --git a/examples/Diffusion_2d.jl b/examples/Diffusion_2d.jl deleted file mode 100644 index 65669bec..00000000 --- a/examples/Diffusion_2d.jl +++ /dev/null @@ -1,138 +0,0 @@ -# EXCLUDE FROM TESTING -# NOTE: This is temporarily not working until we merge the DMSTAG routines with the new Clang branch -# -# This implements src/snes/examples/tutorials/ex2.c from PETSc using the PETSc.jl package, using SNES -# -# This is the same as SNES_ex2b.j, except that we show how automatic differentiation can be used to -# compute the jacobian. -# -# Newton method to solve u'' + u^{2} = f, sequentially. - -using PETSc, MPI, LinearAlgebra, SparseArrays, Plots, ForwardDiff - -if ~MPI.Initialized() - MPI.Init() -end - -PETSc.initialize() - -``` - Computes initial guess -``` -function FormInitialGuess!(dm,x) - - x_Local = PETSc.DMCreateLocalVector(dm); - x_array = PETSc.DMStagVecGetArray(dm,x_Local); - x_array[1:2,1:2] .= 1; - PETSc.DMLocalToGlobal(dm, x_Local, PETSc.INSERT_VALUES, x) -end - -``` - Computes the residual f, given solution vector x -``` -function FormResidual!(f,x) - n = length(x); - xp = LinRange(0.0,1.0, n); - F = 6.0.*xp .+ (xp .+1.e-12).^6.0; # define source term function - - dx = 1.0/(n-1.0); - f[1] = x[1] - 0.0; - for i=2:n-1 - f[i] = (x[i-1] - 2.0*x[i] + x[i+1])/dx^2 + x[i]*x[i] - F[i] - end - f[n] = x[n] - 1.0; - -end - -``` - Wrapper which makes it easier to compute the jacobian using automatic differntiation -``` -function ForwardDiff_routine(x) - - f = zero(x) # vector of zeros, of same type as e - FormResidual!(f,x); - - return f; -end - -``` - This copies a julia sparse matrix to PETSc MatSeqAIJ format -``` -function Mat_JuliaToPETSc!(J::PETSc.MatSeqAIJ, J_julia::SparseMatrixCSC) - - for i = 1:size(J_julia,1) - col = J_julia[i,:]; - row = ones(Int32,length(col.nzind))*i; - for j=1:length(col.nzind) - J[i, col.nzind[j]] = col.nzval[j]; - end - end - PETSc.assemble(J); # finalize assembly - -end - -``` - Computes the jacobian, given solution vector x -``` -function FormJacobian!(x, args...) - - J = args[1]; # preconditioner = args[2], in case we want it to be different from J - - # Use AD to compute jacobian; by transferring x into sparse, the output will be sparse - J_julia = ForwardDiff.jacobian(ForwardDiff_routine,sparse(x)); - - if typeof(J) <: PETSc.AbstractMat - Mat_JuliaToPETSc!(J, J_julia); # transfer julia sparse matrix 2 petsc - else - J .= J_julia; - end -end - - -# ========================================== -# Main code - - -# Compute initial solution -nx = 5; -nz = 5; -x0 = -5; -xend = 5; -z0 = - 10; -zend = 0; - -dm = PETSc.DMStagCreate2d(MPI.COMM_SELF,PETSc.DM_BOUNDARY_NONE,PETSc.DM_BOUNDARY_NONE,nx,nz,1,1,0,0,1,PETSc.DMSTAG_STENCIL_BOX,2); -PETSc.DMStagSetUniformCoordinatesExplicit(dm, x0, xend, z0, zend); -x = PETSc.DMCreateGlobalVector(dm); - -#FormInitialGuess!(dm,x); - -# Compute initial jacobian using a julia structure to obtain the nonzero structure -# Note that we can also obtain this structure in a different manner -#Jstruct = zeros(n,n); -#FormJacobian!(x, Jstruct); # jacobian in julia form -#Jsp = sparse(Float64.(abs.(Jstruct) .> 0)) # sparse julia, with 1.0 in nonzero spots -#PJ = PETSc.MatSeqAIJ(Jsp); # transfer to PETSc (initialize matrix with correct nonzero pattern) - -# Setup SNES -#x_s = PETSc.VecSeq(x); # solution vector -#res = PETSc.VecSeq(zeros(size(x))); # residual vector - -#S = PETSc.SNES{Float64}(MPI.COMM_SELF; -# snes_rtol=1e-12, -# snes_monitor=true, -# snes_converged_reason=true); -#PETSc.setfunction!(S, FormResidual!, res) -#PETSc.setjacobian!(S, FormJacobian!, PJ, PJ) - -# solve -#PETSc.solve!(x_s, S); - -# Extract & plot solution -#x_sol = x_s.array; # convert solution to julia format -#FormResidual!(res.array,x_sol) # just for checking, compute residual -#@show norm(res.array) - -#plot(LinRange(0,1,n),x_sol,xlabel="width",ylabel="solution") - -#PETSc.finalize() diff --git a/examples/Liouville_Bratu_Gelfand.jl b/examples/Liouville_Bratu_Gelfand.jl new file mode 100644 index 00000000..678cf38c --- /dev/null +++ b/examples/Liouville_Bratu_Gelfand.jl @@ -0,0 +1,277 @@ +# INCLUDE IN MPI TEST +#= +In this example we solve the [Liouville–Bratu–Gelfand +equation](https://en.wikipedia.org/wiki/Liouville%E2%80%93Bratu%E2%80%93Gelfand_equation): +```math +∇² ψ + λ exp(ψ) +``` +with zero Dirichlet boundary conditions. + +To solve the problem we use the standard central, finite difference +approximation of the Laplacian in `d`-dimensions + +This example is motivated by the following PETSc examples: +- [`snes/ex5`](https://petsc.org/release/src/snes/tutorials/ex5.c.html) +- [`snes/ex14`](https://petsc.org/release/src/snes/tutorials/ex14.c.html) +=# + +using MPI +using PETSc +using OffsetArrays: OffsetArray +using LinearAlgebra: norm + +opts = if !isinteractive() + PETSc.parse_options(ARGS) +else + (ksp_monitor = true, ksp_view = true) +end + +# Set our MPI communicator +comm = MPI.COMM_WORLD + +# Set our PETSc Scalar Type +PetscScalar = Float64 + +# get the PETSc lib with our chosen `PetscScalar` type +petsclib = PETSc.getlib(; PetscScalar = PetscScalar) + +# Initialize PETSc +PETSc.initialize(petsclib) + +# dimensionality of the problem +dim = haskey(opts, :dim) ? opts.dim : 3 + +# Set the total number of grid points in each direction +Nq = ntuple(_ -> 10, dim) + +# Set the boundary conditions on each side +bcs = ntuple(_ -> PETSc.DM_BOUNDARY_NONE, dim) + +# Set parameter +λ = PetscScalar(6) + +# Create the PETSC dmda object +da = PETSc.DMDA( + petsclib, + comm, + bcs, # boundary conditions + Nq, # Global grid size + 1, # Number of DOF per node + 1, # Stencil width + PETSc.DMDA_STENCIL_STAR; # Stencil type + opts..., +) + +# Create the PETSC snes object +snes = PETSc.SNES(petsclib, comm; opts...) + +# add the da to the snes +PETSc.setDM!(snes, da) + +# Set up the initial guess +x = PETSc.DMGlobalVec(da) +xl = PETSc.DMLocalVec(da) +PETSc.withlocalarray!(xl; read = false) do l_x + corners = PETSc.getcorners(da) + + # Get the global grid dimensions + Nq = PETSc.getinfo(da).global_size + + # Figure out the interior points + int_min = min(CartesianIndex(corners.size), CartesianIndex(2, 2, 2)) + int_max = max(CartesianIndex(corners.size .- 1), CartesianIndex(1, 1, 1)) + interior = (int_min):(int_max) + + # Allows us to adress the local array with global indexing + ox = @view PETSc.reshapelocalarray(l_x, da)[1, :, :, :] + + # Set up the global coordinates in each direction + # -1 to 1 when Nq > 1 and 0 otherwise + coords = map( + Nq -> + Nq == 1 ? range(PetscScalar(0), stop = 0, length = Nq) : + range(-PetscScalar(1), stop = 1, length = Nq), + Nq, + ) + + scaling = λ / (λ + 1) + + # Loop over all the points on the processor and set the initial condition to + # be a hat function + for i in ((corners.lower):(corners.upper)) + ox[i] = + scaling * sqrt( + min( + (1 - abs(coords[1][i[1]])), + (1 - abs(coords[2][i[2]])), + (1 - abs(coords[3][i[3]])), + ), + ) + end +end +PETSc.dm_local_to_global!(xl, x, da, PETSc.INSERT_VALUES) + +# Set up the nonlinear function +r = similar(x) +PETSc.setfunction!(snes, r) do g_fx, snes, g_x + # Get the DMDA associated with the snes + da = PETSc.getDMDA(snes) + + # Get a local vector and transfer the data from the global vector into it + l_x = PETSc.DMLocalVec(da) + PETSc.dm_global_to_local!(g_x, l_x, da, PETSc.INSERT_VALUES) + + ghostcorners = PETSc.getghostcorners(da) + corners = PETSc.getcorners(da) + + # Global grid size + Nq = PETSc.getinfo(da).global_size + + # grid spacing in each dimension + Δx, Δy, Δz = PetscScalar(1) ./ Nq + + # Get local arrays + PETSc.withlocalarray!( + (g_fx, l_x); + read = (false, true), + write = (true, false), + ) do fx, x + + # reshape the array and allow for global indexing + x = @view PETSc.reshapelocalarray(x, da)[1, :, :, :] + fx = @view PETSc.reshapelocalarray(fx, da)[1, :, :, :] + + # Store a tuple of stencils in each direction + stencils = ( + ( + CartesianIndex(-1, 0, 0), + CartesianIndex(0, 0, 0), + CartesianIndex(1, 0, 0), + ), + ( + CartesianIndex(0, -1, 0), + CartesianIndex(0, 0, 0), + CartesianIndex(0, 1, 0), + ), + ( + CartesianIndex(0, 0, -1), + CartesianIndex(0, 0, 0), + CartesianIndex(0, 0, 1), + ), + ) + # Weights for each direction + weights = (Δy * Δz / Δx, Δx * Δz / Δy, Δx * Δy / Δz) + + # loop over indices and set the function value + for ind in ((corners.lower):(corners.upper)) + # If on the boundary just set equal to the incoming data + # otherwise apply the finite difference operator + if any(ntuple(j -> ind[j] == 1 || ind[j] == Nq[j], dim)) + fx[ind] = x[ind] + else + # Apply the source + u = -Δx * Δy * Δz * λ * exp(x[ind]) + + # Apply the finite diffference stencil + for (s, w) in zip(stencils[1:dim], weights[1:dim]) + u += + w * (-x[ind + s[1]] + 2 * x[ind + s[2]] - x[ind + s[3]]) + end + fx[ind] = u + end + end + end + + # Clean up the local vector + PETSc.destroy(l_x) + return 0 +end + +J = LibPETSc.DMCreateMatrix(petsclib, da) +PETSc.setjacobian!(snes, J) do J, snes, g_x + # Get the DMDA associated with the snes + da = PETSc.getDMDA(snes) + + # Get the corners of the points we own + corners = PETSc.getcorners(da) + + # Global grid size + Nq = PETSc.getinfo(da).global_size + + # grid spacing in each dimension + Δx, Δy, Δz = PetscScalar(1) ./ Nq + + # Store a tuple of stencils in each direction + stencils = ( + ( + CartesianIndex(-1, 0, 0), + CartesianIndex(0, 0, 0), + CartesianIndex(1, 0, 0), + ), + ( + CartesianIndex(0, -1, 0), + CartesianIndex(0, 0, 0), + CartesianIndex(0, 1, 0), + ), + ( + CartesianIndex(0, 0, -1), + CartesianIndex(0, 0, 0), + CartesianIndex(0, 0, 1), + ), + ) + # Weights for each direction + weights = (Δy * Δz / Δx, Δx * Δz / Δy, Δx * Δy / Δz) + + # Get a local array of the solution vector + PETSc.withlocalarray!(g_x; write = false) do l_x + # reshape so we can use multi-D indexing + x = @view PETSc.reshapelocalarray(l_x, da)[1, :, :, :] + + # loop over indices and set the function value + for ind in ((corners.lower):(corners.upper)) + # If on the boundary just set equal to the incoming data + # otherwise apply the finite difference operator + if any(ntuple(j -> ind[j] == 1 || ind[j] == Nq[j], dim)) + J[ind, ind] = 1 + else + # We accumulate the diagonal and add it at the end + Jii = -Δx * Δy * Δz * λ * exp(x[ind]) # Apply the source + + # Apply the finite diffference stencil + for (s, w) in zip(stencils[1:dim], weights[1:dim]) + Jii += w * 2 + J[ind, ind + s[1]] = -w + J[ind, ind + s[3]] = -w + end + J[ind, ind] = Jii + end + end + end + + # Assemble the Jacobian matrix + PETSc.assemble!(J) + return 0 +end + +if MPI.Comm_rank(comm) == 0 + println(@elapsed(PETSc.solve!(x, snes))) +else + PETSc.solve!(x, snes) +end +g = similar(x) +snes.f!(g, snes, x) +nm = norm(g) +if MPI.Comm_rank(comm) == 0 + @show nm +end + +# Do some clean up +PETSc.destroy(J) +PETSc.destroy(x) +PETSc.destroy(g) +PETSc.destroy(r) +PETSc.destroy(da) +PETSc.destroy(snes) + +PETSc.finalize(petsclib) + diff --git a/examples/SNES_ex2.jl b/examples/SNES_ex2.jl index 99dff26c..ba2c6bc3 100644 --- a/examples/SNES_ex2.jl +++ b/examples/SNES_ex2.jl @@ -12,18 +12,21 @@ end petsclib = PETSc.petsclibs[1] PETSc.initialize(petsclib) - +comm = MPI.COMM_WORLD """ - Computes initial guess + FormInitialGuess!(x) +Computes initial guess """ function FormInitialGuess!(x) - for i=1:length(x) + for i in eachindex(x) x[i] = 0.50; end + return nothing end """ - Computes rhs forcing function + F = SetInitialArrays(n) +Computes rhs forcing function """ function SetInitialArrays(n) h = 1.0/(n-1.0) @@ -39,21 +42,10 @@ function SetInitialArrays(n) end """ - Computes the residual f, given solution vector x + FormResidual!(cf,cx, args...) +Computes the residual `f`, given solution vector `x` """ -function FormResidual!(cf,cx, args...) - if typeof(cx) <: Ptr{Nothing} - # When this routine is called from PETSc, cx is a pointer to a global vector - # That's why we have to transfer it first to - x = PETSc.unsafe_localarray(PETSc.scalartype(petsclib),cx, write=false) - else - x = cx; - end - if typeof(cf) <: Ptr{Nothing} - f = PETSc.unsafe_localarray(PETSc.scalartype(petsclib),cf, write=true) - else - f = cf; - end +function FormResidual!(f,snes, x) n = length(x); xp = LinRange(0.0,1.0, n); F = 6.0.*xp .+ (xp .+1.e-12).^6.0; # define source term function @@ -64,27 +56,17 @@ function FormResidual!(cf,cx, args...) f[i] = (x[i-1] - 2.0*x[i] + x[i+1])/dx^2 + x[i]*x[i] - F[i] end f[n] = x[n] - 1.0; - Base.finalize(x) - Base.finalize(f) + return 0 end - """ Computes the jacobian, given solution vector x """ -function FormJacobian!(cx, args...) - - if typeof(cx) <: Ptr{Nothing} - x = PETSc.unsafe_localarray(PETSc.scalartype(petsclib),cx, write=false) - else - x = cx; - end - - J = args[1]; # preconditioner = args[2], in case we want it to be different from J - n = length(x); +function FormJacobian!(J, snes, x) + n = length(x) dx = 1.0/(n-1.0); - + # interior points (hand-coded jacobian) for i=2:n-1 J[i,i-1] = 1.0/dx^2; @@ -95,13 +77,10 @@ function FormJacobian!(cx, args...) # boundary points J[1,1] = 1.0; J[n,n] = 1.0; - - if typeof(J) <: PETSc.AbstractMat - PETSc.assemble(J); # finalize assembly - + if !isnothing(snes) + PETSc.assemble!(J) end - - Base.finalize(x) + return 0 end @@ -119,31 +98,41 @@ FormInitialGuess!(x); # Compute initial jacobian using a julia structure to obtain the nonzero structure # Note that we can also obtain this structure in a different manner Jstruct = zeros(n,n); -FormJacobian!(x, Jstruct); # jacobian in julia form -Jsp = sparse(Float64.(abs.(Jstruct) .> 0)) # sparse julia, with 1.0 in nonzero spots -PJ = PETSc.MatSeqAIJ(Jsp); # transfer to +FormJacobian!(Jstruct, nothing, x); # jacobian in julia form +Jsp = sparse(Float64.(abs.(Jstruct) .> 0)) # sparse julia, with 1.0 in nonzero spots +PJ = PETSc.MatSeqAIJWithArrays(petsclib, comm, Jsp); # transfer to PETSc format # Setup snes -x_s = PETSc.VecSeq(x); # solution vector -res = PETSc.VecSeq(F); # residual vector +x_s = LibPETSc.VecCreateSeqWithArray(petsclib,comm, 1, length(x), x) # solution vector +res = LibPETSc.VecCreateSeqWithArray(petsclib,comm, 1, length(F), F) # residual vector +b = LibPETSc.VecCreateSeqWithArray(petsclib,comm, 1, length(F), F) # residual vector -S = PETSc.SNES{Float64}(PETSc.petsclibs[1],MPI.COMM_WORLD; +S = PETSc.SNES(petsclib,comm; snes_rtol=1e-12, - snes_monitor=false, + snes_monitor=true, snes_converged_reason=false); + +# Set functions for residual and jacobian computations PETSc.setfunction!(S, FormResidual!, res) -PETSc.setjacobian!(S, FormJacobian!, PJ, PJ) +PETSc.setjacobian!(S, FormJacobian!, PJ) # solve PETSc.solve!(x_s, S); # Extract & plot solution -x_sol = x_s.array; # convert solution to julia format -FormResidual!(res.array,x_sol) # just for checking, compute residual +x_sol = x_s[:]; # convert solution to julia format +FormResidual!(res,S, x_s) -@show norm(res.array) +@show norm(res[:]) +# cleanup +PETSc.destroy(x_s) +PETSc.destroy(res) +PETSc.destroy(b) +PETSc.destroy(PJ) +PETSc.destroy(S) PETSc.finalize(petsclib) # plot solution in REPL lineplot(LinRange(0,1,n),x_sol,xlabel="width",ylabel="solution") + diff --git a/examples/SNES_ex2b.jl b/examples/SNES_ex2b.jl index bdb94184..9f5273e8 100644 --- a/examples/SNES_ex2b.jl +++ b/examples/SNES_ex2b.jl @@ -10,14 +10,14 @@ using PETSc, MPI, LinearAlgebra, SparseArrays, UnicodePlots, ForwardDiff using Test - if ~MPI.Initialized() MPI.Init() end - petsclib = PETSc.petsclibs[1] PETSc.initialize(petsclib) +comm = MPI.COMM_WORLD + """ Computes initial guess @@ -28,22 +28,27 @@ function FormInitialGuess!(x) end end +""" + F = SetInitialArrays(n) +Computes rhs forcing function +""" +function SetInitialArrays(n) + h = 1.0/(n-1.0) + F = zeros(n); + xp = 0.0; + for i=1:n + v = 6.0*xp + (xp+1.e-12)^6.0; + F[i] = v; + xp = xp+h; + end + + return F +end + """ Computes the residual f, given solution vector x """ -function FormResidual!(cf,cx, args...) - if typeof(cx) <: Ptr{Nothing} - # When this routine is called from PETSc, cx is a pointer to a global vector - # That's why we have to transfer it first to - x = PETSc.unsafe_localarray(PETSc.scalartype(petsclib),cx, write=false) - else - x = cx; - end - if typeof(cf) <: Ptr{Nothing} - f = PETSc.unsafe_localarray(PETSc.scalartype(petsclib),cf, write=true) - else - f = cf; - end +function FormResidual1!(f,snes, x) n = length(x); xp = LinRange(0.0,1.0, n); F = 6.0.*xp .+ (xp .+1.e-12).^6.0; # define source term function @@ -54,47 +59,45 @@ function FormResidual!(cf,cx, args...) f[i] = (x[i-1] - 2.0*x[i] + x[i+1])/dx^2 + x[i]*x[i] - F[i] end f[n] = x[n] - 1.0; - Base.finalize(x) - Base.finalize(f) - + + return 0 end + """ Wrapper which makes it easier to compute the jacobian using automatic differntiation """ function ForwardDiff_res(x) f = zero(x) # vector of zeros, of same type as x - FormResidual!(f,x); + FormResidual1!(f,nothing, x); return f; end + """ Computes the jacobian, given solution vector x """ -function FormJacobian!(cx, args...) - - if typeof(cx) <: Ptr{Nothing} - x = PETSc.unsafe_localarray(PETSc.scalartype(petsclib),cx, write=false) - else - x = cx; - end - J = args[1]; # preconditioner = args[2], in case we want it to be different from J - +function FormJacobian1!(J, snes, x) + # Use AD to compute jacobian; by transferring x into sparse, the output will be sparse - J_julia = ForwardDiff.jacobian(ForwardDiff_res,sparse(x)); + J_julia = ForwardDiff.jacobian(ForwardDiff_res,x[:]); + copyto!(J, sparse(J_julia)) - J .= J_julia; # copy to petsc format + if !isnothing(snes) + PETSc.assemble!(J) + end + return 0 end - # ========================================== # Main code # Compute initial solution -n = 101; +n = 21; +F = SetInitialArrays(n); x = zeros(n); FormInitialGuess!(x); @@ -102,31 +105,44 @@ FormInitialGuess!(x); # Compute initial jacobian using a julia structure to obtain the nonzero structure # Note that we can also obtain this structure in a different manner Jstruct = zeros(n,n); -FormJacobian!(x, Jstruct); # jacobian in julia form +FormJacobian1!(Jstruct, nothing, x); # jacobian in julia form Jsp = sparse(Float64.(abs.(Jstruct) .> 0)) # sparse julia, with 1.0 in nonzero spots -PJ = PETSc.MatSeqAIJ(Jsp); # transfer to PETSc (initialize matrix with correct nonzero pattern) +PJ = PETSc.MatSeqAIJWithArrays(petsclib, comm, Jsp); # transfer to PETSc format # Setup SNES -x_s = PETSc.VecSeq(x); # solution vector -res = PETSc.VecSeq(zeros(size(x))); # residual vector +#x_s = PETSc.VecSeq(petsclib, comm, x); # solution vector +#b = PETSc.VecSeq(petsclib, comm, x); # solution vector +#res = PETSc.VecSeq(petsclib, comm, zeros(size(x))); # residual vector -S = PETSc.SNES{Float64}(PETSc.petsclibs[1],MPI.COMM_SELF; +# Setup snes +x_s = LibPETSc.VecCreateSeqWithArray(petsclib,comm, 1, length(x), x) # solution vector +res = LibPETSc.VecCreateSeqWithArray(petsclib,comm, 1, length(F), F) # residual vector +b = LibPETSc.VecCreateSeqWithArray(petsclib,comm, 1, length(F), F) # residual vector + +snes = PETSc.SNES(petsclib,comm; snes_rtol=1e-12, snes_monitor=nothing, snes_converged_reason=nothing); -PETSc.setfunction!(S, FormResidual!, res) -PETSc.setjacobian!(S, FormJacobian!, PJ, PJ) +PETSc.setfunction!(snes, FormResidual1!, res) +PETSc.setjacobian!(snes, FormJacobian1!, PJ) # solve -PETSc.solve!(x_s, S); +PETSc.solve!(x_s, snes); # Extract & plot solution -x_sol = x_s.array; # convert solution to julia format -FormResidual!(res.array,x_sol) # just for checking, compute residual +x_sol = x_s[:]; # convert solution to julia format +FormResidual1!(res,snes, x_s) -@show norm(res.array) +@show norm(res[:]) +# cleanup +PETSc.destroy(x_s) +PETSc.destroy(res) +PETSc.destroy(b) +PETSc.destroy(PJ) +PETSc.destroy(snes) PETSc.finalize(petsclib) # plot solution in REPL lineplot(LinRange(0,1,n),x_sol,xlabel="width",ylabel="solution") + diff --git a/examples/dmda_laplacian.jl b/examples/dmda_laplacian.jl new file mode 100644 index 00000000..e40b57f5 --- /dev/null +++ b/examples/dmda_laplacian.jl @@ -0,0 +1,256 @@ + +# # Finite Difference Laplacian +# +# This example solves a simple 2-D Laplacian with zero Dirichlet boundary +# conditions using the PETSc DMDA interface. +# +# The approach taken is that the 5-point Laplacian is applied in the interior +# and boundary points are included in the solve, but the forcing for the +# boundary data is the Dirichlet boundary condition and the matrix entry for +# these points is set to the identity. +# +# The exact solution is u(x,y) = sin(2πx)sin(2πy) on [0,1]². +# +# ## Command Line Options: +# +# Grid configuration: +# --N Grid size (default: 65, creates N×N grid) +# +# PETSc options (use single dash): +# -ksp_type KSP solver type (preonly, gmres, cg, etc.) +# -pc_type Preconditioner type (lu, mg, sor, ilu, etc.) +# -ksp_rtol Relative convergence tolerance +# -ksp_monitor Monitor convergence +# +# ## Usage Examples: +# +# 1. Run with default settings (65×65 grid, LU solver): +# +# julia --project=.. dmda_laplacian.jl +# +# 2. Solve on a 129×129 grid with direct LU solver: +# +# julia --project=.. dmda_laplacian.jl --N 129 -ksp_type preonly -pc_type lu +# +# 3. Large grid with iterative SOR solver: +# +# julia --project=.. dmda_laplacian.jl --N 257 -pc_type sor -ksp_rtol 1e-10 -ksp_monitor +# +# 4. Small grid with ILU preconditioner: +# +# julia --project=.. dmda_laplacian.jl --N 33 -pc_type ilu -ksp_rtol 1e-10 -ksp_monitor +# +# 5. Geometric multigrid solver on 513×513 grid: +# +# julia --project=.. dmda_laplacian.jl --N 513 -pc_type mg -ksp_rtol 1e-12 -mg_coarse_pc_type lu +# +# 6. Run in parallel with MPI (4 processes): +# +# julia> using MPI +# julia> mpiexec(cmd -> run(`$cmd -n 4 julia --project dmda_laplacian.jl --N 129 -pc_type mg`)) +# +# For convergence analysis across multiple grid resolutions, see dmda_laplacian_convergence.jl + +using MPI +using PETSc +using UnicodePlots: heatmap +using ForwardDiff: derivative +using Printf + +# boundary data and forcing +exact(x, y) = sin(2π * x) * sin(2π * y) +# The discrete operator is -∇², so forcing = -∇²(exact) +# For exact(x,y) = sin(2πx)sin(2πy), we have ∇²u = -2(2π)²sin(2πx)sin(2πy) +# So forcing = -∇²u = 8π²sin(2πx)sin(2πy) +forcing(x, y) = 8 * π^2 * sin(2π * x) * sin(2π * y) + +# Parse options +opts = if !isinteractive() + PETSc.parse_options(ARGS) +else + (ksp_monitor = false, ksp_type = "preonly", pc_type = "lu", ksp_rtol = 1e-12) +end + +# Parse grid size from command line (default: 65) +N = parse(Int, get(opts, Symbol("-N"), "65")) + +# Set our MPI communicator +comm = MPI.COMM_WORLD + +# Set our PETSc Scalar Type +PetscScalar = Float64 + +# get the PETSc lib with our chosen `PetscScalar` type +petsclib = PETSc.getlib(; PetscScalar = PetscScalar) + +# Initialize PETSc +PETSc.initialize(petsclib) + +# Grid size (set via --N option, default: 65) +Nq = (N, N) + +# Create the DMDA +da = PETSc.DMDA( + petsclib, + comm, + (PETSc.DM_BOUNDARY_NONE, PETSc.DM_BOUNDARY_NONE), + Nq, + 1, + 1, + PETSc.DMDA_STENCIL_STAR; + opts..., +) + +# Setup the Krylov solver +ksp = PETSc.KSP(da; opts...) + +# Define the operator assembly function +function assemble_operator!(A, _, ksp) + da = PETSc.getDMDA(ksp) + corners = PETSc.getcorners(da) + Nq = PETSc.getinfo(da).global_size[1:2] + + Δx = PetscScalar(1 / (Nq[1] - 1)) + Δy = PetscScalar(1 / (Nq[2] - 1)) + + interior = (CartesianIndex(2, 2, 1)):(CartesianIndex(Nq[1] - 1, Nq[2] - 1, 1)) + + sten = ( + CartesianIndex(-1, 0, 0), + CartesianIndex(1, 0, 0), + CartesianIndex(0, -1, 0), + CartesianIndex(0, 1, 0), + CartesianIndex(0, 0, 0), + ) + vals = (-1 / Δx^2, -1 / Δx^2, -1 / Δy^2, -1 / Δy^2, 2 / Δx^2 + 2 / Δy^2) + + for i in ((corners.lower):(corners.upper)) + if i ∈ interior + for (s, v) in zip(sten, vals) + A[i, i + s] = v + end + else + A[i, i] = 1 + end + end + + PETSc.assemble!(A) + return 0 +end + +PETSc.setcomputeoperators!(ksp, assemble_operator!) + +# Set the right-hand side +PETSc.setcomputerhs!(ksp) do petsc_b, ksp + da = PETSc.getDMDA(ksp) + corners = PETSc.getcorners(da) + Nq = PETSc.getinfo(da).global_size[1:2] + + g_x = range(PetscScalar(0), length = Nq[1], stop = 1) + g_y = range(PetscScalar(0), length = Nq[2], stop = 1) + + l_x = g_x[(corners.lower[1]):(corners.upper[1])] + l_y = g_y[(corners.lower[2]):(corners.upper[2])] + + PETSc.withlocalarray!(petsc_b; read = false) do b + b = reshape(b, Int64(corners.size[1]), Int64(corners.size[2])) + b .= forcing.(l_x, l_y') + + if corners.lower[1] == 1 + b[1, :] .= exact.(l_x[1], l_y) + end + if corners.lower[2] == 1 + b[:, 1] .= exact.(l_x, l_y[1]) + end + if corners.upper[1] == Nq[1] + b[end, :] .= exact.(l_x[end], l_y) + end + if corners.upper[2] == Nq[2] + b[:, end] .= exact.(l_x, l_y[end]) + end + end + + return 0 +end + +# Solve the problem +PETSc.solve!(ksp) + +# Check convergence +reason = PETSc.LibPETSc.KSPGetConvergedReason(petsclib, ksp) + +# Get the solution and compute error +sol = PETSc.get_solution(ksp) +corners = PETSc.getcorners(da) +Nq = PETSc.getinfo(da).global_size[1:2] + +g_x = range(PetscScalar(0), length = Nq[1], stop = 1) +g_y = range(PetscScalar(0), length = Nq[2], stop = 1) + +l_x = g_x[(corners.lower[1]):(corners.upper[1])] +l_y = g_y[(corners.lower[2]):(corners.upper[2])] + +Δx = PetscScalar(l_x.step) + +x = sol[:] +u = reshape(x, corners.size[1], corners.size[2]) + +# Compute error only in interior (excluding boundaries) +loc_err2_sum = 0.0 +loc_max_err = 0.0 +loc_npts = 0 + +for i in 1:length(l_x), j in 1:length(l_y) + global loc_err2_sum, loc_max_err, loc_npts + gi = corners.lower[1] + i - 1 + gj = corners.lower[2] + j - 1 + + if gi > 1 && gi < Nq[1] && gj > 1 && gj < Nq[2] + err = abs(u[i,j] - exact(l_x[i], l_y[j])) + loc_err2_sum += err^2 + loc_max_err = max(loc_max_err, err) + loc_npts += 1 + end +end + +root = 0 +err2_sum = MPI.Reduce(loc_err2_sum, +, root, comm) +npts_total = MPI.Reduce(loc_npts, +, root, comm) +max_err = MPI.Reduce(loc_max_err, max, root, comm) + +# Report results on root processor +if root == MPI.Comm_rank(comm) + L2_error = sqrt(err2_sum / npts_total) + + # Report convergence status + if Integer(reason) > 0 + println("KSP converged with reason: $reason") + elseif Integer(reason) < 0 + println("WARNING: KSP diverged with reason: $reason") + else + println("KSP still iterating: $reason") + end + + println("L2-error (interior): $(Printf.@sprintf("%.6e", L2_error))") + println("Max-error (interior): $(Printf.@sprintf("%.6e", max_err))") + println("Mesh spacing h: $(Printf.@sprintf("%.6e", Δx))") + + # Compute error field for plotting + u_exact = exact.(l_x, l_y') + error_field = abs.(u .- u_exact) + + # Plot solution + println("\nSolution heatmap:") + println(heatmap(u')) + + # Plot error + println("\nError heatmap:") + println(heatmap(error_field')) +end + +# Clean up +PETSc.destroy(ksp) +PETSc.destroy(da) + +PETSc.finalize(petsclib) + diff --git a/examples/dmda_laplacian_convergence.jl b/examples/dmda_laplacian_convergence.jl new file mode 100644 index 00000000..8eb10be2 --- /dev/null +++ b/examples/dmda_laplacian_convergence.jl @@ -0,0 +1,526 @@ +# EXCLUDE FROM TESTING +# # Finite Difference Laplacian - Convergence Analysis +# +# This example performs convergence analysis for a 2-D Laplacian solver with zero +# Dirichlet boundary conditions using the PETSc DMDA interface. +# +# The approach taken is that the 5-point Laplacian is applied in the interior +# and boundary points are included in the solve, but the forcing for the +# boundary data is the Dirichlet boundary condition and the matrix entry for +# these points is set to the identity. +# +# By default, runs convergence tests on grids 17×17, 33×33, 65×65, and 129×129. +# Use --single_solve flag for a single solve on a 65×65 grid instead. +# +# ## Command Line Options: +# +# Grid configuration: +# --grids Comma-separated list of grid sizes (e.g., 17,65,257,1025) +# --N_min Minimum grid size for auto-generation (default: 17) +# --N_max Maximum grid size for auto-generation (default: 129) +# Auto-generates: 17, 33, 65, 129, 257, 513, 1025, 2049, ... +# +# Multigrid configuration: +# --mg_levels_list Comma-separated MG levels per grid (e.g., 3,5,7,9) +# --mg_levels Fixed number of MG levels for all grids +# If neither specified: auto-scales with grid (N=17→3, N=33→4, ...) +# +# Other options: +# -single_solve Run single solve instead of convergence test +# +# PETSc options (use single dash): +# -ksp_type KSP solver type (preonly, gmres, richardson, etc.) +# -pc_type Preconditioner type (lu, mg, sor, ilu, etc.) +# -ksp_rtol Relative convergence tolerance +# -mg_coarse_pc_type Coarse grid preconditioner for multigrid +# -ksp_monitor Monitor convergence +# +# ## Usage Examples: +# +# 1. Default convergence analysis (N=17,33,65,129 with LU solver): +# +# julia --project=.. dmda_laplacian_convergence.jl +# +# 2. Custom grid sizes with geometric multigrid: +# +# julia --project=.. dmda_laplacian_convergence.jl --grids 17,65,257,1025 -pc_type mg -mg_coarse_pc_type lu +# +# 3. Custom grids with specific MG levels for each: +# +# julia --project=.. dmda_laplacian_convergence.jl --grids 33,129,513 --mg_levels_list 4,6,8 -pc_type mg -mg_coarse_pc_type lu +# +# 4. Auto-generate grids with fixed MG levels: +# +# julia --project=.. dmda_laplacian_convergence.jl --N_max 513 --mg_levels 7 -pc_type mg -mg_coarse_pc_type lu +# +# 5. Direct solver with preonly KSP: +# +# julia --project=.. dmda_laplacian_convergence.jl --N_max 257 -ksp_type preonly -pc_type lu +# +# 6. Iterative SOR solver: +# +# julia --project=.. dmda_laplacian_convergence.jl --grids 17,65,257,1025 -pc_type sor -ksp_rtol 1e-10 +# +# 7. Single solve with multigrid: +# +# julia --project=.. dmda_laplacian_convergence.jl --single_solve -pc_type mg -ksp_rtol 1e-12 -mg_coarse_pc_type lu +# +# 8. Run in parallel with MPI (4 processes): +# +# julia> using MPI +# julia> mpiexec(cmd -> run(`$cmd -n 4 julia --project dmda_laplacian_convergence.jl -pc_type mg`)) +# +# Notes: +# - Geometric multigrid (MG) uses the DMDA grid hierarchy for automatic coarsening +# - By default, MG levels automatically scale with grid size (N=17→3, N=33→4, N=65→5, N=129→6) +# - Use --mg_levels to fix the number of levels for all grids +# - PETSc options use single dash (-), Julia script options use double dash (--) + +using MPI +using PETSc +using UnicodePlots: heatmap +using ForwardDiff: derivative +using Printf +using Statistics: mean + +# Set up the problem by using an exact solution and then using this to set the +# boundary data and forcing +exact(x, y) = sin(2π * x) * sin(2π * y) +# The discrete operator is -∇², so forcing = -∇²(exact) +# For exact(x,y) = sin(2πx)sin(2πy), we have ∇²u = -2(2π)²sin(2πx)sin(2πy) +# So forcing = -∇²u = 8π²sin(2πx)sin(2πy) +forcing(x, y) = 8 * π^2 * sin(2π * x) * sin(2π * y) + +""" + solve_laplacian(petsclib, comm, N::Int, opts) + +Solve the 2D Laplacian problem on an N×N grid and return the L2 and max errors +(computed on interior points only). +""" +function solve_laplacian(petsclib, comm, N::Int, opts; mg_levels=nothing) + PetscScalar = petsclib.PetscScalar + Nq = (N, N) + + # Add mg_levels to opts if using multigrid and mg_levels is specified + if mg_levels !== nothing && get(opts, :pc_type, nothing) == "mg" + opts = merge(opts, (var"-pc_mg_levels" = mg_levels,)) + end + + # Add direct coarse grid solver for multigrid if not already specified + if get(opts, :pc_type, nothing) == "mg" && !haskey(opts, :mg_coarse_pc_type) + opts = merge(opts, (var"-mg_coarse_pc_type" = "lu",)) + end + + # Create the DMDA + da = PETSc.DMDA( + petsclib, + comm, + (PETSc.DM_BOUNDARY_NONE, PETSc.DM_BOUNDARY_NONE), + Nq, + 1, + 1, + PETSc.DMDA_STENCIL_STAR; + opts..., + ) + + # Setup the Krylov solver + ksp = PETSc.KSP(da; opts...) + + # Define the operator assembly function + function assemble_operator!(A, _, ksp) + da = PETSc.getDMDA(ksp) + corners = PETSc.getcorners(da) + Nq = PETSc.getinfo(da).global_size[1:2] + + Δx = PetscScalar(1 / (Nq[1] - 1)) + Δy = PetscScalar(1 / (Nq[2] - 1)) + + interior = (CartesianIndex(2, 2, 1)):(CartesianIndex(Nq[1] - 1, Nq[2] - 1, 1)) + + sten = ( + CartesianIndex(-1, 0, 0), + CartesianIndex(1, 0, 0), + CartesianIndex(0, -1, 0), + CartesianIndex(0, 1, 0), + CartesianIndex(0, 0, 0), + ) + vals = (-1 / Δx^2, -1 / Δx^2, -1 / Δy^2, -1 / Δy^2, 2 / Δx^2 + 2 / Δy^2) + + for i in ((corners.lower):(corners.upper)) + if i ∈ interior + for (s, v) in zip(sten, vals) + A[i, i + s] = v + end + else + A[i, i] = 1 + end + end + + PETSc.assemble!(A) + return 0 + end + + PETSc.setcomputeoperators!(ksp, assemble_operator!) + + # Set the right-hand side + PETSc.setcomputerhs!(ksp) do petsc_b, ksp + da = PETSc.getDMDA(ksp) + corners = PETSc.getcorners(da) + Nq = PETSc.getinfo(da).global_size[1:2] + + g_x = range(PetscScalar(0), length = Nq[1], stop = 1) + g_y = range(PetscScalar(0), length = Nq[2], stop = 1) + + l_x = g_x[(corners.lower[1]):(corners.upper[1])] + l_y = g_y[(corners.lower[2]):(corners.upper[2])] + + PETSc.withlocalarray!(petsc_b; read = false) do b + b = reshape(b, Int64(corners.size[1]), Int64(corners.size[2])) + b .= forcing.(l_x, l_y') + + if corners.lower[1] == 1 + b[1, :] .= exact.(l_x[1], l_y) + end + if corners.lower[2] == 1 + b[:, 1] .= exact.(l_x, l_y[1]) + end + if corners.upper[1] == Nq[1] + b[end, :] .= exact.(l_x[end], l_y) + end + if corners.upper[2] == Nq[2] + b[:, end] .= exact.(l_x, l_y[end]) + end + end + + return 0 + end + + # Solve the problem and time it + t_start = time() + PETSc.solve!(ksp) + t_solve = time() - t_start + + # Check convergence and get iteration count + reason = PETSc.LibPETSc.KSPGetConvergedReason(petsclib, ksp) + niter = PETSc.LibPETSc.KSPGetIterationNumber(petsclib, ksp) + if Integer(reason) < 0 && MPI.Comm_rank(comm) == 0 + @warn "KSP diverged for N=$N with reason: $reason" + end + + # Get the solution and compute error + sol = PETSc.get_solution(ksp) + corners = PETSc.getcorners(da) + Nq = PETSc.getinfo(da).global_size[1:2] + + g_x = range(PetscScalar(0), length = Nq[1], stop = 1) + g_y = range(PetscScalar(0), length = Nq[2], stop = 1) + + l_x = g_x[(corners.lower[1]):(corners.upper[1])] + l_y = g_y[(corners.lower[2]):(corners.upper[2])] + + Δx = PetscScalar(l_x.step) + + x = sol[:] + u = reshape(x, corners.size[1], corners.size[2]) + + # Compute error only in interior (excluding boundaries) + loc_err2_sum = 0.0 + loc_max_err = 0.0 + loc_npts = 0 + + for i in 1:length(l_x) + for j in 1:length(l_y) + gi = corners.lower[1] + i - 1 + gj = corners.lower[2] + j - 1 + + if gi > 1 && gi < Nq[1] && gj > 1 && gj < Nq[2] + err = abs(u[i,j] - exact(l_x[i], l_y[j])) + loc_err2_sum += err^2 + loc_max_err = max(loc_max_err, err) + loc_npts += 1 + end + end + end + + root = 0 + err2_sum = MPI.Reduce(loc_err2_sum, +, root, comm) + npts_total = MPI.Reduce(loc_npts, +, root, comm) + max_err = MPI.Reduce(loc_max_err, max, root, comm) + + L2_error = nothing + if root == MPI.Comm_rank(comm) + L2_error = sqrt(err2_sum / npts_total) + end + + # Return u for visualization (only needed for single solve mode) + return L2_error, max_err, Δx, reason, niter, t_solve, u, l_x, l_y, ksp, da +end + +""" + run_convergence_analysis(petsclib, comm, grid_sizes, opts; mg_levels_list=nothing, mg_levels_override=nothing) + +Run a convergence analysis for the specified grid sizes and return errors and mesh spacings. +For multigrid solvers: +- If mg_levels_list is provided, uses the specified level for each grid +- If mg_levels_override is provided, uses that fixed level for all grids +- Otherwise, automatically scales levels with grid size +""" +function run_convergence_analysis(petsclib, comm, grid_sizes, opts; mg_levels_list=nothing, mg_levels_override=nothing) + L2_errors = Float64[] + max_errors = Float64[] + h_values = Float64[] + iterations = Int[] + solve_times = Float64[] + mg_levels_used = Union{Int,Nothing}[] + + # Check if using multigrid + using_mg = get(opts, :pc_type, nothing) == "mg" + + for (i, N) in enumerate(grid_sizes) + # Determine MG levels for this grid + mg_levels = if mg_levels_list !== nothing + mg_levels_list[i] + elseif mg_levels_override !== nothing + mg_levels_override + elseif using_mg + i + 2 # Auto-scale: N=17→3, N=33→4, N=65→5, etc. + else + nothing + end + + if using_mg && MPI.Comm_rank(comm) == 0 + println(" Solving N=$N with $mg_levels MG levels...") + end + + # For the first grid, run twice to exclude compilation time + if i == 1 + # Warmup run (discard results) + L2_err_warmup, max_err_warmup, h_warmup, reason_warmup, niter_warmup, t_warmup, u_warmup, l_x_warmup, l_y_warmup, ksp_warmup, da_warmup = solve_laplacian(petsclib, comm, N, opts; mg_levels=mg_levels) + PETSc.destroy(ksp_warmup) + PETSc.destroy(da_warmup) + end + + # Actual run (record results) + L2_err, max_err, h, reason, niter, t_solve, u, l_x, l_y, ksp, da = solve_laplacian(petsclib, comm, N, opts; mg_levels=mg_levels) + + if MPI.Comm_rank(comm) == 0 + push!(L2_errors, L2_err) + push!(max_errors, max_err) + push!(h_values, h) + push!(iterations, niter) + push!(solve_times, t_solve) + push!(mg_levels_used, mg_levels) + end + + # Clean up + PETSc.destroy(ksp) + PETSc.destroy(da) + end + + return L2_errors, max_errors, h_values, iterations, solve_times, mg_levels_used +end + +""" + report_convergence_results(grid_sizes, L2_errors, max_errors, h_values, iterations, solve_times, mg_levels_used) + +Print a formatted table of convergence results and compute convergence orders. +""" +function report_convergence_results(grid_sizes, L2_errors, max_errors, h_values, iterations, solve_times, mg_levels_used) + println("\n" * "="^115) + println("Convergence Analysis Results") + println("="^115) + @printf("%-8s %-8s %-12s %-12s %-10s %-12s %-6s %-8s %-12s\n", + "N", "MG Lvls", "h", "L2 Error", "L2 Order", "Max Error", "Iters", "Time(s)", "Time Order") + println("-"^115) + + for i in 1:length(grid_sizes) + N = grid_sizes[i] + h = h_values[i] + L2_err = L2_errors[i] + max_err = max_errors[i] + niter = iterations[i] + t_solve = solve_times[i] + mg_lvl = mg_levels_used[i] + mg_str = isnothing(mg_lvl) ? "---" : string(mg_lvl) + + if i == 1 + @printf("%-8d %-8s %-12.6e %-12.6e %-10s %-12.6e %-6d %-8.4f %-12s\n", + N, mg_str, h, L2_err, "---", max_err, niter, t_solve, "---") + else + L2_order = log(L2_errors[i-1] / L2_errors[i]) / log(h_values[i-1] / h_values[i]) + # Compute time scaling relative to expected complexity for 2D problems + # Total unknowns = N² (2D grid) + # Optimal multigrid: O(N²) work, so when N doubles, expect time × 4 + # Sparse direct solver (2D): O(N³) for optimal ordering, so when N doubles, expect time × 8 + # time_order = actual_ratio / expected_O(N²)_ratio + # For MG: Time Order ≈ 1.0 means optimal O(N²) scaling + # For sparse direct: Time Order ≈ 2.0 means optimal O(N³) scaling + N_ratio = grid_sizes[i] / grid_sizes[i-1] + expected_time_ratio = N_ratio^2 # Always compare to O(N²) + actual_time_ratio = solve_times[i] / solve_times[i-1] + time_order = actual_time_ratio / expected_time_ratio + @printf("%-8d %-8s %-12.6e %-12.6e %-10.6f %-12.6e %-6d %-8.4f %-12.6f\n", + N, mg_str, h, L2_err, L2_order, max_err, niter, t_solve, time_order) + end + end + + println("-"^115) + + if length(L2_errors) > 1 + # Compute average convergence order + avg_L2_order = mean([log(L2_errors[i-1] / L2_errors[i]) / log(h_values[i-1] / h_values[i]) + for i in 2:length(L2_errors)]) + + println("\nSummary:") + println(@sprintf(" Average L2 convergence order: %.4f", avg_L2_order)) + println(" Expected order for 2nd-order FD: 2.0000") + + if avg_L2_order > 1.95 && avg_L2_order < 2.05 + println(" ✓ Convergence test PASSED (within 2.5% of expected)") + else + println(" ✗ Convergence test FAILED (not within 2.5% of expected)") + end + + println("\nNote:") + println(" Time Order shows actual time ratio / expected O(N²) ratio for 2D problem (N×N grid)") + println(" Optimal multigrid: Time Order ≈ 1.0 (O(N²) = O(total unknowns))") + println(" Optimal sparse direct (2D): Time Order ≈ 2.0 (O(N³) with nested dissection)") + end + println("="^90) +end + +# Parse options +opts = if !isinteractive() + PETSc.parse_options(ARGS) +else + (ksp_monitor = false, ksp_type = "preonly", pc_type = "lu", ksp_rtol = 1e-12) +end + +# Check if single solve is requested (default is convergence test) +run_single_solve = haskey(opts, :single_solve) || (!isinteractive() && "single_solve" in ARGS) + +# Parse grid sizes +# Option 1: -grids 17,33,65,129 (comma-separated list) +# Option 2: -N_min 17 -N_max 129 (auto-generate sequence) +grid_sizes = nothing +if haskey(opts, :grids) + grids_str = opts[:grids] + grid_sizes = parse.(Int, split(grids_str, ',')) +else + # Default: N=17 to N=129 + N_min = parse(Int, get(opts, :N_min, "17")) + N_max = parse(Int, get(opts, :N_max, "129")) +end + +# Parse MG levels +# Option 1: -mg_levels_list 3,4,5,6 (one per grid, comma-separated) +# Option 2: -mg_levels 5 (fixed for all grids) +# Option 3: auto-scale (default if using MG) +mg_levels_list = nothing +mg_levels_override = nothing +if haskey(opts, :mg_levels_list) + levels_str = opts[:mg_levels_list] + mg_levels_list = parse.(Int, split(levels_str, ',')) +elseif haskey(opts, :mg_levels) + mg_levels_override = parse(Int, opts[:mg_levels]) +end + +# Set our MPI communicator +comm = MPI.COMM_WORLD + +# Set our PETSc Scalar Type +PetscScalar = Float64 + +# get the PETSc lib with our chosen `PetscScalar` type +petsclib = PETSc.petsclibs[1] +#petsclib = PETSc.getlib(; PetscScalar = PetscScalar) + +# Initialize PETSc +PETSc.initialize(petsclib) + +if !run_single_solve + # Run convergence analysis + if MPI.Comm_rank(comm) == 0 + println("\nRunning convergence analysis...") + solver_type = get(opts, :pc_type, "lu") + println("Using solver: $solver_type") + if solver_type == "mg" + if mg_levels_list !== nothing + println(" MG levels: $mg_levels_list (per-grid)") + elseif mg_levels_override !== nothing + println(" MG levels: $mg_levels_override (fixed)") + else + println(" MG levels will scale with grid refinement") + end + end + if haskey(opts, :pc_factor_mat_solver_type) + println(" Matrix solver: $(opts[:pc_factor_mat_solver_type])") + end + end + + # Generate or use provided grid sizes + if grid_sizes === nothing + # Auto-generate: 17, 33, 65, 129, 257, 513, ... + # Pattern: 2^n + 1 for n = 4, 5, 6, ... + grid_sizes = Int[] + let N = 17 + while N <= N_max + if N >= N_min + push!(grid_sizes, N) + end + N = 2*N - 1 # Next value in sequence: 17->33, 33->65, etc. + end + end + end + + # Validate mg_levels_list length if provided + if mg_levels_list !== nothing && length(mg_levels_list) != length(grid_sizes) + error("Number of MG levels ($(length(mg_levels_list))) must match number of grids ($(length(grid_sizes)))") + end + + if MPI.Comm_rank(comm) == 0 + println("Grid sizes: $grid_sizes") + end + + # Pass mg_levels info to the convergence analysis + L2_errors, max_errors, h_values, iterations, solve_times, mg_levels_used = run_convergence_analysis( + petsclib, comm, grid_sizes, opts; mg_levels_list=mg_levels_list, mg_levels_override=mg_levels_override) + + if MPI.Comm_rank(comm) == 0 + report_convergence_results(grid_sizes, L2_errors, max_errors, h_values, iterations, solve_times, mg_levels_used) + end +else + # Run single solve with visualization + N = 65 + L2_err, max_err, h, reason, niter, t_solve, u, l_x, l_y, ksp, da = solve_laplacian(petsclib, comm, N, opts) + + # Report convergence status + if MPI.Comm_rank(comm) == 0 + if Integer(reason) > 0 + println("KSP converged with reason: $reason") + elseif Integer(reason) < 0 + println("WARNING: KSP diverged with reason: $reason") + else + println("KSP still iterating: $reason") + end + + println(@sprintf("L2-error (interior): %.6e", L2_err)) + println(@sprintf("Max-error (interior): %.6e", max_err)) + println(@sprintf("Mesh spacing h: %.6e", h)) + end + + # If we only have 1 MPI rank we plot the solution and error + if isinteractive() && MPI.Comm_size(comm) == 1 + display(heatmap(u, zlabel = "sol")) + display(heatmap(u - exact.(l_x, l_y'), zlabel = "error")) + end + + # Clean up + PETSc.destroy(ksp) + PETSc.destroy(da) +end + +PETSc.finalize(petsclib) + +nothing + diff --git a/examples/ex1.jl b/examples/ex1.jl index 41d27118..9c1f4b76 100644 --- a/examples/ex1.jl +++ b/examples/ex1.jl @@ -1,154 +1,201 @@ # 1D staggered FD example -using PETSc, MPI, LinearAlgebra, SparseArrays, ForwardDiff +using PETSc, MPI, LinearAlgebra, SparseArrays# ForwardDiff if ~MPI.Initialized() MPI.Init() end -petsclib=PETSc.petsclibs[1]; +petsclib = PETSc.petsclibs[1]; PETSc.initialize(petsclib) +PetscScalar = PETSc.scalartype(petsclib) +PetscInt = PETSc.inttype(petsclib) +PetscReal = real(PetscScalar) # ========================================== # Main code +comm = MPI.COMM_WORLD # Compute initial solution -nx = 3; +nx = 10; x0 = 0; xend = 1; # create dmstag for solution and setup -dm = PETSc.DMStagCreate1d(petsclib,MPI.COMM_WORLD,PETSc.DM_BOUNDARY_NONE,nx,1,1,PETSc.DMSTAG_STENCIL_BOX,1); -# creat uniform coordinates -PETSc.setuniformcoordinates!(dm, (x0,), (xend,)); +dm = PETSc.DMStag(petsclib, comm, + (PETSc.DM_BOUNDARY_NONE,), + (nx,), + (1,1), + 1, + PETSc.DMSTAG_STENCIL_BOX) + +# create uniform coordinates +LibPETSc.DMStagSetUniformCoordinatesProduct(petsclib, dm, PetscReal(x0), PetscReal(xend), PetscReal(0.0), PetscReal(1.0), PetscReal(0.0), PetscReal(1.0)) + #determine boundary type -bnd = PETSc.DMStagGetBoundaryTypes(dm); +bnd = LibPETSc.DMStagGetBoundaryTypes(petsclib, dm); a = 1.0; b = 2.0; c = 1.0; -if bnd == PETSc.DM_BOUNDARY_PERIODIC +if bnd[1] == PETSc.DM_BOUNDARY_PERIODIC # bnd is now a tuple, check first element b = a; c = 0.0; end #Compute reference solution on the grid, using direct array access -xa = PETSc.createglobalvector(dm); -xa_Local = PETSc.createlocalvector(dm); -xa_array = PETSc.DMStagVecGetArray(dm,xa_Local); -dm_coord = PETSc.getcoordinateDM(dm); -vec_coord = PETSc.getcoordinateslocal(dm); -X_coord = PETSc.DMStagVecGetArray(dm, vec_coord); +xa = PETSc.DMGlobalVec(dm); +xa_Local = PETSc.DMLocalVec(dm); +xa_array = LibPETSc.DMStagVecGetArray(petsclib, dm, xa_Local); +dm_coord = LibPETSc.DMGetCoordinateDM(petsclib, dm) +X_coord,_,_ = LibPETSc.DMStagGetProductCoordinateArrays(petsclib, dm) corners = PETSc.getcorners(dm); -#start,n,nExtra = PETSc.DMStagGetCorners(dm); # Get the correct entries for each of our variables in local element-wise storage -iu = PETSc.DMStagGetLocationSlot(dm, PETSc.DMSTAG_LEFT, 0); -ip = PETSc.DMStagGetLocationSlot(dm, PETSc.DMSTAG_ELEMENT, 0); -ixu = PETSc.DMStagGetLocationSlot(dm_coord, PETSc.DMSTAG_LEFT, 0); -ixp = PETSc.DMStagGetLocationSlot(dm_coord, PETSc.DMSTAG_ELEMENT, 0); +iu = LibPETSc.DMStagGetLocationSlot(petsclib, dm, LibPETSc.DMSTAG_LEFT, PetscInt(0)); +ip = LibPETSc.DMStagGetLocationSlot(petsclib, dm, LibPETSc.DMSTAG_ELEMENT, PetscInt(0)); + +# These lines segfault - unclear why +#ixu = LibPETSc.DMStagGetLocationSlot(petsclib, dm_coord, LibPETSc.DMSTAG_LEFT, PetscInt(0)); +#ixp = LibPETSc.DMStagGetLocationSlot(petsclib, dm_coord, LibPETSc.DMSTAG_ELEMENT, PetscInt(0)); + + +ixu = iu +ixp = ip +# analytical solution: xa_array[1:end ,iu+1] .= a .+ (b .- a .- (c./2.0)) .* X_coord[1:end,ixu+1] .+ (c./2.0).*X_coord[1:end,ixu+1].*X_coord[1:end,ixu+1]; xa_array[1:end-1,ip+1] .= b .- a .- (c./2.0) .+ c .* X_coord[1:end-1,ixp+1]; -#PETSc.DMLocalToGlobal(dm, xa_Local, PETSc.INSERT_VALUES, xa) -PETSc.update!(xa,xa_Local, PETSc.INSERT_VALUES) -dmForcing = PETSc.DMStagCreateCompatibleDMStag(dm,1,0); -f = PETSc.createglobalvector(dmForcing); -fLocal = PETSc.createlocalvector(dmForcing); +LibPETSc.DMStagVecRestoreArray(petsclib, dm, xa_Local, xa_array) +#LibPETSc.DMLocalToGlobalBegin(petsclib, dm, xa_Local, LibPETSc.INSERT_VALUES, xa) +#LibPETSc.DMLocalToGlobalEnd(petsclib, dm, xa_Local, LibPETSc.INSERT_VALUES, xa) +PETSc.dm_local_to_global(dm, xa_Local, xa) + +dmForcing = LibPETSc.DMStagCreateCompatibleDMStag(petsclib, dm, PetscInt(1), PetscInt(0), PetscInt(0), PetscInt(0)); +f = PETSc.DMGlobalVec(dmForcing); +fLocal = PETSc.DMLocalVec(dmForcing); f .= c; fLocal .= c; -A = PETSc.creatematrix(dm); -rhs = PETSc.createglobalvector(dm); +A = LibPETSc.DMCreateMatrix(petsclib, dm); +rhs = PETSc.DMGlobalVec(dm); + +# Construct rhs vector for e in corners.lower[1]-1:corners.upper[1]-1 - pos1 = PETSc.DMStagStencil(PETSc.DMSTAG_ELEMENT,e,0,0,0); - val1 = 0.0; - PETSc.DMStagVecSetValuesStencil(dm, rhs, pos1, val1, PETSc.INSERT_VALUES); + pos1 = LibPETSc.DMStagStencil(LibPETSc.DMSTAG_ELEMENT, PetscInt(e), PetscInt(0), PetscInt(0), PetscInt(0)); + val1 = PetscScalar(0.0); + LibPETSc.DMStagVecSetValuesStencil(petsclib, dm, rhs, PetscInt(1), [pos1], [val1], PETSc.INSERT_VALUES); - pos2 = PETSc.DMStagStencil(PETSc.DMSTAG_LEFT,e,0,0,0); - if e == corners.lower[1] - val2 = a; + pos2 = LibPETSc.DMStagStencil(LibPETSc.DMSTAG_LEFT, PetscInt(e), PetscInt(0), PetscInt(0), PetscInt(0)); + if e == corners.lower[1]-1 + val2 = PetscScalar(a); else - val2 = PETSc.DMStagVecGetValuesStencil(dmForcing, fLocal, pos2); + val2 = LibPETSc.DMStagVecGetValuesStencil(petsclib, dmForcing, fLocal, PetscInt(1), [pos2])[1]; end - PETSc.DMStagVecSetValuesStencil(dm, rhs, pos2, val2, PETSc.INSERT_VALUES); + LibPETSc.DMStagVecSetValuesStencil(petsclib, dm, rhs, PetscInt(1), [pos2], [val2], PETSc.INSERT_VALUES); if e == corners.upper[1]-1 - pos3 = PETSc.DMStagStencil(PETSc.DMSTAG_RIGHT,e,0,0,0); - val3 = b; - PETSc.DMStagVecSetValuesStencil(dm, rhs, pos3, val3, PETSc.INSERT_VALUES); + pos3 = LibPETSc.DMStagStencil(LibPETSc.DMSTAG_RIGHT, PetscInt(e), PetscInt(0), PetscInt(0), PetscInt(0)); + val3 = PetscScalar(b); + LibPETSc.DMStagVecSetValuesStencil(petsclib, dm, rhs, PetscInt(1), [pos3], [val3], PETSc.INSERT_VALUES); end end -PETSc.assemble(rhs) +PETSc.assemble!(rhs) + +# Cinstruct matrix A for e in corners.lower[1]-1:corners.upper[1]-1 # Note that PETSc ordering is zero-based - - row = PETSc.DMStagStencil(PETSc.DMSTAG_LEFT,e,0,0,0); + row = LibPETSc.DMStagStencil(LibPETSc.DMSTAG_LEFT, PetscInt(e), PetscInt(0), PetscInt(0), PetscInt(0)); if e == corners.lower[1]-1 - val1 = 1.0; - PETSc.DMStagMatSetValuesStencil(dm, A, row, row, val1, PETSc.INSERT_VALUES); + val1 = PetscScalar(1.0); + LibPETSc.DMStagMatSetValuesStencil(petsclib, dm, A, PetscInt(1), [row], PetscInt(1), [row], [val1], PETSc.INSERT_VALUES); else - col1 = PETSc.DMStagStencil(PETSc.DMSTAG_ELEMENT,e,0,0,0); - col2 = PETSc.DMStagStencil(PETSc.DMSTAG_ELEMENT,e-1,0,0,0); + col1 = LibPETSc.DMStagStencil(LibPETSc.DMSTAG_ELEMENT, PetscInt(e), PetscInt(0), PetscInt(0), PetscInt(0)); + col2 = LibPETSc.DMStagStencil(LibPETSc.DMSTAG_ELEMENT, PetscInt(e-1), PetscInt(0), PetscInt(0), PetscInt(0)); - xp1 = PETSc.DMStagVecGetValuesStencil(dm_coord, vec_coord, col1); - xp2 = PETSc.DMStagVecGetValuesStencil(dm_coord, vec_coord, col2); - h = xp1-xp2; - #print("h = ", h,", xp1 = ",xp1,", xp2 = ",xp2,"\n") + h = X_coord[2,1]-X_coord[1,1]; - val1 = 1.0/h; - val2 = -1.0/h; - val3 = 0.0; + val1 = PetscScalar(1.0/h); + val2 = PetscScalar(-1.0/h); + val3 = PetscScalar(0.0); - PETSc.DMStagMatSetValuesStencil(dm, A, row, col1, val1, PETSc.INSERT_VALUES); - PETSc.DMStagMatSetValuesStencil(dm, A, row, col2, val2, PETSc.INSERT_VALUES); - PETSc.DMStagMatSetValuesStencil(dm, A, row, row , val3, PETSc.INSERT_VALUES); + LibPETSc.DMStagMatSetValuesStencil(petsclib, dm, A, PetscInt(1), [row], PetscInt(1), [col1], [val1], PETSc.INSERT_VALUES); + LibPETSc.DMStagMatSetValuesStencil(petsclib, dm, A, PetscInt(1), [row], PetscInt(1), [col2], [val2], PETSc.INSERT_VALUES); + LibPETSc.DMStagMatSetValuesStencil(petsclib, dm, A, PetscInt(1), [row], PetscInt(1), [row] , [val3], PETSc.INSERT_VALUES); end if e == corners.upper[1]-1 - row2 = PETSc.DMStagStencil(PETSc.DMSTAG_RIGHT,e,0,0,0); - val4 = 1.0 - PETSc.DMStagMatSetValuesStencil(dm, A, row2, row2, val4, PETSc.INSERT_VALUES); + row2 = LibPETSc.DMStagStencil(LibPETSc.DMSTAG_RIGHT, PetscInt(e), PetscInt(0), PetscInt(0), PetscInt(0)); + val4 = PetscScalar(1.0) + LibPETSc.DMStagMatSetValuesStencil(petsclib, dm, A, PetscInt(1), [row2], PetscInt(1), [row2], [val4], PETSc.INSERT_VALUES); end - row = PETSc.DMStagStencil(PETSc.DMSTAG_ELEMENT,e,0,0,0); - col1 = PETSc.DMStagStencil(PETSc.DMSTAG_RIGHT,e,0,0,0); - col2 = PETSc.DMStagStencil(PETSc.DMSTAG_LEFT,e,0,0,0); + row = LibPETSc.DMStagStencil(LibPETSc.DMSTAG_ELEMENT, PetscInt(e), PetscInt(0), PetscInt(0), PetscInt(0)); + col1 = LibPETSc.DMStagStencil(LibPETSc.DMSTAG_RIGHT, PetscInt(e), PetscInt(0), PetscInt(0), PetscInt(0)); + col2 = LibPETSc.DMStagStencil(LibPETSc.DMSTAG_LEFT, PetscInt(e), PetscInt(0), PetscInt(0), PetscInt(0)); - xu1 = PETSc.DMStagVecGetValuesStencil(dm_coord, vec_coord, col1); - xu2 = PETSc.DMStagVecGetValuesStencil(dm_coord, vec_coord, col2); + #xu1 = LibPETSc.DMStagVecGetValuesStencil(petsclib, dm_coord, X_coord, PetscInt(1), [col1])[1]; # FIXME: Need to check if coordinate access is correct + #xu2 = LibPETSc.DMStagVecGetValuesStencil(petsclib, dm_coord, X_coord, PetscInt(1), [col2])[1]; # FIXME: Need to check if coordinate access is correct + xu1 = X_coord[2,1] + xu2 = X_coord[1,1] h = xu1-xu2; - val1 = -1.0/h; - val2 = 1.0/h; - val3 = 1.0; - PETSc.DMStagMatSetValuesStencil(dm, A, row, col1, val1, PETSc.INSERT_VALUES); - PETSc.DMStagMatSetValuesStencil(dm, A, row, col2, val2, PETSc.INSERT_VALUES); - PETSc.DMStagMatSetValuesStencil(dm, A, row, row , val3, PETSc.INSERT_VALUES); + val1 = PetscScalar(-1.0/h); + val2 = PetscScalar(1.0/h); + val3 = PetscScalar(1.0); + + LibPETSc.DMStagMatSetValuesStencil(petsclib, dm, A, PetscInt(1), [row], PetscInt(1), [col1], [val1], PETSc.INSERT_VALUES); + LibPETSc.DMStagMatSetValuesStencil(petsclib, dm, A, PetscInt(1), [row], PetscInt(1), [col2], [val2], PETSc.INSERT_VALUES); + LibPETSc.DMStagMatSetValuesStencil(petsclib, dm, A, PetscInt(1), [row], PetscInt(1), [row] , [val3], PETSc.INSERT_VALUES); end -PETSc.assemble(A) +PETSc.assemble!(A) + + -x = PETSc.createglobalvector(dm); +x = PETSc.DMGlobalVec(dm); ksp = PETSc.KSP(A); PETSc.solve!(x,ksp,rhs); -xLocal = PETSc.createlocalvector(dm); -PETSc.update!(xLocal, x, PETSc.INSERT_VALUES); -xu = PETSc.DMStagGetGhostArrayLocationSlot(dm,xLocal, PETSc.DMSTAG_LEFT, 0); -xp = PETSc.DMStagGetGhostArrayLocationSlot(dm,xLocal, PETSc.DMSTAG_ELEMENT, 0); +xLocal = PETSc.DMLocalVec(dm); +PETSc.dm_global_to_local(dm,x,xLocal) -print("u_array = ",xu,"\np_array = ",xp,"\n"); +# get the local solution array: +xsolution_array = LibPETSc.DMStagVecGetArray(petsclib, dm, xLocal); + +# TODO: DMStagGetGhostArrayLocationSlot needs review - may not be available or may need different signature +#xu = LibPETSc.DMStagGetGhostArrayLocationSlot(petsclib, dm, xLocal, PETSc.DMSTAG_LEFT, PetscInt(0)); +#xp = LibPETSc.DMStagGetGhostArrayLocationSlot(petsclib, dm, xLocal, PETSc.DMSTAG_ELEMENT, PetscInt(0)); + +iu = LibPETSc.DMStagGetLocationSlot(petsclib, dm, LibPETSc.DMSTAG_LEFT, PetscInt(0)) +ip = LibPETSc.DMStagGetLocationSlot(petsclib, dm, LibPETSc.DMSTAG_ELEMENT, PetscInt(0)) +#ip = LibPETSc.DMStagGetGhostArrayLocationSlot(petsclib, dm, xLocal, PETSc.DMSTAG_ELEMENT, PetscInt(0)); + +#print("u_array = ",xu,"\np_array = ",xp,"\n"); xa_norm = LinearAlgebra.norm(xa); -error = xa.-x +error = xa[:].-x[:] error_norm = LinearAlgebra.norm(error); errRel = error_norm/xa_norm; print("Error (abs): ",error_norm,"\nError (rel): ",errRel,"\n"); +PETSc.destroy(dmForcing); +PETSc.destroy(dm_coord); +PETSc.destroy(fLocal); +PETSc.destroy(f); +PETSc.destroy(dm); +PETSc.destroy(xa_Local); +PETSc.destroy(xa); +PETSc.destroy(xLocal); +PETSc.destroy(x); +PETSc.destroy(rhs); +#PETSc.destroy(ksp); +PETSc.destroy(A); PETSc.finalize(petsclib) + +return nothing \ No newline at end of file diff --git a/examples/ex50.jl b/examples/ex50.jl new file mode 100644 index 00000000..97c31379 --- /dev/null +++ b/examples/ex50.jl @@ -0,0 +1,239 @@ +# INCLUDE IN MPI TEST +# +# This example demonstrates solving a 2D Poisson equation with Neumann boundary +# conditions using a DMDA and KSP solver. +# +# Based on PETSc's ex50.c: +# https://petsc.org/main/src/ksp/ksp/tutorials/ex50.c.html +# +# Poisson equation: div(grad p) = f on [0,1]^2 +# with Neumann boundary conditions: dp/dx = 0 at x=0,1 and dp/dy = 0 at y=0,1 +# Forcing function: f = -cos(π*x)*cos(π*y) +# +# ## Usage Examples: +# +# 1. Run with default settings (100×100 grid, multigrid): +# julia --project=. examples/ksp/ex50.jl +# +# 2. Set grid size with -N option (creates N×N grid): +# julia --project=. examples/ksp/ex50.jl -N 50 -ksp_monitor +# +# 3. Monitor convergence with custom grid: +# julia --project=. examples/ksp/ex50.jl -da_grid_x 50 -da_grid_y 50 -ksp_monitor +# +# 4. Use direct LU solver: +# julia --project=. examples/ksp/ex50.jl -pc_type lu -ksp_monitor -ksp_converged_reason +# +# 5. Multigrid with refinement: +# julia --project=. examples/ksp/ex50.jl -da_grid_x 3 -da_grid_y 3 -da_refine 5 -pc_type mg -ksp_monitor +# +# KNOWN LIMITATION: The C code uses MatNullSpaceCreate/MatSetNullSpace/MatNullSpaceRemove +# to handle the constant nullspace from all-Neumann BCs. However, this causes +# ReadOnlyMemoryError in PETSc.jl due to a wrapper bug in src/ksp.jl (line 201): +# the RHS vector b_vec is created with age=0 instead of getlib(PetscLib).age, +# making it read-only. As a workaround, nullspace handling is commented out. +# The solver may still work due to PETSc's automatic handling, but results may +# not be as accurate as with explicit nullspace removal. +# +using PETSc, MPI, Printf +MPI.Initialized() || MPI.Init() + +# Set our PETSc Scalar Type +PetscScalar = Float64 + +# Get the PETSc lib with our chosen `PetscScalar` type +petsclib = PETSc.getlib(; PetscScalar = PetscScalar) + +# Initialize PETSc +PETSc.initialize(petsclib) + +# Set our MPI communicator +comm = MPI.COMM_WORLD + +# Parse command-line options +opts = if !isinteractive() + PETSc.parse_options(ARGS) +else + # Default options when running interactively + if MPI.Comm_size(comm) == 1 + ( + ksp_monitor = false, + ksp_view = false, + da_grid_x = 100, + da_grid_y = 100, + pc_type = "mg", + pc_mg_levels = 1, + mg_levels_0_pc_type = "ilu", + mg_levels_0_pc_factor_levels = 1, + ) + else + ( + da_grid_x = 3, + da_grid_y = 3, + pc_type = "mg", + da_refine = 10, + ksp_monitor = false, + ksp_view = false, + log_view = nothing, + ) + end +end + +# Parse -N option for grid size (sets both da_grid_x and da_grid_y) +N = parse(Int, get(opts, Symbol("-N"), "0")) +if N > 0 + # Override da_grid_x and da_grid_y with N if specified + opts = merge(opts, (da_grid_x = N, da_grid_y = N)) +end + +boundary_type = (PETSc.DM_BOUNDARY_NONE, PETSc.DM_BOUNDARY_NONE) +stencil_type = PETSc.DMDA_STENCIL_STAR +global_size = (11, 11) +procs = (PETSc.PETSC_DECIDE, PETSc.PETSC_DECIDE) +dof_per_node = 1 +stencil_width = 1 + +da = PETSc.DMDA( + petsclib, + comm, + boundary_type, + global_size, + dof_per_node, + stencil_width, + stencil_type; + opts..., +) + +ksp = PETSc.KSP(da; opts...) + +# Print the final grid size after any refinement (only on rank 0) +if MPI.Comm_rank(comm) == 0 + final_grid_size = PETSc.getinfo(da).global_size[1:2] + @printf("Solving on %d × %d grid\n", final_grid_size[1], final_grid_size[2]) +end + +# Set the Jacobian/operator +PETSc.setcomputeoperators!(ksp) do J, jac, ksp + dm = PETSc.getDMDA(ksp) + corners = PETSc.getcorners(dm) + global_size = PETSc.getinfo(dm).global_size[1:2] + + # Grid spacing in each direction + h = PetscScalar(1) ./ global_size + HxdHy = h[1] / h[2] + HydHx = h[2] / h[1] + + # Assemble the matrix - Neumann BCs with variable stencil at boundaries + for j in corners.lower[2]:corners.upper[2] + for i in corners.lower[1]:corners.upper[1] + idx = CartesianIndex(i, j, 1) + + # Check if we're on boundary + is_boundary = (i == 1 || j == 1 || i == global_size[1] || j == global_size[2]) + + if is_boundary + # Boundary point - variable stencil (only interior neighbors) + diag_val = PetscScalar(0) + numi = 0 # count of i-direction neighbors + numj = 0 # count of j-direction neighbors + + if j > 1 # not on bottom boundary + jac[idx, idx + CartesianIndex(0, -1, 0)] = -HxdHy + numj += 1 + end + if i > 1 # not on left boundary + jac[idx, idx + CartesianIndex(-1, 0, 0)] = -HydHx + numi += 1 + end + if i < global_size[1] # not on right boundary + jac[idx, idx + CartesianIndex(1, 0, 0)] = -HydHx + numi += 1 + end + if j < global_size[2] # not on top boundary + jac[idx, idx + CartesianIndex(0, 1, 0)] = -HxdHy + numj += 1 + end + + # Diagonal: sum of neighbor coefficients + diag_val = numj * HxdHy + numi * HydHx + jac[idx, idx] = diag_val + else + # Interior point - full 5-point stencil + jac[idx, idx + CartesianIndex(0, -1, 0)] = -HxdHy + jac[idx, idx + CartesianIndex(-1, 0, 0)] = -HydHx + jac[idx, idx] = 2.0 * (HxdHy + HydHx) + jac[idx, idx + CartesianIndex(1, 0, 0)] = -HydHx + jac[idx, idx + CartesianIndex(0, 1, 0)] = -HxdHy + end + end + end + + PETSc.assemble!(jac) + + # NOTE: The C code sets a constant nullspace on the matrix for Neumann BCs. + # However, this causes ReadOnlyMemoryError in PETSc.jl due to a wrapper bug. + # TODO: Fix this wrapper issue and re-enable nullspace handling + # comm = PETSc.getcomm(ksp) + # nullspace = LibPETSc.MatNullSpaceCreate(petsclib, comm, LibPETSc.PETSC_TRUE, 0, LibPETSc.PetscVec[]) + # LibPETSc.MatSetNullSpace(petsclib, J, nullspace) + # LibPETSc.MatNullSpaceDestroy(petsclib, nullspace) + + return 0 +end + +# Set the right-hand side +PETSc.setcomputerhs!(ksp) do b_vec, ksp + dm = PETSc.getDMDA(ksp) + comm = PETSc.getcomm(ksp) + corners = PETSc.getcorners(dm) + global_size = PETSc.getinfo(dm).global_size[1:2] + + # Grid spacing in each direction + h = PetscScalar(1) ./ global_size + + # Build the RHS vector with forcing function + PETSc.withlocalarray!(b_vec; read = false) do b + b = reshape(b, Int64(corners.size[1]), Int64(corners.size[2])) + + for (iy, y) in enumerate(corners.lower[2]:corners.upper[2]) + # Cell-centered y-coordinate + y_coord = (y - 0.5) * h[2] + for (ix, x) in enumerate(corners.lower[1]:corners.upper[1]) + # Cell-centered x-coordinate + x_coord = (x - 0.5) * h[1] + # Forcing function: -cos(π*x)*cos(π*y) * Hx * Hy + b[ix, iy] = -cos(π * x_coord) * cos(π * y_coord) * h[1] * h[2] + end + end + end + + # NOTE: The C code calls MatNullSpaceRemove here to force the RHS to be + # consistent for the singular matrix. However, this causes ReadOnlyMemoryError + # in PETSc.jl due to a wrapper bug (src/ksp.jl line 201: b_vec created with age=0). + # The nullspace is set on the matrix in setcomputeoperators!, which should + # be sufficient for KSP to handle it correctly. + # + # TODO: Fix wrapper to create b_vec with getlib(PetscLib).age instead of 0 + # LibPETSc.VecAssemblyBegin(petsclib, b_vec) + # LibPETSc.VecAssemblyEnd(petsclib, b_vec) + # nullspace = LibPETSc.MatNullSpaceCreate(petsclib, comm, LibPETSc.PETSC_TRUE, 0, LibPETSc.PetscVec[]) + # LibPETSc.MatNullSpaceRemove(petsclib, nullspace, b_vec) + # LibPETSc.MatNullSpaceDestroy(petsclib, nullspace) + + return 0 +end + +# Solve the problem +solve_time = @elapsed PETSc.solve!(ksp) + +# Get iteration count and print results (only on rank 0) +if MPI.Comm_rank(comm) == 0 + niter = LibPETSc.KSPGetIterationNumber(petsclib, ksp) + @printf("KSP converged in %d iterations in %.4f seconds\n", niter, solve_time) +end + +# Clean up +# Note: When using KSP(da), the KSP takes ownership of the DM reference +# so we only need to destroy the KSP, not the DA +PETSc.destroy(ksp) +PETSc.finalize(petsclib) \ No newline at end of file diff --git a/examples/ksp/ex50.jl b/examples/ksp/ex50.jl deleted file mode 100644 index 36a9d3a8..00000000 --- a/examples/ksp/ex50.jl +++ /dev/null @@ -1,178 +0,0 @@ -# INCLUDE IN MPI TEST - -using PETSc, MPI, Printf -MPI.Initialized() || MPI.Init() -PETSc.initialize() - -# Set up the RHS for a cell centered scheme for PDE -# -# Δu = -cos(π * x) * cos(π * y) -# -# with zeros Neumann boundary conditions -function rhs!( - ksp::PETSc.AbstractKSP{PetscScalar}, - b_vec::PETSc.AbstractVec{PetscScalar}, -) where {PetscScalar} - dm = PETSc.DMDA(ksp) - comm = PETSc.getcomm(ksp) - corners = PETSc.getcorners(dm) - global_size = PETSc.getinfo(dm).global_size[1:2] - - # Grid spacing in each direction - h = PetscScalar(1) ./ global_size - - # Build the RHS vector for the cell-centered grid. Since the b_vec is not a - # julia vector but a PETSc vector we need to convert it before operating on - # it - PETSc.map_unsafe_localarray!(b_vec; read = false) do b - b = reshape(b, Int64(corners.size[1]), Int64(corners.size[2])) - for (iy, y) in enumerate(corners.lower[2]:corners.upper[2]) - y = (2y - 1) * h[2] / 2 - for (ix, x) in enumerate(corners.lower[1]:corners.upper[1]) - x = (2x - 1) * h[1] / 2 - b[ix, iy] = -cos(π * x) * cos(π * y) * h[1] * h[2] - end - end - end - - # Assemble the PETSc vector - PETSc.assemblybegin(b_vec) - PETSc.assemblyend(b_vec) - - # Hack to remove constant from the vector since we are using all Neumann - # boundary conditions - nullspace = PETSc.MatNullSpace{PetscScalar}(comm, PETSc.PETSC_TRUE) - PETSc.MatNullSpaceRemove!(nullspace, b_vec) - PETSc.destroy(nullspace) - - # zero is the PETSc sucess code - return 0 -end - -function jacobian!( - ksp::PETSc.AbstractKSP{PetscScalar}, - J::PETSc.AbstractMat{PetscScalar}, - jac::PETSc.AbstractMat{PetscScalar}, -) where {PetscScalar} - dm = PETSc.DMDA(ksp) - corners = PETSc.getcorners(dm) - PetscInt = eltype(corners.size) - - global_size = PETSc.getinfo(dm).global_size[1:2] - - # Grid spacing in each direction - h = PetscScalar(1) ./ global_size - - # XXX: Would Mvectors be better? - Sten = PETSc.MatStencil{PetscInt} - col = Vector{Sten}(undef, 5) - row = Vector{Sten}(undef, 1) - val = Vector{PetscScalar}(undef, 5) - - for j in corners.lower[2]:corners.upper[2] - for i in corners.lower[1]:corners.upper[1] - row[1] = Sten(i = i, j = j) - num = 1 - fill!(val, 0) - if i > 1 - val[num] = -h[2] / h[1] - col[num] = Sten(i = i - 1, j = j) - num += 1 - end - if i < global_size[1] - val[num] = -h[2] / h[1] - col[num] = Sten(i = i + 1, j = j) - num += 1 - end - if j > 1 - val[num] = -h[1] / h[2] - col[num] = Sten(i = i, j = j - 1) - num += 1 - end - if j < global_size[2] - val[num] = -h[1] / h[2] - col[num] = Sten(i = i, j = j + 1) - num += 1 - end - val[num] = -sum(val) - col[num] = Sten(i = i, j = j) - PETSc.MatSetValuesStencil!( - jac, - row, - col, - val, - PETSc.INSERT_VALUES; - num_cols = num, - ) - end - end - - PETSc.assemblybegin(jac) - PETSc.assemblyend(jac) - - # Since we have all Neumann there is constant nullspace - comm = PETSc.getcomm(ksp) - nullspace = PETSc.MatNullSpace{PetscScalar}(comm, PETSc.PETSC_TRUE) - PETSc.MatSetNullSpace!(J, nullspace) - PETSc.destroy(nullspace) - return 0 -end - -function main(petsclib; comm = MPI.COMM_WORLD, options...) - boundary_type = (PETSc.DM_BOUNDARY_NONE, PETSc.DM_BOUNDARY_NONE) - stencil_type = PETSc.DMDA_STENCIL_STAR - global_size = (11, 11) - procs = (PETSc.PETSC_DECIDE, PETSc.PETSC_DECIDE) - dof_per_node = 1 - stencil_width = 1 - points_per_proc = (nothing, nothing) - - opts = if MPI.Comm_size(comm) == 1 - ( - ksp_monitor = false, # set to true for output - ksp_view = false, - da_grid_x = 100, - da_grid_y = 100, - pc_type = "mg", - pc_mg_levels = 1, - mg_levels_0_pc_type = "ilu", - mg_levels_0_pc_factor_levels = 1, - ) - else - ( - da_grid_x = 3, - da_grid_y = 3, - pc_type = "mg", - da_refine = 10, - ksp_monitor = false, # set to true for output - ksp_view = false, - log_view = nothing, - ) - end - - da = PETSc.DMDACreate2d( - petsclib, - comm, - boundary_type..., - stencil_type, - global_size..., - procs..., - dof_per_node, - stencil_width, - points_per_proc...; - opts..., - ) - - ksp = PETSc.KSP(da; opts...) - - PETSc.KSPSetComputeRHS!(ksp, rhs!) - PETSc.KSPSetComputeOperators!(ksp, jacobian!) - PETSc.setfromoptions!(ksp) - PETSc.solve!(ksp) -end - -for petsclib in PETSc.petsclibs - if PETSc.scalartype(petsclib) <: Real - main(petsclib) - end -end diff --git a/examples/laplacian.jl b/examples/laplacian.jl index 2c8cc889..85867ffc 100644 --- a/examples/laplacian.jl +++ b/examples/laplacian.jl @@ -1,56 +1,65 @@ -using Test -using PETSc, MPI, LinearAlgebra, SparseArrays - -MPI.Initialized() || MPI.Init() -PETSc.initialize() - -# Constructs the central finite-difference approximation of -∇² for an lx×ly box of nx×ny points -# with Dirichlet boundary conditions. Based on the code from -# http://math.mit.edu/~stevenj/18.303/lecture-10.html -function laplace(T, nx::Integer, ny::Integer=nx, lx::Integer=1, ly::Integer=lx) - dx = T(lx) / T(nx + 1) - dy = T(ly) / T(ny + 1) - Dx = [[one(T) spzeros(T, 1, nx - 1)]; spdiagm(1=>ones(T, nx - 1)) - I] / dx - Dy = [[one(T) spzeros(T, 1, ny - 1)]; spdiagm(1=>ones(T, ny - 1)) - I] / dy - Ax = Dx' * Dx - Ay = Dy' * Dy - A = kron(sparse(I, ny, ny), Ax) + kron(Ay, sparse(I, nx, nx)) - return A -end - -nx = 20 -for T in PETSc.scalar_types - S = laplace(T, nx) - - m, n = size(S) - M = PETSc.MatSeqAIJ(S) - - ksp = PETSc.KSP( - M; - ksp_monitor_true_residual = false, - ksp_view = false, - ksp_type = "cg", - ksp_rtol = 1e-8, - pc_type = "gamg", - mg_levels_ksp_type = "chebyshev", - mg_levels_ksp_max_it = 3, - mg_levels_pc_type = "bjacobi", - mg_levels_sub_pc_type = "icc", - mg_coarse_ksp_type = "preonly", - mg_coarse_pc_type = "cholesky", - ) - - # initial guess - x = PETSc.VecSeq(zeros(T, m)) - b = PETSc.VecSeq(randn(T, n)) - PETSc.solve!(x, ksp, b) - - #= - PETSc.destroy(ksp) - PETSc.destroy(M) - PETSc.destroy(b) - PETSc.destroy(x) - - PETSc.finalize() - =# -end +# Finite Difference Laplacian +# +# In this example a simple finite difference, 1-D laplacian with Dirichlet +# boundary conditions is solved first constructing the operator as Julia sparse +# matrix then solving using PETsc + +using PETSc, MPI +using SparseArrays: spdiagm +using UnicodePlots: lineplot, lineplot! + +# Set our PETSc Scalar Type +PetscScalar = Float64 + +# Get the PETSc lib with our chosen `PetscScalar` type +petsclib = PETSc.getlib(; PetscScalar = PetscScalar) + +# Initialize PETSc +PETSc.initialize(petsclib) + +# Initialize PETSc with logging active and printed to REPL. This is useful to detect memory leaks +#PETSc.initialize(petsclib; log_view = true) + +# Initialize PETSc with logging active and written to "logfile.txt" +#PETSc.initialize(petsclib; log_view = true, options=[":logfile.txt"]) # write log to a file + + +# Set the total number of grid points +Nq = 200 + +# number of interior points +n = Nq - 2 + +# create the interior grid and get the grid spacing +x = range(PetscScalar(0), length = Nq, stop = 1)[2:(end - 1)] +Δx = PetscScalar(x.step) + +# Create the finite difference operator with zero Dirichlet boundary conditions +A = + spdiagm( + -1 => -ones(PetscScalar, n - 1), + 0 => 2ones(PetscScalar, n), + 1 => -ones(PetscScalar, n - 1), + ) / Δx^2 + +# Setup the exact solution and the forcing function +κ = 2PetscScalar(π) +u(x) = sin(κ * x) +fl(x) = κ^2 * sin(κ * x) + +# Set up the PETSc solver +ksp = PETSc.KSP(petsclib, MPI.COMM_SELF, A; ksp_monitor = true); + +# Solve the problem +v = ksp \ fl.(x); + +# Compute the L2-error +ϵ = sqrt(sum((v - u.(x)) .^ 2 * Δx)) +println("L2-error is $ϵ") + +# Plot the solution and error +display(lineplot(x, v, xlabel = "x", ylabel = "solution")) +display(lineplot(x, v - u.(x), xlabel = "x", ylabel = "error")) + +PETSc.destroy(ksp) +PETSc.finalize(petsclib) \ No newline at end of file diff --git a/examples/porosity_waves.jl b/examples/porosity_waves.jl new file mode 100644 index 00000000..978cb25a --- /dev/null +++ b/examples/porosity_waves.jl @@ -0,0 +1,473 @@ +# INCLUDE IN MPI TEST +#= +In this example we solve the 1D viscoelastic porosity wave equations which +describe how magma ascends in the Earth's mantle. The equations are discussed +in [Vasyliev et al. Geophysical Research Letters (25), 17. p. +3239-3242](https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1029/98GL52358): +```math + { ∂ϕ/∂t} = -De {∂Pe/∂t} - ϕ^m Pe + De {∂Pe/∂t} = ∇( ϕ^n (∇Pe + e_x) ) - ϕ^m Pe +``` +with Dirichlet boundary conditions Pe=0 and ϕ=1 on either side. n,m are +parameters and De is the Deborah number which indicates the importance of +elasticity (De>>1). e_x is the unit vector in the direction of gravity (here +taken to be the x-direction) + +To solve the problem we use a standard central, finite difference approximation +in 1D, and simultaneously solve for Pe and ϕ on a collocated grid. We employ a +DMDA/SNES and compute the Jacobian by automatic differentiation. + +Note: the code is working for 1D problems, but 2D and 3D are currently not functional due to an issue with the lateral boundary conditions +=# + +using MPI +using PETSc +using OffsetArrays: OffsetArray +using LinearAlgebra: norm +using ForwardDiff +using SparseArrays +using SparseDiffTools + +# when not run interactive options can be passed via commandline arguments: +# julia --project=examples examples/porosity_waves.jl -Nq1 101 -snes_monitor +opts = if !isinteractive() + PETSc.parse_options(ARGS) +else + ( + ksp_monitor = true, + ksp_rtol = 1e-10, + ksp_converged_reason = false, + snes_monitor = true, + snes_converged_reason = true, + snes_view = false, + snes_max_it = 100, + snes_max_funcs = 10000, + snes_max_linear_solve_fail = 1000, + snes_mf_operator = false, + Nq1 = 1001, + max_it = 4000, + max_time = 25, + dim = 1 + ) +end + + +# To use plotting +CreatePlots = isinteractive() && try + using CairoMakie + true +catch + false +end + +# Set our MPI communicator +comm = MPI.COMM_WORLD + +# Set our PETSc Scalar Type +PetscScalar = Float64 +PetscInt = Int64 + +# get the PETSc lib with our chosen `PetscScalar` type +petsclib = PETSc.getlib(; PetscScalar = PetscScalar, PetscInt = PetscInt) + +# Initialize PETSc +PETSc.initialize(petsclib) + +# dimensionality of the problem +dim = PETSc.typedget(opts, :dim, 1) + +# Set the total number of grid points in each direction +Nq1 = PETSc.typedget(opts, :Nq1, 101) + +Nq = (Nq1, 5, 5) +Nq = Nq[1:dim] + +max_it = PETSc.typedget(opts, :max_it, 10) +max_time = PETSc.typedget(opts, :max_time, 25) +if CreatePlots + fig = Figure(size = (1200, 600)) + if dim==1 + ax1 = Axis3(fig[1, 1], title = "Pe", ylabel= "time", xlabel = "depth", zlabel="Pe", azimuth=-2.191039610705103, elevation=1.0426209566987232) + ax2 = Axis3(fig[1, 2], title = "ϕ", ylabel= "time", xlabel = "depth", zlabel="ϕ", azimuth=-2.191039610705103, elevation=1.0426209566987232) + end +end + +# Set the boundary conditions on each side (Dirichlet in direction of gravity) +bcs = ( + PETSc.DM_BOUNDARY_NONE, + PETSc.DM_BOUNDARY_GHOSTED, + PETSc.DM_BOUNDARY_GHOSTED, + )[1:dim] + +# Set parameters +n = 3 +m = 2 +De = PetscScalar(1e2) +dt = PetscScalar(1e-2) + +# Create the PETSC dmda object +da = PETSc.DMDA( + petsclib, + comm, + bcs, # boundary conditions + Nq, # Global grid size + 2, # Number of DOF per node + 1, # Stencil width + PETSc.DMDA_STENCIL_STAR; # Stencil type + opts..., +) +# Set coordinates of the DMDA (2D and 3D ignored for 1D DMDA) +PETSc.setuniformcoordinates_dmda!(da, (-20, -10, -10), (150, 10, 10)) + +# Cache local coordinates as a plain Julia array. This avoids repeatedly +# mapping/restoring PETSc coordinate vectors during AD/Jacobian evaluations. +coord_cache = copy(PETSc.getlocalcoordinatearray(da)) + +# Create the PETSC snes object +snes = PETSc.SNES(petsclib, comm; opts...) + +# add the da to the snes +PETSc.setDM!(snes, da) + +# Sets the initial profiles +g_x = PETSc.DMGlobalVec(da) +g_xold = PETSc.DMGlobalVec(da) +PETSc.withlocalarray!(g_x; read = false) do l_x + corners = PETSc.getcorners(da) + + x = PETSc.reshapelocalarray(l_x, da) + Phi = @view x[1, :, :, :] + Pe = @view x[2, :, :, :] + + # local coordinates (cached as a plain Julia array) + coord = coord_cache + + Phi0 = 1 + dPhi1 = 8 + dPhi2 = 1 + z1 = 0 + z2 = 40 + lambda = 1 + dPe1 = dPhi1 / De + dPe2 = dPhi2 / De + + # Loop over all the points on the processor and set the initial condition + for i in ((corners.lower):(corners.upper)) + Phi[i] = + Phi0 + + dPhi1 * exp(-((coord[1, i] - z1)^2) / lambda^2) + + dPhi2 * exp(-((coord[1, i] - z2)^2) / lambda^2) + Pe[i] = + -dPe1 * exp(-((coord[1, i] - z1)^2) / lambda^2) - + dPe2 * exp(-((coord[1, i] - z2)^2) / lambda^2) + end +end + +# Initialize x_old on every processor +#g_xold = deepcopy(g_x); # initialize Pe and Phi of last timestep +LibPETSc.VecCopy(petsclib,g_x,g_xold) # initialize Pe and Phi of last timestep + +l_xold = PETSc.DMLocalVec(da) +PETSc.dm_global_to_local!(g_xold, l_xold, da, PETSc.INSERT_VALUES) + +# Keep `x_old` as a plain Julia vector (avoid `unsafe_localarray` finalizers +# interacting with PETSc object lifetimes). +x_old = zeros(PetscScalar, length(l_xold)) +PETSc.withlocalarray!(l_xold; read = true, write = false) do x_arr + copyto!(x_old, x_arr) +end + +# Routine wuth julia-only input/output vectors that computes the local residual +function ComputeLocalResidual!(l_fx, l_x, snes) + + # Compute the local residual. + da = PETSc.getDMDA(snes) + # The local vectors of l_x/x_old include ghost points + x = PETSc.reshapelocalarray(l_x[:], da) + Phi = @view x[1, :, :, :] + Pe = @view x[2, :, :, :] + x_old_reshaped = PETSc.reshapelocalarray(x_old[:], da) + Phi_old = @view x_old_reshaped[1, :, :, :] + Pe_old = @view x_old_reshaped[2, :, :, :] + + # The local residual vectors do not include ghost points + fx = PETSc.reshapelocalarray(l_fx[:], da) + res_Phi = @view fx[1, :, :, :] + res_Pe = @view fx[2, :, :, :] + + # Global grid size + Nq = PETSc.getinfo(da).global_size + + # Local sizes + corners = PETSc.getcorners(da) + + # set ghost boundaries (flux free conditions) + if Nq[2] > 1 + if corners.lower[2] == 1 + Phi[:, 0, :] = Phi[:, 1, :] + Pe[:, 0, :] = Pe[:, 1, :] + end + if corners.upper[2] == Nq[2] + Phi[:, Nq[2] + 1, :] = Phi[:, Nq[2], :] + Pe[:, Nq[2] + 1, :] = Pe[:, Nq[2], :] + end + end + if Nq[3] > 1 + if corners.lower[3] == 1 + Phi[:, :, 0] = Phi[:, :, 1] + Pe[:, :, 0] = Pe[:, :, 1] + end + if corners.upper[3] == Nq[3] + Phi[:, :, Nq[3] + 1] = Phi[:, :, Nq[3]] + Pe[:, :, Nq[3] + 1] = Pe[:, :, Nq[3]] + end + end + + # Stencil + ix_p1 = CartesianIndex(1, 0, 0) # ix + 1 + ix_m1 = CartesianIndex(-1, 0, 0) # ix - 1 + iy_p1 = CartesianIndex(0, 1, 0) # iy + 1 + iy_m1 = CartesianIndex(0, -1, 0) # iy - 1 + iz_p1 = CartesianIndex(0, 0, 1) # iz + 1 + iz_m1 = CartesianIndex(0, 0, -1) # iz - 1 + + # Coordinates and spacing (assumed constant) + coord = coord_cache + Δx = coord[1, corners.lower + ix_p1] - coord[1, corners.lower] + if dim > 1 + Δy = coord[2, corners.lower + iy_p1] - coord[2, corners.lower] + end + if dim == 3 + Δz = coord[1, corners.lower + iz_p1] - coord[1, corners.lower] + end + + # corners.lower + for i in ((corners.lower):(corners.upper)) + if (i[1] == 1 || i[1] == Nq[1]) # Dirichlet upper/lower BC's + res_Phi[i] = Phi[i] - 1 + res_Pe[i] = Pe[i] - 0 + + else # Central points + res_Phi[i] = + (Phi[i] - Phi_old[i]) / dt + + De * (Pe[i] - Pe_old[i]) / dt + + (Phi[i]^m) * Pe[i] + + Phi_c_p1 = (Phi[i + ix_p1] + Phi[i]) / 2 + Phi_c_m1 = (Phi[i + ix_m1] + Phi[i]) / 2 + + res_Pe[i] = + De * (Pe[i] - Pe_old[i]) / dt - + ( + (Phi_c_p1^n) * ((Pe[i + ix_p1] - Pe[i]) / Δx + 1) - + (Phi_c_m1^n) * ((Pe[i] - Pe[i + ix_m1]) / Δx + 1) + ) / Δx + (Phi[i]^m) * Pe[i] + if dim > 1 + # Derivatives in y-direction (for 2D and 3D) + Phi_c_p1 = (Phi[i + iy_p1] + Phi[i]) / 2 + Phi_c_m1 = (Phi[i + iy_m1] + Phi[i]) / 2 + res_Pe[i] = + res_Pe[i] + + ( + (Phi_c_p1^n) * ((Pe[i + iy_p1] - Pe[i]) / Δy) - + (Phi_c_m1^n) * ((Pe[i] - Pe[i + iy_m1]) / Δy) + ) / Δy + end + if dim == 3 + # Derivatives in z-direction (for 3D) + Phi_c_p1 = (Phi[i + iz_p1] + Phi[i]) / 2 + Phi_c_m1 = (Phi[i + iz_m1] + Phi[i]) / 2 + res_Pe[i] = + res_Pe[i] + + ( + (Phi_c_p1^n) * ((Pe[i + iz_p1] - Pe[i]) / Δz) - + (Phi_c_m1^n) * ((Pe[i] - Pe[i + iz_m1]) / Δz) + ) / Δz + end + end + end + + # Copy local residual back to PETSc local vector + for i=1:length(fx) + l_fx[i] = fx[i] + end + + return 0 +end + +# Helper function, for automatic differentiation +function ForwardDiff_res(x, snes) + fx = similar(x) # vector of zeros, of same type as x (local vector) + + ComputeLocalResidual!(fx, x, snes) + + return fx +end + +# Set up the nonlinear function + + +""" + FormResidual!(cf,cx, args...) +Computes the residual `f`, given solution vector `x` +""" +function FormResidual!(f,snes, g_x) + + # Get the DMDA associated with the snes + da = PETSc.getDMDA(snes) + + # Get a local vector and transfer the data from the global->local vector + l_x = PETSc.DMLocalVec(da) + PETSc.dm_global_to_local!(g_x, l_x, da, PETSc.INSERT_VALUES) + + # Get local arrays + PETSc.withlocalarray!( + (f, l_x); + read = (false, true), + write = (true, false), + ) do fx, x + + # Compute the local residual (using local julia vectors) + ComputeLocalResidual!(fx, x, snes) + end + + # Clean up the local vectors + PETSc.destroy(l_x) + return 0 +end + + +# Compute the sparsity pattern and coloring of the jacobian @ every processor +# Ideally this should be done with an automatic sparsity detection algorithm; +# yet this is currently not working in combination with OffsetArrays (see +# https://github.com/JuliaDiff/SparseDiffTools.jl/issues/154) Therefore, we use +# a less efficient approach here. + +r = PETSc.DMGlobalVec(da) +l_x = PETSc.DMLocalVec(da) + +input = rand(length(l_x)) +#create an anonymous function to call ForwardDiff with snes as extra argument +ForwardDiff_res1 = x -> ForwardDiff_res(x, snes) +sparsity_pattern = + sparse(abs.(ForwardDiff.jacobian(ForwardDiff_res1, input)) .> 0); +jac = Float64.(sparsity_pattern) +colors = matrix_colors(jac) + +# Compute the Jacobian, using automatic differentiation +PJ = PETSc.MatAIJ(da) # initialize space for the matrix from the dmda +function FormJacobian!(J, snes, g_x) + + # Get the DMDA associated with the snes + da = PETSc.getDMDA(snes) + + # Get a local vector and transfer the data from the global->local vector + l_x = PETSc.DMLocalVec(da) + PETSc.dm_global_to_local!(g_x, l_x, da, PETSc.INSERT_VALUES) + + # Get a local array of the solution vector and form a Jacobian for the + # interior (non-ghost) unknowns. + PETSc.withlocalarray!(l_x; read = true, write = false) do x_julia + ForwardDiff_res1 = x -> ForwardDiff_res(x, snes) + + # Using SparseDiffTools is more efficient than forming a dense matrix, + # but requires initializing the sparsity pattern & coloring. + S = forwarddiff_color_jacobian( + ForwardDiff_res1, + x_julia, + colorvec = colors, + sparsity = sparsity_pattern, + jac_prototype = jac, + ) + + ind_local = PETSc.localinteriorlinearindex(da) + S = S[ind_local, ind_local] + + # Copy local sparse matrix to parallel PETSc matrix + copyto!(J, sparse(S)) + end + + PETSc.assemble!(J) + + # Clean up the local vectors + PETSc.destroy(l_x) + return 0 +end + +PETSc.setfunction!(snes, FormResidual!, r) +PETSc.setjacobian!(snes, FormJacobian!, PJ) + +# Timestep loop +time, it = PetscScalar(0), 1; +while (it < max_it && time < max_time) + global time, it, x_old, g_xold, g_x, ax1, fig + + # Solve nonlinear system of equations + PETSc.solve!(g_x, snes) + + # Just for checking: compute norm of nonlinear solution + g = similar(g_x) + snes.f!(g, snes, g_x) + nm = norm(g) + if MPI.Comm_rank(comm) == 0 + # @info "Norm of solution" nm + end + + # Update time + time += dt + it += 1 + + # Update the x_old values (Phi_old, Pe_old) on every processor + PETSc.dm_global_to_local!(g_x, l_xold, da, PETSc.INSERT_VALUES) + PETSc.withlocalarray!(l_xold; read = true, write = false) do x_arr + copyto!(x_old, x_arr) + end + + # Visualisation + if (mod(it, 40) == 0 && CreatePlots == true) + coord = PETSc.getlocalcoordinatearray(da) + if dim==1 + x = coord[1, :, :, :] + x = x[:,1,1] + time_vec = ones(size(x)) * time + + Pe = g_x[2:2:end] + ϕ = g_x[1:2:end] + + # Plot Pe + lines!(ax1,x,time_vec,Pe, color=:black) + ax1.title = "De=$(De)" + xlims!(ax1,(-20, 150)) + ylims!(ax1,(0, 25)) + + # Plot ϕ + lines!(ax2,x,time_vec,ϕ, color=:black) + ax2.title = "De=$(De)" + xlims!(ax2,(-20, 150)) + ylims!(ax2,(0, 25)) + zlims!(ax2,(0, 2)) + end + display(fig) + + end + + if MPI.Comm_rank(comm) == 0 + # println("Timestep $it, time=$time") + end +end + + +if CreatePlots + save("porositywave.png",fig) +end + +# Do some clean up +PETSc.destroy(PJ) +PETSc.destroy(g_x) +PETSc.destroy(g_xold) +PETSc.destroy(l_xold) +PETSc.destroy(r) +PETSc.destroy(snes) +PETSc.destroy(da) + +PETSc.finalize(petsclib) diff --git a/examples/porositywave.png b/examples/porositywave.png new file mode 100644 index 00000000..6ea5e009 Binary files /dev/null and b/examples/porositywave.png differ diff --git a/src/LibPETSc.jl b/src/LibPETSc.jl new file mode 100644 index 00000000..473ab2f6 --- /dev/null +++ b/src/LibPETSc.jl @@ -0,0 +1,62 @@ +module LibPETSc + +import PETSc: _doc_external + +using Libdl +using MPI + +export PetscLibType, + petsclibs, + #PetscBool, + PETSC_TRUE, + PETSC_FALSE, + UnionPetscLibType, + getlib, + MatAssemblyType, + MAT_FLUSH_ASSEMBLY, + MAT_FINAL_ASSEMBLY, + InsertMode, + NOT_SET_VALUES, + INSERT_VALUES, + ADD_VALUES, + MAX_VALUES, + MIN_VALUES, + INSERT_ALL_VALUES, + ADD_ALL_VALUES, + INSERT_BC_VALUES, + ADD_BC_VALUES, + NormType, + NORM_1, + NORM_2, + NORM_FROBENIUS, + NORM_INFINITY, + NORM_1_AND_2, + PETSC_DETERMINE, + PETSC_DECIDE, + SCATTER_FORWARD, + SCATTER_REVERSE, + SCATTER_FORWARD_LOCAL, + SCATTER_REVERSE_LOCAL, + DMBoundaryType, + DM_BOUNDARY_NONE, + DM_BOUNDARY_GHOSTED, + DM_BOUNDARY_MIRROR, + DM_BOUNDARY_PERIODIC, + DM_BOUNDARY_TWIST, + DMDAStencilType, + DMDA_STENCIL_STAR, + DMDA_STENCIL_BOX, + DMStagStencilType, + DMSTAG_STENCIL_NONE, + DMSTAG_STENCIL_STAR, + DMSTAG_STENCIL_BOX, + MatStencil, + PetscArray + +include("LibPETSc_const.jl") +include("LibPETSc_startup.jl") +include("LibPETSc_lib.jl") + +include(petsc_library_file) + +end # module diff --git a/src/LibPETSc_const.jl b/src/LibPETSc_const.jl new file mode 100644 index 00000000..60c901be --- /dev/null +++ b/src/LibPETSc_const.jl @@ -0,0 +1,12 @@ +# define common PETSc constants +# this excludes configurable constants (e.g. PetscScalar) which are set in lib.jl + +const PetscErrorCode = Cint + +struct PetscError <: Exception + code::PetscErrorCode +end + +macro chk(expr) + :((errcode = $(esc(expr))) == 0 || throw(PetscError(errcode))) +end \ No newline at end of file diff --git a/src/LibPETSc_lib.jl b/src/LibPETSc_lib.jl new file mode 100644 index 00000000..8239b869 --- /dev/null +++ b/src/LibPETSc_lib.jl @@ -0,0 +1,100 @@ +""" + PetscLibType{PetscScalar, PetscInt}(petsc_library) + +A container for specific PETSc libraries. + +All other containers for PETSc objects should be typed on this to ensure that +dispatch is correct. +""" +mutable struct PetscLibType{PetscScalar, PetscInt, LibType} + petsc_library::LibType + age::Int +end +function PetscLibType{ST, IT}(petsc_library) where {ST, IT} + LT = typeof(petsc_library) + return PetscLibType{ST, IT, LT}(petsc_library, 0) +end +const UnionPetscLibType = Union{PetscLibType, Type{<:PetscLibType}} + +""" + getlib(; PetscScalar = Float64, PetscInt = Int64) + +Return the `PetscLibType` with the associated parameters +""" +function getlib(; PetscScalar = Float64, PetscInt = Int64) + return PetscLibType{PetscScalar, PetscInt}() +end + +function Base.getproperty(petsclib::UnionPetscLibType, name::Symbol) + if name == :PetscScalar + return scalartype(petsclib) + elseif name == :PetscReal + return realtype(petsclib) + elseif name == :PetscInt + return inttype(petsclib) + else + return getfield(petsclib, name) + end +end + +""" + scalartype(petsclib::PetscLibType) + +return the scalar type for the associated `petsclib` +""" +scalartype(::PetscLibType{ST}) where {ST} = ST +scalartype(::Type{PetscLib}) where {PetscLib <: PetscLibType{ST}} where {ST} = + ST + +""" + realtype(petsclib::PetscLibType) + +return the real type for the associated `petsclib` +""" +realtype(::PetscLibType{ST}) where {ST} = real(ST) +realtype(::Type{PetscLib}) where {PetscLib <: PetscLibType{ST}} where {ST} = + real(ST) + +""" + inttype(petsclib::PetscLibType) + +return the int type for the associated `petsclib` +""" +inttype(::PetscLibType{ST, IT}) where {ST, IT} = IT +inttype( + ::Type{PetscLib}, +) where {PetscLib <: PetscLibType{ST, IT}} where {ST, IT} = IT + +function initialize(libhdl::Ptr{Cvoid}) + PetscInitializeNoArguments_ptr = dlsym(libhdl, :PetscInitializeNoArguments) + @chk ccall(PetscInitializeNoArguments_ptr, PetscErrorCode, ()) +end + +const petsclibs = map(libs) do (lib, PetscScalar, PetscInt) + return PetscLibType{PetscScalar, PetscInt}(lib[1]) +end + +macro for_petsc(expr) + quote + for petsclib in petsclibs + # String for the library + petsc_library = petsclib.petsc_library + + # types we dispatch on + PetscLib = typeof(petsclib) + UnionPetscLib = Union{PetscLib, Type{PetscLib}} + + PetscScalar = scalartype(petsclib) + PetscReal = realtype(petsclib) + PetscInt = inttype(petsclib) + PetscComplex = complex(PetscReal) + + @eval esc($expr) + end + end +end + +@for_petsc begin + getlib(::Type{$PetscLib}) = $petsclib + PetscLibType{$PetscScalar, $PetscInt}() = $petsclib +end diff --git a/src/LibPETSc_startup.jl b/src/LibPETSc_startup.jl new file mode 100644 index 00000000..79809b5a --- /dev/null +++ b/src/LibPETSc_startup.jl @@ -0,0 +1,65 @@ +# Functions needed to find libraries +#= +function getlibs() + libs = () + petsc_libs = ENV["JULIA_PETSC_LIBRARY"] + + flags = Libdl.RTLD_LAZY | Libdl.RTLD_DEEPBIND | Libdl.RTLD_GLOBAL + + for petsc_lib in Base.parse_load_path(petsc_libs) + libs = (libs..., (petsc_lib, flags)) + end + return libs +end +=# +const libs = @static if !haskey(ENV, "JULIA_PETSC_LIBRARY") + using PETSc_jll + ( + ((PETSc_jll.libpetsc_Float64_Real_Int64,), Float64, Int64), + ((PETSc_jll.libpetsc_Float32_Real_Int64,), Float32, Int64), + ((PETSc_jll.libpetsc_Float64_Complex_Int64,), Complex{Float64}, Int64), + ((PETSc_jll.libpetsc_Float32_Complex_Int64,), Complex{Float32}, Int64), + ((PETSc_jll.libpetsc_Float64_Real_Int32,), Float64, Int32), + ((PETSc_jll.libpetsc_Float32_Real_Int32,), Float32, Int32), + ((PETSc_jll.libpetsc_Float64_Complex_Int32,), Complex{Float64}, Int32), + ((PETSc_jll.libpetsc_Float32_Complex_Int32,), Complex{Float32}, Int32), + ) +else + error("JULIA_PETSC_LIBRARY not currently working") +end + +const petsc_library_file = + #get(ENV, "JULIA_PETSC_LIBRARY_PATH", "../lib/petsc_library.jl") + get(ENV, "JULIA_PETSC_LIBRARY_PATH", "autowrapped/petsc_library.jl") # if all is well, we should be able to use this + + +#= +function DataTypeFromString(libhdl::Ptr{Cvoid}, name::AbstractString) + PetscDataTypeFromString_ptr = dlsym(libhdl, :PetscDataTypeFromString) + dtype_ref = Ref{PetscDataType}() + found_ref = Ref{PetscBool}() + @chk ccall( + PetscDataTypeFromString_ptr, + PetscErrorCode, + (Cstring, Ptr{PetscDataType}, Ptr{PetscBool}), + name, + dtype_ref, + found_ref, + ) + @assert found_ref[] == PETSC_TRUE + return dtype_ref[] +end + +function PetscDataTypeGetSize(libhdl::Ptr{Cvoid}, dtype::PetscDataType) + PetscDataTypeGetSize_ptr = dlsym(libhdl, :PetscDataTypeGetSize) + datasize_ref = Ref{Csize_t}() + @chk ccall( + PetscDataTypeGetSize_ptr, + PetscErrorCode, + (PetscDataType, Ptr{Csize_t}), + dtype, + datasize_ref, + ) + return datasize_ref[] +end +=# \ No newline at end of file diff --git a/src/PETSc.jl b/src/PETSc.jl index 007c1f51..7a13b0ce 100644 --- a/src/PETSc.jl +++ b/src/PETSc.jl @@ -2,12 +2,10 @@ module PETSc -using MPI, LinearAlgebra, SparseArrays +using MPI, LinearAlgebra, SparseArrays, OffsetArrays MPI.Initialized() || MPI.Init() -using Libdl - function _petsc_link(fname) """ [`$fname`](https://petsc.org/release/docs/manualpages/$fname.html) @@ -20,22 +18,49 @@ function _doc_external(fname) """ end -include("const.jl") -include("startup.jl") -include("lib.jl") +include("LibPETSc.jl") +using .LibPETSc +export LibPETSc +export audit_petsc_file +export set_petsclib + +using Libdl + include("init.jl") -include("ref.jl") -include("viewer.jl") +include("vec.jl") +include("mat.jl") include("options.jl") -include("vec.jl") -include("mat.jl") -include("matshell.jl") -include("dm.jl") -include("dmda.jl") -include("dmstag.jl") include("ksp.jl") -include("pc.jl") -include("snes.jl") +include("snes.jl") +include("dm.jl") include("sys.jl") +include("dmda.jl") +include("dmstag.jl") + +# String convenience wrappers for SetType functions +include("string_wrappers.jl") +include("string_wrappers_extra.jl") + + +include("audit.jl") + + + +#= +include("utils.jl") +include("viewer.jl") + +include("matshell.jl") # not yet wrapped! +include("dm.jl") # partly wrapped, no tests yet +include("dmda.jl") # not yet wrapped! +include("pc.jl") # to be fixed/wrapped +include("ksp.jl") # part is wrapped +include("sys.jl") + +##include("startup.jl") # can be removed (later) +##include("lib.jl") # can be removed (later) +##include("ref.jl") # can be removed (later) + +=# end diff --git a/src/audit.jl b/src/audit.jl new file mode 100644 index 00000000..f0d1727f --- /dev/null +++ b/src/audit.jl @@ -0,0 +1,182 @@ +""" + audit_petsc_file(path::AbstractString) + +Scan a PETSc.jl source file and report PETSc object creations and destroys. + +This utility reads `path`, looks for common PETSc object creation patterns +(`KSP(...)`, `SNES(...)`, `DMDA(...)`, `DMStag(...)`, as well as +`VecCreate...`, `VecDuplicate...`, `Vec...WithArray(...)` and corresponding +`Mat...` creators via either `PETSc.` or `LibPETSc.`), plus common DM/Vec/Mat +allocators like `DMGlobalVec`, `DMLocalVec`, `DMGetCoordinateDM`, +`DMStagCreateCompatibleDMStag`, and `DMCreateMatrix`; and for explicit +`destroy(x)` calls (optionally prefixed with `PETSc.`). + +It prints three sections: + - CREATION statements: line numbers and variables assigned to created objects + - DESTROY calls: line numbers and variables destroyed + - POSSIBLY UNDESTROYED objects: variables that appear in creations but have no + matching destroy call + - FINALIZE calls: presence of `PETSc.finalize(petsclib)`; suggests adding it + if missing + +Notes: + - Heuristic only: matches common constructors and `LibPETSc` creation routines; + it does not follow control flow or scopes. + - Creations without assignment cannot be cross-checked against destroys. + - Objects produced via helpers (e.g., `similar(...)`) are not detected unless + they use known creation patterns. + +Returns `nothing`. +""" +function audit_petsc_file(path::AbstractString) + # Read full content and strip block comments (#= ... =#) before line parsing + content = read(path, String) + content = replace(content, r"(?s)#=.*?=#" => "") + lines = split(content, '\n') + + # Patterns for creation calls + type_creators = r"^(?:\s*)(?:([A-Za-z_]\w*)\s*=\s*)?(?:(?:PETSc|LibPETSc)\.)?(KSP|SNES|DMDA|DMStag)\s*\(" + # Match common PETSc Vec/Mat creators, including suffixed forms like + # VecCreateSeq, VecCreateMPI, VecDuplicateVecs, MatCreateSeqAIJ, etc. + vec_create = r"^(?:\s*)(?:([A-Za-z_]\w*)\s*=\s*)?(?:(?:PETSc|LibPETSc)\.)?Vec(?:Create\w*|Duplicate\w*|Load\w*|\w*WithArray)\s*\(" + mat_create = r"^(?:\s*)(?:([A-Za-z_]\w*)\s*=\s*)?(?:(?:PETSc|LibPETSc)\.)?Mat(?:Create\w*|Duplicate\w*|Load\w*|\w*With\w*Arrays)\s*\(" + # Additional allocators that should be destroyed + dm_vec_alloc = r"^(?:\s*)(?:([A-Za-z_]\w*)\s*=\s*)?(?:(?:PETSc|LibPETSc)\.)?(DMGlobalVec|DMLocalVec)\s*\(" + dm_alloc_dm = r"^(?:\s*)(?:([A-Za-z_]\w*)\s*=\s*)?(?:(?:PETSc|LibPETSc)\.)?(DMGetCoordinateDM|DMStagCreateCompatibleDMStag)\s*\(" + dm_alloc_mat = r"^(?:\s*)(?:([A-Za-z_]\w*)\s*=\s*)?(?:(?:PETSc|LibPETSc)\.)?(DMCreateMatrix)\s*\(" + + # Some PETSc calls create multiple objects via tuple assignment + # e.g. `x,b = LibPETSc.MatCreateVecs(petsclib, A)` + mat_create_vecs = r"^(?:\s*)(.+?)\s*=\s*(?:(?:PETSc|LibPETSc)\.)?MatCreateVecs\s*\(" + + # Pattern for destroy calls + destroy_pat = r"^(?:\s*)(?:(?:PETSc)\.)?destroy\s*\(\s*([A-Za-z_]\w*)" + # Pattern for finalize calls + finalize_pat = r"^(?:\s*)(?:(?:PETSc)\.)?finalize\s*\(\s*([A-Za-z_]\w*)" + + created = Vector{Tuple{Int,Union{Nothing,String},String}}() + destroyed = Vector{Tuple{Int,String}}() + finalized = Vector{Tuple{Int,String}}() + + for (i, ln_raw) in enumerate(lines) + # Skip empty and full-line comments + s = strip(ln_raw) + if isempty(s) || startswith(s, "#") + continue + end + ln_proc = ln_raw + + if occursin(type_creators, ln_proc) + m = match(type_creators, ln_proc) + var = m.captures[1] + func = m.captures[2] + push!(created, (i, var, func)) + continue + end + if occursin(vec_create, ln_proc) + m = match(vec_create, ln_proc) + var = m.captures[1] + push!(created, (i, var, "Vec")) + continue + end + if occursin(mat_create, ln_proc) + m = match(mat_create, ln_proc) + var = m.captures[1] + push!(created, (i, var, "Mat")) + continue + end + if occursin(dm_vec_alloc, ln_proc) + m = match(dm_vec_alloc, ln_proc) + var = m.captures[1] + push!(created, (i, var, "Vec")) + continue + end + if occursin(dm_alloc_dm, ln_proc) + m = match(dm_alloc_dm, ln_proc) + var = m.captures[1] + push!(created, (i, var, "DM")) + continue + end + if occursin(dm_alloc_mat, ln_proc) + m = match(dm_alloc_mat, ln_proc) + var = m.captures[1] + push!(created, (i, var, "Mat")) + continue + end + + if occursin(mat_create_vecs, ln_proc) + m = match(mat_create_vecs, ln_proc) + lhs = m.captures[1] + # Strip parentheses and split on commas: "(x, b)" or "x,b" etc. + lhs = replace(lhs, "(" => "", ")" => "") + vars = [strip(v) for v in split(lhs, ',') if !isempty(strip(v))] + if isempty(vars) + push!(created, (i, nothing, "Vec")) + else + for v in vars + if occursin(r"^[A-Za-z_]\w*$", v) + push!(created, (i, v, "Vec")) + end + end + end + continue + end + + if occursin(destroy_pat, ln_proc) + m = match(destroy_pat, ln_proc) + var = m.captures[1] + push!(destroyed, (i, var)) + continue + end + if occursin(finalize_pat, ln_proc) + m = match(finalize_pat, ln_proc) + var = m.captures[1] + push!(finalized, (i, var)) + continue + end + end + + println("CREATION statements:") + for (lnum, var, func) in created + if isnothing(var) + println(" line $(lnum): $(func)(...) (no assignment)") + else + println(" line $(lnum): $(var) = $(func)(...)") + end + end + + println("DESTROY calls:") + for (lnum, var) in destroyed + println(" line $(lnum): destroy($(var))") + end + + created_vars = Set{String}() + for (_, var, _) in created + if !isnothing(var) + push!(created_vars, var::String) + end + end + destroyed_vars = Set{String}(map(x -> x[2], destroyed)) + + missing = setdiff(created_vars, destroyed_vars) + if !isempty(missing) + println("POSSIBLY UNDESTROYED objects:") + for v in sort(collect(missing)) + println(" $(v)") + end + else + println("No obvious leaks: all assigned creations have a destroy call.") + end + + if isempty(finalized) + println("FINALIZE calls: none detected") + println("Suggestion: add PETSc.finalize(petsclib) at the end of the routine.") + else + println("FINALIZE calls:") + for (lnum, var) in finalized + println(" line $(lnum): finalize($(var))") + end + end + + return nothing +end diff --git a/src/autowrapped/AO_wrappers.jl b/src/autowrapped/AO_wrappers.jl new file mode 100644 index 00000000..26127536 --- /dev/null +++ b/src/autowrapped/AO_wrappers.jl @@ -0,0 +1,996 @@ +# autodefined type arguments for class ------ +# ------------------------------------------------------- +""" + AOFinalizePackage(petsclib::PetscLibType) +This function finalizes everything in the `AO` package. It is called +from `PetscFinalize()`. + +Level: developer + +-seealso: `AOInitializePackage()`, `PetscInitialize()` + +# External Links +$(_doc_external("Vec/AOFinalizePackage")) +""" +function AOFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function AOFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:AOFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + AOInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `AO` package. It is called +from `PetscDLLibraryRegister_petscvec()` when using dynamic libraries, and on the first call to `AOCreate()` +when using static or shared libraries. + +Level: developer + +-seealso: `AOFinalizePackage()`, `PetscInitialize()` + +# External Links +$(_doc_external("Vec/AOInitializePackage")) +""" +function AOInitializePackage(petsclib::PetscLibType) end + +@for_petsc function AOInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:AOInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + AOSetType(petsclib::PetscLibType,ao::AO, method::AOType) +Builds an application ordering for a particular `AOType` + +Collective + +Input Parameters: +- `ao` - The `AO` object +- `method` - The name of the AO type + +Options Database Key: +- `-ao_type ` - Sets the `AO` type; use -help for a list of available types + +Level: intermediate + +-seealso: `AO`, `AOType`, `AOCreateBasic()`, `AOCreateMemoryScalable()`, `AOGetType()`, `AOCreate()` + +# External Links +$(_doc_external("Vec/AOSetType")) +""" +function AOSetType(petsclib::PetscLibType, ao::AO, method::AOType) end + +@for_petsc function AOSetType(petsclib::$UnionPetscLib, ao::AO, method::AOType ) + + @chk ccall( + (:AOSetType, $petsc_library), + PetscErrorCode, + (CAO, AOType), + ao, method, + ) + + + return nothing +end + +""" + type::AOType = AOGetType(petsclib::PetscLibType,ao::AO) +Gets the `AO` type name (as a string) from the AO. + +Not Collective + +Input Parameter: +- `ao` - The vector + +Output Parameter: +- `type` - The `AO` type name + +Level: intermediate + +-seealso: `AO`, `AOType`, `AOSetType()`, `AOCreate()` + +# External Links +$(_doc_external("Vec/AOGetType")) +""" +function AOGetType(petsclib::PetscLibType, ao::AO) end + +@for_petsc function AOGetType(petsclib::$UnionPetscLib, ao::AO ) + type_ = Ref{AOType}() + + @chk ccall( + (:AOGetType, $petsc_library), + PetscErrorCode, + (CAO, Ptr{AOType}), + ao, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + AORegister(petsclib::PetscLibType,sname::String, fnc::external) +Register an application ordering method + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - the name (`AOType`) of the `AO` scheme +- `function` - the create routine for the application ordering method + +Level: advanced + +-seealso: `AO`, `AOType`, `AOCreate()`, `AORegisterAll()`, `AOBASIC`, `AOADVANCED`, `AOMAPPING`, `AOMEMORYSCALABLE` + +# External Links +$(_doc_external("Vec/AORegister")) +""" +function AORegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function AORegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:AORegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + AORegisterAll(petsclib::PetscLibType) +Registers all of the application ordering components in the `AO` package. + +Not Collective + +Level: advanced + +-seealso: `AO`, `AOType`, `AORegister()`, `AORegisterDestroy()` + +# External Links +$(_doc_external("Vec/AORegisterAll")) +""" +function AORegisterAll(petsclib::PetscLibType) end + +@for_petsc function AORegisterAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:AORegisterAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + AOView(petsclib::PetscLibType,ao::AO, viewer::PetscViewer) +Displays an application ordering. + +Collective + +Input Parameters: +- `ao` - the application ordering context +- `viewer` - viewer used for display + +Level: intermediate + +Options Database Key: +- `-ao_view` - calls `AOView()` at end of `AOCreate()` + +-seealso: [](sec_ao), `AO`, `PetscViewerASCIIOpen()`, `AOViewFromOptions()` + +# External Links +$(_doc_external("Vec/AOView")) +""" +function AOView(petsclib::PetscLibType, ao::AO, viewer::PetscViewer) end + +@for_petsc function AOView(petsclib::$UnionPetscLib, ao::AO, viewer::PetscViewer ) + + @chk ccall( + (:AOView, $petsc_library), + PetscErrorCode, + (CAO, PetscViewer), + ao, viewer, + ) + + + return nothing +end + +""" + AOViewFromOptions(petsclib::PetscLibType,ao::AO, obj::PetscObject, name::String) +View an `AO` based on values in the options database + +Collective + +Input Parameters: +- `ao` - the application ordering context +- `obj` - optional object that provides the prefix used to search the options database +- `name` - command line option + +Level: intermediate + +-seealso: [](sec_ao), `AO`, `AOView()`, `PetscObjectViewFromOptions()`, `AOCreate()` + +# External Links +$(_doc_external("Vec/AOViewFromOptions")) +""" +function AOViewFromOptions(petsclib::PetscLibType, ao::AO, obj::PetscObject, name::String) end + +@for_petsc function AOViewFromOptions(petsclib::$UnionPetscLib, ao::AO, obj::PetscObject, name::String ) + + @chk ccall( + (:AOViewFromOptions, $petsc_library), + PetscErrorCode, + (CAO, PetscObject, Ptr{Cchar}), + ao, obj, name, + ) + + + return nothing +end + +""" + AODestroy(petsclib::PetscLibType,ao::AO) +Destroys an application ordering. + +Collective + +Input Parameter: +- `ao` - the application ordering context + +Level: beginner + +-seealso: [](sec_ao), `AO`, `AOCreate()` + +# External Links +$(_doc_external("Vec/AODestroy")) +""" +function AODestroy(petsclib::PetscLibType, ao::AO) end + +@for_petsc function AODestroy(petsclib::$UnionPetscLib, ao::AO ) + ao_ = Ref(ao.ptr) + + @chk ccall( + (:AODestroy, $petsc_library), + PetscErrorCode, + (Ptr{CAO},), + ao_, + ) + + ao.ptr = C_NULL + + return nothing +end + +""" + AOPetscToApplicationIS(petsclib::PetscLibType,ao::AO, is::IS) +Maps an index set in the PETSc ordering to +the application-defined ordering. + +Collective + +Input Parameters: +- `ao` - the application ordering context +- `is` - the index set; this is replaced with its mapped values + +Output Parameter: +- `is` - the mapped index set + +Level: intermediate + +-seealso: [](sec_ao), `AO`, `AOCreateBasic()`, `AOView()`, `AOApplicationToPetsc()`, +`AOApplicationToPetscIS()`, `AOPetscToApplication()`, `ISSTRIDE`, `ISBLOCK` + +# External Links +$(_doc_external("Vec/AOPetscToApplicationIS")) +""" +function AOPetscToApplicationIS(petsclib::PetscLibType, ao::AO, is::IS) end + +@for_petsc function AOPetscToApplicationIS(petsclib::$UnionPetscLib, ao::AO, is::IS ) + + @chk ccall( + (:AOPetscToApplicationIS, $petsc_library), + PetscErrorCode, + (CAO, CIS), + ao, is, + ) + + + return nothing +end + +""" + AOApplicationToPetscIS(petsclib::PetscLibType,ao::AO, is::IS) +Maps an index set in the application +ordering to the PETSc ordering. + +Collective + +Input Parameters: +- `ao` - the application ordering context +- `is` - the index set; this is replaced with its mapped values + +Output Parameter: +- `is` - the mapped index set + +Level: beginner + +-seealso: [](sec_ao), `AO`, `AOCreateBasic()`, `AOView()`, `AOPetscToApplication()`, +`AOPetscToApplicationIS()`, `AOApplicationToPetsc()`, `ISSTRIDE`, `ISBLOCK` + +# External Links +$(_doc_external("Vec/AOApplicationToPetscIS")) +""" +function AOApplicationToPetscIS(petsclib::PetscLibType, ao::AO, is::IS) end + +@for_petsc function AOApplicationToPetscIS(petsclib::$UnionPetscLib, ao::AO, is::IS ) + + @chk ccall( + (:AOApplicationToPetscIS, $petsc_library), + PetscErrorCode, + (CAO, CIS), + ao, is, + ) + + + return nothing +end + +""" + AOPetscToApplication(petsclib::PetscLibType,ao::AO, n::PetscInt, ia::Vector{PetscInt}) +Maps a set of integers in the PETSc ordering to +the application-defined ordering. + +Collective + +Input Parameters: +- `ao` - the application ordering context +- `n` - the number of integers +- `ia` - the integers; these are replaced with their mapped value + +Output Parameter: +- `ia` - the mapped integers + +Level: beginner + +-seealso: [](sec_ao), `AO`, `AOCreateBasic()`, `AOView()`, `AOApplicationToPetsc()`, +`AOPetscToApplicationIS()` + +# External Links +$(_doc_external("Vec/AOPetscToApplication")) +""" +function AOPetscToApplication(petsclib::PetscLibType, ao::AO, n::PetscInt, ia::Vector{PetscInt}) end + +@for_petsc function AOPetscToApplication(petsclib::$UnionPetscLib, ao::AO, n::$PetscInt, ia::Vector{$PetscInt} ) + + @chk ccall( + (:AOPetscToApplication, $petsc_library), + PetscErrorCode, + (CAO, $PetscInt, Ptr{$PetscInt}), + ao, n, ia, + ) + + + return nothing +end + +""" + AOApplicationToPetsc(petsclib::PetscLibType,ao::AO, n::PetscInt, ia::Vector{PetscInt}) +Maps a set of integers in the application +ordering to the PETSc ordering. + +Collective + +Input Parameters: +- `ao` - the application ordering context +- `n` - the number of integers +- `ia` - the integers; these are replaced with their mapped value + +Output Parameter: +- `ia` - the mapped integers + +Level: beginner + +-seealso: [](sec_ao), `AOCreateBasic()`, `AOView()`, `AOPetscToApplication()`, +`AOPetscToApplicationIS()` + +# External Links +$(_doc_external("Vec/AOApplicationToPetsc")) +""" +function AOApplicationToPetsc(petsclib::PetscLibType, ao::AO, n::PetscInt, ia::Vector{PetscInt}) end + +@for_petsc function AOApplicationToPetsc(petsclib::$UnionPetscLib, ao::AO, n::$PetscInt, ia::Vector{$PetscInt} ) + + @chk ccall( + (:AOApplicationToPetsc, $petsc_library), + PetscErrorCode, + (CAO, $PetscInt, Ptr{$PetscInt}), + ao, n, ia, + ) + + + return nothing +end + +""" + AOPetscToApplicationPermuteInt(petsclib::PetscLibType,ao::AO, block::PetscInt, array::Vector{PetscInt}) +Permutes an array of blocks of integers +in the PETSc ordering to the application-defined ordering. + +Collective + +Input Parameters: +- `ao` - The application ordering context +- `block` - The block size +- `array` - The integer array + +Output Parameter: +- `array` - The permuted array + +Level: beginner + +-seealso: [](sec_ao), `AO`, `AOCreateBasic()`, `AOView()`, `AOApplicationToPetsc()`, `AOPetscToApplicationIS()` + +# External Links +$(_doc_external("Vec/AOPetscToApplicationPermuteInt")) +""" +function AOPetscToApplicationPermuteInt(petsclib::PetscLibType, ao::AO, block::PetscInt, array::Vector{PetscInt}) end + +@for_petsc function AOPetscToApplicationPermuteInt(petsclib::$UnionPetscLib, ao::AO, block::$PetscInt, array::Vector{$PetscInt} ) + + @chk ccall( + (:AOPetscToApplicationPermuteInt, $petsc_library), + PetscErrorCode, + (CAO, $PetscInt, Ptr{$PetscInt}), + ao, block, array, + ) + + + return nothing +end + +""" + AOApplicationToPetscPermuteInt(petsclib::PetscLibType,ao::AO, block::PetscInt, array::Vector{PetscInt}) +Permutes an array of blocks of integers +in the application-defined ordering to the PETSc ordering. + +Collective + +Input Parameters: +- `ao` - The application ordering context +- `block` - The block size +- `array` - The integer array + +Output Parameter: +- `array` - The permuted array + +Level: beginner + +-seealso: [](sec_ao), `AO`, `AOCreateBasic()`, `AOView()`, `AOPetscToApplicationIS()`, `AOApplicationToPetsc()` + +# External Links +$(_doc_external("Vec/AOApplicationToPetscPermuteInt")) +""" +function AOApplicationToPetscPermuteInt(petsclib::PetscLibType, ao::AO, block::PetscInt, array::Vector{PetscInt}) end + +@for_petsc function AOApplicationToPetscPermuteInt(petsclib::$UnionPetscLib, ao::AO, block::$PetscInt, array::Vector{$PetscInt} ) + + @chk ccall( + (:AOApplicationToPetscPermuteInt, $petsc_library), + PetscErrorCode, + (CAO, $PetscInt, Ptr{$PetscInt}), + ao, block, array, + ) + + + return nothing +end + +""" + AOPetscToApplicationPermuteReal(petsclib::PetscLibType,ao::AO, block::PetscInt, array::Vector{PetscReal}) +Permutes an array of blocks of reals +in the PETSc ordering to the application-defined ordering. + +Collective + +Input Parameters: +- `ao` - The application ordering context +- `block` - The block size +- `array` - The integer array + +Output Parameter: +- `array` - The permuted array + +Level: beginner + +-seealso: [](sec_ao), `AO`, `AOCreateBasic()`, `AOView()`, `AOApplicationToPetsc()`, `AOPetscToApplicationIS()` + +# External Links +$(_doc_external("Vec/AOPetscToApplicationPermuteReal")) +""" +function AOPetscToApplicationPermuteReal(petsclib::PetscLibType, ao::AO, block::PetscInt, array::Vector{PetscReal}) end + +@for_petsc function AOPetscToApplicationPermuteReal(petsclib::$UnionPetscLib, ao::AO, block::$PetscInt, array::Vector{$PetscReal} ) + + @chk ccall( + (:AOPetscToApplicationPermuteReal, $petsc_library), + PetscErrorCode, + (CAO, $PetscInt, Ptr{$PetscReal}), + ao, block, array, + ) + + + return nothing +end + +""" + AOApplicationToPetscPermuteReal(petsclib::PetscLibType,ao::AO, block::PetscInt, array::Vector{PetscReal}) +Permutes an array of blocks of reals +in the application-defined ordering to the PETSc ordering. + +Collective + +Input Parameters: +- `ao` - The application ordering context +- `block` - The block size +- `array` - The integer array + +Output Parameter: +- `array` - The permuted array + +Level: beginner + +-seealso: [](sec_ao), `AO`, `AOCreateBasic()`, `AOView()`, `AOApplicationToPetsc()`, `AOPetscToApplicationIS()` + +# External Links +$(_doc_external("Vec/AOApplicationToPetscPermuteReal")) +""" +function AOApplicationToPetscPermuteReal(petsclib::PetscLibType, ao::AO, block::PetscInt, array::Vector{PetscReal}) end + +@for_petsc function AOApplicationToPetscPermuteReal(petsclib::$UnionPetscLib, ao::AO, block::$PetscInt, array::Vector{$PetscReal} ) + + @chk ccall( + (:AOApplicationToPetscPermuteReal, $petsc_library), + PetscErrorCode, + (CAO, $PetscInt, Ptr{$PetscReal}), + ao, block, array, + ) + + + return nothing +end + +""" + AOSetFromOptions(petsclib::PetscLibType,ao::AO) +Sets `AO` options from the options database. + +Collective + +Input Parameter: +- `ao` - the application ordering + +Options Database Key: +- `-ao_type ` - sets the type of the `AO` + +Level: beginner + +-seealso: [](sec_ao), `AO`, `AOCreate()`, `AOSetType()`, `AODestroy()`, `AOPetscToApplication()`, `AOApplicationToPetsc()` + +# External Links +$(_doc_external("Vec/AOSetFromOptions")) +""" +function AOSetFromOptions(petsclib::PetscLibType, ao::AO) end + +@for_petsc function AOSetFromOptions(petsclib::$UnionPetscLib, ao::AO ) + + @chk ccall( + (:AOSetFromOptions, $petsc_library), + PetscErrorCode, + (CAO,), + ao, + ) + + + return nothing +end + +""" + AOSetIS(petsclib::PetscLibType,ao::AO, isapp::IS, ispetsc::IS) +Sets the `IS` associated with the application ordering. + +Collective + +Input Parameters: +- `ao` - the application ordering +- `isapp` - index set that defines an ordering +- `ispetsc` - index set that defines another ordering (may be `NULL` to use the natural ordering) + +Level: beginner + +-seealso: [](sec_ao), [](sec_scatter), `AO`, `AOCreate()`, `AODestroy()`, `AOPetscToApplication()`, `AOApplicationToPetsc()` + +# External Links +$(_doc_external("Vec/AOSetIS")) +""" +function AOSetIS(petsclib::PetscLibType, ao::AO, isapp::IS, ispetsc::IS) end + +@for_petsc function AOSetIS(petsclib::$UnionPetscLib, ao::AO, isapp::IS, ispetsc::IS ) + + @chk ccall( + (:AOSetIS, $petsc_library), + PetscErrorCode, + (CAO, CIS, CIS), + ao, isapp, ispetsc, + ) + + + return nothing +end + +""" + ao::AO = AOCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an application ordering. That is an object that maps from an application ordering to a PETSc ordering and vice versa + +Collective + +Input Parameter: +- `comm` - MPI communicator that is to share the `AO` + +Output Parameter: +- `ao` - the new application ordering + +Options Database Key: +- `-ao_type ` - create `AO` with particular format +- `-ao_view` - call `AOView()` at the conclusion of `AOCreate()` + +Level: beginner + +-seealso: [](sec_ao), `AO`, `AOView()`, `AOSetIS()`, `AODestroy()`, `AOPetscToApplication()`, `AOApplicationToPetsc()` + +# External Links +$(_doc_external("Vec/AOCreate")) +""" +function AOCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function AOCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + ao_ = Ref{CAO}() + + @chk ccall( + (:AOCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CAO}), + comm, ao_, + ) + + ao = AO(ao_[], petsclib) + + return ao +end + +""" + hasIndex::PetscBool = AOMappingHasApplicationIndex(petsclib::PetscLibType,ao::AO, idex::PetscInt) +Checks if an `AO` has a requested application index. + +Not Collective + +Input Parameters: +- `ao` - The `AO` +- `idex` - The application index + +Output Parameter: +- `hasIndex` - Flag is `PETSC_TRUE` if the index exists + +Level: intermediate + +-seealso: [](sec_ao), `AOMappingHasPetscIndex()`, `AOCreateMapping()`, `AO` + +# External Links +$(_doc_external("Vec/AOMappingHasApplicationIndex")) +""" +function AOMappingHasApplicationIndex(petsclib::PetscLibType, ao::AO, idex::PetscInt) end + +@for_petsc function AOMappingHasApplicationIndex(petsclib::$UnionPetscLib, ao::AO, idex::$PetscInt ) + hasIndex_ = Ref{PetscBool}() + + @chk ccall( + (:AOMappingHasApplicationIndex, $petsc_library), + PetscErrorCode, + (CAO, $PetscInt, Ptr{PetscBool}), + ao, idex, hasIndex_, + ) + + hasIndex = hasIndex_[] + + return hasIndex +end + +""" + hasIndex::PetscBool = AOMappingHasPetscIndex(petsclib::PetscLibType,ao::AO, idex::PetscInt) +checks if an `AO` has a requested PETSc index. + +Not Collective + +Input Parameters: +- `ao` - The `AO` +- `idex` - The PETSc index + +Output Parameter: +- `hasIndex` - Flag is `PETSC_TRUE` if the index exists + +Level: intermediate + +-seealso: [](sec_ao), `AOMappingHasApplicationIndex()`, `AOCreateMapping()` + +# External Links +$(_doc_external("Vec/AOMappingHasPetscIndex")) +""" +function AOMappingHasPetscIndex(petsclib::PetscLibType, ao::AO, idex::PetscInt) end + +@for_petsc function AOMappingHasPetscIndex(petsclib::$UnionPetscLib, ao::AO, idex::$PetscInt ) + hasIndex_ = Ref{PetscBool}() + + @chk ccall( + (:AOMappingHasPetscIndex, $petsc_library), + PetscErrorCode, + (CAO, $PetscInt, Ptr{PetscBool}), + ao, idex, hasIndex_, + ) + + hasIndex = hasIndex_[] + + return hasIndex +end + +""" + aoout::AO = AOCreateMapping(petsclib::PetscLibType,comm::MPI_Comm, napp::PetscInt, myapp::Vector{PetscInt}, mypetsc::Vector{PetscInt}) +Creates an application mapping using two integer arrays. + +Input Parameters: +- `comm` - MPI communicator that is to share the `AO` +- `napp` - size of integer arrays +- `myapp` - integer array that defines an ordering +- `mypetsc` - integer array that defines another ordering (may be `NULL` to indicate the identity ordering) + +Output Parameter: +- `aoout` - the new application mapping + +Options Database Key: +- `-ao_view` - call `AOView()` at the conclusion of `AOCreateMapping()` + +Level: beginner + +-seealso: [](sec_ao), `AOCreateBasic()`, `AOCreateMappingIS()`, `AODestroy()` + +# External Links +$(_doc_external("Vec/AOCreateMapping")) +""" +function AOCreateMapping(petsclib::PetscLibType, comm::MPI_Comm, napp::PetscInt, myapp::Vector{PetscInt}, mypetsc::Vector{PetscInt}) end + +@for_petsc function AOCreateMapping(petsclib::$UnionPetscLib, comm::MPI_Comm, napp::$PetscInt, myapp::Vector{$PetscInt}, mypetsc::Vector{$PetscInt} ) + aoout_ = Ref{CAO}() + + @chk ccall( + (:AOCreateMapping, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{CAO}), + comm, napp, myapp, mypetsc, aoout_, + ) + + aoout = AO(aoout_[], petsclib) + + return aoout +end + +""" + aoout::AO = AOCreateMappingIS(petsclib::PetscLibType,isapp::IS, ispetsc::IS) +Creates an application mapping using two index sets. + +Input Parameters: +- `isapp` - index set that defines an ordering +- `ispetsc` - index set that defines another ordering, maybe `NULL` for identity `IS` + +Output Parameter: +- `aoout` - the new application ordering + +Options Database Key: +- `-ao_view` - call `AOView()` at the conclusion of `AOCreateMappingIS()` + +Level: beginner + +-seealso: [](sec_ao), [](sec_scatter), `AOCreateBasic()`, `AOCreateMapping()`, `AODestroy()` + +# External Links +$(_doc_external("Vec/AOCreateMappingIS")) +""" +function AOCreateMappingIS(petsclib::PetscLibType, isapp::IS, ispetsc::IS) end + +@for_petsc function AOCreateMappingIS(petsclib::$UnionPetscLib, isapp::IS, ispetsc::IS ) + aoout_ = Ref{CAO}() + + @chk ccall( + (:AOCreateMappingIS, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{CAO}), + isapp, ispetsc, aoout_, + ) + + aoout = AO(aoout_[], petsclib) + + return aoout +end + +""" + aoout::AO = AOCreateMemoryScalable(petsclib::PetscLibType,comm::MPI_Comm, napp::PetscInt, myapp::Vector{PetscInt}, mypetsc::Vector{PetscInt}) +Creates a memory scalable application ordering using two integer arrays. + +Collective + +Input Parameters: +- `comm` - MPI communicator that is to share the `AO` +- `napp` - size of `myapp` and `mypetsc` +- `myapp` - integer array that defines an ordering +- `mypetsc` - integer array that defines another ordering (may be `NULL` to indicate the natural ordering, that is 0,1,2,3,...) + +Output Parameter: +- `aoout` - the new application ordering + +Level: beginner + +-seealso: [](sec_ao), [](sec_scatter), `AO`, `AOCreateMemoryScalableIS()`, `AODestroy()`, `AOPetscToApplication()`, `AOApplicationToPetsc()` + +# External Links +$(_doc_external("Vec/AOCreateMemoryScalable")) +""" +function AOCreateMemoryScalable(petsclib::PetscLibType, comm::MPI_Comm, napp::PetscInt, myapp::Vector{PetscInt}, mypetsc::Vector{PetscInt}) end + +@for_petsc function AOCreateMemoryScalable(petsclib::$UnionPetscLib, comm::MPI_Comm, napp::$PetscInt, myapp::Vector{$PetscInt}, mypetsc::Vector{$PetscInt} ) + aoout_ = Ref{CAO}() + + @chk ccall( + (:AOCreateMemoryScalable, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{CAO}), + comm, napp, myapp, mypetsc, aoout_, + ) + + aoout = AO(aoout_[], petsclib) + + return aoout +end + +""" + aoout::AO = AOCreateMemoryScalableIS(petsclib::PetscLibType,isapp::IS, ispetsc::IS) +Creates a memory scalable application ordering using two index sets. + +Collective + +Input Parameters: +- `isapp` - index set that defines an ordering +- `ispetsc` - index set that defines another ordering (may be `NULL` to use the natural ordering) + +Output Parameter: +- `aoout` - the new application ordering + +Level: beginner + +-seealso: [](sec_ao), [](sec_scatter), `AO`, `AOCreateBasicIS()`, `AOCreateMemoryScalable()`, `AODestroy()` + +# External Links +$(_doc_external("Vec/AOCreateMemoryScalableIS")) +""" +function AOCreateMemoryScalableIS(petsclib::PetscLibType, isapp::IS, ispetsc::IS) end + +@for_petsc function AOCreateMemoryScalableIS(petsclib::$UnionPetscLib, isapp::IS, ispetsc::IS ) + aoout_ = Ref{CAO}() + + @chk ccall( + (:AOCreateMemoryScalableIS, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{CAO}), + isapp, ispetsc, aoout_, + ) + + aoout = AO(aoout_[], petsclib) + + return aoout +end + +""" + aoout::AO = AOCreateBasic(petsclib::PetscLibType,comm::MPI_Comm, napp::PetscInt, myapp::Vector{PetscInt}, mypetsc::Vector{PetscInt}) +Creates a basic application ordering using two integer arrays. + +Collective + +Input Parameters: +- `comm` - MPI communicator that is to share `AO` +- `napp` - size of `myapp` and `mypetsc` +- `myapp` - integer array that defines an ordering +- `mypetsc` - integer array that defines another ordering (may be `NULL` to +indicate the natural ordering, that is 0,1,2,3,...) + +Output Parameter: +- `aoout` - the new application ordering + +Level: beginner + +-seealso: [](sec_ao), [](sec_scatter), `AO`, `AOCreateBasicIS()`, `AODestroy()`, `AOPetscToApplication()`, `AOApplicationToPetsc()` + +# External Links +$(_doc_external("Vec/AOCreateBasic")) +""" +function AOCreateBasic(petsclib::PetscLibType, comm::MPI_Comm, napp::PetscInt, myapp::Vector{PetscInt}, mypetsc::Vector{PetscInt}) end + +@for_petsc function AOCreateBasic(petsclib::$UnionPetscLib, comm::MPI_Comm, napp::$PetscInt, myapp::Vector{$PetscInt}, mypetsc::Vector{$PetscInt} ) + aoout_ = Ref{CAO}() + + @chk ccall( + (:AOCreateBasic, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{CAO}), + comm, napp, myapp, mypetsc, aoout_, + ) + + aoout = AO(aoout_[], petsclib) + + return aoout +end + +""" + aoout::AO = AOCreateBasicIS(petsclib::PetscLibType,isapp::IS, ispetsc::IS) +Creates a basic application ordering using two `IS` index sets. + +Collective + +Input Parameters: +- `isapp` - index set that defines an ordering +- `ispetsc` - index set that defines another ordering (may be `NULL` to use the natural ordering) + +Output Parameter: +- `aoout` - the new application ordering + +Level: beginner + +-seealso: [](sec_ao), [](sec_scatter), `IS`, `AO`, `AOCreateBasic()`, `AODestroy()` + +# External Links +$(_doc_external("Vec/AOCreateBasicIS")) +""" +function AOCreateBasicIS(petsclib::PetscLibType, isapp::IS, ispetsc::IS) end + +@for_petsc function AOCreateBasicIS(petsclib::$UnionPetscLib, isapp::IS, ispetsc::IS ) + aoout_ = Ref{CAO}() + + @chk ccall( + (:AOCreateBasicIS, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{CAO}), + isapp, ispetsc, aoout_, + ) + + aoout = AO(aoout_[], petsclib) + + return aoout +end + diff --git a/src/autowrapped/Characteristic_wrappers.jl b/src/autowrapped/Characteristic_wrappers.jl new file mode 100644 index 00000000..fd7fc8d4 --- /dev/null +++ b/src/autowrapped/Characteristic_wrappers.jl @@ -0,0 +1,342 @@ +# autodefined type arguments for class ------ +mutable struct _n_Characteristic end +const Characteristic = Ptr{_n_Characteristic} + +# ------------------------------------------------------- +""" + CharacteristicFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the `Characteristics` package. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: [](ch_ts), `PetscFinalize()`, `CharacteristicInitializePackage()` + +# External Links +$(_doc_external("Ts/CharacteristicFinalizePackage")) +""" +function CharacteristicFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function CharacteristicFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:CharacteristicFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + CharacteristicInitializePackage(petsclib::PetscLibType) +This function initializes everything in the Characteristic package. It is called +from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to CharacteristicCreate() +when using static libraries. + +Level: developer + +-seealso: [](ch_ts), `PetscInitialize()`, `CharacteristicFinalizePackage()` + +# External Links +$(_doc_external("Ts/CharacteristicInitializePackage")) +""" +function CharacteristicInitializePackage(petsclib::PetscLibType) end + +@for_petsc function CharacteristicInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:CharacteristicInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + CharacteristicDestroy(petsclib::PetscLibType,c::Characteristic) +Destroys a `Characteristic` context created with `CharacteristicCreate()` + +Collective + +Input Parameter: +- `c` - the `Characteristic` context + +Level: beginner + +-seealso: `Characteristic`, `CharacteristicCreate()` + +# External Links +$(_doc_external("Ts/CharacteristicDestroy")) +""" +function CharacteristicDestroy(petsclib::PetscLibType, c::Characteristic) end + +@for_petsc function CharacteristicDestroy(petsclib::$UnionPetscLib, c::Characteristic ) + + @chk ccall( + (:CharacteristicDestroy, $petsc_library), + PetscErrorCode, + (Ptr{Characteristic},), + c, + ) + + + return nothing +end + +""" + c::Characteristic = CharacteristicCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a `Characteristic` context for use with the Method of Characteristics + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `c` - the `Characteristic` context + +Level: beginner + +-seealso: `Characteristic`, `CharacteristicDestroy()` + +# External Links +$(_doc_external("Ts/CharacteristicCreate")) +""" +function CharacteristicCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function CharacteristicCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + c_ = Ref{Characteristic}() + + @chk ccall( + (:CharacteristicCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Characteristic}), + comm, c_, + ) + + c = c_[] + + return c +end + +""" + CharacteristicSetType(petsclib::PetscLibType,c::Characteristic, type::CharacteristicType) +Builds Characteristic for a particular solver. + +Logically Collective + +Input Parameters: +- `c` - the method of characteristics context +- `type` - a known method + +Options Database Key: +- `-characteristic_type ` - Sets the method; use -help for a list +of available methods + +Level: intermediate + +-seealso: [](ch_ts), `CharacteristicType` + +# External Links +$(_doc_external("Ts/CharacteristicSetType")) +""" +function CharacteristicSetType(petsclib::PetscLibType, c::Characteristic, type::CharacteristicType) end + +@for_petsc function CharacteristicSetType(petsclib::$UnionPetscLib, c::Characteristic, type::CharacteristicType ) + + @chk ccall( + (:CharacteristicSetType, $petsc_library), + PetscErrorCode, + (Characteristic, CharacteristicType), + c, type, + ) + + + return nothing +end + +""" + CharacteristicSetUp(petsclib::PetscLibType,c::Characteristic) +Sets up the internal data structures for the +later use of a `Charactoristic` . + +Collective + +Input Parameter: +- `c` - context obtained from CharacteristicCreate() + +Level: developer + +-seealso: [](ch_ts), `Characteristic`, `CharacteristicCreate()`, `CharacteristicSolve()`, `CharacteristicDestroy()` + +# External Links +$(_doc_external("Ts/CharacteristicSetUp")) +""" +function CharacteristicSetUp(petsclib::PetscLibType, c::Characteristic) end + +@for_petsc function CharacteristicSetUp(petsclib::$UnionPetscLib, c::Characteristic ) + + @chk ccall( + (:CharacteristicSetUp, $petsc_library), + PetscErrorCode, + (Characteristic,), + c, + ) + + + return nothing +end + +""" + CharacteristicRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds an approarch to the method of characteristics package. + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new approach +- `function` - routine to create method context + +Level: advanced + +-seealso: [](ch_ts), `CharacteristicRegisterAll()`, `CharacteristicRegisterDestroy()` + +# External Links +$(_doc_external("Ts/CharacteristicRegister")) +""" +function CharacteristicRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function CharacteristicRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:CharacteristicRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + CharacteristicSetVelocityInterpolation(petsclib::PetscLibType,c::Characteristic, da::PetscDM, v::PetscVec, vOld::PetscVec, numComponents::PetscInt, components::Vector{PetscInt}, interp::external, ctx::Cvoid) + +# External Links +$(_doc_external("Ts/CharacteristicSetVelocityInterpolation")) +""" +function CharacteristicSetVelocityInterpolation(petsclib::PetscLibType, c::Characteristic, da::PetscDM, v::PetscVec, vOld::PetscVec, numComponents::PetscInt, components::Vector{PetscInt}, interp::external, ctx::Cvoid) end + +@for_petsc function CharacteristicSetVelocityInterpolation(petsclib::$UnionPetscLib, c::Characteristic, da::PetscDM, v::PetscVec, vOld::PetscVec, numComponents::$PetscInt, components::Vector{$PetscInt}, interp::external, ctx::Cvoid ) + + @chk ccall( + (:CharacteristicSetVelocityInterpolation, $petsc_library), + PetscErrorCode, + (Characteristic, CDM, CVec, CVec, $PetscInt, Ptr{$PetscInt}, external, Ptr{Cvoid}), + c, da, v, vOld, numComponents, components, interp, ctx, + ) + + + return nothing +end + +""" + CharacteristicSetVelocityInterpolationLocal(petsclib::PetscLibType,c::Characteristic, da::PetscDM, v::PetscVec, vOld::PetscVec, numComponents::PetscInt, components::Vector{PetscInt}, interp::external, ctx::Cvoid) + +# External Links +$(_doc_external("Ts/CharacteristicSetVelocityInterpolationLocal")) +""" +function CharacteristicSetVelocityInterpolationLocal(petsclib::PetscLibType, c::Characteristic, da::PetscDM, v::PetscVec, vOld::PetscVec, numComponents::PetscInt, components::Vector{PetscInt}, interp::external, ctx::Cvoid) end + +@for_petsc function CharacteristicSetVelocityInterpolationLocal(petsclib::$UnionPetscLib, c::Characteristic, da::PetscDM, v::PetscVec, vOld::PetscVec, numComponents::$PetscInt, components::Vector{$PetscInt}, interp::external, ctx::Cvoid ) + + @chk ccall( + (:CharacteristicSetVelocityInterpolationLocal, $petsc_library), + PetscErrorCode, + (Characteristic, CDM, CVec, CVec, $PetscInt, Ptr{$PetscInt}, external, Ptr{Cvoid}), + c, da, v, vOld, numComponents, components, interp, ctx, + ) + + + return nothing +end + +""" + CharacteristicSetFieldInterpolation(petsclib::PetscLibType,c::Characteristic, da::PetscDM, v::PetscVec, numComponents::PetscInt, components::Vector{PetscInt}, interp::external, ctx::Cvoid) + +# External Links +$(_doc_external("Ts/CharacteristicSetFieldInterpolation")) +""" +function CharacteristicSetFieldInterpolation(petsclib::PetscLibType, c::Characteristic, da::PetscDM, v::PetscVec, numComponents::PetscInt, components::Vector{PetscInt}, interp::external, ctx::Cvoid) end + +@for_petsc function CharacteristicSetFieldInterpolation(petsclib::$UnionPetscLib, c::Characteristic, da::PetscDM, v::PetscVec, numComponents::$PetscInt, components::Vector{$PetscInt}, interp::external, ctx::Cvoid ) + + @chk ccall( + (:CharacteristicSetFieldInterpolation, $petsc_library), + PetscErrorCode, + (Characteristic, CDM, CVec, $PetscInt, Ptr{$PetscInt}, external, Ptr{Cvoid}), + c, da, v, numComponents, components, interp, ctx, + ) + + + return nothing +end + +""" + CharacteristicSetFieldInterpolationLocal(petsclib::PetscLibType,c::Characteristic, da::PetscDM, v::PetscVec, numComponents::PetscInt, components::Vector{PetscInt}, interp::external, ctx::Cvoid) + +# External Links +$(_doc_external("Ts/CharacteristicSetFieldInterpolationLocal")) +""" +function CharacteristicSetFieldInterpolationLocal(petsclib::PetscLibType, c::Characteristic, da::PetscDM, v::PetscVec, numComponents::PetscInt, components::Vector{PetscInt}, interp::external, ctx::Cvoid) end + +@for_petsc function CharacteristicSetFieldInterpolationLocal(petsclib::$UnionPetscLib, c::Characteristic, da::PetscDM, v::PetscVec, numComponents::$PetscInt, components::Vector{$PetscInt}, interp::external, ctx::Cvoid ) + + @chk ccall( + (:CharacteristicSetFieldInterpolationLocal, $petsc_library), + PetscErrorCode, + (Characteristic, CDM, CVec, $PetscInt, Ptr{$PetscInt}, external, Ptr{Cvoid}), + c, da, v, numComponents, components, interp, ctx, + ) + + + return nothing +end + +""" + CharacteristicSolve(petsclib::PetscLibType,c::Characteristic, dt::PetscReal, solution::PetscVec) +Apply the Method of Characteristics solver + +Collective + +Input Parameters: +- `c` - context obtained from `CharacteristicCreate()` +- `dt` - the time-step +- `solution` - vector holding the solution + +Level: developer + +-seealso: [](ch_ts), `Characteristic`, `CharacteristicCreate()`, `CharacteristicDestroy()` + +# External Links +$(_doc_external("Ts/CharacteristicSolve")) +""" +function CharacteristicSolve(petsclib::PetscLibType, c::Characteristic, dt::PetscReal, solution::PetscVec) end + +@for_petsc function CharacteristicSolve(petsclib::$UnionPetscLib, c::Characteristic, dt::$PetscReal, solution::PetscVec ) + + @chk ccall( + (:CharacteristicSolve, $petsc_library), + PetscErrorCode, + (Characteristic, $PetscReal, CVec), + c, dt, solution, + ) + + + return nothing +end + diff --git a/src/autowrapped/DM_wrappers.jl b/src/autowrapped/DM_wrappers.jl new file mode 100644 index 00000000..c00316fd --- /dev/null +++ b/src/autowrapped/DM_wrappers.jl @@ -0,0 +1,45442 @@ +# autodefined type arguments for class ------ +mutable struct PetscPoCintFn end + +mutable struct _n_DMInterpolationInfo end +const DMInterpolationInfo = Ptr{_n_DMInterpolationInfo} + +mutable struct _n_PetscDS end +const PetscDS = Ptr{_n_PetscDS} + +mutable struct _n_PetscFE end +const PetscFE = Ptr{_n_PetscFE} + +mutable struct _n_DMField end +const DMField = Ptr{_n_DMField} + +mutable struct _n_DMPoCintLocationType end +const DMPoCintLocationType = Ptr{_n_DMPoCintLocationType} + +mutable struct PetscSimplePoCintFn end + +mutable struct _n_DMSwarmCellDM end +const DMSwarmCellDM = Ptr{_n_DMSwarmCellDM} + +#mutable struct _n_AO end +#const AO = Ptr{_n_AO} + +#mutable struct _n_PF end +#const PF = Ptr{_n_PF} + +mutable struct _n_moab_Tag end +const moab_Tag = Ptr{_n_moab_Tag} + +mutable struct _n_moab_Range end +const moab_Range = Ptr{_n_moab_Range} + +mutable struct _n_moab_EntityHandle end +const moab_EntityHandle = Ptr{_n_moab_EntityHandle} + +mutable struct _n_moab_Interface end +const moab_Interface = Ptr{_n_moab_Interface} + +mutable struct _n_moab_ParallelComm end +const moab_ParallelComm = Ptr{_n_moab_ParallelComm} + +mutable struct _n_moab_EntityType end +const moab_EntityType = Ptr{_n_moab_EntityType} + +mutable struct _n_DMPlexTransform end +const DMPlexTransform = Ptr{_n_DMPlexTransform} + +mutable struct _n_PetscPartitioner end +const PetscPartitioner = Ptr{_n_PetscPartitioner} + +mutable struct _n_PetscFV end +const PetscFV = Ptr{_n_PetscFV} + +mutable struct _n_PetscWeakForm end +const PetscWeakForm = Ptr{_n_PetscWeakForm} + +mutable struct _n_PetscGeom end +const PetscGeom = Ptr{_n_PetscGeom} + +mutable struct _n_PetscHMapI end +const PetscHMapI = Ptr{_n_PetscHMapI} + +mutable struct TSIFunctionFn end + +mutable struct TSI2FunctionFn end + +mutable struct TSI2JacobianFn end + +mutable struct TSRHSFunctionFn end + +mutable struct TSTransientVariableFn end + +mutable struct TSSolutionFn end + +mutable struct TSForcingFn end + +mutable struct TSIJacobianFn end + +mutable struct TSRHSJacobianFn end + +#mutable struct _n_TS end +#const TS = Ptr{_n_TS} + +mutable struct DMDATSRHSFunctionLocalFn end + +mutable struct DMDATSRHSJacobianLocalFn end + +mutable struct DMDATSIFunctionLocalFn end + +mutable struct DMDATSIJacobianLocalFn end + +# ------------------------------------------------------- +""" + DMCopyDMKSP(petsclib::PetscLibType,dmsrc::PetscDM, dmdest::PetscDM) +copies a `DM` `DMKSP` context to a new `DM` + +Logically Collective + +Input Parameters: +- `dmsrc` - `DM` to obtain context from +- `dmdest` - `DM` to add context to + +Level: developer + +-seealso: [](ch_ksp), `DMKSP`, `DM`, `KSP`, `DMGetDMKSP()`, `KSPSetDM()` + +# External Links +$(_doc_external("Ksp/DMCopyDMKSP")) +""" +function DMCopyDMKSP(petsclib::PetscLibType, dmsrc::PetscDM, dmdest::PetscDM) end + +@for_petsc function DMCopyDMKSP(petsclib::$UnionPetscLib, dmsrc::PetscDM, dmdest::PetscDM ) + + @chk ccall( + (:DMCopyDMKSP, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dmsrc, dmdest, + ) + + + return nothing +end + +""" + DMKSPSetComputeOperators(petsclib::PetscLibType,dm::PetscDM, func::KSPComputeOperatorsFn, ctx::Cvoid) +set `KSP` matrix evaluation function + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `KSP` +- `func` - matrix evaluation function, for calling sequence see `KSPComputeOperatorsFn` +- `ctx` - context for matrix evaluation + +Level: developer + +-seealso: [](ch_ksp), `DMKSP`, `DM`, `KSP`, `DMKSPSetContext()`, `DMKSPGetComputeOperators()`, `KSPSetOperators()`, `KSPComputeOperatorsFn` + +# External Links +$(_doc_external("Ksp/DMKSPSetComputeOperators")) +""" +function DMKSPSetComputeOperators(petsclib::PetscLibType, dm::PetscDM, func::KSPComputeOperatorsFn, ctx::Cvoid) end + +@for_petsc function DMKSPSetComputeOperators(petsclib::$UnionPetscLib, dm::PetscDM, func::KSPComputeOperatorsFn, ctx::Cvoid ) + + @chk ccall( + (:DMKSPSetComputeOperators, $petsc_library), + PetscErrorCode, + (CDM, Ptr{KSPComputeOperatorsFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMKSPGetComputeOperators(petsclib::PetscLibType,dm::PetscDM, func::KSPComputeOperatorsFn, ctx::Cvoid) +get `KSP` matrix evaluation function + +Not Collective + +Input Parameter: +- `dm` - `DM` used with a `KSP` + +Output Parameters: +- `func` - matrix evaluation function, for calling sequence see `KSPComputeOperatorsFn` +- `ctx` - context for matrix evaluation + +Level: developer + +-seealso: [](ch_ksp), `DMKSP`, `DM`, `KSP`, `DMKSPSetContext()`, `KSPSetComputeOperators()`, `DMKSPSetComputeOperators()`, `KSPComputeOperatorsFn` + +# External Links +$(_doc_external("Ksp/DMKSPGetComputeOperators")) +""" +function DMKSPGetComputeOperators(petsclib::PetscLibType, dm::PetscDM, func::KSPComputeOperatorsFn, ctx::Cvoid) end + +@for_petsc function DMKSPGetComputeOperators(petsclib::$UnionPetscLib, dm::PetscDM, func::KSPComputeOperatorsFn, ctx::Cvoid ) + + @chk ccall( + (:DMKSPGetComputeOperators, $petsc_library), + PetscErrorCode, + (CDM, KSPComputeOperatorsFn, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMKSPSetComputeRHS(petsclib::PetscLibType,dm::PetscDM, func::KSPComputeRHSFn, ctx::Cvoid) +set `KSP` right + +Not Collective + +Input Parameters: +- `dm` - `DM` used with a `KSP` +- `func` - right-hand side evaluation function, for calling sequence see `KSPComputeRHSFn` +- `ctx` - context for right-hand side evaluation + +Level: developer + +-seealso: [](ch_ksp), `DMKSP`, `DM`, `KSP`, `DMKSPSetContext()`, `DMKSPGetComputeRHS()` + +# External Links +$(_doc_external("Ksp/DMKSPSetComputeRHS")) +""" +function DMKSPSetComputeRHS(petsclib::PetscLibType, dm::PetscDM, func::KSPComputeRHSFn, ctx::Cvoid) end + +@for_petsc function DMKSPSetComputeRHS(petsclib::$UnionPetscLib, dm::PetscDM, func::KSPComputeRHSFn, ctx::Cvoid ) + + @chk ccall( + (:DMKSPSetComputeRHS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{KSPComputeRHSFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMKSPSetComputeInitialGuess(petsclib::PetscLibType,dm::PetscDM, func::KSPComputeInitialGuessFn, ctx::Cvoid) +set `KSP` initial guess evaluation function + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `KSP` +- `func` - initial guess evaluation function, for calling sequence see `KSPComputeInitialGuessFn` +- `ctx` - context for initial guess evaluation + +Level: developer + +-seealso: [](ch_ksp), `DMKSP`, `DM`, `KSP`, `DMKSPSetContext()`, `DMKSPGetComputeRHS()`, `KSPComputeInitialGuessFn` + +# External Links +$(_doc_external("Ksp/DMKSPSetComputeInitialGuess")) +""" +function DMKSPSetComputeInitialGuess(petsclib::PetscLibType, dm::PetscDM, func::KSPComputeInitialGuessFn, ctx::Cvoid) end + +@for_petsc function DMKSPSetComputeInitialGuess(petsclib::$UnionPetscLib, dm::PetscDM, func::KSPComputeInitialGuessFn, ctx::Cvoid ) + + @chk ccall( + (:DMKSPSetComputeInitialGuess, $petsc_library), + PetscErrorCode, + (CDM, Ptr{KSPComputeInitialGuessFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMKSPGetComputeRHS(petsclib::PetscLibType,dm::PetscDM, func::KSPComputeRHSFn, ctx::Cvoid) +get `KSP` right + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `KSP` + +Output Parameters: +- `func` - right-hand side evaluation function, for calling sequence see `KSPComputeRHSFn` +- `ctx` - context for right-hand side evaluation + +Level: advanced + +-seealso: [](ch_ksp), `DMKSP`, `DM`, `KSP`, `DMKSPSetContext()`, `KSPSetComputeRHS()`, `DMKSPSetComputeRHS()`, `KSPComputeRHSFn` + +# External Links +$(_doc_external("Ksp/DMKSPGetComputeRHS")) +""" +function DMKSPGetComputeRHS(petsclib::PetscLibType, dm::PetscDM, func::KSPComputeRHSFn, ctx::Cvoid) end + +@for_petsc function DMKSPGetComputeRHS(petsclib::$UnionPetscLib, dm::PetscDM, func::KSPComputeRHSFn, ctx::Cvoid ) + + @chk ccall( + (:DMKSPGetComputeRHS, $petsc_library), + PetscErrorCode, + (CDM, KSPComputeRHSFn, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMKSPGetComputeInitialGuess(petsclib::PetscLibType,dm::PetscDM, func::KSPComputeInitialGuessFn, ctx::Cvoid) +get `KSP` initial guess evaluation function + +Not Collective + +Input Parameter: +- `dm` - `DM` used with a `KSP` + +Output Parameters: +- `func` - initial guess evaluation function, for calling sequence see `KSPComputeInitialGuessFn` +- `ctx` - context for right-hand side evaluation + +Level: advanced + +-seealso: [](ch_ksp), `DMKSP`, `DM`, `KSP`, `DMKSPSetContext()`, `KSPSetComputeRHS()`, `DMKSPSetComputeRHS()`, `KSPComputeInitialGuessFn` + +# External Links +$(_doc_external("Ksp/DMKSPGetComputeInitialGuess")) +""" +function DMKSPGetComputeInitialGuess(petsclib::PetscLibType, dm::PetscDM, func::KSPComputeInitialGuessFn, ctx::Cvoid) end + +@for_petsc function DMKSPGetComputeInitialGuess(petsclib::$UnionPetscLib, dm::PetscDM, func::KSPComputeInitialGuessFn, ctx::Cvoid ) + + @chk ccall( + (:DMKSPGetComputeInitialGuess, $petsc_library), + PetscErrorCode, + (CDM, KSPComputeInitialGuessFn, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMGlobalToLocalSolve(petsclib::PetscLibType,dm::PetscDM, x::PetscVec, y::PetscVec) +Solve for the global vector that is mapped to a given local vector by `DMGlobalToLocalBegin()`/`DMGlobalToLocalEnd()` with mode +`INSERT_VALUES`. + +Collective + +Input Parameters: +- `dm` - The `DM` object +- `x` - The local vector +- `y` - The global vector: the input value of this variable is used as an initial guess + +Output Parameter: +- `y` - The least-squares solution + +Level: advanced + +Note: +It is assumed that the sum of all the local vector sizes is greater than or equal to the global vector size, so the solution is +a least-squares solution. It is also assumed that `DMLocalToGlobalBegin()`/`DMLocalToGlobalEnd()` with mode `ADD_VALUES` is the adjoint of the +global-to-local map, so that the least-squares solution may be found by the normal equations. + +If the `DM` is of type `DMPLEX`, then `y` is the solution of L^T * D * L * y = L^T * D * x , where D is a diagonal mask that is 1 for every point in +the union of the closures of the local cells and 0 otherwise. This difference is only relevant if there are anchor points that are not in the +closure of any local cell (see `DMPlexGetAnchors()`/`DMPlexSetAnchors()`). + +What is L? + +If this solves for a global vector from a local vector why is not called `DMLocalToGlobalSolve()`? + +See also: +=== +`DM`, `DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMLocalToGlobalEnd()`, `DMPlexGetAnchors()`, `DMPlexSetAnchors()` + +# External Links +$(_doc_external("DM/DMGlobalToLocalSolve")) +""" +function DMGlobalToLocalSolve(petsclib::PetscLibType, dm::PetscDM, x::PetscVec, y::PetscVec) end + +@for_petsc function DMGlobalToLocalSolve(petsclib::$UnionPetscLib, dm::PetscDM, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:DMGlobalToLocalSolve, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec), + dm, x, y, + ) + + + return nothing +end + +""" + DMProjectField(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, U::PetscVec, funcs::PetscPoCintFn, mode::InsertMode, X::PetscVec) +This projects a given function of the input fields into the function space provided by a `DM`, putting the coefficients in a global vector. + +Collective + +Input Parameters: +- `dm` - The `DM` +- `time` - The time +- `U` - The input field vector +- `funcs` - The functions to evaluate, one per field, see `PetscPointFn` +- `mode` - The insertion mode for values + +Output Parameter: +- `X` - The output vector + +Level: advanced + +Note: +There are three different `DM`s that potentially interact in this function. The output `dm`, specifies the layout of the values calculates by the function. +The input `DM`, attached to `U`, may be different. For example, you can input the solution over the full domain, but output over a piece of the boundary, or +a subdomain. You can also output a different number of fields than the input, with different discretizations. Last the auxiliary `DM`, attached to the +auxiliary field vector, which is attached to `dm`, can also be different. It can have a different topology, number of fields, and discretizations. + +See also: +=== +`DM`, `PetscPointFn`, `DMProjectFieldLocal()`, `DMProjectFieldLabelLocal()`, `DMProjectFunction()`, `DMComputeL2Diff()` + +# External Links +$(_doc_external("DM/DMProjectField")) +""" +function DMProjectField(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, U::PetscVec, funcs::PetscPoCintFn, mode::InsertMode, X::PetscVec) end + +@for_petsc function DMProjectField(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, U::PetscVec, funcs::PetscPoCintFn, mode::InsertMode, X::PetscVec ) + + @chk ccall( + (:DMProjectField, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, PetscPoCintFn, InsertMode, CVec), + dm, time, U, funcs, mode, X, + ) + + + return nothing +end + +""" + DMAdaptInterpolator(petsclib::PetscLibType,dmc::PetscDM, dmf::PetscDM, In::PetscMat, smoother::PetscKSP, MF::PetscMat, MC::PetscMat, InAdapt::PetscMat, user::Cvoid) + +# External Links +$(_doc_external("DM/DMAdaptInterpolator")) +""" +function DMAdaptInterpolator(petsclib::PetscLibType, dmc::PetscDM, dmf::PetscDM, In::PetscMat, smoother::PetscKSP, MF::PetscMat, MC::PetscMat, InAdapt::PetscMat, user::Cvoid) end + +@for_petsc function DMAdaptInterpolator(petsclib::$UnionPetscLib, dmc::PetscDM, dmf::PetscDM, In::PetscMat, smoother::PetscKSP, MF::PetscMat, MC::PetscMat, InAdapt::PetscMat, user::Cvoid ) + InAdapt_ = Ref(InAdapt.ptr) + + @chk ccall( + (:DMAdaptInterpolator, $petsc_library), + PetscErrorCode, + (CDM, CDM, CMat, CKSP, CMat, CMat, Ptr{CMat}, Ptr{Cvoid}), + dmc, dmf, In, smoother, MF, MC, InAdapt_, user, + ) + + InAdapt.ptr = InAdapt_[] + + return nothing +end + +""" + DMCheckInterpolator(petsclib::PetscLibType,dmf::PetscDM, In::PetscMat, MC::PetscMat, MF::PetscMat, tol::PetscReal) + +# External Links +$(_doc_external("DM/DMCheckInterpolator")) +""" +function DMCheckInterpolator(petsclib::PetscLibType, dmf::PetscDM, In::PetscMat, MC::PetscMat, MF::PetscMat, tol::PetscReal) end + +@for_petsc function DMCheckInterpolator(petsclib::$UnionPetscLib, dmf::PetscDM, In::PetscMat, MC::PetscMat, MF::PetscMat, tol::$PetscReal ) + + @chk ccall( + (:DMCheckInterpolator, $petsc_library), + PetscErrorCode, + (CDM, CMat, CMat, CMat, $PetscReal), + dmf, In, MC, MF, tol, + ) + + + return nothing +end + +""" + DMSwarmProjectFields(petsclib::PetscLibType,sw::PetscDM, dm::PetscDM, nfields::PetscInt, fieldnames::String, fields::Vector{PetscVec}, mode::ScatterMode) +Project a set of swarm fields onto another `DM` + +Collective + +Input Parameters: +- `sw` - the `DMSWARM` +- `dm` - the `DM`, or `NULL` to use the cell `DM` +- `nfields` - the number of swarm fields to project +- `fieldnames` - the textual names of the swarm fields to project +- `fields` - an array of `Vec`'s of length nfields +- `mode` - if `SCATTER_FORWARD` then map particles to the continuum, and if `SCATTER_REVERSE` map the continuum to particles + +Level: beginner + +See also: +=== +`DMSWARM`, `DMSwarmSetType()`, `DMSwarmSetCellDM()`, `DMSwarmType` + +# External Links +$(_doc_external("DMSwarm/DMSwarmProjectFields")) +""" +function DMSwarmProjectFields(petsclib::PetscLibType, sw::PetscDM, dm::PetscDM, nfields::PetscInt, fieldnames::String, fields::Vector{PetscVec}, mode::ScatterMode) end + +@for_petsc function DMSwarmProjectFields(petsclib::$UnionPetscLib, sw::PetscDM, dm::PetscDM, nfields::$PetscInt, fieldnames::String, fields::Vector{PetscVec}, mode::ScatterMode ) + fieldnames_ = Ref(pointer(fieldnames)) + + @chk ccall( + (:DMSwarmProjectFields, $petsc_library), + PetscErrorCode, + (CDM, CDM, $PetscInt, Ptr{Ptr{Cchar}}, Ptr{CVec}, ScatterMode), + sw, dm, nfields, fieldnames_, fields, mode, + ) + + + return nothing +end + +""" + DMSwarmProjectGradientFields(petsclib::PetscLibType,sw::PetscDM, dm::PetscDM, nfields::PetscInt, fieldnames::String, fields::Vector{PetscVec}, mode::ScatterMode) + +# External Links +$(_doc_external("DMSwarm/DMSwarmProjectGradientFields")) +""" +function DMSwarmProjectGradientFields(petsclib::PetscLibType, sw::PetscDM, dm::PetscDM, nfields::PetscInt, fieldnames::String, fields::Vector{PetscVec}, mode::ScatterMode) end + +@for_petsc function DMSwarmProjectGradientFields(petsclib::$UnionPetscLib, sw::PetscDM, dm::PetscDM, nfields::$PetscInt, fieldnames::String, fields::Vector{PetscVec}, mode::ScatterMode ) + fieldnames_ = Ref(pointer(fieldnames)) + + @chk ccall( + (:DMSwarmProjectGradientFields, $petsc_library), + PetscErrorCode, + (CDM, CDM, $PetscInt, Ptr{Ptr{Cchar}}, Ptr{CVec}, ScatterMode), + sw, dm, nfields, fieldnames_, fields, mode, + ) + + + return nothing +end + +""" + DMSwarmRemap(petsclib::PetscLibType,sw::PetscDM) +Project the swarm fields onto a new set of particles + +Collective + +Input Parameter: +- `sw` - The `DMSWARM` object + +Level: beginner + +See also: +=== +`DMSWARM`, `DMSwarmMigrate()`, `DMSwarmCrate()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmRemap")) +""" +function DMSwarmRemap(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmRemap(petsclib::$UnionPetscLib, sw::PetscDM ) + + @chk ccall( + (:DMSwarmRemap, $petsc_library), + PetscErrorCode, + (CDM,), + sw, + ) + + + return nothing +end + +""" + DMSetVI(petsclib::PetscLibType,dm::PetscDM, inactive::IS) +Marks a `DM` as associated with a VI problem. This causes the interpolation/restriction operators to +be restricted to only those variables NOT associated with active constraints. + +Logically Collective + +Input Parameters: +- `dm` - the `DM` object +- `inactive` - an `IS` indicating which points are currently not active + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESVINEWTONRSLS`, `SNESVIGetInactiveSet()` + +# External Links +$(_doc_external("Snes/DMSetVI")) +""" +function DMSetVI(petsclib::PetscLibType, dm::PetscDM, inactive::IS) end + +@for_petsc function DMSetVI(petsclib::$UnionPetscLib, dm::PetscDM, inactive::IS ) + + @chk ccall( + (:DMSetVI, $petsc_library), + PetscErrorCode, + (CDM, CIS), + dm, inactive, + ) + + + return nothing +end + +""" + DMDestroyVI(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("Snes/DMDestroyVI")) +""" +function DMDestroyVI(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMDestroyVI(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMDestroyVI, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMCopyDMSNES(petsclib::PetscLibType,dmsrc::PetscDM, dmdest::PetscDM) +copies a `DMSNES` context to a new `DM` + +Logically Collective + +Input Parameters: +- `dmsrc` - `DM` to obtain context from +- `dmdest` - `DM` to add context to + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMGetDMSNES()`, `SNESSetDM()` + +# External Links +$(_doc_external("Snes/DMCopyDMSNES")) +""" +function DMCopyDMSNES(petsclib::PetscLibType, dmsrc::PetscDM, dmdest::PetscDM) end + +@for_petsc function DMCopyDMSNES(petsclib::$UnionPetscLib, dmsrc::PetscDM, dmdest::PetscDM ) + + @chk ccall( + (:DMCopyDMSNES, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dmsrc, dmdest, + ) + + + return nothing +end + +""" + DMSNESSetFunction(petsclib::PetscLibType,dm::PetscDM, f::SNESFunctionFn, ctx::Cvoid) +set `SNES` residual evaluation function + +Not Collective + +Input Parameters: +- `dm` - DM to be used with `SNES` +- `f` - residual evaluation function; see `SNESFunctionFn` for calling sequence +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetContext()`, `SNESSetFunction()`, `DMSNESSetJacobian()`, `SNESFunctionFn` + +# External Links +$(_doc_external("Snes/DMSNESSetFunction")) +""" +function DMSNESSetFunction(petsclib::PetscLibType, dm::PetscDM, f::SNESFunctionFn, ctx::Cvoid) end + +@for_petsc function DMSNESSetFunction(petsclib::$UnionPetscLib, dm::PetscDM, f::SNESFunctionFn, ctx::Cvoid ) + + @chk ccall( + (:DMSNESSetFunction, $petsc_library), + PetscErrorCode, + (CDM, Ptr{SNESFunctionFn}, Ptr{Cvoid}), + dm, f, ctx, + ) + + + return nothing +end + +""" + DMSNESSetFunctionContextDestroy(petsclib::PetscLibType,dm::PetscDM, f::PetscCtxDestroyFn) +set `SNES` residual evaluation context destroy function + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `SNES` +- `f` - residual evaluation context destroy function, see `PetscCtxDestroyFn` for its calling sequence + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetFunction()`, `SNESSetFunction()`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("Snes/DMSNESSetFunctionContextDestroy")) +""" +function DMSNESSetFunctionContextDestroy(petsclib::PetscLibType, dm::PetscDM, f::PetscCtxDestroyFn) end + +@for_petsc function DMSNESSetFunctionContextDestroy(petsclib::$UnionPetscLib, dm::PetscDM, f::PetscCtxDestroyFn ) + + @chk ccall( + (:DMSNESSetFunctionContextDestroy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscCtxDestroyFn}), + dm, f, + ) + + + return nothing +end + +""" + DMSNESSetMFFunction(petsclib::PetscLibType,dm::PetscDM, func::SNESFunctionFn, ctx::Cvoid) +set `SNES` residual evaluation function used in applying the matrix + +Logically Collective + +Input Parameters: +- `dm` - `DM` to be used with `SNES` +- `func` - residual evaluation function; see `SNESFunctionFn` for calling sequence +- `ctx` - optional function context + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetContext()`, `SNESSetFunction()`, `DMSNESSetJacobian()`, `DMSNESSetFunction()`, `SNESFunctionFn` + +# External Links +$(_doc_external("Snes/DMSNESSetMFFunction")) +""" +function DMSNESSetMFFunction(petsclib::PetscLibType, dm::PetscDM, func::SNESFunctionFn, ctx::Cvoid) end + +@for_petsc function DMSNESSetMFFunction(petsclib::$UnionPetscLib, dm::PetscDM, func::SNESFunctionFn, ctx::Cvoid ) + + @chk ccall( + (:DMSNESSetMFFunction, $petsc_library), + PetscErrorCode, + (CDM, Ptr{SNESFunctionFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMSNESGetFunction(petsclib::PetscLibType,dm::PetscDM, f::SNESFunctionFn, ctx::Cvoid) +get `SNES` residual evaluation function from a `DMSNES` object + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `SNES` + +Output Parameters: +- `f` - residual evaluation function; see `SNESFunctionFn` for calling sequence +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetContext()`, `DMSNESSetFunction()`, `SNESSetFunction()`, `SNESFunctionFn` + +# External Links +$(_doc_external("Snes/DMSNESGetFunction")) +""" +function DMSNESGetFunction(petsclib::PetscLibType, dm::PetscDM, f::SNESFunctionFn, ctx::Cvoid) end + +@for_petsc function DMSNESGetFunction(petsclib::$UnionPetscLib, dm::PetscDM, f::SNESFunctionFn, ctx::Cvoid ) + + @chk ccall( + (:DMSNESGetFunction, $petsc_library), + PetscErrorCode, + (CDM, SNESFunctionFn, Cvoid), + dm, f, ctx, + ) + + + return nothing +end + +""" + DMSNESSetObjective(petsclib::PetscLibType,dm::PetscDM, obj::SNESObjectiveFn, ctx::Cvoid) +Sets the objective function minimized by some of the `SNES` linesearch methods into a `DMSNES` object, used instead of the 2 + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `SNES` +- `obj` - objective evaluation routine; see `SNESObjectiveFn` for the calling sequence +- `ctx` - [optional] user-defined context for private data for the objective evaluation routine (may be `NULL`) + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetContext()`, `SNESGetObjective()`, `DMSNESSetFunction()`, `SNESObjectiveFn` + +# External Links +$(_doc_external("Snes/DMSNESSetObjective")) +""" +function DMSNESSetObjective(petsclib::PetscLibType, dm::PetscDM, obj::SNESObjectiveFn, ctx::Cvoid) end + +@for_petsc function DMSNESSetObjective(petsclib::$UnionPetscLib, dm::PetscDM, obj::SNESObjectiveFn, ctx::Cvoid ) + + @chk ccall( + (:DMSNESSetObjective, $petsc_library), + PetscErrorCode, + (CDM, Ptr{SNESObjectiveFn}, Ptr{Cvoid}), + dm, obj, ctx, + ) + + + return nothing +end + +""" + DMSNESGetObjective(petsclib::PetscLibType,dm::PetscDM, obj::SNESObjectiveFn, ctx::Cvoid) +Returns the objective function set with `DMSNESSetObjective()` + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `SNES` + +Output Parameters: +- `obj` - objective evaluation routine (or `NULL`); see `SNESObjectiveFn` for the calling sequence +- `ctx` - the function context (or `NULL`) + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetContext()`, `DMSNESSetObjective()`, `SNESSetFunction()`, `SNESObjectiveFn` + +# External Links +$(_doc_external("Snes/DMSNESGetObjective")) +""" +function DMSNESGetObjective(petsclib::PetscLibType, dm::PetscDM, obj::SNESObjectiveFn, ctx::Cvoid) end + +@for_petsc function DMSNESGetObjective(petsclib::$UnionPetscLib, dm::PetscDM, obj::SNESObjectiveFn, ctx::Cvoid ) + + @chk ccall( + (:DMSNESGetObjective, $petsc_library), + PetscErrorCode, + (CDM, SNESObjectiveFn, Cvoid), + dm, obj, ctx, + ) + + + return nothing +end + +""" + DMSNESSetNGS(petsclib::PetscLibType,dm::PetscDM, f::external, ctx::Cvoid) +set `SNES` Gauss + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `SNES` +- `f` - relaxation function, see `SNESGSFunction` +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetContext()`, `SNESSetFunction()`, `DMSNESSetJacobian()`, `DMSNESSetFunction()`, `SNESGSFunction` + +# External Links +$(_doc_external("Snes/DMSNESSetNGS")) +""" +function DMSNESSetNGS(petsclib::PetscLibType, dm::PetscDM, f::external, ctx::Cvoid) end + +@for_petsc function DMSNESSetNGS(petsclib::$UnionPetscLib, dm::PetscDM, f::external, ctx::Cvoid ) + + @chk ccall( + (:DMSNESSetNGS, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, f, ctx, + ) + + + return nothing +end + +""" + DMSNESSetJacobian(petsclib::PetscLibType,dm::PetscDM, J::SNESJacobianFn, ctx::Cvoid) +set `SNES` Jacobian evaluation function into a `DMSNES` object + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `SNES` +- `J` - Jacobian evaluation function, see `SNESJacobianFn` +- `ctx` - context for Jacobian evaluation + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetContext()`, `SNESSetFunction()`, `DMSNESGetJacobian()`, `SNESSetJacobian()`, `SNESJacobianFn` + +# External Links +$(_doc_external("Snes/DMSNESSetJacobian")) +""" +function DMSNESSetJacobian(petsclib::PetscLibType, dm::PetscDM, J::SNESJacobianFn, ctx::Cvoid) end + +@for_petsc function DMSNESSetJacobian(petsclib::$UnionPetscLib, dm::PetscDM, J::SNESJacobianFn, ctx::Cvoid ) + + @chk ccall( + (:DMSNESSetJacobian, $petsc_library), + PetscErrorCode, + (CDM, Ptr{SNESJacobianFn}, Ptr{Cvoid}), + dm, J, ctx, + ) + + + return nothing +end + +""" + DMSNESSetJacobianContextDestroy(petsclib::PetscLibType,dm::PetscDM, f::PetscCtxDestroyFn) +set `SNES` Jacobian evaluation context destroy function into a `DMSNES` object + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `SNES` +- `f` - Jacobian evaluation context destroy function, see `PetscCtxDestroyFn` for its calling sequence + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetJacobian()` + +# External Links +$(_doc_external("Snes/DMSNESSetJacobianContextDestroy")) +""" +function DMSNESSetJacobianContextDestroy(petsclib::PetscLibType, dm::PetscDM, f::PetscCtxDestroyFn) end + +@for_petsc function DMSNESSetJacobianContextDestroy(petsclib::$UnionPetscLib, dm::PetscDM, f::PetscCtxDestroyFn ) + + @chk ccall( + (:DMSNESSetJacobianContextDestroy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscCtxDestroyFn}), + dm, f, + ) + + + return nothing +end + +""" + DMSNESGetJacobian(petsclib::PetscLibType,dm::PetscDM, J::SNESJacobianFn, ctx::Cvoid) +get `SNES` Jacobian evaluation function from a `DMSNES` object + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `SNES` + +Output Parameters: +- `J` - Jacobian evaluation function; for all calling sequence see `SNESJacobianFn` +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetContext()`, `SNESSetFunction()`, `DMSNESSetJacobian()`, `SNESJacobianFn` + +# External Links +$(_doc_external("Snes/DMSNESGetJacobian")) +""" +function DMSNESGetJacobian(petsclib::PetscLibType, dm::PetscDM, J::SNESJacobianFn, ctx::Cvoid) end + +@for_petsc function DMSNESGetJacobian(petsclib::$UnionPetscLib, dm::PetscDM, J::SNESJacobianFn, ctx::Cvoid ) + + @chk ccall( + (:DMSNESGetJacobian, $petsc_library), + PetscErrorCode, + (CDM, SNESJacobianFn, Cvoid), + dm, J, ctx, + ) + + + return nothing +end + +""" + DMSNESSetPicard(petsclib::PetscLibType,dm::PetscDM, b::SNESFunctionFn, J::SNESJacobianFn, ctx::Cvoid) +set SNES Picard iteration matrix and RHS evaluation functions into a `DMSNES` object + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `SNES` +- `b` - RHS evaluation function; see `SNESFunctionFn` for calling sequence +- `J` - Picard matrix evaluation function; see `SNESJacobianFn` for calling sequence +- `ctx` - context for residual and matrix evaluation + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `SNESSetPicard()`, `DMSNESSetFunction()`, `DMSNESSetJacobian()`, `SNESFunctionFn`, `SNESJacobianFn` + +# External Links +$(_doc_external("Snes/DMSNESSetPicard")) +""" +function DMSNESSetPicard(petsclib::PetscLibType, dm::PetscDM, b::SNESFunctionFn, J::SNESJacobianFn, ctx::Cvoid) end + +@for_petsc function DMSNESSetPicard(petsclib::$UnionPetscLib, dm::PetscDM, b::SNESFunctionFn, J::SNESJacobianFn, ctx::Cvoid ) + + @chk ccall( + (:DMSNESSetPicard, $petsc_library), + PetscErrorCode, + (CDM, Ptr{SNESFunctionFn}, Ptr{SNESJacobianFn}, Ptr{Cvoid}), + dm, b, J, ctx, + ) + + + return nothing +end + +""" + DMSNESGetPicard(petsclib::PetscLibType,dm::PetscDM, b::SNESFunctionFn, J::SNESJacobianFn, ctx::Cvoid) +get `SNES` Picard iteration evaluation functions from a `DMSNES` object + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `SNES` + +Output Parameters: +- `b` - RHS evaluation function; see `SNESFunctionFn` for calling sequence +- `J` - Jacobian evaluation function; see `SNESJacobianFn` for calling sequence +- `ctx` - context for residual and matrix evaluation + +Level: developer + +-seealso: [](ch_snes), `DMSNES`, `DMSNESSetContext()`, `SNESSetFunction()`, `DMSNESSetJacobian()`, `SNESFunctionFn`, `SNESJacobianFn` + +# External Links +$(_doc_external("Snes/DMSNESGetPicard")) +""" +function DMSNESGetPicard(petsclib::PetscLibType, dm::PetscDM, b::SNESFunctionFn, J::SNESJacobianFn, ctx::Cvoid) end + +@for_petsc function DMSNESGetPicard(petsclib::$UnionPetscLib, dm::PetscDM, b::SNESFunctionFn, J::SNESJacobianFn, ctx::Cvoid ) + + @chk ccall( + (:DMSNESGetPicard, $petsc_library), + PetscErrorCode, + (CDM, SNESFunctionFn, SNESJacobianFn, Cvoid), + dm, b, J, ctx, + ) + + + return nothing +end + +""" + DMSNESSetObjectiveLocal(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a local objective evaluation function. This function is called with local vector +containing the local vector information PLUS ghost point information. It should compute a result for all local +elements and `DMSNES` will automatically accumulate the overlapping values. + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local objective evaluation +- `ctx` - optional context for local residual evaluation + +Level: advanced + +-seealso: `DMSNESSetFunctionLocal()`, `DMSNESSetJacobianLocal()` + +# External Links +$(_doc_external("Snes/DMSNESSetObjectiveLocal")) +""" +function DMSNESSetObjectiveLocal(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMSNESSetObjectiveLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMSNESSetObjectiveLocal, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMSNESSetFunctionLocal(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a local residual evaluation function. This function is called with local vector +containing the local vector information PLUS ghost point information. It should compute a result for all local +elements and `DMSNES` will automatically accumulate the overlapping values. + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local residual evaluation +- `ctx` - optional context for local residual evaluation + +Calling sequence of `func`: +- `dm` - `DM` for the function +- `x` - vector to state at which to evaluate residual +- `f` - vector to hold the function evaluation +- `ctx` - optional context passed above + +Level: advanced + +-seealso: [](ch_snes), `DMSNESSetFunction()`, `DMSNESSetJacobianLocal()` + +# External Links +$(_doc_external("Snes/DMSNESSetFunctionLocal")) +""" +function DMSNESSetFunctionLocal(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMSNESSetFunctionLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMSNESSetFunctionLocal, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMSNESSetBoundaryLocal(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a function to insert, for example, essential boundary conditions into a ghosted solution vector + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local boundary value evaluation +- `ctx` - optional context for local boundary value evaluation + +Calling sequence of `func`: +- `dm` - the `DM` context +- `X` - ghosted solution vector, appropriate locations (such as essential boundary condition nodes) should be filled +- `ctx` - option context passed in `DMSNESSetBoundaryLocal()` + +Level: advanced + +-seealso: [](ch_snes), `DMSNESSetObjectiveLocal()`, `DMSNESSetFunctionLocal()`, `DMSNESSetJacobianLocal()` + +# External Links +$(_doc_external("Snes/DMSNESSetBoundaryLocal")) +""" +function DMSNESSetBoundaryLocal(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMSNESSetBoundaryLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMSNESSetBoundaryLocal, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMSNESSetJacobianLocal(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a local Jacobian evaluation function + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local Jacobian evaluation +- `ctx` - optional context for local Jacobian evaluation + +Calling sequence of `func`: +- `dm` - the `DM` context +- `X` - current solution vector (ghosted or not?) +- `J` - the Jacobian +- `Jp` - approximate Jacobian used to compute the preconditioner, often `J` +- `ctx` - a user provided context + +Level: advanced + +-seealso: [](ch_snes), `DMSNESSetObjectiveLocal()`, `DMSNESSetFunctionLocal()`, `DMSNESSetBoundaryLocal()` + +# External Links +$(_doc_external("Snes/DMSNESSetJacobianLocal")) +""" +function DMSNESSetJacobianLocal(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMSNESSetJacobianLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMSNESSetJacobianLocal, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMDASNESSetFunctionLocal(petsclib::PetscLibType,dm::PetscDM, imode::InsertMode, func::external, ctx::Cvoid) +set a local residual evaluation function for use with `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `imode` - `INSERT_VALUES` if local function computes owned part, `ADD_VALUES` if it contributes to ghosted part +- `func` - local residual evaluation +- `ctx` - optional context for local residual evaluation + +Calling sequence of `func`: +- `info` - `DMDALocalInfo` defining the subdomain to evaluate the residual on +- `x` - dimensional pointer to state at which to evaluate residual (e.g. PetscScalar *x or **x or ***x) +- `f` - dimensional pointer to residual, write the residual here (e.g. PetscScalar *f or **f or ***f) +- `ctx` - optional context passed above + +Level: beginner + +-seealso: [](ch_snes), `DMDA`, `DMDASNESSetJacobianLocal()`, `DMSNESSetFunction()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()` + +# External Links +$(_doc_external("Snes/DMDASNESSetFunctionLocal")) +""" +function DMDASNESSetFunctionLocal(petsclib::PetscLibType, dm::PetscDM, imode::InsertMode, func::external, ctx::Cvoid) end + +@for_petsc function DMDASNESSetFunctionLocal(petsclib::$UnionPetscLib, dm::PetscDM, imode::InsertMode, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMDASNESSetFunctionLocal, $petsc_library), + PetscErrorCode, + (CDM, InsertMode, external, Ptr{Cvoid}), + dm, imode, func, ctx, + ) + + + return nothing +end + +""" + DMDASNESSetFunctionLocalVec(petsclib::PetscLibType,dm::PetscDM, imode::InsertMode, func::external, ctx::Cvoid) +set a local residual evaluation function that operates on a local vector for `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `imode` - `INSERT_VALUES` if local function computes owned part, `ADD_VALUES` if it contributes to ghosted part +- `func` - local residual evaluation +- `ctx` - optional context for local residual evaluation + +Calling sequence of `func`: +- `info` - `DMDALocalInfo` defining the subdomain to evaluate the residual on +- `x` - state vector at which to evaluate residual +- `f` - residual vector +- `ctx` - optional context passed above + +Level: beginner + +-seealso: [](ch_snes), `DMDA`, `DMDASNESSetFunctionLocal()`, `DMDASNESSetJacobianLocalVec()`, `DMSNESSetFunction()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()` + +# External Links +$(_doc_external("Snes/DMDASNESSetFunctionLocalVec")) +""" +function DMDASNESSetFunctionLocalVec(petsclib::PetscLibType, dm::PetscDM, imode::InsertMode, func::external, ctx::Cvoid) end + +@for_petsc function DMDASNESSetFunctionLocalVec(petsclib::$UnionPetscLib, dm::PetscDM, imode::InsertMode, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMDASNESSetFunctionLocalVec, $petsc_library), + PetscErrorCode, + (CDM, InsertMode, external, Ptr{Cvoid}), + dm, imode, func, ctx, + ) + + + return nothing +end + +""" + DMDASNESSetJacobianLocal(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a local Jacobian evaluation function for use with `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local Jacobian evaluation function +- `ctx` - optional context for local Jacobian evaluation + +Calling sequence of `func`: +- `info` - `DMDALocalInfo` defining the subdomain to evaluate the Jacobian at +- `x` - dimensional pointer to state at which to evaluate Jacobian (e.g. PetscScalar *x or **x or ***x) +- `J` - `Mat` object for the Jacobian +- `M` - `Mat` object used to compute the preconditioner often `J` +- `ctx` - optional context passed above + +Level: beginner + +-seealso: [](ch_snes), `DMDA`, `DMDASNESSetFunctionLocal()`, `DMSNESSetJacobian()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()` + +# External Links +$(_doc_external("Snes/DMDASNESSetJacobianLocal")) +""" +function DMDASNESSetJacobianLocal(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMDASNESSetJacobianLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMDASNESSetJacobianLocal, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMDASNESSetJacobianLocalVec(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a local Jacobian evaluation function that operates on a local vector with `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local Jacobian evaluation +- `ctx` - optional context for local Jacobian evaluation + +Calling sequence of `func`: +- `info` - `DMDALocalInfo` defining the subdomain to evaluate the Jacobian at +- `x` - state vector at which to evaluate Jacobian +- `J` - the Jacobian +- `M` - approximate Jacobian from which the preconditioner will be computed, often `J` +- `ctx` - optional context passed above + +Level: beginner + +-seealso: [](ch_snes), `DMDA`, `DMDASNESSetJacobianLocal()`, `DMDASNESSetFunctionLocalVec()`, `DMSNESSetJacobian()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()` + +# External Links +$(_doc_external("Snes/DMDASNESSetJacobianLocalVec")) +""" +function DMDASNESSetJacobianLocalVec(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMDASNESSetJacobianLocalVec(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMDASNESSetJacobianLocalVec, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMDASNESSetObjectiveLocal(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a local residual evaluation function to used with a `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local objective evaluation, see `DMDASNESSetObjectiveLocal` for the calling sequence +- `ctx` - optional context for local residual evaluation + +Calling sequence of `func`: +- `info` - `DMDALocalInfo` defining the subdomain to evaluate the Jacobian at +- `x` - dimensional pointer to state at which to evaluate the objective (e.g. PetscScalar *x or **x or ***x) +- `obj` - returned objective value for the local subdomain +- `ctx` - optional context passed above + +Level: beginner + +-seealso: [](ch_snes), `DMDA`, `DMSNESSetFunction()`, `DMDASNESSetJacobianLocal()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMDASNESObjectiveFn` + +# External Links +$(_doc_external("Snes/DMDASNESSetObjectiveLocal")) +""" +function DMDASNESSetObjectiveLocal(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMDASNESSetObjectiveLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMDASNESSetObjectiveLocal, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMDASNESSetObjectiveLocalVec(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a local residual evaluation function that operates on a local vector with `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local objective evaluation, see `DMDASNESSetObjectiveLocalVec` for the calling sequence +- `ctx` - optional context for local residual evaluation + +Calling sequence of `func`: +- `info` - `DMDALocalInfo` defining the subdomain to evaluate the Jacobian at +- `x` - state vector at which to evaluate the objective +- `obj` - returned objective value for the local subdomain +- `ctx` - optional context passed above + +Level: beginner + +-seealso: [](ch_snes), `DMDA`, `DMDASNESSetObjectiveLocal()`, `DMSNESSetFunction()`, `DMDASNESSetJacobianLocalVec()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMDASNESObjectiveVecFn` + +# External Links +$(_doc_external("Snes/DMDASNESSetObjectiveLocalVec")) +""" +function DMDASNESSetObjectiveLocalVec(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMDASNESSetObjectiveLocalVec(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMDASNESSetObjectiveLocalVec, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMDASNESSetPicardLocal(petsclib::PetscLibType,dm::PetscDM, imode::InsertMode, func::external, jac::external, ctx::Cvoid) +set a local right + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `imode` - `INSERT_VALUES` if local function computes owned part, `ADD_VALUES` if it contributes to ghosted part +- `func` - local residual evaluation +- `jac` - function to compute Jacobian +- `ctx` - optional context for local residual evaluation + +Calling sequence of `func`: +- `info` - defines the subdomain to evaluate the residual on +- `x` - dimensional pointer to state at which to evaluate residual +- `f` - dimensional pointer to residual, write the residual here +- `ctx` - optional context passed above + +Calling sequence of `jac`: +- `info` - defines the subdomain to evaluate the residual on +- `x` - dimensional pointer to state at which to evaluate residual +- `jac` - the Jacobian +- `Jp` - approximation to the Jacobian used to compute the preconditioner, often `J` +- `ctx` - optional context passed above + +Level: beginner + +-seealso: [](ch_snes), `SNES`, `DMDA`, `DMSNESSetFunction()`, `DMDASNESSetJacobian()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()` + +# External Links +$(_doc_external("Snes/DMDASNESSetPicardLocal")) +""" +function DMDASNESSetPicardLocal(petsclib::PetscLibType, dm::PetscDM, imode::InsertMode, func::external, jac::external, ctx::Cvoid) end + +@for_petsc function DMDASNESSetPicardLocal(petsclib::$UnionPetscLib, dm::PetscDM, imode::InsertMode, func::external, jac::external, ctx::Cvoid ) + + @chk ccall( + (:DMDASNESSetPicardLocal, $petsc_library), + PetscErrorCode, + (CDM, InsertMode, external, external, Ptr{Cvoid}), + dm, imode, func, jac, ctx, + ) + + + return nothing +end + +""" + obj::PetscReal = DMPlexSNESComputeObjectiveFEM(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, user::Cvoid) +Sums the local objectives from the local input X using pointwise functions specified by the user + +Input Parameters: +- `dm` - The mesh +- `X` - Local solution +- `user` - The user context + +Output Parameter: +- `obj` - Local objective value + +Level: developer + +-seealso: `DM`, `DMPlexSNESComputeResidualFEM()` + +# External Links +$(_doc_external("Snes/DMPlexSNESComputeObjectiveFEM")) +""" +function DMPlexSNESComputeObjectiveFEM(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexSNESComputeObjectiveFEM(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, user::Cvoid ) + obj_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexSNESComputeObjectiveFEM, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{$PetscReal}, Ptr{Cvoid}), + dm, X, obj_, user, + ) + + obj = obj_[] + + return obj +end + +""" + DMPlexSNESComputeResidualFEM(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, F::PetscVec, user::Cvoid) +Sums the local residual into vector `F` from the local input `X` using pointwise functions specified by the user + +Input Parameters: +- `dm` - The mesh +- `X` - Local solution +- `user` - The user context + +Output Parameter: +- `F` - Local output vector + +Level: developer + +-seealso: [](ch_snes), `DM`, `DMPLEX`, `DMSNESComputeJacobianAction()` + +# External Links +$(_doc_external("Snes/DMPlexSNESComputeResidualFEM")) +""" +function DMPlexSNESComputeResidualFEM(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, F::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexSNESComputeResidualFEM(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, F::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexSNESComputeResidualFEM, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec, Ptr{Cvoid}), + dm, X, F, user, + ) + + + return nothing +end + +""" + DMPlexSNESComputeResidualDS(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, F::PetscVec, user::Cvoid) +Sums the local residual into vector `F` from the local input `X` using all pointwise functions with unique keys in the `PetscDS` + +Input Parameters: +- `dm` - The mesh +- `X` - Local solution +- `user` - The user context + +Output Parameter: +- `F` - Local output vector + +Level: developer + +-seealso: [](ch_snes), `DM`, `DMPLEX`, `DMPlexComputeJacobianAction()` + +# External Links +$(_doc_external("Snes/DMPlexSNESComputeResidualDS")) +""" +function DMPlexSNESComputeResidualDS(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, F::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexSNESComputeResidualDS(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, F::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexSNESComputeResidualDS, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec, Ptr{Cvoid}), + dm, X, F, user, + ) + + + return nothing +end + +""" + DMPlexSNESComputeBoundaryFEM(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, user::Cvoid) +Form the boundary values for the local input `X` + +Input Parameters: +- `dm` - The mesh +- `user` - The user context + +Output Parameter: +- `X` - Local solution + +Level: developer + +-seealso: [](ch_snes), `DM`, `DMPLEX`, `DMPlexComputeJacobianAction()` + +# External Links +$(_doc_external("Snes/DMPlexSNESComputeBoundaryFEM")) +""" +function DMPlexSNESComputeBoundaryFEM(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexSNESComputeBoundaryFEM(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexSNESComputeBoundaryFEM, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + dm, X, user, + ) + + + return nothing +end + +""" + DMSNESComputeJacobianAction(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, Y::PetscVec, F::PetscVec, user::Cvoid) +Compute the action of the Jacobian J(`X`) on `Y` + +Input Parameters: +- `dm` - The `DM` +- `X` - Local solution vector +- `Y` - Local input vector +- `user` - The user context + +Output Parameter: +- `F` - local output vector + +Level: developer + +-seealso: [](ch_snes), `DM`, `DMSNESCreateJacobianMF()`, `DMPlexSNESComputeResidualFEM()` + +# External Links +$(_doc_external("Snes/DMSNESComputeJacobianAction")) +""" +function DMSNESComputeJacobianAction(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, Y::PetscVec, F::PetscVec, user::Cvoid) end + +@for_petsc function DMSNESComputeJacobianAction(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, Y::PetscVec, F::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMSNESComputeJacobianAction, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec, CVec, Ptr{Cvoid}), + dm, X, Y, F, user, + ) + + + return nothing +end + +""" + DMPlexSNESComputeJacobianFEM(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid) +Form the local portion of the Jacobian matrix `Jac` at the local solution `X` using pointwise functions specified by the user. + +Input Parameters: +- `dm` - The `DM` +- `X` - Local input vector +- `user` - The user context + +Output Parameters: +- `Jac` - Jacobian matrix +- `JacP` - approximate Jacobian from which the preconditioner will be built, often `Jac` + +Level: developer + +-seealso: [](ch_snes), `DMPLEX`, `Mat` + +# External Links +$(_doc_external("Snes/DMPlexSNESComputeJacobianFEM")) +""" +function DMPlexSNESComputeJacobianFEM(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid) end + +@for_petsc function DMPlexSNESComputeJacobianFEM(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid ) + + @chk ccall( + (:DMPlexSNESComputeJacobianFEM, $petsc_library), + PetscErrorCode, + (CDM, CVec, CMat, CMat, Ptr{Cvoid}), + dm, X, Jac, JacP, user, + ) + + + return nothing +end + +""" + J::PetscMat = DMSNESCreateJacobianMF(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, user::Cvoid) +Create a `Mat` which computes the action of the Jacobian matrix + +Collective + +Input Parameters: +- `dm` - The `DM` +- `X` - The evaluation point for the Jacobian +- `user` - A user context, or `NULL` + +Output Parameter: +- `J` - The `Mat` + +Level: advanced + +-seealso: [](ch_snes), `DM`, `SNES`, `DMSNESComputeJacobianAction()` + +# External Links +$(_doc_external("Snes/DMSNESCreateJacobianMF")) +""" +function DMSNESCreateJacobianMF(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, user::Cvoid) end + +@for_petsc function DMSNESCreateJacobianMF(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, user::Cvoid ) + J_ = Ref{CMat}() + + @chk ccall( + (:DMSNESCreateJacobianMF, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}, Ptr{CMat}), + dm, X, user, J_, + ) + + J = PetscMat(J_[], petsclib) + + return J +end + +""" + DMPlexSetSNESLocalFEM(petsclib::PetscLibType,dm::PetscDM, use_obj::PetscBool, ctx::Cvoid) +Use `DMPLEX`'s internal FEM routines to compute `SNES` boundary values, objective, residual, and Jacobian. + +Input Parameters: +- `dm` - The `DM` object +- `use_obj` - Use the objective function callback +- `ctx` - The user context that will be passed to pointwise evaluation routines + +Level: developer + +-seealso: [](ch_snes),`DMPLEX`, `SNES`, `PetscDSAddBoundary()`, `PetscDSSetObjective()`, `PetscDSSetResidual()`, `PetscDSSetJacobian()` + +# External Links +$(_doc_external("Snes/DMPlexSetSNESLocalFEM")) +""" +function DMPlexSetSNESLocalFEM(petsclib::PetscLibType, dm::PetscDM, use_obj::PetscBool, ctx::Cvoid) end + +@for_petsc function DMPlexSetSNESLocalFEM(petsclib::$UnionPetscLib, dm::PetscDM, use_obj::PetscBool, ctx::Cvoid ) + + @chk ccall( + (:DMPlexSetSNESLocalFEM, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, Ptr{Cvoid}), + dm, use_obj, ctx, + ) + + + return nothing +end + +""" + error::Vector{PetscReal} = DMSNESCheckDiscretization(petsclib::PetscLibType,snes::PetscSNES, dm::PetscDM, t::PetscReal, u::PetscVec, tol::PetscReal) +Check the discretization error of the exact solution + +Input Parameters: +- `snes` - the `SNES` object +- `dm` - the `DM` +- `t` - the time +- `u` - a `DM` vector +- `tol` - A tolerance for the check, or -1 to print the results instead + +Output Parameter: +- `error` - An array which holds the discretization error in each field, or `NULL` + +Level: developer + +-seealso: [](ch_snes), `PetscDSSetExactSolution()`, `DNSNESCheckFromOptions()`, `DMSNESCheckResidual()`, `DMSNESCheckJacobian()` + +# External Links +$(_doc_external("Snes/DMSNESCheckDiscretization")) +""" +function DMSNESCheckDiscretization(petsclib::PetscLibType, snes::PetscSNES, dm::PetscDM, t::PetscReal, u::PetscVec, tol::PetscReal) end + +@for_petsc function DMSNESCheckDiscretization(petsclib::$UnionPetscLib, snes::PetscSNES, dm::PetscDM, t::$PetscReal, u::PetscVec, tol::$PetscReal ) + error = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMSNESCheckDiscretization, $petsc_library), + PetscErrorCode, + (CSNES, CDM, $PetscReal, CVec, $PetscReal, Ptr{$PetscReal}), + snes, dm, t, u, tol, error, + ) + + + return error +end + +""" + residual::PetscReal = DMSNESCheckResidual(petsclib::PetscLibType,snes::PetscSNES, dm::PetscDM, u::PetscVec, tol::PetscReal) +Check the residual of the exact solution + +Input Parameters: +- `snes` - the `SNES` object +- `dm` - the `DM` +- `u` - a `DM` vector +- `tol` - A tolerance for the check, or -1 to print the results instead + +Output Parameter: +- `residual` - The residual norm of the exact solution, or `NULL` + +Level: developer + +-seealso: [](ch_snes), `DNSNESCheckFromOptions()`, `DMSNESCheckDiscretization()`, `DMSNESCheckJacobian()` + +# External Links +$(_doc_external("Snes/DMSNESCheckResidual")) +""" +function DMSNESCheckResidual(petsclib::PetscLibType, snes::PetscSNES, dm::PetscDM, u::PetscVec, tol::PetscReal) end + +@for_petsc function DMSNESCheckResidual(petsclib::$UnionPetscLib, snes::PetscSNES, dm::PetscDM, u::PetscVec, tol::$PetscReal ) + residual_ = Ref{$PetscReal}() + + @chk ccall( + (:DMSNESCheckResidual, $petsc_library), + PetscErrorCode, + (CSNES, CDM, CVec, $PetscReal, Ptr{$PetscReal}), + snes, dm, u, tol, residual_, + ) + + residual = residual_[] + + return residual +end + +""" + isLinear::PetscBool,convRate::PetscReal = DMSNESCheckJacobian(petsclib::PetscLibType,snes::PetscSNES, dm::PetscDM, u::PetscVec, tol::PetscReal) +Check the Jacobian of the exact solution against the residual using the Taylor Test + +Input Parameters: +- `snes` - the `SNES` object +- `dm` - the `DM` +- `u` - a `DM` vector +- `tol` - A tolerance for the check, or -1 to print the results instead + +Output Parameters: +- `isLinear` - Flag indicaing that the function looks linear, or `NULL` +- `convRate` - The rate of convergence of the linear model, or `NULL` + +Level: developer + +-seealso: [](ch_snes), `DNSNESCheckFromOptions()`, `DMSNESCheckDiscretization()`, `DMSNESCheckResidual()` + +# External Links +$(_doc_external("Snes/DMSNESCheckJacobian")) +""" +function DMSNESCheckJacobian(petsclib::PetscLibType, snes::PetscSNES, dm::PetscDM, u::PetscVec, tol::PetscReal) end + +@for_petsc function DMSNESCheckJacobian(petsclib::$UnionPetscLib, snes::PetscSNES, dm::PetscDM, u::PetscVec, tol::$PetscReal ) + isLinear_ = Ref{PetscBool}() + convRate_ = Ref{$PetscReal}() + + @chk ccall( + (:DMSNESCheckJacobian, $petsc_library), + PetscErrorCode, + (CSNES, CDM, CVec, $PetscReal, Ptr{PetscBool}, Ptr{$PetscReal}), + snes, dm, u, tol, isLinear_, convRate_, + ) + + isLinear = isLinear_[] + convRate = convRate_[] + + return isLinear,convRate +end + +""" + DMSNESCheckFromOptions(petsclib::PetscLibType,snes::PetscSNES, u::PetscVec) +Check the residual and Jacobian functions using the exact solution by outputting some diagnostic information + +Input Parameters: +- `snes` - the `SNES` object +- `u` - representative `SNES` vector + +Level: developer + +-seealso: [](ch_snes), `SNES`, `DM` + +# External Links +$(_doc_external("Snes/DMSNESCheckFromOptions")) +""" +function DMSNESCheckFromOptions(petsclib::PetscLibType, snes::PetscSNES, u::PetscVec) end + +@for_petsc function DMSNESCheckFromOptions(petsclib::$UnionPetscLib, snes::PetscSNES, u::PetscVec ) + + @chk ccall( + (:DMSNESCheckFromOptions, $petsc_library), + PetscErrorCode, + (CSNES, CVec), + snes, u, + ) + + + return nothing +end + +""" + DMPlexSetSNESVariableBounds(petsclib::PetscLibType,dm::PetscDM, snes::PetscSNES) +Compute upper and lower bounds for the solution using pointsie functions from the `PetscDS` + +Collective + +Input Parameters: +- `dm` - The `DM` object +- `snes` - the `SNES` object + +Level: intermediate + +-seealso: `SNESVISetVariableBounds()`, `SNESVI`, [](ch_snes), `DM` + +# External Links +$(_doc_external("Snes/DMPlexSetSNESVariableBounds")) +""" +function DMPlexSetSNESVariableBounds(petsclib::PetscLibType, dm::PetscDM, snes::PetscSNES) end + +@for_petsc function DMPlexSetSNESVariableBounds(petsclib::$UnionPetscLib, dm::PetscDM, snes::PetscSNES ) + + @chk ccall( + (:DMPlexSetSNESVariableBounds, $petsc_library), + PetscErrorCode, + (CDM, CSNES), + dm, snes, + ) + + + return nothing +end + +""" + DMPlexSNESComputeResidualCEED(petsclib::PetscLibType,dm::PetscDM, locX::PetscVec, locF::PetscVec, user::Cvoid) + +# External Links +$(_doc_external("Snes/DMPlexSNESComputeResidualCEED")) +""" +function DMPlexSNESComputeResidualCEED(petsclib::PetscLibType, dm::PetscDM, locX::PetscVec, locF::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexSNESComputeResidualCEED(petsclib::$UnionPetscLib, dm::PetscDM, locX::PetscVec, locF::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexSNESComputeResidualCEED, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec, Ptr{Cvoid}), + dm, locX, locF, user, + ) + + + return nothing +end + +""" + ctx::DMInterpolationInfo = DMInterpolationCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a `DMInterpolationInfo` context + +Collective + +Input Parameter: +- `comm` - the communicator + +Output Parameter: +- `ctx` - the context + +Level: beginner + +Developer Note: +The naming is incorrect, either the object should be named `DMInterpolation` or all the routines should begin with `DMInterpolationInfo` + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationEvaluate()`, `DMInterpolationAddPoints()`, `DMInterpolationDestroy()` + +# External Links +$(_doc_external("DM/DMInterpolationCreate")) +""" +function DMInterpolationCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMInterpolationCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + ctx_ = Ref{DMInterpolationInfo}() + + @chk ccall( + (:DMInterpolationCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{DMInterpolationInfo}), + comm, ctx_, + ) + + ctx = ctx_[] + + return ctx +end + +""" + DMInterpolationSetDim(petsclib::PetscLibType,ctx::DMInterpolationInfo, dim::PetscInt) +Sets the spatial dimension for the interpolation context + +Not Collective + +Input Parameters: +- `ctx` - the context +- `dim` - the spatial dimension + +Level: intermediate + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationGetDim()`, `DMInterpolationEvaluate()`, `DMInterpolationAddPoints()` + +# External Links +$(_doc_external("DM/DMInterpolationSetDim")) +""" +function DMInterpolationSetDim(petsclib::PetscLibType, ctx::DMInterpolationInfo, dim::PetscInt) end + +@for_petsc function DMInterpolationSetDim(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo, dim::$PetscInt ) + + @chk ccall( + (:DMInterpolationSetDim, $petsc_library), + PetscErrorCode, + (DMInterpolationInfo, $PetscInt), + ctx, dim, + ) + + + return nothing +end + +""" + dim::PetscInt = DMInterpolationGetDim(petsclib::PetscLibType,ctx::DMInterpolationInfo) +Gets the spatial dimension for the interpolation context + +Not Collective + +Input Parameter: +- `ctx` - the context + +Output Parameter: +- `dim` - the spatial dimension + +Level: intermediate + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationSetDim()`, `DMInterpolationEvaluate()`, `DMInterpolationAddPoints()` + +# External Links +$(_doc_external("DM/DMInterpolationGetDim")) +""" +function DMInterpolationGetDim(petsclib::PetscLibType, ctx::DMInterpolationInfo) end + +@for_petsc function DMInterpolationGetDim(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:DMInterpolationGetDim, $petsc_library), + PetscErrorCode, + (DMInterpolationInfo, Ptr{$PetscInt}), + ctx, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + DMInterpolationSetDof(petsclib::PetscLibType,ctx::DMInterpolationInfo, dof::PetscInt) +Sets the number of fields interpolated at a point for the interpolation context + +Not Collective + +Input Parameters: +- `ctx` - the context +- `dof` - the number of fields + +Level: intermediate + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationGetDof()`, `DMInterpolationEvaluate()`, `DMInterpolationAddPoints()` + +# External Links +$(_doc_external("DM/DMInterpolationSetDof")) +""" +function DMInterpolationSetDof(petsclib::PetscLibType, ctx::DMInterpolationInfo, dof::PetscInt) end + +@for_petsc function DMInterpolationSetDof(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo, dof::$PetscInt ) + + @chk ccall( + (:DMInterpolationSetDof, $petsc_library), + PetscErrorCode, + (DMInterpolationInfo, $PetscInt), + ctx, dof, + ) + + + return nothing +end + +""" + dof::PetscInt = DMInterpolationGetDof(petsclib::PetscLibType,ctx::DMInterpolationInfo) +Gets the number of fields interpolated at a point for the interpolation context + +Not Collective + +Input Parameter: +- `ctx` - the context + +Output Parameter: +- `dof` - the number of fields + +Level: intermediate + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationSetDof()`, `DMInterpolationEvaluate()`, `DMInterpolationAddPoints()` + +# External Links +$(_doc_external("DM/DMInterpolationGetDof")) +""" +function DMInterpolationGetDof(petsclib::PetscLibType, ctx::DMInterpolationInfo) end + +@for_petsc function DMInterpolationGetDof(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo ) + dof_ = Ref{$PetscInt}() + + @chk ccall( + (:DMInterpolationGetDof, $petsc_library), + PetscErrorCode, + (DMInterpolationInfo, Ptr{$PetscInt}), + ctx, dof_, + ) + + dof = dof_[] + + return dof +end + +""" + DMInterpolationAddPoints(petsclib::PetscLibType,ctx::DMInterpolationInfo, n::PetscInt, points::Vector{PetscReal}) +Add points at which we will interpolate the fields + +Not Collective + +Input Parameters: +- `ctx` - the context +- `n` - the number of points +- `points` - the coordinates for each point, an array of size `n` * dim + +Level: intermediate + +Note: +The input coordinate information is copied into the object. + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationSetDim()`, `DMInterpolationEvaluate()`, `DMInterpolationCreate()` + +# External Links +$(_doc_external("DM/DMInterpolationAddPoints")) +""" +function DMInterpolationAddPoints(petsclib::PetscLibType, ctx::DMInterpolationInfo, n::PetscInt, points::Vector{PetscReal}) end + +@for_petsc function DMInterpolationAddPoints(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo, n::$PetscInt, points::Vector{$PetscReal} ) + + @chk ccall( + (:DMInterpolationAddPoints, $petsc_library), + PetscErrorCode, + (DMInterpolationInfo, $PetscInt, Ptr{$PetscReal}), + ctx, n, points, + ) + + + return nothing +end + +""" + DMInterpolationSetUp(petsclib::PetscLibType,ctx::DMInterpolationInfo, dm::PetscDM, redundantPoints::PetscBool, ignoreOutsideDomain::PetscBool) +Compute spatial indices for point location during interpolation + +Collective + +Input Parameters: +- `ctx` - the context +- `dm` - the `DM` for the function space used for interpolation +- `redundantPoints` - If `PETSC_TRUE`, all processes are passing in the same array of points. Otherwise, points need to be communicated among processes. +- `ignoreOutsideDomain` - If `PETSC_TRUE`, ignore points outside the domain, otherwise return an error + +Level: intermediate + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationEvaluate()`, `DMInterpolationAddPoints()`, `DMInterpolationCreate()` + +# External Links +$(_doc_external("DM/DMInterpolationSetUp")) +""" +function DMInterpolationSetUp(petsclib::PetscLibType, ctx::DMInterpolationInfo, dm::PetscDM, redundantPoints::PetscBool, ignoreOutsideDomain::PetscBool) end + +@for_petsc function DMInterpolationSetUp(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo, dm::PetscDM, redundantPoints::PetscBool, ignoreOutsideDomain::PetscBool ) + + @chk ccall( + (:DMInterpolationSetUp, $petsc_library), + PetscErrorCode, + (DMInterpolationInfo, CDM, PetscBool, PetscBool), + ctx, dm, redundantPoints, ignoreOutsideDomain, + ) + + + return nothing +end + +""" + DMInterpolationGetCoordinates(petsclib::PetscLibType,ctx::DMInterpolationInfo, coordinates::PetscVec) +Gets a `Vec` with the coordinates of each interpolation point + +Collective + +Input Parameter: +- `ctx` - the context + +Output Parameter: +- `coordinates` - the coordinates of interpolation points + +Level: intermediate + +Note: +The local vector entries correspond to interpolation points lying on this process, according to the associated `DM`. +This is a borrowed vector that the user should not destroy. + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationEvaluate()`, `DMInterpolationAddPoints()`, `DMInterpolationCreate()` + +# External Links +$(_doc_external("DM/DMInterpolationGetCoordinates")) +""" +function DMInterpolationGetCoordinates(petsclib::PetscLibType, ctx::DMInterpolationInfo, coordinates::PetscVec) end + +@for_petsc function DMInterpolationGetCoordinates(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo, coordinates::PetscVec ) + coordinates_ = Ref(coordinates.ptr) + + @chk ccall( + (:DMInterpolationGetCoordinates, $petsc_library), + PetscErrorCode, + (DMInterpolationInfo, Ptr{CVec}), + ctx, coordinates_, + ) + + coordinates.ptr = coordinates_[] + + return nothing +end + +""" + DMInterpolationGetVector(petsclib::PetscLibType,ctx::DMInterpolationInfo, v::PetscVec) +Gets a `Vec` which can hold all the interpolated field values + +Collective + +Input Parameter: +- `ctx` - the context + +Output Parameter: +- `v` - a vector capable of holding the interpolated field values + +Level: intermediate + +Note: +This vector should be returned using `DMInterpolationRestoreVector()`. + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationRestoreVector()`, `DMInterpolationEvaluate()`, `DMInterpolationAddPoints()`, `DMInterpolationCreate()` + +# External Links +$(_doc_external("DM/DMInterpolationGetVector")) +""" +function DMInterpolationGetVector(petsclib::PetscLibType, ctx::DMInterpolationInfo, v::PetscVec) end + +@for_petsc function DMInterpolationGetVector(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo, v::PetscVec ) + v_ = Ref(v.ptr) + + @chk ccall( + (:DMInterpolationGetVector, $petsc_library), + PetscErrorCode, + (DMInterpolationInfo, Ptr{CVec}), + ctx, v_, + ) + + v.ptr = v_[] + + return nothing +end + +""" + DMInterpolationRestoreVector(petsclib::PetscLibType,ctx::DMInterpolationInfo, v::PetscVec) +Returns a `Vec` which can hold all the interpolated field values + +Collective + +Input Parameters: +- `ctx` - the context +- `v` - a vector capable of holding the interpolated field values + +Level: intermediate + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationGetVector()`, `DMInterpolationEvaluate()`, `DMInterpolationAddPoints()`, `DMInterpolationCreate()` + +# External Links +$(_doc_external("DM/DMInterpolationRestoreVector")) +""" +function DMInterpolationRestoreVector(petsclib::PetscLibType, ctx::DMInterpolationInfo, v::PetscVec) end + +@for_petsc function DMInterpolationRestoreVector(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo, v::PetscVec ) + v_ = Ref(v.ptr) + + @chk ccall( + (:DMInterpolationRestoreVector, $petsc_library), + PetscErrorCode, + (DMInterpolationInfo, Ptr{CVec}), + ctx, v_, + ) + + v.ptr = v_[] + + return nothing +end + +""" + DMInterpolationEvaluate(petsclib::PetscLibType,ctx::DMInterpolationInfo, dm::PetscDM, x::PetscVec, v::PetscVec) +Using the input from `dm` and `x`, calculates interpolated field values at the interpolation points. + +Input Parameters: +- `ctx` - The `DMInterpolationInfo` context obtained with `DMInterpolationCreate()` +- `dm` - The `DM` +- `x` - The local vector containing the field to be interpolated, can be created with `DMCreateGlobalVector()` + +Output Parameter: +- `v` - The vector containing the interpolated values, obtained with `DMInterpolationGetVector()` + +Level: beginner + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationGetVector()`, `DMInterpolationAddPoints()`, `DMInterpolationCreate()`, `DMInterpolationGetCoordinates()` + +# External Links +$(_doc_external("DM/DMInterpolationEvaluate")) +""" +function DMInterpolationEvaluate(petsclib::PetscLibType, ctx::DMInterpolationInfo, dm::PetscDM, x::PetscVec, v::PetscVec) end + +@for_petsc function DMInterpolationEvaluate(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo, dm::PetscDM, x::PetscVec, v::PetscVec ) + + @chk ccall( + (:DMInterpolationEvaluate, $petsc_library), + PetscErrorCode, + (DMInterpolationInfo, CDM, CVec, CVec), + ctx, dm, x, v, + ) + + + return nothing +end + +""" + DMInterpolationDestroy(petsclib::PetscLibType,ctx::DMInterpolationInfo) +Destroys a `DMInterpolationInfo` context + +Collective + +Input Parameter: +- `ctx` - the context + +Level: beginner + +See also: +=== +`DM`, `DMInterpolationInfo`, `DMInterpolationEvaluate()`, `DMInterpolationAddPoints()`, `DMInterpolationCreate()` + +# External Links +$(_doc_external("DM/DMInterpolationDestroy")) +""" +function DMInterpolationDestroy(petsclib::PetscLibType, ctx::DMInterpolationInfo) end + +@for_petsc function DMInterpolationDestroy(petsclib::$UnionPetscLib, ctx::DMInterpolationInfo ) + + @chk ccall( + (:DMInterpolationDestroy, $petsc_library), + PetscErrorCode, + (Ptr{DMInterpolationInfo},), + ctx, + ) + + + return nothing +end + +""" + is::IS,subdm::PetscDM = DMCreateSectionSubDM(petsclib::PetscLibType,dm::PetscDM, numFields::PetscInt, fields::Vector{PetscInt}, numComps::Vector{PetscInt}, comps::Vector{PetscInt}) +Returns an `IS` and `subDM` containing a `PetscSection` that encapsulates a subproblem defined by a subset of the fields in a `PetscSection` in the `DM`. + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `numFields` - The number of fields to incorporate into `subdm` +- `fields` - The field numbers of the selected fields +- `numComps` - The number of components from each field to incorporate into `subdm`, or PETSC_DECIDE for all components +- `comps` - The component numbers of the selected fields (omitted for PTESC_DECIDE fields) + +Output Parameters: +- `is` - The global indices for the subproblem or `NULL` +- `subdm` - The `DM` for the subproblem, which must already have be cloned from `dm` or `NULL` + +Level: intermediate + +-seealso: `DMCreateSubDM()`, `DMGetLocalSection()`, `DMPlexSetMigrationSF()`, `DMView()` + +# External Links +$(_doc_external("DM/DMCreateSectionSubDM")) +""" +function DMCreateSectionSubDM(petsclib::PetscLibType, dm::PetscDM, numFields::PetscInt, fields::Vector{PetscInt}, numComps::Vector{PetscInt}, comps::Vector{PetscInt}) end + +@for_petsc function DMCreateSectionSubDM(petsclib::$UnionPetscLib, dm::PetscDM, numFields::$PetscInt, fields::Vector{$PetscInt}, numComps::Vector{$PetscInt}, comps::Vector{$PetscInt} ) + is_ = Ref{IS}() + subdm_ = Ref{CDM}() + + @chk ccall( + (:DMCreateSectionSubDM, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{CIS}, Ptr{CDM}), + dm, numFields, fields, numComps, comps, is_, subdm_, + ) + + is = is_[] + subdm = PetscDM(subdm_[], petsclib) + + return is,subdm +end + +""" + is::Vector{IS},superdm::PetscDM = DMCreateSectionSuperDM(petsclib::PetscLibType,dms::Vector{PetscDM}, len::PetscInt) +Returns an arrays of `IS` and a `DM` containing a `PetscSection` that encapsulates a superproblem defined by the array of `DM` and their `PetscSection` + +Not Collective + +Input Parameters: +- `dms` - The `DM` objects, the must all have the same topology; for example obtained with `DMClone()` +- `len` - The number of `DM` in `dms` + +Output Parameters: +- `is` - The global indices for the subproblem, or `NULL` +- `superdm` - The `DM` for the superproblem, which must already have be cloned and contain the same topology as the `dms` + +Level: intermediate + +-seealso: `DMCreateSuperDM()`, `DMGetLocalSection()`, `DMPlexSetMigrationSF()`, `DMView()` + +# External Links +$(_doc_external("DM/DMCreateSectionSuperDM")) +""" +function DMCreateSectionSuperDM(petsclib::PetscLibType, dms::Vector{PetscDM}, len::PetscInt) end + +@for_petsc function DMCreateSectionSuperDM(petsclib::$UnionPetscLib, dms::Vector{PetscDM}, len::$PetscInt ) + is_ = Ref{Ptr{CIS}}() + superdm_ = Ref{CDM}() + + @chk ccall( + (:DMCreateSectionSuperDM, $petsc_library), + PetscErrorCode, + (Ptr{CDM}, $PetscInt, Ptr{Ptr{CIS}}, Ptr{CDM}), + dms, len, is_, superdm_, + ) + + is = unsafe_wrap(Array, is_[], VecGetLocalSize(petsclib, x); own = false) + superdm = PetscDM(superdm_[], petsclib) + + return is,superdm +end + +""" + dm::PetscDM = DMCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty `DM` object. `DM`s are the abstract objects in PETSc that mediate between meshes and discretizations and the +algebraic solvers, time integrators, and optimization algorithms in PETSc. + +Collective + +Input Parameter: +- `comm` - The communicator for the `DM` object + +Output Parameter: +- `dm` - The `DM` object + +Level: beginner + +Notes: +See `DMType` for a brief summary of available `DM`. + +The type must then be set with `DMSetType()`. If you never call `DMSetType()` it will generate an +error when you try to use the `dm`. + +`DM` is an orphan initialism or orphan acronym, the letters have no meaning and never did. + +See also: +=== +`DM`, `DMSetType()`, `DMType`, `DMDACreate()`, `DMDA`, `DMSLICED`, `DMCOMPOSITE`, `DMPLEX`, `DMMOAB`, `DMNETWORK` + +# External Links +$(_doc_external("DM/DMCreate")) +""" +function DMCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + # Ensure PETSc (and MPI) are initialized before creating a DM to avoid crashes + @assert PetscInitialized(petsclib) "PETSc is not initialized — call PETSc.initialize(petsclib) (and MPI.Init()) before creating DMs" + dm_ = Ref{CDM}() + + @chk ccall( + (:DMCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CDM}), + comm, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMClone(petsclib::PetscLibType,dm::PetscDM, newdm::PetscDM) +Creates a `DM` object with the same topology as the original. + +Collective + +Input Parameter: +- `dm` - The original `DM` object + +Output Parameter: +- `newdm` - The new `DM` object + +Level: beginner + +Notes: +For some `DM` implementations this is a shallow clone, the result of which may share (reference counted) information with its parent. For example, +`DMClone()` applied to a `DMPLEX` object will result in a new `DMPLEX` that shares the topology with the original `DMPLEX`. It does not +share the `PetscSection` of the original `DM`. + +The clone is considered set up if the original has been set up. + +Use `DMConvert()` for a general way to create new `DM` from a given `DM` + +See also: +=== +`DM`, `DMDestroy()`, `DMCreate()`, `DMSetType()`, `DMSetLocalSection()`, `DMSetGlobalSection()`, `DMPLEX`, `DMConvert()` + +# External Links +$(_doc_external("DM/DMClone")) +""" +function DMClone(petsclib::PetscLibType, dm::PetscDM, newdm::PetscDM) end + +@for_petsc function DMClone(petsclib::$UnionPetscLib, dm::PetscDM, newdm::PetscDM ) + newdm_ = Ref(newdm.ptr) + + @chk ccall( + (:DMClone, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, newdm_, + ) + + newdm.ptr = newdm_[] + + return nothing +end + +""" + DMSetVecType(petsclib::PetscLibType,dm::PetscDM, ctype::VecType) +Sets the type of vector to be created with `DMCreateLocalVector()` and `DMCreateGlobalVector()` + +Logically Collective + +Input Parameters: +- `dm` - initial distributed array +- `ctype` - the vector type, for example `VECSTANDARD`, `VECCUDA`, or `VECVIENNACL` + +Options Database Key: +- `-dm_vec_type ctype` - the type of vector to create + +Level: intermediate + +See also: +=== +`DM`, `DMCreate()`, `DMDestroy()`, `DMDAInterpolationType`, `VecType`, `DMGetVecType()`, `DMSetMatType()`, `DMGetMatType()`, +`VECSTANDARD`, `VECCUDA`, `VECVIENNACL`, `DMCreateLocalVector()`, `DMCreateGlobalVector()` + +# External Links +$(_doc_external("DM/DMSetVecType")) +""" +function DMSetVecType(petsclib::PetscLibType, dm::PetscDM, ctype::VecType) end + +@for_petsc function DMSetVecType(petsclib::$UnionPetscLib, dm::PetscDM, ctype::VecType ) + + @chk ccall( + (:DMSetVecType, $petsc_library), + PetscErrorCode, + (CDM, VecType), + dm, ctype, + ) + + + return nothing +end + +""" + ctype::VecType = DMGetVecType(petsclib::PetscLibType,da::PetscDM) +Gets the type of vector created with `DMCreateLocalVector()` and `DMCreateGlobalVector()` + +Logically Collective + +Input Parameter: +- `da` - initial distributed array + +Output Parameter: +- `ctype` - the vector type + +Level: intermediate + +See also: +=== +`DM`, `DMCreate()`, `DMDestroy()`, `DMDAInterpolationType`, `VecType`, `DMSetMatType()`, `DMGetMatType()`, `DMSetVecType()` + +# External Links +$(_doc_external("DM/DMGetVecType")) +""" +function DMGetVecType(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMGetVecType(petsclib::$UnionPetscLib, da::PetscDM ) + ctype_ = Ref{VecType}() + + @chk ccall( + (:DMGetVecType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{VecType}), + da, ctype_, + ) + + ctype = unsafe_string(ctype_[]) + + return ctype +end + +""" + DMSetISColoringType(petsclib::PetscLibType,dm::PetscDM, ctype::ISColoringType) +Sets the type of coloring, `IS_COLORING_GLOBAL` or `IS_COLORING_LOCAL` that is created by the `DM` + +Logically Collective + +Input Parameters: +- `dm` - the `DM` context +- `ctype` - the matrix type + +Options Database Key: +- `-dm_is_coloring_type` - global or local + +Level: intermediate + +See also: +=== +`DM`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMSetMatrixPreallocateOnly()`, `MatType`, `DMGetMatType()`, +`DMGetISColoringType()`, `ISColoringType`, `IS_COLORING_GLOBAL`, `IS_COLORING_LOCAL` + +# External Links +$(_doc_external("DM/DMSetISColoringType")) +""" +function DMSetISColoringType(petsclib::PetscLibType, dm::PetscDM, ctype::ISColoringType) end + +@for_petsc function DMSetISColoringType(petsclib::$UnionPetscLib, dm::PetscDM, ctype::ISColoringType ) + + @chk ccall( + (:DMSetISColoringType, $petsc_library), + PetscErrorCode, + (CDM, ISColoringType), + dm, ctype, + ) + + + return nothing +end + +""" + ctype::ISColoringType = DMGetISColoringType(petsclib::PetscLibType,dm::PetscDM) +Gets the type of coloring, `IS_COLORING_GLOBAL` or `IS_COLORING_LOCAL` that is created by the `DM` + +Logically Collective + +Input Parameter: +- `dm` - the `DM` context + +Output Parameter: +- `ctype` - the matrix type + +Options Database Key: +- `-dm_is_coloring_type` - global or local + +Level: intermediate + +See also: +=== +`DM`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMSetMatrixPreallocateOnly()`, `MatType`, `DMGetMatType()`, +`ISColoringType`, `IS_COLORING_GLOBAL`, `IS_COLORING_LOCAL` + +# External Links +$(_doc_external("DM/DMGetISColoringType")) +""" +function DMGetISColoringType(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetISColoringType(petsclib::$UnionPetscLib, dm::PetscDM ) + ctype_ = Ref{ISColoringType}() + + @chk ccall( + (:DMGetISColoringType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{ISColoringType}), + dm, ctype_, + ) + + ctype = unsafe_string(ctype_[]) + + return ctype +end + +""" + DMSetMatType(petsclib::PetscLibType,dm::PetscDM, ctype::MatType) +Sets the type of matrix created with `DMCreateMatrix()` + +Logically Collective + +Input Parameters: +- `dm` - the `DM` context +- `ctype` - the matrix type, for example `MATMPIAIJ` + +Options Database Key: +- `-dm_mat_type ctype` - the type of the matrix to create, for example mpiaij + +Level: intermediate + +See also: +=== +`DM`, `MatType`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMSetMatrixPreallocateOnly()`, `DMGetMatType()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()` + +# External Links +$(_doc_external("DM/DMSetMatType")) +""" +function DMSetMatType(petsclib::PetscLibType, dm::PetscDM, ctype::MatType) end + +@for_petsc function DMSetMatType(petsclib::$UnionPetscLib, dm::PetscDM, ctype::MatType ) + + @chk ccall( + (:DMSetMatType, $petsc_library), + PetscErrorCode, + (CDM, MatType), + dm, ctype, + ) + + + return nothing +end + +""" + ctype::MatType = DMGetMatType(petsclib::PetscLibType,dm::PetscDM) +Gets the type of matrix that would be created with `DMCreateMatrix()` + +Logically Collective + +Input Parameter: +- `dm` - the `DM` context + +Output Parameter: +- `ctype` - the matrix type + +Level: intermediate + +See also: +=== +`DM`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMSetMatrixPreallocateOnly()`, `MatType`, `DMSetMatType()` + +# External Links +$(_doc_external("DM/DMGetMatType")) +""" +function DMGetMatType(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetMatType(petsclib::$UnionPetscLib, dm::PetscDM ) + ctype_ = Ref{MatType}() + + @chk ccall( + (:DMGetMatType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{MatType}), + dm, ctype_, + ) + + ctype = unsafe_string(ctype_[]) + + return ctype +end + +""" + DMSetOptionsPrefix(petsclib::PetscLibType,dm::PetscDM, prefix::String) +Sets the prefix prepended to all option names when searching through the options database + +Logically Collective + +Input Parameters: +- `dm` - the `DM` context +- `prefix` - the prefix to prepend + +Level: advanced + +Note: +A hyphen (-) must NOT be given at the beginning of the prefix name. +The first character of all runtime options is AUTOMATICALLY the hyphen. + +See also: +=== +`DM`, `PetscObjectSetOptionsPrefix()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DM/DMSetOptionsPrefix")) +""" +function DMSetOptionsPrefix(petsclib::PetscLibType, dm::PetscDM, prefix::String) end + +@for_petsc function DMSetOptionsPrefix(petsclib::$UnionPetscLib, dm::PetscDM, prefix::String ) + + @chk ccall( + (:DMSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + dm, prefix, + ) + + + return nothing +end + +""" + DMAppendOptionsPrefix(petsclib::PetscLibType,dm::PetscDM, prefix::String) +Appends an additional string to an already existing prefix used for searching for +`DM` options in the options database. + +Logically Collective + +Input Parameters: +- `dm` - the `DM` context +- `prefix` - the string to append to the current prefix + +Level: advanced + +Note: +If the `DM` does not currently have an options prefix then this value is used alone as the prefix as if `DMSetOptionsPrefix()` had been called. +A hyphen (-) must NOT be given at the beginning of the prefix name. +The first character of all runtime options is AUTOMATICALLY the hyphen. + +See also: +=== +`DM`, `DMSetOptionsPrefix()`, `DMGetOptionsPrefix()`, `PetscObjectAppendOptionsPrefix()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DM/DMAppendOptionsPrefix")) +""" +function DMAppendOptionsPrefix(petsclib::PetscLibType, dm::PetscDM, prefix::String) end + +@for_petsc function DMAppendOptionsPrefix(petsclib::$UnionPetscLib, dm::PetscDM, prefix::String ) + + @chk ccall( + (:DMAppendOptionsPrefix, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + dm, prefix, + ) + + + return nothing +end + +""" + DMGetOptionsPrefix(petsclib::PetscLibType,dm::PetscDM, prefix::String) +Gets the prefix used for searching for all +DM options in the options database. + +Not Collective + +Input Parameter: +- `dm` - the `DM` context + +Output Parameter: +- `prefix` - pointer to the prefix string used is returned + +Level: advanced + +See also: +=== +`DM`, `DMSetOptionsPrefix()`, `DMAppendOptionsPrefix()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DM/DMGetOptionsPrefix")) +""" +function DMGetOptionsPrefix(petsclib::PetscLibType, dm::PetscDM, prefix::String) end + +@for_petsc function DMGetOptionsPrefix(petsclib::$UnionPetscLib, dm::PetscDM, prefix::String ) + prefix_ = Ref(pointer(prefix)) + + @chk ccall( + (:DMGetOptionsPrefix, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{Cchar}}), + dm, prefix_, + ) + + + return nothing +end + +""" + DMDestroy(petsclib::PetscLibType,dm::PetscDM) +Destroys a `DM`. + +Collective + +Input Parameter: +- `dm` - the `DM` object to destroy + +Level: developer + +See also: +=== +`DM`, `DMCreate()`, `DMType`, `DMSetType()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()` + +# External Links +$(_doc_external("DM/DMDestroy")) +""" +function DMDestroy(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMDestroy(petsclib::$UnionPetscLib, dm::PetscDM ) + dm_ = Ref(dm.ptr) + + @chk ccall( + (:DMDestroy, $petsc_library), + PetscErrorCode, + (Ptr{CDM},), + dm_, + ) + + dm.ptr = C_NULL + + return nothing +end + +""" + DMSetUp(petsclib::PetscLibType,dm::PetscDM) +sets up the data structures inside a `DM` object + +Collective + +Input Parameter: +- `dm` - the `DM` object to setup + +Level: intermediate + +Note: +This is usually called after various parameter setting operations and `DMSetFromOptions()` are called on the `DM` + +See also: +=== +`DM`, `DMCreate()`, `DMSetType()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()` + +# External Links +$(_doc_external("DM/DMSetUp")) +""" +function DMSetUp(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSetUp(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMSetUp, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMSetFromOptions(petsclib::PetscLibType,dm::PetscDM) +sets parameters in a `DM` from the options database + +Collective + +Input Parameter: +- `dm` - the `DM` object to set options for + +Options Database Keys: +- `-dm_preallocate_only` - Only preallocate the matrix for `DMCreateMatrix()` and `DMCreateMassMatrix()`, but do not fill it with zeros +- `-dm_vec_type ` - type of vector to create inside `DM` +- `-dm_mat_type ` - type of matrix to create inside `DM` +- `-dm_is_coloring_type` - +- `-dm_bind_below ` - bind (force execution on CPU) for `Vec` and `Mat` objects with local size (number of vector entries or matrix rows) below n; currently only supported for `DMDA` +- `-dm_plex_option_phases ` - List of prefixes for option processing phases +- `-dm_plex_filename ` - File containing a mesh +- `-dm_plex_boundary_filename ` - File containing a mesh boundary +- `-dm_plex_name ` - Name of the mesh in the file +- `-dm_plex_shape ` - The domain shape, such as `BOX`, `SPHERE`, etc. +- `-dm_plex_cell ` - Cell shape +- `-dm_plex_reference_cell_domain ` - Use a reference cell domain +- `-dm_plex_dim ` - Set the topological dimension +- `-dm_plex_simplex ` - `PETSC_TRUE` for simplex elements, `PETSC_FALSE` for tensor elements +- `-dm_plex_interpolate ` - `PETSC_TRUE` turns on topological interpolation (creating edges and faces) +- `-dm_plex_orient ` - `PETSC_TRUE` turns on topological orientation (flipping edges and faces) +- `-dm_plex_scale ` - Scale factor for mesh coordinates +- `-dm_coord_remap ` - Map coordinates using a function +- `-dm_plex_coordinate_dim ` - Change the coordinate dimension of a mesh (usually given with cdm_ prefix) +- `-dm_coord_map ` - Select a builtin coordinate map +- `-dm_coord_map_params ` - Set coordinate mapping parameters +- `-dm_plex_box_faces ` - Number of faces along each dimension +- `-dm_plex_box_lower ` - Specify lower-left-bottom coordinates for the box +- `-dm_plex_box_upper ` - Specify upper-right-top coordinates for the box +- `-dm_plex_box_bd ` - Specify the `DMBoundaryType` for each direction +- `-dm_plex_sphere_radius ` - The sphere radius +- `-dm_plex_ball_radius ` - Radius of the ball +- `-dm_plex_cylinder_bd ` - Boundary type in the z direction +- `-dm_plex_cylinder_num_wedges ` - Number of wedges around the cylinder +- `-dm_plex_reorder ` - Reorder the mesh using the specified algorithm +- `-dm_refine_pre ` - The number of refinements before distribution +- `-dm_refine_uniform_pre ` - Flag for uniform refinement before distribution +- `-dm_refine_volume_limit_pre ` - The maximum cell volume after refinement before distribution +- `-dm_refine ` - The number of refinements after distribution +- `-dm_extrude ` - Activate extrusion and specify the number of layers to extrude +- `-dm_plex_save_transform ` - Save the `DMPlexTransform` that produced this mesh +- `-dm_plex_transform_extrude_thickness ` - The total thickness of extruded layers +- `-dm_plex_transform_extrude_use_tensor ` - Use tensor cells when extruding +- `-dm_plex_transform_extrude_symmetric ` - Extrude layers symmetrically about the surface +- `-dm_plex_transform_extrude_normal ` - Specify the extrusion direction +- `-dm_plex_transform_extrude_thicknesses ` - Specify thickness of each layer +- `-dm_plex_create_fv_ghost_cells` - Flag to create finite volume ghost cells on the boundary +- `-dm_plex_fv_ghost_cells_label ` - Label name for ghost cells boundary +- `-dm_distribute ` - Flag to redistribute a mesh among processes +- `-dm_distribute_overlap ` - The size of the overlap halo +- `-dm_plex_adj_cone ` - Set adjacency direction +- `-dm_plex_adj_closure ` - Set adjacency size +- `-dm_plex_use_ceed ` - Use LibCEED as the FEM backend +- `-dm_plex_check_symmetry` - Check that the adjacency information in the mesh is symmetric - `DMPlexCheckSymmetry()` +- `-dm_plex_check_skeleton` - Check that each cell has the correct number of vertices (only for homogeneous simplex or tensor meshes) - `DMPlexCheckSkeleton()` +- `-dm_plex_check_faces` - Check that the faces of each cell give a vertex order this is consistent with what we expect from the cell type - `DMPlexCheckFaces()` +- `-dm_plex_check_geometry` - Check that cells have positive volume - `DMPlexCheckGeometry()` +- `-dm_plex_check_pointsf` - Check some necessary conditions for `PointSF` - `DMPlexCheckPointSF()` +- `-dm_plex_check_interface_cones` - Check points on inter-partition interfaces have conforming order of cone points - `DMPlexCheckInterfaceCones()` +- `-dm_plex_check_all` - Perform all the checks above + +Level: intermediate + +Note: +For some `DMType` such as `DMDA` this cannot be called after `DMSetUp()` has been called. + +See also: +=== +`DM`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, +`DMPlexCheckSymmetry()`, `DMPlexCheckSkeleton()`, `DMPlexCheckFaces()`, `DMPlexCheckGeometry()`, `DMPlexCheckPointSF()`, `DMPlexCheckInterfaceCones()`, +`DMSetOptionsPrefix()`, `DMType`, `DMPLEX`, `DMDA`, `DMSetUp()` + +# External Links +$(_doc_external("DM/DMSetFromOptions")) +""" +function DMSetFromOptions(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSetFromOptions(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMSetFromOptions, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMViewFromOptions(petsclib::PetscLibType,dm::PetscDM, obj::PetscObject, name::String) +View a `DM` in a particular way based on a request in the options database + +Collective + +Input Parameters: +- `dm` - the `DM` object +- `obj` - optional object that provides the prefix for the options database (if `NULL` then the prefix in `obj` is used) +- `name` - option string that is used to activate viewing + +Level: intermediate + +Note: +See `PetscObjectViewFromOptions()` for a list of values that can be provided in the options database to determine how the `DM` is viewed + +See also: +=== +`DM`, `DMView()`, `PetscObjectViewFromOptions()`, `DMCreate()` + +# External Links +$(_doc_external("DM/DMViewFromOptions")) +""" +function DMViewFromOptions(petsclib::PetscLibType, dm::PetscDM, obj::PetscObject, name::String) end + +@for_petsc function DMViewFromOptions(petsclib::$UnionPetscLib, dm::PetscDM, obj::PetscObject, name::String ) + + @chk ccall( + (:DMViewFromOptions, $petsc_library), + PetscErrorCode, + (CDM, PetscObject, Ptr{Cchar}), + dm, obj, name, + ) + + + return nothing +end + +""" + DMView(petsclib::PetscLibType,dm::PetscDM, v::PetscViewer) +Views a `DM`. Depending on the `PetscViewer` and its `PetscViewerFormat` it may print some ASCII information about the `DM` to the screen or a file or +save the `DM` in a binary file to be loaded later or create a visualization of the `DM` + +Collective + +Input Parameters: +- `dm` - the `DM` object to view +- `v` - the viewer + +Options Database Keys: +- `-view_pyvista_warp ` - Warps the mesh by the active scalar with factor f +- `-view_pyvista_clip ` - Defines the clipping box +- `-dm_view_draw_line_color ` - Specify the X-window color for cell borders +- `-dm_view_draw_cell_color ` - Specify the X-window color for cells +- `-dm_view_draw_affine ` - Flag to ignore high-order edges + +Level: beginner + +Notes: + +`PetscViewer` = `PETSCVIEWERHDF5` i.e. HDF5 format can be used with `PETSC_VIEWER_HDF5_PETSC` as the `PetscViewerFormat` to save multiple `DMPLEX` +meshes in a single HDF5 file. This in turn requires one to name the `DMPLEX` object with `PetscObjectSetName()` +before saving it with `DMView()` and before loading it with `DMLoad()` for identification of the mesh object. + +`PetscViewer` = `PETSCVIEWEREXODUSII` i.e. ExodusII format assumes that element blocks (mapped to "Cell sets" labels) +consists of sequentially numbered cells. + +If `dm` has been distributed, only the part of the `DM` on MPI rank 0 (including "ghost" cells and vertices) will be written. + +Only TRI, TET, QUAD, and HEX cells are supported in ExodusII. + +`DMPLEX` only represents geometry while most post-processing software expect that a mesh also provides information on the discretization space. This function assumes that the file represents Lagrange finite elements of order 1 or 2. +The order of the mesh shall be set using `PetscViewerExodusIISetOrder()` + +Variable names can be set and queried using `PetscViewerExodusII[Set/Get][Nodal/Zonal]VariableNames[s]`. + +See also: +=== +`DM`, `PetscViewer`, `PetscViewerFormat`, `PetscViewerSetFormat()`, `DMDestroy()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMLoad()`, `PetscObjectSetName()` + +# External Links +$(_doc_external("DM/DMView")) +""" +function DMView(petsclib::PetscLibType, dm::PetscDM, v::PetscViewer) end + +@for_petsc function DMView(petsclib::$UnionPetscLib, dm::PetscDM, v::PetscViewer ) + + @chk ccall( + (:DMView, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer), + dm, v, + ) + + + return nothing +end + +""" + vec::PetscVec = DMCreateGlobalVector(petsclib::PetscLibType,dm::PetscDM) +Creates a global vector from a `DM` object. A global vector is a parallel vector that has no duplicate values shared between MPI ranks, +that is it has no ghost locations. + +Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameter: +- `vec` - the global vector + +Level: beginner + +See also: +=== +`DM`, `Vec`, `DMCreateLocalVector()`, `DMGetGlobalVector()`, `DMDestroy()`, `DMView()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, +`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()` + +# External Links +$(_doc_external("DM/DMCreateGlobalVector")) +""" +function DMCreateGlobalVector(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMCreateGlobalVector(petsclib::$UnionPetscLib, dm::PetscDM ) + vec_ = Ref{CVec}() + + @chk ccall( + (:DMCreateGlobalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, vec_, + ) + + vec = PetscVec(vec_[], petsclib) + + return vec +end + +""" + vec::PetscVec = DMCreateLocalVector(petsclib::PetscLibType,dm::PetscDM) +Creates a local vector from a `DM` object. + +Not Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameter: +- `vec` - the local vector + +Level: beginner + +Note: +A local vector usually has ghost locations that contain values that are owned by different MPI ranks. A global vector has no ghost locations. + +See also: +=== +`DM`, `Vec`, `DMCreateGlobalVector()`, `DMGetLocalVector()`, `DMDestroy()`, `DMView()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()` +`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()` + +# External Links +$(_doc_external("DM/DMCreateLocalVector")) +""" +function DMCreateLocalVector(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMCreateLocalVector(petsclib::$UnionPetscLib, dm::PetscDM ) + vec_ = Ref{CVec}() + + @chk ccall( + (:DMCreateLocalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, vec_, + ) + + vec = PetscVec(vec_[], petsclib) + + return vec +end + +""" + DMGetLocalToGlobalMapping(petsclib::PetscLibType,dm::PetscDM, ltog::ISLocalToGlobalMapping) +Accesses the local + +Collective + +Input Parameter: +- `dm` - the `DM` that provides the mapping + +Output Parameter: +- `ltog` - the mapping + +Level: advanced + +Notes: +The global to local mapping allows one to set values into the global vector or matrix using `VecSetValuesLocal()` and `MatSetValuesLocal()` + +Vectors obtained with `DMCreateGlobalVector()` and matrices obtained with `DMCreateMatrix()` already contain the global mapping so you do +need to use this function with those objects. + +This mapping can then be used by `VecSetLocalToGlobalMapping()` or `MatSetLocalToGlobalMapping()`. + +See also: +=== +`DM`, `DMCreateLocalVector()`, `DMCreateGlobalVector()`, `VecSetLocalToGlobalMapping()`, `MatSetLocalToGlobalMapping()`, +`DMCreateMatrix()` + +# External Links +$(_doc_external("DM/DMGetLocalToGlobalMapping")) +""" +function DMGetLocalToGlobalMapping(petsclib::PetscLibType, dm::PetscDM, ltog::ISLocalToGlobalMapping) end + +@for_petsc function DMGetLocalToGlobalMapping(petsclib::$UnionPetscLib, dm::PetscDM, ltog::ISLocalToGlobalMapping ) + + @chk ccall( + (:DMGetLocalToGlobalMapping, $petsc_library), + PetscErrorCode, + (CDM, Ptr{ISLocalToGlobalMapping}), + dm, ltog, + ) + + + return nothing +end + +""" + bs::PetscInt = DMGetBlockSize(petsclib::PetscLibType,dm::PetscDM) +Gets the inherent block size associated with a `DM` + +Not Collective + +Input Parameter: +- `dm` - the `DM` with block structure + +Output Parameter: +- `bs` - the block size, 1 implies no exploitable block structure + +Level: intermediate + +Notes: +This might be the number of degrees of freedom at each grid point for a structured grid. + +Complex `DM` that represent multiphysics or staggered grids or mixed-methods do not generally have a single inherent block size, but +rather different locations in the vectors may have a different block size. + +See also: +=== +`DM`, `ISCreateBlock()`, `VecSetBlockSize()`, `MatSetBlockSize()`, `DMGetLocalToGlobalMapping()` + +# External Links +$(_doc_external("DM/DMGetBlockSize")) +""" +function DMGetBlockSize(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetBlockSize(petsclib::$UnionPetscLib, dm::PetscDM ) + bs_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetBlockSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, bs_, + ) + + bs = bs_[] + + return bs +end + +""" + mat::PetscMat,vec::PetscVec = DMCreateInterpolation(petsclib::PetscLibType,dmc::PetscDM, dmf::PetscDM) +Gets the interpolation matrix between two `DM` objects. The resulting matrix map degrees of freedom in the vector obtained by +`DMCreateGlobalVector()` on the coarse `DM` to similar vectors on the fine grid `DM`. + +Collective + +Input Parameters: +- `dmc` - the `DM` object +- `dmf` - the second, finer `DM` object + +Output Parameters: +- `mat` - the interpolation +- `vec` - the scaling (optional, pass `NULL` if not needed), see `DMCreateInterpolationScale()` + +Level: developer + +Notes: +For `DMDA` objects this only works for "uniform refinement", that is the refined mesh was obtained `DMRefine()` or the coarse mesh was obtained by +DMCoarsen(). The coordinates set into the `DMDA` are completely ignored in computing the interpolation. + +For `DMDA` objects you can use this interpolation (more precisely the interpolation from the `DMGetCoordinateDM()`) to interpolate the mesh coordinate +vectors EXCEPT in the periodic case where it does not make sense since the coordinate vectors are not periodic. + +See also: +=== +`DM`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMRefine()`, `DMCoarsen()`, `DMCreateRestriction()`, `DMCreateInterpolationScale()` + +# External Links +$(_doc_external("DM/DMCreateInterpolation")) +""" +function DMCreateInterpolation(petsclib::PetscLibType, dmc::PetscDM, dmf::PetscDM) end + +@for_petsc function DMCreateInterpolation(petsclib::$UnionPetscLib, dmc::PetscDM, dmf::PetscDM ) + mat_ = Ref{CMat}() + vec_ = Ref{CVec}() + + @chk ccall( + (:DMCreateInterpolation, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{CMat}, Ptr{CVec}), + dmc, dmf, mat_, vec_, + ) + + mat = PetscMat(mat_[], petsclib) + vec = PetscVec(vec_[], petsclib) + + return mat,vec +end + +""" + scale::PetscVec = DMCreateInterpolationScale(petsclib::PetscLibType,dac::PetscDM, daf::PetscDM, mat::PetscMat) +Forms L = 1/(R*1) where 1 is the vector of all ones, and R is +the transpose of the interpolation between the `DM`. + +Input Parameters: +- `dac` - `DM` that defines a coarse mesh +- `daf` - `DM` that defines a fine mesh +- `mat` - the restriction (or interpolation operator) from fine to coarse + +Output Parameter: +- `scale` - the scaled vector + +Level: advanced + +Note: +xcoarse = diag(L)*R*xfine preserves scale and is thus suitable for state (versus residual) +restriction. In other words xcoarse is the coarse representation of xfine. + +Developer Note: +If the fine-scale `DMDA` has the -dm_bind_below option set to true, then `DMCreateInterpolationScale()` calls `MatSetBindingPropagates()` +on the restriction/interpolation operator to set the bindingpropagates flag to true. + +See also: +=== +`DM`, `MatRestrict()`, `MatInterpolate()`, `DMCreateInterpolation()`, `DMCreateRestriction()`, `DMCreateGlobalVector()` + +# External Links +$(_doc_external("DM/DMCreateInterpolationScale")) +""" +function DMCreateInterpolationScale(petsclib::PetscLibType, dac::PetscDM, daf::PetscDM, mat::PetscMat) end + +@for_petsc function DMCreateInterpolationScale(petsclib::$UnionPetscLib, dac::PetscDM, daf::PetscDM, mat::PetscMat ) + scale_ = Ref{CVec}() + + @chk ccall( + (:DMCreateInterpolationScale, $petsc_library), + PetscErrorCode, + (CDM, CDM, CMat, Ptr{CVec}), + dac, daf, mat, scale_, + ) + + scale = PetscVec(scale_[], petsclib) + + return scale +end + +""" + mat::PetscMat = DMCreateRestriction(petsclib::PetscLibType,dmc::PetscDM, dmf::PetscDM) +Gets restriction matrix between two `DM` objects. The resulting matrix map degrees of freedom in the vector obtained by +`DMCreateGlobalVector()` on the fine `DM` to similar vectors on the coarse grid `DM`. + +Collective + +Input Parameters: +- `dmc` - the `DM` object +- `dmf` - the second, finer `DM` object + +Output Parameter: +- `mat` - the restriction + +Level: developer + +Note: +This only works for `DMSTAG`. For many situations either the transpose of the operator obtained with `DMCreateInterpolation()` or that +matrix multiplied by the vector obtained with `DMCreateInterpolationScale()` provides the desired object. + +See also: +=== +`DM`, `DMRestrict()`, `DMInterpolate()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMRefine()`, `DMCoarsen()`, `DMCreateInterpolation()` + +# External Links +$(_doc_external("DM/DMCreateRestriction")) +""" +function DMCreateRestriction(petsclib::PetscLibType, dmc::PetscDM, dmf::PetscDM) end + +@for_petsc function DMCreateRestriction(petsclib::$UnionPetscLib, dmc::PetscDM, dmf::PetscDM ) + mat_ = Ref{CMat}() + + @chk ccall( + (:DMCreateRestriction, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{CMat}), + dmc, dmf, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + mat::PetscMat = DMCreateInjection(petsclib::PetscLibType,dac::PetscDM, daf::PetscDM) +Gets injection matrix between two `DM` objects. + +Collective + +Input Parameters: +- `dac` - the `DM` object +- `daf` - the second, finer `DM` object + +Output Parameter: +- `mat` - the injection + +Level: developer + +Notes: +This is an operator that applied to a vector obtained with `DMCreateGlobalVector()` on the +fine grid maps the values to a vector on the vector on the coarse `DM` by simply selecting +the values on the coarse grid points. This compares to the operator obtained by +`DMCreateRestriction()` or the transpose of the operator obtained by +`DMCreateInterpolation()` that uses a "local weighted average" of the values around the +coarse grid point as the coarse grid value. + +For `DMDA` objects this only works for "uniform refinement", that is the refined mesh was obtained `DMRefine()` or the coarse mesh was obtained by +`DMCoarsen()`. The coordinates set into the `DMDA` are completely ignored in computing the injection. + +See also: +=== +`DM`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMCreateInterpolation()`, +`DMCreateRestriction()`, `MatRestrict()`, `MatInterpolate()` + +# External Links +$(_doc_external("DM/DMCreateInjection")) +""" +function DMCreateInjection(petsclib::PetscLibType, dac::PetscDM, daf::PetscDM) end + +@for_petsc function DMCreateInjection(petsclib::$UnionPetscLib, dac::PetscDM, daf::PetscDM ) + mat_ = Ref{CMat}() + + @chk ccall( + (:DMCreateInjection, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{CMat}), + dac, daf, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + mat::PetscMat = DMCreateMassMatrix(petsclib::PetscLibType,dmc::PetscDM, dmf::PetscDM) +Gets the mass matrix between two `DM` objects +Collective + +Input Parameters: +- `dmc` - the target `DM` object +- `dmf` - the source `DM` object, can be `NULL` + +Output Parameter: +- `mat` - the mass matrix + +Level: developer + +See also: +=== +`DM`, `DMCreateMassMatrixLumped()`, `DMCreateMatrix()`, `DMRefine()`, `DMCoarsen()`, `DMCreateRestriction()`, `DMCreateInterpolation()`, `DMCreateInjection()` + +# External Links +$(_doc_external("DM/DMCreateMassMatrix")) +""" +function DMCreateMassMatrix(petsclib::PetscLibType, dmc::PetscDM, dmf::PetscDM) end + +@for_petsc function DMCreateMassMatrix(petsclib::$UnionPetscLib, dmc::PetscDM, dmf::PetscDM ) + mat_ = Ref{CMat}() + + @chk ccall( + (:DMCreateMassMatrix, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{CMat}), + dmc, dmf, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + llm::PetscVec,lm::PetscVec = DMCreateMassMatrixLumped(petsclib::PetscLibType,dm::PetscDM) +Gets the lumped mass matrix for a given `DM` + +Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameters: +- `llm` - the local lumped mass matrix, which is a diagonal matrix, represented as a vector +- `lm` - the global lumped mass matrix, which is a diagonal matrix, represented as a vector + +Level: developer + +Note: +See `DMCreateMassMatrix()` for how to create the non-lumped version of the mass matrix. + +See also: +=== +`DM`, `DMCreateMassMatrix()`, `DMCreateMatrix()`, `DMRefine()`, `DMCoarsen()`, `DMCreateRestriction()`, `DMCreateInterpolation()`, `DMCreateInjection()` + +# External Links +$(_doc_external("DM/DMCreateMassMatrixLumped")) +""" +function DMCreateMassMatrixLumped(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMCreateMassMatrixLumped(petsclib::$UnionPetscLib, dm::PetscDM ) + llm_ = Ref{CVec}() + lm_ = Ref{CVec}() + + @chk ccall( + (:DMCreateMassMatrixLumped, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}, Ptr{CVec}), + dm, llm_, lm_, + ) + + llm = PetscVec(llm_[], petsclib) + lm = PetscVec(lm_[], petsclib) + + return llm,lm +end + +""" + mat::PetscMat = DMCreateGradientMatrix(petsclib::PetscLibType,dmc::PetscDM, dmf::PetscDM) +Gets the gradient matrix between two `DM` objects +Collective + +Input Parameters: +- `dmc` - the target `DM` object +- `dmf` - the source `DM` object, can be `NULL` + +Output Parameter: +- `mat` - the gradient matrix + +Level: developer + +Notes: +For `DMPLEX` the finite element model for the `DM` must have been already provided. + +See also: +=== +`DM`, `DMCreateMassMatrix()`, `DMCreateMassMatrixLumped()`, `DMCreateMatrix()`, `DMRefine()`, `DMCoarsen()`, `DMCreateRestriction()`, `DMCreateInterpolation()`, `DMCreateInjection()` + +# External Links +$(_doc_external("DM/DMCreateGradientMatrix")) +""" +function DMCreateGradientMatrix(petsclib::PetscLibType, dmc::PetscDM, dmf::PetscDM) end + +@for_petsc function DMCreateGradientMatrix(petsclib::$UnionPetscLib, dmc::PetscDM, dmf::PetscDM ) + mat_ = Ref{CMat}() + + @chk ccall( + (:DMCreateGradientMatrix, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{CMat}), + dmc, dmf, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + coloring::ISColoring = DMCreateColoring(petsclib::PetscLibType,dm::PetscDM, ctype::ISColoringType) +Gets coloring of a graph associated with the `DM`. Often the graph represents the operator matrix associated with the discretization +of a PDE on the `DM`. + +Collective + +Input Parameters: +- `dm` - the `DM` object +- `ctype` - `IS_COLORING_LOCAL` or `IS_COLORING_GLOBAL` + +Output Parameter: +- `coloring` - the coloring + +Level: developer + +Notes: +Coloring of matrices can also be computed directly from the sparse matrix nonzero structure via the `MatColoring` object or from the mesh from which the +matrix comes from (what this function provides). In general using the mesh produces a more optimal coloring (fewer colors). + +This produces a coloring with the distance of 2, see `MatSetColoringDistance()` which can be used for efficiently computing Jacobians with `MatFDColoringCreate()` +For `DMDA` in three dimensions with periodic boundary conditions the number of grid points in each dimension must be divisible by 2*stencil_width + 1, +otherwise an error will be generated. + +See also: +=== +`DM`, `ISColoring`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMSetMatType()`, `MatColoring`, `MatFDColoringCreate()` + +# External Links +$(_doc_external("DM/DMCreateColoring")) +""" +function DMCreateColoring(petsclib::PetscLibType, dm::PetscDM, ctype::ISColoringType) end + +@for_petsc function DMCreateColoring(petsclib::$UnionPetscLib, dm::PetscDM, ctype::ISColoringType ) + coloring_ = Ref{ISColoring}() + + @chk ccall( + (:DMCreateColoring, $petsc_library), + PetscErrorCode, + (CDM, ISColoringType, Ptr{ISColoring}), + dm, ctype, coloring_, + ) + + coloring = coloring_[] + + return coloring +end + +""" + mat::PetscMat = DMCreateMatrix(petsclib::PetscLibType,dm::PetscDM) +Gets an empty matrix for a `DM` that is most commonly used to store the Jacobian of a discrete PDE operator. + +Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameter: +- `mat` - the empty Jacobian + +Options Database Key: +- `-dm_preallocate_only` - Only preallocate the matrix for `DMCreateMatrix()` and `DMCreateMassMatrix()`, but do not fill it with zeros + +Level: beginner + +Notes: +This properly preallocates the number of nonzeros in the sparse matrix so you +do not need to do it yourself. + +By default it also sets the nonzero structure and puts in the zero entries. To prevent setting +the nonzero pattern call `DMSetMatrixPreallocateOnly()` + +For `DMDA`, when you call `MatView()` on this matrix it is displayed using the global natural ordering, NOT in the ordering used +internally by PETSc. + +For `DMDA`, in general it is easiest to use `MatSetValuesStencil()` or `MatSetValuesLocal()` to put values into the matrix because +`MatSetValues()` requires the indices for the global numbering for the `DMDA` which is complic`ated to compute + +See also: +=== +`DM`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMSetMatType()`, `DMCreateMassMatrix()` + +# External Links +$(_doc_external("DM/DMCreateMatrix")) +""" +function DMCreateMatrix(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMCreateMatrix(petsclib::$UnionPetscLib, dm::PetscDM ) + mat_ = Ref{CMat}() + + @chk ccall( + (:DMCreateMatrix, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CMat}), + dm, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + DMSetMatrixPreallocateSkip(petsclib::PetscLibType,dm::PetscDM, skip::PetscBool) +When `DMCreateMatrix()` is called the matrix sizes and +`ISLocalToGlobalMapping` will be properly set, but the data structures to store values in the +matrices will not be preallocated. + +Logically Collective + +Input Parameters: +- `dm` - the `DM` +- `skip` - `PETSC_TRUE` to skip preallocation + +Level: developer + +Note: +This is most useful to reduce initialization costs when `MatSetPreallocationCOO()` and +`MatSetValuesCOO()` will be used. + +See also: +=== +`DM`, `DMCreateMatrix()`, `DMSetMatrixStructureOnly()`, `DMSetMatrixPreallocateOnly()` + +# External Links +$(_doc_external("DM/DMSetMatrixPreallocateSkip")) +""" +function DMSetMatrixPreallocateSkip(petsclib::PetscLibType, dm::PetscDM, skip::PetscBool) end + +@for_petsc function DMSetMatrixPreallocateSkip(petsclib::$UnionPetscLib, dm::PetscDM, skip::PetscBool ) + + @chk ccall( + (:DMSetMatrixPreallocateSkip, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, skip, + ) + + + return nothing +end + +""" + DMSetMatrixPreallocateOnly(petsclib::PetscLibType,dm::PetscDM, only::PetscBool) +When `DMCreateMatrix()` is called the matrix will be properly +preallocated but the nonzero structure and zero values will not be set. + +Logically Collective + +Input Parameters: +- `dm` - the `DM` +- `only` - `PETSC_TRUE` if only want preallocation + +Options Database Key: +- `-dm_preallocate_only` - Only preallocate the matrix for `DMCreateMatrix()`, `DMCreateMassMatrix()`, but do not fill it with zeros + +Level: developer + +See also: +=== +`DM`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMSetMatrixStructureOnly()`, `DMSetMatrixPreallocateSkip()` + +# External Links +$(_doc_external("DM/DMSetMatrixPreallocateOnly")) +""" +function DMSetMatrixPreallocateOnly(petsclib::PetscLibType, dm::PetscDM, only::PetscBool) end + +@for_petsc function DMSetMatrixPreallocateOnly(petsclib::$UnionPetscLib, dm::PetscDM, only::PetscBool ) + + @chk ccall( + (:DMSetMatrixPreallocateOnly, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, only, + ) + + + return nothing +end + +""" + DMSetMatrixStructureOnly(petsclib::PetscLibType,dm::PetscDM, only::PetscBool) +When `DMCreateMatrix()` is called, the matrix nonzero structure will be created +but the array for numerical values will not be allocated. + +Logically Collective + +Input Parameters: +- `dm` - the `DM` +- `only` - `PETSC_TRUE` if you only want matrix nonzero structure + +Level: developer + +See also: +=== +`DM`, `DMCreateMatrix()`, `DMSetMatrixPreallocateOnly()`, `DMSetMatrixPreallocateSkip()` + +# External Links +$(_doc_external("DM/DMSetMatrixStructureOnly")) +""" +function DMSetMatrixStructureOnly(petsclib::PetscLibType, dm::PetscDM, only::PetscBool) end + +@for_petsc function DMSetMatrixStructureOnly(petsclib::$UnionPetscLib, dm::PetscDM, only::PetscBool ) + + @chk ccall( + (:DMSetMatrixStructureOnly, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, only, + ) + + + return nothing +end + +""" + DMSetBlockingType(petsclib::PetscLibType,dm::PetscDM, btype::DMBlockingType) +set the blocking granularity to be used for variable block size `DMCreateMatrix()` is called + +Logically Collective + +Input Parameters: +- `dm` - the `DM` +- `btype` - block by topological point or field node + +Options Database Key: +- `-dm_blocking_type [topological_point, field_node]` - use topological point blocking or field node blocking + +Level: advanced + +See also: +=== +`DM`, `DMCreateMatrix()`, `MatSetVariableBlockSizes()` + +# External Links +$(_doc_external("DM/DMSetBlockingType")) +""" +function DMSetBlockingType(petsclib::PetscLibType, dm::PetscDM, btype::DMBlockingType) end + +@for_petsc function DMSetBlockingType(petsclib::$UnionPetscLib, dm::PetscDM, btype::DMBlockingType ) + + @chk ccall( + (:DMSetBlockingType, $petsc_library), + PetscErrorCode, + (CDM, DMBlockingType), + dm, btype, + ) + + + return nothing +end + +""" + btype::DMBlockingType = DMGetBlockingType(petsclib::PetscLibType,dm::PetscDM) +get the blocking granularity to be used for variable block size `DMCreateMatrix()` is called + +Not Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `btype` - block by topological point or field node + +Level: advanced + +See also: +=== +`DM`, `DMCreateMatrix()`, `MatSetVariableBlockSizes()` + +# External Links +$(_doc_external("DM/DMGetBlockingType")) +""" +function DMGetBlockingType(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetBlockingType(petsclib::$UnionPetscLib, dm::PetscDM ) + btype_ = Ref{DMBlockingType}() + + @chk ccall( + (:DMGetBlockingType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMBlockingType}), + dm, btype_, + ) + + #btype = unsafe_string(btype_[]) + btype = btype_[] + + + return btype +end + +""" + DMSetNullSpaceConstructor(petsclib::PetscLibType,dm::PetscDM, field::PetscInt, nullsp::external) +Provide a callback function which constructs the nullspace for a given field, defined with `DMAddField()`, when function spaces +are joined or split, such as in `DMCreateSubDM()` + +Logically Collective; No Fortran Support + +Input Parameters: +- `dm` - The `DM` +- `field` - The field number for the nullspace +- `nullsp` - A callback to create the nullspace + +Calling sequence of `nullsp`: +- `dm` - The present `DM` +- `origField` - The field number given above, in the original `DM` +- `field` - The field number in dm +- `nullSpace` - The nullspace for the given field + +Level: intermediate + +See also: +=== +`DM`, `DMAddField()`, `DMGetNullSpaceConstructor()`, `DMSetNearNullSpaceConstructor()`, `DMGetNearNullSpaceConstructor()`, `DMCreateSubDM()`, `DMCreateSuperDM()` + +# External Links +$(_doc_external("DM/DMSetNullSpaceConstructor")) +""" +function DMSetNullSpaceConstructor(petsclib::PetscLibType, dm::PetscDM, field::PetscInt, nullsp::external) end + +@for_petsc function DMSetNullSpaceConstructor(petsclib::$UnionPetscLib, dm::PetscDM, field::$PetscInt, nullsp::external ) + + @chk ccall( + (:DMSetNullSpaceConstructor, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, external), + dm, field, nullsp, + ) + + + return nothing +end + +""" + DMSetNearNullSpaceConstructor(petsclib::PetscLibType,dm::PetscDM, field::PetscInt, nullsp::external) +Provide a callback function which constructs the near + +Logically Collective; No Fortran Support + +Input Parameters: +- `dm` - The `DM` +- `field` - The field number for the nullspace +- `nullsp` - A callback to create the near-nullspace + +Calling sequence of `nullsp`: +- `dm` - The present `DM` +- `origField` - The field number given above, in the original `DM` +- `field` - The field number in dm +- `nullSpace` - The nullspace for the given field + +Level: intermediate + +See also: +=== +`DM`, `DMAddField()`, `DMGetNearNullSpaceConstructor()`, `DMSetNullSpaceConstructor()`, `DMGetNullSpaceConstructor()`, `DMCreateSubDM()`, `DMCreateSuperDM()`, +`MatNullSpace` + +# External Links +$(_doc_external("DM/DMSetNearNullSpaceConstructor")) +""" +function DMSetNearNullSpaceConstructor(petsclib::PetscLibType, dm::PetscDM, field::PetscInt, nullsp::external) end + +@for_petsc function DMSetNearNullSpaceConstructor(petsclib::$UnionPetscLib, dm::PetscDM, field::$PetscInt, nullsp::external ) + + @chk ccall( + (:DMSetNearNullSpaceConstructor, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, external), + dm, field, nullsp, + ) + + + return nothing +end + +""" + numFields::PetscInt,fieldNames::Cchar,fields::Vector{IS} = DMCreateFieldIS(petsclib::PetscLibType,dm::PetscDM) +Creates a set of `IS` objects with the global indices of dofs for each field defined with `DMAddField()` + +Not Collective; No Fortran Support + +Input Parameter: +- `dm` - the `DM` object + +Output Parameters: +- `numFields` - The number of fields (or `NULL` if not requested) +- `fieldNames` - The name of each field (or `NULL` if not requested) +- `fields` - The global indices for each field (or `NULL` if not requested) + +Level: intermediate + +Note: +The user is responsible for freeing all requested arrays. In particular, every entry of `fieldNames` should be freed with +`PetscFree()`, every entry of `fields` should be destroyed with `ISDestroy()`, and both arrays should be freed with +`PetscFree()`. + +Developer Note: +It is not clear why both this function and `DMCreateFieldDecomposition()` exist. Having two seems redundant and confusing. This function should +likely be removed. + +See also: +=== +`DM`, `DMAddField()`, `DMGetField()`, `DMDestroy()`, `DMView()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, +`DMCreateFieldDecomposition()` + +# External Links +$(_doc_external("DM/DMCreateFieldIS")) +""" +function DMCreateFieldIS(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMCreateFieldIS(petsclib::$UnionPetscLib, dm::PetscDM ) + numFields_ = Ref{$PetscInt}() + fieldNames_ = Ref{Cchar}() + fields_ = Ref{Ptr{CIS}}() + + @chk ccall( + (:DMCreateFieldIS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Cchar, Ptr{Ptr{CIS}}), + dm, numFields_, fieldNames_, fields_, + ) + + numFields = numFields_[] + fieldNames = fieldNames_[] + fields = unsafe_wrap(Array, fields_[], VecGetLocalSize(petsclib, x); own = false) + + return numFields,fieldNames,fields +end + +""" + len::PetscInt,namelist::Cchar,islist::Vector{IS},dmlist::Vector{PetscDM} = DMCreateFieldDecomposition(petsclib::PetscLibType,dm::PetscDM) +Returns a list of `IS` objects defining a decomposition of a problem into subproblems +corresponding to different fields. + +Not Collective; No Fortran Support + +Input Parameter: +- `dm` - the `DM` object + +Output Parameters: +- `len` - The number of fields (or `NULL` if not requested) +- `namelist` - The name for each field (or `NULL` if not requested) +- `islist` - The global indices for each field (or `NULL` if not requested) +- `dmlist` - The `DM`s for each field subproblem (or `NULL`, if not requested; if `NULL` is returned, no `DM`s are defined) + +Level: intermediate + +Notes: +Each `IS` contains the global indices of the dofs of the corresponding field, defined by +`DMAddField()`. The optional list of `DM`s define the `DM` for each subproblem. + +The same as `DMCreateFieldIS()` but also returns a `DM` for each field. + +The user is responsible for freeing all requested arrays. In particular, every entry of `namelist` should be freed with +`PetscFree()`, every entry of `islist` should be destroyed with `ISDestroy()`, every entry of `dmlist` should be destroyed with `DMDestroy()`, +and all of the arrays should be freed with `PetscFree()`. + +Fortran Notes: +Use the declarations +-vb +character(80), pointer :: namelist(:) +IS, pointer :: islist(:) +DM, pointer :: dmlist(:) +-ve + +`namelist` must be provided, `islist` may be `PETSC_NULL_IS_POINTER` and `dmlist` may be `PETSC_NULL_DM_POINTER` + +Use `DMDestroyFieldDecomposition()` to free the returned objects + +Developer Notes: +It is not clear why this function and `DMCreateFieldIS()` exist. Having two seems redundant and confusing. + +Unlike `DMRefine()`, `DMCoarsen()`, and `DMCreateDomainDecomposition()` this provides no mechanism to provide hooks that are called after the +decomposition is computed. + +See also: +=== +`DM`, `DMAddField()`, `DMCreateFieldIS()`, `DMCreateSubDM()`, `DMCreateDomainDecomposition()`, `DMDestroy()`, `DMView()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMRefine()`, `DMCoarsen()` + +# External Links +$(_doc_external("DM/DMCreateFieldDecomposition")) +""" +function DMCreateFieldDecomposition(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMCreateFieldDecomposition(petsclib::$UnionPetscLib, dm::PetscDM ) + len_ = Ref{$PetscInt}() + namelist_ = Ref{Cchar}() + islist_ = Ref{Ptr{CIS}}() + dmlist_ = Ref{Ptr{PetscDM}}() + + @chk ccall( + (:DMCreateFieldDecomposition, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Cchar, Ptr{Ptr{CIS}}, Ptr{Ptr{CDM}}), + dm, len_, namelist_, islist_, dmlist_, + ) + + len = len_[] + namelist = namelist_[] + islist = unsafe_wrap(Array, islist_[], VecGetLocalSize(petsclib, x); own = false) + dmlist = unsafe_wrap(Array, dmlist_[], VecGetLocalSize(petsclib, x); own = false) + + return len,namelist,islist,dmlist +end + +""" + is::IS,subdm::PetscDM = DMCreateSubDM(petsclib::PetscLibType,dm::PetscDM, numFields::PetscInt, fields::Vector{PetscInt}) +Returns an `IS` and `DM` encapsulating a subproblem defined by the fields passed in. +The fields are defined by `DMCreateFieldIS()`. + +Not collective + +Input Parameters: +- `dm` - The `DM` object +- `numFields` - The number of fields to select +- `fields` - The field numbers of the selected fields + +Output Parameters: +- `is` - The global indices for all the degrees of freedom in the new sub `DM`, use `NULL` if not needed +- `subdm` - The `DM` for the subproblem, use `NULL` if not needed + +Level: intermediate + +Note: +You need to call `DMPlexSetMigrationSF()` on the original `DM` if you want the Global-To-Natural map to be automatically constructed + +See also: +=== +`DM`, `DMCreateFieldIS()`, `DMCreateFieldDecomposition()`, `DMAddField()`, `DMCreateSuperDM()`, `IS`, `VecISCopy()`, `DMPlexSetMigrationSF()`, `DMDestroy()`, `DMView()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()` + +# External Links +$(_doc_external("DM/DMCreateSubDM")) +""" +function DMCreateSubDM(petsclib::PetscLibType, dm::PetscDM, numFields::PetscInt, fields::Vector{PetscInt}) end + +@for_petsc function DMCreateSubDM(petsclib::$UnionPetscLib, dm::PetscDM, numFields::$PetscInt, fields::Vector{$PetscInt} ) + is_ = Ref{IS}() + subdm_ = Ref{CDM}() + + @chk ccall( + (:DMCreateSubDM, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{CIS}, Ptr{CDM}), + dm, numFields, fields, is_, subdm_, + ) + + is = is_[] + subdm = PetscDM(subdm_[], petsclib) + + return is,subdm +end + +""" + is::Vector{IS},superdm::PetscDM = DMCreateSuperDM(petsclib::PetscLibType,dms::Vector{PetscDM}, n::PetscInt) +Returns an arrays of `IS` and a single `DM` encapsulating a superproblem defined by multiple `DM`s passed in. + +Not collective + +Input Parameters: +- `dms` - The `DM` objects +- `n` - The number of `DM`s + +Output Parameters: +- `is` - The global indices for each of subproblem within the super `DM`, or `NULL`, its length is `n` +- `superdm` - The `DM` for the superproblem + +Level: intermediate + +Note: +You need to call `DMPlexSetMigrationSF()` on the original `DM` if you want the Global-To-Natural map to be automatically constructed + +See also: +=== +`DM`, `DMCreateSubDM()`, `DMPlexSetMigrationSF()`, `DMDestroy()`, `DMView()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMCreateFieldIS()`, `DMCreateDomainDecomposition()` + +# External Links +$(_doc_external("DM/DMCreateSuperDM")) +""" +function DMCreateSuperDM(petsclib::PetscLibType, dms::Vector{PetscDM}, n::PetscInt) end + +@for_petsc function DMCreateSuperDM(petsclib::$UnionPetscLib, dms::Vector{PetscDM}, n::$PetscInt ) + is_ = Ref{Ptr{CIS}}() + superdm_ = Ref{CDM}() + + @chk ccall( + (:DMCreateSuperDM, $petsc_library), + PetscErrorCode, + (Ptr{CDM}, $PetscInt, Ptr{Ptr{CIS}}, Ptr{CDM}), + dms, n, is_, superdm_, + ) + + is = unsafe_wrap(Array, is_[], VecGetLocalSize(petsclib, x); own = false) + superdm = PetscDM(superdm_[], petsclib) + + return is,superdm +end + +""" + n::PetscInt,namelist::Cchar,innerislist::Vector{IS},outerislist::Vector{IS},dmlist::Vector{PetscDM} = DMCreateDomainDecomposition(petsclib::PetscLibType,dm::PetscDM) +Returns lists of `IS` objects defining a decomposition of a +problem into subproblems corresponding to restrictions to pairs of nested subdomains. + +Not Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameters: +- `n` - The number of subproblems in the domain decomposition (or `NULL` if not requested), also the length of the four arrays below +- `namelist` - The name for each subdomain (or `NULL` if not requested) +- `innerislist` - The global indices for each inner subdomain (or `NULL`, if not requested) +- `outerislist` - The global indices for each outer subdomain (or `NULL`, if not requested) +- `dmlist` - The `DM`s for each subdomain subproblem (or `NULL`, if not requested; if `NULL` is returned, no `DM`s are defined) + +Level: intermediate + +Notes: +Each `IS` contains the global indices of the dofs of the corresponding subdomains with in the +dofs of the original `DM`. The inner subdomains conceptually define a nonoverlapping +covering, while outer subdomains can overlap. + +The optional list of `DM`s define a `DM` for each subproblem. + +The user is responsible for freeing all requested arrays. In particular, every entry of `namelist` should be freed with +`PetscFree()`, every entry of `innerislist` and `outerislist` should be destroyed with `ISDestroy()`, every entry of `dmlist` should be destroyed with `DMDestroy()`, +and all of the arrays should be freed with `PetscFree()`. + +Developer Notes: +The `dmlist` is for the inner subdomains or the outer subdomains or all subdomains? + +The names are inconsistent, the hooks use `DMSubDomainHook` which is nothing like `DMCreateDomainDecomposition()` while `DMRefineHook` is used for `DMRefine()`. + +See also: +=== +`DM`, `DMCreateFieldDecomposition()`, `DMDestroy()`, `DMCreateDomainDecompositionScatters()`, `DMView()`, `DMCreateInterpolation()`, +`DMSubDomainHookAdd()`, `DMSubDomainHookRemove()`,`DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMRefine()`, `DMCoarsen()` + +# External Links +$(_doc_external("DM/DMCreateDomainDecomposition")) +""" +function DMCreateDomainDecomposition(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMCreateDomainDecomposition(petsclib::$UnionPetscLib, dm::PetscDM ) + n_ = Ref{$PetscInt}() + namelist_ = Ref{Cchar}() + innerislist_ = Ref{Ptr{CIS}}() + outerislist_ = Ref{Ptr{CIS}}() + dmlist_ = Ref{Ptr{PetscDM}}() + + @chk ccall( + (:DMCreateDomainDecomposition, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Cchar, Ptr{Ptr{CIS}}, Ptr{Ptr{CIS}}, Ptr{Ptr{CDM}}), + dm, n_, namelist_, innerislist_, outerislist_, dmlist_, + ) + + n = n_[] + namelist = namelist_[] + innerislist = unsafe_wrap(Array, innerislist_[], VecGetLocalSize(petsclib, x); own = false) + outerislist = unsafe_wrap(Array, outerislist_[], VecGetLocalSize(petsclib, x); own = false) + dmlist = unsafe_wrap(Array, dmlist_[], VecGetLocalSize(petsclib, x); own = false) + + return n,namelist,innerislist,outerislist,dmlist +end + +""" + iscat::Vector{VecScatter},oscat::Vector{VecScatter},gscat::Vector{VecScatter} = DMCreateDomainDecompositionScatters(petsclib::PetscLibType,dm::PetscDM, n::PetscInt, subdms::PetscDM) +Returns scatters to the subdomain vectors from the global vector for subdomains created with +`DMCreateDomainDecomposition()` + +Not Collective + +Input Parameters: +- `dm` - the `DM` object +- `n` - the number of subdomains +- `subdms` - the local subdomains + +Output Parameters: +- `iscat` - scatter from global vector to nonoverlapping global vector entries on subdomain +- `oscat` - scatter from global vector to overlapping global vector entries on subdomain +- `gscat` - scatter from global vector to local vector on subdomain (fills in ghosts) + +Level: developer + +Note: +This is an alternative to the iis and ois arguments in `DMCreateDomainDecomposition()` that allow for the solution +of general nonlinear problems with overlapping subdomain methods. While merely having index sets that enable subsets +of the residual equations to be created is fine for linear problems, nonlinear problems require local assembly of +solution and residual data. + +Developer Note: +Can the subdms input be anything or are they exactly the `DM` obtained from +`DMCreateDomainDecomposition()`? + +See also: +=== +`DM`, `DMCreateDomainDecomposition()`, `DMDestroy()`, `DMView()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMCreateFieldIS()` + +# External Links +$(_doc_external("DM/DMCreateDomainDecompositionScatters")) +""" +function DMCreateDomainDecompositionScatters(petsclib::PetscLibType, dm::PetscDM, n::PetscInt, subdms::PetscDM) end + +@for_petsc function DMCreateDomainDecompositionScatters(petsclib::$UnionPetscLib, dm::PetscDM, n::$PetscInt, subdms::PetscDM ) + subdms_ = Ref(subdms.ptr) + iscat_ = Ref{Ptr{VecScatter}}() + oscat_ = Ref{Ptr{VecScatter}}() + gscat_ = Ref{Ptr{VecScatter}}() + + @chk ccall( + (:DMCreateDomainDecompositionScatters, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CDM}, Ptr{Ptr{VecScatter}}, Ptr{Ptr{VecScatter}}, Ptr{Ptr{VecScatter}}), + dm, n, subdms_, iscat_, oscat_, gscat_, + ) + + subdms.ptr = subdms_[] + iscat = unsafe_wrap(Array, iscat_[], VecGetLocalSize(petsclib, x); own = false) + oscat = unsafe_wrap(Array, oscat_[], VecGetLocalSize(petsclib, x); own = false) + gscat = unsafe_wrap(Array, gscat_[], VecGetLocalSize(petsclib, x); own = false) + + return iscat,oscat,gscat +end + +""" + DMRefine(petsclib::PetscLibType,dm::PetscDM, comm::MPI_Comm, dmf::PetscDM) +Refines a `DM` object using a standard nonadaptive refinement of the underlying mesh + +Collective + +Input Parameters: +- `dm` - the `DM` object +- `comm` - the communicator to contain the new `DM` object (or `MPI_COMM_NULL`) + +Output Parameter: +- `dmf` - the refined `DM`, or `NULL` + +Options Database Key: +- `-dm_plex_cell_refiner ` - chooses the refinement strategy, e.g. regular, tohex + +Level: developer + +Note: +If no refinement was done, the return value is `NULL` + +See also: +=== +`DM`, `DMCoarsen()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateDomainDecomposition()`, +`DMRefineHookAdd()`, `DMRefineHookRemove()` + +# External Links +$(_doc_external("DM/DMRefine")) +""" +function DMRefine(petsclib::PetscLibType, dm::PetscDM, comm::MPI_Comm, dmf::PetscDM) end + +@for_petsc function DMRefine(petsclib::$UnionPetscLib, dm::PetscDM, comm::MPI_Comm, dmf::PetscDM ) + dmf_ = Ref(dmf.ptr) + + @chk ccall( + (:DMRefine, $petsc_library), + PetscErrorCode, + (CDM, MPI_Comm, Ptr{CDM}), + dm, comm, dmf_, + ) + + dmf.ptr = dmf_[] + + return nothing +end + +""" + DMRefineHookAdd(petsclib::PetscLibType,coarse::PetscDM, refinehook::external, interphook::external, ctx::Cvoid) +adds a callback to be run when interpolating a nonlinear problem to a finer grid + +Logically Collective; No Fortran Support + +Input Parameters: +- `coarse` - `DM` on which to run a hook when interpolating to a finer level +- `refinehook` - function to run when setting up the finer level +- `interphook` - function to run to update data on finer levels (once per `SNESSolve()`) +- `ctx` - [optional] user-defined context for provide data for the hooks (may be `NULL`) + +Calling sequence of `refinehook`: +- `coarse` - coarse level `DM` +- `fine` - fine level `DM` to interpolate problem to +- `ctx` - optional user-defined function context + +Calling sequence of `interphook`: +- `coarse` - coarse level `DM` +- `interp` - matrix interpolating a coarse-level solution to the finer grid +- `fine` - fine level `DM` to update +- `ctx` - optional user-defined function context + +Level: advanced + +Notes: +This function is only needed if auxiliary data that is attached to the `DM`s via, for example, `PetscObjectCompose()`, needs to be +passed to fine grids while grid sequencing. + +The actual interpolation is done when `DMInterpolate()` is called. + +If this function is called multiple times, the hooks will be run in the order they are added. + +See also: +=== +`DM`, `DMCoarsenHookAdd()`, `DMInterpolate()`, `SNESFASGetInterpolation()`, `SNESFASGetInjection()`, `PetscObjectCompose()`, `PetscContainerCreate()` + +# External Links +$(_doc_external("DM/DMRefineHookAdd")) +""" +function DMRefineHookAdd(petsclib::PetscLibType, coarse::PetscDM, refinehook::external, interphook::external, ctx::Cvoid) end + +@for_petsc function DMRefineHookAdd(petsclib::$UnionPetscLib, coarse::PetscDM, refinehook::external, interphook::external, ctx::Cvoid ) + + @chk ccall( + (:DMRefineHookAdd, $petsc_library), + PetscErrorCode, + (CDM, external, external, Ptr{Cvoid}), + coarse, refinehook, interphook, ctx, + ) + + + return nothing +end + +""" + DMRefineHookRemove(petsclib::PetscLibType,coarse::PetscDM, refinehook::external, interphook::external, ctx::Cvoid) +remove a callback from the list of hooks, that have been set with `DMRefineHookAdd()`, to be run when interpolating +a nonlinear problem to a finer grid + +Logically Collective; No Fortran Support + +Input Parameters: +- `coarse` - the `DM` on which to run a hook when restricting to a coarser level +- `refinehook` - function to run when setting up a finer level +- `interphook` - function to run to update data on finer levels +- `ctx` - [optional] user-defined context for provide data for the hooks (may be `NULL`) + +Level: advanced + +Note: +This function does nothing if the hook is not in the list. + +See also: +=== +`DM`, `DMRefineHookAdd()`, `DMCoarsenHookRemove()`, `DMInterpolate()`, `SNESFASGetInterpolation()`, `SNESFASGetInjection()`, `PetscObjectCompose()`, `PetscContainerCreate()` + +# External Links +$(_doc_external("DM/DMRefineHookRemove")) +""" +function DMRefineHookRemove(petsclib::PetscLibType, coarse::PetscDM, refinehook::external, interphook::external, ctx::Cvoid) end + +@for_petsc function DMRefineHookRemove(petsclib::$UnionPetscLib, coarse::PetscDM, refinehook::external, interphook::external, ctx::Cvoid ) + + @chk ccall( + (:DMRefineHookRemove, $petsc_library), + PetscErrorCode, + (CDM, external, external, Ptr{Cvoid}), + coarse, refinehook, interphook, ctx, + ) + + + return nothing +end + +""" + DMInterpolate(petsclib::PetscLibType,coarse::PetscDM, interp::PetscMat, fine::PetscDM) +interpolates user + +Collective if any hooks are + +Input Parameters: +- `coarse` - coarser `DM` to use as a base +- `interp` - interpolation matrix, apply using `MatInterpolate()` +- `fine` - finer `DM` to update + +Level: developer + +Developer Note: +This routine is called `DMInterpolate()` while the hook is called `DMRefineHookAdd()`. It would be better to have an +an API with consistent terminology. + +See also: +=== +`DM`, `DMRefineHookAdd()`, `MatInterpolate()` + +# External Links +$(_doc_external("DM/DMInterpolate")) +""" +function DMInterpolate(petsclib::PetscLibType, coarse::PetscDM, interp::PetscMat, fine::PetscDM) end + +@for_petsc function DMInterpolate(petsclib::$UnionPetscLib, coarse::PetscDM, interp::PetscMat, fine::PetscDM ) + + @chk ccall( + (:DMInterpolate, $petsc_library), + PetscErrorCode, + (CDM, CMat, CDM), + coarse, interp, fine, + ) + + + return nothing +end + +""" + DMInterpolateSolution(petsclib::PetscLibType,coarse::PetscDM, fine::PetscDM, interp::PetscMat, coarseSol::PetscVec, fineSol::PetscVec) +Interpolates a solution from a coarse mesh to a fine mesh. + +Collective + +Input Parameters: +- `coarse` - coarse `DM` +- `fine` - fine `DM` +- `interp` - (optional) the matrix computed by `DMCreateInterpolation()`. Implementations may not need this, but if it +is available it can avoid some recomputation. If it is provided, `MatInterpolate()` will be used if +the coarse `DM` does not have a specialized implementation. +- `coarseSol` - solution on the coarse mesh + +Output Parameter: +- `fineSol` - the interpolation of coarseSol to the fine mesh + +Level: developer + +Note: +This function exists because the interpolation of a solution vector between meshes is not always a linear +map. For example, if a boundary value problem has an inhomogeneous Dirichlet boundary condition that is compressed +out of the solution vector. Or if interpolation is inherently a nonlinear operation, such as a method using +slope-limiting reconstruction. + +Developer Note: +This doesn't just interpolate "solutions" so its API name is questionable. + +See also: +=== +`DM`, `DMInterpolate()`, `DMCreateInterpolation()` + +# External Links +$(_doc_external("DM/DMInterpolateSolution")) +""" +function DMInterpolateSolution(petsclib::PetscLibType, coarse::PetscDM, fine::PetscDM, interp::PetscMat, coarseSol::PetscVec, fineSol::PetscVec) end + +@for_petsc function DMInterpolateSolution(petsclib::$UnionPetscLib, coarse::PetscDM, fine::PetscDM, interp::PetscMat, coarseSol::PetscVec, fineSol::PetscVec ) + + @chk ccall( + (:DMInterpolateSolution, $petsc_library), + PetscErrorCode, + (CDM, CDM, CMat, CVec, CVec), + coarse, fine, interp, coarseSol, fineSol, + ) + + + return nothing +end + +""" + level::PetscInt = DMGetRefineLevel(petsclib::PetscLibType,dm::PetscDM) +Gets the number of refinements that have generated this `DM` from some initial `DM`. + +Not Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameter: +- `level` - number of refinements + +Level: developer + +Note: +This can be used, by example, to set the number of coarser levels associated with this `DM` for a multigrid solver. + +See also: +=== +`DM`, `DMRefine()`, `DMCoarsen()`, `DMGetCoarsenLevel()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()` + +# External Links +$(_doc_external("DM/DMGetRefineLevel")) +""" +function DMGetRefineLevel(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetRefineLevel(petsclib::$UnionPetscLib, dm::PetscDM ) + level_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetRefineLevel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, level_, + ) + + level = level_[] + + return level +end + +""" + DMSetRefineLevel(petsclib::PetscLibType,dm::PetscDM, level::PetscInt) +Sets the number of refinements that have generated this `DM`. + +Not Collective + +Input Parameters: +- `dm` - the `DM` object +- `level` - number of refinements + +Level: advanced + +Notes: +This value is used by `PCMG` to determine how many multigrid levels to use + +The values are usually set automatically by the process that is causing the refinements of an initial `DM` by calling this routine. + +See also: +=== +`DM`, `DMGetRefineLevel()`, `DMCoarsen()`, `DMGetCoarsenLevel()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()` + +# External Links +$(_doc_external("DM/DMSetRefineLevel")) +""" +function DMSetRefineLevel(petsclib::PetscLibType, dm::PetscDM, level::PetscInt) end + +@for_petsc function DMSetRefineLevel(petsclib::$UnionPetscLib, dm::PetscDM, level::$PetscInt ) + + @chk ccall( + (:DMSetRefineLevel, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, level, + ) + + + return nothing +end + +""" + DMExtrude(petsclib::PetscLibType,dm::PetscDM, layers::PetscInt, dme::PetscDM) +Extrude a `DM` object from a surface + +Collective + +Input Parameters: +- `dm` - the `DM` object +- `layers` - the number of extruded cell layers + +Output Parameter: +- `dme` - the extruded `DM`, or `NULL` + +Level: developer + +Note: +If no extrusion was done, the return value is `NULL` + +See also: +=== +`DM`, `DMRefine()`, `DMCoarsen()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()` + +# External Links +$(_doc_external("DM/DMExtrude")) +""" +function DMExtrude(petsclib::PetscLibType, dm::PetscDM, layers::PetscInt, dme::PetscDM) end + +@for_petsc function DMExtrude(petsclib::$UnionPetscLib, dm::PetscDM, layers::$PetscInt, dme::PetscDM ) + dme_ = Ref(dme.ptr) + + @chk ccall( + (:DMExtrude, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CDM}), + dm, layers, dme_, + ) + + dme.ptr = dme_[] + + return nothing +end + +""" + flg::PetscBool = DMHasBasisTransform(petsclib::PetscLibType,dm::PetscDM) +Whether the `DM` employs a basis transformation from functions in global vectors to functions in local vectors + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `flg` - `PETSC_TRUE` if a basis transformation should be done + +Level: developer + +See also: +=== +`DM`, `DMPlexGlobalToLocalBasis()`, `DMPlexLocalToGlobalBasis()`, `DMPlexCreateBasisRotation()` + +# External Links +$(_doc_external("DM/DMHasBasisTransform")) +""" +function DMHasBasisTransform(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMHasBasisTransform(petsclib::$UnionPetscLib, dm::PetscDM ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:DMHasBasisTransform, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + DMCopyTransform(petsclib::PetscLibType,dm::PetscDM, newdm::PetscDM) + +# External Links +$(_doc_external("DM/DMCopyTransform")) +""" +function DMCopyTransform(petsclib::PetscLibType, dm::PetscDM, newdm::PetscDM) end + +@for_petsc function DMCopyTransform(petsclib::$UnionPetscLib, dm::PetscDM, newdm::PetscDM ) + + @chk ccall( + (:DMCopyTransform, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dm, newdm, + ) + + + return nothing +end + +""" + DMGlobalToLocalHookAdd(petsclib::PetscLibType,dm::PetscDM, beginhook::external, endhook::external, ctx::Cvoid) +adds a callback to be run when `DMGlobalToLocal()` is called + +Logically Collective + +Input Parameters: +- `dm` - the `DM` +- `beginhook` - function to run at the beginning of `DMGlobalToLocalBegin()` +- `endhook` - function to run after `DMGlobalToLocalEnd()` has completed +- `ctx` - [optional] user-defined context for provide data for the hooks (may be `NULL`) + +Calling sequence of `beginhook`: +- `dm` - global `DM` +- `g` - global vector +- `mode` - mode +- `l` - local vector +- `ctx` - optional user-defined function context + +Calling sequence of `endhook`: +- `dm` - global `DM` +- `g` - global vector +- `mode` - mode +- `l` - local vector +- `ctx` - optional user-defined function context + +Level: advanced + +Note: +The hook may be used to provide, for example, values that represent boundary conditions in the local vectors that do not exist on the global vector. + +See also: +=== +`DM`, `DMGlobalToLocal()`, `DMRefineHookAdd()`, `SNESFASGetInterpolation()`, `SNESFASGetInjection()`, `PetscObjectCompose()`, `PetscContainerCreate()` + +# External Links +$(_doc_external("DM/DMGlobalToLocalHookAdd")) +""" +function DMGlobalToLocalHookAdd(petsclib::PetscLibType, dm::PetscDM, beginhook::external, endhook::external, ctx::Cvoid) end + +@for_petsc function DMGlobalToLocalHookAdd(petsclib::$UnionPetscLib, dm::PetscDM, beginhook::external, endhook::external, ctx::Cvoid ) + + @chk ccall( + (:DMGlobalToLocalHookAdd, $petsc_library), + PetscErrorCode, + (CDM, external, external, Ptr{Cvoid}), + dm, beginhook, endhook, ctx, + ) + + + return nothing +end + +""" + DMGlobalToLocal(petsclib::PetscLibType,dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) +update local vectors from global vector + +Neighbor-wise Collective + +Input Parameters: +- `dm` - the `DM` object +- `g` - the global vector +- `mode` - `INSERT_VALUES` or `ADD_VALUES` +- `l` - the local vector + +Level: beginner + +Notes: +The communication involved in this update can be overlapped with computation by instead using +`DMGlobalToLocalBegin()` and `DMGlobalToLocalEnd()`. + +`DMGlobalToLocalHookAdd()` may be used to provide additional operations that are performed during the update process. + +See also: +=== +`DM`, `DMGlobalToLocalHookAdd()`, `DMCoarsen()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, +`DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMLocalToGlobal()`, `DMLocalToGlobalEnd()`, +`DMGlobalToLocalBegin()` `DMGlobalToLocalEnd()` + +# External Links +$(_doc_external("DM/DMGlobalToLocal")) +""" +function DMGlobalToLocal(petsclib::PetscLibType, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) end + +@for_petsc function DMGlobalToLocal(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec ) + + @chk ccall( + (:DMGlobalToLocal, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, g, mode, l, + ) + + + return nothing +end + +""" + DMGlobalToLocalBegin(petsclib::PetscLibType,dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) +Begins updating local vectors from global vector + +Neighbor-wise Collective + +Input Parameters: +- `dm` - the `DM` object +- `g` - the global vector +- `mode` - `INSERT_VALUES` or `ADD_VALUES` +- `l` - the local vector + +Level: intermediate + +Notes: +The operation is completed with `DMGlobalToLocalEnd()` + +One can perform local computations between the `DMGlobalToLocalBegin()` and `DMGlobalToLocalEnd()` to overlap communication and computation + +`DMGlobalToLocal()` is a short form of `DMGlobalToLocalBegin()` and `DMGlobalToLocalEnd()` + +`DMGlobalToLocalHookAdd()` may be used to provide additional operations that are performed during the update process. + +See also: +=== +`DM`, `DMCoarsen()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMGlobalToLocal()`, `DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMLocalToGlobal()`, `DMLocalToGlobalEnd()` + +# External Links +$(_doc_external("DM/DMGlobalToLocalBegin")) +""" +function DMGlobalToLocalBegin(petsclib::PetscLibType, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) end + +@for_petsc function DMGlobalToLocalBegin(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec ) + + @chk ccall( + (:DMGlobalToLocalBegin, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, g, mode, l, + ) + + + return nothing +end + +""" + DMGlobalToLocalEnd(petsclib::PetscLibType,dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) +Ends updating local vectors from global vector + +Neighbor-wise Collective + +Input Parameters: +- `dm` - the `DM` object +- `g` - the global vector +- `mode` - `INSERT_VALUES` or `ADD_VALUES` +- `l` - the local vector + +Level: intermediate + +Note: +See `DMGlobalToLocalBegin()` for details. + +See also: +=== +`DM`, `DMCoarsen()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMGlobalToLocal()`, `DMLocalToGlobalBegin()`, `DMLocalToGlobal()`, `DMLocalToGlobalEnd()` + +# External Links +$(_doc_external("DM/DMGlobalToLocalEnd")) +""" +function DMGlobalToLocalEnd(petsclib::PetscLibType, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) end + +@for_petsc function DMGlobalToLocalEnd(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec ) + + @chk ccall( + (:DMGlobalToLocalEnd, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, g, mode, l, + ) + + + return nothing +end + +""" + DMLocalToGlobalHookAdd(petsclib::PetscLibType,dm::PetscDM, beginhook::external, endhook::external, ctx::Cvoid) +adds a callback to be run when a local to global is called + +Logically Collective + +Input Parameters: +- `dm` - the `DM` +- `beginhook` - function to run at the beginning of `DMLocalToGlobalBegin()` +- `endhook` - function to run after `DMLocalToGlobalEnd()` has completed +- `ctx` - [optional] user-defined context for provide data for the hooks (may be `NULL`) + +Calling sequence of `beginhook`: +- `global` - global `DM` +- `l` - local vector +- `mode` - mode +- `g` - global vector +- `ctx` - optional user-defined function context + +Calling sequence of `endhook`: +- `global` - global `DM` +- `l` - local vector +- `mode` - mode +- `g` - global vector +- `ctx` - optional user-defined function context + +Level: advanced + +See also: +=== +`DM`, `DMLocalToGlobal()`, `DMRefineHookAdd()`, `DMGlobalToLocalHookAdd()`, `SNESFASGetInterpolation()`, `SNESFASGetInjection()`, `PetscObjectCompose()`, `PetscContainerCreate()` + +# External Links +$(_doc_external("DM/DMLocalToGlobalHookAdd")) +""" +function DMLocalToGlobalHookAdd(petsclib::PetscLibType, dm::PetscDM, beginhook::external, endhook::external, ctx::Cvoid) end + +@for_petsc function DMLocalToGlobalHookAdd(petsclib::$UnionPetscLib, dm::PetscDM, beginhook::external, endhook::external, ctx::Cvoid ) + + @chk ccall( + (:DMLocalToGlobalHookAdd, $petsc_library), + PetscErrorCode, + (CDM, external, external, Ptr{Cvoid}), + dm, beginhook, endhook, ctx, + ) + + + return nothing +end + +""" + DMLocalToGlobal(petsclib::PetscLibType,dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec) +updates global vectors from local vectors + +Neighbor-wise Collective + +Input Parameters: +- `dm` - the `DM` object +- `l` - the local vector +- `mode` - if `INSERT_VALUES` then no parallel communication is used, if `ADD_VALUES` then all ghost points from the same base point accumulate into that base point. +- `g` - the global vector + +Level: beginner + +Notes: +The communication involved in this update can be overlapped with computation by using +`DMLocalToGlobalBegin()` and `DMLocalToGlobalEnd()`. + +In the `ADD_VALUES` case you normally would zero the receiving vector before beginning this operation. + +`INSERT_VALUES` is not supported for `DMDA`; in that case simply compute the values directly into a global vector instead of a local one. + +Use `DMLocalToGlobalHookAdd()` to add additional operations that are performed on the data during the update process + +See also: +=== +`DM`, `DMLocalToGlobalBegin()`, `DMLocalToGlobalEnd()`, `DMCoarsen()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMGlobalToLocal()`, `DMGlobalToLocalEnd()`, `DMGlobalToLocalBegin()`, `DMLocalToGlobalHookAdd()`, `DMGlobaToLocallHookAdd()` + +# External Links +$(_doc_external("DM/DMLocalToGlobal")) +""" +function DMLocalToGlobal(petsclib::PetscLibType, dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec) end + +@for_petsc function DMLocalToGlobal(petsclib::$UnionPetscLib, dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec ) + + @chk ccall( + (:DMLocalToGlobal, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, l, mode, g, + ) + + + return nothing +end + +""" + DMLocalToGlobalBegin(petsclib::PetscLibType,dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec) +begins updating global vectors from local vectors + +Neighbor-wise Collective + +Input Parameters: +- `dm` - the `DM` object +- `l` - the local vector +- `mode` - if `INSERT_VALUES` then no parallel communication is used, if `ADD_VALUES` then all ghost points from the same base point accumulate into that base point. +- `g` - the global vector + +Level: intermediate + +Notes: +In the `ADD_VALUES` case you normally would zero the receiving vector before beginning this operation. + +`INSERT_VALUES is` not supported for `DMDA`, in that case simply compute the values directly into a global vector instead of a local one. + +Use `DMLocalToGlobalEnd()` to complete the communication process. + +`DMLocalToGlobal()` is a short form of `DMLocalToGlobalBegin()` and `DMLocalToGlobalEnd()` + +`DMLocalToGlobalHookAdd()` may be used to provide additional operations that are performed during the update process. + +See also: +=== +`DM`, `DMLocalToGlobal()`, `DMLocalToGlobalEnd()`, `DMCoarsen()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMGlobalToLocal()`, `DMGlobalToLocalEnd()`, `DMGlobalToLocalBegin()` + +# External Links +$(_doc_external("DM/DMLocalToGlobalBegin")) +""" +function DMLocalToGlobalBegin(petsclib::PetscLibType, dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec) end + +@for_petsc function DMLocalToGlobalBegin(petsclib::$UnionPetscLib, dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec ) + + @chk ccall( + (:DMLocalToGlobalBegin, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, l, mode, g, + ) + + + return nothing +end + +""" + DMLocalToGlobalEnd(petsclib::PetscLibType,dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec) +updates global vectors from local vectors + +Neighbor-wise Collective + +Input Parameters: +- `dm` - the `DM` object +- `l` - the local vector +- `mode` - `INSERT_VALUES` or `ADD_VALUES` +- `g` - the global vector + +Level: intermediate + +Note: +See `DMLocalToGlobalBegin()` for full details + +See also: +=== +`DM`, `DMLocalToGlobalBegin()`, `DMCoarsen()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMGlobalToLocalEnd()` + +# External Links +$(_doc_external("DM/DMLocalToGlobalEnd")) +""" +function DMLocalToGlobalEnd(petsclib::PetscLibType, dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec) end + +@for_petsc function DMLocalToGlobalEnd(petsclib::$UnionPetscLib, dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec ) + + @chk ccall( + (:DMLocalToGlobalEnd, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, l, mode, g, + ) + + + return nothing +end + +""" + DMLocalToLocalBegin(petsclib::PetscLibType,dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) +Begins the process of mapping values from a local vector (that include +ghost points that contain irrelevant values) to another local vector where the ghost points +in the second are set correctly from values on other MPI ranks. + +Neighbor-wise Collective + +Input Parameters: +- `dm` - the `DM` object +- `g` - the original local vector +- `mode` - one of `INSERT_VALUES` or `ADD_VALUES` + +Output Parameter: +- `l` - the local vector with correct ghost values + +Level: intermediate + +Note: +Must be followed by `DMLocalToLocalEnd()`. + +See also: +=== +`DM`, `DMLocalToLocalEnd()`, `DMCoarsen()`, `DMDestroy()`, `DMView()`, `DMCreateLocalVector()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()` + +# External Links +$(_doc_external("DM/DMLocalToLocalBegin")) +""" +function DMLocalToLocalBegin(petsclib::PetscLibType, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) end + +@for_petsc function DMLocalToLocalBegin(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec ) + + @chk ccall( + (:DMLocalToLocalBegin, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, g, mode, l, + ) + + + return nothing +end + +""" + DMLocalToLocalEnd(petsclib::PetscLibType,dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) +Maps from a local vector to another local vector where the ghost +points in the second are set correctly. Must be preceded by `DMLocalToLocalBegin()`. + +Neighbor-wise Collective + +Input Parameters: +- `dm` - the `DM` object +- `g` - the original local vector +- `mode` - one of `INSERT_VALUES` or `ADD_VALUES` + +Output Parameter: +- `l` - the local vector with correct ghost values + +Level: intermediate + +See also: +=== +`DM`, `DMLocalToLocalBegin()`, `DMCoarsen()`, `DMDestroy()`, `DMView()`, `DMCreateLocalVector()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()` + +# External Links +$(_doc_external("DM/DMLocalToLocalEnd")) +""" +function DMLocalToLocalEnd(petsclib::PetscLibType, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) end + +@for_petsc function DMLocalToLocalEnd(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec ) + + @chk ccall( + (:DMLocalToLocalEnd, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, g, mode, l, + ) + + + return nothing +end + +""" + DMCoarsen(petsclib::PetscLibType,dm::PetscDM, comm::MPI_Comm, dmc::PetscDM) +Coarsens a `DM` object using a standard, non + +Collective + +Input Parameters: +- `dm` - the `DM` object +- `comm` - the communicator to contain the new `DM` object (or `MPI_COMM_NULL`) + +Output Parameter: +- `dmc` - the coarsened `DM` + +Level: developer + +See also: +=== +`DM`, `DMRefine()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateDomainDecomposition()`, +`DMCoarsenHookAdd()`, `DMCoarsenHookRemove()` + +# External Links +$(_doc_external("DM/DMCoarsen")) +""" +function DMCoarsen(petsclib::PetscLibType, dm::PetscDM, comm::MPI_Comm, dmc::PetscDM) end + +@for_petsc function DMCoarsen(petsclib::$UnionPetscLib, dm::PetscDM, comm::MPI_Comm, dmc::PetscDM ) + dmc_ = Ref(dmc.ptr) + + @chk ccall( + (:DMCoarsen, $petsc_library), + PetscErrorCode, + (CDM, MPI_Comm, Ptr{CDM}), + dm, comm, dmc_, + ) + + dmc.ptr = dmc_[] + + return nothing +end + +""" + DMCoarsenHookAdd(petsclib::PetscLibType,fine::PetscDM, coarsenhook::external, restricthook::external, ctx::Cvoid) +adds a callback to be run when restricting a nonlinear problem to the coarse grid + +Logically Collective; No Fortran Support + +Input Parameters: +- `fine` - `DM` on which to run a hook when restricting to a coarser level +- `coarsenhook` - function to run when setting up a coarser level +- `restricthook` - function to run to update data on coarser levels (called once per `SNESSolve()`) +- `ctx` - [optional] user-defined context for provide data for the hooks (may be `NULL`) + +Calling sequence of `coarsenhook`: +- `fine` - fine level `DM` +- `coarse` - coarse level `DM` to restrict problem to +- `ctx` - optional user-defined function context + +Calling sequence of `restricthook`: +- `fine` - fine level `DM` +- `mrestrict` - matrix restricting a fine-level solution to the coarse grid, usually the transpose of the interpolation +- `rscale` - scaling vector for restriction +- `inject` - matrix restricting by injection +- `coarse` - coarse level DM to update +- `ctx` - optional user-defined function context + +Level: advanced + +Notes: +This function is only needed if auxiliary data, attached to the `DM` with `PetscObjectCompose()`, needs to be set up or passed from the fine `DM` to the coarse `DM`. + +If this function is called multiple times, the hooks will be run in the order they are added. + +In order to compose with nonlinear preconditioning without duplicating storage, the hook should be implemented to +extract the finest level information from its context (instead of from the `SNES`). + +The hooks are automatically called by `DMRestrict()` + +See also: +=== +`DM`, `DMCoarsenHookRemove()`, `DMRefineHookAdd()`, `SNESFASGetInterpolation()`, `SNESFASGetInjection()`, `PetscObjectCompose()`, `PetscContainerCreate()` + +# External Links +$(_doc_external("DM/DMCoarsenHookAdd")) +""" +function DMCoarsenHookAdd(petsclib::PetscLibType, fine::PetscDM, coarsenhook::external, restricthook::external, ctx::Cvoid) end + +@for_petsc function DMCoarsenHookAdd(petsclib::$UnionPetscLib, fine::PetscDM, coarsenhook::external, restricthook::external, ctx::Cvoid ) + + @chk ccall( + (:DMCoarsenHookAdd, $petsc_library), + PetscErrorCode, + (CDM, external, external, Ptr{Cvoid}), + fine, coarsenhook, restricthook, ctx, + ) + + + return nothing +end + +""" + DMCoarsenHookRemove(petsclib::PetscLibType,fine::PetscDM, coarsenhook::external, restricthook::external, ctx::Cvoid) +remove a callback set with `DMCoarsenHookAdd()` + +Logically Collective; No Fortran Support + +Input Parameters: +- `fine` - `DM` on which to run a hook when restricting to a coarser level +- `coarsenhook` - function to run when setting up a coarser level +- `restricthook` - function to run to update data on coarser levels +- `ctx` - [optional] user-defined context for provide data for the hooks (may be `NULL`) + +Level: advanced + +Notes: +This function does nothing if the `coarsenhook` is not in the list. + +See `DMCoarsenHookAdd()` for the calling sequence of `coarsenhook` and `restricthook` + +See also: +=== +`DM`, `DMCoarsenHookAdd()`, `DMRefineHookAdd()`, `SNESFASGetInterpolation()`, `SNESFASGetInjection()`, `PetscObjectCompose()`, `PetscContainerCreate()` + +# External Links +$(_doc_external("DM/DMCoarsenHookRemove")) +""" +function DMCoarsenHookRemove(petsclib::PetscLibType, fine::PetscDM, coarsenhook::external, restricthook::external, ctx::Cvoid) end + +@for_petsc function DMCoarsenHookRemove(petsclib::$UnionPetscLib, fine::PetscDM, coarsenhook::external, restricthook::external, ctx::Cvoid ) + + @chk ccall( + (:DMCoarsenHookRemove, $petsc_library), + PetscErrorCode, + (CDM, external, external, Ptr{Cvoid}), + fine, coarsenhook, restricthook, ctx, + ) + + + return nothing +end + +""" + DMRestrict(petsclib::PetscLibType,fine::PetscDM, restrct::PetscMat, rscale::PetscVec, inject::PetscMat, coarse::PetscDM) +restricts user + +Collective if any hooks are + +Input Parameters: +- `fine` - finer `DM` from which the data is obtained +- `restrct` - restriction matrix, apply using `MatRestrict()`, usually the transpose of the interpolation +- `rscale` - scaling vector for restriction +- `inject` - injection matrix, also use `MatRestrict()` +- `coarse` - coarser `DM` to update + +Level: developer + +Developer Note: +Though this routine is called `DMRestrict()` the hooks are added with `DMCoarsenHookAdd()`, a consistent terminology would be better + +See also: +=== +`DM`, `DMCoarsenHookAdd()`, `MatRestrict()`, `DMInterpolate()`, `DMRefineHookAdd()` + +# External Links +$(_doc_external("DM/DMRestrict")) +""" +function DMRestrict(petsclib::PetscLibType, fine::PetscDM, restrct::PetscMat, rscale::PetscVec, inject::PetscMat, coarse::PetscDM) end + +@for_petsc function DMRestrict(petsclib::$UnionPetscLib, fine::PetscDM, restrct::PetscMat, rscale::PetscVec, inject::PetscMat, coarse::PetscDM ) + + @chk ccall( + (:DMRestrict, $petsc_library), + PetscErrorCode, + (CDM, CMat, CVec, CMat, CDM), + fine, restrct, rscale, inject, coarse, + ) + + + return nothing +end + +""" + DMSubDomainHookAdd(petsclib::PetscLibType,global_::PetscDM, ddhook::external, restricthook::external, ctx::Cvoid) +adds a callback to be run when restricting a problem to subdomain `DM`s with `DMCreateDomainDecomposition()` + +Logically Collective; No Fortran Support + +Input Parameters: +- `global_` - global `DM` +- `ddhook` - function to run to pass data to the decomposition `DM` upon its creation +- `restricthook` - function to run to update data on block solve (at the beginning of the block solve) +- `ctx` - [optional] user-defined context for provide data for the hooks (may be `NULL`) + +Calling sequence of `ddhook`: +- `global` - global `DM` +- `block` - subdomain `DM` +- `ctx` - optional user-defined function context + +Calling sequence of `restricthook`: +- `global` - global `DM` +- `out` - scatter to the outer (with ghost and overlap points) sub vector +- `in` - scatter to sub vector values only owned locally +- `block` - subdomain `DM` +- `ctx` - optional user-defined function context + +Level: advanced + +Notes: +This function can be used if auxiliary data needs to be set up on subdomain `DM`s. + +If this function is called multiple times, the hooks will be run in the order they are added. + +In order to compose with nonlinear preconditioning without duplicating storage, the hook should be implemented to +extract the global information from its context (instead of from the `SNES`). + +Developer Note: +It is unclear what "block solve" means within the definition of `restricthook` + +See also: +=== +`DM`, `DMSubDomainHookRemove()`, `DMRefineHookAdd()`, `SNESFASGetInterpolation()`, `SNESFASGetInjection()`, `PetscObjectCompose()`, `PetscContainerCreate()`, `DMCreateDomainDecomposition()` + +# External Links +$(_doc_external("DM/DMSubDomainHookAdd")) +""" +function DMSubDomainHookAdd(petsclib::PetscLibType, global_::PetscDM, ddhook::external, restricthook::external, ctx::Cvoid) end + +@for_petsc function DMSubDomainHookAdd(petsclib::$UnionPetscLib, global_::PetscDM, ddhook::external, restricthook::external, ctx::Cvoid ) + + @chk ccall( + (:DMSubDomainHookAdd, $petsc_library), + PetscErrorCode, + (CDM, external, external, Ptr{Cvoid}), + global_, ddhook, restricthook, ctx, + ) + + + return nothing +end + +""" + DMSubDomainHookRemove(petsclib::PetscLibType,global_::PetscDM, ddhook::external, restricthook::external, ctx::Cvoid) +remove a callback from the list to be run when restricting a problem to subdomain `DM`s with `DMCreateDomainDecomposition()` + +Logically Collective; No Fortran Support + +Input Parameters: +- `global` - global `DM` +- `ddhook` - function to run to pass data to the decomposition `DM` upon its creation +- `restricthook` - function to run to update data on block solve (at the beginning of the block solve) +- `ctx` - [optional] user-defined context for provide data for the hooks (may be `NULL`) + +Level: advanced + +Note: +See `DMSubDomainHookAdd()` for the calling sequences of `ddhook` and `restricthook` + +See also: +=== +`DM`, `DMSubDomainHookAdd()`, `SNESFASGetInterpolation()`, `SNESFASGetInjection()`, `PetscObjectCompose()`, `PetscContainerCreate()`, +`DMCreateDomainDecomposition()` + +# External Links +$(_doc_external("DM/DMSubDomainHookRemove")) +""" +function DMSubDomainHookRemove(petsclib::PetscLibType, global_::PetscDM, ddhook::external, restricthook::external, ctx::Cvoid) end + +@for_petsc function DMSubDomainHookRemove(petsclib::$UnionPetscLib, global_::PetscDM, ddhook::external, restricthook::external, ctx::Cvoid ) + + @chk ccall( + (:DMSubDomainHookRemove, $petsc_library), + PetscErrorCode, + (CDM, external, external, Ptr{Cvoid}), + global_, ddhook, restricthook, ctx, + ) + + + return nothing +end + +""" + DMSubDomainRestrict(petsclib::PetscLibType,global_::PetscDM, oscatter::VecScatter, gscatter::VecScatter, subdm::PetscDM) +restricts user + +Collective if any hooks are + +Input Parameters: +- `global` - The global `DM` to use as a base +- `oscatter` - The scatter from domain global vector filling subdomain global vector with overlap +- `gscatter` - The scatter from domain global vector filling subdomain local vector with ghosts +- `subdm` - The subdomain `DM` to update + +Level: developer + +See also: +=== +`DM`, `DMCoarsenHookAdd()`, `MatRestrict()`, `DMCreateDomainDecomposition()` + +# External Links +$(_doc_external("DM/DMSubDomainRestrict")) +""" +function DMSubDomainRestrict(petsclib::PetscLibType, global_::PetscDM, oscatter::VecScatter, gscatter::VecScatter, subdm::PetscDM) end + +@for_petsc function DMSubDomainRestrict(petsclib::$UnionPetscLib, global_::PetscDM, oscatter::VecScatter, gscatter::VecScatter, subdm::PetscDM ) + + @chk ccall( + (:DMSubDomainRestrict, $petsc_library), + PetscErrorCode, + (CDM, VecScatter, VecScatter, CDM), + global_, oscatter, gscatter, subdm, + ) + + + return nothing +end + +""" + level::PetscInt = DMGetCoarsenLevel(petsclib::PetscLibType,dm::PetscDM) +Gets the number of coarsenings that have generated this `DM`. + +Not Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameter: +- `level` - number of coarsenings + +Level: developer + +See also: +=== +`DM`, `DMCoarsen()`, `DMSetCoarsenLevel()`, `DMGetRefineLevel()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()` + +# External Links +$(_doc_external("DM/DMGetCoarsenLevel")) +""" +function DMGetCoarsenLevel(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetCoarsenLevel(petsclib::$UnionPetscLib, dm::PetscDM ) + level_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetCoarsenLevel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, level_, + ) + + level = level_[] + + return level +end + +""" + DMSetCoarsenLevel(petsclib::PetscLibType,dm::PetscDM, level::PetscInt) +Sets the number of coarsenings that have generated this `DM`. + +Collective + +Input Parameters: +- `dm` - the `DM` object +- `level` - number of coarsenings + +Level: developer + +Note: +This is rarely used directly, the information is automatically set when a `DM` is created with `DMCoarsen()` + +See also: +=== +`DM`, `DMCoarsen()`, `DMGetCoarsenLevel()`, `DMGetRefineLevel()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()` + +# External Links +$(_doc_external("DM/DMSetCoarsenLevel")) +""" +function DMSetCoarsenLevel(petsclib::PetscLibType, dm::PetscDM, level::PetscInt) end + +@for_petsc function DMSetCoarsenLevel(petsclib::$UnionPetscLib, dm::PetscDM, level::$PetscInt ) + + @chk ccall( + (:DMSetCoarsenLevel, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, level, + ) + + + return nothing +end + +""" + DMRefineHierarchy(petsclib::PetscLibType,dm::PetscDM, nlevels::PetscInt, dmf::Vector{PetscDM}) +Refines a `DM` object, all levels at once + +Collective + +Input Parameters: +- `dm` - the `DM` object +- `nlevels` - the number of levels of refinement + +Output Parameter: +- `dmf` - the refined `DM` hierarchy + +Level: developer + +See also: +=== +`DM`, `DMCoarsen()`, `DMCoarsenHierarchy()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()` + +# External Links +$(_doc_external("DM/DMRefineHierarchy")) +""" +function DMRefineHierarchy(petsclib::PetscLibType, dm::PetscDM, nlevels::PetscInt, dmf::Vector{PetscDM}) end + +@for_petsc function DMRefineHierarchy(petsclib::$UnionPetscLib, dm::PetscDM, nlevels::$PetscInt, dmf::Vector{PetscDM} ) + + @chk ccall( + (:DMRefineHierarchy, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CDM}), + dm, nlevels, dmf, + ) + + + return nothing +end + +""" + DMCoarsenHierarchy(petsclib::PetscLibType,dm::PetscDM, nlevels::PetscInt, dmc::Vector{PetscDM}) +Coarsens a `DM` object, all levels at once + +Collective + +Input Parameters: +- `dm` - the `DM` object +- `nlevels` - the number of levels of coarsening + +Output Parameter: +- `dmc` - the coarsened `DM` hierarchy + +Level: developer + +See also: +=== +`DM`, `DMCoarsen()`, `DMRefineHierarchy()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()` + +# External Links +$(_doc_external("DM/DMCoarsenHierarchy")) +""" +function DMCoarsenHierarchy(petsclib::PetscLibType, dm::PetscDM, nlevels::PetscInt, dmc::Vector{PetscDM}) end + +@for_petsc function DMCoarsenHierarchy(petsclib::$UnionPetscLib, dm::PetscDM, nlevels::$PetscInt, dmc::Vector{PetscDM} ) + + @chk ccall( + (:DMCoarsenHierarchy, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CDM}), + dm, nlevels, dmc, + ) + + + return nothing +end + +""" + DMSetApplicationContextDestroy(petsclib::PetscLibType,dm::PetscDM, destroy::PetscCtxDestroyFn) +Sets a user function that will be called to destroy the application context when the `DM` is destroyed + +Logically Collective if the function is collective + +Input Parameters: +- `dm` - the `DM` object +- `destroy` - the destroy function, see `PetscCtxDestroyFn` for the calling sequence + +Level: intermediate + +See also: +=== +`DM`, `DMSetApplicationContext()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, +`DMGetApplicationContext()`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("DM/DMSetApplicationContextDestroy")) +""" +function DMSetApplicationContextDestroy(petsclib::PetscLibType, dm::PetscDM, destroy::PetscCtxDestroyFn) end + +@for_petsc function DMSetApplicationContextDestroy(petsclib::$UnionPetscLib, dm::PetscDM, destroy::PetscCtxDestroyFn ) + + @chk ccall( + (:DMSetApplicationContextDestroy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscCtxDestroyFn}), + dm, destroy, + ) + + + return nothing +end + +""" + DMSetApplicationContext(petsclib::PetscLibType,dm::PetscDM, ctx::Cvoid) +Set a user context into a `DM` object + +Not Collective + +Input Parameters: +- `dm` - the `DM` object +- `ctx` - the user context + +Level: intermediate + +Note: +A user context is a way to pass problem specific information that is accessible whenever the `DM` is available +In a multilevel solver, the user context is shared by all the `DM` in the hierarchy; it is thus not advisable +to store objects that represent discretized quantities inside the context. + +Fortran Note: +This only works when `ctx` is a Fortran derived type (it cannot be a `PetscObject`), we recommend writing a Fortran interface definition for this +function that tells the Fortran compiler the derived data type that is passed in as the `ctx` argument. See `DMGetApplicationContext()` for +an example. + +See also: +=== +`DM`, `DMGetApplicationContext()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()` + +# External Links +$(_doc_external("DM/DMSetApplicationContext")) +""" +function DMSetApplicationContext(petsclib::PetscLibType, dm::PetscDM, ctx::Cvoid) end + +@for_petsc function DMSetApplicationContext(petsclib::$UnionPetscLib, dm::PetscDM, ctx::Cvoid ) + + @chk ccall( + (:DMSetApplicationContext, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cvoid}), + dm, ctx, + ) + + + return nothing +end + +""" + DMGetApplicationContext(petsclib::PetscLibType,dm::PetscDM, ctx::PeCtx) +Gets a user context from a `DM` object provided with `DMSetApplicationContext()` + +Not Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameter: +- `ctx` - a pointer to the user context + +Level: intermediate + +Note: +A user context is a way to pass problem specific information that is accessible whenever the `DM` is available + +Fortran Notes: +This only works when the context is a Fortran derived type (it cannot be a `PetscObject`) and you **must** write a Fortran interface definition for this +function that tells the Fortran compiler the derived data type that is returned as the `ctx` argument. For example, +-vb +Interface DMGetApplicationContext +Subroutine DMGetApplicationContext(dm,ctx,ierr) +#include +use petscdm +DM dm +type(tUsertype), pointer :: ctx +PetscErrorCode ierr +End Subroutine +End Interface DMGetApplicationContext +-ve + +The prototype for `ctx` must be +-vb +type(tUsertype), pointer :: ctx +-ve + +See also: +=== +`DM`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()` + +# External Links +$(_doc_external("DM/DMGetApplicationContext")) +""" +function DMGetApplicationContext(petsclib::PetscLibType, dm::PetscDM, ctx::PeCtx) end + +@for_petsc function DMGetApplicationContext(petsclib::$UnionPetscLib, dm::PetscDM, ctx::PeCtx ) + + @chk ccall( + (:DMGetApplicationContext, $petsc_library), + PetscErrorCode, + (CDM, PeCtx), + dm, ctx, + ) + + + return nothing +end + +""" + DMSetVariableBounds(petsclib::PetscLibType,dm::PetscDM, f::external) +sets a function to compute the lower and upper bound vectors for `SNESVI`. + +Logically Collective + +Input Parameters: +- `dm` - the DM object +- `f` - the function that computes variable bounds used by `SNESVI` (use `NULL` to cancel a previous function that was set) + +Level: intermediate + +Developer Note: +Should be called `DMSetComputeVIBounds()` or something similar + +See also: +=== +`DM`, `DMComputeVariableBounds()`, `DMHasVariableBounds()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMGetApplicationContext()`, +`DMSetJacobian()` + +# External Links +$(_doc_external("DM/DMSetVariableBounds")) +""" +function DMSetVariableBounds(petsclib::PetscLibType, dm::PetscDM, f::external) end + +@for_petsc function DMSetVariableBounds(petsclib::$UnionPetscLib, dm::PetscDM, f::external ) + + @chk ccall( + (:DMSetVariableBounds, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, f, + ) + + + return nothing +end + +""" + flg::PetscBool = DMHasVariableBounds(petsclib::PetscLibType,dm::PetscDM) +does the `DM` object have a variable bounds function? + +Not Collective + +Input Parameter: +- `dm` - the `DM` object to destroy + +Output Parameter: +- `flg` - `PETSC_TRUE` if the variable bounds function exists + +Level: developer + +See also: +=== +`DM`, `DMComputeVariableBounds()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMGetApplicationContext()` + +# External Links +$(_doc_external("DM/DMHasVariableBounds")) +""" +function DMHasVariableBounds(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMHasVariableBounds(petsclib::$UnionPetscLib, dm::PetscDM ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:DMHasVariableBounds, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + DMComputeVariableBounds(petsclib::PetscLibType,dm::PetscDM, xl::PetscVec, xu::PetscVec) +compute variable bounds used by `SNESVI`. + +Logically Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameters: +- `xl` - lower bound +- `xu` - upper bound + +Level: advanced + +Note: +This is generally not called by users. It calls the function provided by the user with DMSetVariableBounds() + +See also: +=== +`DM`, `DMHasVariableBounds()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMGetApplicationContext()` + +# External Links +$(_doc_external("DM/DMComputeVariableBounds")) +""" +function DMComputeVariableBounds(petsclib::PetscLibType, dm::PetscDM, xl::PetscVec, xu::PetscVec) end + +@for_petsc function DMComputeVariableBounds(petsclib::$UnionPetscLib, dm::PetscDM, xl::PetscVec, xu::PetscVec ) + + @chk ccall( + (:DMComputeVariableBounds, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec), + dm, xl, xu, + ) + + + return nothing +end + +""" + flg::PetscBool = DMHasColoring(petsclib::PetscLibType,dm::PetscDM) +does the `DM` object have a method of providing a coloring? + +Not Collective + +Input Parameter: +- `dm` - the DM object + +Output Parameter: +- `flg` - `PETSC_TRUE` if the `DM` has facilities for `DMCreateColoring()`. + +Level: developer + +See also: +=== +`DM`, `DMCreateColoring()` + +# External Links +$(_doc_external("DM/DMHasColoring")) +""" +function DMHasColoring(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMHasColoring(petsclib::$UnionPetscLib, dm::PetscDM ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:DMHasColoring, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = DMHasCreateRestriction(petsclib::PetscLibType,dm::PetscDM) +does the `DM` object have a method of providing a restriction? + +Not Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameter: +- `flg` - `PETSC_TRUE` if the `DM` has facilities for `DMCreateRestriction()`. + +Level: developer + +See also: +=== +`DM`, `DMCreateRestriction()`, `DMHasCreateInterpolation()`, `DMHasCreateInjection()` + +# External Links +$(_doc_external("DM/DMHasCreateRestriction")) +""" +function DMHasCreateRestriction(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMHasCreateRestriction(petsclib::$UnionPetscLib, dm::PetscDM ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:DMHasCreateRestriction, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = DMHasCreateInjection(petsclib::PetscLibType,dm::PetscDM) +does the `DM` object have a method of providing an injection? + +Not Collective + +Input Parameter: +- `dm` - the `DM` object + +Output Parameter: +- `flg` - `PETSC_TRUE` if the `DM` has facilities for `DMCreateInjection()`. + +Level: developer + +See also: +=== +`DM`, `DMCreateInjection()`, `DMHasCreateRestriction()`, `DMHasCreateInterpolation()` + +# External Links +$(_doc_external("DM/DMHasCreateInjection")) +""" +function DMHasCreateInjection(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMHasCreateInjection(petsclib::$UnionPetscLib, dm::PetscDM ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:DMHasCreateInjection, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + DMSetType(petsclib::PetscLibType,dm::PetscDM, method::DMType) +Builds a `DM`, for a particular `DM` implementation. + +Collective + +Input Parameters: +- `dm` - The `DM` object +- `method` - The name of the `DMType`, for example `DMDA`, `DMPLEX` + +Options Database Key: +- `-dm_type ` - Sets the `DM` type; use -help for a list of available types + +Level: intermediate + +Note: +Of the `DM` is constructed by directly calling a function to construct a particular `DM`, for example, `DMDACreate2d()` or `DMPlexCreateBoxMesh()` + +See also: +=== +`DM`, `DMType`, `DMDA`, `DMPLEX`, `DMGetType()`, `DMCreate()`, `DMDACreate2d()` + +# External Links +$(_doc_external("DM/DMSetType")) +""" +function DMSetType(petsclib::PetscLibType, dm::PetscDM, method::DMType) end + +@for_petsc function DMSetType(petsclib::$UnionPetscLib, dm::PetscDM, method::DMType ) + + @chk ccall( + (:DMSetType, $petsc_library), + PetscErrorCode, + (CDM, DMType), + dm, method, + ) + + + return nothing +end + +""" + type::DMType = DMGetType(petsclib::PetscLibType,dm::PetscDM) +Gets the `DM` type name (as a string) from the `DM`. + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `type` - The `DMType` name + +Level: intermediate + +See also: +=== +`DM`, `DMType`, `DMDA`, `DMPLEX`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DM/DMGetType")) +""" +function DMGetType(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetType(petsclib::$UnionPetscLib, dm::PetscDM ) + type_ = Ref{DMType}() + + @chk ccall( + (:DMGetType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMType}), + dm, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + DMConvert(petsclib::PetscLibType,dm::PetscDM, newtype::DMType, M::PetscDM) +Converts a `DM` to another `DM`, either of the same or different type. + +Collective + +Input Parameters: +- `dm` - the `DM` +- `newtype` - new `DM` type (use "same" for the same type) + +Output Parameter: +- `M` - pointer to new `DM` + +Level: intermediate + +Note: +Cannot be used to convert a sequential `DM` to a parallel or a parallel to sequential, +the MPI communicator of the generated `DM` is always the same as the communicator +of the input `DM`. + +See also: +=== +`DM`, `DMSetType()`, `DMCreate()`, `DMClone()` + +# External Links +$(_doc_external("DM/DMConvert")) +""" +function DMConvert(petsclib::PetscLibType, dm::PetscDM, newtype::DMType, M::PetscDM) end + +@for_petsc function DMConvert(petsclib::$UnionPetscLib, dm::PetscDM, newtype::DMType, M::PetscDM ) + M_ = Ref(M.ptr) + + @chk ccall( + (:DMConvert, $petsc_library), + PetscErrorCode, + (CDM, DMType, Ptr{CDM}), + dm, newtype, M_, + ) + + M.ptr = M_[] + + return nothing +end + +""" + DMRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new `DM` type implementation + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine itself + +Level: advanced + +Note: +`DMRegister()` may be called multiple times to add several user-defined `DM`s + +Example Usage: +-vb +DMRegister("my_da", MyDMCreate); +-ve + +Then, your `DM` type can be chosen with the procedural interface via +-vb +DMCreate(MPI_Comm, DM *); +DMSetType(DM,"my_da"); +-ve +or at runtime via the option +-vb +-da_type my_da +-ve + +See also: +=== +`DM`, `DMType`, `DMSetType()`, `DMRegisterAll()`, `DMRegisterDestroy()` + +# External Links +$(_doc_external("DM/DMRegister")) +""" +function DMRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function DMRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:DMRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + DMLoad(petsclib::PetscLibType,newdm::PetscDM, viewer::PetscViewer) +Loads a DM that has been stored in binary with `DMView()`. + +Collective + +Input Parameters: +- `newdm` - the newly loaded `DM`, this needs to have been created with `DMCreate()` or +some related function before a call to `DMLoad()`. +- `viewer` - binary file viewer, obtained from `PetscViewerBinaryOpen()` or +`PETSCVIEWERHDF5` file viewer, obtained from `PetscViewerHDF5Open()` + +Level: intermediate + +Notes: +The type is determined by the data in the file, any type set into the DM before this call is ignored. + +Using `PETSCVIEWERHDF5` type with `PETSC_VIEWER_HDF5_PETSC` format, one can save multiple `DMPLEX` +meshes in a single HDF5 file. This in turn requires one to name the `DMPLEX` object with `PetscObjectSetName()` +before saving it with `DMView()` and before loading it with `DMLoad()` for identification of the mesh object. + +See also: +=== +`DM`, `PetscViewerBinaryOpen()`, `DMView()`, `MatLoad()`, `VecLoad()` + +# External Links +$(_doc_external("DM/DMLoad")) +""" +function DMLoad(petsclib::PetscLibType, newdm::PetscDM, viewer::PetscViewer) end + +@for_petsc function DMLoad(petsclib::$UnionPetscLib, newdm::PetscDM, viewer::PetscViewer ) + + @chk ccall( + (:DMLoad, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer), + newdm, viewer, + ) + + + return nothing +end + +""" + DMPrintCellIndices(petsclib::PetscLibType,c::PetscInt, name::String, len::PetscInt, x::Vector{PetscInt}) + +# External Links +$(_doc_external("DM/DMPrintCellIndices")) +""" +function DMPrintCellIndices(petsclib::PetscLibType, c::PetscInt, name::String, len::PetscInt, x::Vector{PetscInt}) end + +@for_petsc function DMPrintCellIndices(petsclib::$UnionPetscLib, c::$PetscInt, name::String, len::$PetscInt, x::Vector{$PetscInt} ) + + @chk ccall( + (:DMPrintCellIndices, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Cchar}, $PetscInt, Ptr{$PetscInt}), + c, name, len, x, + ) + + + return nothing +end + +""" + DMPrintCellVector(petsclib::PetscLibType,c::PetscInt, name::String, len::PetscInt, x::Vector{PetscScalar}) + +# External Links +$(_doc_external("DM/DMPrintCellVector")) +""" +function DMPrintCellVector(petsclib::PetscLibType, c::PetscInt, name::String, len::PetscInt, x::Vector{PetscScalar}) end + +@for_petsc function DMPrintCellVector(petsclib::$UnionPetscLib, c::$PetscInt, name::String, len::$PetscInt, x::Vector{$PetscScalar} ) + + @chk ccall( + (:DMPrintCellVector, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Cchar}, $PetscInt, Ptr{$PetscScalar}), + c, name, len, x, + ) + + + return nothing +end + +""" + DMPrintCellVectorReal(petsclib::PetscLibType,c::PetscInt, name::String, len::PetscInt, x::Vector{PetscReal}) + +# External Links +$(_doc_external("DM/DMPrintCellVectorReal")) +""" +function DMPrintCellVectorReal(petsclib::PetscLibType, c::PetscInt, name::String, len::PetscInt, x::Vector{PetscReal}) end + +@for_petsc function DMPrintCellVectorReal(petsclib::$UnionPetscLib, c::$PetscInt, name::String, len::$PetscInt, x::Vector{$PetscReal} ) + + @chk ccall( + (:DMPrintCellVectorReal, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Cchar}, $PetscInt, Ptr{$PetscReal}), + c, name, len, x, + ) + + + return nothing +end + +""" + DMPrintCellMatrix(petsclib::PetscLibType,c::PetscInt, name::String, rows::PetscInt, cols::PetscInt, A::Vector{PetscScalar}) + +# External Links +$(_doc_external("DM/DMPrintCellMatrix")) +""" +function DMPrintCellMatrix(petsclib::PetscLibType, c::PetscInt, name::String, rows::PetscInt, cols::PetscInt, A::Vector{PetscScalar}) end + +@for_petsc function DMPrintCellMatrix(petsclib::$UnionPetscLib, c::$PetscInt, name::String, rows::$PetscInt, cols::$PetscInt, A::Vector{$PetscScalar} ) + + @chk ccall( + (:DMPrintCellMatrix, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Cchar}, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + c, name, rows, cols, A, + ) + + + return nothing +end + +""" + DMPrintLocalVec(petsclib::PetscLibType,dm::PetscDM, name::String, tol::PetscReal, X::PetscVec) + +# External Links +$(_doc_external("DM/DMPrintLocalVec")) +""" +function DMPrintLocalVec(petsclib::PetscLibType, dm::PetscDM, name::String, tol::PetscReal, X::PetscVec) end + +@for_petsc function DMPrintLocalVec(petsclib::$UnionPetscLib, dm::PetscDM, name::String, tol::$PetscReal, X::PetscVec ) + + @chk ccall( + (:DMPrintLocalVec, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscReal, CVec), + dm, name, tol, X, + ) + + + return nothing +end + +""" + DMGetLocalSection(petsclib::PetscLibType,dm::PetscDM, section::PetscSection) +Get the `PetscSection` encoding the local data layout for the `DM`. + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `section` - The `PetscSection` + +Options Database Key: +- `-dm_petscsection_view` - View the section created by the `DM` + +Level: intermediate + +Note: +This gets a borrowed reference, so the user should not destroy this `PetscSection`. + +See also: +=== +`DM`, `DMSetLocalSection()`, `DMGetGlobalSection()` + +# External Links +$(_doc_external("DM/DMGetLocalSection")) +""" +function DMGetLocalSection(petsclib::PetscLibType, dm::PetscDM, section::Union{PetscSection, Ref{PetscSection}}) end + +@for_petsc function DMGetLocalSection(petsclib::$UnionPetscLib, dm::PetscDM, section::Union{PetscSection, Ref{PetscSection}} ) + + # Accept either a Ptr (PetscSection) or a Ref{PetscSection} and pass a Ptr to ccall + section_ = section isa Ref ? section : Ref{PetscSection}(section) + + @chk ccall( + (:DMGetLocalSection, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSection}), + dm, section_, + ) + + + return nothing +end + +""" + DMSetLocalSection(petsclib::PetscLibType,dm::PetscDM, section::PetscSection) +Set the `PetscSection` encoding the local data layout for the `DM`. + +Input Parameters: +- `dm` - The `DM` +- `section` - The `PetscSection` + +Level: intermediate + +Note: +Any existing Section will be destroyed + +See also: +=== +`DM`, `PetscSection`, `DMGetLocalSection()`, `DMSetGlobalSection()` + +# External Links +$(_doc_external("DM/DMSetLocalSection")) +""" +function DMSetLocalSection(petsclib::PetscLibType, dm::PetscDM, section::PetscSection) end + +@for_petsc function DMSetLocalSection(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection ) + + @chk ccall( + (:DMSetLocalSection, $petsc_library), + PetscErrorCode, + (CDM, PetscSection), + dm, section, + ) + + + return nothing +end + +""" + perm::IS,blockStarts::PetscBT = DMCreateSectionPermutation(petsclib::PetscLibType,dm::PetscDM) +Create a permutation of the `PetscSection` chart and optionally a block structure. + +Input Parameter: +- `dm` - The `DM` + +Output Parameters: +- `perm` - A permutation of the mesh points in the chart +- `blockStarts` - A high bit is set for the point that begins every block, or `NULL` for default blocking + +Level: developer + +See also: +=== +`DM`, `PetscSection`, `DMGetLocalSection()`, `DMGetGlobalSection()` + +# External Links +$(_doc_external("DM/DMCreateSectionPermutation")) +""" +function DMCreateSectionPermutation(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMCreateSectionPermutation(petsclib::$UnionPetscLib, dm::PetscDM ) + perm_ = Ref{IS}() + blockStarts_ = Ref{PetscBT}() + + @chk ccall( + (:DMCreateSectionPermutation, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CIS}, Ptr{PetscBT}), + dm, perm_, blockStarts_, + ) + + perm = perm_[] + blockStarts = blockStarts_[] + + return perm,blockStarts +end + +""" + DMGetDefaultConstraints(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, mat::PetscMat, bias::PetscVec) +Get the `PetscSection` and `Mat` that specify the local constraint interpolation. See `DMSetDefaultConstraints()` for a description of the purpose of constraint interpolation. + +not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameters: +- `section` - The `PetscSection` describing the range of the constraint matrix: relates rows of the constraint matrix to dofs of the default section. Returns `NULL` if there are no local constraints. +- `mat` - The `Mat` that interpolates local constraints: its width should be the layout size of the default section. Returns `NULL` if there are no local constraints. +- `bias` - Vector containing bias to be added to constrained dofs + +Level: advanced + +Note: +This gets borrowed references, so the user should not destroy the `PetscSection`, `Mat`, or `Vec`. + +See also: +=== +`DM`, `DMSetDefaultConstraints()` + +# External Links +$(_doc_external("DM/DMGetDefaultConstraints")) +""" +function DMGetDefaultConstraints(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, mat::PetscMat, bias::PetscVec) end + +@for_petsc function DMGetDefaultConstraints(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, mat::PetscMat, bias::PetscVec ) + mat_ = Ref(mat.ptr) + bias_ = Ref(bias.ptr) + + @chk ccall( + (:DMGetDefaultConstraints, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSection}, Ptr{CMat}, Ptr{CVec}), + dm, section, mat_, bias_, + ) + + mat.ptr = mat_[] + bias.ptr = bias_[] + + return nothing +end + +""" + DMSetDefaultConstraints(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, mat::PetscMat, bias::PetscVec) +Set the `PetscSection` and `Mat` that specify the local constraint interpolation. + +Collective + +Input Parameters: +- `dm` - The `DM` +- `section` - The `PetscSection` describing the range of the constraint matrix: relates rows of the constraint matrix to dofs of the default section. Must have a local communicator (`PETSC_COMM_SELF` or derivative). +- `mat` - The `Mat` that interpolates local constraints: its width should be the layout size of the default section: `NULL` indicates no constraints. Must have a local communicator (`PETSC_COMM_SELF` or derivative). +- `bias` - A bias vector to be added to constrained values in the local vector. `NULL` indicates no bias. Must have a local communicator (`PETSC_COMM_SELF` or derivative). + +Level: advanced + +Notes: +If a constraint matrix is specified, then it is applied during `DMGlobalToLocalEnd()` when mode is `INSERT_VALUES`, `INSERT_BC_VALUES`, or `INSERT_ALL_VALUES`. Without a constraint matrix, the local vector l returned by `DMGlobalToLocalEnd()` contains values that have been scattered from a global vector without modification; with a constraint matrix A, l is modified by computing c = A * l + bias, l[s[i]] = c[i], where the scatter s is defined by the `PetscSection` returned by `DMGetDefaultConstraints()`. + +If a constraint matrix is specified, then its adjoint is applied during `DMLocalToGlobalBegin()` when mode is `ADD_VALUES`, `ADD_BC_VALUES`, or `ADD_ALL_VALUES`. Without a constraint matrix, the local vector l is accumulated into a global vector without modification; with a constraint matrix A, l is first modified by computing c[i] = l[s[i]], l[s[i]] = 0, l = l + A'*c, which is the adjoint of the operation described above. Any bias, if specified, is ignored when accumulating. + +This increments the references of the `PetscSection`, `Mat`, and `Vec`, so they user can destroy them. + +See also: +=== +`DM`, `DMGetDefaultConstraints()` + +# External Links +$(_doc_external("DM/DMSetDefaultConstraints")) +""" +function DMSetDefaultConstraints(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, mat::PetscMat, bias::PetscVec) end + +@for_petsc function DMSetDefaultConstraints(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, mat::PetscMat, bias::PetscVec ) + + @chk ccall( + (:DMSetDefaultConstraints, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, CMat, CVec), + dm, section, mat, bias, + ) + + + return nothing +end + +""" + DMGetGlobalSection(petsclib::PetscLibType,dm::PetscDM, section::PetscSection) +Get the `PetscSection` encoding the global data layout for the `DM`. + +Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `section` - The `PetscSection` + +Level: intermediate + +Note: +This gets a borrowed reference, so the user should not destroy this `PetscSection`. + +See also: +=== +`DM`, `DMSetLocalSection()`, `DMGetLocalSection()` + +# External Links +$(_doc_external("DM/DMGetGlobalSection")) +""" +function DMGetGlobalSection(petsclib::PetscLibType, dm::PetscDM, section::PetscSection) end + +@for_petsc function DMGetGlobalSection(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection ) + + @chk ccall( + (:DMGetGlobalSection, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSection}), + dm, section, + ) + + + return nothing +end + +""" + DMSetGlobalSection(petsclib::PetscLibType,dm::PetscDM, section::PetscSection) +Set the `PetscSection` encoding the global data layout for the `DM`. + +Input Parameters: +- `dm` - The `DM` +- `section` - The PetscSection, or `NULL` + +Level: intermediate + +Note: +Any existing `PetscSection` will be destroyed + +See also: +=== +`DM`, `DMGetGlobalSection()`, `DMSetLocalSection()` + +# External Links +$(_doc_external("DM/DMSetGlobalSection")) +""" +function DMSetGlobalSection(petsclib::PetscLibType, dm::PetscDM, section::PetscSection) end + +@for_petsc function DMSetGlobalSection(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection ) + + @chk ccall( + (:DMSetGlobalSection, $petsc_library), + PetscErrorCode, + (CDM, PetscSection), + dm, section, + ) + + + return nothing +end + +""" + DMGetSectionSF(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF) +Get the `PetscSF` encoding the parallel dof overlap for the `DM`. If it has not been set, +it is created from the default `PetscSection` layouts in the `DM`. + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `sf` - The `PetscSF` + +Level: intermediate + +Note: +This gets a borrowed reference, so the user should not destroy this `PetscSF`. + +See also: +=== +`DM`, `DMSetSectionSF()`, `DMCreateSectionSF()` + +# External Links +$(_doc_external("DM/DMGetSectionSF")) +""" +function DMGetSectionSF(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF) end + +@for_petsc function DMGetSectionSF(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF ) + + @chk ccall( + (:DMGetSectionSF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSF}), + dm, sf, + ) + + + return nothing +end + +""" + DMSetSectionSF(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF) +Set the `PetscSF` encoding the parallel dof overlap for the `DM` + +Input Parameters: +- `dm` - The `DM` +- `sf` - The `PetscSF` + +Level: intermediate + +Note: +Any previous `PetscSF` is destroyed + +See also: +=== +`DM`, `DMGetSectionSF()`, `DMCreateSectionSF()` + +# External Links +$(_doc_external("DM/DMSetSectionSF")) +""" +function DMSetSectionSF(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF) end + +@for_petsc function DMSetSectionSF(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF ) + + @chk ccall( + (:DMSetSectionSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF), + dm, sf, + ) + + + return nothing +end + +""" + DMCreateSectionSF(petsclib::PetscLibType,dm::PetscDM, locSection::PetscSection, globalSection::PetscSection) +Create the `PetscSF` encoding the parallel dof overlap for the `DM` based upon the `PetscSection`s +describing the data layout. + +Input Parameters: +- `dm` - The `DM` +- `localSection` - `PetscSection` describing the local data layout +- `globalSection` - `PetscSection` describing the global data layout + +Level: developer + +Note: +One usually uses `DMGetSectionSF()` to obtain the `PetscSF` + +Developer Note: +Since this routine has for arguments the two sections from the `DM` and puts the resulting `PetscSF` +directly into the `DM`, perhaps this function should not take the local and global sections as +input and should just obtain them from the `DM`? Plus PETSc creation functions return the thing +they create, this returns nothing + +See also: +=== +`DM`, `DMGetSectionSF()`, `DMSetSectionSF()`, `DMGetLocalSection()`, `DMGetGlobalSection()` + +# External Links +$(_doc_external("DM/DMCreateSectionSF")) +""" +function DMCreateSectionSF(petsclib::PetscLibType, dm::PetscDM, locSection::PetscSection, globalSection::PetscSection) end + +@for_petsc function DMCreateSectionSF(petsclib::$UnionPetscLib, dm::PetscDM, locSection::PetscSection, globalSection::PetscSection ) + + @chk ccall( + (:DMCreateSectionSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, PetscSection), + dm, locSection, globalSection, + ) + + + return nothing +end + +""" + DMGetPointSF(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF) +Get the `PetscSF` encoding the parallel section point overlap for the `DM`. + +Not collective but the resulting `PetscSF` is collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `sf` - The `PetscSF` + +Level: intermediate + +Note: +This gets a borrowed reference, so the user should not destroy this `PetscSF`. + +See also: +=== +`DM`, `DMSetPointSF()`, `DMGetSectionSF()`, `DMSetSectionSF()`, `DMCreateSectionSF()` + +# External Links +$(_doc_external("DM/DMGetPointSF")) +""" +function DMGetPointSF(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF) end + +@for_petsc function DMGetPointSF(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF ) + + @chk ccall( + (:DMGetPointSF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSF}), + dm, sf, + ) + + + return nothing +end + +""" + DMSetPointSF(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF) +Set the `PetscSF` encoding the parallel section point overlap for the `DM`. + +Collective + +Input Parameters: +- `dm` - The `DM` +- `sf` - The `PetscSF` + +Level: intermediate + +See also: +=== +`DM`, `DMGetPointSF()`, `DMGetSectionSF()`, `DMSetSectionSF()`, `DMCreateSectionSF()` + +# External Links +$(_doc_external("DM/DMSetPointSF")) +""" +function DMSetPointSF(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF) end + +@for_petsc function DMSetPointSF(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF ) + + @chk ccall( + (:DMSetPointSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF), + dm, sf, + ) + + + return nothing +end + +""" + DMGetNaturalSF(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF) +Get the `PetscSF` encoding the map back to the original mesh ordering + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `sf` - The `PetscSF` + +Level: intermediate + +Note: +This gets a borrowed reference, so the user should not destroy this `PetscSF`. + +See also: +=== +`DM`, `DMSetNaturalSF()`, `DMSetUseNatural()`, `DMGetUseNatural()`, `DMPlexCreateGlobalToNaturalSF()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DM/DMGetNaturalSF")) +""" +function DMGetNaturalSF(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF) end + +@for_petsc function DMGetNaturalSF(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF ) + + @chk ccall( + (:DMGetNaturalSF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSF}), + dm, sf, + ) + + + return nothing +end + +""" + DMSetNaturalSF(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF) +Set the PetscSF encoding the map back to the original mesh ordering + +Input Parameters: +- `dm` - The DM +- `sf` - The PetscSF + +Level: intermediate + +See also: +=== +`DM`, `DMGetNaturalSF()`, `DMSetUseNatural()`, `DMGetUseNatural()`, `DMPlexCreateGlobalToNaturalSF()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DM/DMSetNaturalSF")) +""" +function DMSetNaturalSF(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF) end + +@for_petsc function DMSetNaturalSF(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF ) + + @chk ccall( + (:DMSetNaturalSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF), + dm, sf, + ) + + + return nothing +end + +""" + DMClearFields(petsclib::PetscLibType,dm::PetscDM) +Remove all fields from the `DM` + +Logically Collective + +Input Parameter: +- `dm` - The `DM` + +Level: intermediate + +See also: +=== +`DM`, `DMGetNumFields()`, `DMSetNumFields()`, `DMSetField()` + +# External Links +$(_doc_external("DM/DMClearFields")) +""" +function DMClearFields(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMClearFields(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMClearFields, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + numFields::PetscInt = DMGetNumFields(petsclib::PetscLibType,dm::PetscDM) +Get the number of fields in the `DM` + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `numFields` - The number of fields + +Level: intermediate + +See also: +=== +`DM`, `DMSetNumFields()`, `DMSetField()` + +# External Links +$(_doc_external("DM/DMGetNumFields")) +""" +function DMGetNumFields(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetNumFields(petsclib::$UnionPetscLib, dm::PetscDM ) + numFields_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetNumFields, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, numFields_, + ) + + numFields = numFields_[] + + return numFields +end + +""" + DMSetNumFields(petsclib::PetscLibType,dm::PetscDM, numFields::PetscInt) +Set the number of fields in the `DM` + +Logically Collective + +Input Parameters: +- `dm` - The `DM` +- `numFields` - The number of fields + +Level: intermediate + +See also: +=== +`DM`, `DMGetNumFields()`, `DMSetField()` + +# External Links +$(_doc_external("DM/DMSetNumFields")) +""" +function DMSetNumFields(petsclib::PetscLibType, dm::PetscDM, numFields::PetscInt) end + +@for_petsc function DMSetNumFields(petsclib::$UnionPetscLib, dm::PetscDM, numFields::$PetscInt ) + + @chk ccall( + (:DMSetNumFields, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, numFields, + ) + + + return nothing +end + +""" + DMGetField(petsclib::PetscLibType,dm::PetscDM, f::PetscInt, label::DMLabel, disc::PetscObject) +Return the `DMLabel` and discretization object for a given `DM` field + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `f` - The field number + +Output Parameters: +- `label` - The label indicating the support of the field, or `NULL` for the entire mesh (pass in `NULL` if not needed) +- `disc` - The discretization object (pass in `NULL` if not needed) + +Level: intermediate + +See also: +=== +`DM`, `DMAddField()`, `DMSetField()` + +# External Links +$(_doc_external("DM/DMGetField")) +""" +function DMGetField(petsclib::PetscLibType, dm::PetscDM, f::PetscInt, label::DMLabel, disc::PetscObject) end + +@for_petsc function DMGetField(petsclib::$UnionPetscLib, dm::PetscDM, f::$PetscInt, label::DMLabel, disc::PetscObject ) + + @chk ccall( + (:DMGetField, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{DMLabel}, Ptr{PetscObject}), + dm, f, label, disc, + ) + + + return nothing +end + +""" + DMSetField(petsclib::PetscLibType,dm::PetscDM, f::PetscInt, label::DMLabel, disc::PetscObject) +Set the discretization object for a given `DM` field. Usually one would call `DMAddField()` which automatically handles +the field numbering. + +Logically Collective + +Input Parameters: +- `dm` - The `DM` +- `f` - The field number +- `label` - The label indicating the support of the field, or `NULL` for the entire mesh +- `disc` - The discretization object + +Level: intermediate + +See also: +=== +`DM`, `DMAddField()`, `DMGetField()` + +# External Links +$(_doc_external("DM/DMSetField")) +""" +function DMSetField(petsclib::PetscLibType, dm::PetscDM, f::PetscInt, label::DMLabel, disc::PetscObject) end + +@for_petsc function DMSetField(petsclib::$UnionPetscLib, dm::PetscDM, f::$PetscInt, label::DMLabel, disc::PetscObject ) + + @chk ccall( + (:DMSetField, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, DMLabel, PetscObject), + dm, f, label, disc, + ) + + + return nothing +end + +""" + DMAddField(petsclib::PetscLibType,dm::PetscDM, label::DMLabel, disc::PetscObject) +Add a field to a `DM` object. A field is a function space defined by of a set of discretization points (geometric entities) +and a discretization object that defines the function space associated with those points. + +Logically Collective + +Input Parameters: +- `dm` - The `DM` +- `label` - The label indicating the support of the field, or `NULL` for the entire mesh +- `disc` - The discretization object + +Level: intermediate + +Notes: +The label already exists or will be added to the `DM` with `DMSetLabel()`. + +For example, a piecewise continuous pressure field can be defined by coefficients at the cell centers of a mesh and piecewise constant functions +within each cell. Thus a specific function in the space is defined by the combination of a `Vec` containing the coefficients, a `DM` defining the +geometry entities, a `DMLabel` indicating a subset of those geometric entities, and a discretization object, such as a `PetscFE`. + +Fortran Note: +Use the argument `PetscObjectCast(disc)` as the second argument + +See also: +=== +`DM`, `DMSetLabel()`, `DMSetField()`, `DMGetField()`, `PetscFE` + +# External Links +$(_doc_external("DM/DMAddField")) +""" +function DMAddField(petsclib::PetscLibType, dm::PetscDM, label::DMLabel, disc::PetscObject) end + +@for_petsc function DMAddField(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel, disc::PetscObject ) + + @chk ccall( + (:DMAddField, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, PetscObject), + dm, label, disc, + ) + + + return nothing +end + +""" + DMSetFieldAvoidTensor(petsclib::PetscLibType,dm::PetscDM, f::PetscInt, avoidTensor::PetscBool) +Set flag to avoid defining the field on tensor cells + +Logically Collective + +Input Parameters: +- `dm` - The `DM` +- `f` - The field index +- `avoidTensor` - `PETSC_TRUE` to skip defining the field on tensor cells + +Level: intermediate + +See also: +=== +`DM`, `DMGetFieldAvoidTensor()`, `DMSetField()`, `DMGetField()` + +# External Links +$(_doc_external("DM/DMSetFieldAvoidTensor")) +""" +function DMSetFieldAvoidTensor(petsclib::PetscLibType, dm::PetscDM, f::PetscInt, avoidTensor::PetscBool) end + +@for_petsc function DMSetFieldAvoidTensor(petsclib::$UnionPetscLib, dm::PetscDM, f::$PetscInt, avoidTensor::PetscBool ) + + @chk ccall( + (:DMSetFieldAvoidTensor, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscBool), + dm, f, avoidTensor, + ) + + + return nothing +end + +""" + avoidTensor::PetscBool = DMGetFieldAvoidTensor(petsclib::PetscLibType,dm::PetscDM, f::PetscInt) +Get flag to avoid defining the field on tensor cells + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `f` - The field index + +Output Parameter: +- `avoidTensor` - The flag to avoid defining the field on tensor cells + +Level: intermediate + +See also: +=== +`DM`, `DMAddField()`, `DMSetField()`, `DMGetField()`, `DMSetFieldAvoidTensor()` + +# External Links +$(_doc_external("DM/DMGetFieldAvoidTensor")) +""" +function DMGetFieldAvoidTensor(petsclib::PetscLibType, dm::PetscDM, f::PetscInt) end + +@for_petsc function DMGetFieldAvoidTensor(petsclib::$UnionPetscLib, dm::PetscDM, f::$PetscInt ) + avoidTensor_ = Ref{PetscBool}() + + @chk ccall( + (:DMGetFieldAvoidTensor, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscBool}), + dm, f, avoidTensor_, + ) + + avoidTensor = avoidTensor_[] + + return avoidTensor +end + +""" + DMCopyFields(petsclib::PetscLibType,dm::PetscDM, minDegree::PetscInt, maxDegree::PetscInt, newdm::PetscDM) +Copy the discretizations for the `DM` into another `DM` + +Collective + +Input Parameters: +- `dm` - The `DM` +- `minDegree` - Minimum degree for a discretization, or `PETSC_DETERMINE` for no limit +- `maxDegree` - Maximum degree for a discretization, or `PETSC_DETERMINE` for no limit + +Output Parameter: +- `newdm` - The `DM` + +Level: advanced + +See also: +=== +`DM`, `DMGetField()`, `DMSetField()`, `DMAddField()`, `DMCopyDS()`, `DMGetDS()`, `DMGetCellDS()` + +# External Links +$(_doc_external("DM/DMCopyFields")) +""" +function DMCopyFields(petsclib::PetscLibType, dm::PetscDM, minDegree::PetscInt, maxDegree::PetscInt, newdm::PetscDM) end + +@for_petsc function DMCopyFields(petsclib::$UnionPetscLib, dm::PetscDM, minDegree::$PetscInt, maxDegree::$PetscInt, newdm::PetscDM ) + + @chk ccall( + (:DMCopyFields, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, CDM), + dm, minDegree, maxDegree, newdm, + ) + + + return nothing +end + +""" + useCone::PetscBool,useClosure::PetscBool = DMGetAdjacency(petsclib::PetscLibType,dm::PetscDM, f::PetscInt) +Returns the flags for determining variable influence + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `f` - The field number, or `PETSC_DEFAULT` for the default adjacency + +Output Parameters: +- `useCone` - Flag for variable influence starting with the cone operation +- `useClosure` - Flag for variable influence using transitive closure + +Level: developer + +Notes: +-v +FEM: Two points p and q are adjacent if q in closure(star(p)), useCone = PETSC_FALSE, useClosure = PETSC_TRUE +FVM: Two points p and q are adjacent if q in support(p+cone(p)), useCone = PETSC_TRUE, useClosure = PETSC_FALSE +FVM++: Two points p and q are adjacent if q in star(closure(p)), useCone = PETSC_TRUE, useClosure = PETSC_TRUE +-ve +Further explanation can be found in the User's Manual Section on the Influence of Variables on One Another. + +See also: +=== +`DM`, `DMSetAdjacency()`, `DMGetField()`, `DMSetField()` + +# External Links +$(_doc_external("DM/DMGetAdjacency")) +""" +function DMGetAdjacency(petsclib::PetscLibType, dm::PetscDM, f::PetscInt) end + +@for_petsc function DMGetAdjacency(petsclib::$UnionPetscLib, dm::PetscDM, f::$PetscInt ) + useCone_ = Ref{PetscBool}() + useClosure_ = Ref{PetscBool}() + + @chk ccall( + (:DMGetAdjacency, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscBool}, Ptr{PetscBool}), + dm, f, useCone_, useClosure_, + ) + + useCone = useCone_[] + useClosure = useClosure_[] + + return useCone,useClosure +end + +""" + DMSetAdjacency(petsclib::PetscLibType,dm::PetscDM, f::PetscInt, useCone::PetscBool, useClosure::PetscBool) +Set the flags for determining variable influence + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `f` - The field number +- `useCone` - Flag for variable influence starting with the cone operation +- `useClosure` - Flag for variable influence using transitive closure + +Level: developer + +See also: +=== +`DM`, `DMGetAdjacency()`, `DMGetField()`, `DMSetField()` + +# External Links +$(_doc_external("DM/DMSetAdjacency")) +""" +function DMSetAdjacency(petsclib::PetscLibType, dm::PetscDM, f::PetscInt, useCone::PetscBool, useClosure::PetscBool) end + +@for_petsc function DMSetAdjacency(petsclib::$UnionPetscLib, dm::PetscDM, f::$PetscInt, useCone::PetscBool, useClosure::PetscBool ) + + @chk ccall( + (:DMSetAdjacency, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscBool, PetscBool), + dm, f, useCone, useClosure, + ) + + + return nothing +end + +""" + useCone::PetscBool,useClosure::PetscBool = DMGetBasicAdjacency(petsclib::PetscLibType,dm::PetscDM) +Returns the flags for determining variable influence, using either the default or field 0 if it is defined + +Not collective + +Input Parameter: +- `dm` - The `DM` object + +Output Parameters: +- `useCone` - Flag for variable influence starting with the cone operation +- `useClosure` - Flag for variable influence using transitive closure + +Level: developer + +Notes: +-vb +FEM: Two points p and q are adjacent if q in closure(star(p)), useCone = PETSC_FALSE, useClosure = PETSC_TRUE +FVM: Two points p and q are adjacent if q in support(p+cone(p)), useCone = PETSC_TRUE, useClosure = PETSC_FALSE +FVM++: Two points p and q are adjacent if q in star(closure(p)), useCone = PETSC_TRUE, useClosure = PETSC_TRUE +-ve + +See also: +=== +`DM`, `DMSetBasicAdjacency()`, `DMGetField()`, `DMSetField()` + +# External Links +$(_doc_external("DM/DMGetBasicAdjacency")) +""" +function DMGetBasicAdjacency(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetBasicAdjacency(petsclib::$UnionPetscLib, dm::PetscDM ) + useCone_ = Ref{PetscBool}() + useClosure_ = Ref{PetscBool}() + + @chk ccall( + (:DMGetBasicAdjacency, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}, Ptr{PetscBool}), + dm, useCone_, useClosure_, + ) + + useCone = useCone_[] + useClosure = useClosure_[] + + return useCone,useClosure +end + +""" + DMSetBasicAdjacency(petsclib::PetscLibType,dm::PetscDM, useCone::PetscBool, useClosure::PetscBool) +Set the flags for determining variable influence, using either the default or field 0 if it is defined + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `useCone` - Flag for variable influence starting with the cone operation +- `useClosure` - Flag for variable influence using transitive closure + +Level: developer + +Notes: +-vb +FEM: Two points p and q are adjacent if q in closure(star(p)), useCone = PETSC_FALSE, useClosure = PETSC_TRUE +FVM: Two points p and q are adjacent if q in support(p+cone(p)), useCone = PETSC_TRUE, useClosure = PETSC_FALSE +FVM++: Two points p and q are adjacent if q in star(closure(p)), useCone = PETSC_TRUE, useClosure = PETSC_TRUE +-ve + +See also: +=== +`DM`, `DMGetBasicAdjacency()`, `DMGetField()`, `DMSetField()` + +# External Links +$(_doc_external("DM/DMSetBasicAdjacency")) +""" +function DMSetBasicAdjacency(petsclib::PetscLibType, dm::PetscDM, useCone::PetscBool, useClosure::PetscBool) end + +@for_petsc function DMSetBasicAdjacency(petsclib::$UnionPetscLib, dm::PetscDM, useCone::PetscBool, useClosure::PetscBool ) + + @chk ccall( + (:DMSetBasicAdjacency, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, PetscBool), + dm, useCone, useClosure, + ) + + + return nothing +end + +""" + Nds::PetscInt = DMGetNumDS(petsclib::PetscLibType,dm::PetscDM) +Get the number of discrete systems in the `DM` + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `Nds` - The number of `PetscDS` objects + +Level: intermediate + +See also: +=== +`DM`, `DMGetDS()`, `DMGetCellDS()` + +# External Links +$(_doc_external("DM/DMGetNumDS")) +""" +function DMGetNumDS(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetNumDS(petsclib::$UnionPetscLib, dm::PetscDM ) + Nds_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetNumDS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, Nds_, + ) + + Nds = Nds_[] + + return Nds +end + +""" + DMClearDS(petsclib::PetscLibType,dm::PetscDM) +Remove all discrete systems from the `DM` + +Logically Collective + +Input Parameter: +- `dm` - The `DM` + +Level: intermediate + +See also: +=== +`DM`, `DMGetNumDS()`, `DMGetDS()`, `DMSetField()` + +# External Links +$(_doc_external("DM/DMClearDS")) +""" +function DMClearDS(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMClearDS(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMClearDS, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMGetDS(petsclib::PetscLibType,dm::PetscDM, ds::PetscDS) +Get the default `PetscDS` + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `ds` - The default `PetscDS` + +Level: intermediate + +Note: +The `ds` is owned by the `dm` and should not be destroyed directly. + +See also: +=== +`DM`, `DMGetCellDS()`, `DMGetRegionDS()` + +# External Links +$(_doc_external("DM/DMGetDS")) +""" +function DMGetDS(petsclib::PetscLibType, dm::PetscDM, ds::PetscDS) end + +@for_petsc function DMGetDS(petsclib::$UnionPetscLib, dm::PetscDM, ds::PetscDS ) + + @chk ccall( + (:DMGetDS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscDS}), + dm, ds, + ) + + + return nothing +end + +""" + DMGetCellDS(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, ds::PetscDS, dsIn::PetscDS) +Get the `PetscDS` defined on a given cell + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `point` - Cell for the `PetscDS` + +Output Parameters: +- `ds` - The `PetscDS` defined on the given cell +- `dsIn` - The `PetscDS` for input on the given cell, or `NULL` if the same ds + +Level: developer + +See also: +=== +`DM`, `DMGetDS()`, `DMSetRegionDS()` + +# External Links +$(_doc_external("DM/DMGetCellDS")) +""" +function DMGetCellDS(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, ds::PetscDS, dsIn::PetscDS) end + +@for_petsc function DMGetCellDS(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, ds::PetscDS, dsIn::PetscDS ) + + @chk ccall( + (:DMGetCellDS, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscDS}, Ptr{PetscDS}), + dm, point, ds, dsIn, + ) + + + return nothing +end + +""" + DMGetRegionDS(petsclib::PetscLibType,dm::PetscDM, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS) +Get the `PetscDS` for a given mesh region, defined by a `DMLabel` + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `label` - The `DMLabel` defining the mesh region, or `NULL` for the entire mesh + +Output Parameters: +- `fields` - The `IS` containing the `DM` field numbers for the fields in this `PetscDS`, or `NULL` +- `ds` - The `PetscDS` defined on the given region, or `NULL` +- `dsIn` - The `PetscDS` for input in the given region, or `NULL` + +Level: advanced + +Note: +If a non-`NULL` label is given, but there is no `PetscDS` on that specific label, +the `PetscDS` for the full domain (if present) is returned. Returns with +fields = `NULL` and ds = `NULL` if there is no `PetscDS` for the full domain. + +See also: +=== +`DM`, `DMGetRegionNumDS()`, `DMSetRegionDS()`, `DMGetDS()`, `DMGetCellDS()` + +# External Links +$(_doc_external("DM/DMGetRegionDS")) +""" +function DMGetRegionDS(petsclib::PetscLibType, dm::PetscDM, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS) end + +@for_petsc function DMGetRegionDS(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS ) + + @chk ccall( + (:DMGetRegionDS, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, Ptr{CIS}, Ptr{PetscDS}, Ptr{PetscDS}), + dm, label, fields, ds, dsIn, + ) + + + return nothing +end + +""" + DMSetRegionDS(petsclib::PetscLibType,dm::PetscDM, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS) +Set the `PetscDS` for a given mesh region, defined by a `DMLabel` + +Collective + +Input Parameters: +- `dm` - The `DM` +- `label` - The `DMLabel` defining the mesh region, or `NULL` for the entire mesh +- `fields` - The `IS` containing the `DM` field numbers for the fields in this `PetscDS`, or `NULL` for all fields +- `ds` - The `PetscDS` defined on the given region +- `dsIn` - The `PetscDS` for input on the given cell, or `NULL` if it is the same `PetscDS` + +Level: advanced + +Note: +If the label has a `PetscDS` defined, it will be replaced. Otherwise, it will be added to the `DM`. If the `PetscDS` is replaced, +the fields argument is ignored. + +See also: +=== +`DM`, `DMGetRegionDS()`, `DMSetRegionNumDS()`, `DMGetDS()`, `DMGetCellDS()` + +# External Links +$(_doc_external("DM/DMSetRegionDS")) +""" +function DMSetRegionDS(petsclib::PetscLibType, dm::PetscDM, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS) end + +@for_petsc function DMSetRegionDS(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS ) + + @chk ccall( + (:DMSetRegionDS, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, CIS, PetscDS, PetscDS), + dm, label, fields, ds, dsIn, + ) + + + return nothing +end + +""" + DMGetRegionNumDS(petsclib::PetscLibType,dm::PetscDM, num::PetscInt, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS) +Get the `PetscDS` for a given mesh region, defined by the region number + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `num` - The region number, in [0, Nds) + +Output Parameters: +- `label` - The region label, or `NULL` +- `fields` - The `IS` containing the `DM` field numbers for the fields in this `PetscDS`, or `NULL` +- `ds` - The `PetscDS` defined on the given region, or `NULL` +- `dsIn` - The `PetscDS` for input in the given region, or `NULL` + +Level: advanced + +See also: +=== +`DM`, `DMGetRegionDS()`, `DMSetRegionDS()`, `DMGetDS()`, `DMGetCellDS()` + +# External Links +$(_doc_external("DM/DMGetRegionNumDS")) +""" +function DMGetRegionNumDS(petsclib::PetscLibType, dm::PetscDM, num::PetscInt, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS) end + +@for_petsc function DMGetRegionNumDS(petsclib::$UnionPetscLib, dm::PetscDM, num::$PetscInt, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS ) + + @chk ccall( + (:DMGetRegionNumDS, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{DMLabel}, Ptr{CIS}, Ptr{PetscDS}, Ptr{PetscDS}), + dm, num, label, fields, ds, dsIn, + ) + + + return nothing +end + +""" + DMSetRegionNumDS(petsclib::PetscLibType,dm::PetscDM, num::PetscInt, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS) +Set the `PetscDS` for a given mesh region, defined by the region number + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `num` - The region number, in [0, Nds) +- `label` - The region label, or `NULL` +- `fields` - The `IS` containing the `DM` field numbers for the fields in this `PetscDS`, or `NULL` to prevent setting +- `ds` - The `PetscDS` defined on the given region, or `NULL` to prevent setting +- `dsIn` - The `PetscDS` for input on the given cell, or `NULL` if it is the same `PetscDS` + +Level: advanced + +See also: +=== +`DM`, `DMGetRegionDS()`, `DMSetRegionDS()`, `DMGetDS()`, `DMGetCellDS()` + +# External Links +$(_doc_external("DM/DMSetRegionNumDS")) +""" +function DMSetRegionNumDS(petsclib::PetscLibType, dm::PetscDM, num::PetscInt, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS) end + +@for_petsc function DMSetRegionNumDS(petsclib::$UnionPetscLib, dm::PetscDM, num::$PetscInt, label::DMLabel, fields::IS, ds::PetscDS, dsIn::PetscDS ) + + @chk ccall( + (:DMSetRegionNumDS, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, DMLabel, CIS, PetscDS, PetscDS), + dm, num, label, fields, ds, dsIn, + ) + + + return nothing +end + +""" + num::PetscInt = DMFindRegionNum(petsclib::PetscLibType,dm::PetscDM, ds::PetscDS) +Find the region number for a given `PetscDS`, or + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `ds` - The `PetscDS` defined on the given region + +Output Parameter: +- `num` - The region number, in [0, Nds), or -1 if not found + +Level: advanced + +See also: +=== +`DM`, `DMGetRegionNumDS()`, `DMGetRegionDS()`, `DMSetRegionDS()`, `DMGetDS()`, `DMGetCellDS()` + +# External Links +$(_doc_external("DM/DMFindRegionNum")) +""" +function DMFindRegionNum(petsclib::PetscLibType, dm::PetscDM, ds::PetscDS) end + +@for_petsc function DMFindRegionNum(petsclib::$UnionPetscLib, dm::PetscDM, ds::PetscDS ) + num_ = Ref{$PetscInt}() + + @chk ccall( + (:DMFindRegionNum, $petsc_library), + PetscErrorCode, + (CDM, PetscDS, Ptr{$PetscInt}), + dm, ds, num_, + ) + + num = num_[] + + return num +end + +""" + fem::PetscFE = DMCreateFEDefault(petsclib::PetscLibType,dm::PetscDM, Nc::PetscInt, prefix::String, qorder::PetscInt) +Create a `PetscFE` based on the celltype for the mesh + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `Nc` - The number of components for the field +- `prefix` - The options prefix for the output `PetscFE`, or `NULL` +- `qorder` - The quadrature order or `PETSC_DETERMINE` to use `PetscSpace` polynomial degree + +Output Parameter: +- `fem` - The `PetscFE` + +Level: intermediate + +Note: +This is a convenience method that just calls `PetscFECreateByCell()` underneath. + +See also: +=== +`DM`, `PetscFECreateByCell()`, `DMAddField()`, `DMCreateDS()`, `DMGetCellDS()`, `DMGetRegionDS()` + +# External Links +$(_doc_external("DM/DMCreateFEDefault")) +""" +function DMCreateFEDefault(petsclib::PetscLibType, dm::PetscDM, Nc::PetscInt, prefix::String, qorder::PetscInt) end + +@for_petsc function DMCreateFEDefault(petsclib::$UnionPetscLib, dm::PetscDM, Nc::$PetscInt, prefix::String, qorder::$PetscInt ) + fem_ = Ref{PetscFE}() + + @chk ccall( + (:DMCreateFEDefault, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Cchar}, $PetscInt, Ptr{PetscFE}), + dm, Nc, prefix, qorder, fem_, + ) + + fem = fem_[] + + return fem +end + +""" + DMCreateDS(petsclib::PetscLibType,dm::PetscDM) +Create the discrete systems for the `DM` based upon the fields added to the `DM` + +Collective + +Input Parameter: +- `dm` - The `DM` + +Options Database Key: +- `-dm_petscds_view` - View all the `PetscDS` objects in this `DM` + +Level: intermediate + +Developer Note: +The name of this function is wrong. Create functions always return the created object as one of the arguments. + +See also: +=== +`DM`, `DMSetField`, `DMAddField()`, `DMGetDS()`, `DMGetCellDS()`, `DMGetRegionDS()`, `DMSetRegionDS()` + +# External Links +$(_doc_external("DM/DMCreateDS")) +""" +function DMCreateDS(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMCreateDS(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMCreateDS, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMUseTensorOrder(petsclib::PetscLibType,dm::PetscDM, tensor::PetscBool) +Use a tensor product closure ordering for the default section + +Input Parameters: +- `dm` - The DM +- `tensor` - Flag for tensor order + +Level: developer + +-seealso: `DMPlexSetClosurePermutationTensor()`, `PetscSectionResetClosurePermutation()` + +# External Links +$(_doc_external("DM/DMUseTensorOrder")) +""" +function DMUseTensorOrder(petsclib::PetscLibType, dm::PetscDM, tensor::PetscBool) end + +@for_petsc function DMUseTensorOrder(petsclib::$UnionPetscLib, dm::PetscDM, tensor::PetscBool ) + + @chk ccall( + (:DMUseTensorOrder, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, tensor, + ) + + + return nothing +end + +""" + DMComputeExactSolution(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, u::PetscVec, u_t::PetscVec) +Compute the exact solution for a given `DM`, using the `PetscDS` information. + +Collective + +Input Parameters: +- `dm` - The `DM` +- `time` - The time + +Output Parameters: +- `u` - The vector will be filled with exact solution values, or `NULL` +- `u_t` - The vector will be filled with the time derivative of exact solution values, or `NULL` + +Level: developer + +Note: +The user must call `PetscDSSetExactSolution()` before using this routine + +See also: +=== +`DM`, `PetscDSSetExactSolution()` + +# External Links +$(_doc_external("DM/DMComputeExactSolution")) +""" +function DMComputeExactSolution(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, u::PetscVec, u_t::PetscVec) end + +@for_petsc function DMComputeExactSolution(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, u::PetscVec, u_t::PetscVec ) + + @chk ccall( + (:DMComputeExactSolution, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, CVec), + dm, time, u, u_t, + ) + + + return nothing +end + +""" + DMCopyDS(petsclib::PetscLibType,dm::PetscDM, minDegree::PetscInt, maxDegree::PetscInt, newdm::PetscDM) +Copy the discrete systems for the `DM` into another `DM` + +Collective + +Input Parameters: +- `dm` - The `DM` +- `minDegree` - Minimum degree for a discretization, or `PETSC_DETERMINE` for no limit +- `maxDegree` - Maximum degree for a discretization, or `PETSC_DETERMINE` for no limit + +Output Parameter: +- `newdm` - The `DM` + +Level: advanced + +See also: +=== +`DM`, `DMCopyFields()`, `DMAddField()`, `DMGetDS()`, `DMGetCellDS()`, `DMGetRegionDS()`, `DMSetRegionDS()` + +# External Links +$(_doc_external("DM/DMCopyDS")) +""" +function DMCopyDS(petsclib::PetscLibType, dm::PetscDM, minDegree::PetscInt, maxDegree::PetscInt, newdm::PetscDM) end + +@for_petsc function DMCopyDS(petsclib::$UnionPetscLib, dm::PetscDM, minDegree::$PetscInt, maxDegree::$PetscInt, newdm::PetscDM ) + + @chk ccall( + (:DMCopyDS, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, CDM), + dm, minDegree, maxDegree, newdm, + ) + + + return nothing +end + +""" + DMCopyDisc(petsclib::PetscLibType,dm::PetscDM, newdm::PetscDM) +Copy the fields and discrete systems for the `DM` into another `DM` + +Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `newdm` - The `DM` + +Level: advanced + +Developer Note: +Really ugly name, nothing in PETSc is called a `Disc` plus it is an ugly abbreviation + +See also: +=== +`DM`, `DMCopyFields()`, `DMCopyDS()` + +# External Links +$(_doc_external("DM/DMCopyDisc")) +""" +function DMCopyDisc(petsclib::PetscLibType, dm::PetscDM, newdm::PetscDM) end + +@for_petsc function DMCopyDisc(petsclib::$UnionPetscLib, dm::PetscDM, newdm::PetscDM ) + + @chk ccall( + (:DMCopyDisc, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dm, newdm, + ) + + + return nothing +end + +""" + dim::PetscInt = DMGetDimension(petsclib::PetscLibType,dm::PetscDM) +Return the topological dimension of the `DM` + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `dim` - The topological dimension + +Level: beginner + +See also: +=== +`DM`, `DMSetDimension()`, `DMCreate()` + +# External Links +$(_doc_external("DM/DMGetDimension")) +""" +function DMGetDimension(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetDimension(petsclib::$UnionPetscLib, dm::PetscDM ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetDimension, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + DMSetDimension(petsclib::PetscLibType,dm::PetscDM, dim::PetscInt) +Set the topological dimension of the `DM` + +Collective + +Input Parameters: +- `dm` - The `DM` +- `dim` - The topological dimension + +Level: beginner + +See also: +=== +`DM`, `DMGetDimension()`, `DMCreate()` + +# External Links +$(_doc_external("DM/DMSetDimension")) +""" +function DMSetDimension(petsclib::PetscLibType, dm::PetscDM, dim::PetscInt) end + +@for_petsc function DMSetDimension(petsclib::$UnionPetscLib, dm::PetscDM, dim::$PetscInt ) + + @chk ccall( + (:DMSetDimension, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, dim, + ) + + + return nothing +end + +""" + pStart::PetscInt,pEnd::PetscInt = DMGetDimPoints(petsclib::PetscLibType,dm::PetscDM, dim::PetscInt) +Get the half + +Collective + +Input Parameters: +- `dm` - the `DM` +- `dim` - the dimension + +Output Parameters: +- `pStart` - The first point of the given dimension +- `pEnd` - The first point following points of the given dimension + +Level: intermediate + +Note: +The points are vertices in the Hasse diagram encoding the topology. This is explained in +https://arxiv.org/abs/0908.4427. If no points exist of this dimension in the storage scheme, +then the interval is empty. + +See also: +=== +`DM`, `DMPLEX`, `DMPlexGetDepthStratum()`, `DMPlexGetHeightStratum()` + +# External Links +$(_doc_external("DM/DMGetDimPoints")) +""" +function DMGetDimPoints(petsclib::PetscLibType, dm::PetscDM, dim::PetscInt) end + +@for_petsc function DMGetDimPoints(petsclib::$UnionPetscLib, dm::PetscDM, dim::$PetscInt ) + pStart_ = Ref{$PetscInt}() + pEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetDimPoints, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, dim, pStart_, pEnd_, + ) + + pStart = pStart_[] + pEnd = pEnd_[] + + return pStart,pEnd +end + +""" + DMGetOutputDM(petsclib::PetscLibType,dm::PetscDM, odm::PetscDM) +Retrieve the `DM` associated with the layout for output + +Collective + +Input Parameter: +- `dm` - The original `DM` + +Output Parameter: +- `odm` - The `DM` which provides the layout for output + +Level: intermediate + +Note: +In some situations the vector obtained with `DMCreateGlobalVector()` excludes points for degrees of freedom that are associated with fixed (Dirichelet) boundary +conditions since the algebraic solver does not solve for those variables. The output `DM` includes these excluded points and its global vector contains the +locations for those dof so that they can be output to a file or other viewer along with the unconstrained dof. + +See also: +=== +`DM`, `VecView()`, `DMGetGlobalSection()`, `DMCreateGlobalVector()`, `PetscSectionHasConstraints()`, `DMSetGlobalSection()` + +# External Links +$(_doc_external("DM/DMGetOutputDM")) +""" +function DMGetOutputDM(petsclib::PetscLibType, dm::PetscDM, odm::PetscDM) end + +@for_petsc function DMGetOutputDM(petsclib::$UnionPetscLib, dm::PetscDM, odm::PetscDM ) + odm_ = Ref(odm.ptr) + + @chk ccall( + (:DMGetOutputDM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, odm_, + ) + + odm.ptr = odm_[] + + return nothing +end + +""" + num::PetscInt,val::PetscReal = DMGetOutputSequenceNumber(petsclib::PetscLibType,dm::PetscDM) +Retrieve the sequence number/value for output + +Input Parameter: +- `dm` - The original `DM` + +Output Parameters: +- `num` - The output sequence number +- `val` - The output sequence value + +Level: intermediate + +Note: +This is intended for output that should appear in sequence, for instance +a set of timesteps in an `PETSCVIEWERHDF5` file, or a set of realizations of a stochastic system. + +Developer Note: +The `DM` serves as a convenient place to store the current iteration value. The iteration is not +not directly related to the `DM`. + +See also: +=== +`DM`, `VecView()` + +# External Links +$(_doc_external("DM/DMGetOutputSequenceNumber")) +""" +function DMGetOutputSequenceNumber(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetOutputSequenceNumber(petsclib::$UnionPetscLib, dm::PetscDM ) + num_ = Ref{$PetscInt}() + val_ = Ref{$PetscReal}() + + @chk ccall( + (:DMGetOutputSequenceNumber, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscReal}), + dm, num_, val_, + ) + + num = num_[] + val = val_[] + + return num,val +end + +""" + DMSetOutputSequenceNumber(petsclib::PetscLibType,dm::PetscDM, num::PetscInt, val::PetscReal) +Set the sequence number/value for output + +Input Parameters: +- `dm` - The original `DM` +- `num` - The output sequence number +- `val` - The output sequence value + +Level: intermediate + +Note: +This is intended for output that should appear in sequence, for instance +a set of timesteps in an `PETSCVIEWERHDF5` file, or a set of realizations of a stochastic system. + +See also: +=== +`DM`, `VecView()` + +# External Links +$(_doc_external("DM/DMSetOutputSequenceNumber")) +""" +function DMSetOutputSequenceNumber(petsclib::PetscLibType, dm::PetscDM, num::PetscInt, val::PetscReal) end + +@for_petsc function DMSetOutputSequenceNumber(petsclib::$UnionPetscLib, dm::PetscDM, num::$PetscInt, val::$PetscReal ) + + @chk ccall( + (:DMSetOutputSequenceNumber, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscReal), + dm, num, val, + ) + + + return nothing +end + +""" + val::PetscReal = DMOutputSequenceLoad(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, name::String, num::PetscInt) +Retrieve the sequence value from a `PetscViewer` + +Input Parameters: +- `dm` - The original `DM` +- `viewer` - The `PetscViewer` to get it from +- `name` - The sequence name +- `num` - The output sequence number + +Output Parameter: +- `val` - The output sequence value + +Level: intermediate + +Note: +This is intended for output that should appear in sequence, for instance +a set of timesteps in an `PETSCVIEWERHDF5` file, or a set of realizations of a stochastic system. + +Developer Note: +It is unclear at the user API level why a `DM` is needed as input + +See also: +=== +`DM`, `DMGetOutputSequenceNumber()`, `DMSetOutputSequenceNumber()`, `VecView()` + +# External Links +$(_doc_external("DM/DMOutputSequenceLoad")) +""" +function DMOutputSequenceLoad(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, name::String, num::PetscInt) end + +@for_petsc function DMOutputSequenceLoad(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, name::String, num::$PetscInt ) + val_ = Ref{$PetscReal}() + + @chk ccall( + (:DMOutputSequenceLoad, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, Ptr{Cchar}, $PetscInt, Ptr{$PetscReal}), + dm, viewer, name, num, val_, + ) + + val = val_[] + + return val +end + +""" + len::PetscInt = DMGetOutputSequenceLength(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, name::String) +Retrieve the number of sequence values from a `PetscViewer` + +Input Parameters: +- `dm` - The original `DM` +- `viewer` - The `PetscViewer` to get it from +- `name` - The sequence name + +Output Parameter: +- `len` - The length of the output sequence + +Level: intermediate + +Note: +This is intended for output that should appear in sequence, for instance +a set of timesteps in an `PETSCVIEWERHDF5` file, or a set of realizations of a stochastic system. + +Developer Note: +It is unclear at the user API level why a `DM` is needed as input + +See also: +=== +`DM`, `DMGetOutputSequenceNumber()`, `DMSetOutputSequenceNumber()`, `VecView()` + +# External Links +$(_doc_external("DM/DMGetOutputSequenceLength")) +""" +function DMGetOutputSequenceLength(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, name::String) end + +@for_petsc function DMGetOutputSequenceLength(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, name::String ) + len_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetOutputSequenceLength, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, Ptr{Cchar}, Ptr{$PetscInt}), + dm, viewer, name, len_, + ) + + len = len_[] + + return len +end + +""" + useNatural::PetscBool = DMGetUseNatural(petsclib::PetscLibType,dm::PetscDM) +Get the flag for creating a mapping to the natural order when a `DM` is (re)distributed in parallel + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `useNatural` - `PETSC_TRUE` to build the mapping to a natural order during distribution + +Level: beginner + +See also: +=== +`DM`, `DMSetUseNatural()`, `DMCreate()` + +# External Links +$(_doc_external("DM/DMGetUseNatural")) +""" +function DMGetUseNatural(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetUseNatural(petsclib::$UnionPetscLib, dm::PetscDM ) + useNatural_ = Ref{PetscBool}() + + @chk ccall( + (:DMGetUseNatural, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, useNatural_, + ) + + useNatural = useNatural_[] + + return useNatural +end + +""" + DMSetUseNatural(petsclib::PetscLibType,dm::PetscDM, useNatural::PetscBool) +Set the flag for creating a mapping to the natural order when a `DM` is (re)distributed in parallel + +Collective + +Input Parameters: +- `dm` - The `DM` +- `useNatural` - `PETSC_TRUE` to build the mapping to a natural order during distribution + +Level: beginner + +Note: +This also causes the map to be build after `DMCreateSubDM()` and `DMCreateSuperDM()` + +See also: +=== +`DM`, `DMGetUseNatural()`, `DMCreate()`, `DMPlexDistribute()`, `DMCreateSubDM()`, `DMCreateSuperDM()` + +# External Links +$(_doc_external("DM/DMSetUseNatural")) +""" +function DMSetUseNatural(petsclib::PetscLibType, dm::PetscDM, useNatural::PetscBool) end + +@for_petsc function DMSetUseNatural(petsclib::$UnionPetscLib, dm::PetscDM, useNatural::PetscBool ) + + @chk ccall( + (:DMSetUseNatural, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, useNatural, + ) + + + return nothing +end + +""" + DMCreateLabel(petsclib::PetscLibType,dm::PetscDM, name::String) +Create a label of the given name if it does not already exist in the `DM` + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name + +Level: intermediate + +See also: +=== +`DM`, `DMLabelCreate()`, `DMHasLabel()`, `DMGetLabelValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMCreateLabel")) +""" +function DMCreateLabel(petsclib::PetscLibType, dm::PetscDM, name::String) end + +@for_petsc function DMCreateLabel(petsclib::$UnionPetscLib, dm::PetscDM, name::String ) + + @chk ccall( + (:DMCreateLabel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + dm, name, + ) + + + return nothing +end + +""" + DMCreateLabelAtIndex(petsclib::PetscLibType,dm::PetscDM, l::PetscInt, name::String) +Create a label of the given name at the given index. If it already exists in the `DM`, move it to this index. + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `l` - The index for the label +- `name` - The label name + +Level: intermediate + +See also: +=== +`DM`, `DMCreateLabel()`, `DMLabelCreate()`, `DMHasLabel()`, `DMGetLabelValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMCreateLabelAtIndex")) +""" +function DMCreateLabelAtIndex(petsclib::PetscLibType, dm::PetscDM, l::PetscInt, name::String) end + +@for_petsc function DMCreateLabelAtIndex(petsclib::$UnionPetscLib, dm::PetscDM, l::$PetscInt, name::String ) + + @chk ccall( + (:DMCreateLabelAtIndex, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Cchar}), + dm, l, name, + ) + + + return nothing +end + +""" + value::PetscInt = DMGetLabelValue(petsclib::PetscLibType,dm::PetscDM, name::String, point::PetscInt) +Get the value in a `DMLabel` for the given point, with + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name +- `point` - The mesh point + +Output Parameter: +- `value` - The label value for this point, or -1 if the point is not in the label + +Level: beginner + +See also: +=== +`DM`, `DMLabelGetValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMGetLabelValue")) +""" +function DMGetLabelValue(petsclib::PetscLibType, dm::PetscDM, name::String, point::PetscInt) end + +@for_petsc function DMGetLabelValue(petsclib::$UnionPetscLib, dm::PetscDM, name::String, point::$PetscInt ) + value_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetLabelValue, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscInt, Ptr{$PetscInt}), + dm, name, point, value_, + ) + + value = value_[] + + return value +end + +""" + DMSetLabelValue(petsclib::PetscLibType,dm::PetscDM, name::String, point::PetscInt, value::PetscInt) +Add a point to a `DMLabel` with given value + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name +- `point` - The mesh point +- `value` - The label value for this point + +Output Parameter: + +Level: beginner + +See also: +=== +`DM`, `DMLabelSetValue()`, `DMGetStratumIS()`, `DMClearLabelValue()` + +# External Links +$(_doc_external("DM/DMSetLabelValue")) +""" +function DMSetLabelValue(petsclib::PetscLibType, dm::PetscDM, name::String, point::PetscInt, value::PetscInt) end + +@for_petsc function DMSetLabelValue(petsclib::$UnionPetscLib, dm::PetscDM, name::String, point::$PetscInt, value::$PetscInt ) + + @chk ccall( + (:DMSetLabelValue, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscInt, $PetscInt), + dm, name, point, value, + ) + + + return nothing +end + +""" + DMClearLabelValue(petsclib::PetscLibType,dm::PetscDM, name::String, point::PetscInt, value::PetscInt) +Remove a point from a `DMLabel` with given value + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name +- `point` - The mesh point +- `value` - The label value for this point + +Level: beginner + +See also: +=== +`DM`, `DMLabelClearValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMClearLabelValue")) +""" +function DMClearLabelValue(petsclib::PetscLibType, dm::PetscDM, name::String, point::PetscInt, value::PetscInt) end + +@for_petsc function DMClearLabelValue(petsclib::$UnionPetscLib, dm::PetscDM, name::String, point::$PetscInt, value::$PetscInt ) + + @chk ccall( + (:DMClearLabelValue, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscInt, $PetscInt), + dm, name, point, value, + ) + + + return nothing +end + +""" + size::PetscInt = DMGetLabelSize(petsclib::PetscLibType,dm::PetscDM, name::String) +Get the value of `DMLabelGetNumValues()` of a `DMLabel` in the `DM` + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name + +Output Parameter: +- `size` - The number of different integer ids, or 0 if the label does not exist + +Level: beginner + +Developer Note: +This should be renamed to something like `DMGetLabelNumValues()` or removed. + +See also: +=== +`DM`, `DMLabelGetNumValues()`, `DMSetLabelValue()`, `DMGetLabel()` + +# External Links +$(_doc_external("DM/DMGetLabelSize")) +""" +function DMGetLabelSize(petsclib::PetscLibType, dm::PetscDM, name::String) end + +@for_petsc function DMGetLabelSize(petsclib::$UnionPetscLib, dm::PetscDM, name::String ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetLabelSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{$PetscInt}), + dm, name, size_, + ) + + size = size_[] + + return size +end + +""" + DMGetLabelIdIS(petsclib::PetscLibType,dm::PetscDM, name::String, ids::IS) +Get the `DMLabelGetValueIS()` from a `DMLabel` in the `DM` + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name + +Output Parameter: +- `ids` - The integer ids, or `NULL` if the label does not exist + +Level: beginner + +See also: +=== +`DM`, `DMLabelGetValueIS()`, `DMGetLabelSize()` + +# External Links +$(_doc_external("DM/DMGetLabelIdIS")) +""" +function DMGetLabelIdIS(petsclib::PetscLibType, dm::PetscDM, name::String, ids::IS) end + +@for_petsc function DMGetLabelIdIS(petsclib::$UnionPetscLib, dm::PetscDM, name::String, ids::IS ) + + @chk ccall( + (:DMGetLabelIdIS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{CIS}), + dm, name, ids, + ) + + + return nothing +end + +""" + size::PetscInt = DMGetStratumSize(petsclib::PetscLibType,dm::PetscDM, name::String, value::PetscInt) +Get the number of points in a label stratum + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name of the stratum +- `value` - The stratum value + +Output Parameter: +- `size` - The number of points, also called the stratum size + +Level: beginner + +See also: +=== +`DM`, `DMLabelGetStratumSize()`, `DMGetLabelSize()`, `DMGetLabelIds()` + +# External Links +$(_doc_external("DM/DMGetStratumSize")) +""" +function DMGetStratumSize(petsclib::PetscLibType, dm::PetscDM, name::String, value::PetscInt) end + +@for_petsc function DMGetStratumSize(petsclib::$UnionPetscLib, dm::PetscDM, name::String, value::$PetscInt ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetStratumSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscInt, Ptr{$PetscInt}), + dm, name, value, size_, + ) + + size = size_[] + + return size +end + +""" + DMGetStratumIS(petsclib::PetscLibType,dm::PetscDM, name::String, value::PetscInt, points::IS) +Get the points in a label stratum + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name +- `value` - The stratum value + +Output Parameter: +- `points` - The stratum points, or `NULL` if the label does not exist or does not have that value + +Level: beginner + +See also: +=== +`DM`, `DMLabelGetStratumIS()`, `DMGetStratumSize()` + +# External Links +$(_doc_external("DM/DMGetStratumIS")) +""" +function DMGetStratumIS(petsclib::PetscLibType, dm::PetscDM, name::String, value::PetscInt, points::IS) end + +@for_petsc function DMGetStratumIS(petsclib::$UnionPetscLib, dm::PetscDM, name::String, value::$PetscInt, points::IS ) + + @chk ccall( + (:DMGetStratumIS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscInt, Ptr{CIS}), + dm, name, value, points, + ) + + + return nothing +end + +""" + DMSetStratumIS(petsclib::PetscLibType,dm::PetscDM, name::String, value::PetscInt, points::IS) +Set the points in a label stratum + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name +- `value` - The stratum value +- `points` - The stratum points + +Level: beginner + +See also: +=== +`DM`, `DMLabel`, `DMClearLabelStratum()`, `DMLabelClearStratum()`, `DMLabelSetStratumIS()`, `DMGetStratumSize()` + +# External Links +$(_doc_external("DM/DMSetStratumIS")) +""" +function DMSetStratumIS(petsclib::PetscLibType, dm::PetscDM, name::String, value::PetscInt, points::CIS) end + +@for_petsc function DMSetStratumIS(petsclib::$UnionPetscLib, dm::PetscDM, name::String, value::$PetscInt, points::IS ) + + @chk ccall( + (:DMSetStratumIS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscInt, CIS), + dm, name, value, points, + ) + + + return nothing +end + +""" + DMClearLabelStratum(petsclib::PetscLibType,dm::PetscDM, name::String, value::PetscInt) +Remove all points from a stratum from a `DMLabel` + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name +- `value` - The label value for this point + +Output Parameter: + +Level: beginner + +See also: +=== +`DM`, `DMLabel`, `DMLabelClearStratum()`, `DMSetLabelValue()`, `DMGetStratumIS()`, `DMClearLabelValue()` + +# External Links +$(_doc_external("DM/DMClearLabelStratum")) +""" +function DMClearLabelStratum(petsclib::PetscLibType, dm::PetscDM, name::String, value::PetscInt) end + +@for_petsc function DMClearLabelStratum(petsclib::$UnionPetscLib, dm::PetscDM, name::String, value::$PetscInt ) + + @chk ccall( + (:DMClearLabelStratum, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscInt), + dm, name, value, + ) + + + return nothing +end + +""" + numLabels::PetscInt = DMGetNumLabels(petsclib::PetscLibType,dm::PetscDM) +Return the number of labels defined by on the `DM` + +Not Collective + +Input Parameter: +- `dm` - The `DM` object + +Output Parameter: +- `numLabels` - the number of Labels + +Level: intermediate + +See also: +=== +`DM`, `DMLabel`, `DMGetLabelByNum()`, `DMGetLabelName()`, `DMGetLabelValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMGetNumLabels")) +""" +function DMGetNumLabels(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetNumLabels(petsclib::$UnionPetscLib, dm::PetscDM ) + numLabels_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetNumLabels, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, numLabels_, + ) + + numLabels = numLabels_[] + + return numLabels +end + +""" + DMGetLabelName(petsclib::PetscLibType,dm::PetscDM, n::PetscInt, name::String) +Return the name of nth label + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `n` - the label number + +Output Parameter: +- `name` - the label name + +Level: intermediate + +Developer Note: +Some of the functions that appropriate on labels using their number have the suffix ByNum, others do not. + +See also: +=== +`DM`, `DMLabel`, `DMGetLabelByNum()`, `DMGetLabel()`, `DMGetLabelValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMGetLabelName")) +""" +function DMGetLabelName(petsclib::PetscLibType, dm::PetscDM, n::PetscInt, name::String) end + +@for_petsc function DMGetLabelName(petsclib::$UnionPetscLib, dm::PetscDM, n::$PetscInt, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:DMGetLabelName, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}), + dm, n, name_, + ) + + + return nothing +end + +""" + hasLabel::PetscBool = DMHasLabel(petsclib::PetscLibType,dm::PetscDM, name::String) +Determine whether the `DM` has a label of a given name + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name + +Output Parameter: +- `hasLabel` - `PETSC_TRUE` if the label is present + +Level: intermediate + +See also: +=== +`DM`, `DMLabel`, `DMGetLabel()`, `DMGetLabelByNum()`, `DMCreateLabel()`, `DMGetLabelValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMHasLabel")) +""" +function DMHasLabel(petsclib::PetscLibType, dm::PetscDM, name::String) end + +@for_petsc function DMHasLabel(petsclib::$UnionPetscLib, dm::PetscDM, name::String ) + hasLabel_ = Ref{PetscBool}() + + @chk ccall( + (:DMHasLabel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{PetscBool}), + dm, name, hasLabel_, + ) + + hasLabel = hasLabel_[] + + return hasLabel +end + +""" + DMGetLabel(petsclib::PetscLibType,dm::PetscDM, name::String, label::DMLabel) +Return the label of a given name, or `NULL`, from a `DM` + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name + +Output Parameter: +- `label` - The `DMLabel`, or `NULL` if the label is absent + +Default labels in a `DMPLEX`: +- `"depth"` - Holds the depth (co-dimension) of each mesh point +- `"celltype"` - Holds the topological type of each cell +- `"ghost"` - If the DM is distributed with overlap, this marks the cells and faces in the overlap +- `"Cell Sets"` - Mirrors the cell sets defined by GMsh and ExodusII +- `"Face Sets"` - Mirrors the face sets defined by GMsh and ExodusII +- `"Vertex Sets"` - Mirrors the vertex sets defined by GMsh + +Level: intermediate + +See also: +=== +`DM`, `DMLabel`, `DMHasLabel()`, `DMGetLabelByNum()`, `DMAddLabel()`, `DMCreateLabel()`, `DMPlexGetDepthLabel()`, `DMPlexGetCellType()` + +# External Links +$(_doc_external("DM/DMGetLabel")) +""" +function DMGetLabel(petsclib::PetscLibType, dm::PetscDM, name::String, label::DMLabel) end + +@for_petsc function DMGetLabel(petsclib::$UnionPetscLib, dm::PetscDM, name::String, label::DMLabel ) + + @chk ccall( + (:DMGetLabel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{DMLabel}), + dm, name, label, + ) + + + return nothing +end + +""" + DMGetLabelByNum(petsclib::PetscLibType,dm::PetscDM, n::PetscInt, label::DMLabel) +Return the nth label on a `DM` + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `n` - the label number + +Output Parameter: +- `label` - the label + +Level: intermediate + +See also: +=== +`DM`, `DMLabel`, `DMAddLabel()`, `DMGetLabelValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMGetLabelByNum")) +""" +function DMGetLabelByNum(petsclib::PetscLibType, dm::PetscDM, n::PetscInt, label::DMLabel) end + +@for_petsc function DMGetLabelByNum(petsclib::$UnionPetscLib, dm::PetscDM, n::$PetscInt, label::DMLabel ) + + @chk ccall( + (:DMGetLabelByNum, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{DMLabel}), + dm, n, label, + ) + + + return nothing +end + +""" + DMAddLabel(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) +Add the label to this `DM` + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `label` - The `DMLabel` + +Level: developer + +See also: +=== +`DM`, `DMLabel`, `DMCreateLabel()`, `DMHasLabel()`, `DMGetLabelValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMAddLabel")) +""" +function DMAddLabel(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMAddLabel(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + + @chk ccall( + (:DMAddLabel, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, label, + ) + + + return nothing +end + +""" + DMSetLabel(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) +Replaces the label of a given name, or ignores it if the name is not present + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `label` - The `DMLabel`, having the same name, to substitute + +Default labels in a `DMPLEX`: +- `"depth"` - Holds the depth (co-dimension) of each mesh point +- `"celltype"` - Holds the topological type of each cell +- `"ghost"` - If the DM is distributed with overlap, this marks the cells and faces in the overlap +- `"Cell Sets"` - Mirrors the cell sets defined by GMsh and ExodusII +- `"Face Sets"` - Mirrors the face sets defined by GMsh and ExodusII +- `"Vertex Sets"` - Mirrors the vertex sets defined by GMsh + +Level: intermediate + +See also: +=== +`DM`, `DMLabel`, `DMCreateLabel()`, `DMHasLabel()`, `DMPlexGetDepthLabel()`, `DMPlexGetCellType()` + +# External Links +$(_doc_external("DM/DMSetLabel")) +""" +function DMSetLabel(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMSetLabel(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + + @chk ccall( + (:DMSetLabel, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, label, + ) + + + return nothing +end + +""" + DMRemoveLabel(petsclib::PetscLibType,dm::PetscDM, name::String, label::DMLabel) +Remove the label given by name from this `DM` + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name + +Output Parameter: +- `label` - The `DMLabel`, or `NULL` if the label is absent. Pass in `NULL` to call `DMLabelDestroy()` on the label, otherwise the +caller is responsible for calling `DMLabelDestroy()`. + +Level: developer + +See also: +=== +`DM`, `DMLabel`, `DMCreateLabel()`, `DMHasLabel()`, `DMGetLabel()`, `DMGetLabelValue()`, `DMSetLabelValue()`, `DMLabelDestroy()`, `DMRemoveLabelBySelf()` + +# External Links +$(_doc_external("DM/DMRemoveLabel")) +""" +function DMRemoveLabel(petsclib::PetscLibType, dm::PetscDM, name::String, label::DMLabel) end + +@for_petsc function DMRemoveLabel(petsclib::$UnionPetscLib, dm::PetscDM, name::String, label::DMLabel ) + + @chk ccall( + (:DMRemoveLabel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{DMLabel}), + dm, name, label, + ) + + + return nothing +end + +""" + DMRemoveLabelBySelf(petsclib::PetscLibType,dm::PetscDM, label::DMLabel, failNotFound::PetscBool) +Remove the label from this `DM` + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `label` - The `DMLabel` to be removed from the `DM` +- `failNotFound` - Should it fail if the label is not found in the `DM`? + +Level: developer + +Note: +Only exactly the same instance is removed if found, name match is ignored. +If the `DM` has an exclusive reference to the label, the label gets destroyed and +*label nullified. + +See also: +=== +`DM`, `DMLabel`, `DMCreateLabel()`, `DMHasLabel()`, `DMGetLabel()` `DMGetLabelValue()`, `DMSetLabelValue()`, `DMLabelDestroy()`, `DMRemoveLabel()` + +# External Links +$(_doc_external("DM/DMRemoveLabelBySelf")) +""" +function DMRemoveLabelBySelf(petsclib::PetscLibType, dm::PetscDM, label::DMLabel, failNotFound::PetscBool) end + +@for_petsc function DMRemoveLabelBySelf(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel, failNotFound::PetscBool ) + + @chk ccall( + (:DMRemoveLabelBySelf, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMLabel}, PetscBool), + dm, label, failNotFound, + ) + + + return nothing +end + +""" + output::PetscBool = DMGetLabelOutput(petsclib::PetscLibType,dm::PetscDM, name::String) +Get the output flag for a given label + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name + +Output Parameter: +- `output` - The flag for output + +Level: developer + +See also: +=== +`DM`, `DMLabel`, `DMSetLabelOutput()`, `DMCreateLabel()`, `DMHasLabel()`, `DMGetLabelValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMGetLabelOutput")) +""" +function DMGetLabelOutput(petsclib::PetscLibType, dm::PetscDM, name::String) end + +@for_petsc function DMGetLabelOutput(petsclib::$UnionPetscLib, dm::PetscDM, name::String ) + output_ = Ref{PetscBool}() + + @chk ccall( + (:DMGetLabelOutput, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{PetscBool}), + dm, name, output_, + ) + + output = output_[] + + return output +end + +""" + DMSetLabelOutput(petsclib::PetscLibType,dm::PetscDM, name::String, output::PetscBool) +Set if a given label should be saved to a `PetscViewer` in calls to `DMView()` + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - The label name +- `output` - `PETSC_TRUE` to save the label to the viewer + +Level: developer + +See also: +=== +`DM`, `DMLabel`, `DMGetOutputFlag()`, `DMGetLabelOutput()`, `DMCreateLabel()`, `DMHasLabel()`, `DMGetLabelValue()`, `DMSetLabelValue()`, `DMGetStratumIS()` + +# External Links +$(_doc_external("DM/DMSetLabelOutput")) +""" +function DMSetLabelOutput(petsclib::PetscLibType, dm::PetscDM, name::String, output::PetscBool) end + +@for_petsc function DMSetLabelOutput(petsclib::$UnionPetscLib, dm::PetscDM, name::String, output::PetscBool ) + + @chk ccall( + (:DMSetLabelOutput, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, PetscBool), + dm, name, output, + ) + + + return nothing +end + +""" + DMCopyLabels(petsclib::PetscLibType,dmA::PetscDM, dmB::PetscDM, mode::PetscCopyMode, all::PetscBool, emode::DMCopyLabelsMode) +Copy labels from one `DM` mesh to another `DM` with a superset of the points + +Collective + +Input Parameters: +- `dmA` - The `DM` object with initial labels +- `dmB` - The `DM` object to which labels are copied +- `mode` - Copy labels by pointers (`PETSC_OWN_POINTER`) or duplicate them (`PETSC_COPY_VALUES`) +- `all` - Copy all labels including "depth", "dim", and "celltype" (`PETSC_TRUE`) which are otherwise ignored (`PETSC_FALSE`) +- `emode` - How to behave when a `DMLabel` in the source and destination `DM`s with the same name is encountered (see `DMCopyLabelsMode`) + +Level: intermediate + +Note: +This is typically used when interpolating or otherwise adding to a mesh, or testing. + +See also: +=== +`DM`, `DMLabel`, `DMAddLabel()`, `DMCopyLabelsMode` + +# External Links +$(_doc_external("DM/DMCopyLabels")) +""" +function DMCopyLabels(petsclib::PetscLibType, dmA::PetscDM, dmB::PetscDM, mode::PetscCopyMode, all::PetscBool, emode::DMCopyLabelsMode) end + +@for_petsc function DMCopyLabels(petsclib::$UnionPetscLib, dmA::PetscDM, dmB::PetscDM, mode::PetscCopyMode, all::PetscBool, emode::DMCopyLabelsMode ) + + @chk ccall( + (:DMCopyLabels, $petsc_library), + PetscErrorCode, + (CDM, CDM, PetscCopyMode, PetscBool, DMCopyLabelsMode), + dmA, dmB, mode, all, emode, + ) + + + return nothing +end + +""" + equal::PetscBool = DMCompareLabels(petsclib::PetscLibType,dm0::PetscDM, dm1::PetscDM, message::String) +Compare labels between two `DM` objects + +Collective; No Fortran Support + +Input Parameters: +- `dm0` - First `DM` object +- `dm1` - Second `DM` object + +Output Parameters: +- `equal` - (Optional) Flag whether labels of `dm0` and `dm1` are the same +- `message` - (Optional) Message describing the difference, or `NULL` if there is no difference + +Level: intermediate + +Notes: +The output flag equal will be the same on all processes. + +If equal is passed as `NULL` and difference is found, an error is thrown on all processes. + +Make sure to pass equal is `NULL` on all processes or none of them. + +The output message is set independently on each rank. + +message must be freed with `PetscFree()` + +If message is passed as `NULL` and a difference is found, the difference description is printed to `stderr` in synchronized manner. + +Make sure to pass message as `NULL` on all processes or no processes. + +Labels are matched by name. If the number of labels and their names are equal, +`DMLabelCompare()` is used to compare each pair of labels with the same name. + +Developer Note: +Cannot automatically generate the Fortran stub because `message` must be freed with `PetscFree()` + +See also: +=== +`DM`, `DMLabel`, `DMAddLabel()`, `DMCopyLabelsMode`, `DMLabelCompare()` + +# External Links +$(_doc_external("DM/DMCompareLabels")) +""" +function DMCompareLabels(petsclib::PetscLibType, dm0::PetscDM, dm1::PetscDM, message::String) end + +@for_petsc function DMCompareLabels(petsclib::$UnionPetscLib, dm0::PetscDM, dm1::PetscDM, message::String ) + equal_ = Ref{PetscBool}() + message_ = Ref(pointer(message)) + + @chk ccall( + (:DMCompareLabels, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{PetscBool}, Ptr{Ptr{Cchar}}), + dm0, dm1, equal_, message_, + ) + + equal = equal_[] + + return equal +end + +""" + DMGetCoarseDM(petsclib::PetscLibType,dm::PetscDM, cdm::PetscDM) +Get the coarse `DM`from which this `DM` was obtained by refinement + +Not Collective + +Input Parameter: +- `dm` - The `DM` object + +Output Parameter: +- `cdm` - The coarse `DM` + +Level: intermediate + +See also: +=== +`DM`, `DMSetCoarseDM()`, `DMCoarsen()` + +# External Links +$(_doc_external("DM/DMGetCoarseDM")) +""" +function DMGetCoarseDM(petsclib::PetscLibType, dm::PetscDM, cdm::PetscDM) end + +@for_petsc function DMGetCoarseDM(petsclib::$UnionPetscLib, dm::PetscDM, cdm::PetscDM ) + cdm_ = Ref(cdm.ptr) + + @chk ccall( + (:DMGetCoarseDM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, cdm_, + ) + + cdm.ptr = cdm_[] + + return nothing +end + +""" + DMSetCoarseDM(petsclib::PetscLibType,dm::PetscDM, cdm::PetscDM) +Set the coarse `DM` from which this `DM` was obtained by refinement + +Input Parameters: +- `dm` - The `DM` object +- `cdm` - The coarse `DM` + +Level: intermediate + +Note: +Normally this is set automatically by `DMRefine()` + +See also: +=== +`DM`, `DMGetCoarseDM()`, `DMCoarsen()`, `DMSetRefine()`, `DMSetFineDM()` + +# External Links +$(_doc_external("DM/DMSetCoarseDM")) +""" +function DMSetCoarseDM(petsclib::PetscLibType, dm::PetscDM, cdm::PetscDM) end + +@for_petsc function DMSetCoarseDM(petsclib::$UnionPetscLib, dm::PetscDM, cdm::PetscDM ) + + @chk ccall( + (:DMSetCoarseDM, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dm, cdm, + ) + + + return nothing +end + +""" + DMGetFineDM(petsclib::PetscLibType,dm::PetscDM, fdm::PetscDM) +Get the fine mesh from which this `DM` was obtained by coarsening + +Input Parameter: +- `dm` - The `DM` object + +Output Parameter: +- `fdm` - The fine `DM` + +Level: intermediate + +See also: +=== +`DM`, `DMSetFineDM()`, `DMCoarsen()`, `DMRefine()` + +# External Links +$(_doc_external("DM/DMGetFineDM")) +""" +function DMGetFineDM(petsclib::PetscLibType, dm::PetscDM, fdm::PetscDM) end + +@for_petsc function DMGetFineDM(petsclib::$UnionPetscLib, dm::PetscDM, fdm::PetscDM ) + fdm_ = Ref(fdm.ptr) + + @chk ccall( + (:DMGetFineDM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, fdm_, + ) + + fdm.ptr = fdm_[] + + return nothing +end + +""" + DMSetFineDM(petsclib::PetscLibType,dm::PetscDM, fdm::PetscDM) +Set the fine mesh from which this was obtained by coarsening + +Input Parameters: +- `dm` - The `DM` object +- `fdm` - The fine `DM` + +Level: developer + +Note: +Normally this is set automatically by `DMCoarsen()` + +See also: +=== +`DM`, `DMGetFineDM()`, `DMCoarsen()`, `DMRefine()` + +# External Links +$(_doc_external("DM/DMSetFineDM")) +""" +function DMSetFineDM(petsclib::PetscLibType, dm::PetscDM, fdm::PetscDM) end + +@for_petsc function DMSetFineDM(petsclib::$UnionPetscLib, dm::PetscDM, fdm::PetscDM ) + + @chk ccall( + (:DMSetFineDM, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dm, fdm, + ) + + + return nothing +end + +""" + bd::PetscInt = DMAddBoundary(petsclib::PetscLibType,dm::PetscDM, type::DMBoundaryConditionType, name::String, label::DMLabel, Nv::PetscInt, values::Vector{PetscInt}, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid) +Add a boundary condition, for a single field, to a model represented by a `DM` + +Collective + +Input Parameters: +- `dm` - The `DM`, with a `PetscDS` that matches the problem being constrained +- `type` - The type of condition, e.g. `DM_BC_ESSENTIAL_ANALYTIC`, `DM_BC_ESSENTIAL_FIELD` (Dirichlet), or `DM_BC_NATURAL` (Neumann) +- `name` - The BC name +- `label` - The label defining constrained points +- `Nv` - The number of `DMLabel` values for constrained points +- `values` - An array of values for constrained points +- `field` - The field to constrain +- `Nc` - The number of constrained field components (0 will constrain all components) +- `comps` - An array of constrained component numbers +- `bcFunc` - A pointwise function giving boundary values +- `bcFunc_t` - A pointwise function giving the time derivative of the boundary values, or `NULL` +- `ctx` - An optional user context for bcFunc + +Output Parameter: +- `bd` - (Optional) Boundary number + +Options Database Keys: +- `-bc_ ` - Overrides the boundary ids +- `-bc__comp ` - Overrides the boundary components + +Level: intermediate + +Notes: +If the `DM` is of type `DMPLEX` and the field is of type `PetscFE`, then this function completes the label using `DMPlexLabelComplete()`. + +Both bcFunc and bcFunc_t will depend on the boundary condition type. If the type if `DM_BC_ESSENTIAL`, then the calling sequence is: +-vb +void bcFunc(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar bcval[]) +-ve + +If the type is `DM_BC_ESSENTIAL_FIELD` or other _FIELD value, then the calling sequence is: + +-vb +void bcFunc(PetscInt dim, PetscInt Nf, PetscInt NfAux, +const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], +const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], +PetscReal time, const PetscReal x[], PetscScalar bcval[]) +-ve +- `dim` - the spatial dimension +- `Nf` - the number of fields +- `uOff` - the offset into u[] and u_t[] for each field +- `uOff_x` - the offset into u_x[] for each field +- `u` - each field evaluated at the current point +- `u_t` - the time derivative of each field evaluated at the current point +- `u_x` - the gradient of each field evaluated at the current point +- `aOff` - the offset into a[] and a_t[] for each auxiliary field +- `aOff_x` - the offset into a_x[] for each auxiliary field +- `a` - each auxiliary field evaluated at the current point +- `a_t` - the time derivative of each auxiliary field evaluated at the current point +- `a_x` - the gradient of auxiliary each field evaluated at the current point +- `t` - current time +- `x` - coordinates of the current point +- `numConstants` - number of constant parameters +- `constants` - constant parameters +- `bcval` - output values at the current point + +See also: +=== +`DM`, `DSGetBoundary()`, `PetscDSAddBoundary()` + +# External Links +$(_doc_external("DM/DMAddBoundary")) +""" +function DMAddBoundary(petsclib::PetscLibType, dm::PetscDM, type::DMBoundaryConditionType, name::String, label::DMLabel, Nv::PetscInt, values::Vector{PetscInt}, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid) end + +@for_petsc function DMAddBoundary(petsclib::$UnionPetscLib, dm::PetscDM, type::DMBoundaryConditionType, name::String, label::DMLabel, Nv::$PetscInt, values::Vector{$PetscInt}, field::$PetscInt, Nc::$PetscInt, comps::Vector{$PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid ) + bd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMAddBoundary, $petsc_library), + PetscErrorCode, + (CDM, DMBoundaryConditionType, Ptr{Cchar}, DMLabel, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{PetscVoidFn}, Ptr{PetscVoidFn}, Ptr{Cvoid}, Ptr{$PetscInt}), + dm, type, name, label, Nv, values, field, Nc, comps, bcFunc, bcFunc_t, ctx, bd_, + ) + + bd = bd_[] + + return bd +end + +""" + isBd::PetscBool = DMIsBoundaryPoint(petsclib::PetscLibType,dm::PetscDM, point::PetscInt) + +# External Links +$(_doc_external("DM/DMIsBoundaryPoint")) +""" +function DMIsBoundaryPoint(petsclib::PetscLibType, dm::PetscDM, point::PetscInt) end + +@for_petsc function DMIsBoundaryPoint(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt ) + isBd_ = Ref{PetscBool}() + + @chk ccall( + (:DMIsBoundaryPoint, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscBool}), + dm, point, isBd_, + ) + + isBd = isBd_[] + + return isBd +end + +""" + hasBound::PetscBool = DMHasBound(petsclib::PetscLibType,dm::PetscDM) +Determine whether a bound condition was specified + +Logically collective + +Input Parameter: +- `dm` - The `DM`, with a `PetscDS` that matches the problem being constrained + +Output Parameter: +- `hasBound` - Flag indicating if a bound condition was specified + +Level: intermediate + +See also: +=== +`DM`, `DSAddBoundary()`, `PetscDSAddBoundary()` + +# External Links +$(_doc_external("DM/DMHasBound")) +""" +function DMHasBound(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMHasBound(petsclib::$UnionPetscLib, dm::PetscDM ) + hasBound_ = Ref{PetscBool}() + + @chk ccall( + (:DMHasBound, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, hasBound_, + ) + + hasBound = hasBound_[] + + return hasBound +end + +#= +""" + DMProjectFieldLocal(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, locU::PetscVec, ::Cvoid(funcs) +This projects the given function of the input fields into the function space provided by the `DM`, putting the coefficients in a local vector. + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `time` - The time +- `localU` - The input field vector; may be `NULL` if projection is defined purely by coordinates +- `funcs` - The functions to evaluate, one per field +- `mode` - The insertion mode for values + +Output Parameter: +- `localX` - The output vector + +Calling sequence of `funcs`: +- `dim` - The spatial dimension +- `Nf` - The number of input fields +- `NfAux` - The number of input auxiliary fields +- `uOff` - The offset of each field in u[] +- `uOff_x` - The offset of each field in u_x[] +- `u` - The field values at this point in space +- `u_t` - The field time derivative at this point in space (or `NULL`) +- `u_x` - The field derivatives at this point in space +- `aOff` - The offset of each auxiliary field in u[] +- `aOff_x` - The offset of each auxiliary field in u_x[] +- `a` - The auxiliary field values at this point in space +- `a_t` - The auxiliary field time derivative at this point in space (or `NULL`) +- `a_x` - The auxiliary field derivatives at this point in space +- `t` - The current time +- `x` - The coordinates of this point +- `numConstants` - The number of constants +- `constants` - The value of each constant +- `f` - The value of the function at this point in space + +Level: intermediate + +Note: +There are three different `DM`s that potentially interact in this function. The output `DM`, dm, specifies the layout of the values calculates by funcs. +The input `DM`, attached to U, may be different. For example, you can input the solution over the full domain, but output over a piece of the boundary, or +a subdomain. You can also output a different number of fields than the input, with different discretizations. Last the auxiliary `DM`, attached to the +auxiliary field vector, which is attached to dm, can also be different. It can have a different topology, number of fields, and discretizations. + +Developer Notes: +This API is specific to only particular usage of `DM` + +The notes need to provide some information about what has to be provided to the `DM` to be able to perform the computation. + +See also: +=== +`DM`, `DMProjectField()`, `DMProjectFieldLabelLocal()`, +`DMProjectFunction()`, `DMComputeL2Diff()` + +# External Links +$(_doc_external("DM/DMProjectFieldLocal")) +""" +function DMProjectFieldLocal(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, locU::PetscVec, ::Cvoid(funcs) end + +@for_petsc function DMProjectFieldLocal(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, locU::PetscVec, ::Cvoid(funcs ) + + @chk ccall( + (:DMProjectFieldLocal, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, Cvoid(funcs), + dm, time, locU, , + ) + + + return nothing +end + + +""" + DMProjectFieldLabelLocal(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, label::DMLabel, numIds::PetscInt, ids::Vector{PetscInt}, Nc::PetscInt, comps::Vector{PetscInt}, locU::PetscVec, ::Cvoid(funcs) +This projects the given function of the input fields into the function space provided, putting the coefficients in a local vector, calculating only over the portion of the domain specified by the label. + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `time` - The time +- `label` - The `DMLabel` marking the portion of the domain to output +- `numIds` - The number of label ids to use +- `ids` - The label ids to use for marking +- `Nc` - The number of components to set in the output, or `PETSC_DETERMINE` for all components +- `comps` - The components to set in the output, or `NULL` for all components +- `localU` - The input field vector +- `funcs` - The functions to evaluate, one per field +- `mode` - The insertion mode for values + +Output Parameter: +- `localX` - The output vector + +Calling sequence of `funcs`: +- `dim` - The spatial dimension +- `Nf` - The number of input fields +- `NfAux` - The number of input auxiliary fields +- `uOff` - The offset of each field in u[] +- `uOff_x` - The offset of each field in u_x[] +- `u` - The field values at this point in space +- `u_t` - The field time derivative at this point in space (or `NULL`) +- `u_x` - The field derivatives at this point in space +- `aOff` - The offset of each auxiliary field in u[] +- `aOff_x` - The offset of each auxiliary field in u_x[] +- `a` - The auxiliary field values at this point in space +- `a_t` - The auxiliary field time derivative at this point in space (or `NULL`) +- `a_x` - The auxiliary field derivatives at this point in space +- `t` - The current time +- `x` - The coordinates of this point +- `numConstants` - The number of constants +- `constants` - The value of each constant +- `f` - The value of the function at this point in space + +Level: intermediate + +Note: +There are three different `DM`s that potentially interact in this function. The output `DM`, dm, specifies the layout of the values calculates by funcs. +The input `DM`, attached to localU, may be different. For example, you can input the solution over the full domain, but output over a piece of the boundary, or +a subdomain. You can also output a different number of fields than the input, with different discretizations. Last the auxiliary `DM`, attached to the +auxiliary field vector, which is attached to dm, can also be different. It can have a different topology, number of fields, and discretizations. + +Developer Notes: +This API is specific to only particular usage of `DM` + +The notes need to provide some information about what has to be provided to the `DM` to be able to perform the computation. + +See also: +=== +`DM`, `DMProjectField()`, `DMProjectFieldLabel()`, `DMProjectFunction()`, `DMComputeL2Diff()` + +# External Links +$(_doc_external("DM/DMProjectFieldLabelLocal")) +""" +function DMProjectFieldLabelLocal(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, label::DMLabel, numIds::PetscInt, ids::Vector{PetscInt}, Nc::PetscInt, comps::Vector{PetscInt}, locU::PetscVec, ::Cvoid(funcs) end + +@for_petsc function DMProjectFieldLabelLocal(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, label::DMLabel, numIds::$PetscInt, ids::Vector{$PetscInt}, Nc::$PetscInt, comps::Vector{$PetscInt}, locU::PetscVec, ::Cvoid(funcs ) + + @chk ccall( + (:DMProjectFieldLabelLocal, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, DMLabel, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, CVec, Cvoid(funcs), + dm, time, label, numIds, ids, Nc, comps, locU, , + ) + + + return nothing +end + +""" + DMProjectFieldLabel(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, label::DMLabel, numIds::PetscInt, ids::Vector{PetscInt}, Nc::PetscInt, comps::Vector{PetscInt}, U::PetscVec, ::Cvoid(funcs) +This projects the given function of the input fields into the function space provided, putting the coefficients in a global vector, calculating only over the portion of the domain specified by the label. + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `time` - The time +- `label` - The `DMLabel` marking the portion of the domain to output +- `numIds` - The number of label ids to use +- `ids` - The label ids to use for marking +- `Nc` - The number of components to set in the output, or `PETSC_DETERMINE` for all components +- `comps` - The components to set in the output, or `NULL` for all components +- `U` - The input field vector +- `funcs` - The functions to evaluate, one per field +- `mode` - The insertion mode for values + +Output Parameter: +- `X` - The output vector + +Calling sequence of `funcs`: +- `dim` - The spatial dimension +- `Nf` - The number of input fields +- `NfAux` - The number of input auxiliary fields +- `uOff` - The offset of each field in u[] +- `uOff_x` - The offset of each field in u_x[] +- `u` - The field values at this point in space +- `u_t` - The field time derivative at this point in space (or `NULL`) +- `u_x` - The field derivatives at this point in space +- `aOff` - The offset of each auxiliary field in u[] +- `aOff_x` - The offset of each auxiliary field in u_x[] +- `a` - The auxiliary field values at this point in space +- `a_t` - The auxiliary field time derivative at this point in space (or `NULL`) +- `a_x` - The auxiliary field derivatives at this point in space +- `t` - The current time +- `x` - The coordinates of this point +- `numConstants` - The number of constants +- `constants` - The value of each constant +- `f` - The value of the function at this point in space + +Level: intermediate + +Note: +There are three different `DM`s that potentially interact in this function. The output `DM`, dm, specifies the layout of the values calculates by funcs. +The input `DM`, attached to U, may be different. For example, you can input the solution over the full domain, but output over a piece of the boundary, or +a subdomain. You can also output a different number of fields than the input, with different discretizations. Last the auxiliary `DM`, attached to the +auxiliary field vector, which is attached to dm, can also be different. It can have a different topology, number of fields, and discretizations. + +Developer Notes: +This API is specific to only particular usage of `DM` + +The notes need to provide some information about what has to be provided to the `DM` to be able to perform the computation. + +See also: +=== +`DM`, `DMProjectField()`, `DMProjectFieldLabelLocal()`, `DMProjectFunction()`, `DMComputeL2Diff()` + +# External Links +$(_doc_external("DM/DMProjectFieldLabel")) +""" +function DMProjectFieldLabel(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, label::DMLabel, numIds::PetscInt, ids::Vector{PetscInt}, Nc::PetscInt, comps::Vector{PetscInt}, U::PetscVec, ::Cvoid(funcs) end + +@for_petsc function DMProjectFieldLabel(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, label::DMLabel, numIds::$PetscInt, ids::Vector{$PetscInt}, Nc::$PetscInt, comps::Vector{$PetscInt}, U::PetscVec, ::Cvoid(funcs ) + + @chk ccall( + (:DMProjectFieldLabel, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, DMLabel, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, CVec, Cvoid(funcs), + dm, time, label, numIds, ids, Nc, comps, U, , + ) + + + return nothing +end + +""" + DMProjectBdFieldLabelLocal(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, label::DMLabel, numIds::PetscInt, ids::Vector{PetscInt}, Nc::PetscInt, comps::Vector{PetscInt}, locU::PetscVec, ::Cvoid(funcs) +This projects the given function of the input fields into the function space provided, putting the coefficients in a local vector, calculating only over the portion of the domain boundary specified by the label. + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `time` - The time +- `label` - The `DMLabel` marking the portion of the domain boundary to output +- `numIds` - The number of label ids to use +- `ids` - The label ids to use for marking +- `Nc` - The number of components to set in the output, or `PETSC_DETERMINE` for all components +- `comps` - The components to set in the output, or `NULL` for all components +- `localU` - The input field vector +- `funcs` - The functions to evaluate, one per field +- `mode` - The insertion mode for values + +Output Parameter: +- `localX` - The output vector + +Calling sequence of `funcs`: +- `dim` - The spatial dimension +- `Nf` - The number of input fields +- `NfAux` - The number of input auxiliary fields +- `uOff` - The offset of each field in u[] +- `uOff_x` - The offset of each field in u_x[] +- `u` - The field values at this point in space +- `u_t` - The field time derivative at this point in space (or `NULL`) +- `u_x` - The field derivatives at this point in space +- `aOff` - The offset of each auxiliary field in u[] +- `aOff_x` - The offset of each auxiliary field in u_x[] +- `a` - The auxiliary field values at this point in space +- `a_t` - The auxiliary field time derivative at this point in space (or `NULL`) +- `a_x` - The auxiliary field derivatives at this point in space +- `t` - The current time +- `x` - The coordinates of this point +- `n` - The face normal +- `numConstants` - The number of constants +- `constants` - The value of each constant +- `f` - The value of the function at this point in space + +Level: intermediate + +Note: +There are three different `DM`s that potentially interact in this function. The output `DM`, dm, specifies the layout of the values calculates by funcs. +The input `DM`, attached to U, may be different. For example, you can input the solution over the full domain, but output over a piece of the boundary, or +a subdomain. You can also output a different number of fields than the input, with different discretizations. Last the auxiliary `DM`, attached to the +auxiliary field vector, which is attached to dm, can also be different. It can have a different topology, number of fields, and discretizations. + +Developer Notes: +This API is specific to only particular usage of `DM` + +The notes need to provide some information about what has to be provided to the `DM` to be able to perform the computation. + +See also: +=== +`DM`, `DMProjectField()`, `DMProjectFieldLabelLocal()`, `DMProjectFunction()`, `DMComputeL2Diff()` + +# External Links +$(_doc_external("DM/DMProjectBdFieldLabelLocal")) +""" +function DMProjectBdFieldLabelLocal(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, label::DMLabel, numIds::PetscInt, ids::Vector{PetscInt}, Nc::PetscInt, comps::Vector{PetscInt}, locU::PetscVec, ::Cvoid(funcs) end + +@for_petsc function DMProjectBdFieldLabelLocal(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, label::DMLabel, numIds::$PetscInt, ids::Vector{$PetscInt}, Nc::$PetscInt, comps::Vector{$PetscInt}, locU::PetscVec, ::Cvoid(funcs ) + + @chk ccall( + (:DMProjectBdFieldLabelLocal, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, DMLabel, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, CVec, Cvoid(funcs), + dm, time, label, numIds, ids, Nc, comps, locU, , + ) + + + return nothing +end +=# + +""" + nranks::PetscInt = DMGetNeighbors(petsclib::PetscLibType,dm::PetscDM, ranks::Vector{PetscMPIInt}) +Gets an array containing the MPI ranks of all the processes neighbors + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameters: +- `nranks` - the number of neighbours +- `ranks` - the neighbors ranks + +Level: beginner + +Note: +Do not free the array, it is freed when the `DM` is destroyed. + +See also: +=== +`DM`, `DMDAGetNeighbors()`, `PetscSFGetRootRanks()` + +# External Links +$(_doc_external("DM/DMGetNeighbors")) +""" +function DMGetNeighbors(petsclib::PetscLibType, dm::PetscDM, ranks::Vector{PetscMPIInt}) end + +@for_petsc function DMGetNeighbors(petsclib::$UnionPetscLib, dm::PetscDM, ranks::Vector{PetscMPIInt} ) + nranks_ = Ref{$PetscInt}() + ranks_ = Ref(pointer(ranks)) + + @chk ccall( + (:DMGetNeighbors, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{Ptr{PetscMPIInt}}), + dm, nranks_, ranks_, + ) + + nranks = nranks_[] + + return nranks +end + +""" + compatible::PetscBool,set::PetscBool = DMGetCompatibility(petsclib::PetscLibType,dm1::PetscDM, dm2::PetscDM) +determine if two `DM`s are compatible + +Collective + +Input Parameters: +- `dm1` - the first `DM` +- `dm2` - the second `DM` + +Output Parameters: +- `compatible` - whether or not the two `DM`s are compatible +- `set` - whether or not the compatible value was actually determined and set + +Level: advanced + +Notes: +Two `DM`s are deemed compatible if they represent the same parallel decomposition +of the same topology. This implies that the section (field data) on one +"makes sense" with respect to the topology and parallel decomposition of the other. +Loosely speaking, compatible `DM`s represent the same domain and parallel +decomposition, but hold different data. + +Typically, one would confirm compatibility if intending to simultaneously iterate +over a pair of vectors obtained from different `DM`s. + +For example, two `DMDA` objects are compatible if they have the same local +and global sizes and the same stencil width. They can have different numbers +of degrees of freedom per node. Thus, one could use the node numbering from +either `DM` in bounds for a loop over vectors derived from either `DM`. + +Consider the operation of summing data living on a 2-dof `DMDA` to data living +on a 1-dof `DMDA`, which should be compatible, as in the following snippet. +-vb +-.. +PetscCall(DMGetCompatibility(da1,da2,&compatible,&set)); +if (set && compatible) { +PetscCall(DMDAVecGetArrayDOF(da1,vec1,&arr1)); +PetscCall(DMDAVecGetArrayDOF(da2,vec2,&arr2)); +PetscCall(DMDAGetCorners(da1,&x,&y,NULL,&m,&n,NULL)); +for (j=y; j 1 + + +Level: beginner + +-seealso: `DM`, `DMCreateGlobalVector()`, `VecDuplicate()`, `VecDuplicateVecs()`, +`DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMGlobalToLocalBegin()`, +`DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMCreateLocalVector()`, `DMRestoreLocalVector()`, +`VecStrideMax()`, `VecStrideMin()`, `VecStrideNorm()`, `DMClearLocalVectors()`, `DMGetNamedGlobalVector()`, `DMGetNamedLocalVector()` + +# External Links +$(_doc_external("DM/DMGetLocalVector")) +""" +function DMGetLocalVector(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetLocalVector(petsclib::$UnionPetscLib, dm::PetscDM) + g_ = Ref{CVec}() + + @chk ccall( + (:DMGetLocalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, g_, + ) + + g = PetscVec(g_[],petsclib) + + return g +end + +""" + DMRestoreLocalVector(petsclib::PetscLibType,dm::PetscDM, g::PetscVec) +Returns a PETSc vector that was +obtained from `DMGetLocalVector()`. Do not use with vector obtained via +`DMCreateLocalVector()`. + +Not Collective + +Input Parameters: +- `dm` - the `DM` +- `g` - the local vector + +Level: beginner + +-seealso: `DM`, `DMCreateGlobalVector()`, `VecDuplicate()`, `VecDuplicateVecs()`, +`DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMGlobalToLocalBegin()`, +`DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMCreateLocalVector()`, `DMGetLocalVector()`, `DMClearLocalVectors()` + +# External Links +$(_doc_external("DM/DMRestoreLocalVector")) +""" +function DMRestoreLocalVector(petsclib::PetscLibType, dm::PetscDM, g::PetscVec) end + +@for_petsc function DMRestoreLocalVector(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec ) + g_ = Ref(g.ptr) + + @chk ccall( + (:DMRestoreLocalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, g_, + ) + + g.ptr = g_[] + + return nothing +end + +""" + DMGetGlobalVector(petsclib::PetscLibType,dm::PetscDM, g::PetscVec) +Gets a PETSc vector that may be used with the `DM` global routines. + +Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `g` - the global vector + +Level: beginner + +-seealso: `DM`, `DMCreateGlobalVector()`, `VecDuplicate()`, `VecDuplicateVecs()`, +`DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMGlobalToLocalBegin()`, +`DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMCreateLocalVector()`, `DMRestoreLocalVector()` +`VecStrideMax()`, `VecStrideMin()`, `VecStrideNorm()`, `DMClearGlobalVectors()`, `DMGetNamedGlobalVector()`, `DMGetNamedLocalVector()` + +# External Links +$(_doc_external("DM/DMGetGlobalVector")) +""" +function DMGetGlobalVector(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetGlobalVector(petsclib::$UnionPetscLib, dm::PetscDM) + g_ = Ref{CVec}() + + @chk ccall( + (:DMGetGlobalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, g_, + ) + + g = PetscVec(g_[],petsclib) + return g +end + +""" + DMClearGlobalVectors(petsclib::PetscLibType,dm::PetscDM) +Destroys all the global vectors that have been created for `DMGetGlobalVector()` calls in this `DM` + +Collective + +Input Parameter: +- `dm` - the `DM` + +Level: developer + +-seealso: `DM`, `DMCreateGlobalVector()`, `VecDuplicate()`, `VecDuplicateVecs()`, +`DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMGlobalToLocalBegin()`, +`DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMCreateLocalVector()`, `DMRestoreLocalVector()` +`VecStrideMax()`, `VecStrideMin()`, `VecStrideNorm()`, `DMClearLocalVectors()` + +# External Links +$(_doc_external("DM/DMClearGlobalVectors")) +""" +function DMClearGlobalVectors(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMClearGlobalVectors(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMClearGlobalVectors, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMClearLocalVectors(petsclib::PetscLibType,dm::PetscDM) +Destroys all the local vectors that have been created for `DMGetLocalVector()` calls in this `DM` + +Collective + +Input Parameter: +- `dm` - the `DM` + +Level: developer + +-seealso: `DM`, `DMCreateLocalVector()`, `VecDuplicate()`, `VecDuplicateVecs()`, +`DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMLocalToLocalBegin()`, +`DMLocalToLocalEnd()`, `DMRestoreLocalVector()` +`VecStrideMax()`, `VecStrideMin()`, `VecStrideNorm()`, `DMClearGlobalVectors()` + +# External Links +$(_doc_external("DM/DMClearLocalVectors")) +""" +function DMClearLocalVectors(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMClearLocalVectors(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMClearLocalVectors, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMRestoreGlobalVector(petsclib::PetscLibType,dm::PetscDM, g::PetscVec) +Returns a PETSc vector that +obtained from `DMGetGlobalVector()`. Do not use with vector obtained via +`DMCreateGlobalVector()`. + +Not Collective + +Input Parameters: +- `dm` - the `DM` +- `g` - the global vector + +Level: beginner + +-seealso: `DM`, `DMCreateGlobalVector()`, `VecDuplicate()`, `VecDuplicateVecs()`, +`DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMGlobalToGlobalBegin()`, +`DMGlobalToGlobalEnd()`, `DMGlobalToGlobal()`, `DMCreateLocalVector()`, `DMGetGlobalVector()`, `DMClearGlobalVectors()` + +# External Links +$(_doc_external("DM/DMRestoreGlobalVector")) +""" +function DMRestoreGlobalVector(petsclib::PetscLibType, dm::PetscDM, g::PetscVec) end + +@for_petsc function DMRestoreGlobalVector(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec ) + g_ = Ref(g.ptr) + + @chk ccall( + (:DMRestoreGlobalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, g_, + ) + + g.ptr = g_[] + + return nothing +end + +""" + DMClearNamedGlobalVectors(petsclib::PetscLibType,dm::PetscDM) +Destroys all the named global vectors that have been created with `DMGetNamedGlobalVector()` in this `DM` + +Collective + +Input Parameter: +- `dm` - the `DM` + +Level: developer + +-seealso: `DM`, `DMGetNamedGlobalVector()`, `DMGetNamedLocalVector()`, `DMClearNamedLocalVectors()` + +# External Links +$(_doc_external("DM/DMClearNamedGlobalVectors")) +""" +function DMClearNamedGlobalVectors(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMClearNamedGlobalVectors(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMClearNamedGlobalVectors, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMClearNamedLocalVectors(petsclib::PetscLibType,dm::PetscDM) +Destroys all the named local vectors that have been created with `DMGetNamedLocalVector()` in this `DM` + +Collective + +Input Parameter: +- `dm` - the `DM` + +Level: developer + +-seealso: `DM`, `DMGetNamedGlobalVector()`, `DMGetNamedLocalVector()`, `DMClearNamedGlobalVectors()` + +# External Links +$(_doc_external("DM/DMClearNamedLocalVectors")) +""" +function DMClearNamedLocalVectors(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMClearNamedLocalVectors(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMClearNamedLocalVectors, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + exists::PetscBool = DMHasNamedGlobalVector(petsclib::PetscLibType,dm::PetscDM, name::String) +check for a named, persistent global vector created with `DMGetNamedGlobalVector()` + +Not Collective + +Input Parameters: +- `dm` - `DM` to hold named vectors +- `name` - unique name for `Vec` + +Output Parameter: +- `exists` - true if the vector was previously created + +Level: developer + +-seealso: `DM`, `DMGetNamedGlobalVector()`, `DMRestoreNamedLocalVector()`, `DMClearNamedGlobalVectors()` + +# External Links +$(_doc_external("DM/DMHasNamedGlobalVector")) +""" +function DMHasNamedGlobalVector(petsclib::PetscLibType, dm::PetscDM, name::String) end + +@for_petsc function DMHasNamedGlobalVector(petsclib::$UnionPetscLib, dm::PetscDM, name::String ) + exists_ = Ref{PetscBool}() + + @chk ccall( + (:DMHasNamedGlobalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{PetscBool}), + dm, name, exists_, + ) + + exists = exists_[] + + return exists +end + +""" + DMGetNamedGlobalVector(petsclib::PetscLibType,dm::PetscDM, name::String, X::PetscVec) +get access to a named, persistent global vector + +Collective + +Input Parameters: +- `dm` - `DM` to hold named vectors +- `name` - unique name for `X` + +Output Parameter: +- `X` - named `Vec` + +Level: developer + +-seealso: `DM`, `DMRestoreNamedGlobalVector()`, `DMHasNamedGlobalVector()`, `DMClearNamedGlobalVectors()`, `DMGetGlobalVector()`, `DMGetLocalVector()` + +# External Links +$(_doc_external("DM/DMGetNamedGlobalVector")) +""" +function DMGetNamedGlobalVector(petsclib::PetscLibType, dm::PetscDM, name::String, X::PetscVec) end + +@for_petsc function DMGetNamedGlobalVector(petsclib::$UnionPetscLib, dm::PetscDM, name::String, X::PetscVec ) + X_ = Ref(X.ptr) + + @chk ccall( + (:DMGetNamedGlobalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{CVec}), + dm, name, X_, + ) + + X.ptr = X_[] + + return nothing +end + +""" + DMRestoreNamedGlobalVector(petsclib::PetscLibType,dm::PetscDM, name::String, X::PetscVec) +restore access to a named, persistent global vector + +Collective + +Input Parameters: +- `dm` - `DM` on which `X` was gotten +- `name` - name under which `X` was gotten +- `X` - `Vec` to restore + +Level: developer + +-seealso: `DM`, `DMGetNamedGlobalVector()`, `DMClearNamedGlobalVectors()` + +# External Links +$(_doc_external("DM/DMRestoreNamedGlobalVector")) +""" +function DMRestoreNamedGlobalVector(petsclib::PetscLibType, dm::PetscDM, name::String, X::PetscVec) end + +@for_petsc function DMRestoreNamedGlobalVector(petsclib::$UnionPetscLib, dm::PetscDM, name::String, X::PetscVec ) + X_ = Ref(X.ptr) + + @chk ccall( + (:DMRestoreNamedGlobalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{CVec}), + dm, name, X_, + ) + + X.ptr = X_[] + + return nothing +end + +""" + exists::PetscBool = DMHasNamedLocalVector(petsclib::PetscLibType,dm::PetscDM, name::String) +check for a named, persistent local vector created with `DMGetNamedLocalVector()` + +Not Collective + +Input Parameters: +- `dm` - `DM` to hold named vectors +- `name` - unique name for `Vec` + +Output Parameter: +- `exists` - true if the vector was previously created + +Level: developer + +-seealso: `DM`, `DMGetNamedGlobalVector()`, `DMRestoreNamedLocalVector()`, `DMClearNamedLocalVectors()` + +# External Links +$(_doc_external("DM/DMHasNamedLocalVector")) +""" +function DMHasNamedLocalVector(petsclib::PetscLibType, dm::PetscDM, name::String) end + +@for_petsc function DMHasNamedLocalVector(petsclib::$UnionPetscLib, dm::PetscDM, name::String ) + exists_ = Ref{PetscBool}() + + @chk ccall( + (:DMHasNamedLocalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{PetscBool}), + dm, name, exists_, + ) + + exists = exists_[] + + return exists +end + +""" + DMGetNamedLocalVector(petsclib::PetscLibType,dm::PetscDM, name::String, X::PetscVec) +get access to a named, persistent local vector + +Not Collective + +Input Parameters: +- `dm` - `DM` to hold named vectors +- `name` - unique name for `X` + +Output Parameter: +- `X` - named `Vec` + +Level: developer + +-seealso: `DM`, `DMGetNamedGlobalVector()`, `DMRestoreNamedLocalVector()`, `DMHasNamedLocalVector()`, `DMClearNamedLocalVectors()`, `DMGetGlobalVector()`, `DMGetLocalVector()` + +# External Links +$(_doc_external("DM/DMGetNamedLocalVector")) +""" +function DMGetNamedLocalVector(petsclib::PetscLibType, dm::PetscDM, name::String, X::PetscVec) end + +@for_petsc function DMGetNamedLocalVector(petsclib::$UnionPetscLib, dm::PetscDM, name::String, X::PetscVec ) + X_ = Ref(X.ptr) + + @chk ccall( + (:DMGetNamedLocalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{CVec}), + dm, name, X_, + ) + + X.ptr = X_[] + + return nothing +end + +""" + DMRestoreNamedLocalVector(petsclib::PetscLibType,dm::PetscDM, name::String, X::PetscVec) +restore access to a named, persistent local vector obtained with `DMGetNamedLocalVector()` + +Not Collective + +Input Parameters: +- `dm` - `DM` on which `X` was gotten +- `name` - name under which `X` was gotten +- `X` - `Vec` to restore + +Level: developer + +-seealso: `DM`, `DMRestoreNamedGlobalVector()`, `DMGetNamedLocalVector()`, `DMClearNamedLocalVectors()` + +# External Links +$(_doc_external("DM/DMRestoreNamedLocalVector")) +""" +function DMRestoreNamedLocalVector(petsclib::PetscLibType, dm::PetscDM, name::String, X::PetscVec) end + +@for_petsc function DMRestoreNamedLocalVector(petsclib::$UnionPetscLib, dm::PetscDM, name::String, X::PetscVec ) + X_ = Ref(X.ptr) + + @chk ccall( + (:DMRestoreNamedLocalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{CVec}), + dm, name, X_, + ) + + X.ptr = X_[] + + return nothing +end + +""" + DMFinalizePackage(petsclib::PetscLibType) +This function finalizes everything in the `DM` package. It is called +from `PetscFinalize()`. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("DM/DMFinalizePackage")) +""" +function DMFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function DMFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `DM` package. It is called +from `PetscDLLibraryRegister_petscdm()` when using dynamic libraries, and on the first call to `DMCreate()` +or similar routines when using shared or static libraries. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("DM/DMInitializePackage")) +""" +function DMInitializePackage(petsclib::PetscLibType) end + +@for_petsc function DMInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + cdm::PetscDM = DMGetCoordinateDM(petsclib::PetscLibType,dm::PetscDM) +Gets the `DM` that prescribes coordinate layout and scatters between global and local coordinates + +Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `cdm` - coordinate `DM` + +Level: intermediate + +-seealso: `DM`, `DMSetCoordinateDM()`, `DMSetCoordinates()`, `DMSetCoordinatesLocal()`, `DMGetCoordinates()`, `DMGetCoordinatesLocal()`, `DMGSetCellCoordinateDM()`, + + +# External Links +$(_doc_external("DM/DMGetCoordinateDM")) +""" +function DMGetCoordinateDM(petsclib::PetscLibType, dm::PetscDM, cdm::PetscDM) end + +@for_petsc function DMGetCoordinateDM(petsclib::$UnionPetscLib, dm::PetscDM{PetscLib} ) where PetscLib + cdm = PetscDM{PetscLib}(C_NULL, dm.age) + cdm_ = Ref(cdm.ptr) + + @chk ccall( + (:DMGetCoordinateDM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, cdm_, + ) + + cdm.ptr = cdm_[] + + return cdm +end + +""" + DMSetCoordinateDM(petsclib::PetscLibType,dm::PetscDM, cdm::PetscDM) +Sets the `DM` that prescribes coordinate layout and scatters between global and local coordinates + +Logically Collective + +Input Parameters: +- `dm` - the `DM` +- `cdm` - coordinate `DM` + +Level: intermediate + +-seealso: `DM`, `DMGetCoordinateDM()`, `DMSetCoordinates()`, `DMGetCellCoordinateDM()`, `DMSetCoordinatesLocal()`, `DMGetCoordinates()`, `DMGetCoordinatesLocal()`, +`DMGSetCellCoordinateDM()` + +# External Links +$(_doc_external("DM/DMSetCoordinateDM")) +""" +function DMSetCoordinateDM(petsclib::PetscLibType, dm::PetscDM, cdm::PetscDM) end + +@for_petsc function DMSetCoordinateDM(petsclib::$UnionPetscLib, dm::PetscDM, cdm::PetscDM ) + + @chk ccall( + (:DMSetCoordinateDM, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dm, cdm, + ) + + + return nothing +end + +""" + DMGetCellCoordinateDM(petsclib::PetscLibType,dm::PetscDM, cdm::PetscDM) +Gets the `DM` that prescribes cellwise coordinate layout and scatters between global and local cellwise coordinates + +Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `cdm` - cellwise coordinate `DM`, or `NULL` if they are not defined + +Level: intermediate + +-seealso: `DM`, `DMSetCellCoordinateDM()`, `DMSetCellCoordinates()`, `DMSetCellCoordinatesLocal()`, `DMGetCellCoordinates()`, `DMGetCellCoordinatesLocal()`, +`DMLocalizeCoordinates()`, `DMSetCoordinateDM()`, `DMGetCoordinateDM()` + +# External Links +$(_doc_external("DM/DMGetCellCoordinateDM")) +""" +function DMGetCellCoordinateDM(petsclib::PetscLibType, dm::PetscDM, cdm::PetscDM) end + +@for_petsc function DMGetCellCoordinateDM(petsclib::$UnionPetscLib, dm::PetscDM, cdm::PetscDM ) + cdm_ = Ref(cdm.ptr) + + @chk ccall( + (:DMGetCellCoordinateDM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, cdm_, + ) + + cdm.ptr = cdm_[] + + return nothing +end + +""" + DMSetCellCoordinateDM(petsclib::PetscLibType,dm::PetscDM, cdm::PetscDM) +Sets the `DM` that prescribes cellwise coordinate layout and scatters between global and local cellwise coordinates + +Logically Collective + +Input Parameters: +- `dm` - the `DM` +- `cdm` - cellwise coordinate `DM` + +Level: intermediate + +-seealso: `DMGetCellCoordinateDM()`, `DMSetCellCoordinates()`, `DMSetCellCoordinatesLocal()`, `DMGetCellCoordinates()`, `DMGetCellCoordinatesLocal()`, +`DMSetCoordinateDM()`, `DMGetCoordinateDM()` + +# External Links +$(_doc_external("DM/DMSetCellCoordinateDM")) +""" +function DMSetCellCoordinateDM(petsclib::PetscLibType, dm::PetscDM, cdm::PetscDM) end + +@for_petsc function DMSetCellCoordinateDM(petsclib::$UnionPetscLib, dm::PetscDM, cdm::PetscDM ) + + @chk ccall( + (:DMSetCellCoordinateDM, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dm, cdm, + ) + + + return nothing +end + +""" + dim::PetscInt = DMGetCoordinateDim(petsclib::PetscLibType,dm::PetscDM) +Retrieve the dimension of the embedding space for coordinate values. For example a mesh on the surface of a sphere would have a 3 dimensional embedding space + +Not Collective + +Input Parameter: +- `dm` - The `DM` object + +Output Parameter: +- `dim` - The embedding dimension + +Level: intermediate + +-seealso: `DM`, `DMSetCoordinateDim()`, `DMGetCoordinateSection()`, `DMGetCoordinateDM()`, `DMGetLocalSection()`, `DMSetLocalSection()` + +# External Links +$(_doc_external("DM/DMGetCoordinateDim")) +""" +function DMGetCoordinateDim(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetCoordinateDim(petsclib::$UnionPetscLib, dm::PetscDM ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetCoordinateDim, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + DMSetCoordinateDim(petsclib::PetscLibType,dm::PetscDM, dim::PetscInt) +Set the dimension of the embedding space for coordinate values. + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `dim` - The embedding dimension + +Level: intermediate + +-seealso: `DM`, `DMGetCoordinateDim()`, `DMSetCoordinateSection()`, `DMGetCoordinateSection()`, `DMGetLocalSection()`, `DMSetLocalSection()` + +# External Links +$(_doc_external("DM/DMSetCoordinateDim")) +""" +function DMSetCoordinateDim(petsclib::PetscLibType, dm::PetscDM, dim::PetscInt) end + +@for_petsc function DMSetCoordinateDim(petsclib::$UnionPetscLib, dm::PetscDM, dim::$PetscInt ) + + @chk ccall( + (:DMSetCoordinateDim, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, dim, + ) + + + return nothing +end + +""" + DMGetCoordinateSection(petsclib::PetscLibType,dm::PetscDM, section::PetscSection) +Retrieve the `PetscSection` of coordinate values over the mesh. + +Collective + +Input Parameter: +- `dm` - The `DM` object + +Output Parameter: +- `section` - The `PetscSection` object + +Level: intermediate + +-seealso: `DM`, `DMGetCoordinateDM()`, `DMGetLocalSection()`, `DMSetLocalSection()` + +# External Links +$(_doc_external("DM/DMGetCoordinateSection")) +""" +function DMGetCoordinateSection(petsclib::PetscLibType, dm::PetscDM, section::PetscSection) end + +@for_petsc function DMGetCoordinateSection(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection ) + + @chk ccall( + (:DMGetCoordinateSection, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSection}), + dm, section, + ) + + + return nothing +end + +""" + DMSetCoordinateSection(petsclib::PetscLibType,dm::PetscDM, dim::PetscInt, section::PetscSection) +Set the `PetscSection` of coordinate values over the mesh. + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `dim` - The embedding dimension, or `PETSC_DETERMINE` +- `section` - The `PetscSection` object + +Level: intermediate + +-seealso: `DM`, `DMGetCoordinateDim()`, `DMGetCoordinateSection()`, `DMGetLocalSection()`, `DMSetLocalSection()` + +# External Links +$(_doc_external("DM/DMSetCoordinateSection")) +""" +function DMSetCoordinateSection(petsclib::PetscLibType, dm::PetscDM, dim::PetscInt, section::PetscSection) end + +@for_petsc function DMSetCoordinateSection(petsclib::$UnionPetscLib, dm::PetscDM, dim::$PetscInt, section::PetscSection ) + + @chk ccall( + (:DMSetCoordinateSection, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscSection), + dm, dim, section, + ) + + + return nothing +end + +""" + DMGetCellCoordinateSection(petsclib::PetscLibType,dm::PetscDM, section::PetscSection) +Retrieve the `PetscSection` of cellwise coordinate values over the mesh. + +Collective + +Input Parameter: +- `dm` - The `DM` object + +Output Parameter: +- `section` - The `PetscSection` object, or `NULL` if no cellwise coordinates are defined + +Level: intermediate + +-seealso: `DM`, `DMGetCoordinateSection()`, `DMSetCellCoordinateSection()`, `DMGetCellCoordinateDM()`, `DMGetCoordinateDM()`, `DMGetLocalSection()`, `DMSetLocalSection()` + +# External Links +$(_doc_external("DM/DMGetCellCoordinateSection")) +""" +function DMGetCellCoordinateSection(petsclib::PetscLibType, dm::PetscDM, section::PetscSection) end + +@for_petsc function DMGetCellCoordinateSection(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection ) + + @chk ccall( + (:DMGetCellCoordinateSection, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSection}), + dm, section, + ) + + + return nothing +end + +""" + DMSetCellCoordinateSection(petsclib::PetscLibType,dm::PetscDM, dim::PetscInt, section::PetscSection) +Set the `PetscSection` of cellwise coordinate values over the mesh. + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `dim` - The embedding dimension, or `PETSC_DETERMINE` +- `section` - The `PetscSection` object for a cellwise layout + +Level: intermediate + +-seealso: `DM`, `DMGetCoordinateDim()`, `DMSetCoordinateSection()`, `DMGetCellCoordinateSection()`, `DMGetCoordinateSection()`, `DMGetCellCoordinateDM()`, `DMGetLocalSection()`, `DMSetLocalSection()` + +# External Links +$(_doc_external("DM/DMSetCellCoordinateSection")) +""" +function DMSetCellCoordinateSection(petsclib::PetscLibType, dm::PetscDM, dim::PetscInt, section::PetscSection) end + +@for_petsc function DMSetCellCoordinateSection(petsclib::$UnionPetscLib, dm::PetscDM, dim::$PetscInt, section::PetscSection ) + + @chk ccall( + (:DMSetCellCoordinateSection, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscSection), + dm, dim, section, + ) + + + return nothing +end + +""" + DMGetCoordinates(petsclib::PetscLibType,dm::PetscDM, c::PetscVec) +Gets a global vector with the coordinates associated with the `DM`. + +Collective if the global vector with coordinates has not been set yet but the local vector with coordinates has been set + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `c` - global coordinate vector + +Level: intermediate + +-seealso: `DM`, `DMDA`, `DMSetCoordinates()`, `DMGetCoordinatesLocal()`, `DMGetCoordinateDM()`, `DMDASetUniformCoordinates()` + +# External Links +$(_doc_external("DM/DMGetCoordinates")) +""" +function DMGetCoordinates(petsclib::PetscLibType, dm::PetscDM, c::PetscVec) end + +@for_petsc function DMGetCoordinates(petsclib::$UnionPetscLib, dm::PetscDM, c::PetscVec ) + c_ = Ref(c.ptr) + + @chk ccall( + (:DMGetCoordinates, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, c_, + ) + + c.ptr = c_[] + + return nothing +end + +""" + DMSetCoordinates(petsclib::PetscLibType,dm::PetscDM, c::PetscVec) +Sets into the `DM` a global vector that holds the coordinates + +Logically Collective + +Input Parameters: +- `dm` - the `DM` +- `c` - coordinate vector + +Level: intermediate + +-seealso: `DM`, `DMSetCoordinatesLocal()`, `DMGetCoordinates()`, `DMGetCoordinatesLocal()`, `DMGetCoordinateDM()`, `DMDASetUniformCoordinates()` + +# External Links +$(_doc_external("DM/DMSetCoordinates")) +""" +function DMSetCoordinates(petsclib::PetscLibType, dm::PetscDM, c::PetscVec) end + +@for_petsc function DMSetCoordinates(petsclib::$UnionPetscLib, dm::PetscDM, c::PetscVec ) + + @chk ccall( + (:DMSetCoordinates, $petsc_library), + PetscErrorCode, + (CDM, CVec), + dm, c, + ) + + + return nothing +end + +""" + DMGetCellCoordinates(petsclib::PetscLibType,dm::PetscDM, c::PetscVec) +Gets a global vector with the cellwise coordinates associated with the `DM`. + +Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `c` - global coordinate vector + +Level: intermediate + +-seealso: `DM`, `DMGetCoordinates()`, `DMSetCellCoordinates()`, `DMGetCellCoordinatesLocal()`, `DMGetCellCoordinateDM()` + +# External Links +$(_doc_external("DM/DMGetCellCoordinates")) +""" +function DMGetCellCoordinates(petsclib::PetscLibType, dm::PetscDM, c::PetscVec) end + +@for_petsc function DMGetCellCoordinates(petsclib::$UnionPetscLib, dm::PetscDM, c::PetscVec ) + c_ = Ref(c.ptr) + + @chk ccall( + (:DMGetCellCoordinates, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, c_, + ) + + c.ptr = c_[] + + return nothing +end + +""" + DMSetCellCoordinates(petsclib::PetscLibType,dm::PetscDM, c::PetscVec) +Sets into the `DM` a global vector that holds the cellwise coordinates + +Collective + +Input Parameters: +- `dm` - the `DM` +- `c` - cellwise coordinate vector + +Level: intermediate + +-seealso: `DM`, `DMGetCoordinates()`, `DMSetCellCoordinatesLocal()`, `DMGetCellCoordinates()`, `DMGetCellCoordinatesLocal()`, `DMGetCellCoordinateDM()` + +# External Links +$(_doc_external("DM/DMSetCellCoordinates")) +""" +function DMSetCellCoordinates(petsclib::PetscLibType, dm::PetscDM, c::PetscVec) end + +@for_petsc function DMSetCellCoordinates(petsclib::$UnionPetscLib, dm::PetscDM, c::PetscVec ) + + @chk ccall( + (:DMSetCellCoordinates, $petsc_library), + PetscErrorCode, + (CDM, CVec), + dm, c, + ) + + + return nothing +end + +""" + DMGetCoordinatesLocalSetUp(petsclib::PetscLibType,dm::PetscDM) +Prepares a local vector of coordinates, so that `DMGetCoordinatesLocalNoncollective()` can be used as non + +Collective + +Input Parameter: +- `dm` - the `DM` + +Level: advanced + +-seealso: `DM`, `DMSetCoordinates()`, `DMGetCoordinatesLocalNoncollective()` + +# External Links +$(_doc_external("DM/DMGetCoordinatesLocalSetUp")) +""" +function DMGetCoordinatesLocalSetUp(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetCoordinatesLocalSetUp(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMGetCoordinatesLocalSetUp, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMGetCoordinatesLocal(petsclib::PetscLibType,dm::PetscDM, c::PetscVec) +Gets a local vector with the coordinates associated with the `DM`. + +Collective the first time it is called + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `c` - coordinate vector + +Level: intermediate + +-seealso: `DM`, `DMSetCoordinatesLocal()`, `DMGetCoordinates()`, `DMSetCoordinates()`, `DMGetCoordinateDM()`, `DMGetCoordinatesLocalNoncollective()` + +# External Links +$(_doc_external("DM/DMGetCoordinatesLocal")) +""" +function DMGetCoordinatesLocal(petsclib::PetscLibType, dm::PetscDM, c::PetscVec) end + +@for_petsc function DMGetCoordinatesLocal(petsclib::$UnionPetscLib, dm::PetscDM, c::PetscVec ) + c_ = Ref(c.ptr) + + @chk ccall( + (:DMGetCoordinatesLocal, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, c_, + ) + + c.ptr = c_[] + + return nothing +end + +""" + DMGetCoordinatesLocalNoncollective(petsclib::PetscLibType,dm::PetscDM, c::PetscVec) +Non + +Not Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `c` - coordinate vector + +Level: advanced + +-seealso: `DM`, `DMGetCoordinatesLocalSetUp()`, `DMGetCoordinatesLocal()`, `DMSetCoordinatesLocal()`, `DMGetCoordinates()`, `DMSetCoordinates()`, `DMGetCoordinateDM()` + +# External Links +$(_doc_external("DM/DMGetCoordinatesLocalNoncollective")) +""" +function DMGetCoordinatesLocalNoncollective(petsclib::PetscLibType, dm::PetscDM, c::PetscVec) end + +@for_petsc function DMGetCoordinatesLocalNoncollective(petsclib::$UnionPetscLib, dm::PetscDM, c::PetscVec ) + c_ = Ref(c.ptr) + + @chk ccall( + (:DMGetCoordinatesLocalNoncollective, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, c_, + ) + + c.ptr = c_[] + + return nothing +end + +""" + DMGetCoordinatesLocalTuple(petsclib::PetscLibType,dm::PetscDM, p::IS, pCoordSection::PetscSection, pCoord::PetscVec) +Gets a local vector with the coordinates of specified points and the section describing its layout. + +Not Collective + +Input Parameters: +- `dm` - the `DM` +- `p` - the `IS` of points whose coordinates will be returned + +Output Parameters: +- `pCoordSection` - the `PetscSection` describing the layout of pCoord, i.e. each point corresponds to one point in `p`, and DOFs correspond to coordinates +- `pCoord` - the `Vec` with coordinates of points in `p` + +Level: advanced + +-seealso: `DM`, `DMDA`, `DMSetCoordinatesLocal()`, `DMGetCoordinatesLocal()`, `DMGetCoordinatesLocalNoncollective()`, `DMGetCoordinatesLocalSetUp()`, `DMGetCoordinates()`, `DMSetCoordinates()`, `DMGetCoordinateDM()` + +# External Links +$(_doc_external("DM/DMGetCoordinatesLocalTuple")) +""" +function DMGetCoordinatesLocalTuple(petsclib::PetscLibType, dm::PetscDM, p::IS, pCoordSection::PetscSection, pCoord::PetscVec) end + +@for_petsc function DMGetCoordinatesLocalTuple(petsclib::$UnionPetscLib, dm::PetscDM, p::IS, pCoordSection::PetscSection, pCoord::PetscVec ) + pCoord_ = Ref(pCoord.ptr) + + @chk ccall( + (:DMGetCoordinatesLocalTuple, $petsc_library), + PetscErrorCode, + (CDM, CIS, Ptr{PetscSection}, Ptr{CVec}), + dm, p, pCoordSection, pCoord_, + ) + + pCoord.ptr = pCoord_[] + + return nothing +end + +""" + DMSetCoordinatesLocal(petsclib::PetscLibType,dm::PetscDM, c::PetscVec) +Sets into the `DM` a local vector, including ghost points, that holds the coordinates + +Not Collective + +Input Parameters: +- `dm` - the `DM` +- `c` - coordinate vector + +Level: intermediate + +-seealso: `DM`, `DMGetCoordinatesLocal()`, `DMSetCoordinates()`, `DMGetCoordinates()`, `DMGetCoordinateDM()` + +# External Links +$(_doc_external("DM/DMSetCoordinatesLocal")) +""" +function DMSetCoordinatesLocal(petsclib::PetscLibType, dm::PetscDM, c::PetscVec) end + +@for_petsc function DMSetCoordinatesLocal(petsclib::$UnionPetscLib, dm::PetscDM, c::PetscVec ) + + @chk ccall( + (:DMSetCoordinatesLocal, $petsc_library), + PetscErrorCode, + (CDM, CVec), + dm, c, + ) + + + return nothing +end + +""" + DMGetCellCoordinatesLocalSetUp(petsclib::PetscLibType,dm::PetscDM) +Prepares a local vector of cellwise coordinates, so that `DMGetCellCoordinatesLocalNoncollective()` can be used as non + +Collective + +Input Parameter: +- `dm` - the `DM` + +Level: advanced + +-seealso: `DM`, `DMGetCellCoordinatesLocalNoncollective()` + +# External Links +$(_doc_external("DM/DMGetCellCoordinatesLocalSetUp")) +""" +function DMGetCellCoordinatesLocalSetUp(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetCellCoordinatesLocalSetUp(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMGetCellCoordinatesLocalSetUp, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMGetCellCoordinatesLocal(petsclib::PetscLibType,dm::PetscDM, c::PetscVec) +Gets a local vector with the cellwise coordinates associated with the `DM`. + +Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `c` - coordinate vector + +Level: intermediate + +-seealso: `DM`, `DMSetCellCoordinatesLocal()`, `DMGetCellCoordinates()`, `DMSetCellCoordinates()`, `DMGetCellCoordinateDM()`, `DMGetCellCoordinatesLocalNoncollective()` + +# External Links +$(_doc_external("DM/DMGetCellCoordinatesLocal")) +""" +function DMGetCellCoordinatesLocal(petsclib::PetscLibType, dm::PetscDM, c::PetscVec) end + +@for_petsc function DMGetCellCoordinatesLocal(petsclib::$UnionPetscLib, dm::PetscDM, c::PetscVec ) + c_ = Ref(c.ptr) + + @chk ccall( + (:DMGetCellCoordinatesLocal, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, c_, + ) + + c.ptr = c_[] + + return nothing +end + +""" + DMGetCellCoordinatesLocalNoncollective(petsclib::PetscLibType,dm::PetscDM, c::PetscVec) +Non + +Not Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `c` - cellwise coordinate vector + +Level: advanced + +-seealso: `DM`, `DMGetCellCoordinatesLocalSetUp()`, `DMGetCellCoordinatesLocal()`, `DMSetCellCoordinatesLocal()`, `DMGetCellCoordinates()`, `DMSetCellCoordinates()`, `DMGetCellCoordinateDM()` + +# External Links +$(_doc_external("DM/DMGetCellCoordinatesLocalNoncollective")) +""" +function DMGetCellCoordinatesLocalNoncollective(petsclib::PetscLibType, dm::PetscDM, c::PetscVec) end + +@for_petsc function DMGetCellCoordinatesLocalNoncollective(petsclib::$UnionPetscLib, dm::PetscDM, c::PetscVec ) + c_ = Ref(c.ptr) + + @chk ccall( + (:DMGetCellCoordinatesLocalNoncollective, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, c_, + ) + + c.ptr = c_[] + + return nothing +end + +""" + DMSetCellCoordinatesLocal(petsclib::PetscLibType,dm::PetscDM, c::PetscVec) +Sets into the `DM` a local vector including ghost points that holds the cellwise coordinates + +Not Collective + +Input Parameters: +- `dm` - the `DM` +- `c` - cellwise coordinate vector + +Level: intermediate + +-seealso: `DM`, `DMGetCellCoordinatesLocal()`, `DMSetCellCoordinates()`, `DMGetCellCoordinates()`, `DMGetCellCoordinateDM()` + +# External Links +$(_doc_external("DM/DMSetCellCoordinatesLocal")) +""" +function DMSetCellCoordinatesLocal(petsclib::PetscLibType, dm::PetscDM, c::PetscVec) end + +@for_petsc function DMSetCellCoordinatesLocal(petsclib::$UnionPetscLib, dm::PetscDM, c::PetscVec ) + + @chk ccall( + (:DMSetCellCoordinatesLocal, $petsc_library), + PetscErrorCode, + (CDM, CVec), + dm, c, + ) + + + return nothing +end + +""" + DMGetCoordinateField(petsclib::PetscLibType,dm::PetscDM, field::DMField) + +# External Links +$(_doc_external("DM/DMGetCoordinateField")) +""" +function DMGetCoordinateField(petsclib::PetscLibType, dm::PetscDM, field::DMField) end + +@for_petsc function DMGetCoordinateField(petsclib::$UnionPetscLib, dm::PetscDM, field::DMField ) + + @chk ccall( + (:DMGetCoordinateField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMField}), + dm, field, + ) + + + return nothing +end + +""" + DMSetCoordinateField(petsclib::PetscLibType,dm::PetscDM, field::DMField) + +# External Links +$(_doc_external("DM/DMSetCoordinateField")) +""" +function DMSetCoordinateField(petsclib::PetscLibType, dm::PetscDM, field::DMField) end + +@for_petsc function DMSetCoordinateField(petsclib::$UnionPetscLib, dm::PetscDM, field::DMField ) + + @chk ccall( + (:DMSetCoordinateField, $petsc_library), + PetscErrorCode, + (CDM, DMField), + dm, field, + ) + + + return nothing +end + +""" + DMSetCellCoordinateField(petsclib::PetscLibType,dm::PetscDM, field::DMField) + +# External Links +$(_doc_external("DM/DMSetCellCoordinateField")) +""" +function DMSetCellCoordinateField(petsclib::PetscLibType, dm::PetscDM, field::DMField) end + +@for_petsc function DMSetCellCoordinateField(petsclib::$UnionPetscLib, dm::PetscDM, field::DMField ) + + @chk ccall( + (:DMSetCellCoordinateField, $petsc_library), + PetscErrorCode, + (CDM, DMField), + dm, field, + ) + + + return nothing +end + +""" + lmin::Vector{PetscReal},lmax::Vector{PetscReal} = DMGetLocalBoundingBox(petsclib::PetscLibType,dm::PetscDM) +Returns the bounding box for the piece of the `DM` on this process. + +Not Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameters: +- `lmin` - local minimum coordinates (length coord dim, optional) +- `lmax` - local maximum coordinates (length coord dim, optional) + +Level: beginner + +-seealso: `DM`, `DMGetCoordinates()`, `DMGetCoordinatesLocal()`, `DMGetBoundingBox()` + +# External Links +$(_doc_external("DM/DMGetLocalBoundingBox")) +""" +function DMGetLocalBoundingBox(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetLocalBoundingBox(petsclib::$UnionPetscLib, dm::PetscDM ) + lmin = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + lmax = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMGetLocalBoundingBox, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}, Ptr{$PetscReal}), + dm, lmin, lmax, + ) + + + return lmin,lmax +end + +""" + gmin::Vector{PetscReal},gmax::Vector{PetscReal} = DMGetBoundingBox(petsclib::PetscLibType,dm::PetscDM) +Returns the global bounding box for the `DM`. + +Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameters: +- `gmin` - global minimum coordinates (length coord dim, optional) +- `gmax` - global maximum coordinates (length coord dim, optional) + +Level: beginner + +-seealso: `DM`, `DMGetLocalBoundingBox()`, `DMGetCoordinates()`, `DMGetCoordinatesLocal()` + +# External Links +$(_doc_external("DM/DMGetBoundingBox")) +""" +function DMGetBoundingBox(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetBoundingBox(petsclib::$UnionPetscLib, dm::PetscDM ) + gmin = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + gmax = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMGetBoundingBox, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}, Ptr{$PetscReal}), + dm, gmin, gmax, + ) + + + return gmin,gmax +end + +""" + DMSetCoordinateDisc(petsclib::PetscLibType,dm::PetscDM, disc::PetscFE, locized::PetscBool, project::PetscBool) +Set a coordinate space + +Input Parameters: +- `dm` - The `DM` object +- `disc` - The new coordinate discretization or `NULL` to ensure a coordinate discretization exists +- `localized` - Set a localized (DG) coordinate space +- `project` - Project coordinates to new discretization + +Level: intermediate + +-seealso: `DM`, `PetscFE`, `DMGetCoordinateField()` + +# External Links +$(_doc_external("DM/DMSetCoordinateDisc")) +""" +function DMSetCoordinateDisc(petsclib::PetscLibType, dm::PetscDM, disc::PetscFE, locized::PetscBool, project::PetscBool) end + +@for_petsc function DMSetCoordinateDisc(petsclib::$UnionPetscLib, dm::PetscDM, disc::PetscFE, locized::PetscBool, project::PetscBool ) + + @chk ccall( + (:DMSetCoordinateDisc, $petsc_library), + PetscErrorCode, + (CDM, PetscFE, PetscBool, PetscBool), + dm, disc, locized, project, + ) + + + return nothing +end + +""" + DMLocatePoints(petsclib::PetscLibType,dm::PetscDM, v::PetscVec, ltype::DMPoCintLocationType, cellSF::PetscSF) +Locate the points in `v` in the mesh and return a `PetscSF` of the containing cells + +Collective + +Input Parameters: +- `dm` - The `DM` +- `ltype` - The type of point location, e.g. `DM_POINTLOCATION_NONE` or `DM_POINTLOCATION_NEAREST` + +Input/Output Parameters: +- `v` - The `Vec` of points, on output contains the nearest mesh points to the given points if `DM_POINTLOCATION_NEAREST` is used +- `cellSF` - Points to either `NULL`, or a `PetscSF` with guesses for which cells contain each point; +on output, the `PetscSF` containing the MPI ranks and local indices of the containing points + +Level: developer + +-seealso: `DM`, `DMSetCoordinates()`, `DMSetCoordinatesLocal()`, `DMGetCoordinates()`, `DMGetCoordinatesLocal()`, `DMPointLocationType` + +# External Links +$(_doc_external("DM/DMLocatePoints")) +""" +function DMLocatePoints(petsclib::PetscLibType, dm::PetscDM, v::PetscVec, ltype::DMPoCintLocationType, cellSF::PetscSF) end + +@for_petsc function DMLocatePoints(petsclib::$UnionPetscLib, dm::PetscDM, v::PetscVec, ltype::DMPoCintLocationType, cellSF::PetscSF ) + + @chk ccall( + (:DMLocatePoints, $petsc_library), + PetscErrorCode, + (CDM, CVec, DMPoCintLocationType, Ptr{PetscSF}), + dm, v, ltype, cellSF, + ) + + + return nothing +end + +""" + DMGeomModelRegisterAll(petsclib::PetscLibType) +Registers all of the geometry model methods in the `DM` package. + +Not Collective + +Level: advanced + +-seealso: `DM`, `DMGeomModelRegisterDestroy()` + +# External Links +$(_doc_external("DM/DMGeomModelRegisterAll")) +""" +function DMGeomModelRegisterAll(petsclib::PetscLibType) end + +@for_petsc function DMGeomModelRegisterAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMGeomModelRegisterAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMGeomModelRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a geometry model to `DM` + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined geometry model +- `fnc` - geometry model function + +-seealso: `DM`, `DMGeomModelRegisterAll()`, `DMPlexGeomModel()`, `DMGeomModelRegisterDestroy()` + +# External Links +$(_doc_external("DM/DMGeomModelRegister")) +""" +function DMGeomModelRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function DMGeomModelRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:DMGeomModelRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + DMGeomModelRegisterDestroy(petsclib::PetscLibType) + +# External Links +$(_doc_external("DM/DMGeomModelRegisterDestroy")) +""" +function DMGeomModelRegisterDestroy(petsclib::PetscLibType) end + +@for_petsc function DMGeomModelRegisterDestroy(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMGeomModelRegisterDestroy, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMSetSnapToGeomModel(petsclib::PetscLibType,dm::PetscDM, name::String) +Choose a geometry model for this `DM`. + +Not Collective + +Input Parameters: +- `dm` - The `DM` object +- `name` - A geometry model name, or `NULL` for the default + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMRefine()`, `DMPlexCreate()`, `DMSnapToGeomModel()` + +# External Links +$(_doc_external("DM/DMSetSnapToGeomModel")) +""" +function DMSetSnapToGeomModel(petsclib::PetscLibType, dm::PetscDM, name::String) end + +@for_petsc function DMSetSnapToGeomModel(petsclib::$UnionPetscLib, dm::PetscDM, name::String ) + + @chk ccall( + (:DMSetSnapToGeomModel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + dm, name, + ) + + + return nothing +end + +""" + gcoords::Vector{PetscScalar} = DMSnapToGeomModel(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, dE::PetscInt, mcoords::Vector{PetscScalar}) +Given a coordinate point 'mcoords' on the mesh point 'p', return the closest coordinate point 'gcoords' on the geometry model associated with that point. + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `p` - The mesh point +- `dE` - The coordinate dimension +- `mcoords` - A coordinate point lying on the mesh point + +Output Parameter: +- `gcoords` - The closest coordinate point on the geometry model associated with 'p' to the given point + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMRefine()`, `DMPlexCreate()`, `DMPlexSetRefinementUniform()` + +# External Links +$(_doc_external("DM/DMSnapToGeomModel")) +""" +function DMSnapToGeomModel(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, dE::PetscInt, mcoords::Vector{PetscScalar}) end + +@for_petsc function DMSnapToGeomModel(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, dE::$PetscInt, mcoords::Vector{$PetscScalar} ) + gcoords = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMSnapToGeomModel, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + dm, p, dE, mcoords, gcoords, + ) + + + return gcoords +end + +""" + DMGenerateRegisterAll(petsclib::PetscLibType) +Registers all of the mesh generation methods in the `DM` package. + +Not Collective + +Level: advanced + +-seealso: `DM`, `DMGenerateRegisterDestroy()` + +# External Links +$(_doc_external("DM/DMGenerateRegisterAll")) +""" +function DMGenerateRegisterAll(petsclib::PetscLibType) end + +@for_petsc function DMGenerateRegisterAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMGenerateRegisterAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMGenerateRegister(petsclib::PetscLibType,sname::String, fnc::external, rfnc::external, alfnc::external, dim::PetscInt) +Adds a grid generator to `DM` + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined grid generator +- `fnc` - generator function +- `rfnc` - refinement function +- `alfnc` - adapt by label function +- `dim` - dimension of boundary of domain + +-seealso: `DM`, `DMGenerateRegisterAll()`, `DMPlexGenerate()`, `DMGenerateRegisterDestroy()` + +# External Links +$(_doc_external("DM/DMGenerateRegister")) +""" +function DMGenerateRegister(petsclib::PetscLibType, sname::String, fnc::external, rfnc::external, alfnc::external, dim::PetscInt) end + +@for_petsc function DMGenerateRegister(petsclib::$UnionPetscLib, sname::String, fnc::external, rfnc::external, alfnc::external, dim::$PetscInt ) + + @chk ccall( + (:DMGenerateRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external, external, external, $PetscInt), + sname, fnc, rfnc, alfnc, dim, + ) + + + return nothing +end + +""" + DMGenerateRegisterDestroy(petsclib::PetscLibType) + +# External Links +$(_doc_external("DM/DMGenerateRegisterDestroy")) +""" +function DMGenerateRegisterDestroy(petsclib::PetscLibType) end + +@for_petsc function DMGenerateRegisterDestroy(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMGenerateRegisterDestroy, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMAdaptLabel(petsclib::PetscLibType,dm::PetscDM, label::DMLabel, dmAdapt::PetscDM) +Adapt a `DM` based on a `DMLabel` with values interpreted as coarsening and refining flags. Specific implementations of `DM` maybe have +specialized flags, but all implementations should accept flag values `DM_ADAPT_DETERMINE`, `DM_ADAPT_KEEP`, `DM_ADAPT_REFINE`, and, +`DM_ADAPT_COARSEN`. + +Collective + +Input Parameters: +- `dm` - the pre-adaptation `DM` object +- `label` - label with the flags + +Output Parameters: +- `dmAdapt` - the adapted `DM` object: may be `NULL` if an adapted `DM` could not be produced. + +Level: intermediate + +-seealso: `DM`, `DMAdaptMetric()`, `DMCoarsen()`, `DMRefine()` + +# External Links +$(_doc_external("DM/DMAdaptLabel")) +""" +function DMAdaptLabel(petsclib::PetscLibType, dm::PetscDM, label::DMLabel, dmAdapt::PetscDM) end + +@for_petsc function DMAdaptLabel(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel, dmAdapt::PetscDM ) + dmAdapt_ = Ref(dmAdapt.ptr) + + @chk ccall( + (:DMAdaptLabel, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, Ptr{CDM}), + dm, label, dmAdapt_, + ) + + dmAdapt.ptr = dmAdapt_[] + + return nothing +end + +""" + DMAdaptMetric(petsclib::PetscLibType,dm::PetscDM, metric::PetscVec, bdLabel::DMLabel, rgLabel::DMLabel, dmAdapt::PetscDM) +Generates a mesh adapted to the specified metric field. + +Input Parameters: +- `dm` - The DM object +- `metric` - The metric to which the mesh is adapted, defined vertex-wise. +- `bdLabel` - Label for boundary tags, which will be preserved in the output mesh. `bdLabel` should be `NULL` if there is no such label, and should be different from "_boundary_". +- `rgLabel` - Label for cell tags, which will be preserved in the output mesh. `rgLabel` should be `NULL` if there is no such label, and should be different from "_regions_". + +Output Parameter: +- `dmAdapt` - Pointer to the `DM` object containing the adapted mesh + +-seealso: `DMAdaptLabel()`, `DMCoarsen()`, `DMRefine()` + +# External Links +$(_doc_external("DM/DMAdaptMetric")) +""" +function DMAdaptMetric(petsclib::PetscLibType, dm::PetscDM, metric::PetscVec, bdLabel::DMLabel, rgLabel::DMLabel, dmAdapt::PetscDM) end + +@for_petsc function DMAdaptMetric(petsclib::$UnionPetscLib, dm::PetscDM, metric::PetscVec, bdLabel::DMLabel, rgLabel::DMLabel, dmAdapt::PetscDM ) + dmAdapt_ = Ref(dmAdapt.ptr) + + @chk ccall( + (:DMAdaptMetric, $petsc_library), + PetscErrorCode, + (CDM, CVec, DMLabel, DMLabel, Ptr{CDM}), + dm, metric, bdLabel, rgLabel, dmAdapt_, + ) + + dmAdapt.ptr = dmAdapt_[] + + return nothing +end + +""" + maxCell::Vector{PetscReal},Lstart::Vector{PetscReal},L::Vector{PetscReal} = DMGetPeriodicity(petsclib::PetscLibType,dm::PetscDM) +Get the description of mesh periodicity + +Not collective + +Input Parameter: +- `dm` - The `DM` object + +Output Parameters: +- `maxCell` - Over distances greater than this, we can assume a point has crossed over to another sheet, when trying to localize cell coordinates +- `Lstart` - If we assume the mesh is a torus, this is the start of each coordinate, or `NULL` for 0.0 +- `L` - If we assume the mesh is a torus, this is the length of each coordinate, otherwise it is < 0.0 + +Level: developer + +-seealso: `DM` + +# External Links +$(_doc_external("DM/DMGetPeriodicity")) +""" +function DMGetPeriodicity(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetPeriodicity(petsclib::$UnionPetscLib, dm::PetscDM ) + maxCell_ = Ref{Ptr{$PetscReal}}() + Lstart_ = Ref{Ptr{$PetscReal}}() + L_ = Ref{Ptr{$PetscReal}}() + + @chk ccall( + (:DMGetPeriodicity, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}), + dm, maxCell_, Lstart_, L_, + ) + + maxCell = unsafe_wrap(Array, maxCell_[], VecGetLocalSize(petsclib, x); own = false) + Lstart = unsafe_wrap(Array, Lstart_[], VecGetLocalSize(petsclib, x); own = false) + L = unsafe_wrap(Array, L_[], VecGetLocalSize(petsclib, x); own = false) + + return maxCell,Lstart,L +end + +""" + DMSetPeriodicity(petsclib::PetscLibType,dm::PetscDM, maxCell::Vector{PetscReal}, Lstart::Vector{PetscReal}, L::Vector{PetscReal}) +Set the description of mesh periodicity + +Logically Collective + +Input Parameters: +- `dm` - The `DM` object +- `maxCell` - Over distances greater than this, we can assume a point has crossed over to another sheet, when trying to localize cell coordinates. Pass `NULL` to remove such information. +- `Lstart` - If we assume the mesh is a torus, this is the start of each coordinate, or `NULL` for 0.0 +- `L` - If we assume the mesh is a torus, this is the length of each coordinate, otherwise it is < 0.0 + +Level: developer + +-seealso: `DM`, `DMGetPeriodicity()` + +# External Links +$(_doc_external("DM/DMSetPeriodicity")) +""" +function DMSetPeriodicity(petsclib::PetscLibType, dm::PetscDM, maxCell::Vector{PetscReal}, Lstart::Vector{PetscReal}, L::Vector{PetscReal}) end + +@for_petsc function DMSetPeriodicity(petsclib::$UnionPetscLib, dm::PetscDM, maxCell::Vector{$PetscReal}, Lstart::Vector{$PetscReal}, L::Vector{$PetscReal} ) + + @chk ccall( + (:DMSetPeriodicity, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + dm, maxCell, Lstart, L, + ) + + + return nothing +end + +""" + out::Vector{PetscScalar} = DMLocalizeCoordinate(petsclib::PetscLibType,dm::PetscDM, in::Vector{PetscScalar}, endpoint::PetscBool) +If a mesh is periodic (a torus with lengths L_i, some of which can be infinite), project the coordinate onto [0, L_i) in each dimension. + +Input Parameters: +- `dm` - The `DM` +- `in` - The input coordinate point (dim numbers) +- `endpoint` - Include the endpoint L_i + +Output Parameter: +- `out` - The localized coordinate point (dim numbers) + +Level: developer + +-seealso: `DM`, `DMLocalizeCoordinates()`, `DMLocalizeAddCoordinate()` + +# External Links +$(_doc_external("DM/DMLocalizeCoordinate")) +""" +function DMLocalizeCoordinate(petsclib::PetscLibType, dm::PetscDM, in::Vector{PetscScalar}, endpoint::PetscBool) end + +@for_petsc function DMLocalizeCoordinate(petsclib::$UnionPetscLib, dm::PetscDM, in::Vector{$PetscScalar}, endpoint::PetscBool ) + out = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMLocalizeCoordinate, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscScalar}, PetscBool, Ptr{$PetscScalar}), + dm, in, endpoint, out, + ) + + + return out +end + +""" + areLocalized::PetscBool = DMGetCoordinatesLocalizedLocal(petsclib::PetscLibType,dm::PetscDM) +Check if the `DM` coordinates have been localized for cells on this process + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `areLocalized` - `PETSC_TRUE` if localized + +Level: developer + +-seealso: `DM`, `DMLocalizeCoordinates()`, `DMGetCoordinatesLocalized()`, `DMSetPeriodicity()` + +# External Links +$(_doc_external("DM/DMGetCoordinatesLocalizedLocal")) +""" +function DMGetCoordinatesLocalizedLocal(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetCoordinatesLocalizedLocal(petsclib::$UnionPetscLib, dm::PetscDM ) + areLocalized_ = Ref{PetscBool}() + + @chk ccall( + (:DMGetCoordinatesLocalizedLocal, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, areLocalized_, + ) + + areLocalized = areLocalized_[] + + return areLocalized +end + +""" + areLocalized::PetscBool = DMGetCoordinatesLocalized(petsclib::PetscLibType,dm::PetscDM) +Check if the `DM` coordinates have been localized for cells + +Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `areLocalized` - `PETSC_TRUE` if localized + +Level: developer + +-seealso: `DM`, `DMLocalizeCoordinates()`, `DMSetPeriodicity()`, `DMGetCoordinatesLocalizedLocal()` + +# External Links +$(_doc_external("DM/DMGetCoordinatesLocalized")) +""" +function DMGetCoordinatesLocalized(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetCoordinatesLocalized(petsclib::$UnionPetscLib, dm::PetscDM ) + areLocalized_ = Ref{PetscBool}() + + @chk ccall( + (:DMGetCoordinatesLocalized, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, areLocalized_, + ) + + areLocalized = areLocalized_[] + + return areLocalized +end + +""" + sparse::PetscBool = DMGetSparseLocalize(petsclib::PetscLibType,dm::PetscDM) +Check if the `DM` coordinates should be localized only for cells near the periodic boundary. + +Not collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `sparse` - `PETSC_TRUE` if only cells near the periodic boundary are localized + +Level: intermediate + +-seealso: `DMSetSparseLocalize()`, `DMLocalizeCoordinates()`, `DMSetPeriodicity()` + +# External Links +$(_doc_external("DM/DMGetSparseLocalize")) +""" +function DMGetSparseLocalize(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMGetSparseLocalize(petsclib::$UnionPetscLib, dm::PetscDM ) + sparse_ = Ref{PetscBool}() + + @chk ccall( + (:DMGetSparseLocalize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, sparse_, + ) + + sparse = sparse_[] + + return sparse +end + +""" + DMSetSparseLocalize(petsclib::PetscLibType,dm::PetscDM, sparse::PetscBool) +Set the flag indicating that `DM` coordinates should be localized only for cells near the periodic boundary. + +Logically collective + +Input Parameters: +- `dm` - The `DM` +- `sparse` - `PETSC_TRUE` if only cells near the periodic boundary are localized + +Level: intermediate + +-seealso: `DMGetSparseLocalize()`, `DMLocalizeCoordinates()`, `DMSetPeriodicity()` + +# External Links +$(_doc_external("DM/DMSetSparseLocalize")) +""" +function DMSetSparseLocalize(petsclib::PetscLibType, dm::PetscDM, sparse::PetscBool) end + +@for_petsc function DMSetSparseLocalize(petsclib::$UnionPetscLib, dm::PetscDM, sparse::PetscBool ) + + @chk ccall( + (:DMSetSparseLocalize, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, sparse, + ) + + + return nothing +end + +""" + DMLocalizeCoordinates(petsclib::PetscLibType,dm::PetscDM) +If a mesh is periodic, create local coordinates for cells having periodic faces + +Collective + +Input Parameter: +- `dm` - The `DM` + +Level: developer + +-seealso: `DM`, `DMSetPeriodicity()`, `DMLocalizeCoordinate()`, `DMLocalizeAddCoordinate()` + +# External Links +$(_doc_external("DM/DMLocalizeCoordinates")) +""" +function DMLocalizeCoordinates(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMLocalizeCoordinates(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMLocalizeCoordinates, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMForestRegisterType(petsclib::PetscLibType,name::DMType) +Registers a `DMType` as a subtype of `DMFOREST` (so that `DMIsForest()` will be correct) + +Not Collective + +Input Parameter: +- `name` - the name of the type + +Level: advanced + +-seealso: `DMFOREST`, `DMIsForest()` + +# External Links +$(_doc_external("DMForest/DMForestRegisterType")) +""" +function DMForestRegisterType(petsclib::PetscLibType, name::DMType) end + +@for_petsc function DMForestRegisterType(petsclib::$UnionPetscLib, name::DMType ) + + @chk ccall( + (:DMForestRegisterType, $petsc_library), + PetscErrorCode, + (DMType,), + name, + ) + + + return nothing +end + +""" + isForest::PetscBool = DMIsForest(petsclib::PetscLibType,dm::PetscDM) +Check whether a DM uses the DMFOREST interface for hierarchically + +Not Collective + +Input Parameter: +- `dm` - the DM object + +Output Parameter: +- `isForest` - whether dm is a subtype of DMFOREST + +Level: intermediate + +-seealso: `DMFOREST`, `DMForestRegisterType()` + +# External Links +$(_doc_external("DM/DMIsForest")) +""" +function DMIsForest(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMIsForest(petsclib::$UnionPetscLib, dm::PetscDM ) + isForest_ = Ref{PetscBool}() + + @chk ccall( + (:DMIsForest, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, isForest_, + ) + + isForest = isForest_[] + + return isForest +end + +""" + DMForestTemplate(petsclib::PetscLibType,dm::PetscDM, comm::MPI_Comm, tdm::PetscDM) +Create a new `DM` that will be adapted from a source `DM`. + +Collective + +Input Parameters: +- `dm` - the source `DM` object +- `comm` - the communicator for the new `DM` (this communicator is currently ignored, but is present so that `DMForestTemplate()` can be used within `DMCoarsen()`) + +Output Parameter: +- `tdm` - the new `DM` object + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetAdaptivityForest()` + +# External Links +$(_doc_external("DMForest/DMForestTemplate")) +""" +function DMForestTemplate(petsclib::PetscLibType, dm::PetscDM, comm::MPI_Comm, tdm::PetscDM) end + +@for_petsc function DMForestTemplate(petsclib::$UnionPetscLib, dm::PetscDM, comm::MPI_Comm, tdm::PetscDM ) + tdm_ = Ref(tdm.ptr) + + @chk ccall( + (:DMForestTemplate, $petsc_library), + PetscErrorCode, + (CDM, MPI_Comm, Ptr{CDM}), + dm, comm, tdm_, + ) + + tdm.ptr = tdm_[] + + return nothing +end + +""" + DMForestSetTopology(petsclib::PetscLibType,dm::PetscDM, topology::DMForestTopology) +Set the topology of a `DMFOREST` during the pre +"cube", "shell") and can be interpreted by subtypes of `DMFOREST`) to construct the base DM of a forest during +`DMSetUp()`. + +Logically collectiv + +Input Parameters: +- `dm` - the forest +- `topology` - the topology of the forest + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetTopology()`, `DMForestSetBaseDM()` + +# External Links +$(_doc_external("DMForest/DMForestSetTopology")) +""" +function DMForestSetTopology(petsclib::PetscLibType, dm::PetscDM, topology::Union{DMForestTopology, String}) end + +@for_petsc function DMForestSetTopology(petsclib::$UnionPetscLib, dm::PetscDM, topology::Union{DMForestTopology, String} ) + + topo_arg = topology + + @chk ccall( + (:DMForestSetTopology, $petsc_library), + PetscErrorCode, + (CDM, DMForestTopology), + dm, topo_arg, + ) + + + return nothing +end + +""" + DMForestGetTopology(petsclib::PetscLibType,dm::PetscDM, topology::DMForestTopology) +Get a string describing the topology of a `DMFOREST`. + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `topology` - the topology of the forest (e.g., 'cube', 'shell') + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetTopology()` + +# External Links +$(_doc_external("DMForest/DMForestGetTopology")) +""" +function DMForestGetTopology(petsclib::PetscLibType, dm::PetscDM, topology::DMForestTopology) end + +@for_petsc function DMForestGetTopology(petsclib::$UnionPetscLib, dm::PetscDM, topology::DMForestTopology ) + + @chk ccall( + (:DMForestGetTopology, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMForestTopology}), + dm, topology, + ) + + + return nothing +end + +""" + DMForestSetBaseDM(petsclib::PetscLibType,dm::PetscDM, base::PetscDM) +During the pre +`DMFOREST` forest. + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `base` - the base `DM` of the forest + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetBaseDM()` + +# External Links +$(_doc_external("DMForest/DMForestSetBaseDM")) +""" +function DMForestSetBaseDM(petsclib::PetscLibType, dm::PetscDM, base::PetscDM) end + +@for_petsc function DMForestSetBaseDM(petsclib::$UnionPetscLib, dm::PetscDM, base::PetscDM ) + + @chk ccall( + (:DMForestSetBaseDM, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dm, base, + ) + + + return nothing +end + +""" + DMForestGetBaseDM(petsclib::PetscLibType,dm::PetscDM, base::PetscDM) +Get the base `DM` of a `DMFOREST` + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `base` - the base `DM` of the forest + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetBaseDM()` + +# External Links +$(_doc_external("DMForest/DMForestGetBaseDM")) +""" +function DMForestGetBaseDM(petsclib::PetscLibType, dm::PetscDM, base::PetscDM) end + +@for_petsc function DMForestGetBaseDM(petsclib::$UnionPetscLib, dm::PetscDM, base::PetscDM ) + base_ = Ref(base.ptr) + + @chk ccall( + (:DMForestGetBaseDM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, base_, + ) + + base.ptr = base_[] + + return nothing +end + +""" + DMForestSetBaseCoordinateMapping(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) + +# External Links +$(_doc_external("DMForest/DMForestSetBaseCoordinateMapping")) +""" +function DMForestSetBaseCoordinateMapping(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMForestSetBaseCoordinateMapping(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMForestSetBaseCoordinateMapping, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMForestSetAdaptivityForest(petsclib::PetscLibType,dm::PetscDM, adapt::PetscDM) +During the pre +current forest will be adapted (e.g., the current forest will be +refined/coarsened/repartitioned from it) in `DMSetUp()`. + +Logically Collective + +Input Parameters: +- `dm` - the new forest, which will be constructed from adapt +- `adapt` - the old forest + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetAdaptivityForest()`, `DMForestSetAdaptivityPurpose()` + +# External Links +$(_doc_external("DMForest/DMForestSetAdaptivityForest")) +""" +function DMForestSetAdaptivityForest(petsclib::PetscLibType, dm::PetscDM, adapt::PetscDM) end + +@for_petsc function DMForestSetAdaptivityForest(petsclib::$UnionPetscLib, dm::PetscDM, adapt::PetscDM ) + + @chk ccall( + (:DMForestSetAdaptivityForest, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dm, adapt, + ) + + + return nothing +end + +""" + DMForestGetAdaptivityForest(petsclib::PetscLibType,dm::PetscDM, adapt::PetscDM) +Get the forest from which the current forest is adapted. + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `adapt` - the forest from which `dm` is/was adapted + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetAdaptivityForest()`, `DMForestSetAdaptivityPurpose()` + +# External Links +$(_doc_external("DMForest/DMForestGetAdaptivityForest")) +""" +function DMForestGetAdaptivityForest(petsclib::PetscLibType, dm::PetscDM, adapt::PetscDM) end + +@for_petsc function DMForestGetAdaptivityForest(petsclib::$UnionPetscLib, dm::PetscDM, adapt::PetscDM ) + adapt_ = Ref(adapt.ptr) + + @chk ccall( + (:DMForestGetAdaptivityForest, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, adapt_, + ) + + adapt.ptr = adapt_[] + + return nothing +end + +""" + DMForestSetAdaptivityPurpose(petsclib::PetscLibType,dm::PetscDM, purpose::DMAdaptFlag) +During the pre +source (set with `DMForestSetAdaptivityForest()`) for the purpose of refinement (`DM_ADAPT_REFINE`), coarsening +(`DM_ADAPT_COARSEN`), or undefined (`DM_ADAPT_DETERMINE`). + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `purpose` - the adaptivity purpose + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestTemplate()`, `DMForestSetAdaptivityForest()`, `DMForestGetAdaptivityForest()`, `DMAdaptFlag` + +# External Links +$(_doc_external("DMForest/DMForestSetAdaptivityPurpose")) +""" +function DMForestSetAdaptivityPurpose(petsclib::PetscLibType, dm::PetscDM, purpose::DMAdaptFlag) end + +@for_petsc function DMForestSetAdaptivityPurpose(petsclib::$UnionPetscLib, dm::PetscDM, purpose::DMAdaptFlag ) + + @chk ccall( + (:DMForestSetAdaptivityPurpose, $petsc_library), + PetscErrorCode, + (CDM, DMAdaptFlag), + dm, purpose, + ) + + + return nothing +end + +""" + DMForestGetAdaptivityPurpose(petsclib::PetscLibType,dm::PetscDM, purpose::DMAdaptFlag) +Get whether the current `DM` is being adapted from its source (set with +`DMForestSetAdaptivityForest()`) for the purpose of refinement (`DM_ADAPT_REFINE`), coarsening (`DM_ADAPT_COARSEN`), +coarsening only the last level (`DM_ADAPT_COARSEN_LAST`) or undefined (`DM_ADAPT_DETERMINE`). + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `purpose` - the adaptivity purpose + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestTemplate()`, `DMForestSetAdaptivityForest()`, `DMForestGetAdaptivityForest()`, `DMAdaptFlag` + +# External Links +$(_doc_external("DMForest/DMForestGetAdaptivityPurpose")) +""" +function DMForestGetAdaptivityPurpose(petsclib::PetscLibType, dm::PetscDM, purpose::DMAdaptFlag) end + +@for_petsc function DMForestGetAdaptivityPurpose(petsclib::$UnionPetscLib, dm::PetscDM, purpose::DMAdaptFlag ) + + @chk ccall( + (:DMForestGetAdaptivityPurpose, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMAdaptFlag}), + dm, purpose, + ) + + + return nothing +end + +""" + DMForestSetAdjacencyDimension(petsclib::PetscLibType,dm::PetscDM, adjDim::PetscInt) +During the pre +cell adjacency (for the purposes of partitioning and overlap). + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `adjDim` - default 0 (i.e., vertices determine adjacency) + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetAdjacencyDimension()`, `DMForestSetAdjacencyCodimension()`, `DMForestSetPartitionOverlap()` + +# External Links +$(_doc_external("DMForest/DMForestSetAdjacencyDimension")) +""" +function DMForestSetAdjacencyDimension(petsclib::PetscLibType, dm::PetscDM, adjDim::PetscInt) end + +@for_petsc function DMForestSetAdjacencyDimension(petsclib::$UnionPetscLib, dm::PetscDM, adjDim::$PetscInt ) + + @chk ccall( + (:DMForestSetAdjacencyDimension, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, adjDim, + ) + + + return nothing +end + +""" + DMForestSetAdjacencyCodimension(petsclib::PetscLibType,dm::PetscDM, adjCodim::PetscInt) +Like `DMForestSetAdjacencyDimension()`, but specified as a co +e.g., adjacency based on facets can be specified by codimension 1 in all cases) + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `adjCodim` - default is the dimension of the forest (see `DMGetDimension()`), since this is the codimension of vertices + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetAdjacencyCodimension()`, `DMForestSetAdjacencyDimension()` + +# External Links +$(_doc_external("DMForest/DMForestSetAdjacencyCodimension")) +""" +function DMForestSetAdjacencyCodimension(petsclib::PetscLibType, dm::PetscDM, adjCodim::PetscInt) end + +@for_petsc function DMForestSetAdjacencyCodimension(petsclib::$UnionPetscLib, dm::PetscDM, adjCodim::$PetscInt ) + + @chk ccall( + (:DMForestSetAdjacencyCodimension, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, adjCodim, + ) + + + return nothing +end + +""" + adjDim::PetscInt = DMForestGetAdjacencyDimension(petsclib::PetscLibType,dm::PetscDM) +Get the dimension of interface points that determine cell adjacency (for the +purposes of partitioning and overlap). + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `adjDim` - default 0 (i.e., vertices determine adjacency) + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetAdjacencyDimension()`, `DMForestGetAdjacencyCodimension()`, `DMForestSetPartitionOverlap()` + +# External Links +$(_doc_external("DMForest/DMForestGetAdjacencyDimension")) +""" +function DMForestGetAdjacencyDimension(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetAdjacencyDimension(petsclib::$UnionPetscLib, dm::PetscDM ) + adjDim_ = Ref{$PetscInt}() + + @chk ccall( + (:DMForestGetAdjacencyDimension, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, adjDim_, + ) + + adjDim = adjDim_[] + + return adjDim +end + +""" + adjCodim::PetscInt = DMForestGetAdjacencyCodimension(petsclib::PetscLibType,dm::PetscDM) +Like `DMForestGetAdjacencyDimension()`, but specified as a co +e.g., adjacency based on facets can be specified by codimension 1 in all cases) + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `adjCodim` - default isthe dimension of the forest (see `DMGetDimension()`), since this is the codimension of vertices + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetAdjacencyCodimension()`, `DMForestGetAdjacencyDimension()` + +# External Links +$(_doc_external("DMForest/DMForestGetAdjacencyCodimension")) +""" +function DMForestGetAdjacencyCodimension(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetAdjacencyCodimension(petsclib::$UnionPetscLib, dm::PetscDM ) + adjCodim_ = Ref{$PetscInt}() + + @chk ccall( + (:DMForestGetAdjacencyCodimension, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, adjCodim_, + ) + + adjCodim = adjCodim_[] + + return adjCodim +end + +""" + DMForestSetPartitionOverlap(petsclib::PetscLibType,dm::PetscDM, overlap::PetscInt) +During the pre +partitions of a forest, with values > 0 indicating subdomains that are expanded by that many iterations of adding +adjacent cells + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `overlap` - default 0 + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetPartitionOverlap()`, `DMForestSetAdjacencyDimension()`, `DMForestSetAdjacencyCodimension()` + +# External Links +$(_doc_external("DMForest/DMForestSetPartitionOverlap")) +""" +function DMForestSetPartitionOverlap(petsclib::PetscLibType, dm::PetscDM, overlap::PetscInt) end + +@for_petsc function DMForestSetPartitionOverlap(petsclib::$UnionPetscLib, dm::PetscDM, overlap::$PetscInt ) + + @chk ccall( + (:DMForestSetPartitionOverlap, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, overlap, + ) + + + return nothing +end + +""" + overlap::PetscInt = DMForestGetPartitionOverlap(petsclib::PetscLibType,dm::PetscDM) +Get the amount of cell +> 0 indicating subdomains that are expanded by that many iterations of adding adjacent cells + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `overlap` - default 0 + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetAdjacencyDimension()`, `DMForestSetAdjacencyCodimension()` + +# External Links +$(_doc_external("DMForest/DMForestGetPartitionOverlap")) +""" +function DMForestGetPartitionOverlap(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetPartitionOverlap(petsclib::$UnionPetscLib, dm::PetscDM ) + overlap_ = Ref{$PetscInt}() + + @chk ccall( + (:DMForestGetPartitionOverlap, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, overlap_, + ) + + overlap = overlap_[] + + return overlap +end + +""" + DMForestSetMinimumRefinement(petsclib::PetscLibType,dm::PetscDM, minRefinement::PetscInt) +During the pre +`DM`, see `DMForestGetBaseDM()`) allowed in the forest. If the forest is being created by coarsening a previous forest +(see `DMForestGetAdaptivityForest()`) this limits the amount of coarsening. + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `minRefinement` - default `PETSC_DEFAULT` (interpreted by the subtype of `DMFOREST`) + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetMinimumRefinement()`, `DMForestSetMaximumRefinement()`, `DMForestSetInitialRefinement()`, `DMForestGetBaseDM()`, `DMForestGetAdaptivityForest()` + +# External Links +$(_doc_external("DMForest/DMForestSetMinimumRefinement")) +""" +function DMForestSetMinimumRefinement(petsclib::PetscLibType, dm::PetscDM, minRefinement::PetscInt) end + +@for_petsc function DMForestSetMinimumRefinement(petsclib::$UnionPetscLib, dm::PetscDM, minRefinement::$PetscInt ) + + @chk ccall( + (:DMForestSetMinimumRefinement, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, minRefinement, + ) + + + return nothing +end + +""" + minRefinement::PetscInt = DMForestGetMinimumRefinement(petsclib::PetscLibType,dm::PetscDM) +Get the minimum level of refinement (relative to the base `DM`, see +`DMForestGetBaseDM()`) allowed in the forest. If the forest is being created by coarsening a previous forest (see +`DMForestGetAdaptivityForest()`), this limits the amount of coarsening. + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `minRefinement` - default `PETSC_DEFAULT` (interpreted by the subtype of `DMFOREST`) + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetMinimumRefinement()`, `DMForestGetMaximumRefinement()`, `DMForestGetInitialRefinement()`, `DMForestGetBaseDM()`, `DMForestGetAdaptivityForest()` + +# External Links +$(_doc_external("DMForest/DMForestGetMinimumRefinement")) +""" +function DMForestGetMinimumRefinement(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetMinimumRefinement(petsclib::$UnionPetscLib, dm::PetscDM ) + minRefinement_ = Ref{$PetscInt}() + + @chk ccall( + (:DMForestGetMinimumRefinement, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, minRefinement_, + ) + + minRefinement = minRefinement_[] + + return minRefinement +end + +""" + DMForestSetInitialRefinement(petsclib::PetscLibType,dm::PetscDM, initRefinement::PetscInt) +During the pre +`DM`, see `DMForestGetBaseDM()`) allowed in the forest. + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `initRefinement` - default `PETSC_DEFAULT` (interpreted by the subtype of `DMFOREST`) + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetMinimumRefinement()`, `DMForestSetMaximumRefinement()`, `DMForestGetBaseDM()` + +# External Links +$(_doc_external("DMForest/DMForestSetInitialRefinement")) +""" +function DMForestSetInitialRefinement(petsclib::PetscLibType, dm::PetscDM, initRefinement::PetscInt) end + +@for_petsc function DMForestSetInitialRefinement(petsclib::$UnionPetscLib, dm::PetscDM, initRefinement::$PetscInt ) + + @chk ccall( + (:DMForestSetInitialRefinement, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, initRefinement, + ) + + + return nothing +end + +""" + initRefinement::PetscInt = DMForestGetInitialRefinement(petsclib::PetscLibType,dm::PetscDM) +Get the initial level of refinement (relative to the base `DM`, see +`DMForestGetBaseDM()`) allowed in the forest. + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `initRefinement` - default `PETSC_DEFAULT` (interpreted by the subtype of `DMFOREST`) + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetMinimumRefinement()`, `DMForestSetMaximumRefinement()`, `DMForestGetBaseDM()` + +# External Links +$(_doc_external("DMForest/DMForestGetInitialRefinement")) +""" +function DMForestGetInitialRefinement(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetInitialRefinement(petsclib::$UnionPetscLib, dm::PetscDM ) + initRefinement_ = Ref{$PetscInt}() + + @chk ccall( + (:DMForestGetInitialRefinement, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, initRefinement_, + ) + + initRefinement = initRefinement_[] + + return initRefinement +end + +""" + DMForestSetMaximumRefinement(petsclib::PetscLibType,dm::PetscDM, maxRefinement::PetscInt) +During the pre +`DM`, see `DMForestGetBaseDM()`) allowed in the forest. If the forest is being created by refining a previous forest +(see `DMForestGetAdaptivityForest()`), this limits the amount of refinement. + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `maxRefinement` - default `PETSC_DEFAULT` (interpreted by the subtype of `DMFOREST`) + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetMinimumRefinement()`, `DMForestSetInitialRefinement()`, `DMForestGetBaseDM()`, `DMForestGetAdaptivityDM()` + +# External Links +$(_doc_external("DMForest/DMForestSetMaximumRefinement")) +""" +function DMForestSetMaximumRefinement(petsclib::PetscLibType, dm::PetscDM, maxRefinement::PetscInt) end + +@for_petsc function DMForestSetMaximumRefinement(petsclib::$UnionPetscLib, dm::PetscDM, maxRefinement::$PetscInt ) + + @chk ccall( + (:DMForestSetMaximumRefinement, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, maxRefinement, + ) + + + return nothing +end + +""" + maxRefinement::PetscInt = DMForestGetMaximumRefinement(petsclib::PetscLibType,dm::PetscDM) +Get the maximum level of refinement (relative to the base `DM`, see +`DMForestGetBaseDM()`) allowed in the forest. If the forest is being created by refining a previous forest (see +`DMForestGetAdaptivityForest()`), this limits the amount of refinement. + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `maxRefinement` - default `PETSC_DEFAULT` (interpreted by the subtype of `DMFOREST`) + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetMaximumRefinement()`, `DMForestGetMinimumRefinement()`, `DMForestGetInitialRefinement()`, `DMForestGetBaseDM()`, `DMForestGetAdaptivityForest()` + +# External Links +$(_doc_external("DMForest/DMForestGetMaximumRefinement")) +""" +function DMForestGetMaximumRefinement(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetMaximumRefinement(petsclib::$UnionPetscLib, dm::PetscDM ) + maxRefinement_ = Ref{$PetscInt}() + + @chk ccall( + (:DMForestGetMaximumRefinement, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, maxRefinement_, + ) + + maxRefinement = maxRefinement_[] + + return maxRefinement +end + +""" + DMForestSetAdaptivityStrategy(petsclib::PetscLibType,dm::PetscDM, adaptStrategy::DMForestAdaptivityStrategy) +During the pre + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `adaptStrategy` - default `DMFORESTADAPTALL` + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestGetAdaptivityStrategy()`, `DMFORESTADAPTALL`, `DMFORESTADAPTANY` + +# External Links +$(_doc_external("DMForest/DMForestSetAdaptivityStrategy")) +""" +function DMForestSetAdaptivityStrategy(petsclib::PetscLibType, dm::PetscDM, adaptStrategy::DMForestAdaptivityStrategy) end + +@for_petsc function DMForestSetAdaptivityStrategy(petsclib::$UnionPetscLib, dm::PetscDM, adaptStrategy::DMForestAdaptivityStrategy ) + + @chk ccall( + (:DMForestSetAdaptivityStrategy, $petsc_library), + PetscErrorCode, + (CDM, DMForestAdaptivityStrategy), + dm, adaptStrategy, + ) + + + return nothing +end + +""" + DMForestGetAdaptivityStrategy(petsclib::PetscLibType,dm::PetscDM, adaptStrategy::DMForestAdaptivityStrategy) +Get the strategy for combining adaptivity labels from multiple processes. + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `adaptStrategy` - the adaptivity strategy (default `DMFORESTADAPTALL`) + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMFORESTADAPTALL`, `DMFORESTADAPTANY`, `DMForestSetAdaptivityStrategy()` + +# External Links +$(_doc_external("DMForest/DMForestGetAdaptivityStrategy")) +""" +function DMForestGetAdaptivityStrategy(petsclib::PetscLibType, dm::PetscDM, adaptStrategy::DMForestAdaptivityStrategy) end + +@for_petsc function DMForestGetAdaptivityStrategy(petsclib::$UnionPetscLib, dm::PetscDM, adaptStrategy::DMForestAdaptivityStrategy ) + + @chk ccall( + (:DMForestGetAdaptivityStrategy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMForestAdaptivityStrategy}), + dm, adaptStrategy, + ) + + + return nothing +end + +""" + success::PetscBool = DMForestGetAdaptivitySuccess(petsclib::PetscLibType,dm::PetscDM) +Return whether the requested adaptation (refinement, coarsening, repartitioning, +etc.) was successful. + +Collective + +Input Parameter: +- `dm` - the post-adaptation forest + +Output Parameter: +- `success` - `PETSC_TRUE` if the post-adaptation forest is different from the pre-adaptation forest. + +Level: intermediate + +-seealso: `DM`, `DMFOREST` + +# External Links +$(_doc_external("DMForest/DMForestGetAdaptivitySuccess")) +""" +function DMForestGetAdaptivitySuccess(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetAdaptivitySuccess(petsclib::$UnionPetscLib, dm::PetscDM ) + success_ = Ref{PetscBool}() + + @chk ccall( + (:DMForestGetAdaptivitySuccess, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, success_, + ) + + success = success_[] + + return success +end + +""" + DMForestSetComputeAdaptivitySF(petsclib::PetscLibType,dm::PetscDM, computeSF::PetscBool) +During the pre +relating the cells of the pre-adaptation forest to the post-adaptiation forest. + +Logically Collective + +Input Parameters: +- `dm` - the post-adaptation forest +- `computeSF` - default `PETSC_TRUE` + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestGetComputeAdaptivitySF()`, `DMForestGetAdaptivitySF()` + +# External Links +$(_doc_external("DMForest/DMForestSetComputeAdaptivitySF")) +""" +function DMForestSetComputeAdaptivitySF(petsclib::PetscLibType, dm::PetscDM, computeSF::PetscBool) end + +@for_petsc function DMForestSetComputeAdaptivitySF(petsclib::$UnionPetscLib, dm::PetscDM, computeSF::PetscBool ) + + @chk ccall( + (:DMForestSetComputeAdaptivitySF, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, computeSF, + ) + + + return nothing +end + +""" + DMForestTransferVec(petsclib::PetscLibType,dmIn::PetscDM, vecIn::PetscVec, dmOut::PetscDM, vecOut::PetscVec, useBCs::PetscBool, time::PetscReal) + +# External Links +$(_doc_external("DMForest/DMForestTransferVec")) +""" +function DMForestTransferVec(petsclib::PetscLibType, dmIn::PetscDM, vecIn::PetscVec, dmOut::PetscDM, vecOut::PetscVec, useBCs::PetscBool, time::PetscReal) end + +@for_petsc function DMForestTransferVec(petsclib::$UnionPetscLib, dmIn::PetscDM, vecIn::PetscVec, dmOut::PetscDM, vecOut::PetscVec, useBCs::PetscBool, time::$PetscReal ) + + @chk ccall( + (:DMForestTransferVec, $petsc_library), + PetscErrorCode, + (CDM, CVec, CDM, CVec, PetscBool, $PetscReal), + dmIn, vecIn, dmOut, vecOut, useBCs, time, + ) + + + return nothing +end + +""" + DMForestTransferVecFromBase(petsclib::PetscLibType,dm::PetscDM, vecIn::PetscVec, vecOut::PetscVec) + +# External Links +$(_doc_external("DMForest/DMForestTransferVecFromBase")) +""" +function DMForestTransferVecFromBase(petsclib::PetscLibType, dm::PetscDM, vecIn::PetscVec, vecOut::PetscVec) end + +@for_petsc function DMForestTransferVecFromBase(petsclib::$UnionPetscLib, dm::PetscDM, vecIn::PetscVec, vecOut::PetscVec ) + + @chk ccall( + (:DMForestTransferVecFromBase, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec), + dm, vecIn, vecOut, + ) + + + return nothing +end + +""" + computeSF::PetscBool = DMForestGetComputeAdaptivitySF(petsclib::PetscLibType,dm::PetscDM) +Get whether transfer `PetscSF`s should be computed relating the cells of the +pre-adaptation forest to the post-adaptiation forest. After `DMSetUp()` is called, these transfer PetscSFs can be +accessed with `DMForestGetAdaptivitySF()`. + +Not Collective + +Input Parameter: +- `dm` - the post-adaptation forest + +Output Parameter: +- `computeSF` - default `PETSC_TRUE` + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestSetComputeAdaptivitySF()`, `DMForestGetAdaptivitySF()` + +# External Links +$(_doc_external("DMForest/DMForestGetComputeAdaptivitySF")) +""" +function DMForestGetComputeAdaptivitySF(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetComputeAdaptivitySF(petsclib::$UnionPetscLib, dm::PetscDM ) + computeSF_ = Ref{PetscBool}() + + @chk ccall( + (:DMForestGetComputeAdaptivitySF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, computeSF_, + ) + + computeSF = computeSF_[] + + return computeSF +end + +""" + DMForestGetAdaptivitySF(petsclib::PetscLibType,dm::PetscDM, preCoarseToFine::PetscSF, coarseToPreFine::PetscSF) +Get `PetscSF`s that relate the pre +post-adaptation forest. + +Not Collective + +Input Parameter: +- `dm` - the post-adaptation forest + +Output Parameters: +- `preCoarseToFine` - pre-adaptation coarse cells to post-adaptation fine cells: BCast goes from pre- to post- +- `coarseToPreFine` - post-adaptation coarse cells to pre-adaptation fine cells: BCast goes from post- to pre- + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestGetComputeAdaptivitySF()`, `DMForestSetComputeAdaptivitySF()` + +# External Links +$(_doc_external("DMForest/DMForestGetAdaptivitySF")) +""" +function DMForestGetAdaptivitySF(petsclib::PetscLibType, dm::PetscDM, preCoarseToFine::PetscSF, coarseToPreFine::PetscSF) end + +@for_petsc function DMForestGetAdaptivitySF(petsclib::$UnionPetscLib, dm::PetscDM, preCoarseToFine::PetscSF, coarseToPreFine::PetscSF ) + + @chk ccall( + (:DMForestGetAdaptivitySF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSF}, Ptr{PetscSF}), + dm, preCoarseToFine, coarseToPreFine, + ) + + + return nothing +end + +""" + DMForestSetGradeFactor(petsclib::PetscLibType,dm::PetscDM, grade::PetscInt) +During the pre +mesh, e.g. give 2 to indicate that the diameter of neighboring cells should differ by at most +a factor of 2. + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `grade` - the grading factor + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestGetGradeFactor()` + +# External Links +$(_doc_external("DMForest/DMForestSetGradeFactor")) +""" +function DMForestSetGradeFactor(petsclib::PetscLibType, dm::PetscDM, grade::PetscInt) end + +@for_petsc function DMForestSetGradeFactor(petsclib::$UnionPetscLib, dm::PetscDM, grade::$PetscInt ) + + @chk ccall( + (:DMForestSetGradeFactor, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, grade, + ) + + + return nothing +end + +""" + grade::PetscInt = DMForestGetGradeFactor(petsclib::PetscLibType,dm::PetscDM) +Get the desired amount of grading in the mesh, e.g. give 2 to indicate that the diameter of +neighboring cells should differ by at most a factor of 2. Subtypes of `DMFOREST` may only support one particular +choice of grading factor. + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `grade` - the grading factor + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestSetGradeFactor()` + +# External Links +$(_doc_external("DMForest/DMForestGetGradeFactor")) +""" +function DMForestGetGradeFactor(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetGradeFactor(petsclib::$UnionPetscLib, dm::PetscDM ) + grade_ = Ref{$PetscInt}() + + @chk ccall( + (:DMForestGetGradeFactor, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, grade_, + ) + + grade = grade_[] + + return grade +end + +""" + DMForestSetCellWeightFactor(petsclib::PetscLibType,dm::PetscDM, weightsFactor::PetscReal) +During the pre +the cell weight (see `DMForestSetCellWeights()`) when calculating partitions. + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `weightsFactor` - default 1. + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestGetCellWeightFactor()`, `DMForestSetCellWeights()` + +# External Links +$(_doc_external("DMForest/DMForestSetCellWeightFactor")) +""" +function DMForestSetCellWeightFactor(petsclib::PetscLibType, dm::PetscDM, weightsFactor::PetscReal) end + +@for_petsc function DMForestSetCellWeightFactor(petsclib::$UnionPetscLib, dm::PetscDM, weightsFactor::$PetscReal ) + + @chk ccall( + (:DMForestSetCellWeightFactor, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, weightsFactor, + ) + + + return nothing +end + +""" + weightsFactor::PetscReal = DMForestGetCellWeightFactor(petsclib::PetscLibType,dm::PetscDM) +Get the factor by which the level of refinement changes the cell weight (see +`DMForestSetCellWeights()`) when calculating partitions. + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `weightsFactor` - default 1. + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestSetCellWeightFactor()`, `DMForestSetCellWeights()` + +# External Links +$(_doc_external("DMForest/DMForestGetCellWeightFactor")) +""" +function DMForestGetCellWeightFactor(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetCellWeightFactor(petsclib::$UnionPetscLib, dm::PetscDM ) + weightsFactor_ = Ref{$PetscReal}() + + @chk ccall( + (:DMForestGetCellWeightFactor, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, weightsFactor_, + ) + + weightsFactor = weightsFactor_[] + + return weightsFactor +end + +""" + cStart::PetscInt,cEnd::PetscInt = DMForestGetCellChart(petsclib::PetscLibType,dm::PetscDM) +After the setup phase, get the local half + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameters: +- `cStart` - the first cell on this process +- `cEnd` - one after the final cell on this process + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetCellSF()` + +# External Links +$(_doc_external("DMForest/DMForestGetCellChart")) +""" +function DMForestGetCellChart(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetCellChart(petsclib::$UnionPetscLib, dm::PetscDM ) + cStart_ = Ref{$PetscInt}() + cEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMForestGetCellChart, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, cStart_, cEnd_, + ) + + cStart = cStart_[] + cEnd = cEnd_[] + + return cStart,cEnd +end + +""" + DMForestGetCellSF(petsclib::PetscLibType,dm::PetscDM, cellSF::PetscSF) +After the setup phase, get the `PetscSF` for overlapping cells between processes + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `cellSF` - the `PetscSF` + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetCellChart()` + +# External Links +$(_doc_external("DMForest/DMForestGetCellSF")) +""" +function DMForestGetCellSF(petsclib::PetscLibType, dm::PetscDM, cellSF::PetscSF) end + +@for_petsc function DMForestGetCellSF(petsclib::$UnionPetscLib, dm::PetscDM, cellSF::PetscSF ) + + @chk ccall( + (:DMForestGetCellSF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSF}), + dm, cellSF, + ) + + + return nothing +end + +""" + DMForestSetAdaptivityLabel(petsclib::PetscLibType,dm::PetscDM, adaptLabel::DMLabel) +During the pre +`DMForestGetAdaptivityForest()`) that holds the adaptation flags (refinement, coarsening, or some combination). + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `adaptLabel` - the label in the pre-adaptation forest + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestGetAdaptivityLabel()` + +# External Links +$(_doc_external("DMForest/DMForestSetAdaptivityLabel")) +""" +function DMForestSetAdaptivityLabel(petsclib::PetscLibType, dm::PetscDM, adaptLabel::DMLabel) end + +@for_petsc function DMForestSetAdaptivityLabel(petsclib::$UnionPetscLib, dm::PetscDM, adaptLabel::DMLabel ) + + @chk ccall( + (:DMForestSetAdaptivityLabel, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, adaptLabel, + ) + + + return nothing +end + +""" + DMForestGetAdaptivityLabel(petsclib::PetscLibType,dm::PetscDM, adaptLabel::DMLabel) +Get the label of the pre +holds the adaptation flags (refinement, coarsening, or some combination). + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `adaptLabel` - the name of the label in the pre-adaptation forest + +Level: intermediate + +-seealso: `DM`, `DMFOREST`, `DMForestSetAdaptivityLabel()` + +# External Links +$(_doc_external("DMForest/DMForestGetAdaptivityLabel")) +""" +function DMForestGetAdaptivityLabel(petsclib::PetscLibType, dm::PetscDM, adaptLabel::DMLabel) end + +@for_petsc function DMForestGetAdaptivityLabel(petsclib::$UnionPetscLib, dm::PetscDM, adaptLabel::DMLabel ) + + @chk ccall( + (:DMForestGetAdaptivityLabel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMLabel}), + dm, adaptLabel, + ) + + + return nothing +end + +""" + DMForestSetCellWeights(petsclib::PetscLibType,dm::PetscDM, weights::Vector{PetscReal}, copyMode::PetscCopyMode) +Set the weights assigned to each of the cells (see `DMForestGetCellChart()`) of the current +process: weights are used to determine parallel partitioning. + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `weights` - the array of weights (see `DMForestSetWeightCapacity()`) for all cells, or `NULL` to indicate each cell has weight 1. +- `copyMode` - how weights should reference weights + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestGetCellWeights()`, `DMForestSetWeightCapacity()` + +# External Links +$(_doc_external("DMForest/DMForestSetCellWeights")) +""" +function DMForestSetCellWeights(petsclib::PetscLibType, dm::PetscDM, weights::Vector{PetscReal}, copyMode::PetscCopyMode) end + +@for_petsc function DMForestSetCellWeights(petsclib::$UnionPetscLib, dm::PetscDM, weights::Vector{$PetscReal}, copyMode::PetscCopyMode ) + + @chk ccall( + (:DMForestSetCellWeights, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}, PetscCopyMode), + dm, weights, copyMode, + ) + + + return nothing +end + +""" + weights::PetscReal = DMForestGetCellWeights(petsclib::PetscLibType,dm::PetscDM) +Get the weights assigned to each of the cells (see `DMForestGetCellChart()`) of the current +process: weights are used to determine parallel partitioning. + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `weights` - the array of weights for all cells, or `NULL` to indicate each cell has weight 1. + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestSetCellWeights()`, `DMForestSetWeightCapacity()` + +# External Links +$(_doc_external("DMForest/DMForestGetCellWeights")) +""" +function DMForestGetCellWeights(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetCellWeights(petsclib::$UnionPetscLib, dm::PetscDM ) + weights_ = Ref{$PetscReal}() + + @chk ccall( + (:DMForestGetCellWeights, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, weights_, + ) + + weights = weights_[] + + return weights +end + +""" + DMForestSetWeightCapacity(petsclib::PetscLibType,dm::PetscDM, capacity::PetscReal) +During the pre +a pre-adaptation forest (see `DMForestGetAdaptivityForest()`). + +Logically Collective + +Input Parameters: +- `dm` - the forest +- `capacity` - this process's capacity + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestGetWeightCapacity()`, `DMForestSetCellWeights()`, `DMForestSetCellWeightFactor()` + +# External Links +$(_doc_external("DMForest/DMForestSetWeightCapacity")) +""" +function DMForestSetWeightCapacity(petsclib::PetscLibType, dm::PetscDM, capacity::PetscReal) end + +@for_petsc function DMForestSetWeightCapacity(petsclib::$UnionPetscLib, dm::PetscDM, capacity::$PetscReal ) + + @chk ccall( + (:DMForestSetWeightCapacity, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, capacity, + ) + + + return nothing +end + +""" + capacity::PetscReal = DMForestGetWeightCapacity(petsclib::PetscLibType,dm::PetscDM) +Set the capacity of the current process when repartitioning a pre +`DMForestGetAdaptivityForest()`). + +Not Collective + +Input Parameter: +- `dm` - the forest + +Output Parameter: +- `capacity` - this process's capacity + +Level: advanced + +-seealso: `DM`, `DMFOREST`, `DMForestSetWeightCapacity()`, `DMForestSetCellWeights()`, `DMForestSetCellWeightFactor()` + +# External Links +$(_doc_external("DMForest/DMForestGetWeightCapacity")) +""" +function DMForestGetWeightCapacity(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMForestGetWeightCapacity(petsclib::$UnionPetscLib, dm::PetscDM ) + capacity_ = Ref{$PetscReal}() + + @chk ccall( + (:DMForestGetWeightCapacity, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, capacity_, + ) + + capacity = capacity_[] + + return capacity +end + +""" + DMSwarmSetPointsUniformCoordinates(petsclib::PetscLibType,sw::PetscDM, min::Vector{PetscReal}, max::Vector{PetscReal}, npoints::Vector{PetscInt}, mode::InsertMode) +Set point coordinates in a `DMSWARM` on a regular (ijk) grid + +Collective + +Input Parameters: +- `sw` - the `DMSWARM` +- `min` - minimum coordinate values in the x, y, z directions (array of length dim) +- `max` - maximum coordinate values in the x, y, z directions (array of length dim) +- `npoints` - number of points in each spatial direction (array of length dim) +- `mode` - indicates whether to append points to the swarm (`ADD_VALUES`), or over-ride existing points (`INSERT_VALUES`) + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmSetType()`, `DMSwarmSetCellDM()`, `DMSwarmType` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetPointsUniformCoordinates")) +""" +function DMSwarmSetPointsUniformCoordinates(petsclib::PetscLibType, sw::PetscDM, min::Vector{PetscReal}, max::Vector{PetscReal}, npoints::Vector{PetscInt}, mode::InsertMode) end + +@for_petsc function DMSwarmSetPointsUniformCoordinates(petsclib::$UnionPetscLib, sw::PetscDM, min::Vector{$PetscReal}, max::Vector{$PetscReal}, npoints::Vector{$PetscInt}, mode::InsertMode ) + + @chk ccall( + (:DMSwarmSetPointsUniformCoordinates, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscInt}, InsertMode), + sw, min, max, npoints, mode, + ) + + + return nothing +end + +""" + DMSwarmSetPointCoordinates(petsclib::PetscLibType,sw::PetscDM, npoints::PetscInt, coor::Vector{PetscReal}, redundant::PetscBool, mode::InsertMode) +Set point coordinates in a `DMSWARM` from a user defined list + +Collective + +Input Parameters: +- `sw` - the `DMSWARM` +- `npoints` - the number of points to insert +- `coor` - the coordinate values +- `redundant` - if set to `PETSC_TRUE`, it is assumed that `npoints` and `coor` are only valid on rank 0 and should be broadcast to other ranks +- `mode` - indicates whether to append points to the swarm (`ADD_VALUES`), or over-ride existing points (`INSERT_VALUES`) + +Level: beginner + +-seealso: `DMSWARM`, `DMSwarmSetType()`, `DMSwarmSetCellDM()`, `DMSwarmType`, `DMSwarmSetPointsUniformCoordinates()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetPointCoordinates")) +""" +function DMSwarmSetPointCoordinates(petsclib::PetscLibType, sw::PetscDM, npoints::PetscInt, coor::Vector{PetscReal}, redundant::PetscBool, mode::InsertMode) end + +@for_petsc function DMSwarmSetPointCoordinates(petsclib::$UnionPetscLib, sw::PetscDM, npoints::$PetscInt, coor::Vector{$PetscReal}, redundant::PetscBool, mode::InsertMode ) + + @chk ccall( + (:DMSwarmSetPointCoordinates, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscReal}, PetscBool, InsertMode), + sw, npoints, coor, redundant, mode, + ) + + + return nothing +end + +""" + DMSwarmInsertPointsUsingCellDM(petsclib::PetscLibType,dm::PetscDM, layout_type::DMSwarmPICLayoutType, fill_param::PetscInt) +Insert point coordinates within each cell + +Not Collective + +Input Parameters: +- `dm` - the `DMSWARM` +- `layout_type` - method used to fill each cell with the cell `DM` +- `fill_param` - parameter controlling how many points per cell are added (the meaning of this parameter is dependent on the layout type) + +Level: beginner + +-seealso: `DMSWARM`, `DMSwarmPICLayoutType`, `DMSwarmSetType()`, `DMSwarmSetCellDM()`, `DMSwarmType` + +# External Links +$(_doc_external("DMSwarm/DMSwarmInsertPointsUsingCellDM")) +""" +function DMSwarmInsertPointsUsingCellDM(petsclib::PetscLibType, dm::PetscDM, layout_type::DMSwarmPICLayoutType, fill_param::PetscInt) end + +@for_petsc function DMSwarmInsertPointsUsingCellDM(petsclib::$UnionPetscLib, dm::PetscDM, layout_type::DMSwarmPICLayoutType, fill_param::$PetscInt ) + + @chk ccall( + (:DMSwarmInsertPointsUsingCellDM, $petsc_library), + PetscErrorCode, + (CDM, DMSwarmPICLayoutType, $PetscInt), + dm, layout_type, fill_param, + ) + + + return nothing +end + +""" + DMSwarmSetPointCoordinatesCellwise(petsclib::PetscLibType,dm::PetscDM, npoints::PetscInt, xi::Vector{PetscReal}) +Insert point coordinates (defined over the reference cell) within each cell + +Not Collective + +Input Parameters: +- `dm` - the `DMSWARM` +- `npoints` - the number of points to insert in each cell +- `xi` - the coordinates (defined in the local coordinate system for each cell) to insert + +Level: beginner + +-seealso: `DMSWARM`, `DMSwarmSetCellDM()`, `DMSwarmInsertPointsUsingCellDM()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetPointCoordinatesCellwise")) +""" +function DMSwarmSetPointCoordinatesCellwise(petsclib::PetscLibType, dm::PetscDM, npoints::PetscInt, xi::Vector{PetscReal}) end + +@for_petsc function DMSwarmSetPointCoordinatesCellwise(petsclib::$UnionPetscLib, dm::PetscDM, npoints::$PetscInt, xi::Vector{$PetscReal} ) + + @chk ccall( + (:DMSwarmSetPointCoordinatesCellwise, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscReal}), + dm, npoints, xi, + ) + + + return nothing +end + +""" + ncells::PetscInt,count::PetscInt = DMSwarmCreatePointPerCellCount(petsclib::PetscLibType,sw::PetscDM) +Count the number of points within all cells in the cell DM + +Not Collective + +Input Parameter: +- `sw` - the `DMSWARM` + +Output Parameters: +- `ncells` - the number of cells in the cell `DM` (optional argument, pass `NULL` to ignore) +- `count` - array of length ncells containing the number of points per cell + +Level: beginner + +-seealso: `DMSWARM`, `DMSwarmSetType()`, `DMSwarmSetCellDM()`, `DMSwarmType` + +# External Links +$(_doc_external("DMSwarm/DMSwarmCreatePointPerCellCount")) +""" +function DMSwarmCreatePointPerCellCount(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmCreatePointPerCellCount(petsclib::$UnionPetscLib, sw::PetscDM ) + ncells_ = Ref{$PetscInt}() + count_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmCreatePointPerCellCount, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, $PetscInt), + sw, ncells_, count_, + ) + + ncells = ncells_[] + count = count_[] + + return ncells,count +end + +""" + Ns::PetscInt = DMSwarmGetNumSpecies(petsclib::PetscLibType,sw::PetscDM) +Get the number of particle species + +Not Collective + +Input Parameter: +- `sw` - the `DMSWARM` + +Output Parameters: +- `Ns` - the number of species + +Level: intermediate + +-seealso: `DMSWARM`, `DMSwarmSetNumSpecies()`, `DMSwarmSetType()`, `DMSwarmType` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetNumSpecies")) +""" +function DMSwarmGetNumSpecies(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmGetNumSpecies(petsclib::$UnionPetscLib, sw::PetscDM ) + Ns_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmGetNumSpecies, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + sw, Ns_, + ) + + Ns = Ns_[] + + return Ns +end + +""" + DMSwarmSetNumSpecies(petsclib::PetscLibType,sw::PetscDM, Ns::PetscInt) +Set the number of particle species + +Not Collective + +Input Parameters: +- `sw` - the `DMSWARM` +- `Ns` - the number of species + +Level: intermediate + +-seealso: `DMSWARM`, `DMSwarmGetNumSpecies()`, `DMSwarmSetType()`, `DMSwarmType` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetNumSpecies")) +""" +function DMSwarmSetNumSpecies(petsclib::PetscLibType, sw::PetscDM, Ns::PetscInt) end + +@for_petsc function DMSwarmSetNumSpecies(petsclib::$UnionPetscLib, sw::PetscDM, Ns::$PetscInt ) + + @chk ccall( + (:DMSwarmSetNumSpecies, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + sw, Ns, + ) + + + return nothing +end + +""" + DMSwarmGetCoordinateFunction(petsclib::PetscLibType,sw::PetscDM, coordFunc::PetscSimplePoCintFn) +Get the function setting initial particle positions, if it exists + +Not Collective + +Input Parameter: +- `sw` - the `DMSWARM` + +Output Parameter: +- `coordFunc` - the function setting initial particle positions, or `NULL`, see `PetscSimplePointFn` for the calling sequence + +Level: intermediate + +-seealso: `DMSWARM`, `DMSwarmSetCoordinateFunction()`, `DMSwarmGetVelocityFunction()`, `DMSwarmInitializeCoordinates()`, `PetscSimplePointFn` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetCoordinateFunction")) +""" +function DMSwarmGetCoordinateFunction(petsclib::PetscLibType, sw::PetscDM, coordFunc::PetscSimplePoCintFn) end + +@for_petsc function DMSwarmGetCoordinateFunction(petsclib::$UnionPetscLib, sw::PetscDM, coordFunc::PetscSimplePoCintFn ) + + @chk ccall( + (:DMSwarmGetCoordinateFunction, $petsc_library), + PetscErrorCode, + (CDM, PetscSimplePoCintFn), + sw, coordFunc, + ) + + + return nothing +end + +""" + DMSwarmSetCoordinateFunction(petsclib::PetscLibType,sw::PetscDM, coordFunc::PetscSimplePoCintFn) +Set the function setting initial particle positions + +Not Collective + +Input Parameters: +- `sw` - the `DMSWARM` +- `coordFunc` - the function setting initial particle positions, see `PetscSimplePointFn` for the calling sequence + +Level: intermediate + +-seealso: `DMSWARM`, `DMSwarmGetCoordinateFunction()`, `DMSwarmSetVelocityFunction()`, `DMSwarmInitializeCoordinates()`, `PetscSimplePointFn` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetCoordinateFunction")) +""" +function DMSwarmSetCoordinateFunction(petsclib::PetscLibType, sw::PetscDM, coordFunc::PetscSimplePoCintFn) end + +@for_petsc function DMSwarmSetCoordinateFunction(petsclib::$UnionPetscLib, sw::PetscDM, coordFunc::PetscSimplePoCintFn ) + + @chk ccall( + (:DMSwarmSetCoordinateFunction, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSimplePoCintFn}), + sw, coordFunc, + ) + + + return nothing +end + +""" + DMSwarmGetVelocityFunction(petsclib::PetscLibType,sw::PetscDM, velFunc::PetscSimplePoCintFn) +Get the function setting initial particle velocities, if it exists + +Not Collective + +Input Parameter: +- `sw` - the `DMSWARM` + +Output Parameter: +- `velFunc` - the function setting initial particle velocities, or `NULL`, see `PetscSimplePointFn` for the calling sequence + +Level: intermediate + +-seealso: `DMSWARM`, `DMSwarmSetVelocityFunction()`, `DMSwarmGetCoordinateFunction()`, `DMSwarmInitializeVelocities()`, `PetscSimplePointFn` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetVelocityFunction")) +""" +function DMSwarmGetVelocityFunction(petsclib::PetscLibType, sw::PetscDM, velFunc::PetscSimplePoCintFn) end + +@for_petsc function DMSwarmGetVelocityFunction(petsclib::$UnionPetscLib, sw::PetscDM, velFunc::PetscSimplePoCintFn ) + + @chk ccall( + (:DMSwarmGetVelocityFunction, $petsc_library), + PetscErrorCode, + (CDM, PetscSimplePoCintFn), + sw, velFunc, + ) + + + return nothing +end + +""" + DMSwarmSetVelocityFunction(petsclib::PetscLibType,sw::PetscDM, velFunc::PetscSimplePoCintFn) +Set the function setting initial particle velocities + +Not Collective + +Input Parameters: +- `sw` - the `DMSWARM` +- `velFunc` - the function setting initial particle velocities, see `PetscSimplePointFn` for the calling sequence + +Level: intermediate + +-seealso: `DMSWARM`, `DMSwarmGetVelocityFunction()`, `DMSwarmSetCoordinateFunction()`, `DMSwarmInitializeVelocities()`, `PetscSimplePointFn` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetVelocityFunction")) +""" +function DMSwarmSetVelocityFunction(petsclib::PetscLibType, sw::PetscDM, velFunc::PetscSimplePoCintFn) end + +@for_petsc function DMSwarmSetVelocityFunction(petsclib::$UnionPetscLib, sw::PetscDM, velFunc::PetscSimplePoCintFn ) + + @chk ccall( + (:DMSwarmSetVelocityFunction, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSimplePoCintFn}), + sw, velFunc, + ) + + + return nothing +end + +""" + DMSwarmComputeLocalSize(petsclib::PetscLibType,sw::PetscDM, N::PetscInt, density::PetscProbFn) +Compute the local number and distribution of particles based upon a density function + +Not Collective + +Input Parameters: +- `sw` - The `DMSWARM` +- `N` - The target number of particles +- `density` - The density field for the particle layout, normalized to unity + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmComputeLocalSizeFromOptions()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmComputeLocalSize")) +""" +function DMSwarmComputeLocalSize(petsclib::PetscLibType, sw::PetscDM, N::PetscInt, density::PetscProbFn) end + +@for_petsc function DMSwarmComputeLocalSize(petsclib::$UnionPetscLib, sw::PetscDM, N::$PetscInt, density::PetscProbFn ) + + @chk ccall( + (:DMSwarmComputeLocalSize, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscProbFn}), + sw, N, density, + ) + + + return nothing +end + +""" + DMSwarmComputeLocalSizeFromOptions(petsclib::PetscLibType,sw::PetscDM) +Compute the local number and distribution of particles based upon a density function determined by options + +Not Collective + +Input Parameter: +- `sw` - The `DMSWARM` + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmComputeLocalSize()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmComputeLocalSizeFromOptions")) +""" +function DMSwarmComputeLocalSizeFromOptions(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmComputeLocalSizeFromOptions(petsclib::$UnionPetscLib, sw::PetscDM ) + + @chk ccall( + (:DMSwarmComputeLocalSizeFromOptions, $petsc_library), + PetscErrorCode, + (CDM,), + sw, + ) + + + return nothing +end + +""" + DMSwarmInitializeCoordinates(petsclib::PetscLibType,sw::PetscDM) +Determine the initial coordinates of particles for a PIC method + +Not Collective + +Input Parameter: +- `sw` - The `DMSWARM` + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmComputeLocalSize()`, `DMSwarmInitializeVelocities()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmInitializeCoordinates")) +""" +function DMSwarmInitializeCoordinates(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmInitializeCoordinates(petsclib::$UnionPetscLib, sw::PetscDM ) + + @chk ccall( + (:DMSwarmInitializeCoordinates, $petsc_library), + PetscErrorCode, + (CDM,), + sw, + ) + + + return nothing +end + +""" + DMSwarmInitializeVelocities(petsclib::PetscLibType,sw::PetscDM, sampler::PetscProbFn, v0::Vector{PetscReal}) +Set the initial velocities of particles using a distribution. + +Collective + +Input Parameters: +- `sw` - The `DMSWARM` object +- `sampler` - A function which uniformly samples the velocity PDF +- `v0` - The velocity scale for nondimensionalization for each species + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmComputeLocalSize()`, `DMSwarmInitializeCoordinates()`, `DMSwarmInitializeVelocitiesFromOptions()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmInitializeVelocities")) +""" +function DMSwarmInitializeVelocities(petsclib::PetscLibType, sw::PetscDM, sampler::PetscProbFn, v0::Vector{PetscReal}) end + +@for_petsc function DMSwarmInitializeVelocities(petsclib::$UnionPetscLib, sw::PetscDM, sampler::PetscProbFn, v0::Vector{$PetscReal} ) + + @chk ccall( + (:DMSwarmInitializeVelocities, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscProbFn}, Ptr{$PetscReal}), + sw, sampler, v0, + ) + + + return nothing +end + +""" + DMSwarmInitializeVelocitiesFromOptions(petsclib::PetscLibType,sw::PetscDM, v0::Vector{PetscReal}) +Set the initial velocities of particles using a distribution determined from options. + +Collective + +Input Parameters: +- `sw` - The `DMSWARM` object +- `v0` - The velocity scale for nondimensionalization for each species + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmComputeLocalSize()`, `DMSwarmInitializeCoordinates()`, `DMSwarmInitializeVelocities()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmInitializeVelocitiesFromOptions")) +""" +function DMSwarmInitializeVelocitiesFromOptions(petsclib::PetscLibType, sw::PetscDM, v0::Vector{PetscReal}) end + +@for_petsc function DMSwarmInitializeVelocitiesFromOptions(petsclib::$UnionPetscLib, sw::PetscDM, v0::Vector{$PetscReal} ) + + @chk ccall( + (:DMSwarmInitializeVelocitiesFromOptions, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + sw, v0, + ) + + + return nothing +end + +""" + mtype::DMSwarmMigrateType = DMSwarmGetMigrateType(petsclib::PetscLibType,dm::PetscDM) +Get the style of point migration + +Logically Collective + +Input Parameter: +- `dm` - the `DMSWARM` + +Output Parameter: +- `mtype` - The migration type, see `DMSwarmMigrateType` + +Level: intermediate + +-seealso: `DM`, `DMSWARM`, `DMSwarmMigrateType`, `DMSwarmMigrate()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetMigrateType")) +""" +function DMSwarmGetMigrateType(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSwarmGetMigrateType(petsclib::$UnionPetscLib, dm::PetscDM ) + mtype_ = Ref{DMSwarmMigrateType}() + + @chk ccall( + (:DMSwarmGetMigrateType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMSwarmMigrateType}), + dm, mtype_, + ) + + mtype = mtype_[] + + return mtype +end + +""" + DMSwarmSetMigrateType(petsclib::PetscLibType,dm::PetscDM, mtype::DMSwarmMigrateType) +Set the style of point migration + +Logically Collective + +Input Parameters: +- `dm` - the `DMSWARM` +- `mtype` - The migration type, see `DMSwarmMigrateType` + +Level: intermediate + +-seealso: `DM`, `DMSWARM`, `DMSwarmMigrateType`, `DMSwarmGetMigrateType()`, `DMSwarmMigrate()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetMigrateType")) +""" +function DMSwarmSetMigrateType(petsclib::PetscLibType, dm::PetscDM, mtype::DMSwarmMigrateType) end + +@for_petsc function DMSwarmSetMigrateType(petsclib::$UnionPetscLib, dm::PetscDM, mtype::DMSwarmMigrateType ) + + @chk ccall( + (:DMSwarmSetMigrateType, $petsc_library), + PetscErrorCode, + (CDM, DMSwarmMigrateType), + dm, mtype, + ) + + + return nothing +end + +""" + DMSwarmViewFieldsXDMF(petsclib::PetscLibType,dm::PetscDM, filename::String, nfields::PetscInt, field_name_list::String) +Write a selection of DMSwarm fields to an XDMF3 file + +Collective + +Input Parameters: +- `dm` - the `DMSWARM` +- `filename` - the file name of the XDMF file (must have the extension .xmf) +- `nfields` - the number of fields to write into the XDMF file +- `field_name_list` - array of length nfields containing the textual name of fields to write + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmViewXDMF()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmViewFieldsXDMF")) +""" +function DMSwarmViewFieldsXDMF(petsclib::PetscLibType, dm::PetscDM, filename::String, nfields::PetscInt, field_name_list::String) end + +@for_petsc function DMSwarmViewFieldsXDMF(petsclib::$UnionPetscLib, dm::PetscDM, filename::String, nfields::$PetscInt, field_name_list::String ) + field_name_list_ = Ref(pointer(field_name_list)) + + @chk ccall( + (:DMSwarmViewFieldsXDMF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscInt, Ptr{Ptr{Cchar}}), + dm, filename, nfields, field_name_list_, + ) + + + return nothing +end + +""" + DMSwarmViewXDMF(petsclib::PetscLibType,dm::PetscDM, filename::String) +Write `DMSWARM` fields to an XDMF3 file + +Collective + +Input Parameters: +- `dm` - the `DMSWARM` +- `filename` - the file name of the XDMF file (must have the extension .xmf) + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmViewFieldsXDMF()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmViewXDMF")) +""" +function DMSwarmViewXDMF(petsclib::PetscLibType, dm::PetscDM, filename::String) end + +@for_petsc function DMSwarmViewXDMF(petsclib::$UnionPetscLib, dm::PetscDM, filename::String ) + + @chk ccall( + (:DMSwarmViewXDMF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + dm, filename, + ) + + + return nothing +end + +""" + Nf::PetscInt = DMSwarmVectorGetField(petsclib::PetscLibType,sw::PetscDM, fieldnames::String) +Gets the fields from which to define a `Vec` object +when `DMCreateLocalVector()`, or `DMCreateGlobalVector()` is called + +Not collective + +Input Parameter: +- `sw` - a `DMSWARM` + +Output Parameters: +- `Nf` - the number of fields +- `fieldnames` - the textual name given to each registered field, or NULL if it has not been set + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmVectorDefineField()`, `DMSwarmRegisterPetscDatatypeField()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmVectorGetField")) +""" +function DMSwarmVectorGetField(petsclib::PetscLibType, sw::PetscDM, fieldnames::String) end + +@for_petsc function DMSwarmVectorGetField(petsclib::$UnionPetscLib, sw::PetscDM, fieldnames::String ) + Nf_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmVectorGetField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{Cchar}), + sw, Nf_, fieldnames, + ) + + Nf = Nf_[] + + return Nf +end + +""" + DMSwarmVectorDefineField(petsclib::PetscLibType,dm::PetscDM, fieldname::String) +Sets the field from which to define a `Vec` object +when `DMCreateLocalVector()`, or `DMCreateGlobalVector()` is called + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `fieldname` - the textual name given to each registered field + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmVectorDefineFields()`, `DMSwarmVectorGetField()`, `DMSwarmRegisterPetscDatatypeField()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmVectorDefineField")) +""" +function DMSwarmVectorDefineField(petsclib::PetscLibType, dm::PetscDM, fieldname::String) end + +@for_petsc function DMSwarmVectorDefineField(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String ) + + @chk ccall( + (:DMSwarmVectorDefineField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + dm, fieldname, + ) + + + return nothing +end + +""" + DMSwarmVectorDefineFields(petsclib::PetscLibType,sw::PetscDM, Nf::PetscInt, fieldnames::String) +Sets the fields from which to define a `Vec` object +when `DMCreateLocalVector()`, or `DMCreateGlobalVector()` is called + +Collective, No Fortran support + +Input Parameters: +- `sw` - a `DMSWARM` +- `Nf` - the number of fields +- `fieldnames` - the textual name given to each registered field + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmVectorDefineField()`, `DMSwarmVectorGetField()`, `DMSwarmRegisterPetscDatatypeField()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmVectorDefineFields")) +""" +function DMSwarmVectorDefineFields(petsclib::PetscLibType, sw::PetscDM, Nf::PetscInt, fieldnames::String) end + +@for_petsc function DMSwarmVectorDefineFields(petsclib::$UnionPetscLib, sw::PetscDM, Nf::$PetscInt, fieldnames::String ) + fieldnames_ = Ref(pointer(fieldnames)) + + @chk ccall( + (:DMSwarmVectorDefineFields, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}), + sw, Nf, fieldnames_, + ) + + + return nothing +end + +""" + mass::PetscMat = DMSwarmCreateMassMatrixSquare(petsclib::PetscLibType,dmCoarse::PetscDM, dmFine::PetscDM) +Creates the block + +Collective + +Input Parameters: +- `dmCoarse` - a `DMSWARM` +- `dmFine` - a `DMPLEX` + +Output Parameter: +- `mass` - the square of the particle mass matrix + +Level: advanced + +-seealso: `DM`, `DMSWARM`, `DMCreateMassMatrix()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmCreateMassMatrixSquare")) +""" +function DMSwarmCreateMassMatrixSquare(petsclib::PetscLibType, dmCoarse::PetscDM, dmFine::PetscDM) end + +@for_petsc function DMSwarmCreateMassMatrixSquare(petsclib::$UnionPetscLib, dmCoarse::PetscDM, dmFine::PetscDM ) + mass_ = Ref{CMat}() + + @chk ccall( + (:DMSwarmCreateMassMatrixSquare, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{CMat}), + dmCoarse, dmFine, mass_, + ) + + mass = PetscMat(mass_[], petsclib) + + return mass +end + +""" + vec::PetscVec = DMSwarmCreateGlobalVectorFromField(petsclib::PetscLibType,dm::PetscDM, fieldname::String) +Creates a `Vec` object sharing the array associated with a given field + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `fieldname` - the textual name given to a registered field + +Output Parameter: +- `vec` - the vector + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmDestroyGlobalVectorFromField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmCreateGlobalVectorFromField")) +""" +function DMSwarmCreateGlobalVectorFromField(petsclib::PetscLibType, dm::PetscDM, fieldname::String) end + +@for_petsc function DMSwarmCreateGlobalVectorFromField(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String ) + vec_ = Ref{CVec}() + + @chk ccall( + (:DMSwarmCreateGlobalVectorFromField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{CVec}), + dm, fieldname, vec_, + ) + + vec = PetscVec(vec_[], petsclib) + + return vec +end + +""" + DMSwarmDestroyGlobalVectorFromField(petsclib::PetscLibType,dm::PetscDM, fieldname::String, vec::PetscVec) +Destroys the `Vec` object which share the array associated with a given field + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `fieldname` - the textual name given to a registered field + +Output Parameter: +- `vec` - the vector + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmCreateGlobalVectorFromField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmDestroyGlobalVectorFromField")) +""" +function DMSwarmDestroyGlobalVectorFromField(petsclib::PetscLibType, dm::PetscDM, fieldname::String, vec::PetscVec) end + +@for_petsc function DMSwarmDestroyGlobalVectorFromField(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String, vec::PetscVec ) + vec_ = Ref(vec.ptr) + + @chk ccall( + (:DMSwarmDestroyGlobalVectorFromField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{CVec}), + dm, fieldname, vec_, + ) + + vec.ptr = vec_[] + + return nothing +end + +""" + vec::PetscVec = DMSwarmCreateLocalVectorFromField(petsclib::PetscLibType,dm::PetscDM, fieldname::String) +Creates a `Vec` object sharing the array associated with a given field + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `fieldname` - the textual name given to a registered field + +Output Parameter: +- `vec` - the vector + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmDestroyLocalVectorFromField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmCreateLocalVectorFromField")) +""" +function DMSwarmCreateLocalVectorFromField(petsclib::PetscLibType, dm::PetscDM, fieldname::String) end + +@for_petsc function DMSwarmCreateLocalVectorFromField(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String ) + vec_ = Ref{CVec}() + + @chk ccall( + (:DMSwarmCreateLocalVectorFromField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{CVec}), + dm, fieldname, vec_, + ) + + vec = PetscVec(vec_[], petsclib) + + return vec +end + +""" + DMSwarmDestroyLocalVectorFromField(petsclib::PetscLibType,dm::PetscDM, fieldname::String, vec::PetscVec) +Destroys the `Vec` object which share the array associated with a given field + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `fieldname` - the textual name given to a registered field + +Output Parameter: +- `vec` - the vector + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmCreateLocalVectorFromField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmDestroyLocalVectorFromField")) +""" +function DMSwarmDestroyLocalVectorFromField(petsclib::PetscLibType, dm::PetscDM, fieldname::String, vec::PetscVec) end + +@for_petsc function DMSwarmDestroyLocalVectorFromField(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String, vec::PetscVec ) + vec_ = Ref(vec.ptr) + + @chk ccall( + (:DMSwarmDestroyLocalVectorFromField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{CVec}), + dm, fieldname, vec_, + ) + + vec.ptr = vec_[] + + return nothing +end + +""" + vec::PetscVec = DMSwarmCreateGlobalVectorFromFields(petsclib::PetscLibType,dm::PetscDM, Nf::PetscInt, fieldnames::String) +Creates a `Vec` object sharing the array associated with a given field set + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `Nf` - the number of fields +- `fieldnames` - the textual names given to the registered fields + +Output Parameter: +- `vec` - the vector + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmDestroyGlobalVectorFromFields()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmCreateGlobalVectorFromFields")) +""" +function DMSwarmCreateGlobalVectorFromFields(petsclib::PetscLibType, dm::PetscDM, Nf::PetscInt, fieldnames::String) end + +@for_petsc function DMSwarmCreateGlobalVectorFromFields(petsclib::$UnionPetscLib, dm::PetscDM, Nf::$PetscInt, fieldnames::String ) + fieldnames_ = Ref(pointer(fieldnames)) + vec_ = Ref{CVec}() + + @chk ccall( + (:DMSwarmCreateGlobalVectorFromFields, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}, Ptr{CVec}), + dm, Nf, fieldnames_, vec_, + ) + + vec = PetscVec(vec_[], petsclib) + + return vec +end + +""" + DMSwarmDestroyGlobalVectorFromFields(petsclib::PetscLibType,dm::PetscDM, Nf::PetscInt, fieldnames::String, vec::PetscVec) +Destroys the `Vec` object which share the array associated with a given field set + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `Nf` - the number of fields +- `fieldnames` - the textual names given to the registered fields + +Output Parameter: +- `vec` - the vector + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmCreateGlobalVectorFromField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmDestroyGlobalVectorFromFields")) +""" +function DMSwarmDestroyGlobalVectorFromFields(petsclib::PetscLibType, dm::PetscDM, Nf::PetscInt, fieldnames::String, vec::PetscVec) end + +@for_petsc function DMSwarmDestroyGlobalVectorFromFields(petsclib::$UnionPetscLib, dm::PetscDM, Nf::$PetscInt, fieldnames::String, vec::PetscVec ) + fieldnames_ = Ref(pointer(fieldnames)) + vec_ = Ref(vec.ptr) + + @chk ccall( + (:DMSwarmDestroyGlobalVectorFromFields, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}, Ptr{CVec}), + dm, Nf, fieldnames_, vec_, + ) + + vec.ptr = vec_[] + + return nothing +end + +""" + vec::PetscVec = DMSwarmCreateLocalVectorFromFields(petsclib::PetscLibType,dm::PetscDM, Nf::PetscInt, fieldnames::String) +Creates a `Vec` object sharing the array associated with a given field set + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `Nf` - the number of fields +- `fieldnames` - the textual names given to the registered fields + +Output Parameter: +- `vec` - the vector + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmDestroyLocalVectorFromField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmCreateLocalVectorFromFields")) +""" +function DMSwarmCreateLocalVectorFromFields(petsclib::PetscLibType, dm::PetscDM, Nf::PetscInt, fieldnames::String) end + +@for_petsc function DMSwarmCreateLocalVectorFromFields(petsclib::$UnionPetscLib, dm::PetscDM, Nf::$PetscInt, fieldnames::String ) + fieldnames_ = Ref(pointer(fieldnames)) + vec_ = Ref{CVec}() + + @chk ccall( + (:DMSwarmCreateLocalVectorFromFields, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}, Ptr{CVec}), + dm, Nf, fieldnames_, vec_, + ) + + vec = PetscVec(vec_[], petsclib) + + return vec +end + +""" + DMSwarmDestroyLocalVectorFromFields(petsclib::PetscLibType,dm::PetscDM, Nf::PetscInt, fieldnames::String, vec::PetscVec) +Destroys the `Vec` object which share the array associated with a given field set + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `Nf` - the number of fields +- `fieldnames` - the textual names given to the registered fields + +Output Parameter: +- `vec` - the vector + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmCreateLocalVectorFromFields()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmDestroyLocalVectorFromFields")) +""" +function DMSwarmDestroyLocalVectorFromFields(petsclib::PetscLibType, dm::PetscDM, Nf::PetscInt, fieldnames::String, vec::PetscVec) end + +@for_petsc function DMSwarmDestroyLocalVectorFromFields(petsclib::$UnionPetscLib, dm::PetscDM, Nf::$PetscInt, fieldnames::String, vec::PetscVec ) + fieldnames_ = Ref(pointer(fieldnames)) + vec_ = Ref(vec.ptr) + + @chk ccall( + (:DMSwarmDestroyLocalVectorFromFields, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}, Ptr{CVec}), + dm, Nf, fieldnames_, vec_, + ) + + vec.ptr = vec_[] + + return nothing +end + +""" + DMSwarmInitializeFieldRegister(petsclib::PetscLibType,dm::PetscDM) +Initiates the registration of fields to a `DMSWARM` + +Collective + +Input Parameter: +- `dm` - a `DMSWARM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmFinalizeFieldRegister()`, `DMSwarmRegisterPetscDatatypeField()`, +`DMSwarmRegisterUserStructField()`, `DMSwarmRegisterUserDatatypeField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmInitializeFieldRegister")) +""" +function DMSwarmInitializeFieldRegister(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSwarmInitializeFieldRegister(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMSwarmInitializeFieldRegister, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMSwarmFinalizeFieldRegister(petsclib::PetscLibType,dm::PetscDM) +Finalizes the registration of fields to a `DMSWARM` + +Collective + +Input Parameter: +- `dm` - a `DMSWARM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmInitializeFieldRegister()`, `DMSwarmRegisterPetscDatatypeField()`, +`DMSwarmRegisterUserStructField()`, `DMSwarmRegisterUserDatatypeField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmFinalizeFieldRegister")) +""" +function DMSwarmFinalizeFieldRegister(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSwarmFinalizeFieldRegister(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMSwarmFinalizeFieldRegister, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMSwarmSetLocalSizes(petsclib::PetscLibType,sw::PetscDM, nloc::PetscInt, buffer::PetscInt) +Sets the length of all registered fields on the `DMSWARM` + +Not Collective + +Input Parameters: +- `sw` - a `DMSWARM` +- `nlocal` - the length of each registered field +- `buffer` - the length of the buffer used to efficient dynamic re-sizing + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmGetLocalSize()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetLocalSizes")) +""" +function DMSwarmSetLocalSizes(petsclib::PetscLibType, sw::PetscDM, nloc::PetscInt, buffer::PetscInt) end + +@for_petsc function DMSwarmSetLocalSizes(petsclib::$UnionPetscLib, sw::PetscDM, nloc::$PetscInt, buffer::$PetscInt ) + + @chk ccall( + (:DMSwarmSetLocalSizes, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt), + sw, nloc, buffer, + ) + + + return nothing +end + +""" + DMSwarmSetCellDM(petsclib::PetscLibType,sw::PetscDM, dm::PetscDM) +Attaches a `DM` to a `DMSWARM` + +Collective + +Input Parameters: +- `sw` - a `DMSWARM` +- `dm` - the `DM` to attach to the `DMSWARM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmSetType()`, `DMSwarmGetCellDM()`, `DMSwarmMigrate()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetCellDM")) +""" +function DMSwarmSetCellDM(petsclib::PetscLibType, sw::PetscDM, dm::PetscDM) end + +@for_petsc function DMSwarmSetCellDM(petsclib::$UnionPetscLib, sw::PetscDM, dm::PetscDM ) + + @chk ccall( + (:DMSwarmSetCellDM, $petsc_library), + PetscErrorCode, + (CDM, CDM), + sw, dm, + ) + + + return nothing +end + +""" + DMSwarmGetCellDM(petsclib::PetscLibType,sw::PetscDM, dm::PetscDM) +Fetches the active cell `DM` + +Collective + +Input Parameter: +- `sw` - a `DMSWARM` + +Output Parameter: +- `dm` - the active `DM` for the `DMSWARM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmSetCellDM()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetCellDM")) +""" +function DMSwarmGetCellDM(petsclib::PetscLibType, sw::PetscDM, dm::PetscDM) end + +@for_petsc function DMSwarmGetCellDM(petsclib::$UnionPetscLib, sw::PetscDM, dm::PetscDM ) + dm_ = Ref(dm.ptr) + + @chk ccall( + (:DMSwarmGetCellDM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + sw, dm_, + ) + + dm.ptr = dm_[] + + return nothing +end + +""" + Ndm::PetscInt = DMSwarmGetCellDMNames(petsclib::PetscLibType,sw::PetscDM, celldms::String) +Get the list of cell `DM` names + +Not collective + +Input Parameter: +- `sw` - a `DMSWARM` + +Output Parameters: +- `Ndm` - the number of `DMSwarmCellDM` in the `DMSWARM` +- `celldms` - the name of each `DMSwarmCellDM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmSetCellDM()`, `DMSwarmGetCellDMByName()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetCellDMNames")) +""" +function DMSwarmGetCellDMNames(petsclib::PetscLibType, sw::PetscDM, celldms::String) end + +@for_petsc function DMSwarmGetCellDMNames(petsclib::$UnionPetscLib, sw::PetscDM, celldms::String ) + Ndm_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmGetCellDMNames, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{Cchar}), + sw, Ndm_, celldms, + ) + + Ndm = Ndm_[] + + return Ndm +end + +""" + DMSwarmSetCellDMActive(petsclib::PetscLibType,sw::PetscDM, name::String) +Activates a cell `DM` for a `DMSWARM` + +Collective + +Input Parameters: +- `sw` - a `DMSWARM` +- `name` - name of the cell `DM` to active for the `DMSWARM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmCellDM`, `DMSwarmSetType()`, `DMSwarmAddCellDM()`, `DMSwarmSetCellDM()`, `DMSwarmMigrate()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetCellDMActive")) +""" +function DMSwarmSetCellDMActive(petsclib::PetscLibType, sw::PetscDM, name::String) end + +@for_petsc function DMSwarmSetCellDMActive(petsclib::$UnionPetscLib, sw::PetscDM, name::String ) + + @chk ccall( + (:DMSwarmSetCellDMActive, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + sw, name, + ) + + + return nothing +end + +""" + DMSwarmGetCellDMActive(petsclib::PetscLibType,sw::PetscDM, celldm::DMSwarmCellDM) +Returns the active cell `DM` for a `DMSWARM` + +Collective + +Input Parameter: +- `sw` - a `DMSWARM` + +Output Parameter: +- `celldm` - the active `DMSwarmCellDM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmCellDM`, `DMSwarmSetType()`, `DMSwarmAddCellDM()`, `DMSwarmSetCellDM()`, `DMSwarmMigrate()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetCellDMActive")) +""" +function DMSwarmGetCellDMActive(petsclib::PetscLibType, sw::PetscDM, celldm::DMSwarmCellDM) end + +@for_petsc function DMSwarmGetCellDMActive(petsclib::$UnionPetscLib, sw::PetscDM, celldm::DMSwarmCellDM ) + + @chk ccall( + (:DMSwarmGetCellDMActive, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMSwarmCellDM}), + sw, celldm, + ) + + + return nothing +end + +""" + DMSwarmGetCellDMByName(petsclib::PetscLibType,sw::PetscDM, name::String, celldm::DMSwarmCellDM) +Get a `DMSwarmCellDM` from its name + +Not collective + +Input Parameters: +- `sw` - a `DMSWARM` +- `name` - the name + +Output Parameter: +- `celldm` - the `DMSwarmCellDM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmSetCellDM()`, `DMSwarmGetCellDMNames()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetCellDMByName")) +""" +function DMSwarmGetCellDMByName(petsclib::PetscLibType, sw::PetscDM, name::String, celldm::DMSwarmCellDM) end + +@for_petsc function DMSwarmGetCellDMByName(petsclib::$UnionPetscLib, sw::PetscDM, name::String, celldm::DMSwarmCellDM ) + + @chk ccall( + (:DMSwarmGetCellDMByName, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{DMSwarmCellDM}), + sw, name, celldm, + ) + + + return nothing +end + +""" + DMSwarmAddCellDM(petsclib::PetscLibType,sw::PetscDM, celldm::DMSwarmCellDM) +Adds a cell `DM` to the `DMSWARM` + +Collective + +Input Parameters: +- `sw` - a `DMSWARM` +- `celldm` - the `DMSwarmCellDM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmSetType()`, `DMSwarmPushCellDM()`, `DMSwarmSetCellDM()`, `DMSwarmMigrate()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmAddCellDM")) +""" +function DMSwarmAddCellDM(petsclib::PetscLibType, sw::PetscDM, celldm::DMSwarmCellDM) end + +@for_petsc function DMSwarmAddCellDM(petsclib::$UnionPetscLib, sw::PetscDM, celldm::DMSwarmCellDM ) + + @chk ccall( + (:DMSwarmAddCellDM, $petsc_library), + PetscErrorCode, + (CDM, DMSwarmCellDM), + sw, celldm, + ) + + + return nothing +end + +""" + nloc::PetscInt = DMSwarmGetLocalSize(petsclib::PetscLibType,dm::PetscDM) +Retrieves the local length of fields registered + +Not Collective + +Input Parameter: +- `dm` - a `DMSWARM` + +Output Parameter: +- `nlocal` - the length of each registered field + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmGetSize()`, `DMSwarmSetLocalSizes()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetLocalSize")) +""" +function DMSwarmGetLocalSize(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSwarmGetLocalSize(petsclib::$UnionPetscLib, dm::PetscDM ) + nloc_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmGetLocalSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, nloc_, + ) + + nloc = nloc_[] + + return nloc +end + +""" + n::PetscInt = DMSwarmGetSize(petsclib::PetscLibType,dm::PetscDM) +Retrieves the total length of fields registered + +Collective + +Input Parameter: +- `dm` - a `DMSWARM` + +Output Parameter: +- `n` - the total length of each registered field + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmGetLocalSize()`, `DMSwarmSetLocalSizes()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetSize")) +""" +function DMSwarmGetSize(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSwarmGetSize(petsclib::$UnionPetscLib, dm::PetscDM ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmGetSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, n_, + ) + + n = n_[] + + return n +end + +""" + DMSwarmRegisterPetscDatatypeField(petsclib::PetscLibType,dm::PetscDM, fieldname::String, blocksize::PetscInt, type::PetscDataType) +Register a field to a `DMSWARM` with a native PETSc data type + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `fieldname` - the textual name to identify this field +- `blocksize` - the number of each data type +- `type` - a valid PETSc data type (`PETSC_CHAR`, `PETSC_SHORT`, `PETSC_INT`, `PETSC_FLOAT`, `PETSC_REAL`, `PETSC_LONG`) + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterUserStructField()`, `DMSwarmRegisterUserDatatypeField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmRegisterPetscDatatypeField")) +""" +function DMSwarmRegisterPetscDatatypeField(petsclib::PetscLibType, dm::PetscDM, fieldname::String, blocksize::PetscInt, type::PetscDataType) end + +@for_petsc function DMSwarmRegisterPetscDatatypeField(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String, blocksize::$PetscInt, type::PetscDataType ) + + @chk ccall( + (:DMSwarmRegisterPetscDatatypeField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscInt, PetscDataType), + dm, fieldname, blocksize, type, + ) + + + return nothing +end + +""" + DMSwarmRegisterUserStructField(petsclib::PetscLibType,dm::PetscDM, fieldname::String, size::Csize_t) +Register a user defined struct to a `DMSWARM` + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `fieldname` - the textual name to identify this field +- `size` - the size in bytes of the user struct of each data type + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmRegisterUserDatatypeField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmRegisterUserStructField")) +""" +function DMSwarmRegisterUserStructField(petsclib::PetscLibType, dm::PetscDM, fieldname::String, size::Csize_t) end + +@for_petsc function DMSwarmRegisterUserStructField(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String, size::Csize_t ) + + @chk ccall( + (:DMSwarmRegisterUserStructField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Csize_t), + dm, fieldname, size, + ) + + + return nothing +end + +""" + DMSwarmRegisterUserDatatypeField(petsclib::PetscLibType,dm::PetscDM, fieldname::String, size::Csize_t, blocksize::PetscInt) +Register a user defined data type to a `DMSWARM` + +Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `fieldname` - the textual name to identify this field +- `size` - the size in bytes of the user data type +- `blocksize` - the number of each data type + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmRegisterUserStructField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmRegisterUserDatatypeField")) +""" +function DMSwarmRegisterUserDatatypeField(petsclib::PetscLibType, dm::PetscDM, fieldname::String, size::Csize_t, blocksize::PetscInt) end + +@for_petsc function DMSwarmRegisterUserDatatypeField(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String, size::Csize_t, blocksize::$PetscInt ) + + @chk ccall( + (:DMSwarmRegisterUserDatatypeField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Csize_t, $PetscInt), + dm, fieldname, size, blocksize, + ) + + + return nothing +end + +""" + blocksize::PetscInt = DMSwarmGetField(petsclib::PetscLibType,dm::PetscDM, fieldname::String, type::PetscDataType, data::Cvoid) +Get access to the underlying array storing all entries associated with a registered field + +Not Collective, No Fortran Support + +Input Parameters: +- `dm` - a `DMSWARM` +- `fieldname` - the textual name to identify this field + +Output Parameters: +- `blocksize` - the number of each data type +- `type` - the data type +- `data` - pointer to raw array + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRestoreField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetField")) +""" +function DMSwarmGetField(petsclib::PetscLibType, dm::PetscDM, fieldname::String, type::Ref{PetscDataType}, data::Ptr{Ptr{Cvoid}}) end + +@for_petsc function DMSwarmGetField(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String, type::Ref{PetscDataType}, data::Ptr{Ptr{Cvoid}} ) + blocksize_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmGetField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{$PetscInt}, Ptr{PetscDataType}, Ptr{Ptr{Cvoid}}), + dm, fieldname, blocksize_, type, data, + ) + + blocksize = blocksize_[] + + return blocksize +end + +""" + blocksize::PetscInt = DMSwarmRestoreField(petsclib::PetscLibType,dm::PetscDM, fieldname::String, type::PetscDataType, data::Cvoid) +Restore access to the underlying array storing all entries associated with a registered field + +Not Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `fieldname` - the textual name to identify this field + +Output Parameters: +- `blocksize` - the number of each data type +- `type` - the data type +- `data` - pointer to raw array + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmGetField()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmRestoreField")) +""" +function DMSwarmRestoreField(petsclib::PetscLibType, dm::PetscDM, fieldname::String, type::Ref{PetscDataType}, data::Ptr{Ptr{Cvoid}}) end + +@for_petsc function DMSwarmRestoreField(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String, type::Ref{PetscDataType}, data::Ptr{Ptr{Cvoid}} ) + blocksize_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmRestoreField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{$PetscInt}, Ptr{PetscDataType}, Ptr{Ptr{Cvoid}}), + dm, fieldname, blocksize_, type, data, + ) + + blocksize = blocksize_[] + + return blocksize +end + +""" + blocksize::PetscInt = DMSwarmGetFieldInfo(petsclib::PetscLibType,dm::PetscDM, fieldname::String, type::PetscDataType) + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetFieldInfo")) +""" +function DMSwarmGetFieldInfo(petsclib::PetscLibType, dm::PetscDM, fieldname::String, type::PetscDataType) end + +@for_petsc function DMSwarmGetFieldInfo(petsclib::$UnionPetscLib, dm::PetscDM, fieldname::String, type::PetscDataType ) + blocksize_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmGetFieldInfo, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{$PetscInt}, Ptr{PetscDataType}), + dm, fieldname, blocksize_, type, + ) + + blocksize = blocksize_[] + + return blocksize +end + +""" + DMSwarmAddPoint(petsclib::PetscLibType,dm::PetscDM) +Add space for one new point in the `DMSWARM` + +Not Collective + +Input Parameter: +- `dm` - a `DMSWARM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmAddNPoints()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmAddPoint")) +""" +function DMSwarmAddPoint(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSwarmAddPoint(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMSwarmAddPoint, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMSwarmAddNPoints(petsclib::PetscLibType,dm::PetscDM, npoints::PetscInt) +Add space for a number of new points in the `DMSWARM` + +Not Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `npoints` - the number of new points to add + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmAddPoint()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmAddNPoints")) +""" +function DMSwarmAddNPoints(petsclib::PetscLibType, dm::PetscDM, npoints::PetscInt) end + +@for_petsc function DMSwarmAddNPoints(petsclib::$UnionPetscLib, dm::PetscDM, npoints::$PetscInt ) + + @chk ccall( + (:DMSwarmAddNPoints, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, npoints, + ) + + + return nothing +end + +""" + DMSwarmRemovePoint(petsclib::PetscLibType,dm::PetscDM) +Remove the last point from the `DMSWARM` + +Not Collective + +Input Parameter: +- `dm` - a `DMSWARM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRemovePointAtIndex()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmRemovePoint")) +""" +function DMSwarmRemovePoint(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSwarmRemovePoint(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMSwarmRemovePoint, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMSwarmRemovePointAtIndex(petsclib::PetscLibType,dm::PetscDM, idx::PetscInt) +Removes a specific point from the `DMSWARM` + +Not Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `idx` - index of point to remove + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRemovePoint()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmRemovePointAtIndex")) +""" +function DMSwarmRemovePointAtIndex(petsclib::PetscLibType, dm::PetscDM, idx::PetscInt) end + +@for_petsc function DMSwarmRemovePointAtIndex(petsclib::$UnionPetscLib, dm::PetscDM, idx::$PetscInt ) + + @chk ccall( + (:DMSwarmRemovePointAtIndex, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, idx, + ) + + + return nothing +end + +""" + DMSwarmCopyPoint(petsclib::PetscLibType,dm::PetscDM, pi::PetscInt, pj::PetscInt) +Copy point pj to point pi in the `DMSWARM` + +Not Collective + +Input Parameters: +- `dm` - a `DMSWARM` +- `pi` - the index of the point to copy +- `pj` - the point index where the copy should be located + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRemovePoint()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmCopyPoint")) +""" +function DMSwarmCopyPoint(petsclib::PetscLibType, dm::PetscDM, pi::PetscInt, pj::PetscInt) end + +@for_petsc function DMSwarmCopyPoint(petsclib::$UnionPetscLib, dm::PetscDM, pi::$PetscInt, pj::$PetscInt ) + + @chk ccall( + (:DMSwarmCopyPoint, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt), + dm, pi, pj, + ) + + + return nothing +end + +""" + DMSwarmMigrate(petsclib::PetscLibType,dm::PetscDM, remove_sent_points::PetscBool) +Relocates points defined in the `DMSWARM` to other MPI + +Collective + +Input Parameters: +- `dm` - the `DMSWARM` +- `remove_sent_points` - flag indicating if sent points should be removed from the current MPI-rank + +Level: advanced + +-seealso: `DM`, `DMSWARM`, `DMSwarmSetMigrateType()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmMigrate")) +""" +function DMSwarmMigrate(petsclib::PetscLibType, dm::PetscDM, remove_sent_points::PetscBool) end + +@for_petsc function DMSwarmMigrate(petsclib::$UnionPetscLib, dm::PetscDM, remove_sent_points::PetscBool ) + + @chk ccall( + (:DMSwarmMigrate, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, remove_sent_points, + ) + + + return nothing +end + +""" + DMSwarmCollectViewCreate(petsclib::PetscLibType,dm::PetscDM) +Applies a collection method and gathers points +in neighbour ranks into the `DMSWARM` + +Collective + +Input Parameter: +- `dm` - the `DMSWARM` + +Level: advanced + +-seealso: `DM`, `DMSWARM`, `DMSwarmCollectViewDestroy()`, `DMSwarmSetCollectType()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmCollectViewCreate")) +""" +function DMSwarmCollectViewCreate(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSwarmCollectViewCreate(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMSwarmCollectViewCreate, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMSwarmCollectViewDestroy(petsclib::PetscLibType,dm::PetscDM) +Resets the `DMSWARM` to the size prior to calling `DMSwarmCollectViewCreate()` + +Collective + +Input Parameters: +- `dm` - the `DMSWARM` + +-seealso: `DM`, `DMSWARM`, `DMSwarmCollectViewCreate()`, `DMSwarmSetCollectType()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmCollectViewDestroy")) +""" +function DMSwarmCollectViewDestroy(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMSwarmCollectViewDestroy(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMSwarmCollectViewDestroy, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMSwarmSetPointCoordinatesRandom(petsclib::PetscLibType,dm::PetscDM, Npc::PetscInt) +Sets initial coordinates for particles in each cell + +Collective + +Input Parameters: +- `dm` - the `DMSWARM` +- `Npc` - The number of particles per cell in the cell `DM` + +Level: intermediate + +-seealso: `DM`, `DMSWARM`, `DMSwarmSetCellDM()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetPointCoordinatesRandom")) +""" +function DMSwarmSetPointCoordinatesRandom(petsclib::PetscLibType, dm::PetscDM, Npc::PetscInt) end + +@for_petsc function DMSwarmSetPointCoordinatesRandom(petsclib::$UnionPetscLib, dm::PetscDM, Npc::$PetscInt ) + + @chk ccall( + (:DMSwarmSetPointCoordinatesRandom, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, Npc, + ) + + + return nothing +end + +""" + stype::DMSwarmType = DMSwarmGetType(petsclib::PetscLibType,sw::PetscDM) +Get particular flavor of `DMSWARM` + +Collective + +Input Parameter: +- `sw` - the `DMSWARM` + +Output Parameter: +- `stype` - the `DMSWARM` type (e.g. `DMSWARM_PIC`) + +Level: advanced + +-seealso: `DM`, `DMSWARM`, `DMSwarmSetMigrateType()`, `DMSwarmSetCollectType()`, `DMSwarmType`, `DMSWARM_PIC`, `DMSWARM_BASIC` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetType")) +""" +function DMSwarmGetType(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmGetType(petsclib::$UnionPetscLib, sw::PetscDM ) + stype_ = Ref{DMSwarmType}() + + @chk ccall( + (:DMSwarmGetType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMSwarmType}), + sw, stype_, + ) + + stype = stype_[] + + return stype +end + +""" + DMSwarmSetType(petsclib::PetscLibType,sw::PetscDM, stype::DMSwarmType) +Set particular flavor of `DMSWARM` + +Collective + +Input Parameters: +- `sw` - the `DMSWARM` +- `stype` - the `DMSWARM` type (e.g. `DMSWARM_PIC`) + +Level: advanced + +-seealso: `DM`, `DMSWARM`, `DMSwarmSetMigrateType()`, `DMSwarmSetCollectType()`, `DMSwarmType`, `DMSWARM_PIC`, `DMSWARM_BASIC` + +# External Links +$(_doc_external("DMSwarm/DMSwarmSetType")) +""" +function DMSwarmSetType(petsclib::PetscLibType, sw::PetscDM, stype::DMSwarmType) end + +@for_petsc function DMSwarmSetType(petsclib::$UnionPetscLib, sw::PetscDM, stype::DMSwarmType ) + + @chk ccall( + (:DMSwarmSetType, $petsc_library), + PetscErrorCode, + (CDM, DMSwarmType), + sw, stype, + ) + + + return nothing +end + +""" + DMSwarmGetCellSwarm(petsclib::PetscLibType,sw::PetscDM, cellID::PetscInt, cellswarm::PetscDM) +Extracts a single cell from the `DMSWARM` object, returns it as a single cell `DMSWARM`. +The cell `DM` is filtered for fields of that cell, and the filtered `DM` is used as the cell `DM` of the new swarm object. + +Noncollective + +Input Parameters: +- `sw` - the `DMSWARM` +- `cellID` - the integer id of the cell to be extracted and filtered +- `cellswarm` - The `DMSWARM` to receive the cell + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmRestoreCellSwarm()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmGetCellSwarm")) +""" +function DMSwarmGetCellSwarm(petsclib::PetscLibType, sw::PetscDM, cellID::PetscInt, cellswarm::PetscDM) end + +@for_petsc function DMSwarmGetCellSwarm(petsclib::$UnionPetscLib, sw::PetscDM, cellID::$PetscInt, cellswarm::PetscDM ) + + @chk ccall( + (:DMSwarmGetCellSwarm, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, CDM), + sw, cellID, cellswarm, + ) + + + return nothing +end + +""" + DMSwarmRestoreCellSwarm(petsclib::PetscLibType,sw::PetscDM, cellID::PetscInt, cellswarm::PetscDM) +Restores a `DMSWARM` object obtained with `DMSwarmGetCellSwarm()`. All fields are copied back into the parent swarm. + +Noncollective + +Input Parameters: +- `sw` - the parent `DMSWARM` +- `cellID` - the integer id of the cell to be copied back into the parent swarm +- `cellswarm` - the cell swarm object + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmGetCellSwarm()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmRestoreCellSwarm")) +""" +function DMSwarmRestoreCellSwarm(petsclib::PetscLibType, sw::PetscDM, cellID::PetscInt, cellswarm::PetscDM) end + +@for_petsc function DMSwarmRestoreCellSwarm(petsclib::$UnionPetscLib, sw::PetscDM, cellID::$PetscInt, cellswarm::PetscDM ) + + @chk ccall( + (:DMSwarmRestoreCellSwarm, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, CDM), + sw, cellID, cellswarm, + ) + + + return nothing +end + +""" + moments::Vector{PetscReal} = DMSwarmComputeMoments(petsclib::PetscLibType,sw::PetscDM, coordinate::String, weight::String) +Compute the first three particle moments for a given field + +Noncollective + +Input Parameters: +- `sw` - the `DMSWARM` +- `coordinate` - the coordinate field name +- `weight` - the weight field name + +Output Parameter: +- `moments` - the field moments + +Level: intermediate + +-seealso: `DM`, `DMSWARM`, `DMPlexComputeMoments()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmComputeMoments")) +""" +function DMSwarmComputeMoments(petsclib::PetscLibType, sw::PetscDM, coordinate::String, weight::String) end + +@for_petsc function DMSwarmComputeMoments(petsclib::$UnionPetscLib, sw::PetscDM, coordinate::String, weight::String ) + moments = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMSwarmComputeMoments, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscReal}), + sw, coordinate, weight, moments, + ) + + + return moments +end + +""" + DMSwarmReplace(petsclib::PetscLibType,dm::PetscDM, ndm::PetscDM) + +# External Links +$(_doc_external("DMSwarm/DMSwarmReplace")) +""" +function DMSwarmReplace(petsclib::PetscLibType, dm::PetscDM, ndm::PetscDM) end + +@for_petsc function DMSwarmReplace(petsclib::$UnionPetscLib, dm::PetscDM, ndm::PetscDM ) + ndm_ = Ref(ndm.ptr) + + @chk ccall( + (:DMSwarmReplace, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, ndm_, + ) + + ndm.ptr = ndm_[] + + return nothing +end + +""" + nsw::PetscDM = DMSwarmDuplicate(petsclib::PetscLibType,sw::PetscDM) +Creates a new `DMSWARM` with the same fields and cell `DM`s but no particles + +Collective + +Input Parameter: +- `sw` - the `DMSWARM` + +Output Parameter: +- `nsw` - the new `DMSWARM` + +Level: beginner + +-seealso: `DM`, `DMSWARM`, `DMSwarmCreate()`, `DMClone()` + +# External Links +$(_doc_external("DMSwarm/DMSwarmDuplicate")) +""" +function DMSwarmDuplicate(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmDuplicate(petsclib::$UnionPetscLib, sw::PetscDM ) + nsw_ = Ref{CDM}() + + @chk ccall( + (:DMSwarmDuplicate, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + sw, nsw_, + ) + + nsw = PetscDM(nsw_[], petsclib) + + return nsw +end + +""" + gx::PetscInt,gy::PetscInt,gz::PetscInt = DMDAGetElementsCorners(petsclib::PetscLibType,da::PetscDM) +Returns the global (i,j,k) indices of the lower left +corner of the non-overlapping decomposition of elements identified by `DMDAGetElements()` + +Not Collective + +Input Parameter: +- `da` - the `DMDA` object + +Output Parameters: +- `gx` - the i index +- `gy` - the j index +- `gz` - the k index + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAElementType`, `DMDASetElementType()`, `DMDAGetElements()`, `DMDAGetCorners()`, `DMDAGetGhostCorners()`, `DMDAGetElementsSizes()`, +`DMDAGetElementsCornersIS()`, `DMDARestoreElementsCornersIS()` + +# External Links +$(_doc_external("DMDA/DMDAGetElementsCorners")) +""" +function DMDAGetElementsCorners(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetElementsCorners(petsclib::$UnionPetscLib, da::PetscDM ) + gx_ = Ref{$PetscInt}() + gy_ = Ref{$PetscInt}() + gz_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetElementsCorners, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, gx_, gy_, gz_, + ) + + gx = gx_[] + gy = gy_[] + gz = gz_[] + + return gx,gy,gz +end + +""" + mx::PetscInt,my::PetscInt,mz::PetscInt = DMDAGetElementsSizes(petsclib::PetscLibType,da::PetscDM) +Gets the local number of elements per coordinate direction for the non + +Not Collective + +Input Parameter: +- `da` - the `DMDA` object + +Output Parameters: +- `mx` - number of local elements in x-direction +- `my` - number of local elements in y-direction +- `mz` - number of local elements in z-direction + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAElementType`, `DMDASetElementType()`, `DMDAGetElements()`, `DMDAGetElementsCorners()` + +# External Links +$(_doc_external("DMDA/DMDAGetElementsSizes")) +""" +function DMDAGetElementsSizes(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetElementsSizes(petsclib::$UnionPetscLib, da::PetscDM ) + mx_ = Ref{$PetscInt}() + my_ = Ref{$PetscInt}() + mz_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetElementsSizes, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, mx_, my_, mz_, + ) + + mx = mx_[] + my = my_[] + mz = mz_[] + + return mx,my,mz +end + +""" + etype::DMDAElementType = DMDASetElementType(petsclib::PetscLibType,da::PetscDM) +Sets the element type to be returned by `DMDAGetElements()` + +Not Collective + +Input Parameter: +- `da` - the `DMDA` object + +Output Parameter: +- `etype` - the element type, currently either `DMDA_ELEMENT_P1` or `DMDA_ELEMENT_Q1` + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAElementType`, `DMDAGetElementType()`, `DMDAGetElements()`, `DMDARestoreElements()`, +`DMDA_ELEMENT_P1`, `DMDA_ELEMENT_Q1` + +# External Links +$(_doc_external("DMDA/DMDASetElementType")) +""" +function DMDASetElementType(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDASetElementType(petsclib::$UnionPetscLib, da::PetscDM ) + etype_ = Ref{DMDAElementType}() + + @chk ccall( + (:DMDASetElementType, $petsc_library), + PetscErrorCode, + (CDM, DMDAElementType), + da, etype_, + ) + + etype = etype_[] + + return etype +end + +""" + etype::DMDAElementType = DMDAGetElementType(petsclib::PetscLibType,da::PetscDM) +Gets the element type to be returned by `DMDAGetElements()` + +Not Collective + +Input Parameter: +- `da` - the `DMDA` object + +Output Parameter: +- `etype` - the element type, currently either `DMDA_ELEMENT_P1` or `DMDA_ELEMENT_Q1` + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAElementType`, `DMDASetElementType()`, `DMDAGetElements()`, `DMDARestoreElements()`, +`DMDA_ELEMENT_P1`, `DMDA_ELEMENT_Q1` + +# External Links +$(_doc_external("DMDA/DMDAGetElementType")) +""" +function DMDAGetElementType(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetElementType(petsclib::$UnionPetscLib, da::PetscDM ) + etype_ = Ref{DMDAElementType}() + + @chk ccall( + (:DMDAGetElementType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMDAElementType}), + da, etype_, + ) + + etype = etype_[] + + return etype +end + +""" + nel::PetscInt,nen::PetscInt,e::Vector{PetscInt} = DMDAGetElements(petsclib::PetscLibType,dm::PetscDM) +Gets an array containing the indices (in local indexing) +of all the local elements + +Not Collective + +Input Parameter: +- `dm` - the `DMDA` object + +Output Parameters: +- `nel` - number of local elements +- `nen` - number of nodes in each element (for example in one dimension it is 2, in two dimensions it is 3 (for `DMDA_ELEMENT_P1`) and 4 +(for `DMDA_ELEMENT_Q1`) +- `e` - the local indices of the elements' vertices, of length `nel` * `nen` + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAElementType`, `DMDASetElementType()`, `VecSetValuesLocal()`, `MatSetValuesLocal()`, +`DMGlobalToLocalBegin()`, `DMLocalToGlobalBegin()`, `DMDARestoreElements()`, `DMDA_ELEMENT_P1`, `DMDA_ELEMENT_Q1`, `DMDAGetElementsSizes()`, +`DMDAGetElementsCorners()` + +# External Links +$(_doc_external("DMDA/DMDAGetElements")) +""" +function DMDAGetElements(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMDAGetElements(petsclib::$UnionPetscLib, dm::PetscDM ) + nel_ = Ref{$PetscInt}() + nen_ = Ref{$PetscInt}() + e_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMDAGetElements, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, nel_, nen_, e_, + ) + + nel = nel_[] + nen = nen_[] + e = unsafe_wrap(Array, e_[], VecGetLocalSize(petsclib, x); own = false) + + return nel,nen,e +end + +""" + DMDAGetSubdomainCornersIS(petsclib::PetscLibType,dm::PetscDM, is::IS) +Gets an index set containing the corner indices (in local indexing) +of the non-overlapping decomposition identified by `DMDAGetElements()` + +Not Collective + +Input Parameter: +- `dm` - the `DMDA` object + +Output Parameter: +- `is` - the index set + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAElementType`, `DMDASetElementType()`, `DMDAGetElements()`, `DMDARestoreElementsCornersIS()`, +`DMDAGetElementsSizes()`, `DMDAGetElementsCorners()` + +# External Links +$(_doc_external("DMDA/DMDAGetSubdomainCornersIS")) +""" +function DMDAGetSubdomainCornersIS(petsclib::PetscLibType, dm::PetscDM, is::IS) end + +@for_petsc function DMDAGetSubdomainCornersIS(petsclib::$UnionPetscLib, dm::PetscDM, is::IS ) + + @chk ccall( + (:DMDAGetSubdomainCornersIS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CIS}), + dm, is, + ) + + + return nothing +end + +""" + DMDARestoreElements(petsclib::PetscLibType,dm::PetscDM, nel::PetscInt, nen::PetscInt, e::Vector{PetscInt}) +Restores the array obtained with `DMDAGetElements()` + +Not Collective + +Input Parameters: +- `dm` - the `DM` object +- `nel` - number of local elements +- `nen` - number of nodes in each element +- `e` - the local indices of the elements' vertices + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAElementType`, `DMDASetElementType()`, `DMDAGetElements()` + +# External Links +$(_doc_external("DMDA/DMDARestoreElements")) +""" +function DMDARestoreElements(petsclib::PetscLibType, dm::PetscDM, nel::PetscInt, nen::PetscInt, e::Vector{PetscInt}) end + +@for_petsc function DMDARestoreElements(petsclib::$UnionPetscLib, dm::PetscDM, nel::$PetscInt, nen::$PetscInt, e::Vector{$PetscInt} ) + e_ = Ref(pointer(e)) + + @chk ccall( + (:DMDARestoreElements, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, nel, nen, e_, + ) + + + return nothing +end + +""" + DMDARestoreSubdomainCornersIS(petsclib::PetscLibType,dm::PetscDM, is::IS) +Restores the `IS` obtained with `DMDAGetSubdomainCornersIS()` + +Not Collective + +Input Parameters: +- `dm` - the `DM` object +- `is` - the index set + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAElementType`, `DMDASetElementType()`, `DMDAGetSubdomainCornersIS()` + +# External Links +$(_doc_external("DMDA/DMDARestoreSubdomainCornersIS")) +""" +function DMDARestoreSubdomainCornersIS(petsclib::PetscLibType, dm::PetscDM, is::IS) end + +@for_petsc function DMDARestoreSubdomainCornersIS(petsclib::$UnionPetscLib, dm::PetscDM, is::IS ) + + @chk ccall( + (:DMDARestoreSubdomainCornersIS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CIS}), + dm, is, + ) + + + return nothing +end + +""" + DMDAVecGetArray(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Returns a multiple dimension array that shares data with +the underlying vector and is indexed using the global or local dimensions of a `DMDA`. + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - a vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` + +Output Parameter: +- `array` - the array + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecRestoreArray()`, `DMDAVecRestoreArrayDOF()` +`DMDAVecGetArrayDOF()`, `DMDAVecGetArrayWrite()`, `DMDAVecRestoreArrayWrite()`, `DMDAVecGetArrayRead()`, `DMDAVecRestoreArrayRead()`, +`DMStagVecGetArray()` + +# External Links +$(_doc_external("DMDA/DMDAVecGetArray")) +""" +function DMDAVecGetArray(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecGetArray(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecGetArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecRestoreArray(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Restores a multiple dimension array obtained with `DMDAVecGetArray()` + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - a vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` +- `array` - the `array` pointer + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecGetArray()`, +`DMDAVecGetArrayWrite()`, `DMDAVecRestoreArrayWrite()`, `DMDAVecGetArrayRead()`, `DMDAVecRestoreArrayRead()`, +`DMStagVecRestoreArray()` + +# External Links +$(_doc_external("DMDA/DMDAVecRestoreArray")) +""" +function DMDAVecRestoreArray(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecRestoreArray(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecRestoreArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecGetArrayWrite(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Returns a multiple dimension array that shares data with +the underlying vector and is indexed using the global or local dimensions of a `DMDA`. + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - a vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` + +Output Parameter: +- `array` - the array + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecRestoreArrayWrite()`, `DMDAVecRestoreArrayDOF()` +`DMDAVecGetArrayDOF()`, `DMDAVecGetArray()`, `DMDAVecRestoreArray()`, `DMDAVecGetArrayRead()`, `DMDAVecRestoreArrayRead()` + +# External Links +$(_doc_external("DMDA/DMDAVecGetArrayWrite")) +""" +function DMDAVecGetArrayWrite(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecGetArrayWrite(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecGetArrayWrite, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecRestoreArrayWrite(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Restores a multiple dimension array obtained with `DMDAVecGetArrayWrite()` + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - a vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` +- `array` - the `array` pointer + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecGetArrayWrite()`, +`DMDAVecGetArray()`, `DMDAVecRestoreArray()`, `DMDAVecGetArrayRead()`, `DMDAVecRestoreArrayRead()` + +# External Links +$(_doc_external("DMDA/DMDAVecRestoreArrayWrite")) +""" +function DMDAVecRestoreArrayWrite(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecRestoreArrayWrite(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecRestoreArrayWrite, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecGetArrayDOF(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Returns a multiple dimension array that shares data with +the underlying vector and is indexed using the global or local dimensions of a `DMDA` + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - a vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` + +Output Parameter: +- `array` - the `array` pointer + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecRestoreArray()`, `DMDAVecGetArray()`, `DMDAVecRestoreArrayDOF()`, +`DMDAVecGetArrayWrite()`, `DMDAVecRestoreArrayWrite()`, `DMDAVecGetArrayRead()`, `DMDAVecRestoreArrayRead()`, `DMDAVecGetArrayDOFRead()` + +# External Links +$(_doc_external("DMDA/DMDAVecGetArrayDOF")) +""" +function DMDAVecGetArrayDOF(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecGetArrayDOF(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecGetArrayDOF, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecRestoreArrayDOF(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Restores a multiple dimension array obtained with `DMDAVecGetArrayDOF()` + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` +- `array` - the `array` point + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecGetArray()`, `DMDAVecGetArrayDOF()`, +`DMDAVecGetArrayWrite()`, `DMDAVecRestoreArrayWrite()`, `DMDAVecGetArrayRead()`, `DMDAVecRestoreArrayRead()` + +# External Links +$(_doc_external("DMDA/DMDAVecRestoreArrayDOF")) +""" +function DMDAVecRestoreArrayDOF(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecRestoreArrayDOF(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecRestoreArrayDOF, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecGetArrayRead(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Returns a multiple dimension array that shares data with +the underlying vector and is indexed using the global or local dimensions of a `DMDA`. + +Not Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - a vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` + +Output Parameter: +- `array` - the array + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, +`DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecRestoreArrayRead()`, +`DMDAVecRestoreArrayDOF()`, `DMDAVecGetArrayDOF()`, `DMDAVecGetArray()`, +`DMDAVecRestoreArray()`, `DMStagVecGetArrayRead()` + +# External Links +$(_doc_external("DMDA/DMDAVecGetArrayRead")) +""" +function DMDAVecGetArrayRead(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecGetArrayRead(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecGetArrayRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecRestoreArrayRead(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Restores a multiple dimension array obtained with `DMDAVecGetArrayRead()` + +Not Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` +- `array` - the `array` pointer + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecGetArrayRead()`, +`DMDAVecGetArray()`, `DMDAVecRestoreArray()`, `DMDAVecGetArrayWrite()`, `DMDAVecRestoreArrayWrite()`, +`DMStagVecRestoreArrayRead()` + +# External Links +$(_doc_external("DMDA/DMDAVecRestoreArrayRead")) +""" +function DMDAVecRestoreArrayRead(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecRestoreArrayRead(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecRestoreArrayRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecGetArrayDOFRead(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Returns a multiple dimension array that shares data with +the underlying vector and is indexed using the global or local dimensions of a `DMDA` + +Not Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - a vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` + +Output Parameter: +- `array` - the array + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecRestoreArray()`, `DMDAVecGetArray()`, `DMDAVecGetArrayDOF()`, +`DMDAVecGetArrayWrite()`, `DMDAVecRestoreArrayWrite()`, `DMDAVecGetArrayRead()`, `DMDAVecRestoreArrayRead()` + +# External Links +$(_doc_external("DMDA/DMDAVecGetArrayDOFRead")) +""" +function DMDAVecGetArrayDOFRead(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecGetArrayDOFRead(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecGetArrayDOFRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecRestoreArrayDOFRead(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Restores a multiple dimension array obtained with `DMDAVecGetArrayDOFRead()` + +Not Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - a vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` +- `array` - the `array` pointer + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecGetArray()`, `DMDAVecGetArrayDOF()`, `DMDAVecRestoreArrayDOF()`, +`DMDAVecGetArrayWrite()`, `DMDAVecRestoreArrayWrite()`, `DMDAVecGetArrayRead()`, `DMDAVecRestoreArrayRead()` + +# External Links +$(_doc_external("DMDA/DMDAVecRestoreArrayDOFRead")) +""" +function DMDAVecRestoreArrayDOFRead(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecRestoreArrayDOFRead(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecRestoreArrayDOFRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecGetArrayDOFWrite(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Returns a multiple dimension array that shares data with +the underlying vector and is indexed using the global or local dimensions of a `DMDA` + +Not Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - a vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` + +Output Parameter: +- `array` - the array + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecRestoreArray()`, `DMDAVecGetArray()`, `DMDAVecGetArrayDOF()`, +`DMDAVecGetArrayWrite()`, `DMDAVecRestoreArrayWrite()` + +# External Links +$(_doc_external("DMDA/DMDAVecGetArrayDOFWrite")) +""" +function DMDAVecGetArrayDOFWrite(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecGetArrayDOFWrite(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecGetArrayDOFWrite, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAVecRestoreArrayDOFWrite(petsclib::PetscLibType,da::PetscDM, vec::PetscVec, array::Cvoid) +Restores a multiple dimension array obtained with `DMDAVecGetArrayDOFWrite()` + +Not Collective + +Input Parameters: +- `da` - the `DMDA` +- `vec` - a vector the same size as one obtained with `DMCreateGlobalVector()` or `DMCreateLocalVector()` +- `array` - the `array` pointer + +Level: intermediate + +-seealso: [](sec_struct), [](sec_struct_set), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `VecGetArray()`, `VecRestoreArray()`, `DMDAVecGetArray()`, `DMDAVecGetArrayDOF()`, `DMDAVecRestoreArrayDOF()`, +`DMDAVecGetArrayWrite()`, `DMDAVecRestoreArrayWrite()` + +# External Links +$(_doc_external("DMDA/DMDAVecRestoreArrayDOFWrite")) +""" +function DMDAVecRestoreArrayDOFWrite(petsclib::PetscLibType, da::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMDAVecRestoreArrayDOFWrite(petsclib::$UnionPetscLib, da::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMDAVecRestoreArrayDOFWrite, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + da, vec, array, + ) + + + return nothing +end + +""" + DMDAGlobalToNaturalBegin(petsclib::PetscLibType,da::PetscDM, g::PetscVec, mode::InsertMode, n::PetscVec) +Maps values from the global vector obtained with `DMCreateGlobalVector()` to a global vector +in the "natural" grid ordering. Must be followed by +`DMDAGlobalToNaturalEnd()` to complete the exchange. + +Neighbor-wise Collective + +Input Parameters: +- `da` - the `DMDA` context +- `g` - the global vector, see `DMCreateGlobalVector()` +- `mode` - one of `INSERT_VALUES` or `ADD_VALUES` + +Output Parameter: +- `n` - the natural ordering values, see `DMDACreateNaturalVector()` + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGlobalToNaturalEnd()`, `DMLocalToGlobalBegin()`, `DMDACreate2d()`, +`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMDACreateNaturalVector()` + +# External Links +$(_doc_external("DMDA/DMDAGlobalToNaturalBegin")) +""" +function DMDAGlobalToNaturalBegin(petsclib::PetscLibType, da::PetscDM, g::PetscVec, mode::InsertMode, n::PetscVec) end + +@for_petsc function DMDAGlobalToNaturalBegin(petsclib::$UnionPetscLib, da::PetscDM, g::PetscVec, mode::InsertMode, n::PetscVec ) + + @chk ccall( + (:DMDAGlobalToNaturalBegin, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + da, g, mode, n, + ) + + + return nothing +end + +""" + DMDAGlobalToNaturalEnd(petsclib::PetscLibType,da::PetscDM, g::PetscVec, mode::InsertMode, n::PetscVec) +Maps values from the global vector obtained with `DMCreateGlobalVector()` to a global vector +in the natural ordering. Must be preceded by `DMDAGlobalToNaturalBegin()`. + +Neighbor-wise Collective + +Input Parameters: +- `da` - the `DMDA` context +- `g` - the global vector, see `DMCreateGlobalVector()` +- `mode` - one of `INSERT_VALUES` or `ADD_VALUES` + +Output Parameter: +- `n` - the global values in the natural ordering, see `DMDACreateNaturalVector()` + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGlobalToNaturalBegin()`, `DMLocalToGlobalBegin()`, `DMDACreate2d()`, +`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMDACreateNaturalVector()` + +# External Links +$(_doc_external("DMDA/DMDAGlobalToNaturalEnd")) +""" +function DMDAGlobalToNaturalEnd(petsclib::PetscLibType, da::PetscDM, g::PetscVec, mode::InsertMode, n::PetscVec) end + +@for_petsc function DMDAGlobalToNaturalEnd(petsclib::$UnionPetscLib, da::PetscDM, g::PetscVec, mode::InsertMode, n::PetscVec ) + + @chk ccall( + (:DMDAGlobalToNaturalEnd, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + da, g, mode, n, + ) + + + return nothing +end + +""" + DMDANaturalToGlobalBegin(petsclib::PetscLibType,da::PetscDM, n::PetscVec, mode::InsertMode, g::PetscVec) +Maps values from a global vector in the "natural" ordering +to a global vector in the PETSc `DMDA` grid ordering. Must be followed by +`DMDANaturalToGlobalEnd()` to complete the exchange. + +Neighbor-wise Collective + +Input Parameters: +- `da` - the `DMDA` context +- `g` - the global vector in a natural ordering, see `DMDACreateNaturalVector()` +- `mode` - one of `INSERT_VALUES` or `ADD_VALUES` + +Output Parameter: +- `n` - the values in the `DMDA` ordering + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGlobalToNaturalEnd()`, `DMDAGlobalToNaturalBegin()`, `DMLocalToGlobalBegin()`, `DMDACreate2d()`, +`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMDACreateNaturalVector()` + +# External Links +$(_doc_external("DMDA/DMDANaturalToGlobalBegin")) +""" +function DMDANaturalToGlobalBegin(petsclib::PetscLibType, da::PetscDM, n::PetscVec, mode::InsertMode, g::PetscVec) end + +@for_petsc function DMDANaturalToGlobalBegin(petsclib::$UnionPetscLib, da::PetscDM, n::PetscVec, mode::InsertMode, g::PetscVec ) + + @chk ccall( + (:DMDANaturalToGlobalBegin, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + da, n, mode, g, + ) + + + return nothing +end + +""" + DMDANaturalToGlobalEnd(petsclib::PetscLibType,da::PetscDM, n::PetscVec, mode::InsertMode, g::PetscVec) +Maps values from the natural ordering global vector +to a global vector in the PETSc `DMDA` ordering. Must be preceded by `DMDANaturalToGlobalBegin()`. + +Neighbor-wise Collective + +Input Parameters: +- `da` - the `DMDA` context +- `g` - the global vector in a natural ordering +- `mode` - one of `INSERT_VALUES` or `ADD_VALUES` + +Output Parameter: +- `n` - the global values in the PETSc `DMDA` ordering + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGlobalToNaturalBegin()`, `DMDAGlobalToNaturalEnd()`, `DMLocalToGlobalBegin()`, `DMDACreate2d()`, +`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMDACreateNaturalVector()` + +# External Links +$(_doc_external("DMDA/DMDANaturalToGlobalEnd")) +""" +function DMDANaturalToGlobalEnd(petsclib::PetscLibType, da::PetscDM, n::PetscVec, mode::InsertMode, g::PetscVec) end + +@for_petsc function DMDANaturalToGlobalEnd(petsclib::$UnionPetscLib, da::PetscDM, n::PetscVec, mode::InsertMode, g::PetscVec ) + + @chk ccall( + (:DMDANaturalToGlobalEnd, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + da, n, mode, g, + ) + + + return nothing +end + +""" + scatter::VecScatter = DMDAGlobalToNaturalAllCreate(petsclib::PetscLibType,da::PetscDM) +Creates a scatter context that maps from a +global vector, obtained with `DMCreateGlobalVector()`, to the entire vector to each processor in natural numbering + +Collective + +Input Parameter: +- `da` - the `DMDA` context + +Output Parameter: +- `scatter` - the scatter context + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDANaturalAllToGlobalCreate()`, `DMDAGlobalToNaturalEnd()`, `DMLocalToGlobalBegin()`, `DMDACreate2d()`, +`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMDACreateNaturalVector()` + +# External Links +$(_doc_external("DMDA/DMDAGlobalToNaturalAllCreate")) +""" +function DMDAGlobalToNaturalAllCreate(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGlobalToNaturalAllCreate(petsclib::$UnionPetscLib, da::PetscDM ) + scatter_ = Ref{VecScatter}() + + @chk ccall( + (:DMDAGlobalToNaturalAllCreate, $petsc_library), + PetscErrorCode, + (CDM, Ptr{VecScatter}), + da, scatter_, + ) + + scatter = scatter_[] + + return scatter +end + +""" + scatter::VecScatter = DMDANaturalAllToGlobalCreate(petsclib::PetscLibType,da::PetscDM) +Creates a scatter context that maps from a copy +of the entire vector on each processor (in the natural ordering) to its local part in the global vector, obtained with `DMCreateGlobalVector()`. + +Collective + +Input Parameter: +- `da` - the `DMDA` context + +Output Parameter: +- `scatter` - the scatter context + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGlobalToNaturalAllCreate()`, `DMDAGlobalToNaturalEnd()`, `DMLocalToGlobalBegin()`, `DMDACreate2d()`, +`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMDACreateNaturalVector()` + +# External Links +$(_doc_external("DMDA/DMDANaturalAllToGlobalCreate")) +""" +function DMDANaturalAllToGlobalCreate(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDANaturalAllToGlobalCreate(petsclib::$UnionPetscLib, da::PetscDM ) + scatter_ = Ref{VecScatter}() + + @chk ccall( + (:DMDANaturalAllToGlobalCreate, $petsc_library), + PetscErrorCode, + (CDM, Ptr{VecScatter}), + da, scatter_, + ) + + scatter = scatter_[] + + return scatter +end + +""" + g::PetscVec = DMDACreateNaturalVector(petsclib::PetscLibType,da::PetscDM) +Creates a parallel PETSc vector that +will hold vector values in the natural numbering, rather than in +the PETSc parallel numbering associated with the `DMDA`. + +Collective + +Input Parameter: +- `da` - the `DMDA` + +Output Parameter: +- `g` - the distributed global vector + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGlobalToNaturalBegin()`, `DMDAGlobalToNaturalEnd()`, `DMDANaturalToGlobalBegin()`, `DMDANaturalToGlobalEnd()`, +`DMCreateLocalVector()`, `VecDuplicate()`, `VecDuplicateVecs()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMGlobalToLocalBegin()`, +`DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()` + +# External Links +$(_doc_external("DMDA/DMDACreateNaturalVector")) +""" +function DMDACreateNaturalVector(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDACreateNaturalVector(petsclib::$UnionPetscLib, da::PetscDM ) + g_ = Ref{CVec}() + + @chk ccall( + (:DMDACreateNaturalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + da, g_, + ) + + g = PetscVec(g_[], petsclib) + + return g +end + +""" + da::PetscDM = DMDACreate1d(petsclib::PetscLibType,comm::MPI_Comm, bx::DMBoundaryType, M::PetscInt, dof::PetscInt, s::PetscInt, lx::Vector{PetscInt}) +Creates an object that will manage the communication of one regular array data that is distributed across one or more MPI processes. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bx` - type of ghost cells at the boundary the array should have, if any. Use `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, or `DM_BOUNDARY_PERIODIC`. +- `M` - global dimension of the array (that is the number of grid points) +- `dof` - number of degrees of freedom per node +- `s` - stencil width +- `lx` - array containing number of nodes in the X direction on each processor, or `NULL`. If non-null, must be of length as the number of processes in the MPI_Comm. The sum of these entries must equal `M`. + +Output Parameter: +- `da` - the resulting distributed array object + +Options Database Keys: +- `-dm_view` - Calls `DMView()` at the conclusion of `DMDACreate1d()` +- `-da_grid_x ` - number of grid points in x direction +- `-da_refine_x ` - refinement factor +- `-da_refine ` - refine the `DMDA` n times before creating it + +Level: beginner + +-seealso: [](sec_struct), `DMDA`, `DM`, `DMDestroy()`, `DMView()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMGlobalToLocalBegin()`, `DMDASetRefinementFactor()`, +`DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMLocalToLocalBegin()`, `DMLocalToLocalEnd()`, `DMDAGetRefinementFactor()`, +`DMDAGetInfo()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()`, `DMDACreateNaturalVector()`, `DMLoad()`, `DMDAGetOwnershipRanges()`, +`DMStagCreate1d()`, `DMBoundaryType` + +# External Links +$(_doc_external("DMDA/DMDACreate1d")) +""" +function DMDACreate1d(petsclib::PetscLibType, comm::MPI_Comm, bx::DMBoundaryType, M::PetscInt, dof::PetscInt, s::PetscInt, lx::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function DMDACreate1d(petsclib::$UnionPetscLib, comm::MPI_Comm, bx::DMBoundaryType, M::$PetscInt, dof::$PetscInt, s::$PetscInt, lx::Union{Ptr,Vector{$PetscInt}} ) + da_ = Ref{CDM}() + + @chk ccall( + (:DMDACreate1d, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMBoundaryType, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CDM}), + comm, bx, M, dof, s, lx, da_, + ) + + da = PetscDM(da_[], petsclib) + + return da +end + +""" + DMDASetAOType(petsclib::PetscLibType,da::PetscDM, aotype::AOType) +Sets the type of application ordering to create with `DMDAGetAO()`, for a distributed array. + +Collective + +Input Parameters: +- `da` - the `DMDA` +- `aotype` - type of `AO`. `AOType` which can be `AOBASIC`, `AOADVANCED`, `AOMAPPING`, or `AOMEMORYSCALABLE` + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDACreate2d()`, `DMDAGetAO()`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `DMLocalToGlobal()` +`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMLocalToLocalBegin()`, `DMLocalToLocalEnd()`, `DMDAGetGlobalIndices()`, `DMDAGetOwnershipRanges()`, +`AO`, `AOPetscToApplication()`, `AOApplicationToPetsc()`, `AOType`, `AOBASIC`, `AOADVANCED`, `AOMAPPING`, `AOMEMORYSCALABLE` + +# External Links +$(_doc_external("DMDA/DMDASetAOType")) +""" +function DMDASetAOType(petsclib::PetscLibType, da::PetscDM, aotype::AOType) end + +@for_petsc function DMDASetAOType(petsclib::$UnionPetscLib, da::PetscDM, aotype::AOType ) + + @chk ccall( + (:DMDASetAOType, $petsc_library), + PetscErrorCode, + (CDM, AOType), + da, aotype, + ) + + + return nothing +end + +""" + DMDAGetAO(petsclib::PetscLibType,da::PetscDM, ao::AO) +Gets the application ordering context for a distributed array. + +Collective + +Input Parameter: +- `da` - the `DMDA` + +Output Parameter: +- `ao` - the application ordering context for `DMDA` + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDACreate2d()`, `DMDASetAOType()`, `DMDAGetGhostCorners()`, `DMDAGetCorners()`, `DMLocalToGlobal()` +`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMLocalToLocalBegin()`, `DMLocalToLocalEnd()`, `DMDAGetOwnershipRanges()`, +`AO`, `AOPetscToApplication()`, `AOApplicationToPetsc()` + +# External Links +$(_doc_external("DMDA/DMDAGetAO")) +""" +function DMDAGetAO(petsclib::PetscLibType, da::PetscDM, ao::AO) end + +@for_petsc function DMDAGetAO(petsclib::$UnionPetscLib, da::PetscDM, ao::AO ) + + @chk ccall( + (:DMDAGetAO, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CAO}), + da, ao, + ) + + + return nothing +end + +""" + DMDASetUniformCoordinates(petsclib::PetscLibType,da::PetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal) +Sets a `DMDA` coordinates to be a uniform grid + +Collective + +Input Parameters: +- `da` - the `DMDA` object +- `xmin` - min extreme in the x direction +- `xmax` - max extreme in the x direction +- `ymin` - min extreme in the y direction (value ignored for 1 dimensional problems) +- `ymax` - max extreme in the y direction (value ignored for 1 dimensional problems) +- `zmin` - min extreme in the z direction (value ignored for 1 or 2 dimensional problems) +- `zmax` - max extreme in the z direction (value ignored for 1 or 2 dimensional problems) + +Level: beginner + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMSetCoordinates()`, `DMGetCoordinates()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMStagSetUniformCoordinates()` + +# External Links +$(_doc_external("DMDA/DMDASetUniformCoordinates")) +""" +function DMDASetUniformCoordinates(petsclib::PetscLibType, da::PetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal) end + +@for_petsc function DMDASetUniformCoordinates(petsclib::$UnionPetscLib, da::PetscDM, xmin::$PetscReal, xmax::$PetscReal, ymin::$PetscReal, ymax::$PetscReal, zmin::$PetscReal, zmax::$PetscReal ) + + @chk ccall( + (:DMDASetUniformCoordinates, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + da, xmin, xmax, ymin, ymax, zmin, zmax, + ) + + + return nothing +end + +""" + dim::PetscInt,M::PetscInt,N::PetscInt,P::PetscInt,m::PetscInt,n::PetscInt,p::PetscInt,dof::PetscInt,s::PetscInt, bx::DMBoundaryType, by::DMBoundaryType, bz::DMBoundaryType, st::DMDAStencilType = DMDAGetInfo(petsclib::PetscLibType,da::PetscDM) +Gets information about a given distributed array. + +Not Collective + +Input Parameter: +- `da` - the `DMDA` + +Output Parameters: +- `dim` - dimension of the `DMDA` (1, 2, or 3) +- `M` - global dimension in first direction of the array +- `N` - global dimension in second direction of the array +- `P` - global dimension in third direction of the array +- `m` - corresponding number of MPI processes in first dimension +- `n` - corresponding number of MPI processes in second dimension +- `p` - corresponding number of MPI processes in third dimension +- `dof` - number of degrees of freedom per node +- `s` - stencil width +- `bx` - type of ghost nodes at boundary in first dimension +- `by` - type of ghost nodes at boundary in second dimension +- `bz` - type of ghost nodes at boundary in third dimension +- `st` - stencil type, either `DMDA_STENCIL_STAR` or `DMDA_STENCIL_BOX` + +Note: +in julia, we return a named + +Level: beginner + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMView()`, `DMDAGetCorners()`, `DMDAGetLocalInfo()` + +# External Links +$(_doc_external("DMDA/DMDAGetInfo")) +""" +function DMDAGetInfo(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetInfo(petsclib::$UnionPetscLib, da::PetscDM ) + dim_ = Ref{$PetscInt}() + M_ = Ref{$PetscInt}() + N_ = Ref{$PetscInt}() + P_ = Ref{$PetscInt}() + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + p_ = Ref{$PetscInt}() + dof_ = Ref{$PetscInt}() + s_ = Ref{$PetscInt}() + bx_ = Ref{$DMBoundaryType}() + by_ = Ref{$DMBoundaryType}() + bz_ = Ref{$DMBoundaryType}() + st_ = Ref{$DMDAStencilType}() + + @chk ccall( + (:DMDAGetInfo, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{DMBoundaryType}, Ptr{DMBoundaryType}, Ptr{DMBoundaryType}, Ptr{DMDAStencilType}), + da, dim_, M_, N_, P_, m_, n_, p_, dof_, s_, bx_, by_, bz_, st_, + ) + + dim = dim_[] + M = M_[] + N = N_[] + P = P_[] + m = m_[] + n = n_[] + p = p_[] + dof = dof_[] + s = s_[] + bx = bx_[] + by = by_[] + bz = bz_[] + st = st_[] + + + return dim, M, N, P, m, n, p, dof, s, bx, by, bz, st +end + +""" + DMDAGetLocalInfo(petsclib::PetscLibType,da::PetscDM, info::DMDALocalInfo) +Gets information about a given `DMDA` and this MPI process's location in it + +Not Collective + +Input Parameter: +- `da` - the `DMDA` + +Output Parameter: +- `info` - structure containing the information + +Level: beginner + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetInfo()`, `DMDAGetCorners()`, `DMDALocalInfo` + +# External Links +$(_doc_external("DMDA/DMDAGetLocalInfo")) +""" +function DMDAGetLocalInfo(petsclib::PetscLibType, da::PetscDM, info::DMDALocalInfo) end + +@for_petsc function DMDAGetLocalInfo(petsclib::$UnionPetscLib, da::PetscDM, info::DMDALocalInfo ) + + @chk ccall( + (:DMDAGetLocalInfo, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMDALocalInfo}), + da, info, + ) + + + return nothing +end + +""" + da::PetscDM =petsclib::PetscLibType,comm::MPI_Comm, bx::DMBoundaryType, by::DMBoundaryType, stencil_type::DMDAStencilType, M::PetscInt, N::PetscInt, m::PetscInt, n::PetscInt, dof::PetscInt, s::PetscInt, lx::Vector{PetscInt}, ly::Vector{PetscInt}) +Creates an object that will manage the communication of two +regular array data that is distributed across one or more MPI processes. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bx` - type of ghost nodes the x array have. Use one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC`. +- `by` - type of ghost nodes the y array have. Use one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC`. +- `stencil_type` - stencil type. Use either `DMDA_STENCIL_BOX` or `DMDA_STENCIL_STAR`. +- `M` - global dimension in x direction of the array +- `N` - global dimension in y direction of the array +- `m` - corresponding number of processors in x dimension (or `PETSC_DECIDE` to have calculated) +- `n` - corresponding number of processors in y dimension (or `PETSC_DECIDE` to have calculated) +- `dof` - number of degrees of freedom per node +- `s` - stencil width +- `lx` - arrays containing the number of nodes in each cell along the x coordinates, or `NULL`. +- `ly` - arrays containing the number of nodes in each cell along the y coordinates, or `NULL`. + +Output Parameter: +- `da` - the resulting distributed array object + +Options Database Keys: +- `-dm_view` - Calls `DMView()` at the conclusion of `DMDACreate2d()` +- `-da_grid_x ` - number of grid points in x direction +- `-da_grid_y ` - number of grid points in y direction +- `-da_processors_x ` - number of processors in x direction +- `-da_processors_y ` - number of processors in y direction +- `-da_bd_x ` - boundary type in x direction +- `-da_bd_y ` - boundary type in y direction +- `-da_bd_all ` - boundary type in all directions +- `-da_refine_x ` - refinement ratio in x direction +- `-da_refine_y ` - refinement ratio in y direction +- `-da_refine ` - refine the `DMDA` n times before creating + +Level: beginner + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDestroy()`, `DMView()`, `DMDACreate1d()`, `DMDACreate3d()`, `DMGlobalToLocalBegin()`, `DMDAGetRefinementFactor()`, +`DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMLocalToLocalBegin()`, `DMLocalToLocalEnd()`, `DMDASetRefinementFactor()`, +`DMDAGetInfo()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()`, `DMDACreateNaturalVector()`, `DMLoad()`, `DMDAGetOwnershipRanges()`, +`DMStagCreate2d()`, `DMBoundaryType` + +# External Links +$(_doc_external("DMDA/DMDACreate2d")) +""" +function DMDACreate2d(petsclib::PetscLibType, comm::MPI_Comm, bx::DMBoundaryType, by::DMBoundaryType, stencil_type::DMDAStencilType, M::PetscInt, N::PetscInt, m::PetscInt, n::PetscInt, dof::PetscInt, s::PetscInt, lx::Union{Ptr, Vector{PetscInt}}, ly::Union{Ptr, Vector{PetscInt}}) end + +@for_petsc function DMDACreate2d(petsclib::$UnionPetscLib, comm::MPI_Comm, bx::DMBoundaryType, by::DMBoundaryType, stencil_type::DMDAStencilType, M::$PetscInt, N::$PetscInt, m::$PetscInt, n::$PetscInt, dof::$PetscInt, s::$PetscInt, lx::Union{Ptr, Vector{$PetscInt}}, ly::Union{Ptr, Vector{$PetscInt}} ) + da_ = Ref{CDM}() + + @chk ccall( + (:DMDACreate2d, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMBoundaryType, DMBoundaryType, DMDAStencilType, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{CDM}), + comm, bx, by, stencil_type, M, N, m, n, dof, s, lx, ly, da_, + ) + + da = PetscDM(da_[], petsclib) + + return da +end + +""" + DMDAGetScatter(petsclib::PetscLibType,da::PetscDM, gtol::VecScatter, ltol::VecScatter) +Gets the global +local-to-local vector scatter contexts for a `DMDA` distributed array. + +Collective + +Input Parameter: +- `da` - the `DMDA` + +Output Parameters: +- `gtol` - global-to-local scatter context (may be `NULL`) +- `ltol` - local-to-local scatter context (may be `NULL`) + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()` + +# External Links +$(_doc_external("DMDA/DMDAGetScatter")) +""" +function DMDAGetScatter(petsclib::PetscLibType, da::PetscDM, gtol::VecScatter, ltol::VecScatter) end + +@for_petsc function DMDAGetScatter(petsclib::$UnionPetscLib, da::PetscDM, gtol::VecScatter, ltol::VecScatter ) + + @chk ccall( + (:DMDAGetScatter, $petsc_library), + PetscErrorCode, + (CDM, Ptr{VecScatter}, Ptr{VecScatter}), + da, gtol, ltol, + ) + + + return nothing +end + +""" + numCellsX::PetscInt,numCellsY::PetscInt,numCellsZ::PetscInt,numCells::PetscInt = DMDAGetNumCells(petsclib::PetscLibType,dm::PetscDM) +Get the number of cells (or vertices) in the local piece of the `DMDA`. This includes ghost cells. + +Input Parameter: +- `dm` - The `DMDA` object + +Output Parameters: +- `numCellsX` - The number of local cells in the x-direction +- `numCellsY` - The number of local cells in the y-direction +- `numCellsZ` - The number of local cells in the z-direction +- `numCells` - The number of local cells + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetCellPoint()` + +# External Links +$(_doc_external("DMDA/DMDAGetNumCells")) +""" +function DMDAGetNumCells(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMDAGetNumCells(petsclib::$UnionPetscLib, dm::PetscDM ) + numCellsX_ = Ref{$PetscInt}() + numCellsY_ = Ref{$PetscInt}() + numCellsZ_ = Ref{$PetscInt}() + numCells_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetNumCells, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, numCellsX_, numCellsY_, numCellsZ_, numCells_, + ) + + numCellsX = numCellsX_[] + numCellsY = numCellsY_[] + numCellsZ = numCellsZ_[] + numCells = numCells_[] + + return numCellsX,numCellsY,numCellsZ,numCells +end + +""" + point::PetscInt = DMDAGetCellPoint(petsclib::PetscLibType,dm::PetscDM, i::PetscInt, j::PetscInt, k::PetscInt) +Get the `DM` point corresponding to the tuple (i, j, k) in the `DMDA` + +Input Parameters: +- `dm` - The `DMDA` object +- `i` - The global x index for the cell +- `j` - The global y index for the cell +- `k` - The global z index for the cell + +Output Parameter: +- `point` - The local `DM` point + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetNumCells()` + +# External Links +$(_doc_external("DMDA/DMDAGetCellPoint")) +""" +function DMDAGetCellPoint(petsclib::PetscLibType, dm::PetscDM, i::PetscInt, j::PetscInt, k::PetscInt) end + +@for_petsc function DMDAGetCellPoint(petsclib::$UnionPetscLib, dm::PetscDM, i::$PetscInt, j::$PetscInt, k::$PetscInt ) + point_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetCellPoint, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}), + dm, i, j, k, point_, + ) + + point = point_[] + + return point +end + +""" + numVerticesX::PetscInt,numVerticesY::PetscInt,numVerticesZ::PetscInt,numVertices::PetscInt = DMDAGetNumVertices(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMDA/DMDAGetNumVertices")) +""" +function DMDAGetNumVertices(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMDAGetNumVertices(petsclib::$UnionPetscLib, dm::PetscDM ) + numVerticesX_ = Ref{$PetscInt}() + numVerticesY_ = Ref{$PetscInt}() + numVerticesZ_ = Ref{$PetscInt}() + numVertices_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetNumVertices, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, numVerticesX_, numVerticesY_, numVerticesZ_, numVertices_, + ) + + numVerticesX = numVerticesX_[] + numVerticesY = numVerticesY_[] + numVerticesZ = numVerticesZ_[] + numVertices = numVertices_[] + + return numVerticesX,numVerticesY,numVerticesZ,numVertices +end + +""" + numXFacesX::PetscInt,numXFaces::PetscInt,numYFacesY::PetscInt,numYFaces::PetscInt,numZFacesZ::PetscInt,numZFaces::PetscInt = DMDAGetNumFaces(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMDA/DMDAGetNumFaces")) +""" +function DMDAGetNumFaces(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMDAGetNumFaces(petsclib::$UnionPetscLib, dm::PetscDM ) + numXFacesX_ = Ref{$PetscInt}() + numXFaces_ = Ref{$PetscInt}() + numYFacesY_ = Ref{$PetscInt}() + numYFaces_ = Ref{$PetscInt}() + numZFacesZ_ = Ref{$PetscInt}() + numZFaces_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetNumFaces, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, numXFacesX_, numXFaces_, numYFacesY_, numYFaces_, numZFacesZ_, numZFaces_, + ) + + numXFacesX = numXFacesX_[] + numXFaces = numXFaces_[] + numYFacesY = numYFacesY_[] + numYFaces = numYFaces_[] + numZFacesZ = numZFacesZ_[] + numZFaces = numZFaces_[] + + return numXFacesX,numXFaces,numYFacesY,numYFaces,numZFacesZ,numZFaces +end + +""" + pStart::PetscInt,pEnd::PetscInt = DMDAGetHeightStratum(petsclib::PetscLibType,dm::PetscDM, height::PetscInt) +Get the bounds [`start`, `end`) for all points at a certain height. + +Not Collective + +Input Parameters: +- `dm` - The `DMDA` object +- `height` - The requested height + +Output Parameters: +- `pStart` - The first point at this `height` +- `pEnd` - One beyond the last point at this `height` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMDA`, `DMPlexGetDepthStratum()`, `DMPlexGetHeightStratum()`, `DMPlexGetCellTypeStratum()`, `DMPlexGetDepth()`, +`DMPlexGetDepthLabel()`, `DMPlexGetPointDepth()`, `DMPlexSymmetrize()`, `DMPlexInterpolate()`, `DMDAGetDepthStratum()` + +# External Links +$(_doc_external("DMDA/DMDAGetHeightStratum")) +""" +function DMDAGetHeightStratum(petsclib::PetscLibType, dm::PetscDM, height::PetscInt) end + +@for_petsc function DMDAGetHeightStratum(petsclib::$UnionPetscLib, dm::PetscDM, height::$PetscInt ) + pStart_ = Ref{$PetscInt}() + pEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetHeightStratum, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, height, pStart_, pEnd_, + ) + + pStart = pStart_[] + pEnd = pEnd_[] + + return pStart,pEnd +end + +""" + pStart::PetscInt,pEnd::PetscInt = DMDAGetDepthStratum(petsclib::PetscLibType,dm::PetscDM, depth::PetscInt) +Get the bounds [`start`, `end`) for all points at a certain depth. + +Not Collective + +Input Parameters: +- `dm` - The `DMDA` object +- `depth` - The requested depth + +Output Parameters: +- `pStart` - The first point at this `depth` +- `pEnd` - One beyond the last point at this `depth` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMDA`, `DMPlexGetDepthStratum()`, `DMPlexGetHeightStratum()`, `DMPlexGetCellTypeStratum()`, `DMPlexGetDepth()`, +`DMPlexGetDepthLabel()`, `DMPlexGetPointDepth()`, `DMPlexSymmetrize()`, `DMPlexInterpolate()`, `DMDAGetHeightStratum()` + +# External Links +$(_doc_external("DMDA/DMDAGetDepthStratum")) +""" +function DMDAGetDepthStratum(petsclib::PetscLibType, dm::PetscDM, depth::PetscInt) end + +@for_petsc function DMDAGetDepthStratum(petsclib::$UnionPetscLib, dm::PetscDM, depth::$PetscInt ) + pStart_ = Ref{$PetscInt}() + pEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetDepthStratum, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, depth, pStart_, pEnd_, + ) + + pStart = pStart_[] + pEnd = pEnd_[] + + return pStart,pEnd +end + +""" + DMDASetVertexCoordinates(petsclib::PetscLibType,dm::PetscDM, xl::PetscReal, xu::PetscReal, yl::PetscReal, yu::PetscReal, zl::PetscReal, zu::PetscReal) +Sets the lower and upper coordinates for a `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - The `DMDA` object +- `xl` - the lower x coordinate +- `xu` - the upper x coordinate +- `yl` - the lower y coordinate +- `yu` - the upper y coordinate +- `zl` - the lower z coordinate +- `zu` - the upper z coordinate + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMDA` + +# External Links +$(_doc_external("DMDA/DMDASetVertexCoordinates")) +""" +function DMDASetVertexCoordinates(petsclib::PetscLibType, dm::PetscDM, xl::PetscReal, xu::PetscReal, yl::PetscReal, yu::PetscReal, zl::PetscReal, zu::PetscReal) end + +@for_petsc function DMDASetVertexCoordinates(petsclib::$UnionPetscLib, dm::PetscDM, xl::$PetscReal, xu::$PetscReal, yl::$PetscReal, yu::$PetscReal, zl::$PetscReal, zu::$PetscReal ) + + @chk ccall( + (:DMDASetVertexCoordinates, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + dm, xl, xu, yl, yu, zl, zu, + ) + + + return nothing +end + +""" + DMDAGetArray(petsclib::PetscLibType,da::PetscDM, ghosted::PetscBool, vptr::Cvoid) +Gets a work array for a `DMDA` + +Input Parameters: +- `da` - a `DMDA` +- `ghosted` - do you want arrays for the ghosted or nonghosted patch + +Output Parameter: +- `vptr` - array data structured + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDARestoreArray()` + +# External Links +$(_doc_external("DMDA/DMDAGetArray")) +""" +function DMDAGetArray(petsclib::PetscLibType, da::PetscDM, ghosted::PetscBool, vptr::Cvoid) end + +@for_petsc function DMDAGetArray(petsclib::$UnionPetscLib, da::PetscDM, ghosted::PetscBool, vptr::Cvoid ) + + @chk ccall( + (:DMDAGetArray, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, Ptr{Cvoid}), + da, ghosted, vptr, + ) + + + return nothing +end + +""" + DMDARestoreArray(petsclib::PetscLibType,da::PetscDM, ghosted::PetscBool, vptr::Cvoid) +Restores an array for a `DMDA` obtained with `DMDAGetArray()` + +Input Parameters: +- `da` - information about my local patch +- `ghosted` - do you want arrays for the ghosted or nonghosted patch +- `vptr` - array data structured + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetArray()` + +# External Links +$(_doc_external("DMDA/DMDARestoreArray")) +""" +function DMDARestoreArray(petsclib::PetscLibType, da::PetscDM, ghosted::PetscBool, vptr::Cvoid) end + +@for_petsc function DMDARestoreArray(petsclib::$UnionPetscLib, da::PetscDM, ghosted::PetscBool, vptr::Cvoid ) + + @chk ccall( + (:DMDARestoreArray, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, Ptr{Cvoid}), + da, ghosted, vptr, + ) + + + return nothing +end + +""" + DMDASetSizes(petsclib::PetscLibType,da::PetscDM, M::PetscInt, N::PetscInt, P::PetscInt) +Sets the number of grid points in the three dimensional directions + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` +- `M` - the global X size +- `N` - the global Y size +- `P` - the global Z size + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `PetscSplitOwnership()` + +# External Links +$(_doc_external("DMDA/DMDASetSizes")) +""" +function DMDASetSizes(petsclib::PetscLibType, da::PetscDM, M::PetscInt, N::PetscInt, P::PetscInt) end + +@for_petsc function DMDASetSizes(petsclib::$UnionPetscLib, da::PetscDM, M::$PetscInt, N::$PetscInt, P::$PetscInt ) + + @chk ccall( + (:DMDASetSizes, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt), + da, M, N, P, + ) + + + return nothing +end + +""" + DMDASetNumProcs(petsclib::PetscLibType,da::PetscDM, m::PetscInt, n::PetscInt, p::PetscInt) +Sets the number of processes in each dimension + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` +- `m` - the number of X processes (or `PETSC_DECIDE`) +- `n` - the number of Y processes (or `PETSC_DECIDE`) +- `p` - the number of Z processes (or `PETSC_DECIDE`) + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDASetSizes()`, `PetscSplitOwnership()` + +# External Links +$(_doc_external("DMDA/DMDASetNumProcs")) +""" +function DMDASetNumProcs(petsclib::PetscLibType, da::PetscDM, m::PetscInt, n::PetscInt, p::PetscInt) end + +@for_petsc function DMDASetNumProcs(petsclib::$UnionPetscLib, da::PetscDM, m::$PetscInt, n::$PetscInt, p::$PetscInt ) + + @chk ccall( + (:DMDASetNumProcs, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt), + da, m, n, p, + ) + + + return nothing +end + +""" + bx::DMBoundaryType,by::DMBoundaryType,bz::DMBoundaryType = DMDAGetBoundaryType(petsclib::PetscLibType,da::PetscDM) +Gets the type of ghost nodes on domain boundaries. + +Not Collective + +Input Parameter: +- `da` - The `DMDA` + +Output Parameters: +- `bx` - x boundary type, one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC` +- `by` - y boundary type, one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC` +- `bz` - z boundary type, one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC` + +Level: intermediate + +-seealso: [](sec_struct), `DMDASetBoundaryType()`, `DM`, `DMDA`, `DMDACreate()`, `DMDestroy()`, `DMBoundaryType`, `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC` + +# External Links +$(_doc_external("DMDA/DMDAGetBoundaryType")) +""" +function DMDAGetBoundaryType(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetBoundaryType(petsclib::$UnionPetscLib, da::PetscDM ) + bx_ = Ref{DMBoundaryType}() + by_ = Ref{DMBoundaryType}() + bz_ = Ref{DMBoundaryType}() + + @chk ccall( + (:DMDAGetBoundaryType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMBoundaryType}, Ptr{DMBoundaryType}, Ptr{DMBoundaryType}), + da, bx_, by_, bz_, + ) + + bx = bx_[] + by = by_[] + bz = bz_[] + + return bx,by,bz +end + +""" + DMDASetBoundaryType(petsclib::PetscLibType,da::PetscDM, bx::DMBoundaryType, by::DMBoundaryType, bz::DMBoundaryType) +Sets the type of ghost nodes on domain boundaries for a `DMDA` object. + +Not Collective + +Input Parameters: +- `da` - The `DMDA` +- `bx` - x boundary type, one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC` +- `by` - y boundary type, one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC` +- `bz` - z boundary type, one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC` + +Level: intermediate + +-seealso: [](sec_struct), `DMDAGetBoundaryType()`, `DM`, `DMDA`, `DMDACreate()`, `DMDestroy()`, `DMBoundaryType`, `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC` + +# External Links +$(_doc_external("DMDA/DMDASetBoundaryType")) +""" +function DMDASetBoundaryType(petsclib::PetscLibType, da::PetscDM, bx::DMBoundaryType, by::DMBoundaryType, bz::DMBoundaryType) end + +@for_petsc function DMDASetBoundaryType(petsclib::$UnionPetscLib, da::PetscDM, bx::DMBoundaryType, by::DMBoundaryType, bz::DMBoundaryType ) + + @chk ccall( + (:DMDASetBoundaryType, $petsc_library), + PetscErrorCode, + (CDM, DMBoundaryType, DMBoundaryType, DMBoundaryType), + da, bx, by, bz, + ) + + + return nothing +end + +""" + DMDASetDof(petsclib::PetscLibType,da::PetscDM, dof::PetscInt) +Sets the number of degrees of freedom per vertex + +Not Collective + +Input Parameters: +- `da` - The `DMDA` +- `dof` - Number of degrees of freedom per vertex + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetDof()`, `DMDACreate()`, `DMDestroy()` + +# External Links +$(_doc_external("DMDA/DMDASetDof")) +""" +function DMDASetDof(petsclib::PetscLibType, da::PetscDM, dof::PetscInt) end + +@for_petsc function DMDASetDof(petsclib::$UnionPetscLib, da::PetscDM, dof::$PetscInt ) + + @chk ccall( + (:DMDASetDof, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + da, dof, + ) + + + return nothing +end + +""" + dof::PetscInt = DMDAGetDof(petsclib::PetscLibType,da::PetscDM) +Gets the number of degrees of freedom per vertex + +Not Collective + +Input Parameter: +- `da` - The `DMDA` + +Output Parameter: +- `dof` - Number of degrees of freedom per vertex + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDASetDof()`, `DMDACreate()`, `DMDestroy()` + +# External Links +$(_doc_external("DMDA/DMDAGetDof")) +""" +function DMDAGetDof(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetDof(petsclib::$UnionPetscLib, da::PetscDM ) + dof_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetDof, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + da, dof_, + ) + + dof = dof_[] + + return dof +end + +""" + x::PetscInt,y::PetscInt,z::PetscInt = DMDAGetOverlap(petsclib::PetscLibType,da::PetscDM) +Gets the size of the per + +Not Collective + +Input Parameter: +- `da` - The `DMDA` + +Output Parameters: +- `x` - Overlap in the x direction +- `y` - Overlap in the y direction +- `z` - Overlap in the z direction + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateDomainDecomposition()`, `DMDASetOverlap()` + +# External Links +$(_doc_external("DMDA/DMDAGetOverlap")) +""" +function DMDAGetOverlap(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetOverlap(petsclib::$UnionPetscLib, da::PetscDM ) + x_ = Ref{$PetscInt}() + y_ = Ref{$PetscInt}() + z_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetOverlap, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, x_, y_, z_, + ) + + x = x_[] + y = y_[] + z = z_[] + + return x,y,z +end + +""" + DMDASetOverlap(petsclib::PetscLibType,da::PetscDM, x::PetscInt, y::PetscInt, z::PetscInt) +Sets the size of the per + +Not Collective + +Input Parameters: +- `da` - The `DMDA` +- `x` - Overlap in the x direction +- `y` - Overlap in the y direction +- `z` - Overlap in the z direction + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateDomainDecomposition()`, `DMDAGetOverlap()` + +# External Links +$(_doc_external("DMDA/DMDASetOverlap")) +""" +function DMDASetOverlap(petsclib::PetscLibType, da::PetscDM, x::PetscInt, y::PetscInt, z::PetscInt) end + +@for_petsc function DMDASetOverlap(petsclib::$UnionPetscLib, da::PetscDM, x::$PetscInt, y::$PetscInt, z::$PetscInt ) + + @chk ccall( + (:DMDASetOverlap, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt), + da, x, y, z, + ) + + + return nothing +end + +""" + Nsub::PetscInt = DMDAGetNumLocalSubDomains(petsclib::PetscLibType,da::PetscDM) +Gets the number of local subdomains that would be created upon decomposition. + +Not Collective + +Input Parameter: +- `da` - The `DMDA` + +Output Parameter: +- `Nsub` - Number of local subdomains created upon decomposition + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateDomainDecomposition()`, `DMDASetNumLocalSubDomains()` + +# External Links +$(_doc_external("DMDA/DMDAGetNumLocalSubDomains")) +""" +function DMDAGetNumLocalSubDomains(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetNumLocalSubDomains(petsclib::$UnionPetscLib, da::PetscDM ) + Nsub_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetNumLocalSubDomains, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + da, Nsub_, + ) + + Nsub = Nsub_[] + + return Nsub +end + +""" + DMDASetNumLocalSubDomains(petsclib::PetscLibType,da::PetscDM, Nsub::PetscInt) +Sets the number of local subdomains to create when decomposing with `DMCreateDomainDecomposition()` + +Not Collective + +Input Parameters: +- `da` - The `DMDA` +- `Nsub` - The number of local subdomains requested + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateDomainDecomposition()`, `DMDAGetNumLocalSubDomains()` + +# External Links +$(_doc_external("DMDA/DMDASetNumLocalSubDomains")) +""" +function DMDASetNumLocalSubDomains(petsclib::PetscLibType, da::PetscDM, Nsub::PetscInt) end + +@for_petsc function DMDASetNumLocalSubDomains(petsclib::$UnionPetscLib, da::PetscDM, Nsub::$PetscInt ) + + @chk ccall( + (:DMDASetNumLocalSubDomains, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + da, Nsub, + ) + + + return nothing +end + +""" + DMDASetOffset(petsclib::PetscLibType,da::PetscDM, xo::PetscInt, yo::PetscInt, zo::PetscInt, Mo::PetscInt, No::PetscInt, Po::PetscInt) +Sets the index offset of the `DMDA`. + +Collective + +Input Parameters: +- `da` - The `DMDA` +- `xo` - The offset in the x direction +- `yo` - The offset in the y direction +- `zo` - The offset in the z direction +- `Mo` - The problem offset in the x direction +- `No` - The problem offset in the y direction +- `Po` - The problem offset in the z direction + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetOffset()`, `DMDAVecGetArray()` + +# External Links +$(_doc_external("DMDA/DMDASetOffset")) +""" +function DMDASetOffset(petsclib::PetscLibType, da::PetscDM, xo::PetscInt, yo::PetscInt, zo::PetscInt, Mo::PetscInt, No::PetscInt, Po::PetscInt) end + +@for_petsc function DMDASetOffset(petsclib::$UnionPetscLib, da::PetscDM, xo::$PetscInt, yo::$PetscInt, zo::$PetscInt, Mo::$PetscInt, No::$PetscInt, Po::$PetscInt ) + + @chk ccall( + (:DMDASetOffset, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt), + da, xo, yo, zo, Mo, No, Po, + ) + + + return nothing +end + +""" + xo::PetscInt,yo::PetscInt,zo::PetscInt,Mo::PetscInt,No::PetscInt,Po::PetscInt = DMDAGetOffset(petsclib::PetscLibType,da::PetscDM) +Gets the index offset of the `DMDA`. + +Not Collective + +Input Parameter: +- `da` - The `DMDA` + +Output Parameters: +- `xo` - The offset in the x direction +- `yo` - The offset in the y direction +- `zo` - The offset in the z direction +- `Mo` - The global size in the x direction +- `No` - The global size in the y direction +- `Po` - The global size in the z direction + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDASetOffset()`, `DMDAVecGetArray()` + +# External Links +$(_doc_external("DMDA/DMDAGetOffset")) +""" +function DMDAGetOffset(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetOffset(petsclib::$UnionPetscLib, da::PetscDM ) + xo_ = Ref{$PetscInt}() + yo_ = Ref{$PetscInt}() + zo_ = Ref{$PetscInt}() + Mo_ = Ref{$PetscInt}() + No_ = Ref{$PetscInt}() + Po_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetOffset, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, xo_, yo_, zo_, Mo_, No_, Po_, + ) + + xo = xo_[] + yo = yo_[] + zo = zo_[] + Mo = Mo_[] + No = No_[] + Po = Po_[] + + return xo,yo,zo,Mo,No,Po +end + +""" + xs::PetscInt,ys::PetscInt,zs::PetscInt,xm::PetscInt,ym::PetscInt,zm::PetscInt = DMDAGetNonOverlappingRegion(petsclib::PetscLibType,da::PetscDM) +Gets the indices of the nonoverlapping region of a subdomain `DMDA`. + +Not Collective + +Input Parameter: +- `da` - The `DMDA` + +Output Parameters: +- `xs` - The start of the region in x +- `ys` - The start of the region in y +- `zs` - The start of the region in z +- `xm` - The size of the region in x +- `ym` - The size of the region in y +- `zm` - The size of the region in z + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetOffset()`, `DMDAVecGetArray()` + +# External Links +$(_doc_external("DMDA/DMDAGetNonOverlappingRegion")) +""" +function DMDAGetNonOverlappingRegion(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetNonOverlappingRegion(petsclib::$UnionPetscLib, da::PetscDM ) + xs_ = Ref{$PetscInt}() + ys_ = Ref{$PetscInt}() + zs_ = Ref{$PetscInt}() + xm_ = Ref{$PetscInt}() + ym_ = Ref{$PetscInt}() + zm_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetNonOverlappingRegion, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, xs_, ys_, zs_, xm_, ym_, zm_, + ) + + xs = xs_[] + ys = ys_[] + zs = zs_[] + xm = xm_[] + ym = ym_[] + zm = zm_[] + + return xs,ys,zs,xm,ym,zm +end + +""" + DMDASetNonOverlappingRegion(petsclib::PetscLibType,da::PetscDM, xs::PetscInt, ys::PetscInt, zs::PetscInt, xm::PetscInt, ym::PetscInt, zm::PetscInt) +Sets the indices of the nonoverlapping region of a subdomain `DMDA`. + +Collective + +Input Parameters: +- `da` - The `DMDA` +- `xs` - The start of the region in x +- `ys` - The start of the region in y +- `zs` - The start of the region in z +- `xm` - The size of the region in x +- `ym` - The size of the region in y +- `zm` - The size of the region in z + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetOffset()`, `DMDAVecGetArray()` + +# External Links +$(_doc_external("DMDA/DMDASetNonOverlappingRegion")) +""" +function DMDASetNonOverlappingRegion(petsclib::PetscLibType, da::PetscDM, xs::PetscInt, ys::PetscInt, zs::PetscInt, xm::PetscInt, ym::PetscInt, zm::PetscInt) end + +@for_petsc function DMDASetNonOverlappingRegion(petsclib::$UnionPetscLib, da::PetscDM, xs::$PetscInt, ys::$PetscInt, zs::$PetscInt, xm::$PetscInt, ym::$PetscInt, zm::$PetscInt ) + + @chk ccall( + (:DMDASetNonOverlappingRegion, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt), + da, xs, ys, zs, xm, ym, zm, + ) + + + return nothing +end + +""" + DMDASetStencilType(petsclib::PetscLibType,da::PetscDM, stype::DMDAStencilType) +Sets the type of the communication stencil + +Logically Collective + +Input Parameters: +- `da` - The `DMDA` +- `stype` - The stencil type, use either `DMDA_STENCIL_BOX` or `DMDA_STENCIL_STAR`. + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDACreate()`, `DMDestroy()`, `DMDAStencilType`, `DMDA_STENCIL_BOX`, `DMDA_STENCIL_STAR.` + +# External Links +$(_doc_external("DMDA/DMDASetStencilType")) +""" +function DMDASetStencilType(petsclib::PetscLibType, da::PetscDM, stype::DMDAStencilType) end + +@for_petsc function DMDASetStencilType(petsclib::$UnionPetscLib, da::PetscDM, stype::DMDAStencilType ) + + @chk ccall( + (:DMDASetStencilType, $petsc_library), + PetscErrorCode, + (CDM, DMDAStencilType), + da, stype, + ) + + + return nothing +end + +""" + stype::DMDAStencilType = DMDAGetStencilType(petsclib::PetscLibType,da::PetscDM) +Gets the type of the communication stencil + +Not Collective + +Input Parameter: +- `da` - The `DMDA` + +Output Parameter: +- `stype` - The stencil type, use either `DMDA_STENCIL_BOX` or `DMDA_STENCIL_STAR`. + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDACreate()`, `DMDestroy()`, `DMDAStencilType`, `DMDA_STENCIL_BOX`, `DMDA_STENCIL_STAR.` + +# External Links +$(_doc_external("DMDA/DMDAGetStencilType")) +""" +function DMDAGetStencilType(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetStencilType(petsclib::$UnionPetscLib, da::PetscDM ) + stype_ = Ref{DMDAStencilType}() + + @chk ccall( + (:DMDAGetStencilType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMDAStencilType}), + da, stype_, + ) + + stype = stype_[] + + return stype +end + +""" + DMDASetStencilWidth(petsclib::PetscLibType,da::PetscDM, width::PetscInt) +Sets the width of the communication stencil + +Logically Collective + +Input Parameters: +- `da` - The `DMDA` +- `width` - The stencil width + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDACreate()`, `DMDestroy()`, `DMDAStencilType`, `DMDA_STENCIL_BOX`, `DMDA_STENCIL_STAR.` + +# External Links +$(_doc_external("DMDA/DMDASetStencilWidth")) +""" +function DMDASetStencilWidth(petsclib::PetscLibType, da::PetscDM, width::PetscInt) end + +@for_petsc function DMDASetStencilWidth(petsclib::$UnionPetscLib, da::PetscDM, width::$PetscInt ) + + @chk ccall( + (:DMDASetStencilWidth, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + da, width, + ) + + + return nothing +end + +""" + width::PetscInt = DMDAGetStencilWidth(petsclib::PetscLibType,da::PetscDM) +Gets the width of the communication stencil + +Not Collective + +Input Parameter: +- `da` - The `DMDA` + +Output Parameter: +- `width` - The stencil width + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDACreate()`, `DMDestroy()`, `DMDAStencilType`, `DMDA_STENCIL_BOX`, `DMDA_STENCIL_STAR.` + +# External Links +$(_doc_external("DMDA/DMDAGetStencilWidth")) +""" +function DMDAGetStencilWidth(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetStencilWidth(petsclib::$UnionPetscLib, da::PetscDM ) + width_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetStencilWidth, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + da, width_, + ) + + width = width_[] + + return width +end + +""" + DMDASetOwnershipRanges(petsclib::PetscLibType,da::PetscDM, lx::Vector{PetscInt}, ly::Vector{PetscInt}, lz::Vector{PetscInt}) +Sets the number of nodes in each direction on each process + +Logically Collective + +Input Parameters: +- `da` - The `DMDA` +- `lx` - array containing number of nodes in the X direction on each process, or `NULL`. If non-null, must be of length da->m +- `ly` - array containing number of nodes in the Y direction on each process, or `NULL`. If non-null, must be of length da->n +- `lz` - array containing number of nodes in the Z direction on each process, or `NULL`. If non-null, must be of length da->p. + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDACreate()`, `DMDestroy()` + +# External Links +$(_doc_external("DMDA/DMDASetOwnershipRanges")) +""" +function DMDASetOwnershipRanges(petsclib::PetscLibType, da::PetscDM, lx::Vector{PetscInt}, ly::Vector{PetscInt}, lz::Vector{PetscInt}) end + +@for_petsc function DMDASetOwnershipRanges(petsclib::$UnionPetscLib, da::PetscDM, lx::Vector{$PetscInt}, ly::Vector{$PetscInt}, lz::Vector{$PetscInt} ) + + @chk ccall( + (:DMDASetOwnershipRanges, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, lx, ly, lz, + ) + + + return nothing +end + +""" + DMDASetInterpolationType(petsclib::PetscLibType,da::PetscDM, ctype::DMDAInterpolationType) +Sets the type of interpolation that will be +returned by `DMCreateInterpolation()` + +Logically Collective + +Input Parameters: +- `da` - initial distributed array +- `ctype` - `DMDA_Q1` and `DMDA_Q0` are currently the only supported forms + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMDestroy()`, `DMDAInterpolationType`, +`DMDA_Q1`, `DMDA_Q0` + +# External Links +$(_doc_external("DMDA/DMDASetInterpolationType")) +""" +function DMDASetInterpolationType(petsclib::PetscLibType, da::PetscDM, ctype::DMDAInterpolationType) end + +@for_petsc function DMDASetInterpolationType(petsclib::$UnionPetscLib, da::PetscDM, ctype::DMDAInterpolationType ) + + @chk ccall( + (:DMDASetInterpolationType, $petsc_library), + PetscErrorCode, + (CDM, DMDAInterpolationType), + da, ctype, + ) + + + return nothing +end + +""" + ctype::DMDAInterpolationType = DMDAGetInterpolationType(petsclib::PetscLibType,da::PetscDM) +Gets the type of interpolation that will be +used by `DMCreateInterpolation()` + +Not Collective + +Input Parameter: +- `da` - distributed array + +Output Parameter: +- `ctype` - interpolation type (`DMDA_Q1` and `DMDA_Q0` are currently the only supported forms) + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAInterpolationType`, `DMDASetInterpolationType()`, `DMCreateInterpolation()`, +`DMDA_Q1`, `DMDA_Q0` + +# External Links +$(_doc_external("DMDA/DMDAGetInterpolationType")) +""" +function DMDAGetInterpolationType(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetInterpolationType(petsclib::$UnionPetscLib, da::PetscDM ) + ctype_ = Ref{DMDAInterpolationType}() + + @chk ccall( + (:DMDAGetInterpolationType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMDAInterpolationType}), + da, ctype_, + ) + + ctype = ctype_[] + + return ctype +end + +""" + DMDAGetNeighbors(petsclib::PetscLibType,da::PetscDM, ranks::Vector{PetscMPIInt}) +Gets an array containing the MPI rank of all the current +processes neighbors. + +Not Collective + +Input Parameter: +- `da` - the `DMDA` object + +Output Parameter: +- `ranks` - the neighbors ranks, stored with the x index increasing most rapidly. The process itself is in the list + +Level: intermediate + +-seealso: [](sec_struct), `DMDA`, `DM` + +# External Links +$(_doc_external("DMDA/DMDAGetNeighbors")) +""" +function DMDAGetNeighbors(petsclib::PetscLibType, da::PetscDM, ranks::Vector{PetscMPIInt}) end + +@for_petsc function DMDAGetNeighbors(petsclib::$UnionPetscLib, da::PetscDM, ranks::Vector{PetscMPIInt} ) + ranks_ = Ref(pointer(ranks)) + + @chk ccall( + (:DMDAGetNeighbors, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{PetscMPIInt}}), + da, ranks_, + ) + + + return nothing +end + +""" + lx::Vector{PetscInt},ly::Vector{PetscInt},lz::Vector{PetscInt} = DMDAGetOwnershipRanges(petsclib::PetscLibType,da::PetscDM) +Gets the number of indices in the x, y and z direction that are owned by each process in that direction + +Not Collective + +Input Parameter: +- `da` - the `DMDA` object + +Output Parameters: +- `lx` - ownership along x direction (optional), its length is `m` the number of processes in the x-direction +- `ly` - ownership along y direction (optional), its length is `n` the number of processes in the y-direction +- `lz` - ownership along z direction (optional), its length is `p` the number of processes in the z-direction + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetCorners()`, `DMDAGetGhostCorners()`, `DMDACreate()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `VecGetOwnershipRanges()` + +# External Links +$(_doc_external("DMDA/DMDAGetOwnershipRanges")) +""" +function DMDAGetOwnershipRanges(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetOwnershipRanges(petsclib::$UnionPetscLib, da::PetscDM ) + lx_ = Ref{Ptr{$PetscInt}}() + ly_ = Ref{Ptr{$PetscInt}}() + lz_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMDAGetOwnershipRanges, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + da, lx_, ly_, lz_, + ) + + lx = unsafe_wrap(Array, lx_[], VecGetLocalSize(petsclib, x); own = false) + ly = unsafe_wrap(Array, ly_[], VecGetLocalSize(petsclib, x); own = false) + lz = unsafe_wrap(Array, lz_[], VecGetLocalSize(petsclib, x); own = false) + + return lx,ly,lz +end + +""" + DMDASetRefinementFactor(petsclib::PetscLibType,da::PetscDM, refine_x::PetscInt, refine_y::PetscInt, refine_z::PetscInt) +Set the ratios that the `DMDA` grid is refined + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` object +- `refine_x` - ratio of fine grid to coarse in x direction (2 by default) +- `refine_y` - ratio of fine grid to coarse in y direction (2 by default) +- `refine_z` - ratio of fine grid to coarse in z direction (2 by default) + +Options Database Keys: +- `-da_refine_x refine_x` - refinement ratio in x direction +- `-da_refine_y rafine_y` - refinement ratio in y direction +- `-da_refine_z refine_z` - refinement ratio in z direction +- `-da_refine ` - refine the `DMDA` object n times when it is created. + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMRefine()`, `DMDAGetRefinementFactor()` + +# External Links +$(_doc_external("DMDA/DMDASetRefinementFactor")) +""" +function DMDASetRefinementFactor(petsclib::PetscLibType, da::PetscDM, refine_x::PetscInt, refine_y::PetscInt, refine_z::PetscInt) end + +@for_petsc function DMDASetRefinementFactor(petsclib::$UnionPetscLib, da::PetscDM, refine_x::$PetscInt, refine_y::$PetscInt, refine_z::$PetscInt ) + + @chk ccall( + (:DMDASetRefinementFactor, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt), + da, refine_x, refine_y, refine_z, + ) + + + return nothing +end + +""" + refine_x::PetscInt,refine_y::PetscInt,refine_z::PetscInt = DMDAGetRefinementFactor(petsclib::PetscLibType,da::PetscDM) +Gets the ratios that the `DMDA` grid is refined + +Not Collective + +Input Parameter: +- `da` - the `DMDA` object + +Output Parameters: +- `refine_x` - ratio of fine grid to coarse in x direction (2 by default) +- `refine_y` - ratio of fine grid to coarse in y direction (2 by default) +- `refine_z` - ratio of fine grid to coarse in z direction (2 by default) + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMRefine()`, `DMDASetRefinementFactor()` + +# External Links +$(_doc_external("DMDA/DMDAGetRefinementFactor")) +""" +function DMDAGetRefinementFactor(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetRefinementFactor(petsclib::$UnionPetscLib, da::PetscDM ) + refine_x_ = Ref{$PetscInt}() + refine_y_ = Ref{$PetscInt}() + refine_z_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetRefinementFactor, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, refine_x_, refine_y_, refine_z_, + ) + + refine_x = refine_x_[] + refine_y = refine_y_[] + refine_z = refine_z_[] + + return refine_x,refine_y,refine_z +end + +""" + DMDASetGetMatrix(petsclib::PetscLibType,da::PetscDM, f::external) +Sets the routine used by the `DMDA` to allocate a matrix. + +Logically Collective; No Fortran Support + +Input Parameters: +- `da` - the `DMDA` object +- `f` - the function that allocates the matrix for that specific `DMDA` + +Calling sequence of `f`: +- `da` - the `DMDA` object +- `A` - the created matrix + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateMatrix()`, `DMDASetBlockFills()` + +# External Links +$(_doc_external("DMDA/DMDASetGetMatrix")) +""" +function DMDASetGetMatrix(petsclib::PetscLibType, da::PetscDM, f::external) end + +@for_petsc function DMDASetGetMatrix(petsclib::$UnionPetscLib, da::PetscDM, f::external ) + + @chk ccall( + (:DMDASetGetMatrix, $petsc_library), + PetscErrorCode, + (CDM, external), + da, f, + ) + + + return nothing +end + +""" + gidxm::Vector{PetscInt} = DMDAMapMatStencilToGlobal(petsclib::PetscLibType,da::PetscDM, m::PetscInt, idxm::Vector{MatStencil}) +Map a list of `MatStencil` on a grid to global indices. + +Not Collective + +Input Parameters: +- `da` - the `DMDA` object +- `m` - number of `MatStencil` to map +- `idxm` - grid points (and component number when dof > 1) + +Output Parameter: +- `gidxm` - global row indices + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `MatStencil` + +# External Links +$(_doc_external("DMDA/DMDAMapMatStencilToGlobal")) +""" +function DMDAMapMatStencilToGlobal(petsclib::PetscLibType, da::PetscDM, m::PetscInt, idxm::Vector{MatStencil}) end + +@for_petsc function DMDAMapMatStencilToGlobal(petsclib::$UnionPetscLib, da::PetscDM, m::$PetscInt, idxm::Vector{MatStencil} ) + gidxm = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMDAMapMatStencilToGlobal, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{MatStencil}, Ptr{$PetscInt}), + da, m, idxm, gidxm, + ) + + + return gidxm +end + +""" + nodes::PetscReal = DMDASetGLLCoordinates(petsclib::PetscLibType,da::PetscDM, n::PetscInt) + +# External Links +$(_doc_external("DMDA/DMDASetGLLCoordinates")) +""" +function DMDASetGLLCoordinates(petsclib::PetscLibType, da::PetscDM, n::PetscInt) end + +@for_petsc function DMDASetGLLCoordinates(petsclib::$UnionPetscLib, da::PetscDM, n::$PetscInt ) + nodes_ = Ref{$PetscReal}() + + @chk ccall( + (:DMDASetGLLCoordinates, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscReal}), + da, n, nodes_, + ) + + nodes = nodes_[] + + return nodes +end + +""" + is::IS = DMDACreatePatchIS(petsclib::PetscLibType,da::PetscDM, lower::MatStencil, upper::MatStencil, offproc::PetscBool) +Creates an index set corresponding to a logically rectangular patch of the `DMDA`. + +Collective + +Input Parameters: +- `da` - the `DMDA` +- `lower` - a `MatStencil` with i, j and k entries corresponding to the lower corner of the patch +- `upper` - a `MatStencil` with i, j and k entries corresponding to the upper corner of the patch +- `offproc` - indicate whether the returned `IS` will contain off process indices + +Output Parameter: +- `is` - the `IS` corresponding to the patch + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateDomainDecomposition()`, `DMCreateDomainDecompositionScatters()` + +# External Links +$(_doc_external("DMDA/DMDACreatePatchIS")) +""" +function DMDACreatePatchIS(petsclib::PetscLibType, da::PetscDM, lower::MatStencil, upper::MatStencil, offproc::PetscBool) end + +@for_petsc function DMDACreatePatchIS(petsclib::$UnionPetscLib, da::PetscDM, lower::MatStencil, upper::MatStencil, offproc::PetscBool ) + is_ = Ref{IS}() + + @chk ccall( + (:DMDACreatePatchIS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{MatStencil}, Ptr{MatStencil}, Ptr{CIS}, PetscBool), + da, lower, upper, is_, offproc, + ) + + is = is_[] + + return is +end + +""" + pf::PF = DMDACreatePF(petsclib::PetscLibType,da::PetscDM) +Creates an appropriately dimensioned `PF` mathematical function object +from a `DMDA`. + +Collective; No Fortran Support + +Input Parameter: +- `da` - initial distributed array + +Output Parameter: +- `pf` - the mathematical function object + +Level: advanced + +-seealso: `DM`, `PF`, `DMDA`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMDestroy()`, `DMCreateGlobalVector()` + +# External Links +$(_doc_external("DMDA/DMDACreatePF")) +""" +function DMDACreatePF(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDACreatePF(petsclib::$UnionPetscLib, da::PetscDM ) + pf_ = Ref{CPF}() + + @chk ccall( + (:DMDACreatePF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CPF}), + da, pf_, + ) + + pf = pf_[] + + return pf +end + +""" + DMDAVTKWriteAll(petsclib::PetscLibType,odm::PetscObject, viewer::PetscViewer) +Write a file containing all the fields that have been provided to the viewer + +Collective + +Input Parameters: +- `odm` - `DMDA` specifying the grid layout, passed as a `PetscObject` +- `viewer` - viewer of type `PETSCVIEWERVTK` + +Level: developer + +-seealso: [](sec_struct), `DMDA`, `DM`, `PETSCVIEWERVTK`, `DMDASetFieldName()` + +# External Links +$(_doc_external("DMDA/DMDAVTKWriteAll")) +""" +function DMDAVTKWriteAll(petsclib::PetscLibType, odm::PetscObject, viewer::PetscViewer) end + +@for_petsc function DMDAVTKWriteAll(petsclib::$UnionPetscLib, odm::PetscObject, viewer::PetscViewer ) + + @chk ccall( + (:DMDAVTKWriteAll, $petsc_library), + PetscErrorCode, + (PetscObject, PetscViewer), + odm, viewer, + ) + + + return nothing +end + +""" + da::PetscDM = DMDACreate3d(petsclib::PetscLibType,comm::MPI_Comm, bx::DMBoundaryType, by::DMBoundaryType, bz::DMBoundaryType, stencil_type::DMDAStencilType, M::PetscInt, N::PetscInt, P::PetscInt, m::PetscInt, n::PetscInt, p::PetscInt, dof::PetscInt, s::PetscInt, lx::Vector{PetscInt}, ly::Vector{PetscInt}, lz::Vector{PetscInt}) +Creates an object that will manage the communication of three +regular array data that is distributed across one or more MPI processes. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bx` - type of x ghost nodes the array have. Use one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC`. +- `by` - type of y ghost nodes the array have. Use one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC`. +- `bz` - type of z ghost nodes the array have. Use one of `DM_BOUNDARY_NONE`, `DM_BOUNDARY_GHOSTED`, `DM_BOUNDARY_PERIODIC`. +- `stencil_type` - Type of stencil (`DMDA_STENCIL_STAR` or `DMDA_STENCIL_BOX`) +- `M` - global dimension in x direction of the array +- `N` - global dimension in y direction of the array +- `P` - global dimension in z direction of the array +- `m` - corresponding number of processors in x dimension (or `PETSC_DECIDE` to have calculated) +- `n` - corresponding number of processors in y dimension (or `PETSC_DECIDE` to have calculated) +- `p` - corresponding number of processors in z dimension (or `PETSC_DECIDE` to have calculated) +- `dof` - number of degrees of freedom per node +- `s` - stencil width +- `lx` - arrays containing the number of nodes in each cell along the x coordinates, or `NULL`. +- `ly` - arrays containing the number of nodes in each cell along the y coordinates, or `NULL`. +- `lz` - arrays containing the number of nodes in each cell along the z coordinates, or `NULL`. + +Output Parameter: +- `da` - the resulting distributed array object + +Options Database Keys: +- `-dm_view` - Calls `DMView()` at the conclusion of `DMDACreate3d()` +- `-da_grid_x ` - number of grid points in x direction +- `-da_grid_y ` - number of grid points in y direction +- `-da_grid_z ` - number of grid points in z direction +- `-da_processors_x ` - number of processors in x direction +- `-da_processors_y ` - number of processors in y direction +- `-da_processors_z ` - number of processors in z direction +- `-da_bd_x ` - boundary type in x direction +- `-da_bd_y ` - boundary type in y direction +- `-da_bd_z ` - boundary type in x direction +- `-da_bd_all ` - boundary type in all directions +- `-da_refine_x ` - refinement ratio in x direction +- `-da_refine_y ` - refinement ratio in y direction +- `-da_refine_z ` - refinement ratio in z directio +- `-da_refine ` - refine the `DMDA` n times before creating it + +Level: beginner + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDestroy()`, `DMView()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMGlobalToLocalBegin()`, `DMDAGetRefinementFactor()`, +`DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`, `DMLocalToLocalBegin()`, `DMLocalToLocalEnd()`, `DMDASetRefinementFactor()`, +`DMDAGetInfo()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()`, `DMDACreateNaturalVector()`, `DMLoad()`, `DMDAGetOwnershipRanges()`, +`DMStagCreate3d()`, `DMBoundaryType` + +# External Links +$(_doc_external("DMDA/DMDACreate3d")) +""" +function DMDACreate3d(petsclib::PetscLibType, comm::MPI_Comm, bx::DMBoundaryType, by::DMBoundaryType, bz::DMBoundaryType, stencil_type::DMDAStencilType, M::PetscInt, N::PetscInt, P::PetscInt, m::PetscInt, n::PetscInt, p::PetscInt, dof::PetscInt, s::PetscInt, lx::Union{Ptr, Vector{PetscInt}}, ly::Union{Ptr, Vector{PetscInt}}, lz::Union{Ptr, Vector{PetscInt}}) end + +@for_petsc function DMDACreate3d(petsclib::$UnionPetscLib, comm::MPI_Comm, bx::DMBoundaryType, by::DMBoundaryType, bz::DMBoundaryType, stencil_type::DMDAStencilType, M::$PetscInt, N::$PetscInt, P::$PetscInt, m::$PetscInt, n::$PetscInt, p::$PetscInt, dof::$PetscInt, s::$PetscInt, lx::Union{Ptr, Vector{$PetscInt}}, ly::Union{Ptr, Vector{$PetscInt}}, lz::Union{Ptr, Vector{$PetscInt}} ) + da_ = Ref{CDM}() + + @chk ccall( + (:DMDACreate3d, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMBoundaryType, DMBoundaryType, DMBoundaryType, DMDAStencilType, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{CDM}), + comm, bx, by, bz, stencil_type, M, N, P, m, n, p, dof, s, lx, ly, lz, da_, + ) + + da = PetscDM(da_[], petsclib) + + return da +end + +""" + DMDASetBlockFills(petsclib::PetscLibType,da::PetscDM, dfill::PetscInt, ofill::PetscInt) +Sets the fill pattern in each block for a multi +of the matrix returned by `DMCreateMatrix()`. + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` +- `dfill` - the fill pattern in the diagonal block (may be `NULL`, means use dense block) +- `ofill` - the fill pattern in the off-diagonal blocks + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateMatrix()`, `DMDASetGetMatrix()`, `DMSetMatrixPreallocateOnly()`, `DMDASetBlockFillsSparse()` + +# External Links +$(_doc_external("DMDA/DMDASetBlockFills")) +""" +function DMDASetBlockFills(petsclib::PetscLibType, da::PetscDM, dfill::PetscInt, ofill::PetscInt) end + +@for_petsc function DMDASetBlockFills(petsclib::$UnionPetscLib, da::PetscDM, dfill::$PetscInt, ofill::$PetscInt ) + + @chk ccall( + (:DMDASetBlockFills, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, dfill, ofill, + ) + + + return nothing +end + +""" + DMDASetBlockFillsSparse(petsclib::PetscLibType,da::PetscDM, dfillsparse::PetscInt, ofillsparse::PetscInt) +Sets the fill pattern in each block for a multi +of the matrix returned by `DMCreateMatrix()`, using sparse representations +of fill patterns. + +Logically Collective + +Input Parameters: +- `da` - the `DMDA` +- `dfillsparse` - the sparse fill pattern in the diagonal block (may be `NULL`, means use dense block) +- `ofillsparse` - the sparse fill pattern in the off-diagonal blocks + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDASetBlockFills()`, `DMCreateMatrix()`, `DMDASetGetMatrix()`, `DMSetMatrixPreallocateOnly()` + +# External Links +$(_doc_external("DMDA/DMDASetBlockFillsSparse")) +""" +function DMDASetBlockFillsSparse(petsclib::PetscLibType, da::PetscDM, dfillsparse::PetscInt, ofillsparse::PetscInt) end + +@for_petsc function DMDASetBlockFillsSparse(petsclib::$UnionPetscLib, da::PetscDM, dfillsparse::$PetscInt, ofillsparse::$PetscInt ) + + @chk ccall( + (:DMDASetBlockFillsSparse, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, dfillsparse, ofillsparse, + ) + + + return nothing +end + +""" + DMDASetFieldName(petsclib::PetscLibType,da::PetscDM, nf::PetscInt, name::String) +Sets the names of individual field components in multicomponent +vectors associated with a `DMDA`. + +Logically Collective; name must contain a common value + +Input Parameters: +- `da` - the `DMDA` +- `nf` - field number for the `DMDA` (0, 1, ... dof-1), where dof indicates the +number of degrees of freedom per node within the `DMDA` +- `name` - the name of the field (component) + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetFieldName()`, `DMDASetCoordinateName()`, `DMDAGetCoordinateName()`, `DMDASetFieldNames()`, `DMSetUp()` + +# External Links +$(_doc_external("DMDA/DMDASetFieldName")) +""" +function DMDASetFieldName(petsclib::PetscLibType, da::PetscDM, nf::PetscInt, name::String) end + +@for_petsc function DMDASetFieldName(petsclib::$UnionPetscLib, da::PetscDM, nf::$PetscInt, name::String ) + + @chk ccall( + (:DMDASetFieldName, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Cchar}), + da, nf, name, + ) + + + return nothing +end + +""" + DMDAGetFieldNames(petsclib::PetscLibType,da::PetscDM, names::Cchar) +Gets the name of all the components in the vector associated with the `DMDA` + +Not Collective; names will contain a common value; No Fortran Support + +Input Parameter: +- `da` - the `DMDA` object + +Output Parameter: +- `names` - the names of the components, final string is `NULL`, will have the same number of entries as the dof used in creating the `DMDA` + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetFieldName()`, `DMDASetCoordinateName()`, `DMDAGetCoordinateName()`, `DMDASetFieldName()`, `DMDASetFieldNames()` + +# External Links +$(_doc_external("DMDA/DMDAGetFieldNames")) +""" +function DMDAGetFieldNames(petsclib::PetscLibType, da::PetscDM, names::Cchar) end + +@for_petsc function DMDAGetFieldNames(petsclib::$UnionPetscLib, da::PetscDM, names::Cchar ) + + @chk ccall( + (:DMDAGetFieldNames, $petsc_library), + PetscErrorCode, + (CDM, Cchar), + da, names, + ) + + + return nothing +end + +""" + DMDASetFieldNames(petsclib::PetscLibType,da::PetscDM, names::String) +Sets the name of each component in the vector associated with the `DMDA` + +Logically Collective; names must contain a common value; No Fortran Support + +Input Parameters: +- `da` - the `DMDA` object +- `names` - the names of the components, final string must be `NULL`, must have the same number of entries as the dof used in creating the `DMDA` + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetFieldName()`, `DMDASetCoordinateName()`, `DMDAGetCoordinateName()`, `DMDASetFieldName()`, `DMSetUp()` + +# External Links +$(_doc_external("DMDA/DMDASetFieldNames")) +""" +function DMDASetFieldNames(petsclib::PetscLibType, da::PetscDM, names::String) end + +@for_petsc function DMDASetFieldNames(petsclib::$UnionPetscLib, da::PetscDM, names::String ) + names_ = Ref(pointer(names)) + + @chk ccall( + (:DMDASetFieldNames, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{Cchar}}), + da, names_, + ) + + + return nothing +end + +""" + DMDAGetFieldName(petsclib::PetscLibType,da::PetscDM, nf::PetscInt, name::String) +Gets the names of individual field components in multicomponent +vectors associated with a `DMDA`. + +Not Collective; name will contain a common value + +Input Parameters: +- `da` - the `DMDA` +- `nf` - field number for the `DMDA` (0, 1, ... dof-1), where dof indicates the +number of degrees of freedom per node within the `DMDA` + +Output Parameter: +- `name` - the name of the field (component) + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDASetFieldName()`, `DMDASetCoordinateName()`, `DMDAGetCoordinateName()`, `DMSetUp()` + +# External Links +$(_doc_external("DMDA/DMDAGetFieldName")) +""" +function DMDAGetFieldName(petsclib::PetscLibType, da::PetscDM, nf::PetscInt, name::String) end + +@for_petsc function DMDAGetFieldName(petsclib::$UnionPetscLib, da::PetscDM, nf::$PetscInt, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:DMDAGetFieldName, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}), + da, nf, name_, + ) + + + return nothing +end + +""" + DMDASetCoordinateName(petsclib::PetscLibType,dm::PetscDM, nf::PetscInt, name::String) +Sets the name of the coordinate directions associated with a `DMDA`, for example "x" or "y" + +Logically Collective; name must contain a common value; No Fortran Support + +Input Parameters: +- `dm` - the `DMDA` +- `nf` - coordinate number for the `DMDA` (0, 1, ... dim-1), +- `name` - the name of the coordinate + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetCoordinateName()`, `DMDASetFieldName()`, `DMDAGetFieldName()`, `DMSetUp()` + +# External Links +$(_doc_external("DMDA/DMDASetCoordinateName")) +""" +function DMDASetCoordinateName(petsclib::PetscLibType, dm::PetscDM, nf::PetscInt, name::String) end + +@for_petsc function DMDASetCoordinateName(petsclib::$UnionPetscLib, dm::PetscDM, nf::$PetscInt, name::String ) + + @chk ccall( + (:DMDASetCoordinateName, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Cchar}), + dm, nf, name, + ) + + + return nothing +end + +""" + DMDAGetCoordinateName(petsclib::PetscLibType,dm::PetscDM, nf::PetscInt, name::String) +Gets the name of a coordinate direction associated with a `DMDA`. + +Not Collective; name will contain a common value; No Fortran Support + +Input Parameters: +- `dm` - the `DMDA` +- `nf` - number for the `DMDA` (0, 1, ... dim-1) + +Output Parameter: +- `name` - the name of the coordinate direction + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDASetCoordinateName()`, `DMDASetFieldName()`, `DMDAGetFieldName()`, `DMSetUp()` + +# External Links +$(_doc_external("DMDA/DMDAGetCoordinateName")) +""" +function DMDAGetCoordinateName(petsclib::PetscLibType, dm::PetscDM, nf::PetscInt, name::String) end + +@for_petsc function DMDAGetCoordinateName(petsclib::$UnionPetscLib, dm::PetscDM, nf::$PetscInt, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:DMDAGetCoordinateName, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}), + dm, nf, name_, + ) + + + return nothing +end + +""" + x::PetscInt,y::PetscInt,z::PetscInt,m::PetscInt,n::PetscInt,p::PetscInt = DMDAGetCorners(petsclib::PetscLibType,da::PetscDM) +Returns the global (`x`,`y`,`z`) indices of the lower left +corner and size of the local region, excluding ghost points. + +Not Collective + +Input Parameter: +- `da` - the `DMDA` + +Output Parameters: +- `x` - the corner index for the first dimension +- `y` - the corner index for the second dimension (only used in 2D and 3D problems) +- `z` - the corner index for the third dimension (only used in 3D problems) +- `m` - the width in the first dimension +- `n` - the width in the second dimension (only used in 2D and 3D problems) +- `p` - the width in the third dimension (only used in 3D problems) + +Level: beginner + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMDAGetOwnershipRanges()`, `DMStagGetCorners()`, `DMSTAG` + +# External Links +$(_doc_external("DMDA/DMDAGetCorners")) +""" +function DMDAGetCorners(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetCorners(petsclib::$UnionPetscLib, da::PetscDM ) + x_ = Ref{$PetscInt}() + y_ = Ref{$PetscInt}() + z_ = Ref{$PetscInt}() + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + p_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetCorners, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, x_, y_, z_, m_, n_, p_, + ) + + x = x_[] + y = y_[] + z = z_[] + m = m_[] + n = n_[] + p = p_[] + + return x,y,z,m,n,p +end + +""" + nda::PetscDM = DMDACreateCompatibleDMDA(petsclib::PetscLibType,da::PetscDM, nfields::PetscInt) +Creates a `DMDA` with the same layout as given `DMDA` but with fewer or more fields + +Collective + +Input Parameters: +- `da` - the `DMDA` +- `nfields` - number of fields in new `DMDA` + +Output Parameter: +- `nda` - the new `DMDA` + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetGhostCorners()`, `DMSetCoordinates()`, `DMDASetUniformCoordinates()`, `DMGetCoordinates()`, `DMDAGetGhostedCoordinates()`, +`DMStagCreateCompatibleDMStag()` + +# External Links +$(_doc_external("DMDA/DMDACreateCompatibleDMDA")) +""" +function DMDACreateCompatibleDMDA(petsclib::PetscLibType, da::PetscDM, nfields::PetscInt) end + +@for_petsc function DMDACreateCompatibleDMDA(petsclib::$UnionPetscLib, da::PetscDM, nfields::$PetscInt ) + nda_ = Ref{CDM}() + + @chk ccall( + (:DMDACreateCompatibleDMDA, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CDM}), + da, nfields, nda_, + ) + + nda = PetscDM(nda_[], petsclib) + + return nda +end + +""" + DMDAGetCoordinateArray(petsclib::PetscLibType,dm::PetscDM, xc::Cvoid) +Gets an array containing the coordinates of the `DMDA` + +Not Collective; No Fortran Support + +Input Parameter: +- `dm` - the `DMDA` + +Output Parameter: +- `xc` - the coordinates + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDASetCoordinateName()`, `DMDASetFieldName()`, `DMDAGetFieldName()`, `DMDARestoreCoordinateArray()` + +# External Links +$(_doc_external("DMDA/DMDAGetCoordinateArray")) +""" +function DMDAGetCoordinateArray(petsclib::PetscLibType, dm::PetscDM, xc::Cvoid) end + +@for_petsc function DMDAGetCoordinateArray(petsclib::$UnionPetscLib, dm::PetscDM, xc::Cvoid ) + + @chk ccall( + (:DMDAGetCoordinateArray, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cvoid}), + dm, xc, + ) + + + return nothing +end + +""" + DMDARestoreCoordinateArray(petsclib::PetscLibType,dm::PetscDM, xc::Cvoid) +Returns an array containing the coordinates of the `DMDA` obtained with `DMDAGetCoordinateArray()` + +Not Collective; No Fortran Support + +Input Parameters: +- `dm` - the `DMDA` +- `xc` - the coordinates + +Level: intermediate + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDASetCoordinateName()`, `DMDASetFieldName()`, `DMDAGetFieldName()`, `DMDAGetCoordinateArray()` + +# External Links +$(_doc_external("DMDA/DMDARestoreCoordinateArray")) +""" +function DMDARestoreCoordinateArray(petsclib::PetscLibType, dm::PetscDM, xc::Cvoid) end + +@for_petsc function DMDARestoreCoordinateArray(petsclib::$UnionPetscLib, dm::PetscDM, xc::Cvoid ) + + @chk ccall( + (:DMDARestoreCoordinateArray, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cvoid}), + dm, xc, + ) + + + return nothing +end + +""" + da::PetscDM = DMDACreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a `DMDA` object for managing structured grids. + +Collective + +Input Parameter: +- `comm` - The communicator for the `DMDA` object + +Output Parameter: +- `da` - the `DMDA` object + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMSetUp()`, `DMDASetSizes()`, `DMClone()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()` + +# External Links +$(_doc_external("DMDA/DMDACreate")) +""" +function DMDACreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMDACreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + da_ = Ref{CDM}() + + @chk ccall( + (:DMDACreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CDM}), + comm, da_, + ) + + da = PetscDM(da_[], petsclib) + + return da +end + +""" + cell::PetscInt = DMDAConvertToCell(petsclib::PetscLibType,dm::PetscDM, s::MatStencil) +Convert a (i,j,k) location in a `DMDA` to its local cell or vertex number + +Not Collective + +Input Parameters: +- `dm` - the `DMDA` +- `s` - a `MatStencil` that provides (i,j,k) + +Output Parameter: +- `cell` - the local cell or vertext number + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetGhostCorners()` + +# External Links +$(_doc_external("DMDA/DMDAConvertToCell")) +""" +function DMDAConvertToCell(petsclib::PetscLibType, dm::PetscDM, s::MatStencil) end + +@for_petsc function DMDAConvertToCell(petsclib::$UnionPetscLib, dm::PetscDM, s::MatStencil ) + cell_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAConvertToCell, $petsc_library), + PetscErrorCode, + (CDM, MatStencil, Ptr{$PetscInt}), + dm, s, cell_, + ) + + cell = cell_[] + + return cell +end + +""" + II::PetscInt,JJ::PetscInt,KK::PetscInt,X::PetscScalar,Y::PetscScalar,Z::PetscScalar = DMDAGetLogicalCoordinate(petsclib::PetscLibType,da::PetscDM, x::PetscScalar, y::PetscScalar, z::PetscScalar) +Returns a the i,j,k logical coordinate for the closest mesh point to a `x`, `y`, `z` point in the coordinates of the `DMDA` + +Collective + +Input Parameters: +- `da` - the `DMDA` +- `x` - the first physical coordinate +- `y` - the second physical coordinate +- `z` - the third physical coordinate + +Output Parameters: +- `II` - the first logical coordinate (-1 on processes that do not contain that point) +- `JJ` - the second logical coordinate (-1 on processes that do not contain that point) +- `KK` - the third logical coordinate (-1 on processes that do not contain that point) +- `X` - (optional) the first coordinate of the located grid point +- `Y` - (optional) the second coordinate of the located grid point +- `Z` - (optional) the third coordinate of the located grid point + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA` + +# External Links +$(_doc_external("DMDA/DMDAGetLogicalCoordinate")) +""" +function DMDAGetLogicalCoordinate(petsclib::PetscLibType, da::PetscDM, x::PetscScalar, y::PetscScalar, z::PetscScalar) end + +@for_petsc function DMDAGetLogicalCoordinate(petsclib::$UnionPetscLib, da::PetscDM, x::$PetscScalar, y::$PetscScalar, z::$PetscScalar ) + II_ = Ref{$PetscInt}() + JJ_ = Ref{$PetscInt}() + KK_ = Ref{$PetscInt}() + X_ = Ref{$PetscScalar}() + Y_ = Ref{$PetscScalar}() + Z_ = Ref{$PetscScalar}() + + @chk ccall( + (:DMDAGetLogicalCoordinate, $petsc_library), + PetscErrorCode, + (CDM, $PetscScalar, $PetscScalar, $PetscScalar, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + da, x, y, z, II_, JJ_, KK_, X_, Y_, Z_, + ) + + II = II_[] + JJ = JJ_[] + KK = KK_[] + X = X_[] + Y = Y_[] + Z = Z_[] + + return II,JJ,KK,X,Y,Z +end + +""" + DMDAGetRay(petsclib::PetscLibType,da::PetscDM, dir::DMDirection, gp::PetscInt, newvec::PetscVec, scatter::VecScatter) +Returns a vector on process zero that contains a row or column of the values in a `DMDA` vector + +Collective + +Input Parameters: +- `da` - the `DMDA` +- `dir` - Cartesian direction, either `DM_X`, `DM_Y`, or `DM_Z` +- `gp` - global grid point number in this direction + +Output Parameters: +- `newvec` - the new vector that can hold the values (size zero on all processes except MPI rank 0) +- `scatter` - the `VecScatter` that will map from the original vector to the ray + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDirection`, `Vec`, `VecScatter` + +# External Links +$(_doc_external("DMDA/DMDAGetRay")) +""" +function DMDAGetRay(petsclib::PetscLibType, da::PetscDM, dir::DMDirection, gp::PetscInt, newvec::PetscVec, scatter::VecScatter) end + +@for_petsc function DMDAGetRay(petsclib::$UnionPetscLib, da::PetscDM, dir::DMDirection, gp::$PetscInt, newvec::PetscVec, scatter::VecScatter ) + newvec_ = Ref(newvec.ptr) + + @chk ccall( + (:DMDAGetRay, $petsc_library), + PetscErrorCode, + (CDM, DMDirection, $PetscInt, Ptr{CVec}, Ptr{VecScatter}), + da, dir, gp, newvec_, scatter, + ) + + newvec.ptr = newvec_[] + + return nothing +end + +""" + DMDAGetProcessorSubset(petsclib::PetscLibType,da::PetscDM, dir::DMDirection, gp::PetscInt, comm::MPI_Comm) +Returns a communicator consisting only of the +processors in a `DMDA` that own a particular global x, y, or z grid point +(corresponding to a logical plane in a 3D grid or a line in a 2D grid). + +Collective; No Fortran Support + +Input Parameters: +- `da` - the `DMDA` +- `dir` - Cartesian direction, either `DM_X`, `DM_Y`, or `DM_Z` +- `gp` - global grid point number in this direction + +Output Parameter: +- `comm` - new communicator + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDirection`, `DM_X`, `DM_Y`, `DM_Z`, `DMDAGetProcessorSubsets()` + +# External Links +$(_doc_external("DMDA/DMDAGetProcessorSubset")) +""" +function DMDAGetProcessorSubset(petsclib::PetscLibType, da::PetscDM, dir::DMDirection, gp::PetscInt, comm::MPI_Comm) end + +@for_petsc function DMDAGetProcessorSubset(petsclib::$UnionPetscLib, da::PetscDM, dir::DMDirection, gp::$PetscInt, comm::MPI_Comm ) + + @chk ccall( + (:DMDAGetProcessorSubset, $petsc_library), + PetscErrorCode, + (CDM, DMDirection, $PetscInt, Ptr{MPI_Comm}), + da, dir, gp, comm, + ) + + + return nothing +end + +""" + DMDAGetProcessorSubsets(petsclib::PetscLibType,da::PetscDM, dir::DMDirection, subcomm::MPI_Comm) +Returns communicators consisting only of the +processors in a `DMDA` adjacent in a particular dimension, +corresponding to a logical plane in a 3D grid or a line in a 2D grid. + +Collective; No Fortran Support + +Input Parameters: +- `da` - the `DMDA` +- `dir` - Cartesian direction, either `DM_X`, `DM_Y`, or `DM_Z` + +Output Parameter: +- `subcomm` - new communicator + +Level: advanced + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDirection`, `DMDAGetProcessorSubset()`, `DM_X`, `DM_Y`, `DM_Z` + +# External Links +$(_doc_external("DMDA/DMDAGetProcessorSubsets")) +""" +function DMDAGetProcessorSubsets(petsclib::PetscLibType, da::PetscDM, dir::DMDirection, subcomm::MPI_Comm) end + +@for_petsc function DMDAGetProcessorSubsets(petsclib::$UnionPetscLib, da::PetscDM, dir::DMDirection, subcomm::MPI_Comm ) + + @chk ccall( + (:DMDAGetProcessorSubsets, $petsc_library), + PetscErrorCode, + (CDM, DMDirection, Ptr{MPI_Comm}), + da, dir, subcomm, + ) + + + return nothing +end + +""" + x::PetscInt,y::PetscInt,z::PetscInt,m::PetscInt,n::PetscInt,p::PetscInt = DMDAGetGhostCorners(petsclib::PetscLibType,da::PetscDM) +Returns the global (`i`,`j`,`k`) indices of the lower left +corner and size of the local region, including ghost points. + +Not Collective + +Input Parameter: +- `da` - the `DMDA` + +Output Parameters: +- `x` - the corner index for the first dimension +- `y` - the corner index for the second dimension (only used in 2D and 3D problems) +- `z` - the corner index for the third dimension (only used in 3D problems) +- `m` - the width in the first dimension +- `n` - the width in the second dimension (only used in 2D and 3D problems) +- `p` - the width in the third dimension (only used in 3D problems) + +Level: beginner + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMDAGetCorners()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMDAGetOwnershipRanges()`, `DMStagGetGhostCorners()`, `DMSTAG` + +# External Links +$(_doc_external("DMDA/DMDAGetGhostCorners")) +""" +function DMDAGetGhostCorners(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAGetGhostCorners(petsclib::$UnionPetscLib, da::PetscDM ) + x_ = Ref{$PetscInt}() + y_ = Ref{$PetscInt}() + z_ = Ref{$PetscInt}() + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + p_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetGhostCorners, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + da, x_, y_, z_, m_, n_, p_, + ) + + x = x_[] + y = y_[] + z = z_[] + m = m_[] + n = n_[] + p = p_[] + + return x,y,z,m,n,p +end + +""" + DMDASetPreallocationCenterDimension(petsclib::PetscLibType,dm::PetscDM, preallocCenterDim::PetscInt) +Determine the topology used to determine adjacency + +Input Parameters: +- `dm` - The `DMDA` object +- `preallocCenterDim` - The dimension of points which connect adjacent entries + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateMatrix()`, `DMDAPreallocateOperator()` + +# External Links +$(_doc_external("DMDA/DMDASetPreallocationCenterDimension")) +""" +function DMDASetPreallocationCenterDimension(petsclib::PetscLibType, dm::PetscDM, preallocCenterDim::PetscInt) end + +@for_petsc function DMDASetPreallocationCenterDimension(petsclib::$UnionPetscLib, dm::PetscDM, preallocCenterDim::$PetscInt ) + + @chk ccall( + (:DMDASetPreallocationCenterDimension, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, preallocCenterDim, + ) + + + return nothing +end + +""" + preallocCenterDim::PetscInt = DMDAGetPreallocationCenterDimension(petsclib::PetscLibType,dm::PetscDM) +Return the topology used to determine adjacency + +Input Parameter: +- `dm` - The `DMDA` object + +Output Parameter: +- `preallocCenterDim` - The dimension of points which connect adjacent entries + +Level: developer + +-seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateMatrix()`, `DMDAPreallocateOperator()`, `DMDASetPreallocationCenterDimension()` + +# External Links +$(_doc_external("DMDA/DMDAGetPreallocationCenterDimension")) +""" +function DMDAGetPreallocationCenterDimension(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMDAGetPreallocationCenterDimension(petsclib::$UnionPetscLib, dm::PetscDM ) + preallocCenterDim_ = Ref{$PetscInt}() + + @chk ccall( + (:DMDAGetPreallocationCenterDimension, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, preallocCenterDim_, + ) + + preallocCenterDim = preallocCenterDim_[] + + return preallocCenterDim +end + +""" + rest::PetscMat = DMDACreateAggregates(petsclib::PetscLibType,dac::PetscDM, daf::PetscDM) +Gets the aggregates that map between +grids associated with two `DMDA` + +Collective + +Input Parameters: +- `dac` - the coarse grid `DMDA` +- `daf` - the fine grid `DMDA` + +Output Parameter: +- `rest` - the restriction matrix (transpose of the projection matrix) + +Level: intermediate + +-seealso: [](sec_struct), `DMRefine()`, `DMCreateInjection()`, `DMCreateInterpolation()` + +# External Links +$(_doc_external("DMDA/DMDACreateAggregates")) +""" +function DMDACreateAggregates(petsclib::PetscLibType, dac::PetscDM, daf::PetscDM) end + +@for_petsc function DMDACreateAggregates(petsclib::$UnionPetscLib, dac::PetscDM, daf::PetscDM ) + rest_ = Ref{CMat}() + + @chk ccall( + (:DMDACreateAggregates, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{CMat}), + dac, daf, rest_, + ) + + rest = PetscMat(rest_[], petsclib) + + return rest +end + +""" + DMGlobalToLocalBeginDefaultShell(petsclib::PetscLibType,dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) +Uses the GlobalToLocal `VecScatter` context set by the user to begin a global to local scatter + +Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `g` - global vector +- `mode` - `InsertMode` +- `l` - local vector + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMGlobalToLocalEndDefaultShell()` + +# External Links +$(_doc_external("DM/DMGlobalToLocalBeginDefaultShell")) +""" +function DMGlobalToLocalBeginDefaultShell(petsclib::PetscLibType, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) end + +@for_petsc function DMGlobalToLocalBeginDefaultShell(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec ) + + @chk ccall( + (:DMGlobalToLocalBeginDefaultShell, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, g, mode, l, + ) + + + return nothing +end + +""" + DMGlobalToLocalEndDefaultShell(petsclib::PetscLibType,dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) +Uses the GlobalToLocal `VecScatter` context set by the user to end a global to local scatter +Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `g` - global vector +- `mode` - `InsertMode` +- `l` - local vector + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMGlobalToLocalBeginDefaultShell()` + +# External Links +$(_doc_external("DM/DMGlobalToLocalEndDefaultShell")) +""" +function DMGlobalToLocalEndDefaultShell(petsclib::PetscLibType, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) end + +@for_petsc function DMGlobalToLocalEndDefaultShell(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec ) + + @chk ccall( + (:DMGlobalToLocalEndDefaultShell, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, g, mode, l, + ) + + + return nothing +end + +""" + DMLocalToGlobalBeginDefaultShell(petsclib::PetscLibType,dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec) +Uses the LocalToGlobal `VecScatter` context set by the user to begin a local to global scatter +Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `l` - local vector +- `mode` - `InsertMode` +- `g` - global vector + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMLocalToGlobalEndDefaultShell()` + +# External Links +$(_doc_external("DM/DMLocalToGlobalBeginDefaultShell")) +""" +function DMLocalToGlobalBeginDefaultShell(petsclib::PetscLibType, dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec) end + +@for_petsc function DMLocalToGlobalBeginDefaultShell(petsclib::$UnionPetscLib, dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec ) + + @chk ccall( + (:DMLocalToGlobalBeginDefaultShell, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, l, mode, g, + ) + + + return nothing +end + +""" + DMLocalToGlobalEndDefaultShell(petsclib::PetscLibType,dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec) +Uses the LocalToGlobal `VecScatter` context set by the user to end a local to global scatter +Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `l` - local vector +- `mode` - `InsertMode` +- `g` - global vector + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMLocalToGlobalBeginDefaultShell()` + +# External Links +$(_doc_external("DM/DMLocalToGlobalEndDefaultShell")) +""" +function DMLocalToGlobalEndDefaultShell(petsclib::PetscLibType, dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec) end + +@for_petsc function DMLocalToGlobalEndDefaultShell(petsclib::$UnionPetscLib, dm::PetscDM, l::PetscVec, mode::InsertMode, g::PetscVec ) + + @chk ccall( + (:DMLocalToGlobalEndDefaultShell, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, l, mode, g, + ) + + + return nothing +end + +""" + DMLocalToLocalBeginDefaultShell(petsclib::PetscLibType,dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) +Uses the LocalToLocal `VecScatter` context set by the user to begin a local to local scatter +Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `g` - the original local vector +- `mode` - `InsertMode` + +Output Parameter: +- `l` - the local vector with correct ghost values + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMLocalToLocalEndDefaultShell()` + +# External Links +$(_doc_external("DM/DMLocalToLocalBeginDefaultShell")) +""" +function DMLocalToLocalBeginDefaultShell(petsclib::PetscLibType, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) end + +@for_petsc function DMLocalToLocalBeginDefaultShell(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec ) + + @chk ccall( + (:DMLocalToLocalBeginDefaultShell, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, g, mode, l, + ) + + + return nothing +end + +""" + DMLocalToLocalEndDefaultShell(petsclib::PetscLibType,dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) +Uses the LocalToLocal `VecScatter` context set by the user to end a local to local scatter +Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `g` - the original local vector +- `mode` - `InsertMode` + +Output Parameter: +- `l` - the local vector with correct ghost values + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMLocalToLocalBeginDefaultShell()` + +# External Links +$(_doc_external("DM/DMLocalToLocalEndDefaultShell")) +""" +function DMLocalToLocalEndDefaultShell(petsclib::PetscLibType, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec) end + +@for_petsc function DMLocalToLocalEndDefaultShell(petsclib::$UnionPetscLib, dm::PetscDM, g::PetscVec, mode::InsertMode, l::PetscVec ) + + @chk ccall( + (:DMLocalToLocalEndDefaultShell, $petsc_library), + PetscErrorCode, + (CDM, CVec, InsertMode, CVec), + dm, g, mode, l, + ) + + + return nothing +end + +""" + DMShellSetDestroyContext(petsclib::PetscLibType,dm::PetscDM, destroyctx::external) +set a function that destroys the context provided with `DMShellSetContext()` + +Collective + +Input Parameters: +- `dm` - the `DM` to attach the `destroyctx()` function to +- `destroyctx` - the function that destroys the context + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetDestroyContext")) +""" +function DMShellSetDestroyContext(petsclib::PetscLibType, dm::PetscDM, destroyctx::external) end + +@for_petsc function DMShellSetDestroyContext(petsclib::$UnionPetscLib, dm::PetscDM, destroyctx::external ) + + @chk ccall( + (:DMShellSetDestroyContext, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, destroyctx, + ) + + + return nothing +end + +""" + DMShellSetContext(petsclib::PetscLibType,dm::PetscDM, ctx::Cvoid) +set some data to be usable by this `DMSHELL` + +Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `ctx` - the context + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMCreateMatrix()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetContext")) +""" +function DMShellSetContext(petsclib::PetscLibType, dm::PetscDM, ctx::Cvoid) end + +@for_petsc function DMShellSetContext(petsclib::$UnionPetscLib, dm::PetscDM, ctx::Cvoid ) + + @chk ccall( + (:DMShellSetContext, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cvoid}), + dm, ctx, + ) + + + return nothing +end + +""" + DMShellGetContext(petsclib::PetscLibType,dm::PetscDM, ctx::Cvoid) +Returns the user + +Collective + +Input Parameter: +- `dm` - `DMSHELL` + +Output Parameter: +- `ctx` - the context + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMCreateMatrix()`, `DMShellSetContext()` + +# External Links +$(_doc_external("DM/DMShellGetContext")) +""" +function DMShellGetContext(petsclib::PetscLibType, dm::PetscDM, ctx::Cvoid) end + +@for_petsc function DMShellGetContext(petsclib::$UnionPetscLib, dm::PetscDM, ctx::Cvoid ) + + @chk ccall( + (:DMShellGetContext, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cvoid}), + dm, ctx, + ) + + + return nothing +end + +""" + DMShellSetMatrix(petsclib::PetscLibType,dm::PetscDM, J::PetscMat) +sets a template matrix associated with the `DMSHELL` + +Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `J` - template matrix + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMCreateMatrix()`, `DMShellSetCreateMatrix()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetMatrix")) +""" +function DMShellSetMatrix(petsclib::PetscLibType, dm::PetscDM, J::PetscMat) end + +@for_petsc function DMShellSetMatrix(petsclib::$UnionPetscLib, dm::PetscDM, J::PetscMat ) + + @chk ccall( + (:DMShellSetMatrix, $petsc_library), + PetscErrorCode, + (CDM, CMat), + dm, J, + ) + + + return nothing +end + +""" + DMShellSetCreateMatrix(petsclib::PetscLibType,dm::PetscDM, func::external) +sets the routine to create a matrix associated with the `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `func` - the function to create a matrix + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMCreateMatrix()`, `DMShellSetMatrix()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCreateMatrix")) +""" +function DMShellSetCreateMatrix(petsclib::PetscLibType, dm::PetscDM, func::external) end + +@for_petsc function DMShellSetCreateMatrix(petsclib::$UnionPetscLib, dm::PetscDM, func::external ) + + @chk ccall( + (:DMShellSetCreateMatrix, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, func, + ) + + + return nothing +end + +""" + DMShellSetGlobalVector(petsclib::PetscLibType,dm::PetscDM, X::PetscVec) +sets a template global vector associated with the `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `X` - template vector + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMCreateGlobalVector()`, `DMShellSetMatrix()`, `DMShellSetCreateGlobalVector()` + +# External Links +$(_doc_external("DM/DMShellSetGlobalVector")) +""" +function DMShellSetGlobalVector(petsclib::PetscLibType, dm::PetscDM, X::PetscVec) end + +@for_petsc function DMShellSetGlobalVector(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec ) + + @chk ccall( + (:DMShellSetGlobalVector, $petsc_library), + PetscErrorCode, + (CDM, CVec), + dm, X, + ) + + + return nothing +end + +""" + DMShellGetGlobalVector(petsclib::PetscLibType,dm::PetscDM, X::PetscVec) +Returns the template global vector associated with the `DMSHELL`, or `NULL` if it was not set + +Not Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `X` - template vector + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetGlobalVector()`, `DMShellSetCreateGlobalVector()`, `DMCreateGlobalVector()` + +# External Links +$(_doc_external("DM/DMShellGetGlobalVector")) +""" +function DMShellGetGlobalVector(petsclib::PetscLibType, dm::PetscDM, X::PetscVec) end + +@for_petsc function DMShellGetGlobalVector(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec ) + X_ = Ref(X.ptr) + + @chk ccall( + (:DMShellGetGlobalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, X_, + ) + + X.ptr = X_[] + + return nothing +end + +""" + DMShellSetCreateGlobalVector(petsclib::PetscLibType,dm::PetscDM, func::external) +sets the routine to create a global vector associated with the `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `func` - the creation routine + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetGlobalVector()`, `DMShellSetCreateMatrix()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCreateGlobalVector")) +""" +function DMShellSetCreateGlobalVector(petsclib::PetscLibType, dm::PetscDM, func::external) end + +@for_petsc function DMShellSetCreateGlobalVector(petsclib::$UnionPetscLib, dm::PetscDM, func::external ) + + @chk ccall( + (:DMShellSetCreateGlobalVector, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, func, + ) + + + return nothing +end + +""" + DMShellSetLocalVector(petsclib::PetscLibType,dm::PetscDM, X::PetscVec) +sets a template local vector associated with the `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - `DMSHELL` +- `X` - template vector + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMCreateLocalVector()`, `DMShellSetMatrix()`, `DMShellSetCreateLocalVector()` + +# External Links +$(_doc_external("DM/DMShellSetLocalVector")) +""" +function DMShellSetLocalVector(petsclib::PetscLibType, dm::PetscDM, X::PetscVec) end + +@for_petsc function DMShellSetLocalVector(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec ) + + @chk ccall( + (:DMShellSetLocalVector, $petsc_library), + PetscErrorCode, + (CDM, CVec), + dm, X, + ) + + + return nothing +end + +""" + DMShellSetCreateLocalVector(petsclib::PetscLibType,dm::PetscDM, func::external) +sets the routine to create a local vector associated with the `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `func` - the creation routine + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetLocalVector()`, `DMShellSetCreateMatrix()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCreateLocalVector")) +""" +function DMShellSetCreateLocalVector(petsclib::PetscLibType, dm::PetscDM, func::external) end + +@for_petsc function DMShellSetCreateLocalVector(petsclib::$UnionPetscLib, dm::PetscDM, func::external ) + + @chk ccall( + (:DMShellSetCreateLocalVector, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, func, + ) + + + return nothing +end + +""" + DMShellSetGlobalToLocal(petsclib::PetscLibType,dm::PetscDM, begin_::external, end_::external) +Sets the routines used to perform a global to local scatter + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `begin_` - the routine that begins the global to local scatter +- `end_` - the routine that ends the global to local scatter + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetLocalToGlobal()`, `DMGlobalToLocalBeginDefaultShell()`, `DMGlobalToLocalEndDefaultShell()` + +# External Links +$(_doc_external("DM/DMShellSetGlobalToLocal")) +""" +function DMShellSetGlobalToLocal(petsclib::PetscLibType, dm::PetscDM, begin_::external, end_::external) end + +@for_petsc function DMShellSetGlobalToLocal(petsclib::$UnionPetscLib, dm::PetscDM, begin_::external, end_::external ) + + @chk ccall( + (:DMShellSetGlobalToLocal, $petsc_library), + PetscErrorCode, + (CDM, external, external), + dm, begin_, end_, + ) + + + return nothing +end + +#= +""" + PetscErrorCode, + (CDM, external, external), + dm, begin_, end_, + ) + + + return nothing +end +=# + +""" + DMShellSetLocalToGlobal(petsclib::PetscLibType,dm::PetscDM, begin_::external, end_::external) +Sets the routines used to perform a local to global scatter + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `begin` - the routine that begins the local to global scatter +- `end` - the routine that ends the local to global scatter + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetGlobalToLocal()` + +# External Links +$(_doc_external("DM/DMShellSetLocalToGlobal")) +""" +function DMShellSetLocalToGlobal(petsclib::PetscLibType, dm::PetscDM, begin_::external, end_::external) end + +@for_petsc function DMShellSetLocalToGlobal(petsclib::$UnionPetscLib, dm::PetscDM, begin_::external, end_::external ) + + @chk ccall( + (:DMShellSetLocalToGlobal, $petsc_library), + PetscErrorCode, + (CDM, external, external), + dm, begin_, end_, + ) + + + return nothing +end + +""" + DMShellSetLocalToLocal(petsclib::PetscLibType,dm::PetscDM, begin_::external, end_::external) +Sets the routines used to perform a local to local scatter + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `begin` - the routine that begins the local to local scatter +- `end` - the routine that ends the local to local scatter + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetGlobalToLocal()`, `DMLocalToLocalBeginDefaultShell()`, `DMLocalToLocalEndDefaultShell()` + +# External Links +$(_doc_external("DM/DMShellSetLocalToLocal")) +""" +function DMShellSetLocalToLocal(petsclib::PetscLibType, dm::PetscDM, begin_::external, end_::external) end + +@for_petsc function DMShellSetLocalToLocal(petsclib::$UnionPetscLib, dm::PetscDM, begin_::external, end_::external ) + + @chk ccall( + (:DMShellSetLocalToLocal, $petsc_library), + PetscErrorCode, + (CDM, external, external), + dm, begin_, end_, + ) + + + return nothing +end + +""" + DMShellSetGlobalToLocalVecScatter(petsclib::PetscLibType,dm::PetscDM, gtol::VecScatter) +Sets a `VecScatter` context for global to local communication + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `gtol` - the global to local `VecScatter` context + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetGlobalToLocal()`, `DMGlobalToLocalBeginDefaultShell()`, `DMGlobalToLocalEndDefaultShell()` + +# External Links +$(_doc_external("DM/DMShellSetGlobalToLocalVecScatter")) +""" +function DMShellSetGlobalToLocalVecScatter(petsclib::PetscLibType, dm::PetscDM, gtol::VecScatter) end + +@for_petsc function DMShellSetGlobalToLocalVecScatter(petsclib::$UnionPetscLib, dm::PetscDM, gtol::VecScatter ) + + @chk ccall( + (:DMShellSetGlobalToLocalVecScatter, $petsc_library), + PetscErrorCode, + (CDM, VecScatter), + dm, gtol, + ) + + + return nothing +end + +""" + DMShellSetLocalToGlobalVecScatter(petsclib::PetscLibType,dm::PetscDM, ltog::VecScatter) +Sets a` VecScatter` context for local to global communication + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `ltog` - the local to global `VecScatter` context + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetLocalToGlobal()`, `DMLocalToGlobalBeginDefaultShell()`, `DMLocalToGlobalEndDefaultShell()` + +# External Links +$(_doc_external("DM/DMShellSetLocalToGlobalVecScatter")) +""" +function DMShellSetLocalToGlobalVecScatter(petsclib::PetscLibType, dm::PetscDM, ltog::VecScatter) end + +@for_petsc function DMShellSetLocalToGlobalVecScatter(petsclib::$UnionPetscLib, dm::PetscDM, ltog::VecScatter ) + + @chk ccall( + (:DMShellSetLocalToGlobalVecScatter, $petsc_library), + PetscErrorCode, + (CDM, VecScatter), + dm, ltog, + ) + + + return nothing +end + +""" + DMShellSetLocalToLocalVecScatter(petsclib::PetscLibType,dm::PetscDM, ltol::VecScatter) +Sets a `VecScatter` context for local to local communication + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `ltol` - the local to local `VecScatter` context + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetLocalToLocal()`, `DMLocalToLocalBeginDefaultShell()`, `DMLocalToLocalEndDefaultShell()` + +# External Links +$(_doc_external("DM/DMShellSetLocalToLocalVecScatter")) +""" +function DMShellSetLocalToLocalVecScatter(petsclib::PetscLibType, dm::PetscDM, ltol::VecScatter) end + +@for_petsc function DMShellSetLocalToLocalVecScatter(petsclib::$UnionPetscLib, dm::PetscDM, ltol::VecScatter ) + + @chk ccall( + (:DMShellSetLocalToLocalVecScatter, $petsc_library), + PetscErrorCode, + (CDM, VecScatter), + dm, ltol, + ) + + + return nothing +end + +""" + DMShellSetCoarsen(petsclib::PetscLibType,dm::PetscDM, coarsen::external) +Set the routine used to coarsen the `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `coarsen` - the routine that coarsens the `DM` + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetRefine()`, `DMCoarsen()`, `DMShellGetCoarsen()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCoarsen")) +""" +function DMShellSetCoarsen(petsclib::PetscLibType, dm::PetscDM, coarsen::external) end + +@for_petsc function DMShellSetCoarsen(petsclib::$UnionPetscLib, dm::PetscDM, coarsen::external ) + + @chk ccall( + (:DMShellSetCoarsen, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, coarsen, + ) + + + return nothing +end + +""" + DMShellSetRefine(petsclib::PetscLibType,dm::PetscDM, refine::external) +Set the routine used to refine the `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `refine` - the routine that refines the `DM` + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetCoarsen()`, `DMRefine()`, `DMShellGetRefine()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetRefine")) +""" +function DMShellSetRefine(petsclib::PetscLibType, dm::PetscDM, refine::external) end + +@for_petsc function DMShellSetRefine(petsclib::$UnionPetscLib, dm::PetscDM, refine::external ) + + @chk ccall( + (:DMShellSetRefine, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, refine, + ) + + + return nothing +end + +""" + DMShellSetCreateInterpolation(petsclib::PetscLibType,dm::PetscDM, interp::external) +Set the routine used to create the interpolation operator + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `interp` - the routine to create the interpolation + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetCreateInjection()`, `DMCreateInterpolation()`, `DMShellGetCreateInterpolation()`, `DMShellSetCreateRestriction()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCreateInterpolation")) +""" +function DMShellSetCreateInterpolation(petsclib::PetscLibType, dm::PetscDM, interp::external) end + +@for_petsc function DMShellSetCreateInterpolation(petsclib::$UnionPetscLib, dm::PetscDM, interp::external ) + + @chk ccall( + (:DMShellSetCreateInterpolation, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, interp, + ) + + + return nothing +end + +""" + DMShellSetCreateRestriction(petsclib::PetscLibType,dm::PetscDM, restriction::external) +Set the routine used to create the restriction operator + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `restriction` - the routine to create the restriction + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetCreateInjection()`, `DMCreateInterpolation()`, `DMShellGetCreateRestriction()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCreateRestriction")) +""" +function DMShellSetCreateRestriction(petsclib::PetscLibType, dm::PetscDM, restriction::external) end + +@for_petsc function DMShellSetCreateRestriction(petsclib::$UnionPetscLib, dm::PetscDM, restriction::external ) + + @chk ccall( + (:DMShellSetCreateRestriction, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, restriction, + ) + + + return nothing +end + +""" + DMShellSetCreateInjection(petsclib::PetscLibType,dm::PetscDM, inject::external) +Set the routine used to create the injection operator + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `inject` - the routine to create the injection + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMShellSetCreateInterpolation()`, `DMCreateInjection()`, `DMShellGetCreateInjection()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCreateInjection")) +""" +function DMShellSetCreateInjection(petsclib::PetscLibType, dm::PetscDM, inject::external) end + +@for_petsc function DMShellSetCreateInjection(petsclib::$UnionPetscLib, dm::PetscDM, inject::external ) + + @chk ccall( + (:DMShellSetCreateInjection, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, inject, + ) + + + return nothing +end + +""" + DMShellSetCreateFieldDecomposition(petsclib::PetscLibType,dm::PetscDM, decomp::external) +Set the routine used to create a decomposition of fields for the `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `decomp` - the routine to create the decomposition + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMCreateFieldDecomposition()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCreateFieldDecomposition")) +""" +function DMShellSetCreateFieldDecomposition(petsclib::PetscLibType, dm::PetscDM, decomp::external) end + +@for_petsc function DMShellSetCreateFieldDecomposition(petsclib::$UnionPetscLib, dm::PetscDM, decomp::external ) + + @chk ccall( + (:DMShellSetCreateFieldDecomposition, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, decomp, + ) + + + return nothing +end + +""" + DMShellSetCreateDomainDecomposition(petsclib::PetscLibType,dm::PetscDM, decomp::external) +Set the routine used to create a domain decomposition for the `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `decomp` - the routine to create the decomposition + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMCreateDomainDecomposition()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCreateDomainDecomposition")) +""" +function DMShellSetCreateDomainDecomposition(petsclib::PetscLibType, dm::PetscDM, decomp::external) end + +@for_petsc function DMShellSetCreateDomainDecomposition(petsclib::$UnionPetscLib, dm::PetscDM, decomp::external ) + + @chk ccall( + (:DMShellSetCreateDomainDecomposition, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, decomp, + ) + + + return nothing +end + +""" + DMShellSetCreateDomainDecompositionScatters(petsclib::PetscLibType,dm::PetscDM, scatter::external) +Set the routine used to create the scatter contexts for domain decomposition with a `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `scatter` - the routine to create the scatters + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMCreateDomainDecompositionScatters()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCreateDomainDecompositionScatters")) +""" +function DMShellSetCreateDomainDecompositionScatters(petsclib::PetscLibType, dm::PetscDM, scatter::external) end + +@for_petsc function DMShellSetCreateDomainDecompositionScatters(petsclib::$UnionPetscLib, dm::PetscDM, scatter::external ) + + @chk ccall( + (:DMShellSetCreateDomainDecompositionScatters, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, scatter, + ) + + + return nothing +end + +""" + DMShellSetCreateSubDM(petsclib::PetscLibType,dm::PetscDM, subdm::external) +Set the routine used to create a sub `DM` from the `DMSHELL` + +Logically Collective + +Input Parameters: +- `dm` - the `DMSHELL` +- `subdm` - the routine to create the decomposition + +Level: advanced + +-seealso: `DM`, `DMSHELL`, `DMCreateSubDM()`, `DMShellGetCreateSubDM()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellSetCreateSubDM")) +""" +function DMShellSetCreateSubDM(petsclib::PetscLibType, dm::PetscDM, subdm::external) end + +@for_petsc function DMShellSetCreateSubDM(petsclib::$UnionPetscLib, dm::PetscDM, subdm::external ) + + @chk ccall( + (:DMShellSetCreateSubDM, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, subdm, + ) + + + return nothing +end + +""" + dm::PetscDM = DMShellCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a `DMSHELL` object, used to manage user + +Collective + +Input Parameter: +- `comm` - the processors that will share the global vector + +Output Parameter: +- `dm` - the `DMSHELL` + +Level: advanced + +-seealso: `DMDestroy()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()`, `DMShellSetContext()`, `DMShellGetContext()` + +# External Links +$(_doc_external("DM/DMShellCreate")) +""" +function DMShellCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMShellCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMShellCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CDM}), + comm, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMNetworkGetPlex(petsclib::PetscLibType,dm::PetscDM, plexdm::PetscDM) +Gets the `DMPLEX` associated with this `DMNETWORK` + +Not Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameter: +- `plexdm` - the `DMPLEX` object + +Level: advanced + +-seealso: `DM`, `DMNETWORK`, `DMPLEX`, `DMNetworkCreate()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetPlex")) +""" +function DMNetworkGetPlex(petsclib::PetscLibType, dm::PetscDM, plexdm::PetscDM) end + +@for_petsc function DMNetworkGetPlex(petsclib::$UnionPetscLib, dm::PetscDM, plexdm::PetscDM ) + plexdm_ = Ref(plexdm.ptr) + + @chk ccall( + (:DMNetworkGetPlex, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, plexdm_, + ) + + plexdm.ptr = plexdm_[] + + return nothing +end + +""" + nsubnet::PetscInt,Nsubnet::PetscInt = DMNetworkGetNumSubNetworks(petsclib::PetscLibType,dm::PetscDM) +Gets the number of subnetworks + +Not Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameters: +- `nsubnet` - local number of subnetworks, pass `NULL` if not needed +- `Nsubnet` - global number of subnetworks, pass `NULL` if not needed + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()`, `DMNetworkSetNumSubNetworks()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetNumSubNetworks")) +""" +function DMNetworkGetNumSubNetworks(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkGetNumSubNetworks(petsclib::$UnionPetscLib, dm::PetscDM ) + nsubnet_ = Ref{$PetscInt}() + Nsubnet_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetNumSubNetworks, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, nsubnet_, Nsubnet_, + ) + + nsubnet = nsubnet_[] + Nsubnet = Nsubnet_[] + + return nsubnet,Nsubnet +end + +""" + DMNetworkSetNumSubNetworks(petsclib::PetscLibType,dm::PetscDM, nsubnet::PetscInt, Nsubnet::PetscInt) +Sets the number of subnetworks + +Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `nsubnet` - local number of subnetworks +- `Nsubnet` - global number of subnetworks + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()`, `DMNetworkGetNumSubNetworks()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkSetNumSubNetworks")) +""" +function DMNetworkSetNumSubNetworks(petsclib::PetscLibType, dm::PetscDM, nsubnet::PetscInt, Nsubnet::PetscInt) end + +@for_petsc function DMNetworkSetNumSubNetworks(petsclib::$UnionPetscLib, dm::PetscDM, nsubnet::$PetscInt, Nsubnet::$PetscInt ) + + @chk ccall( + (:DMNetworkSetNumSubNetworks, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt), + dm, nsubnet, Nsubnet, + ) + + + return nothing +end + +""" + netnum::PetscInt = DMNetworkAddSubnetwork(petsclib::PetscLibType,dm::PetscDM, name::String, ne::PetscInt, edgelist::Vector{PetscInt}) +Add a subnetwork + +Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `name` - name of the subnetwork +- `ne` - number of local edges of this subnetwork +- `edgelist` - list of edges for this subnetwork, this is a one dimensional array with pairs of entries being the two vertices (in global numbering +of the vertices) of each edge: [first vertex of first edge, second vertex of first edge, first vertex of second edge, second vertex of second edge, etc.] + +Output Parameter: +- `netnum` - global index of the subnetwork + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()`, `DMNetworkSetNumSubnetworks()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkAddSubnetwork")) +""" +function DMNetworkAddSubnetwork(petsclib::PetscLibType, dm::PetscDM, name::String, ne::PetscInt, edgelist::Vector{PetscInt}) end + +@for_petsc function DMNetworkAddSubnetwork(petsclib::$UnionPetscLib, dm::PetscDM, name::String, ne::$PetscInt, edgelist::Vector{$PetscInt} ) + netnum_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkAddSubnetwork, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, name, ne, edgelist, netnum_, + ) + + netnum = netnum_[] + + return netnum +end + +""" + gidx::PetscInt,n::PetscInt,sv::Vector{PetscInt} = DMNetworkSharedVertexGetInfo(petsclib::PetscLibType,dm::PetscDM, v::PetscInt) +Get info of a shared vertex struct, see petsc/private/dmnetworkimpl.h + +Not Collective + +Input Parameters: +- `dm` - the `DM` object +- `v` - vertex point + +Output Parameters: +- `gidx` - global number of this shared vertex in the internal dmplex, pass `NULL` if not needed +- `n` - number of subnetworks that share this vertex, pass `NULL` if not needed +- `sv` - array of size `n`: sv[2*i,2*i+1]=(net[i], idx[i]), i=0,...,n-1, pass `NULL` if not needed + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetSharedVertices()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkSharedVertexGetInfo")) +""" +function DMNetworkSharedVertexGetInfo(petsclib::PetscLibType, dm::PetscDM, v::PetscInt) end + +@for_petsc function DMNetworkSharedVertexGetInfo(petsclib::$UnionPetscLib, dm::PetscDM, v::$PetscInt ) + gidx_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + sv_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMNetworkSharedVertexGetInfo, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, v, gidx_, n_, sv_, + ) + + gidx = gidx_[] + n = n_[] + sv = unsafe_wrap(Array, sv_[], VecGetLocalSize(petsclib, x); own = false) + + return gidx,n,sv +end + +""" + DMNetworkLayoutSetUp(petsclib::PetscLibType,dm::PetscDM) +Sets up the bare layout (graph) for the network + +Not Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkSetNumSubNetworks()`, `DMNetworkAddSubnetwork()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkLayoutSetUp")) +""" +function DMNetworkLayoutSetUp(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkLayoutSetUp(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMNetworkLayoutSetUp, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + nv::PetscInt,ne::PetscInt,vtx::Vector{PetscInt},edge::Vector{PetscInt} = DMNetworkGetSubnetwork(petsclib::PetscLibType,dm::PetscDM, netnum::PetscInt) +Returns the information about a requested subnetwork + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `netnum` - the global index of the subnetwork + +Output Parameters: +- `nv` - number of vertices (local) +- `ne` - number of edges (local) +- `vtx` - local vertices of the subnetwork +- `edge` - local edges of the subnetwork + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()`, `DMNetworkAddSubnetwork()`, `DMNetworkLayoutSetUp()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetSubnetwork")) +""" +function DMNetworkGetSubnetwork(petsclib::PetscLibType, dm::PetscDM, netnum::PetscInt) end + +@for_petsc function DMNetworkGetSubnetwork(petsclib::$UnionPetscLib, dm::PetscDM, netnum::$PetscInt ) + nv_ = Ref{$PetscInt}() + ne_ = Ref{$PetscInt}() + vtx_ = Ref{Ptr{$PetscInt}}() + edge_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMNetworkGetSubnetwork, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + dm, netnum, nv_, ne_, vtx_, edge_, + ) + + nv = nv_[] + ne = ne_[] + vtx = unsafe_wrap(Array, vtx_[], VecGetLocalSize(petsclib, x); own = false) + edge = unsafe_wrap(Array, edge_[], VecGetLocalSize(petsclib, x); own = false) + + return nv,ne,vtx,edge +end + +""" + DMNetworkAddSharedVertices(petsclib::PetscLibType,dm::PetscDM, anetnum::PetscInt, bnetnum::PetscInt, nsvtx::PetscInt, asvtx::Vector{PetscInt}, bsvtx::Vector{PetscInt}) +Add shared vertices that connect two given subnetworks + +Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `anetnum` - first subnetwork global numbering returned by `DMNetworkAddSubnetwork()` +- `bnetnum` - second subnetwork global numbering returned by `DMNetworkAddSubnetwork()` +- `nsvtx` - number of vertices that are shared by the two subnetworks +- `asvtx` - vertex index in the first subnetwork +- `bsvtx` - vertex index in the second subnetwork + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()`, `DMNetworkAddSubnetwork()`, `DMNetworkGetSharedVertices()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkAddSharedVertices")) +""" +function DMNetworkAddSharedVertices(petsclib::PetscLibType, dm::PetscDM, anetnum::PetscInt, bnetnum::PetscInt, nsvtx::PetscInt, asvtx::Vector{PetscInt}, bsvtx::Vector{PetscInt}) end + +@for_petsc function DMNetworkAddSharedVertices(petsclib::$UnionPetscLib, dm::PetscDM, anetnum::$PetscInt, bnetnum::$PetscInt, nsvtx::$PetscInt, asvtx::Vector{$PetscInt}, bsvtx::Vector{$PetscInt} ) + + @chk ccall( + (:DMNetworkAddSharedVertices, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, anetnum, bnetnum, nsvtx, asvtx, bsvtx, + ) + + + return nothing +end + +""" + nsv::PetscInt,svtx::Vector{PetscInt} = DMNetworkGetSharedVertices(petsclib::PetscLibType,dm::PetscDM) +Returns the info for the shared vertices + +Not Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameters: +- `nsv` - number of local shared vertices, pass `NULL` if not needed +- `svtx` - local shared vertices, pass `NULL` if not needed + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetSubnetwork()`, `DMNetworkLayoutSetUp()`, `DMNetworkAddSharedVertices()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetSharedVertices")) +""" +function DMNetworkGetSharedVertices(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkGetSharedVertices(petsclib::$UnionPetscLib, dm::PetscDM ) + nsv_ = Ref{$PetscInt}() + svtx_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMNetworkGetSharedVertices, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, nsv_, svtx_, + ) + + nsv = nsv_[] + svtx = unsafe_wrap(Array, svtx_[], VecGetLocalSize(petsclib, x); own = false) + + return nsv,svtx +end + +""" + key::PetscInt = DMNetworkRegisterComponent(petsclib::PetscLibType,dm::PetscDM, name::String, size::Csize_t) +Registers the network component + +Logically Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `name` - the component name +- `size` - the storage size in bytes for this component data + +Output Parameter: +- `key` - an integer key that defines the component + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()`, `DMNetworkLayoutSetUp()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkRegisterComponent")) +""" +function DMNetworkRegisterComponent(petsclib::PetscLibType, dm::PetscDM, name::String, size::Csize_t) end + +@for_petsc function DMNetworkRegisterComponent(petsclib::$UnionPetscLib, dm::PetscDM, name::String, size::Csize_t ) + key_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkRegisterComponent, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Csize_t, Ptr{$PetscInt}), + dm, name, size, key_, + ) + + key = key_[] + + return key +end + +""" + nVertices::PetscInt,NVertices::PetscInt = DMNetworkGetNumVertices(petsclib::PetscLibType,dm::PetscDM) +Get the local and global number of vertices for the entire network. + +Not Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameters: +- `nVertices` - the local number of vertices, pass `NULL` if not needed +- `NVertices` - the global number of vertices, pass `NULL` if not needed + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetNumEdges()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetNumVertices")) +""" +function DMNetworkGetNumVertices(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkGetNumVertices(petsclib::$UnionPetscLib, dm::PetscDM ) + nVertices_ = Ref{$PetscInt}() + NVertices_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetNumVertices, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, nVertices_, NVertices_, + ) + + nVertices = nVertices_[] + NVertices = NVertices_[] + + return nVertices,NVertices +end + +""" + nEdges::PetscInt,NEdges::PetscInt = DMNetworkGetNumEdges(petsclib::PetscLibType,dm::PetscDM) +Get the local and global number of edges for the entire network. + +Not Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameters: +- `nEdges` - the local number of edges, pass `NULL` if not needed +- `NEdges` - the global number of edges, pass `NULL` if not needed + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetNumVertices()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetNumEdges")) +""" +function DMNetworkGetNumEdges(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkGetNumEdges(petsclib::$UnionPetscLib, dm::PetscDM ) + nEdges_ = Ref{$PetscInt}() + NEdges_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetNumEdges, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, nEdges_, NEdges_, + ) + + nEdges = nEdges_[] + NEdges = NEdges_[] + + return nEdges,NEdges +end + +""" + vStart::PetscInt,vEnd::PetscInt = DMNetworkGetVertexRange(petsclib::PetscLibType,dm::PetscDM) +Get the bounds [start, end) for the local vertices + +Not Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameters: +- `vStart` - the first vertex point, pass `NULL` if not needed +- `vEnd` - one beyond the last vertex point, pass `NULL` if not needed + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetEdgeRange()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetVertexRange")) +""" +function DMNetworkGetVertexRange(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkGetVertexRange(petsclib::$UnionPetscLib, dm::PetscDM ) + vStart_ = Ref{$PetscInt}() + vEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetVertexRange, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, vStart_, vEnd_, + ) + + vStart = vStart_[] + vEnd = vEnd_[] + + return vStart,vEnd +end + +""" + eStart::PetscInt,eEnd::PetscInt = DMNetworkGetEdgeRange(petsclib::PetscLibType,dm::PetscDM) +Get the bounds [start, end) for the local edges + +Not Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameters: +- `eStart` - The first edge point, pass `NULL` if not needed +- `eEnd` - One beyond the last edge point, pass `NULL` if not needed + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetVertexRange()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetEdgeRange")) +""" +function DMNetworkGetEdgeRange(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkGetEdgeRange(petsclib::$UnionPetscLib, dm::PetscDM ) + eStart_ = Ref{$PetscInt}() + eEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetEdgeRange, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, eStart_, eEnd_, + ) + + eStart = eStart_[] + eEnd = eEnd_[] + + return eStart,eEnd +end + +""" + index::PetscInt = DMNetworkGetGlobalEdgeIndex(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Get the global numbering for the edge on the network + +Not Collective + +Input Parameters: +- `dm` - `DMNETWORK` object +- `p` - edge point + +Output Parameter: +- `index` - the global numbering for the edge + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetGlobalVertexIndex()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetGlobalEdgeIndex")) +""" +function DMNetworkGetGlobalEdgeIndex(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMNetworkGetGlobalEdgeIndex(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + index_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetGlobalEdgeIndex, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, p, index_, + ) + + index = index_[] + + return index +end + +""" + index::PetscInt = DMNetworkGetGlobalVertexIndex(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Get the global numbering for the vertex on the network + +Not Collective + +Input Parameters: +- `dm` - `DMNETWORK` object +- `p` - vertex point + +Output Parameter: +- `index` - the global numbering for the vertex + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetGlobalEdgeIndex()`, `DMNetworkGetLocalVertexIndex()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetGlobalVertexIndex")) +""" +function DMNetworkGetGlobalVertexIndex(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMNetworkGetGlobalVertexIndex(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + index_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetGlobalVertexIndex, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, p, index_, + ) + + index = index_[] + + return index +end + +""" + numcomponents::PetscInt = DMNetworkGetNumComponents(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Get the number of components at a vertex/edge + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `p` - vertex/edge point + +Output Parameter: +- `numcomponents` - Number of components at the vertex/edge + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkRegisterComponent()`, `DMNetworkAddComponent()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetNumComponents")) +""" +function DMNetworkGetNumComponents(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMNetworkGetNumComponents(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + numcomponents_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetNumComponents, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, p, numcomponents_, + ) + + numcomponents = numcomponents_[] + + return numcomponents +end + +""" + offset::PetscInt = DMNetworkGetLocalVecOffset(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, compnum::PetscInt) +Get the offset for accessing the variables associated with a component at the given vertex/edge from the local vector + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `p` - the edge or vertex point +- `compnum` - component number; use ALL_COMPONENTS if no specific component is requested + +Output Parameter: +- `offset` - the local offset + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMGetLocalVector()`, `DMNetworkGetComponent()`, `DMNetworkGetGlobalVecOffset()`, `DMCreateGlobalVector()`, `VecGetArray()`, `VecSetValuesLocal()`, `MatSetValuesLocal()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetLocalVecOffset")) +""" +function DMNetworkGetLocalVecOffset(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, compnum::PetscInt) end + +@for_petsc function DMNetworkGetLocalVecOffset(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, compnum::$PetscInt ) + offset_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetLocalVecOffset, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscInt}), + dm, p, compnum, offset_, + ) + + offset = offset_[] + + return offset +end + +""" + offsetg::PetscInt = DMNetworkGetGlobalVecOffset(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, compnum::PetscInt) +Get the global offset for accessing the variables associated with a component for the given vertex/edge from the global vector + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `p` - the edge or vertex point +- `compnum` - component number; use ALL_COMPONENTS if no specific component is requested + +Output Parameter: +- `offsetg` - the global offset + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetLocalVecOffset()`, `DMGetGlobalVector()`, `DMNetworkGetComponent()`, `DMCreateGlobalVector()`, `VecGetArray()`, `VecSetValues()`, `MatSetValues()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetGlobalVecOffset")) +""" +function DMNetworkGetGlobalVecOffset(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, compnum::PetscInt) end + +@for_petsc function DMNetworkGetGlobalVecOffset(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, compnum::$PetscInt ) + offsetg_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetGlobalVecOffset, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscInt}), + dm, p, compnum, offsetg_, + ) + + offsetg = offsetg_[] + + return offsetg +end + +""" + offset::PetscInt = DMNetworkGetEdgeOffset(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Get the offset for accessing the variables associated with the given edge from the local subvector + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `p` - the edge point + +Output Parameter: +- `offset` - the offset + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetLocalVecOffset()`, `DMGetLocalVector()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetEdgeOffset")) +""" +function DMNetworkGetEdgeOffset(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMNetworkGetEdgeOffset(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + offset_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetEdgeOffset, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, p, offset_, + ) + + offset = offset_[] + + return offset +end + +""" + offset::PetscInt = DMNetworkGetVertexOffset(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Get the offset for accessing the variables associated with the given vertex from the local subvector + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `p` - the vertex point + +Output Parameter: +- `offset` - the offset + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetEdgeOffset()`, `DMGetLocalVector()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetVertexOffset")) +""" +function DMNetworkGetVertexOffset(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMNetworkGetVertexOffset(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + offset_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetVertexOffset, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, p, offset_, + ) + + offset = offset_[] + + return offset +end + +""" + DMNetworkAddComponent(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, componentkey::PetscInt, compvalue::Cvoid, nvar::PetscInt) +Adds a network component and number of variables at the given point (vertex/edge) + +Collective + +Input Parameters: +- `dm` - the DMNetwork +- `p` - the vertex/edge point. These points are local indices provided by `DMNetworkGetSubnetwork()` +- `componentkey` - component key returned while registering the component with `DMNetworkRegisterComponent()` +- `compvalue` - pointer to the data structure for the component, or `NULL` if the component does not require data, this data is not copied so you cannot +free this space until after `DMSetUp()` is called. +- `nvar` - number of variables for the component at the vertex/edge point, zero if the component does not introduce any degrees of freedom at the point + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetComponent()`, `DMNetworkGetSubnetwork()`, `DMNetworkIsGhostVertex()`, `DMNetworkLayoutSetUp()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkAddComponent")) +""" +function DMNetworkAddComponent(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, componentkey::PetscInt, compvalue::Cvoid, nvar::PetscInt) end + +@for_petsc function DMNetworkAddComponent(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, componentkey::$PetscInt, compvalue::Cvoid, nvar::$PetscInt ) + + @chk ccall( + (:DMNetworkAddComponent, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{Cvoid}, $PetscInt), + dm, p, componentkey, compvalue, nvar, + ) + + + return nothing +end + +""" + compkey::PetscInt,nvar::PetscInt = DMNetworkGetComponent(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, compnum::PetscInt, component::PeCtx) +Gets the component key, the component data, and the number of variables at a given network point + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `p` - vertex/edge point +- `compnum` - component number; use ALL_COMPONENTS if sum up all the components + +Output Parameters: +- `compkey` - the key obtained when registering the component (use `NULL` if not required) +- `component` - the component data (use `NULL` if not required) +- `nvar` - number of variables (use `NULL` if not required) + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkAddComponent()`, `DMNetworkGetNumComponents()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetComponent")) +""" +function DMNetworkGetComponent(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, compnum::PetscInt, component::PeCtx) end + +@for_petsc function DMNetworkGetComponent(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, compnum::$PetscInt, component::PeCtx ) + compkey_ = Ref{$PetscInt}() + nvar_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetComponent, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscInt}, PeCtx, Ptr{$PetscInt}), + dm, p, compnum, compkey_, component, nvar_, + ) + + compkey = compkey_[] + nvar = nvar_[] + + return compkey,nvar +end + +""" + DMNetworkAssembleGraphStructures(petsclib::PetscLibType,dm::PetscDM) +Assembles vertex and edge data structures. Must be called after `DMNetworkDistribute()` + +Collective + +Input Parameter: +- `dm` - the `DMNETWORK` Object + +Level: intermediate + +-seealso: `DMNetworkDistribute()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkAssembleGraphStructures")) +""" +function DMNetworkAssembleGraphStructures(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkAssembleGraphStructures(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMNetworkAssembleGraphStructures, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMNetworkDistribute(petsclib::PetscLibType,dm::PetscDM, overlap::PetscInt) +Distributes the network and moves associated component data + +Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `overlap` - the overlap of partitions, 0 is the default + +Options Database Keys: +- `-dmnetwork_view` - Calls `DMView()` at the conclusion of `DMSetUp()` +- `-dmnetwork_view_distributed` - Calls `DMView()` at the conclusion of `DMNetworkDistribute()` +- `-dmnetwork_view_tmpdir` - Sets the temporary directory to use when viewing with the `draw` option +- `-dmnetwork_view_all_ranks` - Displays all of the subnetworks for each MPI rank +- `-dmnetwork_view_rank_range` - Displays the subnetworks for the ranks in a comma-separated list +- `-dmnetwork_view_no_vertices` - Disables displaying the vertices in the network visualization +- `-dmnetwork_view_no_numbering` - Disables displaying the numbering of edges and vertices in the network visualization + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkDistribute")) +""" +function DMNetworkDistribute(petsclib::PetscLibType, dm::PetscDM, overlap::PetscInt) end + +@for_petsc function DMNetworkDistribute(petsclib::$UnionPetscLib, dm::PetscDM, overlap::$PetscInt ) + dm_ = Ref(dm.ptr) + + @chk ccall( + (:DMNetworkDistribute, $petsc_library), + PetscErrorCode, + (Ptr{CDM}, $PetscInt), + dm_, overlap, + ) + + dm.ptr = dm_[] + + return nothing +end + +""" + nedges::PetscInt,edges::Vector{PetscInt} = DMNetworkGetSupportingEdges(petsclib::PetscLibType,dm::PetscDM, vertex::PetscInt) +Return the supporting edges for this vertex point + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `vertex` - the vertex point + +Output Parameters: +- `nedges` - number of edges connected to this vertex point +- `edges` - list of edge points, pass `NULL` if not needed + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()`, `DMNetworkGetConnectedVertices()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetSupportingEdges")) +""" +function DMNetworkGetSupportingEdges(petsclib::PetscLibType, dm::PetscDM, vertex::PetscInt) end + +@for_petsc function DMNetworkGetSupportingEdges(petsclib::$UnionPetscLib, dm::PetscDM, vertex::$PetscInt ) + nedges_ = Ref{$PetscInt}() + edges_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMNetworkGetSupportingEdges, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, vertex, nedges_, edges_, + ) + + nedges = nedges_[] + edges = unsafe_wrap(Array, edges_[], VecGetLocalSize(petsclib, x); own = false) + + return nedges,edges +end + +""" + vertices::Vector{PetscInt} = DMNetworkGetConnectedVertices(petsclib::PetscLibType,dm::PetscDM, edge::PetscInt) +Return the connected vertices for this edge point + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `edge` - the edge point + +Output Parameter: +- `vertices` - vertices connected to this edge + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()`, `DMNetworkGetSupportingEdges()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetConnectedVertices")) +""" +function DMNetworkGetConnectedVertices(petsclib::PetscLibType, dm::PetscDM, edge::PetscInt) end + +@for_petsc function DMNetworkGetConnectedVertices(petsclib::$UnionPetscLib, dm::PetscDM, edge::$PetscInt ) + vertices_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMNetworkGetConnectedVertices, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{$PetscInt}}), + dm, edge, vertices_, + ) + + vertices = unsafe_wrap(Array, vertices_[], VecGetLocalSize(petsclib, x); own = false) + + return vertices +end + +""" + flag::PetscBool = DMNetworkIsSharedVertex(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Returns `PETSC_TRUE` if the vertex is shared by subnetworks + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `p` - the vertex point + +Output Parameter: +- `flag` - `PETSC_TRUE` if the vertex is shared by subnetworks + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkAddSharedVertices()`, `DMNetworkIsGhostVertex()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkIsSharedVertex")) +""" +function DMNetworkIsSharedVertex(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMNetworkIsSharedVertex(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + flag_ = Ref{PetscBool}() + + @chk ccall( + (:DMNetworkIsSharedVertex, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscBool}), + dm, p, flag_, + ) + + flag = flag_[] + + return flag +end + +""" + isghost::PetscBool = DMNetworkIsGhostVertex(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Returns `PETSC_TRUE` if the vertex is a ghost vertex + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `p` - the vertex point + +Output Parameter: +- `isghost` - `PETSC_TRUE` if the vertex is a ghost point + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetConnectedVertices()`, `DMNetworkGetVertexRange()`, `DMNetworkIsSharedVertex()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkIsGhostVertex")) +""" +function DMNetworkIsGhostVertex(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMNetworkIsGhostVertex(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + isghost_ = Ref{PetscBool}() + + @chk ccall( + (:DMNetworkIsGhostVertex, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscBool}), + dm, p, isghost_, + ) + + isghost = isghost_[] + + return isghost +end + +""" + DMNetworkHasJacobian(petsclib::PetscLibType,dm::PetscDM, eflg::PetscBool, vflg::PetscBool) +Sets global flag for using user's sub Jacobian matrices +-- `replaced by DMNetworkSetOption(network,userjacobian,PETSC_TRUE)?` + +Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `eflg` - turn the option on (`PETSC_TRUE`) or off (`PETSC_FALSE`) if user provides Jacobian for edges +- `vflg` - turn the option on (`PETSC_TRUE`) or off (`PETSC_FALSE`) if user provides Jacobian for vertices + +Level: intermediate + +-seealso: `DMNetworkSetOption()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkHasJacobian")) +""" +function DMNetworkHasJacobian(petsclib::PetscLibType, dm::PetscDM, eflg::PetscBool, vflg::PetscBool) end + +@for_petsc function DMNetworkHasJacobian(petsclib::$UnionPetscLib, dm::PetscDM, eflg::PetscBool, vflg::PetscBool ) + + @chk ccall( + (:DMNetworkHasJacobian, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, PetscBool), + dm, eflg, vflg, + ) + + + return nothing +end + +""" + DMNetworkEdgeSetMatrix(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, J::Vector{PetscMat}) +Sets user + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `p` - the edge point +- `J` - array (size = 3) of Jacobian submatrices for this edge point: +J[0]: this edge +J[1] and J[2]: connected vertices, obtained by calling `DMNetworkGetConnectedVertices()` + +Level: advanced + +-seealso: `DM`, `DMNETWORK`, `DMNetworkVertexSetMatrix()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkEdgeSetMatrix")) +""" +function DMNetworkEdgeSetMatrix(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, J::Vector{PetscMat}) end + +@for_petsc function DMNetworkEdgeSetMatrix(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, J::Vector{PetscMat} ) + + @chk ccall( + (:DMNetworkEdgeSetMatrix, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CMat}), + dm, p, J, + ) + + + return nothing +end + +""" + DMNetworkVertexSetMatrix(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, J::Vector{PetscMat}) +Sets user + +Not Collective + +Input Parameters: +- `dm` - The `DMNETWORK` object +- `p` - the vertex point +- `J` - array of Jacobian (size = 2*(num of supporting edges) + 1) submatrices for this vertex point: +J[0]: this vertex +J[1+2*i]: i-th supporting edge +J[1+2*i+1]: i-th connected vertex + +Level: advanced + +-seealso: `DM`, `DMNETWORK`, `DMNetworkEdgeSetMatrix()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkVertexSetMatrix")) +""" +function DMNetworkVertexSetMatrix(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, J::Vector{PetscMat}) end + +@for_petsc function DMNetworkVertexSetMatrix(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, J::Vector{PetscMat} ) + + @chk ccall( + (:DMNetworkVertexSetMatrix, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CMat}), + dm, p, J, + ) + + + return nothing +end + +""" + vg::PetscInt = DMNetworkGetVertexLocalToGlobalOrdering(petsclib::PetscLibType,dm::PetscDM, vloc::PetscInt) +Get vertex global index + +Not Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object +- `vloc` - local vertex ordering, start from 0 + +Output Parameter: +- `vg` - global vertex ordering, start from 0 + +Level: advanced + +-seealso: `DM`, `DMNETWORK`, `DMNetworkSetVertexLocalToGlobalOrdering()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkGetVertexLocalToGlobalOrdering")) +""" +function DMNetworkGetVertexLocalToGlobalOrdering(petsclib::PetscLibType, dm::PetscDM, vloc::PetscInt) end + +@for_petsc function DMNetworkGetVertexLocalToGlobalOrdering(petsclib::$UnionPetscLib, dm::PetscDM, vloc::$PetscInt ) + vg_ = Ref{$PetscInt}() + + @chk ccall( + (:DMNetworkGetVertexLocalToGlobalOrdering, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, vloc, vg_, + ) + + vg = vg_[] + + return vg +end + +""" + DMNetworkSetVertexLocalToGlobalOrdering(petsclib::PetscLibType,dm::PetscDM) +Create and setup vertex local to global map + +Collective + +Input Parameters: +- `dm` - the `DMNETWORK` object + +Level: advanced + +-seealso: `DM`, `DMNETWORK`, `DMNetworkGetGlobalVertexIndex()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkSetVertexLocalToGlobalOrdering")) +""" +function DMNetworkSetVertexLocalToGlobalOrdering(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkSetVertexLocalToGlobalOrdering(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMNetworkSetVertexLocalToGlobalOrdering, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + is::IS = DMNetworkCreateIS(petsclib::PetscLibType,dm::PetscDM, numkeys::PetscInt, keys::Vector{PetscInt}, blocksize::Vector{PetscInt}, nselectedvar::Vector{PetscInt}, selectedvar::Vector{PetscInt}) +Create an index set object from the global vector of the network + +Collective + +Input Parameters: +- `dm` - `DMNETWORK` object +- `numkeys` - number of keys +- `keys` - array of keys that define the components of the variables you wish to extract +- `blocksize` - block size of the variables associated to the component +- `nselectedvar` - number of variables in each block to select +- `selectedvar` - the offset into the block of each variable in each block to select + +Output Parameter: +- `is` - the index set + +Level: advanced + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()`, `ISCreateGeneral()`, `DMNetworkCreateLocalIS()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkCreateIS")) +""" +function DMNetworkCreateIS(petsclib::PetscLibType, dm::PetscDM, numkeys::PetscInt, keys::Vector{PetscInt}, blocksize::Vector{PetscInt}, nselectedvar::Vector{PetscInt}, selectedvar::Vector{PetscInt}) end + +@for_petsc function DMNetworkCreateIS(petsclib::$UnionPetscLib, dm::PetscDM, numkeys::$PetscInt, keys::Vector{$PetscInt}, blocksize::Vector{$PetscInt}, nselectedvar::Vector{$PetscInt}, selectedvar::Vector{$PetscInt} ) + selectedvar_ = Ref(pointer(selectedvar)) + is_ = Ref{IS}() + + @chk ccall( + (:DMNetworkCreateIS, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{CIS}), + dm, numkeys, keys, blocksize, nselectedvar, selectedvar_, is_, + ) + + is = is_[] + + return is +end + +""" + is::IS = DMNetworkCreateLocalIS(petsclib::PetscLibType,dm::PetscDM, numkeys::PetscInt, keys::Vector{PetscInt}, blocksize::Vector{PetscInt}, nselectedvar::Vector{PetscInt}, selectedvar::Vector{PetscInt}) +Create an index set object from the local vector of the network + +Not Collective + +Input Parameters: +- `dm` - `DMNETWORK` object +- `numkeys` - number of keys +- `keys` - array of keys that define the components of the variables you wish to extract +- `blocksize` - block size of the variables associated to the component +- `nselectedvar` - number of variables in each block to select +- `selectedvar` - the offset into the block of each variable in each block to select + +Output Parameter: +- `is` - the index set + +Level: advanced + +-seealso: `DM`, `DMNETWORK`, `DMNetworkCreate()`, `DMNetworkCreateIS()`, `ISCreateGeneral()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkCreateLocalIS")) +""" +function DMNetworkCreateLocalIS(petsclib::PetscLibType, dm::PetscDM, numkeys::PetscInt, keys::Vector{PetscInt}, blocksize::Vector{PetscInt}, nselectedvar::Vector{PetscInt}, selectedvar::Vector{PetscInt}) end + +@for_petsc function DMNetworkCreateLocalIS(petsclib::$UnionPetscLib, dm::PetscDM, numkeys::$PetscInt, keys::Vector{$PetscInt}, blocksize::Vector{$PetscInt}, nselectedvar::Vector{$PetscInt}, selectedvar::Vector{$PetscInt} ) + selectedvar_ = Ref(pointer(selectedvar)) + is_ = Ref{IS}() + + @chk ccall( + (:DMNetworkCreateLocalIS, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{CIS}), + dm, numkeys, keys, blocksize, nselectedvar, selectedvar_, is_, + ) + + is = is_[] + + return is +end + +""" + DMNetworkFinalizeComponents(petsclib::PetscLibType,dm::PetscDM) +Sets up internal data structures for the sections and components. It is called after registering new components and adding all components +to the cloned network. After calling this subroutine, no new components can be added to the network. + +Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkAddComponent()`, `DMNetworkRegisterComponent()`, `DMSetUp()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkFinalizeComponents")) +""" +function DMNetworkFinalizeComponents(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkFinalizeComponents(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMNetworkFinalizeComponents, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + network::PetscDM = DMNetworkCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a DMNetwork object, which encapsulates an unstructured network. + +Collective + +Input Parameter: +- `comm` - The communicator for the DMNetwork object + +Output Parameter: +- `network` - The DMNetwork object + +Level: beginner + +-seealso: `DMCreate()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkCreate")) +""" +function DMNetworkCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMNetworkCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + network_ = Ref{CDM}() + + @chk ccall( + (:DMNetworkCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CDM}), + comm, network_, + ) + + network = PetscDM(network_[], petsclib) + + return network +end + +""" + showranks::PetscBool = DMNetworkViewSetShowRanks(petsclib::PetscLibType,dm::PetscDM) +Sets viewing the `DMETNWORK` on each rank individually. + +Logically Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameter: +- `showranks` - `PETSC_TRUE` if viewing each rank's sub network individually + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkViewSetShowGlobal()`, `DMNetworkViewSetShowVertices()`, `DMNetworkViewSetShowNumbering()`, `DMNetworkViewSetViewRanks()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkViewSetShowRanks")) +""" +function DMNetworkViewSetShowRanks(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkViewSetShowRanks(petsclib::$UnionPetscLib, dm::PetscDM ) + showranks_ = Ref{PetscBool}() + + @chk ccall( + (:DMNetworkViewSetShowRanks, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, showranks_, + ) + + showranks = showranks_[] + + return showranks +end + +""" + showglobal::PetscBool = DMNetworkViewSetShowGlobal(petsclib::PetscLibType,dm::PetscDM) +Set viewing the global network. + +Logically Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameter: +- `showglobal` - `PETSC_TRUE` if viewing the global network + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkViewSetShowRanks()`, `DMNetworkViewSetShowVertices()`, `DMNetworkViewSetShowNumbering()`, `DMNetworkViewSetViewRanks()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkViewSetShowGlobal")) +""" +function DMNetworkViewSetShowGlobal(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkViewSetShowGlobal(petsclib::$UnionPetscLib, dm::PetscDM ) + showglobal_ = Ref{PetscBool}() + + @chk ccall( + (:DMNetworkViewSetShowGlobal, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, showglobal_, + ) + + showglobal = showglobal_[] + + return showglobal +end + +""" + showvertices::PetscBool = DMNetworkViewSetShowVertices(petsclib::PetscLibType,dm::PetscDM) +Sets whether to display the vertices in viewing routines. + +Logically Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameter: +- `showvertices` - `PETSC_TRUE` if visualizing the vertices + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkViewSetShowRanks()`, `DMNetworkViewSetShowGlobal()`, `DMNetworkViewSetShowNumbering()`, `DMNetworkViewSetViewRanks()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkViewSetShowVertices")) +""" +function DMNetworkViewSetShowVertices(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkViewSetShowVertices(petsclib::$UnionPetscLib, dm::PetscDM ) + showvertices_ = Ref{PetscBool}() + + @chk ccall( + (:DMNetworkViewSetShowVertices, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, showvertices_, + ) + + showvertices = showvertices_[] + + return showvertices +end + +""" + shownumbering::PetscBool = DMNetworkViewSetShowNumbering(petsclib::PetscLibType,dm::PetscDM) +Set displaying the numbering of edges and vertices in viewing routines. + +Logically Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameter: +- `shownumbering` - `PETSC_TRUE` if displaying the numbering of edges and vertices + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkViewSetShowRanks()`, `DMNetworkViewSetShowGlobal()`, `DMNetworkViewSetShowVertices()`, `DMNetworkViewSetViewRanks()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkViewSetShowNumbering")) +""" +function DMNetworkViewSetShowNumbering(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMNetworkViewSetShowNumbering(petsclib::$UnionPetscLib, dm::PetscDM ) + shownumbering_ = Ref{PetscBool}() + + @chk ccall( + (:DMNetworkViewSetShowNumbering, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, shownumbering_, + ) + + shownumbering = shownumbering_[] + + return shownumbering +end + +""" + DMNetworkViewSetViewRanks(petsclib::PetscLibType,dm::PetscDM, viewranks::IS) +View the `DMNETWORK` on each of the specified ranks individually. + +Collective + +Input Parameter: +- `dm` - the `DMNETWORK` object + +Output Parameter: +- `viewranks` - set of ranks to view the `DMNETWORK` on individually + +Level: beginner + +-seealso: `DM`, `DMNETWORK`, `DMNetworkViewSetShowRanks()`, `DMNetworkViewSetShowGlobal()`, `DMNetworkViewSetShowVertices()`, `DMNetworkViewSetShowNumbering()` + +# External Links +$(_doc_external("DMNetwork/DMNetworkViewSetViewRanks")) +""" +function DMNetworkViewSetViewRanks(petsclib::PetscLibType, dm::PetscDM, viewranks::IS) end + +@for_petsc function DMNetworkViewSetViewRanks(petsclib::$UnionPetscLib, dm::PetscDM, viewranks::IS ) + + @chk ccall( + (:DMNetworkViewSetViewRanks, $petsc_library), + PetscErrorCode, + (CDM, CIS), + dm, viewranks, + ) + + + return nothing +end + +""" + DMProductGetDM(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt, subdm::PetscDM) +Get sub + +Not Collective + +Input Parameters: +- `dm` - the` DMPRODUCT` +- `slot` - which dimension within `DMPRODUCT` whose coordinates is being provided, in the range 0 to dim-1 + +Output Parameter: +- `subdm` - the sub-`DM` + +Level: advanced + +-seealso: `DMPRODUCT`, `DMProductSetDM()`, `DMProductGetDimensionIndex()`, `DMProductSetDimensionIndex()` + +# External Links +$(_doc_external("DMPRODUCT/DMProductGetDM")) +""" +function DMProductGetDM(petsclib::PetscLibType, dm::PetscDM, slot::PetscInt, subdm::PetscDM) end + +@for_petsc function DMProductGetDM(petsclib::$UnionPetscLib, dm::PetscDM, slot::$PetscInt, subdm::PetscDM ) + subdm_ = Ref(subdm.ptr) + + @chk ccall( + (:DMProductGetDM, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CDM}), + dm, slot, subdm_, + ) + + subdm.ptr = subdm_[] + + return nothing +end + +""" + DMProductSetDM(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt, subdm::PetscDM) +Set sub + +Not Collective + +Input Parameters: +- `dm` - the `DMPRODUCT` +- `slot` - which dimension within `DMPRODUCT` whose coordinates is being provided, in the range 0 to dim-1 +- `subdm` - the sub-`DM` + +Level: advanced + +-seealso: `DMPRODUCT`, `DMProductGetDM()`, `DMProductSetDimensionIndex()`, `DMProductGetDimensionIndex()` + +# External Links +$(_doc_external("DMPRODUCT/DMProductSetDM")) +""" +function DMProductSetDM(petsclib::PetscLibType, dm::PetscDM, slot::PetscInt, subdm::PetscDM) end + +@for_petsc function DMProductSetDM(petsclib::$UnionPetscLib, dm::PetscDM, slot::$PetscInt, subdm::PetscDM ) + + @chk ccall( + (:DMProductSetDM, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, CDM), + dm, slot, subdm, + ) + + + return nothing +end + +""" + DMProductSetDimensionIndex(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt, idx::PetscInt) +Set which dimension `idx` of the sub + +Not Collective + +Input Parameters: +- `dm` - the `DMPRODUCT` +- `slot` - which dimension, in the range 0 to dim-1 you are providing to the `dm` +- `idx` - the dimension of the sub-`DM` to use + +Level: advanced + +-seealso: `DMPRODUCT`, `DMProductGetDM()`, `DMProductGetDimensionIndex()` + +# External Links +$(_doc_external("DMPRODUCT/DMProductSetDimensionIndex")) +""" +function DMProductSetDimensionIndex(petsclib::PetscLibType, dm::PetscDM, slot::PetscInt, idx::PetscInt) end + +@for_petsc function DMProductSetDimensionIndex(petsclib::$UnionPetscLib, dm::PetscDM, slot::$PetscInt, idx::$PetscInt ) + + @chk ccall( + (:DMProductSetDimensionIndex, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt), + dm, slot, idx, + ) + + + return nothing +end + +""" + idx::PetscInt = DMProductGetDimensionIndex(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt) +Get which dimension `idx` of the sub + +Not Collective + +Input Parameters: +- `dm` - the `DMPRODUCT` +- `slot` - which dimension, in the range 0 to dim-1 of `dm` + +Output Parameter: +- `idx` - the dimension of the sub-`DM` + +Level: advanced + +-seealso: `DMPRODUCT`, `DMProductGetDM()`, `DMProductSetDimensionIndex()` + +# External Links +$(_doc_external("DMPRODUCT/DMProductGetDimensionIndex")) +""" +function DMProductGetDimensionIndex(petsclib::PetscLibType, dm::PetscDM, slot::PetscInt) end + +@for_petsc function DMProductGetDimensionIndex(petsclib::$UnionPetscLib, dm::PetscDM, slot::$PetscInt ) + idx_ = Ref{$PetscInt}() + + @chk ccall( + (:DMProductGetDimensionIndex, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, slot, idx_, + ) + + idx = idx_[] + + return idx +end + +""" + DMCompositeSetCoupling(petsclib::PetscLibType,dm::PetscDM, FormCoupleLocations::external) +Sets user provided routines that compute the coupling between the +separate components `DM` in a `DMCOMPOSITE` to build the correct matrix nonzero structure. + +Logically Collective; No Fortran Support + +Input Parameters: +- `dm` - the composite object +- `FormCoupleLocations` - routine to set the nonzero locations in the matrix + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM` + +# External Links +$(_doc_external("DM/DMCompositeSetCoupling")) +""" +function DMCompositeSetCoupling(petsclib::PetscLibType, dm::PetscDM, FormCoupleLocations::external) end + +@for_petsc function DMCompositeSetCoupling(petsclib::$UnionPetscLib, dm::PetscDM, FormCoupleLocations::external ) + + @chk ccall( + (:DMCompositeSetCoupling, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, FormCoupleLocations, + ) + + + return nothing +end + +""" + nDM::PetscInt = DMCompositeGetNumberDM(petsclib::PetscLibType,dm::PetscDM) +Gets the number of `DM` objects in the `DMCOMPOSITE` +representation. + +Not Collective + +Input Parameter: +- `dm` - the `DMCOMPOSITE` object + +Output Parameter: +- `nDM` - the number of `DM` + +Level: beginner + +-seealso: `DMCOMPOSITE`, `DM` + +# External Links +$(_doc_external("DM/DMCompositeGetNumberDM")) +""" +function DMCompositeGetNumberDM(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMCompositeGetNumberDM(petsclib::$UnionPetscLib, dm::PetscDM ) + nDM_ = Ref{$PetscInt}() + + @chk ccall( + (:DMCompositeGetNumberDM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, nDM_, + ) + + nDM = nDM_[] + + return nDM +end + +""" + DMCompositeGetAccessArray(petsclib::PetscLibType,dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{PetscVec}) +Allows one to access the individual packed vectors in their global +representation. + +Collective + +Input Parameters: +- `dm` - the `DMCOMPOSITE` +- `pvec` - packed vector +- `nwanted` - number of vectors wanted +- `wanted` - sorted array of integers indicating thde vectors wanted, or `NULL` to get all vectors, length `nwanted` + +Output Parameter: +- `vecs` - array of requested global vectors (must be previously allocated and of length `nwanted`) + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMCompositeGetAccess()`, `DMCompositeGetEntries()`, `DMCompositeScatter()`, `DMCompositeGather()` + +# External Links +$(_doc_external("DM/DMCompositeGetAccessArray")) +""" +function DMCompositeGetAccessArray(petsclib::PetscLibType, dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{PetscVec}) end + +@for_petsc function DMCompositeGetAccessArray(petsclib::$UnionPetscLib, dm::PetscDM, pvec::PetscVec, nwanted::$PetscInt, wanted::Vector{$PetscInt}, vecs::Vector{PetscVec} ) + + @chk ccall( + (:DMCompositeGetAccessArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, $PetscInt, Ptr{$PetscInt}, Ptr{CVec}), + dm, pvec, nwanted, wanted, vecs, + ) + + + return nothing +end + +""" + DMCompositeGetLocalAccessArray(petsclib::PetscLibType,dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{PetscVec}) +Allows one to access the individual +packed vectors in their local representation. + +Collective + +Input Parameters: +- `dm` - the `DMCOMPOSITE` +- `pvec` - packed vector +- `nwanted` - number of vectors wanted +- `wanted` - sorted array of vectors wanted, or `NULL` to get all vectors, length `nwanted` + +Output Parameter: +- `vecs` - array of requested local vectors (must be allocated and of length `nwanted`) + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMCompositeRestoreLocalAccessArray()`, `DMCompositeGetAccess()`, +`DMCompositeGetEntries()`, `DMCompositeScatter()`, `DMCompositeGather()` + +# External Links +$(_doc_external("DM/DMCompositeGetLocalAccessArray")) +""" +function DMCompositeGetLocalAccessArray(petsclib::PetscLibType, dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{PetscVec}) end + +@for_petsc function DMCompositeGetLocalAccessArray(petsclib::$UnionPetscLib, dm::PetscDM, pvec::PetscVec, nwanted::$PetscInt, wanted::Vector{$PetscInt}, vecs::Vector{PetscVec} ) + + @chk ccall( + (:DMCompositeGetLocalAccessArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, $PetscInt, Ptr{$PetscInt}, Ptr{CVec}), + dm, pvec, nwanted, wanted, vecs, + ) + + + return nothing +end + +""" + DMCompositeRestoreAccessArray(petsclib::PetscLibType,dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{PetscVec}) +Returns the vectors obtained with `DMCompositeGetAccessArray()` + +Collective + +Input Parameters: +- `dm` - the `DMCOMPOSITE` object +- `pvec` - packed vector +- `nwanted` - number of vectors wanted +- `wanted` - sorted array of vectors wanted, or `NULL` to restore all vectors +- `vecs` - array of global vectors + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMCompositeRestoreAccess()`, `DMCompositeRestoreEntries()`, `DMCompositeScatter()`, `DMCompositeGather()` + +# External Links +$(_doc_external("DM/DMCompositeRestoreAccessArray")) +""" +function DMCompositeRestoreAccessArray(petsclib::PetscLibType, dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{PetscVec}) end + +@for_petsc function DMCompositeRestoreAccessArray(petsclib::$UnionPetscLib, dm::PetscDM, pvec::PetscVec, nwanted::$PetscInt, wanted::Vector{$PetscInt}, vecs::Vector{PetscVec} ) + + @chk ccall( + (:DMCompositeRestoreAccessArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, $PetscInt, Ptr{$PetscInt}, Ptr{CVec}), + dm, pvec, nwanted, wanted, vecs, + ) + + + return nothing +end + +""" + DMCompositeRestoreLocalAccessArray(petsclib::PetscLibType,dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::PetscVec) +Returns the vectors obtained with `DMCompositeGetLocalAccessArray()`. + +Collective + +Input Parameters: +- `dm` - the `DMCOMPOSITE` object +- `pvec` - packed vector +- `nwanted` - number of vectors wanted +- `wanted` - sorted array of vectors wanted, or `NULL` to restore all vectors +- `vecs` - array of local vectors + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMCompositeGetLocalAccessArray()`, `DMCompositeRestoreAccessArray()`, +`DMCompositeRestoreAccess()`, `DMCompositeRestoreEntries()`, +`DMCompositeScatter()`, `DMCompositeGather()` + +# External Links +$(_doc_external("DM/DMCompositeRestoreLocalAccessArray")) +""" +function DMCompositeRestoreLocalAccessArray(petsclib::PetscLibType, dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::PetscVec) end + +@for_petsc function DMCompositeRestoreLocalAccessArray(petsclib::$UnionPetscLib, dm::PetscDM, pvec::PetscVec, nwanted::$PetscInt, wanted::Vector{$PetscInt}, vecs::PetscVec ) + vecs_ = Ref(vecs.ptr) + + @chk ccall( + (:DMCompositeRestoreLocalAccessArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, $PetscInt, Ptr{$PetscInt}, Ptr{CVec}), + dm, pvec, nwanted, wanted, vecs_, + ) + + vecs.ptr = vecs_[] + + return nothing +end + +""" + DMCompositeScatterArray(petsclib::PetscLibType,dm::PetscDM, gvec::PetscVec, lvecs::PetscVec) +Scatters from a global packed vector into its individual local vectors + +Collective + +Input Parameters: +- `dm` - the `DMCOMPOSITE` object +- `gvec` - the global vector +- `lvecs` - array of local vectors, NULL for any that are not needed + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMDestroy()`, `DMCompositeAddDM()`, `DMCreateGlobalVector()` +`DMCompositeGather()`, `DMCompositeCreate()`, `DMCompositeGetISLocalToGlobalMappings()`, `DMCompositeGetAccess()`, +`DMCompositeGetLocalVectors()`, `DMCompositeRestoreLocalVectors()`, `DMCompositeGetEntries()` + +# External Links +$(_doc_external("DM/DMCompositeScatterArray")) +""" +function DMCompositeScatterArray(petsclib::PetscLibType, dm::PetscDM, gvec::PetscVec, lvecs::PetscVec) end + +@for_petsc function DMCompositeScatterArray(petsclib::$UnionPetscLib, dm::PetscDM, gvec::PetscVec, lvecs::PetscVec ) + lvecs_ = Ref(lvecs.ptr) + + @chk ccall( + (:DMCompositeScatterArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{CVec}), + dm, gvec, lvecs_, + ) + + lvecs.ptr = lvecs_[] + + return nothing +end + +""" + DMCompositeGatherArray(petsclib::PetscLibType,dm::PetscDM, imode::InsertMode, gvec::PetscVec, lvecs::PetscVec) +Gathers into a global packed vector from its individual local vectors + +Collective + +Input Parameters: +- `dm` - the `DMCOMPOSITE` object +- `gvec` - the global vector +- `imode` - `INSERT_VALUES` or `ADD_VALUES` +- `lvecs` - the individual sequential vectors, NULL for any that are not needed + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMDestroy()`, `DMCompositeAddDM()`, `DMCreateGlobalVector()`, +`DMCompositeScatter()`, `DMCompositeCreate()`, `DMCompositeGetISLocalToGlobalMappings()`, `DMCompositeGetAccess()`, +`DMCompositeGetLocalVectors()`, `DMCompositeRestoreLocalVectors()`, `DMCompositeGetEntries()`, + +# External Links +$(_doc_external("DM/DMCompositeGatherArray")) +""" +function DMCompositeGatherArray(petsclib::PetscLibType, dm::PetscDM, imode::InsertMode, gvec::PetscVec, lvecs::PetscVec) end + +@for_petsc function DMCompositeGatherArray(petsclib::$UnionPetscLib, dm::PetscDM, imode::InsertMode, gvec::PetscVec, lvecs::PetscVec ) + lvecs_ = Ref(lvecs.ptr) + + @chk ccall( + (:DMCompositeGatherArray, $petsc_library), + PetscErrorCode, + (CDM, InsertMode, CVec, Ptr{CVec}), + dm, imode, gvec, lvecs_, + ) + + lvecs.ptr = lvecs_[] + + return nothing +end + +""" + DMCompositeAddDM(petsclib::PetscLibType,dmc::PetscDM, dm::PetscDM) +adds a `DM` vector to a `DMCOMPOSITE` + +Collective + +Input Parameters: +- `dmc` - the `DMCOMPOSITE` object +- `dm` - the `DM` object + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMDestroy()`, `DMCompositeGather()`, `DMCreateGlobalVector()`, +`DMCompositeScatter()`, `DMCompositeCreate()`, `DMCompositeGetISLocalToGlobalMappings()`, `DMCompositeGetAccess()`, +`DMCompositeGetLocalVectors()`, `DMCompositeRestoreLocalVectors()`, `DMCompositeGetEntries()` + +# External Links +$(_doc_external("DM/DMCompositeAddDM")) +""" +function DMCompositeAddDM(petsclib::PetscLibType, dmc::PetscDM, dm::PetscDM) end + +@for_petsc function DMCompositeAddDM(petsclib::$UnionPetscLib, dmc::PetscDM, dm::PetscDM ) + + @chk ccall( + (:DMCompositeAddDM, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dmc, dm, + ) + + + return nothing +end + +""" + DMCompositeGetISLocalToGlobalMappings(petsclib::PetscLibType,dm::PetscDM, ltogs::Vector{ISLocalToGlobalMapping}) +gets an `ISLocalToGlobalMapping` for each `DM` in the `DMCOMPOSITE`, maps to the composite global space + +Collective; No Fortran Support + +Input Parameter: +- `dm` - the `DMCOMPOSITE` object + +Output Parameter: +- `ltogs` - the individual mappings for each packed vector. Note that this includes +all the ghost points that individual ghosted `DMDA` may have. + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMDestroy()`, `DMCompositeAddDM()`, `DMCreateGlobalVector()`, +`DMCompositeGather()`, `DMCompositeCreate()`, `DMCompositeGetAccess()`, `DMCompositeScatter()`, +`DMCompositeGetLocalVectors()`, `DMCompositeRestoreLocalVectors()`, `DMCompositeGetEntries()` + +# External Links +$(_doc_external("DM/DMCompositeGetISLocalToGlobalMappings")) +""" +function DMCompositeGetISLocalToGlobalMappings(petsclib::PetscLibType, dm::PetscDM, ltogs::Vector{ISLocalToGlobalMapping}) end + +@for_petsc function DMCompositeGetISLocalToGlobalMappings(petsclib::$UnionPetscLib, dm::PetscDM, ltogs::Vector{ISLocalToGlobalMapping} ) + ltogs_ = Ref(pointer(ltogs)) + + @chk ccall( + (:DMCompositeGetISLocalToGlobalMappings, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{ISLocalToGlobalMapping}}), + dm, ltogs_, + ) + + + return nothing +end + +""" + DMCompositeGetLocalISs(petsclib::PetscLibType,dm::PetscDM, is::Vector{IS}) +Gets index sets for each component of a composite local vector + +Not Collective; No Fortran Support + +Input Parameter: +- `dm` - the `DMCOMPOSITE` + +Output Parameter: +- `is` - array of serial index sets for each component of the `DMCOMPOSITE` + +Level: intermediate + +-seealso: `DMCOMPOSITE`, `DM`, `DMCompositeGetGlobalISs()`, `DMCompositeGetISLocalToGlobalMappings()`, `MatGetLocalSubMatrix()`, +`MatCreateLocalRef()`, `DMCompositeGetNumberDM()` + +# External Links +$(_doc_external("DM/DMCompositeGetLocalISs")) +""" +function DMCompositeGetLocalISs(petsclib::PetscLibType, dm::PetscDM, is::Vector{IS}) end + +@for_petsc function DMCompositeGetLocalISs(petsclib::$UnionPetscLib, dm::PetscDM, is::Vector{IS} ) + is_ = Ref(pointer(is)) + + @chk ccall( + (:DMCompositeGetLocalISs, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{CIS}}), + dm, is_, + ) + + + return nothing +end + +""" + DMCompositeGetGlobalISs(petsclib::PetscLibType,dm::PetscDM, is::Vector{IS}) +Gets the index sets for each composed object in a `DMCOMPOSITE` + +Collective + +Input Parameter: +- `dm` - the `DMCOMPOSITE` object + +Output Parameter: +- `is` - the array of index sets + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMDestroy()`, `DMCompositeAddDM()`, `DMCreateGlobalVector()`, +`DMCompositeGather()`, `DMCompositeCreate()`, `DMCompositeGetAccess()`, `DMCompositeScatter()`, +`DMCompositeGetLocalVectors()`, `DMCompositeRestoreLocalVectors()`, `DMCompositeGetEntries()` + +# External Links +$(_doc_external("DM/DMCompositeGetGlobalISs")) +""" +function DMCompositeGetGlobalISs(petsclib::PetscLibType, dm::PetscDM, is::Vector{IS}) end + +@for_petsc function DMCompositeGetGlobalISs(petsclib::$UnionPetscLib, dm::PetscDM, is::Vector{IS} ) + is_ = Ref(pointer(is)) + + @chk ccall( + (:DMCompositeGetGlobalISs, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{CIS}}), + dm, is_, + ) + + + return nothing +end + +""" + DMCompositeGetEntriesArray(petsclib::PetscLibType,dm::PetscDM, dms::Vector{PetscDM}) +Gets the DM for each entry in a `DMCOMPOSITE` + +Not Collective + +Input Parameter: +- `dm` - the `DMCOMPOSITE` object + +Output Parameter: +- `dms` - array of sufficient length (see `DMCompositeGetNumberDM()`) to hold the individual `DM` + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMDestroy()`, `DMCompositeAddDM()`, `DMCreateGlobalVector()`, `DMCompositeGetEntries()` +`DMCompositeGather()`, `DMCompositeCreate()`, `DMCompositeGetISLocalToGlobalMappings()`, `DMCompositeGetAccess()`, +`DMCompositeRestoreLocalVectors()`, `DMCompositeGetLocalVectors()`, `DMCompositeScatter()` + +# External Links +$(_doc_external("DM/DMCompositeGetEntriesArray")) +""" +function DMCompositeGetEntriesArray(petsclib::PetscLibType, dm::PetscDM, dms::Vector{PetscDM}) end + +@for_petsc function DMCompositeGetEntriesArray(petsclib::$UnionPetscLib, dm::PetscDM, dms::Vector{PetscDM} ) + + @chk ccall( + (:DMCompositeGetEntriesArray, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, dms, + ) + + + return nothing +end + +""" + packer::PetscDM = DMCompositeCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a `DMCOMPOSITE`, used to generate "composite" +vectors made up of several subvectors. + +Collective + +Input Parameter: +- `comm` - the processors that will share the global vector + +Output Parameter: +- `packer` - the `DMCOMPOSITE` object + +Level: advanced + +-seealso: `DMCOMPOSITE`, `DM`, `DMDestroy()`, `DMCompositeAddDM()`, `DMCompositeScatter()`, `DMCreate()` +`DMCompositeGather()`, `DMCreateGlobalVector()`, `DMCompositeGetISLocalToGlobalMappings()`, `DMCompositeGetAccess()` +`DMCompositeGetLocalVectors()`, `DMCompositeRestoreLocalVectors()`, `DMCompositeGetEntries()` + +# External Links +$(_doc_external("DM/DMCompositeCreate")) +""" +function DMCompositeCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMCompositeCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + packer_ = Ref{CDM}() + + @chk ccall( + (:DMCompositeCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CDM}), + comm, packer_, + ) + + packer = PetscDM(packer_[], petsclib) + + return packer +end + +""" + dm::PetscDM = DMStagCreate1d(petsclib::PetscLibType,comm::MPI_Comm, bndx::DMBoundaryType, M::PetscInt, dof0::PetscInt, dof1::PetscInt, stencilType::DMStagStencilType, stencilWidth::PetscInt, lx::Vector{PetscInt}) +Create an object to manage data living on the elements and vertices of a parallelized regular 1D grid. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bndx` - boundary type: `DM_BOUNDARY_NONE`, `DM_BOUNDARY_PERIODIC`, or `DM_BOUNDARY_GHOSTED` +- `M` - global number of elements +- `dof0` - number of degrees of freedom per vertex/0-cell +- `dof1` - number of degrees of freedom per element/1-cell +- `stencilType` - ghost/halo region type: `DMSTAG_STENCIL_BOX` or `DMSTAG_STENCIL_NONE` +- `stencilWidth` - width, in elements, of halo/ghost region +- `lx` - array of local sizes, of length equal to the comm size, summing to `M` or `NULL` + +Output Parameter: +- `dm` - the new `DMSTAG` object + +Options Database Keys: +- `-dm_view` - calls `DMViewFromOptions()` at the conclusion of `DMSetUp()` +- `-stag_grid_x ` - number of elements in the x direction +- `-stag_ghost_stencil_width` - width of ghost region, in elements +- `-stag_boundary_type_x ` - `DMBoundaryType` value + +Level: beginner + +Notes: +You must call `DMSetUp()` after this call before using the `DM`. +If you wish to use the options database (see the keys above) to change values in the `DMSTAG`, you must call +`DMSetFromOptions()` after this function but before `DMSetUp()`. + +See also: +=== +`DMSTAG`, `DMStagCreate2d()`, `DMStagCreate3d()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()`, `DMLocalToGlobalBegin()`, `DMDACreate1d()` + +# External Links +$(_doc_external("DMStag/DMStagCreate1d")) +""" +function DMStagCreate1d(petsclib::PetscLibType, comm::MPI_Comm, bndx::DMBoundaryType, M::PetscInt, dof0::PetscInt, dof1::PetscInt, stencilType::DMStagStencilType, stencilWidth::PetscInt, lx::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function DMStagCreate1d(petsclib::$UnionPetscLib, comm::MPI_Comm, bndx::DMBoundaryType, M::$PetscInt, dof0::$PetscInt, dof1::$PetscInt, stencilType::DMStagStencilType, stencilWidth::$PetscInt, lx::Union{Ptr,Vector{$PetscInt}} ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMStagCreate1d, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMBoundaryType, $PetscInt, $PetscInt, $PetscInt, DMStagStencilType, $PetscInt, Ptr{$PetscInt}, Ptr{CDM}), + comm, bndx, M, dof0, dof1, stencilType, stencilWidth, lx, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMStagVecSplitToDMDA(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec, loc::DMStagStencilLocation, c::PetscInt, pda::PetscDM, pdavec::PetscVec) +create a `DMDA` and `Vec` from a subgrid of a `DMSTAG` and its `Vec` + +Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `vec` - `Vec` object associated with `dm` +- `loc` - which subgrid to extract (see `DMStagStencilLocation`) +- `c` - which component to extract (see note below) + +Output Parameters: +- `pda` - the `DMDA` +- `pdavec` - the new `Vec` + +Level: advanced + +Notes: +If a `c` value of `-k` is provided, the first `k` DOF for that position are extracted, +padding with zero values if needed. If a non-negative value is provided, a single +DOF is extracted. + +The caller is responsible for destroying the created `DMDA` and `Vec`. + +See also: +=== +`DMSTAG`, `DMDA`, `DMStagStencilLocation`, `DM`, `Vec`, `DMStagMigrateVec()`, `DMStagCreateCompatibleDMStag()` + +# External Links +$(_doc_external("DMStag/DMStagVecSplitToDMDA")) +""" +function DMStagVecSplitToDMDA(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec, loc::DMStagStencilLocation, c::PetscInt, pda::PetscDM, pdavec::PetscVec) end + +@for_petsc function DMStagVecSplitToDMDA(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec, loc::DMStagStencilLocation, c::$PetscInt, pda::PetscDM, pdavec::PetscVec ) + pda_ = Ref(pda.ptr) + pdavec_ = Ref(pdavec.ptr) + + @chk ccall( + (:DMStagVecSplitToDMDA, $petsc_library), + PetscErrorCode, + (CDM, CVec, DMStagStencilLocation, $PetscInt, Ptr{CDM}, Ptr{CVec}), + dm, vec, loc, c, pda_, pdavec_, + ) + + pda.ptr = pda_[] + pdavec.ptr = pdavec_[] + + return nothing +end + +""" + is::IS = DMStagCreateISFromStencils(petsclib::PetscLibType,dm::PetscDM, n_stencil::PetscInt, stencils::Vector{DMStagStencil}) +Create an `IS`, using global numberings, for a subset of DOF in a `DMSTAG` object + +Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `n_stencil` - the number of stencils provided +- `stencils` - an array of `DMStagStencil` objects (`i`, `j`, and `k` are ignored) + +Output Parameter: +- `is` - the global `IS` + +Note: +Redundant entries in the stencils argument are ignored + +Level: advanced + +See also: +=== +`DMSTAG`, `IS`, `DMStagStencil`, `DMCreateGlobalVector` + +# External Links +$(_doc_external("DMStag/DMStagCreateISFromStencils")) +""" +function DMStagCreateISFromStencils(petsclib::PetscLibType, dm::PetscDM, n_stencil::PetscInt, stencils::Vector{DMStagStencil}) end + +@for_petsc function DMStagCreateISFromStencils(petsclib::$UnionPetscLib, dm::PetscDM, n_stencil::$PetscInt, stencils::Vector{DMStagStencil} ) + is_ = Ref{IS}() + + @chk ccall( + (:DMStagCreateISFromStencils, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{DMStagStencil}, Ptr{CIS}), + dm, n_stencil, stencils, is_, + ) + + is = is_[] + + return is +end + +""" + dof::PetscInt = DMStagGetLocationDOF(petsclib::PetscLibType,dm::PetscDM, loc::DMStagStencilLocation) +Get number of DOF associated with a given point in a `DMSTAG` grid + +Not Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `loc` - grid point (see `DMStagStencilLocation`) + +Output Parameter: +- `dof` - the number of DOF (components) living at `loc` in `dm` + +Level: intermediate + +See also: +=== +`DMSTAG`, `DMStagStencilLocation`, `DMStagStencil`, `DMDAGetDof()` + +# External Links +$(_doc_external("DMStag/DMStagGetLocationDOF")) +""" +function DMStagGetLocationDOF(petsclib::PetscLibType, dm::PetscDM, loc::DMStagStencilLocation) end + +@for_petsc function DMStagGetLocationDOF(petsclib::$UnionPetscLib, dm::PetscDM, loc::DMStagStencilLocation ) + dof_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetLocationDOF, $petsc_library), + PetscErrorCode, + (CDM, DMStagStencilLocation, Ptr{$PetscInt}), + dm, loc, dof_, + ) + + dof = dof_[] + + return dof +end + +""" + val::PetscScalar = DMStagMatGetValuesStencil(petsclib::PetscLibType,dm::PetscDM, mat::PetscMat, nRow::PetscInt, posRow::DMStagStencil, nCol::PetscInt, posCol::DMStagStencil) +retrieve local matrix entries using grid indexing + +Not Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `mat` - the matrix +- `nRow` - number of rows +- `posRow` - grid locations (including components) of rows +- `nCol` - number of columns +- `posCol` - grid locations (including components) of columns + +Output Parameter: +- `val` - logically two-dimensional array of values + +Level: advanced + +See also: +=== +`DMSTAG`, `DMStagStencil`, `DMStagStencilLocation`, `DMStagVecGetValuesStencil()`, `DMStagVecSetValuesStencil()`, `DMStagMatSetValuesStencil()`, `MatSetValuesStencil()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `DMCreateMatrix()` + +# External Links +$(_doc_external("DMStag/DMStagMatGetValuesStencil")) +""" +function DMStagMatGetValuesStencil(petsclib::PetscLibType, dm::PetscDM, mat::PetscMat, nRow::PetscInt, posRow::Vector{DMStagStencil}, nCol::PetscInt, posCol::Vector{DMStagStencil}) end + +@for_petsc function DMStagMatGetValuesStencil(petsclib::$UnionPetscLib, dm::PetscDM, mat::PetscMat, nRow::$PetscInt, posRow::Vector{DMStagStencil}, nCol::$PetscInt, posCol::Vector{DMStagStencil} ) + # Prepare output buffer (flat) and pass pointer to PETSc + vals = Vector{$PetscScalar}(undef, nRow * nCol) + + @chk ccall( + (:DMStagMatGetValuesStencil, $petsc_library), + PetscErrorCode, + (CDM, CMat, $PetscInt, Ptr{DMStagStencil}, $PetscInt, Ptr{DMStagStencil}, Ptr{$PetscScalar}), + dm, mat, nRow, posRow, nCol, posCol, vals, + ) + + # reshape into 2D Julia array (rows x cols) + return reshape(vals, nRow, nCol) +end + +""" + DMStagMatSetValuesStencil(petsclib::PetscLibType,dm::PetscDM, mat::PetscMat, nRow::PetscInt, posRow::DMStagStencil, nCol::PetscInt, posCol::DMStagStencil, val::PetscScalar, insertMode::InsertMode) +insert or add matrix entries using grid indexing + +Not Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `mat` - the matrix +- `nRow` - number of rows +- `posRow` - grid locations (including components) of rows +- `nCol` - number of columns +- `posCol` - grid locations (including components) of columns +- `val` - logically two-dimensional array of values +- `insertMode` - `INSERT_VALUES` or `ADD_VALUES` + +Notes: +See notes for `MatSetValuesStencil()` + +Level: intermediate + +See also: +=== +`DMSTAG`, `DMStagStencil`, `DMStagStencilLocation`, `DMStagVecGetValuesStencil()`, `DMStagVecSetValuesStencil()`, `DMStagMatGetValuesStencil()`, `MatSetValuesStencil()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `DMCreateMatrix()` + +# External Links +$(_doc_external("DMStag/DMStagMatSetValuesStencil")) +""" +function DMStagMatSetValuesStencil(petsclib::PetscLibType, dm::PetscDM, mat::PetscMat, nRow::PetscInt, posRow::DMStagStencil, nCol::PetscInt, posCol::DMStagStencil, val::PetscScalar, insertMode::InsertMode) end + +@for_petsc function DMStagMatSetValuesStencil(petsclib::$UnionPetscLib, dm::PetscDM, mat::PetscMat, nRow::$PetscInt, posRow::Vector{DMStagStencil}, nCol::$PetscInt, posCol::Vector{DMStagStencil}, val::Vector{$PetscScalar}, insertMode::InsertMode ) + + @chk ccall( + (:DMStagMatSetValuesStencil, $petsc_library), + PetscErrorCode, + (CDM, CMat, $PetscInt, Ptr{DMStagStencil}, $PetscInt, Ptr{DMStagStencil}, Ptr{$PetscScalar}, InsertMode), + dm, mat, nRow, posRow, nCol, posCol, val, insertMode, + ) + + return nothing +end + +""" + ix::PetscInt = DMStagStencilToIndexLocal(petsclib::PetscLibType,dm::PetscDM, dim::PetscInt, n::PetscInt, pos::DMStagStencil) +Convert an array of `DMStagStenci`l objects to an array of indices into a local vector. + +Not Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `dim` - the dimension of the `DMSTAG` object +- `n` - the number of `DMStagStencil` objects +- `pos` - an array of `n` `DMStagStencil` objects + +Output Parameter: +- `ix` - output array of `n` indices + +Notes: +The `DMStagStencil` objects in `pos` use global element indices. + +The `.c` fields in `pos` must always be set (even if to `0`). + +Developer Notes: +This is a "hot" function, and accepts the dimension redundantly to avoid having to perform any error checking inside the function. + +Level: developer + +See also: +=== +`DMSTAG`, `DMStagStencilLocation`, `DMStagStencil`, `DMGetLocalVector`, `DMCreateLocalVector` + +# External Links +$(_doc_external("DMStag/DMStagStencilToIndexLocal")) +""" +function DMStagStencilToIndexLocal(petsclib::PetscLibType, dm::PetscDM, dim::PetscInt, n::PetscInt, pos::DMStagStencil) end + +@for_petsc function DMStagStencilToIndexLocal(petsclib::$UnionPetscLib, dm::PetscDM, dim::$PetscInt, n::$PetscInt, pos::Vector{DMStagStencil} ) + #ix_ = Ref{$PetscInt}() + + ix = Vector{$PetscInt}(undef, n) + @chk ccall( + (:DMStagStencilToIndexLocal, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{DMStagStencil}, Ptr{$PetscInt}), + dm, dim, n, pos, ix, + ) + + #ix = ix_[] + + return ix +end + +""" + val::PetscScalar = DMStagVecGetValuesStencil(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec, n::PetscInt, pos::DMStagStencil) +get vector values using grid indexing + +Not Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `vec` - the vector object +- `n` - the number of values to obtain +- `pos` - locations to obtain values from (as an array of `DMStagStencil` values) + +Output Parameter: +- `val` - value at the point + +Notes: +Accepts stencils which refer to global element numbers, but +only allows access to entries in the local representation (including ghosts). + +This approach is not as efficient as getting values directly with `DMStagVecGetArray()`, +which is recommended for matrix-free operators. + +Level: advanced + +See also: +=== +`DMSTAG`, `DMStagStencil`, `DMStagStencilLocation`, `DMStagVecSetValuesStencil()`, `DMStagMatSetValuesStencil()`, `DMStagVecGetArray()` + +# External Links +$(_doc_external("DMStag/DMStagVecGetValuesStencil")) +""" +function DMStagVecGetValuesStencil(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec, n::PetscInt, pos::Vector{DMStagStencil}) end + +@for_petsc function DMStagVecGetValuesStencil(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec, n::$PetscInt, pos::Vector{DMStagStencil}) + # Allocate the output array (PETSc writes into this buffer) + @assert n>0 + + vals = Vector{$PetscScalar}(undef, n) + + @chk ccall( + (:DMStagVecGetValuesStencil, $petsc_library), + PetscErrorCode, + (CDM, CVec, $PetscInt, Ptr{DMStagStencil}, Ptr{$PetscScalar}), + dm, vec, n, pos, vals, + ) + + return vals +end + +""" + DMStagVecSetValuesStencil(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec, n::PetscInt, pos::DMStagStencil, val::PetscScalar, insertMode::InsertMode) +Set `Vec` values using global grid indexing + +Not Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `vec` - the `Vec` +- `n` - the number of values to set +- `pos` - the locations to set values, as an array of `DMStagStencil` structs +- `val` - the values to set +- `insertMode` - `INSERT_VALUES` or `ADD_VALUES` + +Notes: +The vector is expected to be a global vector compatible with the DM (usually obtained by `DMGetGlobalVector()` or `DMCreateGlobalVector()`). + +This approach is not as efficient as setting values directly with `DMStagVecGetArray()`, which is recommended for matrix-free operators. +For assembling systems, where overhead may be less important than convenience, this routine could be helpful in assembling a righthand side and a matrix (using `DMStagMatSetValuesStencil()`). + +Level: advanced + +See also: +=== +`DMSTAG`, `Vec`, `DMStagStencil`, `DMStagStencilLocation`, `DMStagVecGetValuesStencil()`, `DMStagMatSetValuesStencil()`, `DMCreateGlobalVector()`, `DMGetLocalVector()`, `DMStagVecGetArray()` + +# External Links +$(_doc_external("DMStag/DMStagVecSetValuesStencil")) +""" +function DMStagVecSetValuesStencil(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec, n::PetscInt, pos::DMStagStencil, val::PetscScalar, insertMode::InsertMode) end + +@for_petsc function DMStagVecSetValuesStencil(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec, n::$PetscInt, pos::Vector{DMStagStencil}, val::Vector{$PetscScalar}, insertMode::InsertMode ) + + @chk ccall( + (:DMStagVecSetValuesStencil, $petsc_library), + PetscErrorCode, + (CDM, CVec, $PetscInt, Ptr{DMStagStencil}, Ptr{$PetscScalar}, InsertMode), + dm, vec, n, pos, val, insertMode, + ) + + + return nothing +end + +""" + DMStagRestrictSimple(petsclib::PetscLibType,dmf::PetscDM, xf::PetscVec, dmc::PetscDM, xc::PetscVec) +restricts data from a fine to a coarse `DMSTAG`, in the simplest way + +Values on coarse cells are averages of all fine cells that they cover. +Thus, values on vertices are injected, values on edges are averages +of the underlying two fine edges, and values on elements in +d dimensions are averages of 2^d underlying elements. + +Input Parameters: +- `dmf` - fine `DM` +- `xf` - data on fine `DM` +- `dmc` - coarse `DM` + +Output Parameter: +- `xc` - data on coarse `DM` + +Level: advanced + +See also: +=== +`DMSTAG`, `DM`, `DMRestrict()`, `DMCoarsen()`, `DMCreateInjection()` + +# External Links +$(_doc_external("DMStag/DMStagRestrictSimple")) +""" +function DMStagRestrictSimple(petsclib::PetscLibType, dmf::PetscDM, xf::PetscVec, dmc::PetscDM, xc::PetscVec) end + +@for_petsc function DMStagRestrictSimple(petsclib::$UnionPetscLib, dmf::PetscDM, xf::PetscVec, dmc::PetscDM, xc::PetscVec ) + + @chk ccall( + (:DMStagRestrictSimple, $petsc_library), + PetscErrorCode, + (CDM, CVec, CDM, CVec), + dmf, xf, dmc, xc, + ) + + + return nothing +end + +""" + dm::PetscDM = DMStagCreate3d(petsclib::PetscLibType,comm::MPI_Comm, bndx::DMBoundaryType, bndy::DMBoundaryType, bndz::DMBoundaryType, M::PetscInt, N::PetscInt, P::PetscInt, m::PetscInt, n::PetscInt, p::PetscInt, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, dof3::PetscInt, stencilType::DMStagStencilType, stencilWidth::PetscInt, lx::Vector{PetscInt}, ly::Vector{PetscInt}, lz::Vector{PetscInt}) +Create an object to manage data living on the elements, faces, edges, and vertices of a parallelized regular 3D grid. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bndx` - x boundary type, `DM_BOUNDARY_NONE`, `DM_BOUNDARY_PERIODIC`, or `DM_BOUNDARY_GHOSTED` +- `bndy` - y boundary type, `DM_BOUNDARY_NONE`, `DM_BOUNDARY_PERIODIC`, or `DM_BOUNDARY_GHOSTED` +- `bndz` - z boundary type, `DM_BOUNDARY_NONE`, `DM_BOUNDARY_PERIODIC`, or `DM_BOUNDARY_GHOSTED` +- `M` - global number of elements in x direction +- `N` - global number of elements in y direction +- `P` - global number of elements in z direction +- `m` - number of ranks in the x direction (may be `PETSC_DECIDE`) +- `n` - number of ranks in the y direction (may be `PETSC_DECIDE`) +- `p` - number of ranks in the z direction (may be `PETSC_DECIDE`) +- `dof0` - number of degrees of freedom per vertex/0-cell +- `dof1` - number of degrees of freedom per edge/1-cell +- `dof2` - number of degrees of freedom per face/2-cell +- `dof3` - number of degrees of freedom per element/3-cell +- `stencilType` - ghost/halo region type: `DMSTAG_STENCIL_NONE`, `DMSTAG_STENCIL_BOX`, or `DMSTAG_STENCIL_STAR` +- `stencilWidth` - width, in elements, of halo/ghost region +- `lx` - array of local x element counts, of length equal to `m`, summing to `M`, or `NULL` +- `ly` - arrays of local y element counts, of length equal to `n`, summing to `N`, or `NULL` +- `lz` - arrays of local z element counts, of length equal to `p`, summing to `P`, or `NULL` + +Output Parameter: +- `dm` - the new `DMSTAG` object + +Options Database Keys: +- `-dm_view` - calls `DMViewFromOptions()` at the conclusion of `DMSetUp()` +- `-stag_grid_x ` - number of elements in the x direction +- `-stag_grid_y ` - number of elements in the y direction +- `-stag_grid_z ` - number of elements in the z direction +- `-stag_ranks_x ` - number of ranks in the x direction +- `-stag_ranks_y ` - number of ranks in the y direction +- `-stag_ranks_z ` - number of ranks in the z direction +- `-stag_ghost_stencil_width` - width of ghost region, in elements +- `-stag_boundary_type x ` - `DMBoundaryType` value +- `-stag_boundary_type y ` - `DMBoundaryType` value +- `-stag_boundary_type z ` - `DMBoundaryType` value + +Level: beginner + +Notes: +You must call `DMSetUp()` after this call before using the `DM`. +If you wish to use the options database (see the keys above) to change values in the `DMSTAG`, you must call +`DMSetFromOptions()` after this function but before `DMSetUp()`. + +See also: +=== +`DMSTAG`, `DMStagCreate1d()`, `DMStagCreate2d()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()`, `DMLocalToGlobalBegin()`, `DMDACreate3d()` + +# External Links +$(_doc_external("DMStag/DMStagCreate3d")) +""" +function DMStagCreate3d(petsclib::PetscLibType, comm::MPI_Comm, bndx::DMBoundaryType, bndy::DMBoundaryType, bndz::DMBoundaryType, M::PetscInt, N::PetscInt, P::PetscInt, m::PetscInt, n::PetscInt, p::PetscInt, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, dof3::PetscInt, stencilType::DMStagStencilType, stencilWidth::PetscInt, lx::Union{Ptr,Vector{PetscInt}}, ly::Union{Ptr,Vector{PetscInt}}, lz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function DMStagCreate3d(petsclib::$UnionPetscLib, comm::MPI_Comm, bndx::DMBoundaryType, bndy::DMBoundaryType, bndz::DMBoundaryType, M::$PetscInt, N::$PetscInt, P::$PetscInt, m::$PetscInt, n::$PetscInt, p::$PetscInt, dof0::$PetscInt, dof1::$PetscInt, dof2::$PetscInt, dof3::$PetscInt, stencilType::DMStagStencilType, stencilWidth::$PetscInt, lx::Union{Ptr,Vector{$PetscInt}}, ly::Union{Ptr,Vector{$PetscInt}}, lz::Union{Ptr,Vector{$PetscInt}} ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMStagCreate3d, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMBoundaryType, DMBoundaryType, DMBoundaryType, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, DMStagStencilType, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{CDM}), + comm, bndx, bndy, bndz, M, N, P, m, n, p, dof0, dof1, dof2, dof3, stencilType, stencilWidth, lx, ly, lz, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + boundaryTypeX::DMBoundaryType,boundaryTypeY::DMBoundaryType,boundaryTypeZ::DMBoundaryType = DMStagGetBoundaryTypes(petsclib::PetscLibType,dm::PetscDM) +get boundary types + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `boundaryTypeX` - boundary type for x direction +- `boundaryTypeY` - boundary type for y direction, not set for one dimensional problems +- `boundaryTypeZ` - boundary type for z direction, not set for one and two dimensional problems + +Level: intermediate + +See also: +=== +`DMSTAG`, `DMBoundaryType` + +# External Links +$(_doc_external("DMStag/DMStagGetBoundaryTypes")) +""" +function DMStagGetBoundaryTypes(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetBoundaryTypes(petsclib::$UnionPetscLib, dm::PetscDM ) + boundaryTypeX_ = Ref{DMBoundaryType}() + boundaryTypeY_ = Ref{DMBoundaryType}() + boundaryTypeZ_ = Ref{DMBoundaryType}() + + @chk ccall( + (:DMStagGetBoundaryTypes, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMBoundaryType}, Ptr{DMBoundaryType}, Ptr{DMBoundaryType}), + dm, boundaryTypeX_, boundaryTypeY_, boundaryTypeZ_, + ) + + boundaryTypeX = boundaryTypeX_[] + boundaryTypeY = boundaryTypeY_[] + boundaryTypeZ = boundaryTypeZ_[] + + return boundaryTypeX,boundaryTypeY,boundaryTypeZ +end + +""" + DMStagGetProductCoordinateArrays(petsclib::PetscLibType,dm::PetscDM, arrX::Cvoid, arrY::Cvoid, arrZ::Cvoid) +extract local product coordinate arrays, one per dimension + +Logically Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `arrX` - local 1D coordinate arrays for x direction +- `arrY` - local 1D coordinate arrays for y direction, not set for one dimensional problems +- `arrZ` - local 1D coordinate arrays for z direction, not set for one and two dimensional problems + +Level: intermediate + +Notes: +A high-level helper function to quickly extract local coordinate arrays. + +Note that 2-dimensional arrays are returned. See +`DMStagVecGetArray()`, which is called internally to produce these arrays +representing coordinates on elements and vertices (element boundaries) +for a 1-dimensional `DMSTAG` in each coordinate direction. + +One should use `DMStagGetProductCoordinateLocationSlot()` to determine appropriate +indices for the second dimension in these returned arrays. This function +checks that the coordinate array is a suitable product of 1-dimensional +`DMSTAG` objects. + +See also: +=== +`DMSTAG`, `DMPRODUCT`, `DMStagGetProductCoordinateArraysRead()`, `DMStagSetUniformCoordinates()`, `DMStagSetUniformCoordinatesProduct()`, `DMStagGetProductCoordinateLocationSlot()` + +# External Links +$(_doc_external("DMStag/DMStagGetProductCoordinateArrays")) +""" +function DMStagGetProductCoordinateArrays(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetProductCoordinateArrays(petsclib::$UnionPetscLib, dm::PetscDM) + arrX_ = Ref{Ptr{Ptr{$PetscScalar}}}() + arrY_ = Ref{Ptr{Ptr{$PetscScalar}}}() + arrZ_ = Ref{Ptr{Ptr{$PetscScalar}}}() + + _,_,_,nx,ny,nz = DMStagGetGhostCorners(petsclib, dm) + + @chk ccall( + (:DMStagGetProductCoordinateArrays, $petsc_library), + PetscErrorCode, + (CDM, Ref{Ptr{Ptr{$PetscScalar}}}, Ref{Ptr{Ptr{$PetscScalar}}}, Ref{Ptr{Ptr{$PetscScalar}}}), + dm, arrX_, arrY_, arrZ_, + ) + + #mat = unsafe_wrap(Array, unsafe_load(arrX_[]), (nx,2)) + mat = unsafe_wrap(Array, unsafe_load(arrX_[]), (2,nx)) + mat = PermutedDimsArray(mat, (2,1)) + arrX = PetscArray(mat,arrX_[]) + + if ny>0 + #mat = unsafe_wrap(Array, unsafe_load(arrY_[]), (ny,2)) + mat = unsafe_wrap(Array, unsafe_load(arrY_[]), (2,ny)) + mat = PermutedDimsArray(mat, (2,1)) + + arrY = PetscArray(mat,arrY_[]) + else + arrY = nothing + end + if nz>0 + #mat = unsafe_wrap(Array, unsafe_load(arrZ_[]), (nz,2)) + mat = unsafe_wrap(Array, unsafe_load(arrY_[]), (2,nz)) + mat = PermutedDimsArray(mat, (2,1)) + arrZ = PetscArray(mat,arrZ_[]) + else + arrZ = nothing + end + + return arrX,arrY,arrZ +end + +""" + arrX::PetscArray, arrY::PetscArray, arrZ::PetscArray = DMStagGetProductCoordinateArraysRead(petsclib::PetscLibType,dm::PetscDM) +extract product coordinate arrays, read + +Logically Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `arrX` - local 1D coordinate arrays for `x` direction +- `arrY` - local 1D coordinate arrays for `y` direction, not set for one dimensional problems +- `arrZ` - local 1D coordinate arrays for `z` direction, not set for one and two dimensional problems + +Level: intermediate + +Note: +See `DMStagGetProductCoordinateArrays()` for more information. + +See also: +=== +`DMSTAG`, `DMPRODUCT`, `DMStagGetProductCoordinateArrays()`, `DMStagSetUniformCoordinates()`, `DMStagSetUniformCoordinatesProduct()`, `DMStagGetProductCoordinateLocationSlot()` + +# External Links +$(_doc_external("DMStag/DMStagGetProductCoordinateArraysRead")) +""" +function DMStagGetProductCoordinateArraysRead(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetProductCoordinateArraysRead(petsclib::$UnionPetscLib, dm::PetscDM) + arrX_ = Ref{Ptr{Ptr{$PetscScalar}}}() + arrY_ = Ref{Ptr{Ptr{$PetscScalar}}}() + arrZ_ = Ref{Ptr{Ptr{$PetscScalar}}}() + + _,_,_,nx,ny,nz = DMStagGetGhostCorners(petsclib, dm) + + @chk ccall( + (:DMStagGetProductCoordinateArraysRead, $petsc_library), + PetscErrorCode, + (CDM, Ref{Ptr{Ptr{$PetscScalar}}}, Ref{Ptr{Ptr{$PetscScalar}}}, Ref{Ptr{Ptr{$PetscScalar}}}), + dm, arrX_, arrY_, arrZ_, + ) + + mat = unsafe_wrap(Array, unsafe_load(arrX_[]), (nx,2)) + arrX = PetscArray(mat,arrX_[]) + + mat = unsafe_wrap(Array, unsafe_load(arrY_[]), (ny,2)) + arrY = PetscArray(mat,arrY_[]) + + mat = unsafe_wrap(Array, unsafe_load(arrZ_[]), (nz,2)) + arrZ = PetscArray(mat,arrZ_[]) + + return arrX,arrY,arrZ +end + +""" + x::PetscInt,y::PetscInt,z::PetscInt,m::PetscInt,n::PetscInt,p::PetscInt,nExtrax::PetscInt,nExtray::PetscInt,nExtraz::PetscInt = DMStagGetCorners(petsclib::PetscLibType,dm::PetscDM) +return global element indices of the local region (excluding ghost points) + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `x` - starting element index in first direction +- `y` - starting element index in second direction +- `z` - starting element index in third direction +- `m` - element width in first direction +- `n` - element width in second direction +- `p` - element width in third direction +- `nExtrax` - number of extra partial elements in first direction +- `nExtray` - number of extra partial elements in second direction +- `nExtraz` - number of extra partial elements in third direction + +Level: beginner + +Notes: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to `NULL` in this case. + +The number of extra partial elements is either 1 or 0. +The value is 1 on right, top, and front non-periodic domain ("physical") boundaries, +in the x, y, and z directions respectively, and otherwise 0. + +See also: +=== +`DMSTAG`, `DMStagGetGhostCorners()`, `DMDAGetCorners()` + +# External Links +$(_doc_external("DMStag/DMStagGetCorners")) +""" +function DMStagGetCorners(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetCorners(petsclib::$UnionPetscLib, dm::PetscDM ) + x_ = Ref{$PetscInt}() + y_ = Ref{$PetscInt}() + z_ = Ref{$PetscInt}() + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + p_ = Ref{$PetscInt}() + nExtrax_ = Ref{$PetscInt}() + nExtray_ = Ref{$PetscInt}() + nExtraz_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetCorners, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, x_, y_, z_, m_, n_, p_, nExtrax_, nExtray_, nExtraz_, + ) + + x = x_[] + y = y_[] + z = z_[] + m = m_[] + n = n_[] + p = p_[] + nExtrax = nExtrax_[] + nExtray = nExtray_[] + nExtraz = nExtraz_[] + + return x,y,z,m,n,p,nExtrax,nExtray,nExtraz +end + +""" + dof0::PetscInt,dof1::PetscInt,dof2::PetscInt,dof3::PetscInt = DMStagGetDOF(petsclib::PetscLibType,dm::PetscDM) +get number of DOF associated with each stratum of the grid + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `dof0` - the number of points per 0-cell (vertex/node) +- `dof1` - the number of points per 1-cell (element in 1D, edge in 2D and 3D) +- `dof2` - the number of points per 2-cell (element in 2D, face in 3D) +- `dof3` - the number of points per 3-cell (element in 3D) + +Level: beginner + +See also: +=== +`DMSTAG`, `DMStagGetCorners()`, `DMStagGetGhostCorners()`, `DMStagGetGlobalSizes()`, `DMStagGetStencilWidth()`, `DMStagGetBoundaryTypes()`, `DMStagGetLocationDOF()`, `DMDAGetDof()` + +# External Links +$(_doc_external("DMStag/DMStagGetDOF")) +""" +function DMStagGetDOF(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetDOF(petsclib::$UnionPetscLib, dm::PetscDM ) + dof0_ = Ref{$PetscInt}() + dof1_ = Ref{$PetscInt}() + dof2_ = Ref{$PetscInt}() + dof3_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetDOF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, dof0_, dof1_, dof2_, dof3_, + ) + + dof0 = dof0_[] + dof1 = dof1_[] + dof2 = dof2_[] + dof3 = dof3_[] + + return dof0,dof1,dof2,dof3 +end + +""" + x::PetscInt,y::PetscInt,z::PetscInt,m::PetscInt,n::PetscInt,p::PetscInt = DMStagGetGhostCorners(petsclib::PetscLibType,dm::PetscDM) +return global element indices of the local region, including ghost points + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `x` - the starting element index in the first direction +- `y` - the starting element index in the second direction +- `z` - the starting element index in the third direction +- `m` - the element width in the first direction +- `n` - the element width in the second direction +- `p` - the element width in the third direction + +Level: beginner + +Note: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to `NULL` in this case. + +See also: +=== +`DMSTAG`, `DMStagGetCorners()`, `DMDAGetGhostCorners()` + +# External Links +$(_doc_external("DMStag/DMStagGetGhostCorners")) +""" +function DMStagGetGhostCorners(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetGhostCorners(petsclib::$UnionPetscLib, dm::PetscDM ) + x_ = Ref{$PetscInt}() + y_ = Ref{$PetscInt}() + z_ = Ref{$PetscInt}() + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + p_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetGhostCorners, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, x_, y_, z_, m_, n_, p_, + ) + + x = x_[] + y = y_[] + z = z_[] + m = m_[] + n = n_[] + p = p_[] + + return x,y,z,m,n,p +end + +""" + M::PetscInt,N::PetscInt,P::PetscInt = DMStagGetGlobalSizes(petsclib::PetscLibType,dm::PetscDM) +get global element counts + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `M` - global element counts in the x direction +- `N` - global element counts in the y direction +- `P` - global element counts in the z direction + +Level: beginner + +Note: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to `NULL` in this case. + +See also: +=== +`DMSTAG`, `DMStagGetLocalSizes()`, `DMDAGetInfo()` + +# External Links +$(_doc_external("DMStag/DMStagGetGlobalSizes")) +""" +function DMStagGetGlobalSizes(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetGlobalSizes(petsclib::$UnionPetscLib, dm::PetscDM ) + M_ = Ref{$PetscInt}() + N_ = Ref{$PetscInt}() + P_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetGlobalSizes, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, M_, N_, P_, + ) + + M = M_[] + N = N_[] + P = P_[] + + return M,N,P +end + +""" + isFirstRank0::PetscBool,isFirstRank1::PetscBool,isFirstRank2::PetscBool = DMStagGetIsFirstRank(petsclib::PetscLibType,dm::PetscDM) +get boolean value for whether this rank is first in each direction in the rank grid + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `isFirstRank0` - whether this rank is first in the x direction +- `isFirstRank1` - whether this rank is first in the y direction +- `isFirstRank2` - whether this rank is first in the z direction + +Level: intermediate + +Note: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to `NULL` in this case. + +See also: +=== +`DMSTAG`, `DMStagGetIsLastRank()` + +# External Links +$(_doc_external("DMStag/DMStagGetIsFirstRank")) +""" +function DMStagGetIsFirstRank(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetIsFirstRank(petsclib::$UnionPetscLib, dm::PetscDM ) + isFirstRank0_ = Ref{PetscBool}() + isFirstRank1_ = Ref{PetscBool}() + isFirstRank2_ = Ref{PetscBool}() + + @chk ccall( + (:DMStagGetIsFirstRank, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}, Ptr{PetscBool}, Ptr{PetscBool}), + dm, isFirstRank0_, isFirstRank1_, isFirstRank2_, + ) + + isFirstRank0 = isFirstRank0_[] + isFirstRank1 = isFirstRank1_[] + isFirstRank2 = isFirstRank2_[] + + return isFirstRank0,isFirstRank1,isFirstRank2 +end + +""" + isLastRank0::PetscBool,isLastRank1::PetscBool,isLastRank2::PetscBool = DMStagGetIsLastRank(petsclib::PetscLibType,dm::PetscDM) +get boolean value for whether this rank is last in each direction in the rank grid + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `isLastRank0` - whether this rank is last in the x direction +- `isLastRank1` - whether this rank is last in the y direction +- `isLastRank2` - whether this rank is last in the z direction + +Level: intermediate + +Note: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to `NULL` in this case. + +See also: +=== +`DMSTAG`, `DMStagGetIsFirstRank()` + +# External Links +$(_doc_external("DMStag/DMStagGetIsLastRank")) +""" +function DMStagGetIsLastRank(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetIsLastRank(petsclib::$UnionPetscLib, dm::PetscDM ) + isLastRank0_ = Ref{PetscBool}() + isLastRank1_ = Ref{PetscBool}() + isLastRank2_ = Ref{PetscBool}() + + @chk ccall( + (:DMStagGetIsLastRank, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}, Ptr{PetscBool}, Ptr{PetscBool}), + dm, isLastRank0_, isLastRank1_, isLastRank2_, + ) + + isLastRank0 = isLastRank0_[] + isLastRank1 = isLastRank1_[] + isLastRank2 = isLastRank2_[] + + return isLastRank0,isLastRank1,isLastRank2 +end + +""" + m::PetscInt,n::PetscInt,p::PetscInt = DMStagGetLocalSizes(petsclib::PetscLibType,dm::PetscDM) +get local elementwise sizes + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `m` - local element counts (excluding ghosts) in the x direction +- `n` - local element counts (excluding ghosts) in the y direction +- `p` - local element counts (excluding ghosts) in the z direction + +Level: beginner + +Note: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to `NULL` in this case. + +See also: +=== +`DMSTAG`, `DMStagGetGlobalSizes()`, `DMStagGetDOF()`, `DMStagGetNumRanks()`, `DMDAGetLocalInfo()` + +# External Links +$(_doc_external("DMStag/DMStagGetLocalSizes")) +""" +function DMStagGetLocalSizes(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetLocalSizes(petsclib::$UnionPetscLib, dm::PetscDM ) + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + p_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetLocalSizes, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, m_, n_, p_, + ) + + m = m_[] + n = n_[] + p = p_[] + + return m,n,p +end + +""" + nRanks0::PetscInt,nRanks1::PetscInt,nRanks2::PetscInt = DMStagGetNumRanks(petsclib::PetscLibType,dm::PetscDM) +get number of ranks in each direction in the global grid decomposition + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `nRanks0` - number of ranks in the x direction in the grid decomposition +- `nRanks1` - number of ranks in the y direction in the grid decomposition +- `nRanks2` - number of ranks in the z direction in the grid decomposition + +Level: intermediate + +See also: +=== +`DMSTAG`, `DMStagGetGlobalSizes()`, `DMStagGetLocalSize()`, `DMStagSetNumRanks()`, `DMDAGetInfo()` + +# External Links +$(_doc_external("DMStag/DMStagGetNumRanks")) +""" +function DMStagGetNumRanks(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetNumRanks(petsclib::$UnionPetscLib, dm::PetscDM ) + nRanks0_ = Ref{$PetscInt}() + nRanks1_ = Ref{$PetscInt}() + nRanks2_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetNumRanks, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, nRanks0_, nRanks1_, nRanks2_, + ) + + nRanks0 = nRanks0_[] + nRanks1 = nRanks1_[] + nRanks2 = nRanks2_[] + + return nRanks0,nRanks1,nRanks2 +end + +""" + entries::PetscInt = DMStagGetEntries(petsclib::PetscLibType,dm::PetscDM) +get number of native entries in the global representation + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameter: +- `entries` - number of rank-native entries in the global representation + +Level: developer + +Note: +This is the number of entries on this rank for a global vector associated with `dm`. +That is, it is value of `size` returned by `VecGetLocalSize(vec,&size)` when +`DMCreateGlobalVector(dm,&vec) is used to create a `Vec`. Users would typically +use these functions. + +See also: +=== +`DMSTAG`, `DMStagGetDOF()`, `DMStagGetEntriesLocal()`, `DMStagGetEntriesPerElement()`, `DMCreateLocalVector()` + +# External Links +$(_doc_external("DMStag/DMStagGetEntries")) +""" +function DMStagGetEntries(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetEntries(petsclib::$UnionPetscLib, dm::PetscDM ) + entries_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetEntries, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, entries_, + ) + + entries = entries_[] + + return entries +end + +""" + entries::PetscInt = DMStagGetEntriesLocal(petsclib::PetscLibType,dm::PetscDM) +get number of entries in the local representation + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameter: +- `entries` - number of entries in the local representation + +Level: developer + +Note: +This is the number of entries on this rank in the local representation. +That is, it is value of `size` returned by `VecGetSize(vec,&size)` or +`VecGetLocalSize(vec,&size)` when `DMCreateLocalVector(dm,&vec)` is used to +create a `Vec`. Users would typically use these functions. + +See also: +=== +`DMSTAG`, `DMStagGetDOF()`, `DMStagGetEntries()`, `DMStagGetEntriesPerElement()`, `DMCreateLocalVector()` + +# External Links +$(_doc_external("DMStag/DMStagGetEntriesLocal")) +""" +function DMStagGetEntriesLocal(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetEntriesLocal(petsclib::$UnionPetscLib, dm::PetscDM ) + entries_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetEntriesLocal, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, entries_, + ) + + entries = entries_[] + + return entries +end + +""" + entriesPerElement::PetscInt = DMStagGetEntriesPerElement(petsclib::PetscLibType,dm::PetscDM) +get number of entries per element in the local representation + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameter: +- `entriesPerElement` - number of entries associated with each element in the local representation + +Level: developer + +Notes: +This is the natural block size for most local operations. In 1D it is equal to `dof0` + `dof1`, +in 2D it is equal to `dof0` + 2`dof1` + `dof2`, and in 3D it is equal to `dof0` + 3`dof1` + 3`dof2` + `dof3` + +See also: +=== +`DMSTAG`, `DMStagGetDOF()` + +# External Links +$(_doc_external("DMStag/DMStagGetEntriesPerElement")) +""" +function DMStagGetEntriesPerElement(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetEntriesPerElement(petsclib::$UnionPetscLib, dm::PetscDM ) + entriesPerElement_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetEntriesPerElement, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, entriesPerElement_, + ) + + entriesPerElement = entriesPerElement_[] + + return entriesPerElement +end + +""" + stencilType::DMStagStencilType = DMStagGetStencilType(petsclib::PetscLibType,dm::PetscDM) +get elementwise ghost/halo stencil type + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameter: +- `stencilType` - the elementwise ghost stencil type: `DMSTAG_STENCIL_BOX`, `DMSTAG_STENCIL_STAR`, or `DMSTAG_STENCIL_NONE` + +Level: beginner + +See also: +=== +`DMSTAG`, `DMStagSetStencilType()`, `DMStagGetStencilWidth`, `DMStagStencilType` + +# External Links +$(_doc_external("DMStag/DMStagGetStencilType")) +""" +function DMStagGetStencilType(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetStencilType(petsclib::$UnionPetscLib, dm::PetscDM ) + stencilType_ = Ref{DMStagStencilType}() + + @chk ccall( + (:DMStagGetStencilType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMStagStencilType}), + dm, stencilType_, + ) + + stencilType = stencilType_[] + + return stencilType +end + +""" + stencilWidth::PetscInt = DMStagGetStencilWidth(petsclib::PetscLibType,dm::PetscDM) +get elementwise stencil width + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameter: +- `stencilWidth` - stencil/halo/ghost width in elements + +Level: beginner + +See also: +=== +`DMSTAG`, `DMStagSetStencilWidth()`, `DMStagGetStencilType()`, `DMDAGetStencilType()` + +# External Links +$(_doc_external("DMStag/DMStagGetStencilWidth")) +""" +function DMStagGetStencilWidth(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetStencilWidth(petsclib::$UnionPetscLib, dm::PetscDM ) + stencilWidth_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetStencilWidth, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, stencilWidth_, + ) + + stencilWidth = stencilWidth_[] + + return stencilWidth +end + +""" + lx::Vector{PetscInt},ly::Vector{PetscInt},lz::Vector{PetscInt} = DMStagGetOwnershipRanges(petsclib::PetscLibType,dm::PetscDM) +get elements per rank in each direction + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `lx` - ownership along x direction (optional) +- `ly` - ownership along y direction (optional) +- `lz` - ownership along z direction (optional) + +Level: intermediate + +Notes: +These correspond to the optional final arguments passed to `DMStagCreate1d()`, `DMStagCreate2d()`, and `DMStagCreate3d()`. + +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to `NULL` in this case. + +In C you should not free these arrays, nor change the values in them. +They will only have valid values while the `DMSTAG` they came from still exists (has not been destroyed). + +See also: +=== +`DMSTAG`, `DMStagSetGlobalSizes()`, `DMStagSetOwnershipRanges()`, `DMStagCreate1d()`, `DMStagCreate2d()`, `DMStagCreate3d()`, `DMDAGetOwnershipRanges()` + +# External Links +$(_doc_external("DMStag/DMStagGetOwnershipRanges")) +""" +function DMStagGetOwnershipRanges(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetOwnershipRanges(petsclib::$UnionPetscLib, dm::PetscDM ) + lx_ = Ref{Ptr{$PetscInt}}() + ly_ = Ref{Ptr{$PetscInt}}() + lz_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMStagGetOwnershipRanges, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + dm, lx_, ly_, lz_, + ) + # todo: determine the sizes of these arrays to wrap them properly + #lx = unsafe_wrap(Array, lx_[], VecGetLocalSize(petsclib, x); own = false) + #ly = unsafe_wrap(Array, ly_[], VecGetLocalSize(petsclib, x); own = false) + #lz = unsafe_wrap(Array, lz_[], VecGetLocalSize(petsclib, x); own = false) + lx = lx_[] + ly = ly_[] + lz = lz_[] + return lx,ly,lz +end + +""" + newdm::PetscDM = DMStagCreateCompatibleDMStag(petsclib::PetscLibType,dm::PetscDM, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, dof3::PetscInt) +create a compatible `DMSTAG` with different dof/stratum + +Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `dof0` - number of dof on the first stratum in the new `DMSTAG` +- `dof1` - number of dof on the second stratum in the new `DMSTAG` +- `dof2` - number of dof on the third stratum in the new `DMSTAG` +- `dof3` - number of dof on the fourth stratum in the new `DMSTAG` + +Output Parameter: +- `newdm` - the new, compatible `DMSTAG` + +Level: intermediate + +Notes: +DOF supplied for strata too big for the dimension are ignored; these may be set to `0`. +For example, for a 2-dimensional `DMSTAG`, `dof2` sets the number of dof per element, +and `dof3` is unused. For a 3-dimensional `DMSTAG`, `dof3` sets the number of DOF per element. + +In contrast to `DMDACreateCompatibleDMDA()`, coordinates are not reused. + +See also: +=== +`DMSTAG`, `DMDACreateCompatibleDMDA()`, `DMGetCompatibility()`, `DMStagMigrateVec()` + +# External Links +$(_doc_external("DMStag/DMStagCreateCompatibleDMStag")) +""" +function DMStagCreateCompatibleDMStag(petsclib::PetscLibType, dm::PetscDM, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, dof3::PetscInt) end + +@for_petsc function DMStagCreateCompatibleDMStag(petsclib::$UnionPetscLib, dm::PetscDM{PetscLib}, dof0::$PetscInt, dof1::$PetscInt, dof2::$PetscInt, dof3::$PetscInt ) where {PetscLib} + newdm_ = Ref{CDM}() + + @chk ccall( + (:DMStagCreateCompatibleDMStag, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{CDM}), + dm, dof0, dof1, dof2, dof3, newdm_, + ) + + newdm = PetscDM{PetscLib}(newdm_[], 0) + + return newdm +end + +""" + slot::PetscInt = DMStagGetLocationSlot(petsclib::PetscLibType,dm::PetscDM, loc::DMStagStencilLocation, c::PetscInt) +get index to use in accessing raw local arrays + +Not Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `loc` - location relative to an element +- `c` - component + +Output Parameter: +- `slot` - index to use + +Level: beginner + +Notes: +Provides an appropriate index to use with `DMStagVecGetArray()` and friends. +This is required so that the user doesn't need to know about the ordering of +dof associated with each local element. + +See also: +=== +`DMSTAG`, `DMStagVecGetArray()`, `DMStagVecGetArrayRead()`, `DMStagGetDOF()`, `DMStagGetEntriesPerElement()` + +# External Links +$(_doc_external("DMStag/DMStagGetLocationSlot")) +""" +function DMStagGetLocationSlot(petsclib::PetscLibType, dm::PetscDM, loc::DMStagStencilLocation, c::PetscInt) end + +@for_petsc function DMStagGetLocationSlot(petsclib::$UnionPetscLib, dm::PetscDM, loc::DMStagStencilLocation, c::$PetscInt ) + slot_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetLocationSlot, $petsc_library), + PetscErrorCode, + (CDM, DMStagStencilLocation, $PetscInt, Ptr{$PetscInt}), + dm, loc, c, slot_, + ) + + slot = slot_[] + + return slot +end + +""" + refine_x::PetscInt,refine_y::PetscInt,refine_z::PetscInt = DMStagGetRefinementFactor(petsclib::PetscLibType,dm::PetscDM) +get refinement ratios in each direction + +Not Collective + +Input Parameter: +- `dm` - the `DMSTAG` object + +Output Parameters: +- `refine_x` - ratio of fine grid to coarse in x-direction (2 by default) +- `refine_y` - ratio of fine grid to coarse in y-direction (2 by default) +- `refine_z` - ratio of fine grid to coarse in z-direction (2 by default) + +Level: intermediate + +See also: +=== +`DMSTAG`, `DMRefine()`, `DMCoarsen()`, `DMStagSetRefinementFactor()`, `DMDASetRefinementFactor()` + +# External Links +$(_doc_external("DMStag/DMStagGetRefinementFactor")) +""" +function DMStagGetRefinementFactor(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagGetRefinementFactor(petsclib::$UnionPetscLib, dm::PetscDM ) + refine_x_ = Ref{$PetscInt}() + refine_y_ = Ref{$PetscInt}() + refine_z_ = Ref{$PetscInt}() + + @chk ccall( + (:DMStagGetRefinementFactor, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, refine_x_, refine_y_, refine_z_, + ) + + refine_x = refine_x_[] + refine_y = refine_y_[] + refine_z = refine_z_[] + + return refine_x,refine_y,refine_z +end + +""" + DMStagMigrateVec(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec, dmTo::PetscDM, vecTo::PetscVec) +transfer a vector associated with a `DMSTAG` to a vector associated with a compatible `DMSTAG` + +Collective + +Input Parameters: +- `dm` - the source `DMSTAG` object +- `vec` - the source vector, compatible with `dm` +- `dmTo` - the compatible destination `DMSTAG` object +- `vecTo` - the destination vector, compatible with `dmTo` + +Level: advanced + +Notes: +Extra dof are ignored, and unfilled dof are zeroed. +Currently only implemented to migrate global vectors to global vectors. +For the definition of compatibility of `DM`s, see `DMGetCompatibility()`. + +See also: +=== +`DMSTAG`, `DMStagCreateCompatibleDMStag()`, `DMGetCompatibility()`, `DMStagVecSplitToDMDA()` + +# External Links +$(_doc_external("DMStag/DMStagMigrateVec")) +""" +function DMStagMigrateVec(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec, dmTo::PetscDM, vecTo::PetscVec) end + +@for_petsc function DMStagMigrateVec(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec, dmTo::PetscDM, vecTo::PetscVec ) + + @chk ccall( + (:DMStagMigrateVec, $petsc_library), + PetscErrorCode, + (CDM, CVec, CDM, CVec), + dm, vec, dmTo, vecTo, + ) + + + return nothing +end + +""" + DMStagPopulateLocalToGlobalInjective(petsclib::PetscLibType,dm::PetscDM) +populate an internal 1 + +Collective + +Creates an internal object which explicitly maps a single local degree of +freedom to each global degree of freedom. This is used, if populated, +instead of SCATTER_REVERSE_LOCAL with the (1-to-many, in general) +global-to-local map, when DMLocalToGlobal() is called with INSERT_VALUES. +This allows usage, for example, even in the periodic, 1-rank case, where +the inverse of the global-to-local map, even when restricted to on-rank +communication, is non-injective. This is at the cost of storing an additional +VecScatter object inside each `DMSTAG` object. + +Input Parameter: +- `dm` - the `DMSTAG` object + +Level: developer + +Notes: +In normal usage, library users shouldn't be concerned with this function, +as it is called during `DMSetUp()`, when required. + +Returns immediately if the internal map is already populated. + +Developer Notes: +This could, if desired, be moved up to a general `DM` routine. It would allow, +for example, `DMDA` to support `DMLocalToGlobal()` with `INSERT_VALUES`, +even in the single-rank periodic case. + +See also: +=== +`DMSTAG`, `DMLocalToGlobal()`, `VecScatter` + +# External Links +$(_doc_external("DMStag/DMStagPopulateLocalToGlobalInjective")) +""" +function DMStagPopulateLocalToGlobalInjective(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMStagPopulateLocalToGlobalInjective(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMStagPopulateLocalToGlobalInjective, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMStagRestoreProductCoordinateArrays(petsclib::PetscLibType,dm::PetscDM, arrX::PetscArray, arrY::PetscArray, arrZ::PetscArray) +restore local array access + +Logically Collective + +Input Parameter: +- `dm` - the `DMSTAG` object +- `arrX` - local 1D coordinate arrays for x direction +- `arrY` - local 1D coordinate arrays for y direction +- `arrZ` - local 1D coordinate arrays for z direction + +Level: intermediate + +Notes: +This function does not automatically perform a local->global scatter to populate global coordinates from the local coordinates. +Thus, it may be required to explicitly perform these operations in some situations, as in the following partial example: +-vb +PetscCall(DMGetCoordinateDM(dm, &cdm)); +for (PetscInt d = 0; d < 3; ++d) { +DM subdm; +Vec coor, coor_local; + +PetscCall(DMProductGetDM(cdm, d, &subdm)); +PetscCall(DMGetCoordinates(subdm, &coor)); +PetscCall(DMGetCoordinatesLocal(subdm, &coor_local)); +PetscCall(DMLocalToGlobal(subdm, coor_local, INSERT_VALUES, coor)); +PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Coordinates dim %" PetscInt_FMT ":\n", d)); +PetscCall(VecView(coor, PETSC_VIEWER_STDOUT_WORLD)); +} +-ve + +See also: +=== +`DMSTAG`, `DMStagGetProductCoordinateArrays()`, `DMStagGetProductCoordinateArraysRead()` + +# External Links +$(_doc_external("DMStag/DMStagRestoreProductCoordinateArrays")) +""" +function DMStagRestoreProductCoordinateArrays(petsclib::PetscLibType, dm::PetscDM, arrX::PetscArray, arrY::PetscArray, arrZ::PetscArray) end + +@for_petsc function DMStagRestoreProductCoordinateArrays(petsclib::$UnionPetscLib, dm::PetscDM, arrX::PetscArray, arrY::PetscArray, arrZ::PetscArray ) + + @chk ccall( + (:DMStagRestoreProductCoordinateArrays, $petsc_library), + PetscErrorCode, + (CDM, Ref{Ptr{Ptr{$PetscScalar}}}, Ref{Ptr{Ptr{$PetscScalar}}}, Ref{Ptr{Ptr{$PetscScalar}}}), + dm, arrX.ptr, arrY.ptr, arrZ.ptr + ) + + + return nothing +end + +""" + DMStagRestoreProductCoordinateArraysRead(petsclib::PetscLibType,dm::PetscDM, arrX::PetscArray, arrY::PetscArray, arrZ::PetscArray) +restore local product array access, read + +Logically Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `arrX` - local 1D coordinate arrays for x direction +- `arrY` - local 1D coordinate arrays for y direction +- `arrZ` - local 1D coordinate arrays for z direction + +Level: intermediate + +See also: +=== +`DMSTAG`, `DMStagGetProductCoordinateArrays()`, `DMStagGetProductCoordinateArraysRead()` + +# External Links +$(_doc_external("DMStag/DMStagRestoreProductCoordinateArraysRead")) +""" +function DMStagRestoreProductCoordinateArraysRead(petsclib::PetscLibType, dm::PetscDM, arrX::PetscArray, arrY::PetscArray, arrZ::PetscArray) end + +@for_petsc function DMStagRestoreProductCoordinateArraysRead(petsclib::$UnionPetscLib, dm::PetscDM, arrX::PetscArray, arrY::PetscArray, arrZ::PetscArray ) + + + @chk ccall( + (:DMStagRestoreProductCoordinateArrays, $petsc_library), + PetscErrorCode, + (CDM, Ref{Ptr{Ptr{$PetscScalar}}}, Ref{Ptr{Ptr{$PetscScalar}}}, Ref{Ptr{Ptr{$PetscScalar}}}), + dm, arrX.ptr, arrY.ptr, arrZ.ptr, + ) + + return nothing +end + +""" + DMStagSetBoundaryTypes(petsclib::PetscLibType,dm::PetscDM, boundaryType0::DMBoundaryType, boundaryType1::DMBoundaryType, boundaryType2::DMBoundaryType) +set `DMSTAG` boundary types + +Logically Collective; boundaryType0, boundaryType1, and boundaryType2 must contain common values + +Input Parameters: +- `dm` - the `DMSTAG` object +- `boundaryType2` - boundary type for x direction +- `boundaryType1` - boundary type for y direction, not set for one dimensional problems +- `boundaryType0` - boundary type for z direction, not set for one and two dimensional problems + +Level: advanced + +Note: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. + +See also: +=== +`DMSTAG`, `DMBoundaryType`, `DMStagCreate1d()`, `DMStagCreate2d()`, `DMStagCreate3d()`, `DMDASetBoundaryType()` + +# External Links +$(_doc_external("DMStag/DMStagSetBoundaryTypes")) +""" +function DMStagSetBoundaryTypes(petsclib::PetscLibType, dm::PetscDM, boundaryType0::DMBoundaryType, boundaryType1::DMBoundaryType, boundaryType2::DMBoundaryType) end + +@for_petsc function DMStagSetBoundaryTypes(petsclib::$UnionPetscLib, dm::PetscDM, boundaryType0::DMBoundaryType, boundaryType1::DMBoundaryType, boundaryType2::DMBoundaryType ) + + @chk ccall( + (:DMStagSetBoundaryTypes, $petsc_library), + PetscErrorCode, + (CDM, DMBoundaryType, DMBoundaryType, DMBoundaryType), + dm, boundaryType0, boundaryType1, boundaryType2, + ) + + + return nothing +end + +""" + DMStagSetCoordinateDMType(petsclib::PetscLibType,dm::PetscDM, dmtype::DMType) +set DM type to store coordinates + +Logically Collective; `dmtype` must contain common value + +Input Parameters: +- `dm` - the `DMSTAG` object +- `dmtype` - `DMtype` for coordinates, either `DMSTAG` or `DMPRODUCT` + +Level: advanced + +See also: +=== +`DMSTAG`, `DMPRODUCT`, `DMGetCoordinateDM()`, `DMStagSetUniformCoordinates()`, `DMStagSetUniformCoordinatesExplicit()`, `DMStagSetUniformCoordinatesProduct()`, `DMType` + +# External Links +$(_doc_external("DMStag/DMStagSetCoordinateDMType")) +""" +function DMStagSetCoordinateDMType(petsclib::PetscLibType, dm::PetscDM, dmtype::DMType) end + +@for_petsc function DMStagSetCoordinateDMType(petsclib::$UnionPetscLib, dm::PetscDM, dmtype::DMType ) + + @chk ccall( + (:DMStagSetCoordinateDMType, $petsc_library), + PetscErrorCode, + (CDM, DMType), + dm, dmtype, + ) + + + return nothing +end + +""" + DMStagSetDOF(petsclib::PetscLibType,dm::PetscDM, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, dof3::PetscInt) +set dof/stratum + +Logically Collective; `dof0`, `dof1`, `dof2`, and `dof3` must contain common values + +Input Parameters: +- `dm` - the `DMSTAG` object +- `dof0` - the number of points per 0-cell (vertex/node) +- `dof1` - the number of points per 1-cell (element in 1D, edge in 2D and 3D) +- `dof2` - the number of points per 2-cell (element in 2D, face in 3D) +- `dof3` - the number of points per 3-cell (element in 3D) + +Level: advanced + +Note: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. + +See also: +=== +`DMSTAG`, `DMDASetDof()` + +# External Links +$(_doc_external("DMStag/DMStagSetDOF")) +""" +function DMStagSetDOF(petsclib::PetscLibType, dm::PetscDM, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, dof3::PetscInt) end + +@for_petsc function DMStagSetDOF(petsclib::$UnionPetscLib, dm::PetscDM, dof0::$PetscInt, dof1::$PetscInt, dof2::$PetscInt, dof3::$PetscInt ) + + @chk ccall( + (:DMStagSetDOF, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, $PetscInt), + dm, dof0, dof1, dof2, dof3, + ) + + + return nothing +end + +""" + DMStagSetNumRanks(petsclib::PetscLibType,dm::PetscDM, nRanks0::PetscInt, nRanks1::PetscInt, nRanks2::PetscInt) +set ranks in each direction in the global rank grid + +Logically Collective; `nRanks0`, `nRanks1`, and `nRanks2` must contain common values + +Input Parameters: +- `dm` - the `DMSTAG` object +- `nRanks0` - number of ranks in the x direction +- `nRanks1` - number of ranks in the y direction +- `nRanks2` - number of ranks in the z direction + +Level: developer + +Note: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. + +See also: +=== +`DMSTAG`, `DMDASetNumProcs()` + +# External Links +$(_doc_external("DMStag/DMStagSetNumRanks")) +""" +function DMStagSetNumRanks(petsclib::PetscLibType, dm::PetscDM, nRanks0::PetscInt, nRanks1::PetscInt, nRanks2::PetscInt) end + +@for_petsc function DMStagSetNumRanks(petsclib::$UnionPetscLib, dm::PetscDM, nRanks0::$PetscInt, nRanks1::$PetscInt, nRanks2::$PetscInt ) + + @chk ccall( + (:DMStagSetNumRanks, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt), + dm, nRanks0, nRanks1, nRanks2, + ) + + + return nothing +end + +""" + DMStagSetStencilType(petsclib::PetscLibType,dm::PetscDM, stencilType::DMStagStencilType) +set elementwise ghost/halo stencil type + +Logically Collective; `stencilType` must contain common value + +Input Parameters: +- `dm` - the `DMSTAG` object +- `stencilType` - the elementwise ghost stencil type: `DMSTAG_STENCIL_BOX`, `DMSTAG_STENCIL_STAR`, or `DMSTAG_STENCIL_NONE` + +Level: beginner + +See also: +=== +`DMSTAG`, `DMStagGetStencilType()`, `DMStagSetStencilWidth()`, `DMStagStencilType` + +# External Links +$(_doc_external("DMStag/DMStagSetStencilType")) +""" +function DMStagSetStencilType(petsclib::PetscLibType, dm::PetscDM, stencilType::DMStagStencilType) end + +@for_petsc function DMStagSetStencilType(petsclib::$UnionPetscLib, dm::PetscDM, stencilType::DMStagStencilType ) + + @chk ccall( + (:DMStagSetStencilType, $petsc_library), + PetscErrorCode, + (CDM, DMStagStencilType), + dm, stencilType, + ) + + + return nothing +end + +""" + DMStagSetStencilWidth(petsclib::PetscLibType,dm::PetscDM, stencilWidth::PetscInt) +set elementwise stencil width + +Logically Collective; `stencilWidth` must contain common value + +Input Parameters: +- `dm` - the `DMSTAG` object +- `stencilWidth` - stencil/halo/ghost width in elements + +Level: beginner + +Note: +The width value is not used when `DMSTAG_STENCIL_NONE` is specified. + +See also: +=== +`DMSTAG`, `DMStagGetStencilWidth()`, `DMStagGetStencilType()`, `DMStagStencilType` + +# External Links +$(_doc_external("DMStag/DMStagSetStencilWidth")) +""" +function DMStagSetStencilWidth(petsclib::PetscLibType, dm::PetscDM, stencilWidth::PetscInt) end + +@for_petsc function DMStagSetStencilWidth(petsclib::$UnionPetscLib, dm::PetscDM, stencilWidth::$PetscInt ) + + @chk ccall( + (:DMStagSetStencilWidth, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, stencilWidth, + ) + + + return nothing +end + +""" + DMStagSetGlobalSizes(petsclib::PetscLibType,dm::PetscDM, N0::PetscInt, N1::PetscInt, N2::PetscInt) +set global element counts in each direction + +Logically Collective; `N0`, `N1`, and `N2` must contain common values + +Input Parameters: +- `dm` - the `DMSTAG` object +- `N0` - global elementwise size in the x direction +- `N1` - global elementwise size in the y direction +- `N2` - global elementwise size in the z direction + +Level: advanced + +Note: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. + +See also: +=== +`DMSTAG`, `DMStagGetGlobalSizes()`, `DMDASetSizes()` + +# External Links +$(_doc_external("DMStag/DMStagSetGlobalSizes")) +""" +function DMStagSetGlobalSizes(petsclib::PetscLibType, dm::PetscDM, N0::PetscInt, N1::PetscInt, N2::PetscInt) end + +@for_petsc function DMStagSetGlobalSizes(petsclib::$UnionPetscLib, dm::PetscDM, N0::$PetscInt, N1::$PetscInt, N2::$PetscInt ) + + @chk ccall( + (:DMStagSetGlobalSizes, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt), + dm, N0, N1, N2, + ) + + + return nothing +end + +""" + DMStagSetOwnershipRanges(petsclib::PetscLibType,dm::PetscDM, lx::Vector{PetscInt}, ly::Vector{PetscInt}, lz::Vector{PetscInt}) +set elements per rank in each direction + +Logically Collective; `lx`, `ly`, and `lz` must contain common values + +Input Parameters: +- `dm` - the `DMSTAG` object +- `lx` - element counts for each rank in the x direction, may be `NULL` +- `ly` - element counts for each rank in the y direction, may be `NULL` +- `lz` - element counts for each rank in the z direction, may be `NULL` + +Level: developer + +Note: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to `NULL` in this case. + +See also: +=== +`DMSTAG`, `DMStagSetGlobalSizes()`, `DMStagGetOwnershipRanges()`, `DMDASetOwnershipRanges()` + +# External Links +$(_doc_external("DMStag/DMStagSetOwnershipRanges")) +""" +function DMStagSetOwnershipRanges(petsclib::PetscLibType, dm::PetscDM, lx::Vector{PetscInt}, ly::Vector{PetscInt}, lz::Vector{PetscInt}) end + +@for_petsc function DMStagSetOwnershipRanges(petsclib::$UnionPetscLib, dm::PetscDM, lx::Vector{$PetscInt}, ly::Vector{$PetscInt}, lz::Vector{$PetscInt} ) + + @chk ccall( + (:DMStagSetOwnershipRanges, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, lx, ly, lz, + ) + + + return nothing +end + +""" + DMStagSetRefinementFactor(petsclib::PetscLibType,dm::PetscDM, refine_x::PetscInt, refine_y::PetscInt, refine_z::PetscInt) +set refinement ratios in each direction + +Logically Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `refine_x` - ratio of fine grid to coarse in x-direction (2 by default) +- `refine_y` - ratio of fine grid to coarse in y-direction (2 by default) +- `refine_z` - ratio of fine grid to coarse in z-direction (2 by default) + +Level: intermediate + +Note: +Pass `PETSC_IGNORE` to leave a value unchanged + +See also: +=== +`DMSTAG`, `DMRefine()`, `DMCoarsen()`, `DMStagGetRefinementFactor()`, `DMDAGetRefinementFactor()` + +# External Links +$(_doc_external("DMStag/DMStagSetRefinementFactor")) +""" +function DMStagSetRefinementFactor(petsclib::PetscLibType, dm::PetscDM, refine_x::PetscInt, refine_y::PetscInt, refine_z::PetscInt) end + +@for_petsc function DMStagSetRefinementFactor(petsclib::$UnionPetscLib, dm::PetscDM, refine_x::$PetscInt, refine_y::$PetscInt, refine_z::$PetscInt ) + + @chk ccall( + (:DMStagSetRefinementFactor, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt), + dm, refine_x, refine_y, refine_z, + ) + + + return nothing +end + +""" + DMStagSetUniformCoordinates(petsclib::PetscLibType,dm::PetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal) +set `DMSTAG` coordinates to be a uniform grid + +Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `xmin` - minimum global coordinate value in the `x` direction +- `xmax` - maximum global coordinate values in the `x` direction +- `ymin` - minimum global coordinate value in the `y` direction +- `ymax` - maximum global coordinate value in the `y` direction +- `zmin` - minimum global coordinate value in the `z` direction +- `zmax` - maximum global coordinate value in the `z` direction + +Level: advanced + +Notes: +`DMSTAG` supports 2 different types of coordinate `DM`: `DMSTAG` and `DMPRODUCT`. +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. + +Local coordinates are populated (using `DMSetCoordinatesLocal()`), linearly +extrapolated to ghost cells, including those outside the physical domain. +This is also done in case of periodic boundaries, meaning that the same +global point may have different coordinates in different local representations, +which are equivalent assuming a periodicity implied by the arguments to this function, +i.e. two points are equivalent if their difference is a multiple of (`xmax` - `xmin` ) +in the x direction, ( `ymax` - `ymin` ) in the y direction, and ( `zmax` - `zmin` ) in the z direction. + +See also: +=== +`DMSTAG`, `DMPRODUCT`, `DMStagSetUniformCoordinatesExplicit()`, `DMStagSetUniformCoordinatesProduct()`, `DMStagSetCoordinateDMType()`, `DMGetCoordinateDM()`, `DMGetCoordinates()`, `DMDASetUniformCoordinates()`, `DMBoundaryType` + +# External Links +$(_doc_external("DMStag/DMStagSetUniformCoordinates")) +""" +function DMStagSetUniformCoordinates(petsclib::PetscLibType, dm::PetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal) end + +@for_petsc function DMStagSetUniformCoordinates(petsclib::$UnionPetscLib, dm::PetscDM, xmin::$PetscReal, xmax::$PetscReal, ymin::$PetscReal, ymax::$PetscReal, zmin::$PetscReal, zmax::$PetscReal ) + + @chk ccall( + (:DMStagSetUniformCoordinates, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + dm, xmin, xmax, ymin, ymax, zmin, zmax, + ) + + + return nothing +end + +""" + DMStagSetUniformCoordinatesExplicit(petsclib::PetscLibType,dm::PetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal) +set `DMSTAG` coordinates to be a uniform grid, storing all values + +Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `xmin` - minimum global coordinate value in the `x` direction +- `xmax` - maximum global coordinate value in the `x` direction +- `ymin` - minimum global coordinate value in the `y` direction +- `ymax` - maximum global coordinate value in the `y` direction +- `zmin` - minimum global coordinate value in the `z` direction +- `zmax` - maximum global coordinate value in the `z` direction + +Level: beginner + +Notes: +`DMSTAG` supports 2 different types of coordinate `DM`: either another `DMSTAG`, or a `DMPRODUCT`. +If the grid is orthogonal, using `DMPRODUCT` should be more efficient. + +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. + +See the manual page for `DMStagSetUniformCoordinates()` for information on how +coordinates for dummy cells outside the physical domain boundary are populated. + +See also: +=== +`DMSTAG`, `DMStagSetUniformCoordinates()`, `DMStagSetUniformCoordinatesProduct()`, `DMStagSetCoordinateDMType()` + +# External Links +$(_doc_external("DMStag/DMStagSetUniformCoordinatesExplicit")) +""" +function DMStagSetUniformCoordinatesExplicit(petsclib::PetscLibType, dm::PetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal) end + +@for_petsc function DMStagSetUniformCoordinatesExplicit(petsclib::$UnionPetscLib, dm::PetscDM, xmin::$PetscReal, xmax::$PetscReal, ymin::$PetscReal, ymax::$PetscReal, zmin::$PetscReal, zmax::$PetscReal ) + + @chk ccall( + (:DMStagSetUniformCoordinatesExplicit, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + dm, xmin, xmax, ymin, ymax, zmin, zmax, + ) + + + return nothing +end + +""" + DMStagSetUniformCoordinatesProduct(petsclib::PetscLibType,dm::PetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal) +create uniform coordinates, as a product of 1D arrays + +Set the coordinate `DM` to be a `DMPRODUCT` of 1D `DMSTAG` objects, each of which have a coordinate `DM` (also a 1d `DMSTAG`) holding uniform coordinates. + +Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `xmin` - minimum global coordinate value in the `x` direction +- `xmax` - maximum global coordinate value in the `x` direction +- `ymin` - minimum global coordinate value in the `y` direction +- `ymax` - maximum global coordinate value in the `y` direction +- `zmin` - minimum global coordinate value in the `z` direction +- `zmax` - maximum global coordinate value in the `z` direction + +Level: intermediate + +Notes: +Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. + +The per-dimension 1-dimensional `DMSTAG` objects that comprise the product +always have active 0-cells (vertices, element boundaries) and 1-cells +(element centers). + +See the manual page for `DMStagSetUniformCoordinates()` for information on how +coordinates for dummy cells outside the physical domain boundary are populated. + +See also: +=== +`DMSTAG`, `DMPRODUCT`, `DMStagSetUniformCoordinates()`, `DMStagSetUniformCoordinatesExplicit()`, `DMStagSetCoordinateDMType()` + +# External Links +$(_doc_external("DMStag/DMStagSetUniformCoordinatesProduct")) +""" +function DMStagSetUniformCoordinatesProduct(petsclib::PetscLibType, dm::PetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal) end + +@for_petsc function DMStagSetUniformCoordinatesProduct(petsclib::$UnionPetscLib, dm::PetscDM, xmin::$PetscReal, xmax::$PetscReal, ymin::$PetscReal, ymax::$PetscReal, zmin::$PetscReal, zmax::$PetscReal ) + + @chk ccall( + (:DMStagSetUniformCoordinatesProduct, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + dm, xmin, xmax, ymin, ymax, zmin, zmax, + ) + + + return nothing +end + +""" + array::PetscArray = DMStagVecGetArray(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec) +get access to local array + +Logically Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `vec` - the `Vec` object + +Output Parameter: +- `array` - the array + +Level: beginner + +Note: +This function returns a (dim+1)-dimensional array for a dim-dimensional `DMSTAG`. + +The first 1-3 dimensions indicate an element in the global +numbering, using the standard C ordering. + +The final dimension in this array corresponds to a degree +of freedom with respect to this element, for example corresponding to +the element or one of its neighboring faces, edges, or vertices. + +For example, for a 3D `DMSTAG`, indexing is `array[k][j][i][idx]`, where `k` is the +index in the z-direction, `j` is the index in the y-direction, and `i` is the +index in the x-direction. + +`idx` is obtained with `DMStagGetLocationSlot()`, since the correct offset +into the (d+1)-dimensional C array for a d-dimensional `DMSTAG` depends on the grid size and the number +of DOF stored at each location. + +`DMStagVecRestoreArray()` must be called, once finished with the array + +See also: +=== +`DMSTAG`, `DMStagVecGetArrayRead()`, `DMStagGetLocationSlot()`, `DMGetLocalVector()`, `DMCreateLocalVector()`, `DMGetGlobalVector()`, `DMCreateGlobalVector()`, `DMDAVecGetArray()`, `DMDAVecGetArrayDOF()` + +# External Links +$(_doc_external("DMStag/DMStagVecGetArray")) +""" +function DMStagVecGetArray(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec) end + +@for_petsc function DMStagVecGetArray(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec) + # PETSc returns a pointer into the Vec's internal storage; we wrap it without taking ownership + xs,ys,zs,m,n,p = DMStagGetGhostCorners(petsclib, dm) + dim = DMGetDimension(petsclib, dm) + q = DMStagGetEntriesPerElement(petsclib, dm) + + if dim==1 + a_ = Ref{Ptr{Ptr{$PetscScalar}}}() + @chk ccall( + (:DMStagVecGetArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ref{Ptr{Ptr{$PetscScalar}}}), + dm, vec, a_, + ) + sz = (q,m) + perm = (2,1) + elseif dim==2 + a_ = Ref{Ptr{Ptr{Ptr{$PetscScalar}}}}() + @chk ccall( + (:DMStagVecGetArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ref{Ptr{Ptr{Ptr{$PetscScalar}}}}), + dm, vec, a_, + ) + sz = (q,m,n) + perm = (2,3,1) + elseif dim==3 + a_ = Ref{Ptr{Ptr{Ptr{Ptr{$PetscScalar}}}}}() + @chk ccall( + (:DMStagVecGetArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ref{Ptr{Ptr{Ptr{Ptr{$PetscScalar}}}}}), + dm, vec, a_, + ) + sz = (q,m,n,p) + perm = (2,3,4,1) + + end + + # Dereference the pointer-of-pointers down to a raw scalar pointer + # For 1D: Ptr{Ptr{T}} -> load once -> Ptr{T} + # For 2D: Ptr{Ptr{Ptr{T}}} -> load twice -> Ptr{T} + # For 3D: Ptr{Ptr{Ptr{Ptr{T}}}} -> load thrice -> Ptr{T} + raw_ptr = a_[] + for _ = 1:dim + raw_ptr = unsafe_load(raw_ptr) + end + mat = unsafe_wrap(Array, raw_ptr, sz) + # permute, as julia uses Fortran type storage order, but + # PETSc/C use C type storage order: + mat = PermutedDimsArray(mat, perm) + arr = PetscArray(mat, a_) + + return arr +end + +""" + array::PetscArray = DMStagVecGetArrayRead(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec) +get read + +Logically Collective + +See the man page for `DMStagVecGetArray()` for more information. + +Input Parameters: +- `dm` - the `DMSTAG` object +- `vec` - the `Vec` object + +Output Parameter: +- `array` - the read-only array + +Level: beginner + +Note: +`DMStagVecRestoreArrayRead()` must be called, once finished with the array + +See also: +=== +`DMSTAG`, `DMStagGetLocationSlot()`, `DMGetLocalVector()`, `DMCreateLocalVector()`, `DMGetGlobalVector()`, `DMCreateGlobalVector()`, `DMDAVecGetArrayRead()`, `DMDAVecGetArrayDOFRead()` + +# External Links +$(_doc_external("DMStag/DMStagVecGetArrayRead")) +""" +function DMStagVecGetArrayRead(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec) end + +@for_petsc function DMStagVecGetArrayRead(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec) + # PETSc returns a pointer into the Vec's internal storage; we wrap it without taking ownership + _,_,_,m,n,p = DMStagGetGhostCorners(petsclib, dm) + dim = DMGetDimension(petsclib, dm) + q = DMStagGetEntriesPerElement(petsclib, dm) + + if dim==1 + a_ = Ref{Ptr{Ptr{$PetscScalar}}}() + @chk ccall( + (:DMStagVecGetArrayRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ref{Ptr{Ptr{$PetscScalar}}}), + dm, vec, a_, + ) + sz = (m,q) + perm = (2,1) + elseif dim==2 + a_ = Ref{Ptr{Ptr{Ptr{$PetscScalar}}}}() + @chk ccall( + (:DMStagVecGetArrayRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ref{Ptr{Ptr{Ptr{$PetscScalar}}}}), + dm, vec, a_, + ) + sz = (m,n,q) + perm = (2,3,1) + + elseif dim==3 + a_ = Ref{Ptr{Ptr{Ptr{Ptr{$PetscScalar}}}}}() + @chk ccall( + (:DMStagVecGetArrayRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ref{Ptr{Ptr{Ptr{Ptr{$PetscScalar}}}}}), + dm, vec, a_, + ) + sz = (m,n,p,q) + perm = (2,3,41) + end + + # Dereference the pointer-of-pointers down to a raw scalar pointer + raw_ptr = a_[] + for _ = 1:dim + raw_ptr = unsafe_load(raw_ptr) + end + mat = unsafe_wrap(Array, raw_ptr, sz) + # permute, as julia uses Fortran type storage order, but + # PETSc/C use C type storage order: + mat = PermutedDimsArray(mat, perm) + arr = PetscArray(mat, a_) + + return arr +end + +""" + DMStagVecRestoreArray(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec, array::PetscArray) +restore access to a raw array + +Logically Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `vec` - the `Vec` object + +Output Parameter: +- `array` - the array + +Level: beginner + +See also: +=== +`DMSTAG`, `DMStagVecGetArray()`, `DMDAVecRestoreArray()`, `DMDAVecRestoreArrayDOF()` + +# External Links +$(_doc_external("DMStag/DMStagVecRestoreArray")) +""" +function DMStagVecRestoreArray(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec, array::PetscArray) end + +@for_petsc function DMStagVecRestoreArray(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec, array::PetscArray{$PetscScalar, N} ) where N + if array.ptr[] != C_NULL + if N==2 + @chk ccall( + (:DMStagVecRestoreArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Ptr{Ptr{$PetscScalar}}}), + dm, vec, array.ptr, + ) + # prevent double-restore: null the handle + array.ptr[] = Ptr{Ptr{$PetscScalar}}(C_NULL) + elseif N==3 + @chk ccall( + (:DMStagVecRestoreArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Ptr{Ptr{Ptr{$PetscScalar}}}}), + dm, vec, array.ptr, + ) + array.ptr[] = Ptr{Ptr{Ptr{$PetscScalar}}}(C_NULL) + elseif N==4 + @chk ccall( + (:DMStagVecRestoreArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Ptr{Ptr{Ptr{Ptr{$PetscScalar}}}}}), + dm, vec, array.ptr, + ) + array.ptr[] = Ptr{Ptr{Ptr{Ptr{$PetscScalar}}}}(C_NULL) + end + end + + return nothing +end + +""" + DMStagVecRestoreArrayRead(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec, array::PetscArray) +restore read + +Logically Collective + +Input Parameters: +- `dm` - the `DMSTAG` object +- `vec` - the Vec object + +Output Parameter: +- `array` - the read-only array + +Level: beginner + +See also: +=== +`DMSTAG`, `DMStagVecGetArrayRead()`, `DMDAVecRestoreArrayRead()`, `DMDAVecRestoreArrayDOFRead()` + +# External Links +$(_doc_external("DMStag/DMStagVecRestoreArrayRead")) +""" +function DMStagVecRestoreArrayRead(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec, array::PetscArray) end + +@for_petsc function DMStagVecRestoreArrayRead(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec, array::PetscArray{$PetscScalar, N} ) where N + if array.ptr[] != C_NULL + if N==2 + @chk ccall( + (:DMStagVecRestoreArrayRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Ptr{Ptr{$PetscScalar}}}), + dm, vec, array.ptr, + ) + array.ptr[] = Ptr{Ptr{$PetscScalar}}(C_NULL) + elseif N==3 + @chk ccall( + (:DMStagVecRestoreArrayRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Ptr{Ptr{Ptr{$PetscScalar}}}}), + dm, vec, array.ptr, + ) + array.ptr[] = Ptr{Ptr{Ptr{$PetscScalar}}}(C_NULL) + elseif N==4 + @chk ccall( + (:DMStagVecRestoreArrayRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Ptr{Ptr{Ptr{Ptr{$PetscScalar}}}}}), + dm, vec, array.ptr, + ) + array.ptr[] = Ptr{Ptr{Ptr{Ptr{$PetscScalar}}}}(C_NULL) + end + end + + return nothing +end + +""" + dm::PetscDM = DMStagCreate2d(petsclib::PetscLibType,comm::MPI_Comm, bndx::DMBoundaryType, bndy::DMBoundaryType, M::PetscInt, N::PetscInt, m::PetscInt, n::PetscInt, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, stencilType::DMStagStencilType, stencilWidth::PetscInt, lx::Vector{PetscInt}, ly::Vector{PetscInt}) +Create an object to manage data living on the elements, faces, and vertices of a parallelized regular 2D grid. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bndx` - x boundary type, `DM_BOUNDARY_NONE`, `DM_BOUNDARY_PERIODIC`, or `DM_BOUNDARY_GHOSTED` +- `bndy` - y boundary type, `DM_BOUNDARY_NONE`, `DM_BOUNDARY_PERIODIC`, or `DM_BOUNDARY_GHOSTED` +- `M` - global number of elements in x direction +- `N` - global number of elements in y direction +- `m` - number of ranks in the x direction (may be `PETSC_DECIDE`) +- `n` - number of ranks in the y direction (may be `PETSC_DECIDE`) +- `dof0` - number of degrees of freedom per vertex/0-cell +- `dof1` - number of degrees of freedom per face/1-cell +- `dof2` - number of degrees of freedom per element/2-cell +- `stencilType` - ghost/halo region type: `DMSTAG_STENCIL_NONE`, `DMSTAG_STENCIL_BOX`, or `DMSTAG_STENCIL_STAR` +- `stencilWidth` - width, in elements, of halo/ghost region +- `lx` - array of local x element counts, of length equal to `m`, summing to `M`, or `NULL` +- `ly` - array of local y element counts, of length equal to `n`, summing to `N`, or `NULL` + +Output Parameter: +- `dm` - the new `DMSTAG` object + +Options Database Keys: +- `-dm_view` - calls `DMViewFromOptions()` at the conclusion of `DMSetUp()` +- `-stag_grid_x ` - number of elements in the x direction +- `-stag_grid_y ` - number of elements in the y direction +- `-stag_ranks_x ` - number of ranks in the x direction +- `-stag_ranks_y ` - number of ranks in the y direction +- `-stag_ghost_stencil_width` - width of ghost region, in elements +- `-stag_boundary_type_x ` - `DMBoundaryType` value +- `-stag_boundary_type_y ` - `DMBoundaryType` value + +Level: beginner + +Notes: +You must call `DMSetUp()` after this call, before using the `DM`. +If you wish to use the options database (see the keys above) to change values in the `DMSTAG`, you must call +`DMSetFromOptions()` after this function but before `DMSetUp()`. + +See also: +=== +`DMSTAG`, `DMStagCreate1d()`, `DMStagCreate3d()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()`, `DMLocalToGlobalBegin()`, `DMDACreate2d()` + +# External Links +$(_doc_external("DMStag/DMStagCreate2d")) +""" +function DMStagCreate2d(petsclib::PetscLibType, comm::MPI_Comm, bndx::DMBoundaryType, bndy::DMBoundaryType, M::PetscInt, N::PetscInt, m::PetscInt, n::PetscInt, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, stencilType::DMStagStencilType, stencilWidth::PetscInt, lx::Union{Ptr,Vector{PetscInt}}, ly::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function DMStagCreate2d(petsclib::$UnionPetscLib, comm::MPI_Comm, bndx::DMBoundaryType, bndy::DMBoundaryType, M::$PetscInt, N::$PetscInt, m::$PetscInt, n::$PetscInt, dof0::$PetscInt, dof1::$PetscInt, dof2::$PetscInt, stencilType::DMStagStencilType, stencilWidth::$PetscInt, lx::Union{Ptr,Vector{$PetscInt}}, ly::Union{Ptr,Vector{$PetscInt}} ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMStagCreate2d, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMBoundaryType, DMBoundaryType, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, DMStagStencilType, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{CDM}), + comm, bndx, bndy, M, N, m, n, dof0, dof1, dof2, stencilType, stencilWidth, lx, ly, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMPatchZoom(petsclib::PetscLibType,dm::PetscDM, lower::MatStencil, upper::MatStencil, commz::MPI_Comm, dmz::PetscDM, sfz::PetscSF, sfzr::PetscSF) +Create patches of a `DMDA` on subsets of processes, indicated by `commz` + +Collective + +Input Parameters: +- `dm` - the `DM` +- `lower` - the lower left corner of the requested patch +- `upper` - the upper right corner of the requested patch +- `commz` - the new communicator for the patch, `MPI_COMM_NULL` indicates that the given rank will not own a patch + +Output Parameters: +- `dmz` - the patch `DM` +- `sfz` - the `PetscSF` mapping the patch+halo to the zoomed version (optional) +- `sfzr` - the `PetscSF` mapping the patch to the restricted zoomed version + +Level: intermediate + +-seealso: `DMPatchSolve()`, `DMDACreatePatchIS()` + +# External Links +$(_doc_external("DMPatch/DMPatchZoom")) +""" +function DMPatchZoom(petsclib::PetscLibType, dm::PetscDM, lower::MatStencil, upper::MatStencil, commz::MPI_Comm, dmz::PetscDM, sfz::PetscSF, sfzr::PetscSF) end + +@for_petsc function DMPatchZoom(petsclib::$UnionPetscLib, dm::PetscDM, lower::MatStencil, upper::MatStencil, commz::MPI_Comm, dmz::PetscDM, sfz::PetscSF, sfzr::PetscSF ) + dmz_ = Ref(dmz.ptr) + + @chk ccall( + (:DMPatchZoom, $petsc_library), + PetscErrorCode, + (CDM, MatStencil, MatStencil, MPI_Comm, Ptr{CDM}, Ptr{PetscSF}, Ptr{PetscSF}), + dm, lower, upper, commz, dmz_, sfz, sfzr, + ) + + dmz.ptr = dmz_[] + + return nothing +end + +""" + DMPatchSolve(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMPatch/DMPatchSolve")) +""" +function DMPatchSolve(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPatchSolve(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPatchSolve, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPatchGetCoarse(petsclib::PetscLibType,dm::PetscDM, dmCoarse::PetscDM) + +# External Links +$(_doc_external("DMPatch/DMPatchGetCoarse")) +""" +function DMPatchGetCoarse(petsclib::PetscLibType, dm::PetscDM, dmCoarse::PetscDM) end + +@for_petsc function DMPatchGetCoarse(petsclib::$UnionPetscLib, dm::PetscDM, dmCoarse::PetscDM ) + dmCoarse_ = Ref(dmCoarse.ptr) + + @chk ccall( + (:DMPatchGetCoarse, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, dmCoarse_, + ) + + dmCoarse.ptr = dmCoarse_[] + + return nothing +end + +""" + DMPatchGetPatchSize(petsclib::PetscLibType,dm::PetscDM, patchSize::MatStencil) + +# External Links +$(_doc_external("DMPatch/DMPatchGetPatchSize")) +""" +function DMPatchGetPatchSize(petsclib::PetscLibType, dm::PetscDM, patchSize::MatStencil) end + +@for_petsc function DMPatchGetPatchSize(petsclib::$UnionPetscLib, dm::PetscDM, patchSize::MatStencil ) + + @chk ccall( + (:DMPatchGetPatchSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{MatStencil}), + dm, patchSize, + ) + + + return nothing +end + +""" + DMPatchSetPatchSize(petsclib::PetscLibType,dm::PetscDM, patchSize::MatStencil) + +# External Links +$(_doc_external("DMPatch/DMPatchSetPatchSize")) +""" +function DMPatchSetPatchSize(petsclib::PetscLibType, dm::PetscDM, patchSize::MatStencil) end + +@for_petsc function DMPatchSetPatchSize(petsclib::$UnionPetscLib, dm::PetscDM, patchSize::MatStencil ) + + @chk ccall( + (:DMPatchSetPatchSize, $petsc_library), + PetscErrorCode, + (CDM, MatStencil), + dm, patchSize, + ) + + + return nothing +end + +""" + DMPatchGetCommSize(petsclib::PetscLibType,dm::PetscDM, commSize::MatStencil) + +# External Links +$(_doc_external("DMPatch/DMPatchGetCommSize")) +""" +function DMPatchGetCommSize(petsclib::PetscLibType, dm::PetscDM, commSize::MatStencil) end + +@for_petsc function DMPatchGetCommSize(petsclib::$UnionPetscLib, dm::PetscDM, commSize::MatStencil ) + + @chk ccall( + (:DMPatchGetCommSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{MatStencil}), + dm, commSize, + ) + + + return nothing +end + +""" + DMPatchSetCommSize(petsclib::PetscLibType,dm::PetscDM, commSize::MatStencil) + +# External Links +$(_doc_external("DMPatch/DMPatchSetCommSize")) +""" +function DMPatchSetCommSize(petsclib::PetscLibType, dm::PetscDM, commSize::MatStencil) end + +@for_petsc function DMPatchSetCommSize(petsclib::$UnionPetscLib, dm::PetscDM, commSize::MatStencil ) + + @chk ccall( + (:DMPatchSetCommSize, $petsc_library), + PetscErrorCode, + (CDM, MatStencil), + dm, commSize, + ) + + + return nothing +end + +""" + mesh::PetscDM = DMPatchCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a DMPatch object, which is a collections of DMs called patches. + +Collective + +Input Parameter: +- `comm` - The communicator for the DMPatch object + +Output Parameter: +- `mesh` - The DMPatch object + +-seealso: `DMPatchZoom()` + + +# External Links +$(_doc_external("DMPatch/DMPatchCreate")) +""" +function DMPatchCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMPatchCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + mesh_ = Ref{CDM}() + + @chk ccall( + (:DMPatchCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CDM}), + comm, mesh_, + ) + + mesh = PetscDM(mesh_[], petsclib) + + return mesh +end + +""" + dm::PetscDM = DMPatchCreateGrid(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, patchSize::MatStencil, commSize::MatStencil, gridSize::MatStencil) + +# External Links +$(_doc_external("DMPatch/DMPatchCreateGrid")) +""" +function DMPatchCreateGrid(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, patchSize::MatStencil, commSize::MatStencil, gridSize::MatStencil) end + +@for_petsc function DMPatchCreateGrid(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, patchSize::MatStencil, commSize::MatStencil, gridSize::MatStencil ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPatchCreateGrid, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, MatStencil, MatStencil, MatStencil, Ptr{CDM}), + comm, dim, patchSize, commSize, gridSize, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMRedundantSetSize(petsclib::PetscLibType,dm::PetscDM, rank::PetscMPIInt, N::PetscInt) +Sets the size of a densely coupled redundant object + +Collective + +Input Parameters: +- `dm` - `DM` object of type `DMREDUNDANT` +- `rank` - rank of process to own the redundant degrees of freedom +- `N` - total number of redundant degrees of freedom + +Level: advanced + +-seealso: `DM`, `DMREDUNDANT`, `DMDestroy()`, `DMCreateGlobalVector()`, `DMRedundantCreate()`, `DMRedundantGetSize()` + +# External Links +$(_doc_external("DM/DMRedundantSetSize")) +""" +function DMRedundantSetSize(petsclib::PetscLibType, dm::PetscDM, rank::PetscMPIInt, N::PetscInt) end + +@for_petsc function DMRedundantSetSize(petsclib::$UnionPetscLib, dm::PetscDM, rank::PetscMPIInt, N::$PetscInt ) + + @chk ccall( + (:DMRedundantSetSize, $petsc_library), + PetscErrorCode, + (CDM, PetscMPIInt, $PetscInt), + dm, rank, N, + ) + + + return nothing +end + +""" + N::PetscInt = DMRedundantGetSize(petsclib::PetscLibType,dm::PetscDM, rank::PetscMPIInt) +Gets the size of a densely coupled redundant object + +Not Collective + +Input Parameter: +- `dm` - `DM` object of type `DMREDUNDANT` + +Output Parameters: +- `rank` - rank of process to own the redundant degrees of freedom (or `NULL`) +- `N` - total number of redundant degrees of freedom (or `NULL`) + +Level: advanced + +-seealso: `DM`, `DMREDUNDANT`, `DMDestroy()`, `DMCreateGlobalVector()`, `DMRedundantCreate()`, `DMRedundantSetSize()` + +# External Links +$(_doc_external("DM/DMRedundantGetSize")) +""" +function DMRedundantGetSize(petsclib::PetscLibType, dm::PetscDM, rank::PetscMPIInt) end + +@for_petsc function DMRedundantGetSize(petsclib::$UnionPetscLib, dm::PetscDM, rank::PetscMPIInt ) + N_ = Ref{$PetscInt}() + + @chk ccall( + (:DMRedundantGetSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscMPIInt}, Ptr{$PetscInt}), + dm, rank, N_, + ) + + N = N_[] + + return N +end + +""" + dm::PetscDM = DMRedundantCreate(petsclib::PetscLibType,comm::MPI_Comm, rank::PetscMPIInt, N::PetscInt) +Creates a `DM` object, used to manage data for dense globally coupled variables + +Collective + +Input Parameters: +- `comm` - the processors that will share the global vector +- `rank` - the MPI rank to own the redundant values +- `N` - total number of degrees of freedom + +Output Parameter: +- `dm` - the `DM` object of type `DMREDUNDANT` + +Level: advanced + +-seealso: `DM`, `DMREDUNDANT`, `DMDestroy()`, `DMCreateGlobalVector()`, `DMCreateMatrix()`, `DMCompositeAddDM()`, `DMSetType()`, `DMRedundantSetSize()`, `DMRedundantGetSize()` + +# External Links +$(_doc_external("DM/DMRedundantCreate")) +""" +function DMRedundantCreate(petsclib::PetscLibType, comm::MPI_Comm, rank::PetscMPIInt, N::PetscInt) end + +@for_petsc function DMRedundantCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, rank::PetscMPIInt, N::$PetscInt ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMRedundantCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscMPIInt, $PetscInt, Ptr{CDM}), + comm, rank, N, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMMoabOutput(petsclib::PetscLibType,dm::PetscDM, filename::String, usrwriteopts::String) + +# External Links +$(_doc_external("DMMoab/DMMoabOutput")) +""" +function DMMoabOutput(petsclib::PetscLibType, dm::PetscDM, filename::String, usrwriteopts::String) end + +@for_petsc function DMMoabOutput(petsclib::$UnionPetscLib, dm::PetscDM, filename::String, usrwriteopts::String ) + + @chk ccall( + (:DMMoabOutput, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{Cchar}), + dm, filename, usrwriteopts, + ) + + + return nothing +end + +""" + coordinates::PetscReal,phypts::PetscReal,jacobian_quadrature_weight_product::PetscReal,fe_basis::PetscReal = DMMoabFEMComputeBasis(petsclib::PetscLibType,dim::PetscInt, nverts::PetscInt, quadrature::PetscQuadrature, fe_basis_derivatives::PetscReal) + +# External Links +$(_doc_external("DMMoab/DMMoabFEMComputeBasis")) +""" +function DMMoabFEMComputeBasis(petsclib::PetscLibType, dim::PetscInt, nverts::PetscInt, quadrature::PetscQuadrature, fe_basis_derivatives::PetscReal) end + +@for_petsc function DMMoabFEMComputeBasis(petsclib::$UnionPetscLib, dim::$PetscInt, nverts::$PetscInt, quadrature::PetscQuadrature, fe_basis_derivatives::$PetscReal ) + coordinates_ = Ref{$PetscReal}() + phypts_ = Ref{$PetscReal}() + jacobian_quadrature_weight_product_ = Ref{$PetscReal}() + fe_basis_ = Ref{$PetscReal}() + + @chk ccall( + (:DMMoabFEMComputeBasis, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, PetscQuadrature, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscReal), + dim, nverts, coordinates_, quadrature, phypts_, jacobian_quadrature_weight_product_, fe_basis_, fe_basis_derivatives, + ) + + coordinates = coordinates_[] + phypts = phypts_[] + jacobian_quadrature_weight_product = jacobian_quadrature_weight_product_[] + fe_basis = fe_basis_[] + + return coordinates,phypts,jacobian_quadrature_weight_product,fe_basis +end + +""" + quadrature::PetscQuadrature = DMMoabFEMCreateQuadratureDefault(petsclib::PetscLibType,dim::PetscInt, nverts::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabFEMCreateQuadratureDefault")) +""" +function DMMoabFEMCreateQuadratureDefault(petsclib::PetscLibType, dim::PetscInt, nverts::PetscInt) end + +@for_petsc function DMMoabFEMCreateQuadratureDefault(petsclib::$UnionPetscLib, dim::$PetscInt, nverts::$PetscInt ) + quadrature_ = Ref{PetscQuadrature}() + + @chk ccall( + (:DMMoabFEMCreateQuadratureDefault, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{PetscQuadrature}), + dim, nverts, quadrature_, + ) + + quadrature = quadrature_[] + + return quadrature +end + +""" + coordinates::PetscReal,xphy::PetscReal,natparam::PetscReal,phi::PetscReal = DMMoabPToRMapping(petsclib::PetscLibType,dim::PetscInt, nverts::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabPToRMapping")) +""" +function DMMoabPToRMapping(petsclib::PetscLibType, dim::PetscInt, nverts::PetscInt) end + +@for_petsc function DMMoabPToRMapping(petsclib::$UnionPetscLib, dim::$PetscInt, nverts::$PetscInt ) + coordinates_ = Ref{$PetscReal}() + xphy_ = Ref{$PetscReal}() + natparam_ = Ref{$PetscReal}() + phi_ = Ref{$PetscReal}() + + @chk ccall( + (:DMMoabPToRMapping, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + dim, nverts, coordinates_, xphy_, natparam_, phi_, + ) + + coordinates = coordinates_[] + xphy = xphy_[] + natparam = natparam_[] + phi = phi_[] + + return coordinates,xphy,natparam,phi +end + +""" + range::moab_Range,vec::PetscVec = DMMoabCreateVector(petsclib::PetscLibType,dm::PetscDM, tag::moab_Tag, is_global_vec::PetscBool, destroy_tag::PetscBool) + +# External Links +$(_doc_external("DMMoab/DMMoabCreateVector")) +""" +function DMMoabCreateVector(petsclib::PetscLibType, dm::PetscDM, tag::moab_Tag, is_global_vec::PetscBool, destroy_tag::PetscBool) end + +@for_petsc function DMMoabCreateVector(petsclib::$UnionPetscLib, dm::PetscDM, tag::moab_Tag, is_global_vec::PetscBool, destroy_tag::PetscBool ) + range_ = Ref{moab_Range}() + vec_ = Ref{CVec}() + + @chk ccall( + (:DMMoabCreateVector, $petsc_library), + PetscErrorCode, + (CDM, moab_Tag, Ptr{moab_Range}, PetscBool, PetscBool, Ptr{CVec}), + dm, tag, range_, is_global_vec, destroy_tag, vec_, + ) + + range = range_[] + vec = PetscVec(vec_[], petsclib) + + return range,vec +end + +""" + DMMoabGetVecTag(petsclib::PetscLibType,vec::PetscVec, tag::moab_Tag) + +# External Links +$(_doc_external("DMMoab/DMMoabGetVecTag")) +""" +function DMMoabGetVecTag(petsclib::PetscLibType, vec::PetscVec, tag::moab_Tag) end + +@for_petsc function DMMoabGetVecTag(petsclib::$UnionPetscLib, vec::PetscVec, tag::moab_Tag ) + + @chk ccall( + (:DMMoabGetVecTag, $petsc_library), + PetscErrorCode, + (CVec, Ptr{moab_Tag}), + vec, tag, + ) + + + return nothing +end + +""" + DMMoabGetVecRange(petsclib::PetscLibType,vec::PetscVec, range::moab_Range) + +# External Links +$(_doc_external("DMMoab/DMMoabGetVecRange")) +""" +function DMMoabGetVecRange(petsclib::PetscLibType, vec::PetscVec, range::moab_Range) end + +@for_petsc function DMMoabGetVecRange(petsclib::$UnionPetscLib, vec::PetscVec, range::moab_Range ) + + @chk ccall( + (:DMMoabGetVecRange, $petsc_library), + PetscErrorCode, + (CVec, Ptr{moab_Range}), + vec, range, + ) + + + return nothing +end + +""" + DMMoabVecGetArray(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec, array::Cvoid) + +# External Links +$(_doc_external("DMMoab/DMMoabVecGetArray")) +""" +function DMMoabVecGetArray(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMMoabVecGetArray(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMMoabVecGetArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + dm, vec, array, + ) + + + return nothing +end + +""" + DMMoabVecRestoreArray(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec, array::Cvoid) + +# External Links +$(_doc_external("DMMoab/DMMoabVecRestoreArray")) +""" +function DMMoabVecRestoreArray(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMMoabVecRestoreArray(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMMoabVecRestoreArray, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + dm, vec, array, + ) + + + return nothing +end + +""" + DMMoabVecGetArrayRead(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec, array::Cvoid) + +# External Links +$(_doc_external("DMMoab/DMMoabVecGetArrayRead")) +""" +function DMMoabVecGetArrayRead(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMMoabVecGetArrayRead(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMMoabVecGetArrayRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + dm, vec, array, + ) + + + return nothing +end + +""" + DMMoabVecRestoreArrayRead(petsclib::PetscLibType,dm::PetscDM, vec::PetscVec, array::Cvoid) + +# External Links +$(_doc_external("DMMoab/DMMoabVecRestoreArrayRead")) +""" +function DMMoabVecRestoreArrayRead(petsclib::PetscLibType, dm::PetscDM, vec::PetscVec, array::Cvoid) end + +@for_petsc function DMMoabVecRestoreArrayRead(petsclib::$UnionPetscLib, dm::PetscDM, vec::PetscVec, array::Cvoid ) + + @chk ccall( + (:DMMoabVecRestoreArrayRead, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{Cvoid}), + dm, vec, array, + ) + + + return nothing +end + +""" + ldegrees::PetscInt = DMMoabGenerateHierarchy(petsclib::PetscLibType,dm::PetscDM, nlevels::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabGenerateHierarchy")) +""" +function DMMoabGenerateHierarchy(petsclib::PetscLibType, dm::PetscDM, nlevels::PetscInt) end + +@for_petsc function DMMoabGenerateHierarchy(petsclib::$UnionPetscLib, dm::PetscDM, nlevels::$PetscInt ) + ldegrees_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGenerateHierarchy, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, nlevels, ldegrees_, + ) + + ldegrees = ldegrees_[] + + return ldegrees +end + +""" + bounds::PetscReal,dm::PetscDM = DMMoabCreateBoxMesh(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, useSimplex::PetscBool, nele::PetscInt, nghost::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabCreateBoxMesh")) +""" +function DMMoabCreateBoxMesh(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, useSimplex::PetscBool, nele::PetscInt, nghost::PetscInt) end + +@for_petsc function DMMoabCreateBoxMesh(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, useSimplex::PetscBool, nele::$PetscInt, nghost::$PetscInt ) + bounds_ = Ref{$PetscReal}() + dm_ = Ref{CDM}() + + @chk ccall( + (:DMMoabCreateBoxMesh, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, PetscBool, Ptr{$PetscReal}, $PetscInt, $PetscInt, Ptr{CDM}), + comm, dim, useSimplex, bounds_, nele, nghost, dm_, + ) + + bounds = bounds_[] + dm = PetscDM(dm_[], petsclib) + + return bounds,dm +end + +""" + DMMoabLoadFromFile(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, nghost::PetscInt, filename::String, usrreadopts::String, dm::PetscDM) + +# External Links +$(_doc_external("DMMoab/DMMoabLoadFromFile")) +""" +function DMMoabLoadFromFile(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, nghost::PetscInt, filename::String, usrreadopts::String, dm::PetscDM) end + +@for_petsc function DMMoabLoadFromFile(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, nghost::$PetscInt, filename::String, usrreadopts::String, dm::PetscDM ) + dm_ = Ref(dm.ptr) + + @chk ccall( + (:DMMoabLoadFromFile, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{Cchar}, Ptr{Cchar}, Ptr{CDM}), + comm, dim, nghost, filename, usrreadopts, dm_, + ) + + dm.ptr = dm_[] + + return nothing +end + +""" + DMMoabRenumberMeshEntities(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMMoab/DMMoabRenumberMeshEntities")) +""" +function DMMoabRenumberMeshEntities(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMMoabRenumberMeshEntities(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMMoabRenumberMeshEntities, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMMoabSetFieldVector(petsclib::PetscLibType,dm::PetscDM, ifield::PetscInt, fvec::PetscVec) + +# External Links +$(_doc_external("DMMoab/DMMoabSetFieldVector")) +""" +function DMMoabSetFieldVector(petsclib::PetscLibType, dm::PetscDM, ifield::PetscInt, fvec::PetscVec) end + +@for_petsc function DMMoabSetFieldVector(petsclib::$UnionPetscLib, dm::PetscDM, ifield::$PetscInt, fvec::PetscVec ) + + @chk ccall( + (:DMMoabSetFieldVector, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, CVec), + dm, ifield, fvec, + ) + + + return nothing +end + +""" + DMMoabSetGlobalFieldVector(petsclib::PetscLibType,dm::PetscDM, fvec::PetscVec) + +# External Links +$(_doc_external("DMMoab/DMMoabSetGlobalFieldVector")) +""" +function DMMoabSetGlobalFieldVector(petsclib::PetscLibType, dm::PetscDM, fvec::PetscVec) end + +@for_petsc function DMMoabSetGlobalFieldVector(petsclib::$UnionPetscLib, dm::PetscDM, fvec::PetscVec ) + + @chk ccall( + (:DMMoabSetGlobalFieldVector, $petsc_library), + PetscErrorCode, + (CDM, CVec), + dm, fvec, + ) + + + return nothing +end + +""" + DMMoabSetFieldNames(petsclib::PetscLibType,dm::PetscDM, numFields::PetscInt, fields::String) + +# External Links +$(_doc_external("DMMoab/DMMoabSetFieldNames")) +""" +function DMMoabSetFieldNames(petsclib::PetscLibType, dm::PetscDM, numFields::PetscInt, fields::String) end + +@for_petsc function DMMoabSetFieldNames(petsclib::$UnionPetscLib, dm::PetscDM, numFields::$PetscInt, fields::String ) + fields_ = Ref(pointer(fields)) + + @chk ccall( + (:DMMoabSetFieldNames, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}), + dm, numFields, fields_, + ) + + + return nothing +end + +""" + DMMoabGetFieldName(petsclib::PetscLibType,dm::PetscDM, field::PetscInt, fieldName::String) + +# External Links +$(_doc_external("DMMoab/DMMoabGetFieldName")) +""" +function DMMoabGetFieldName(petsclib::PetscLibType, dm::PetscDM, field::PetscInt, fieldName::String) end + +@for_petsc function DMMoabGetFieldName(petsclib::$UnionPetscLib, dm::PetscDM, field::$PetscInt, fieldName::String ) + fieldName_ = Ref(pointer(fieldName)) + + @chk ccall( + (:DMMoabGetFieldName, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}), + dm, field, fieldName_, + ) + + + return nothing +end + +""" + DMMoabSetFieldName(petsclib::PetscLibType,dm::PetscDM, field::PetscInt, fieldName::String) + +# External Links +$(_doc_external("DMMoab/DMMoabSetFieldName")) +""" +function DMMoabSetFieldName(petsclib::PetscLibType, dm::PetscDM, field::PetscInt, fieldName::String) end + +@for_petsc function DMMoabSetFieldName(petsclib::$UnionPetscLib, dm::PetscDM, field::$PetscInt, fieldName::String ) + + @chk ccall( + (:DMMoabSetFieldName, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Cchar}), + dm, field, fieldName, + ) + + + return nothing +end + +""" + dof::PetscInt = DMMoabGetFieldDof(petsclib::PetscLibType,dm::PetscDM, point::moab_EntityHandle, field::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabGetFieldDof")) +""" +function DMMoabGetFieldDof(petsclib::PetscLibType, dm::PetscDM, point::moab_EntityHandle, field::PetscInt) end + +@for_petsc function DMMoabGetFieldDof(petsclib::$UnionPetscLib, dm::PetscDM, point::moab_EntityHandle, field::$PetscInt ) + dof_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetFieldDof, $petsc_library), + PetscErrorCode, + (CDM, moab_EntityHandle, $PetscInt, Ptr{$PetscInt}), + dm, point, field, dof_, + ) + + dof = dof_[] + + return dof +end + +""" + dof::PetscInt = DMMoabGetFieldDofs(petsclib::PetscLibType,dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle, field::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabGetFieldDofs")) +""" +function DMMoabGetFieldDofs(petsclib::PetscLibType, dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle, field::PetscInt) end + +@for_petsc function DMMoabGetFieldDofs(petsclib::$UnionPetscLib, dm::PetscDM, npoints::$PetscInt, points::moab_EntityHandle, field::$PetscInt ) + dof_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetFieldDofs, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{moab_EntityHandle}, $PetscInt, Ptr{$PetscInt}), + dm, npoints, points, field, dof_, + ) + + dof = dof_[] + + return dof +end + +""" + dof::PetscInt = DMMoabGetFieldDofsLocal(petsclib::PetscLibType,dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle, field::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabGetFieldDofsLocal")) +""" +function DMMoabGetFieldDofsLocal(petsclib::PetscLibType, dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle, field::PetscInt) end + +@for_petsc function DMMoabGetFieldDofsLocal(petsclib::$UnionPetscLib, dm::PetscDM, npoints::$PetscInt, points::moab_EntityHandle, field::$PetscInt ) + dof_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetFieldDofsLocal, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{moab_EntityHandle}, $PetscInt, Ptr{$PetscInt}), + dm, npoints, points, field, dof_, + ) + + dof = dof_[] + + return dof +end + +""" + dof::PetscInt = DMMoabGetDofs(petsclib::PetscLibType,dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabGetDofs")) +""" +function DMMoabGetDofs(petsclib::PetscLibType, dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle) end + +@for_petsc function DMMoabGetDofs(petsclib::$UnionPetscLib, dm::PetscDM, npoints::$PetscInt, points::moab_EntityHandle ) + dof_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetDofs, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{moab_EntityHandle}, Ptr{$PetscInt}), + dm, npoints, points, dof_, + ) + + dof = dof_[] + + return dof +end + +""" + dof::PetscInt = DMMoabGetDofsLocal(petsclib::PetscLibType,dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabGetDofsLocal")) +""" +function DMMoabGetDofsLocal(petsclib::PetscLibType, dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle) end + +@for_petsc function DMMoabGetDofsLocal(petsclib::$UnionPetscLib, dm::PetscDM, npoints::$PetscInt, points::moab_EntityHandle ) + dof_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetDofsLocal, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{moab_EntityHandle}, Ptr{$PetscInt}), + dm, npoints, points, dof_, + ) + + dof = dof_[] + + return dof +end + +""" + dof::PetscInt = DMMoabGetDofsBlocked(petsclib::PetscLibType,dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabGetDofsBlocked")) +""" +function DMMoabGetDofsBlocked(petsclib::PetscLibType, dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle) end + +@for_petsc function DMMoabGetDofsBlocked(petsclib::$UnionPetscLib, dm::PetscDM, npoints::$PetscInt, points::moab_EntityHandle ) + dof_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetDofsBlocked, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{moab_EntityHandle}, Ptr{$PetscInt}), + dm, npoints, points, dof_, + ) + + dof = dof_[] + + return dof +end + +""" + dof::PetscInt = DMMoabGetDofsBlockedLocal(petsclib::PetscLibType,dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabGetDofsBlockedLocal")) +""" +function DMMoabGetDofsBlockedLocal(petsclib::PetscLibType, dm::PetscDM, npoints::PetscInt, points::moab_EntityHandle) end + +@for_petsc function DMMoabGetDofsBlockedLocal(petsclib::$UnionPetscLib, dm::PetscDM, npoints::$PetscInt, points::moab_EntityHandle ) + dof_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetDofsBlockedLocal, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{moab_EntityHandle}, Ptr{$PetscInt}), + dm, npoints, points, dof_, + ) + + dof = dof_[] + + return dof +end + +""" + DMMoabGetVertexDofsBlocked(petsclib::PetscLibType,dm::PetscDM, dof::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabGetVertexDofsBlocked")) +""" +function DMMoabGetVertexDofsBlocked(petsclib::PetscLibType, dm::PetscDM, dof::PetscInt) end + +@for_petsc function DMMoabGetVertexDofsBlocked(petsclib::$UnionPetscLib, dm::PetscDM, dof::$PetscInt ) + + @chk ccall( + (:DMMoabGetVertexDofsBlocked, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, dof, + ) + + + return nothing +end + +""" + DMMoabGetVertexDofsBlockedLocal(petsclib::PetscLibType,dm::PetscDM, dof::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabGetVertexDofsBlockedLocal")) +""" +function DMMoabGetVertexDofsBlockedLocal(petsclib::PetscLibType, dm::PetscDM, dof::PetscInt) end + +@for_petsc function DMMoabGetVertexDofsBlockedLocal(petsclib::$UnionPetscLib, dm::PetscDM, dof::$PetscInt ) + + @chk ccall( + (:DMMoabGetVertexDofsBlockedLocal, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, dof, + ) + + + return nothing +end + +""" + dmb::PetscDM = DMMoabCreate(petsclib::PetscLibType,comm::MPI_Comm) + +# External Links +$(_doc_external("DMMoab/DMMoabCreate")) +""" +function DMMoabCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMMoabCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + dmb_ = Ref{CDM}() + + @chk ccall( + (:DMMoabCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CDM}), + comm, dmb_, + ) + + dmb = PetscDM(dmb_[], petsclib) + + return dmb +end + +""" + mbiface::moab_Interface,ltog_tag::moab_Tag,range::moab_Range,dmb::PetscDM = DMMoabCreateMoab(petsclib::PetscLibType,comm::MPI_Comm) + +# External Links +$(_doc_external("DMMoab/DMMoabCreateMoab")) +""" +function DMMoabCreateMoab(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMMoabCreateMoab(petsclib::$UnionPetscLib, comm::MPI_Comm ) + mbiface_ = Ref{moab_Interface}() + ltog_tag_ = Ref{moab_Tag}() + range_ = Ref{moab_Range}() + dmb_ = Ref{CDM}() + + @chk ccall( + (:DMMoabCreateMoab, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{moab_Interface}, Ptr{moab_Tag}, Ptr{moab_Range}, Ptr{CDM}), + comm, mbiface_, ltog_tag_, range_, dmb_, + ) + + mbiface = mbiface_[] + ltog_tag = ltog_tag_[] + range = range_[] + dmb = PetscDM(dmb_[], petsclib) + + return mbiface,ltog_tag,range,dmb +end + +""" + DMMoabGetParallelComm(petsclib::PetscLibType,dm::PetscDM, pcomm::moab_ParallelComm) + +# External Links +$(_doc_external("DMMoab/DMMoabGetParallelComm")) +""" +function DMMoabGetParallelComm(petsclib::PetscLibType, dm::PetscDM, pcomm::moab_ParallelComm) end + +@for_petsc function DMMoabGetParallelComm(petsclib::$UnionPetscLib, dm::PetscDM, pcomm::moab_ParallelComm ) + + @chk ccall( + (:DMMoabGetParallelComm, $petsc_library), + PetscErrorCode, + (CDM, moab_ParallelComm), + dm, pcomm, + ) + + + return nothing +end + +""" + DMMoabSetInterface(petsclib::PetscLibType,dm::PetscDM, mbiface::moab_Interface) + +# External Links +$(_doc_external("DMMoab/DMMoabSetInterface")) +""" +function DMMoabSetInterface(petsclib::PetscLibType, dm::PetscDM, mbiface::moab_Interface) end + +@for_petsc function DMMoabSetInterface(petsclib::$UnionPetscLib, dm::PetscDM, mbiface::moab_Interface ) + + @chk ccall( + (:DMMoabSetInterface, $petsc_library), + PetscErrorCode, + (CDM, Ptr{moab_Interface}), + dm, mbiface, + ) + + + return nothing +end + +""" + DMMoabGetInterface(petsclib::PetscLibType,dm::PetscDM, mbiface::moab_Interface) + +# External Links +$(_doc_external("DMMoab/DMMoabGetInterface")) +""" +function DMMoabGetInterface(petsclib::PetscLibType, dm::PetscDM, mbiface::moab_Interface) end + +@for_petsc function DMMoabGetInterface(petsclib::$UnionPetscLib, dm::PetscDM, mbiface::moab_Interface ) + + @chk ccall( + (:DMMoabGetInterface, $petsc_library), + PetscErrorCode, + (CDM, moab_Interface), + dm, mbiface, + ) + + + return nothing +end + +""" + DMMoabSetLocalVertices(petsclib::PetscLibType,dm::PetscDM, range::moab_Range) + +# External Links +$(_doc_external("DMMoab/DMMoabSetLocalVertices")) +""" +function DMMoabSetLocalVertices(petsclib::PetscLibType, dm::PetscDM, range::moab_Range) end + +@for_petsc function DMMoabSetLocalVertices(petsclib::$UnionPetscLib, dm::PetscDM, range::moab_Range ) + + @chk ccall( + (:DMMoabSetLocalVertices, $petsc_library), + PetscErrorCode, + (CDM, Ptr{moab_Range}), + dm, range, + ) + + + return nothing +end + +""" + DMMoabGetAllVertices(petsclib::PetscLibType,dm::PetscDM, loc::moab_Range) + +# External Links +$(_doc_external("DMMoab/DMMoabGetAllVertices")) +""" +function DMMoabGetAllVertices(petsclib::PetscLibType, dm::PetscDM, loc::moab_Range) end + +@for_petsc function DMMoabGetAllVertices(petsclib::$UnionPetscLib, dm::PetscDM, loc::moab_Range ) + + @chk ccall( + (:DMMoabGetAllVertices, $petsc_library), + PetscErrorCode, + (CDM, Ptr{moab_Range}), + dm, loc, + ) + + + return nothing +end + +""" + DMMoabGetLocalVertices(petsclib::PetscLibType,dm::PetscDM, owned::moab_Range, ghost::moab_Range) + +# External Links +$(_doc_external("DMMoab/DMMoabGetLocalVertices")) +""" +function DMMoabGetLocalVertices(petsclib::PetscLibType, dm::PetscDM, owned::moab_Range, ghost::moab_Range) end + +@for_petsc function DMMoabGetLocalVertices(petsclib::$UnionPetscLib, dm::PetscDM, owned::moab_Range, ghost::moab_Range ) + + @chk ccall( + (:DMMoabGetLocalVertices, $petsc_library), + PetscErrorCode, + (CDM, moab_Range, moab_Range), + dm, owned, ghost, + ) + + + return nothing +end + +""" + DMMoabGetLocalElements(petsclib::PetscLibType,dm::PetscDM, range::moab_Range) + +# External Links +$(_doc_external("DMMoab/DMMoabGetLocalElements")) +""" +function DMMoabGetLocalElements(petsclib::PetscLibType, dm::PetscDM, range::moab_Range) end + +@for_petsc function DMMoabGetLocalElements(petsclib::$UnionPetscLib, dm::PetscDM, range::moab_Range ) + + @chk ccall( + (:DMMoabGetLocalElements, $petsc_library), + PetscErrorCode, + (CDM, moab_Range), + dm, range, + ) + + + return nothing +end + +""" + DMMoabSetLocalElements(petsclib::PetscLibType,dm::PetscDM, range::moab_Range) + +# External Links +$(_doc_external("DMMoab/DMMoabSetLocalElements")) +""" +function DMMoabSetLocalElements(petsclib::PetscLibType, dm::PetscDM, range::moab_Range) end + +@for_petsc function DMMoabSetLocalElements(petsclib::$UnionPetscLib, dm::PetscDM, range::moab_Range ) + + @chk ccall( + (:DMMoabSetLocalElements, $petsc_library), + PetscErrorCode, + (CDM, Ptr{moab_Range}), + dm, range, + ) + + + return nothing +end + +""" + DMMoabSetLocalToGlobalTag(petsclib::PetscLibType,dm::PetscDM, ltogtag::moab_Tag) + +# External Links +$(_doc_external("DMMoab/DMMoabSetLocalToGlobalTag")) +""" +function DMMoabSetLocalToGlobalTag(petsclib::PetscLibType, dm::PetscDM, ltogtag::moab_Tag) end + +@for_petsc function DMMoabSetLocalToGlobalTag(petsclib::$UnionPetscLib, dm::PetscDM, ltogtag::moab_Tag ) + + @chk ccall( + (:DMMoabSetLocalToGlobalTag, $petsc_library), + PetscErrorCode, + (CDM, moab_Tag), + dm, ltogtag, + ) + + + return nothing +end + +""" + DMMoabGetLocalToGlobalTag(petsclib::PetscLibType,dm::PetscDM, ltog_tag::moab_Tag) + +# External Links +$(_doc_external("DMMoab/DMMoabGetLocalToGlobalTag")) +""" +function DMMoabGetLocalToGlobalTag(petsclib::PetscLibType, dm::PetscDM, ltog_tag::moab_Tag) end + +@for_petsc function DMMoabGetLocalToGlobalTag(petsclib::$UnionPetscLib, dm::PetscDM, ltog_tag::moab_Tag ) + + @chk ccall( + (:DMMoabGetLocalToGlobalTag, $petsc_library), + PetscErrorCode, + (CDM, Ptr{moab_Tag}), + dm, ltog_tag, + ) + + + return nothing +end + +""" + DMMoabSetBlockSize(petsclib::PetscLibType,dm::PetscDM, bs::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabSetBlockSize")) +""" +function DMMoabSetBlockSize(petsclib::PetscLibType, dm::PetscDM, bs::PetscInt) end + +@for_petsc function DMMoabSetBlockSize(petsclib::$UnionPetscLib, dm::PetscDM, bs::$PetscInt ) + + @chk ccall( + (:DMMoabSetBlockSize, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, bs, + ) + + + return nothing +end + +""" + bs::PetscInt = DMMoabGetBlockSize(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMMoab/DMMoabGetBlockSize")) +""" +function DMMoabGetBlockSize(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMMoabGetBlockSize(petsclib::$UnionPetscLib, dm::PetscDM ) + bs_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetBlockSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, bs_, + ) + + bs = bs_[] + + return bs +end + +""" + neg::PetscInt,nvg::PetscInt = DMMoabGetSize(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMMoab/DMMoabGetSize")) +""" +function DMMoabGetSize(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMMoabGetSize(petsclib::$UnionPetscLib, dm::PetscDM ) + neg_ = Ref{$PetscInt}() + nvg_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, neg_, nvg_, + ) + + neg = neg_[] + nvg = nvg_[] + + return neg,nvg +end + +""" + nel::PetscInt,neg::PetscInt,nvl::PetscInt,nvg::PetscInt = DMMoabGetLocalSize(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMMoab/DMMoabGetLocalSize")) +""" +function DMMoabGetLocalSize(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMMoabGetLocalSize(petsclib::$UnionPetscLib, dm::PetscDM ) + nel_ = Ref{$PetscInt}() + neg_ = Ref{$PetscInt}() + nvl_ = Ref{$PetscInt}() + nvg_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetLocalSize, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, nel_, neg_, nvl_, nvg_, + ) + + nel = nel_[] + neg = neg_[] + nvl = nvl_[] + nvg = nvg_[] + + return nel,neg,nvl,nvg +end + +""" + offset::PetscInt = DMMoabGetOffset(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMMoab/DMMoabGetOffset")) +""" +function DMMoabGetOffset(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMMoabGetOffset(petsclib::$UnionPetscLib, dm::PetscDM ) + offset_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetOffset, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, offset_, + ) + + offset = offset_[] + + return offset +end + +""" + dim::PetscInt = DMMoabGetDimension(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMMoab/DMMoabGetDimension")) +""" +function DMMoabGetDimension(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMMoabGetDimension(petsclib::$UnionPetscLib, dm::PetscDM ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetDimension, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + nlevel::PetscInt = DMMoabGetHierarchyLevel(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMMoab/DMMoabGetHierarchyLevel")) +""" +function DMMoabGetHierarchyLevel(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMMoabGetHierarchyLevel(petsclib::$UnionPetscLib, dm::PetscDM ) + nlevel_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetHierarchyLevel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, nlevel_, + ) + + nlevel = nlevel_[] + + return nlevel +end + +""" + mat::PetscInt = DMMoabGetMaterialBlock(petsclib::PetscLibType,dm::PetscDM, ehandle::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabGetMaterialBlock")) +""" +function DMMoabGetMaterialBlock(petsclib::PetscLibType, dm::PetscDM, ehandle::moab_EntityHandle) end + +@for_petsc function DMMoabGetMaterialBlock(petsclib::$UnionPetscLib, dm::PetscDM, ehandle::moab_EntityHandle ) + mat_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetMaterialBlock, $petsc_library), + PetscErrorCode, + (CDM, moab_EntityHandle, Ptr{$PetscInt}), + dm, ehandle, mat_, + ) + + mat = mat_[] + + return mat +end + +""" + vpos::PetscReal = DMMoabGetVertexCoordinates(petsclib::PetscLibType,dm::PetscDM, nconn::PetscInt, conn::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabGetVertexCoordinates")) +""" +function DMMoabGetVertexCoordinates(petsclib::PetscLibType, dm::PetscDM, nconn::PetscInt, conn::moab_EntityHandle) end + +@for_petsc function DMMoabGetVertexCoordinates(petsclib::$UnionPetscLib, dm::PetscDM, nconn::$PetscInt, conn::moab_EntityHandle ) + vpos_ = Ref{$PetscReal}() + + @chk ccall( + (:DMMoabGetVertexCoordinates, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{moab_EntityHandle}, Ptr{$PetscReal}), + dm, nconn, conn, vpos_, + ) + + vpos = vpos_[] + + return vpos +end + +""" + nconn::PetscInt = DMMoabGetVertexConnectivity(petsclib::PetscLibType,dm::PetscDM, vhandle::moab_EntityHandle, conn::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabGetVertexConnectivity")) +""" +function DMMoabGetVertexConnectivity(petsclib::PetscLibType, dm::PetscDM, vhandle::moab_EntityHandle, conn::moab_EntityHandle) end + +@for_petsc function DMMoabGetVertexConnectivity(petsclib::$UnionPetscLib, dm::PetscDM, vhandle::moab_EntityHandle, conn::moab_EntityHandle ) + nconn_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetVertexConnectivity, $petsc_library), + PetscErrorCode, + (CDM, moab_EntityHandle, Ptr{$PetscInt}, moab_EntityHandle), + dm, vhandle, nconn_, conn, + ) + + nconn = nconn_[] + + return nconn +end + +""" + nconn::PetscInt = DMMoabRestoreVertexConnectivity(petsclib::PetscLibType,dm::PetscDM, ehandle::moab_EntityHandle, conn::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabRestoreVertexConnectivity")) +""" +function DMMoabRestoreVertexConnectivity(petsclib::PetscLibType, dm::PetscDM, ehandle::moab_EntityHandle, conn::moab_EntityHandle) end + +@for_petsc function DMMoabRestoreVertexConnectivity(petsclib::$UnionPetscLib, dm::PetscDM, ehandle::moab_EntityHandle, conn::moab_EntityHandle ) + nconn_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabRestoreVertexConnectivity, $petsc_library), + PetscErrorCode, + (CDM, moab_EntityHandle, Ptr{$PetscInt}, moab_EntityHandle), + dm, ehandle, nconn_, conn, + ) + + nconn = nconn_[] + + return nconn +end + +""" + nconn::PetscInt = DMMoabGetElementConnectivity(petsclib::PetscLibType,dm::PetscDM, ehandle::moab_EntityHandle, conn::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabGetElementConnectivity")) +""" +function DMMoabGetElementConnectivity(petsclib::PetscLibType, dm::PetscDM, ehandle::moab_EntityHandle, conn::moab_EntityHandle) end + +@for_petsc function DMMoabGetElementConnectivity(petsclib::$UnionPetscLib, dm::PetscDM, ehandle::moab_EntityHandle, conn::moab_EntityHandle ) + nconn_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabGetElementConnectivity, $petsc_library), + PetscErrorCode, + (CDM, moab_EntityHandle, Ptr{$PetscInt}, moab_EntityHandle), + dm, ehandle, nconn_, conn, + ) + + nconn = nconn_[] + + return nconn +end + +""" + ent_on_boundary::PetscBool = DMMoabIsEntityOnBoundary(petsclib::PetscLibType,dm::PetscDM, ent::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabIsEntityOnBoundary")) +""" +function DMMoabIsEntityOnBoundary(petsclib::PetscLibType, dm::PetscDM, ent::moab_EntityHandle) end + +@for_petsc function DMMoabIsEntityOnBoundary(petsclib::$UnionPetscLib, dm::PetscDM, ent::moab_EntityHandle ) + ent_on_boundary_ = Ref{PetscBool}() + + @chk ccall( + (:DMMoabIsEntityOnBoundary, $petsc_library), + PetscErrorCode, + (CDM, moab_EntityHandle, Ptr{PetscBool}), + dm, ent, ent_on_boundary_, + ) + + ent_on_boundary = ent_on_boundary_[] + + return ent_on_boundary +end + +""" + isbdvtx::PetscBool = DMMoabCheckBoundaryVertices(petsclib::PetscLibType,dm::PetscDM, nconn::PetscInt, cnt::moab_EntityHandle) + +# External Links +$(_doc_external("DMMoab/DMMoabCheckBoundaryVertices")) +""" +function DMMoabCheckBoundaryVertices(petsclib::PetscLibType, dm::PetscDM, nconn::PetscInt, cnt::moab_EntityHandle) end + +@for_petsc function DMMoabCheckBoundaryVertices(petsclib::$UnionPetscLib, dm::PetscDM, nconn::$PetscInt, cnt::moab_EntityHandle ) + isbdvtx_ = Ref{PetscBool}() + + @chk ccall( + (:DMMoabCheckBoundaryVertices, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{moab_EntityHandle}, Ptr{PetscBool}), + dm, nconn, cnt, isbdvtx_, + ) + + isbdvtx = isbdvtx_[] + + return isbdvtx +end + +""" + DMMoabGetBoundaryMarkers(petsclib::PetscLibType,dm::PetscDM, bdvtx::moab_Range, bdelems::moab_Range, bdfaces::moab_Range) + +# External Links +$(_doc_external("DMMoab/DMMoabGetBoundaryMarkers")) +""" +function DMMoabGetBoundaryMarkers(petsclib::PetscLibType, dm::PetscDM, bdvtx::moab_Range, bdelems::moab_Range, bdfaces::moab_Range) end + +@for_petsc function DMMoabGetBoundaryMarkers(petsclib::$UnionPetscLib, dm::PetscDM, bdvtx::moab_Range, bdelems::moab_Range, bdfaces::moab_Range ) + + @chk ccall( + (:DMMoabGetBoundaryMarkers, $petsc_library), + PetscErrorCode, + (CDM, moab_Range, moab_Range, moab_Range), + dm, bdvtx, bdelems, bdfaces, + ) + + + return nothing +end + +""" + coords::PetscReal,overts::moab_Range = DMMoabCreateVertices(petsclib::PetscLibType,dm::PetscDM, nverts::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabCreateVertices")) +""" +function DMMoabCreateVertices(petsclib::PetscLibType, dm::PetscDM, nverts::PetscInt) end + +@for_petsc function DMMoabCreateVertices(petsclib::$UnionPetscLib, dm::PetscDM, nverts::$PetscInt ) + coords_ = Ref{$PetscReal}() + overts_ = Ref{moab_Range}() + + @chk ccall( + (:DMMoabCreateVertices, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}, $PetscInt, Ptr{moab_Range}), + dm, coords_, nverts, overts_, + ) + + coords = coords_[] + overts = overts_[] + + return coords,overts +end + +""" + conn::moab_EntityHandle,oelem::moab_EntityHandle = DMMoabCreateElement(petsclib::PetscLibType,dm::PetscDM, type::moab_EntityType, nverts::PetscInt) + +# External Links +$(_doc_external("DMMoab/DMMoabCreateElement")) +""" +function DMMoabCreateElement(petsclib::PetscLibType, dm::PetscDM, type::moab_EntityType, nverts::PetscInt) end + +@for_petsc function DMMoabCreateElement(petsclib::$UnionPetscLib, dm::PetscDM, type::moab_EntityType, nverts::$PetscInt ) + conn_ = Ref{moab_EntityHandle}() + oelem_ = Ref{moab_EntityHandle}() + + @chk ccall( + (:DMMoabCreateElement, $petsc_library), + PetscErrorCode, + (CDM, moab_EntityType, Ptr{moab_EntityHandle}, $PetscInt, Ptr{moab_EntityHandle}), + dm, type, conn_, nverts, oelem_, + ) + + conn = conn_[] + oelem = oelem_[] + + return conn,oelem +end + +""" + newdm::PetscDM = DMMoabCreateSubmesh(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMMoab/DMMoabCreateSubmesh")) +""" +function DMMoabCreateSubmesh(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMMoabCreateSubmesh(petsclib::$UnionPetscLib, dm::PetscDM ) + newdm_ = Ref{CDM}() + + @chk ccall( + (:DMMoabCreateSubmesh, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, newdm_, + ) + + newdm = PetscDM(newdm_[], petsclib) + + return newdm +end + +""" + dfill::PetscInt,ofill::PetscInt = DMMoabSetBlockFills(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMMoab/DMMoabSetBlockFills")) +""" +function DMMoabSetBlockFills(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMMoabSetBlockFills(petsclib::$UnionPetscLib, dm::PetscDM ) + dfill_ = Ref{$PetscInt}() + ofill_ = Ref{$PetscInt}() + + @chk ccall( + (:DMMoabSetBlockFills, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, dfill_, ofill_, + ) + + dfill = dfill_[] + ofill = ofill_[] + + return dfill,ofill +end + +""" + point::PetscInt = DMPlexGetActivePoint(petsclib::PetscLibType,dm::PetscDM) +Get the point on which projection is currently working + +Not Collective + +Input Parameter: +- `dm` - the `DM` + +Output Parameter: +- `point` - The mesh point involved in the current projection + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetActivePoint()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetActivePoint")) +""" +function DMPlexGetActivePoint(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetActivePoint(petsclib::$UnionPetscLib, dm::PetscDM ) + point_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetActivePoint, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, point_, + ) + + point = point_[] + + return point +end + +""" + DMPlexSetActivePoint(petsclib::PetscLibType,dm::PetscDM, point::PetscInt) +Set the point on which projection is currently working + +Not Collective + +Input Parameters: +- `dm` - the `DM` +- `point` - The mesh point involved in the current projection + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetActivePoint()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetActivePoint")) +""" +function DMPlexSetActivePoint(petsclib::PetscLibType, dm::PetscDM, point::PetscInt) end + +@for_petsc function DMPlexSetActivePoint(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt ) + + @chk ccall( + (:DMPlexSetActivePoint, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, point, + ) + + + return nothing +end + +""" + point::PetscInt = DMGetFirstLabeledPoint(petsclib::PetscLibType,dm::PetscDM, odm::PetscDM, label::DMLabel, numIds::PetscInt, ids::Vector{PetscInt}, height::PetscInt, ds::PetscDS) +Find first labeled `point` in `odm` such that the corresponding point in `dm` has the specified `height`. Return `point` and the corresponding `ds`. + +Input Parameters: +- `dm` - the `DM` +- `odm` - the enclosing `DM` +- `label` - label for `DM` domain, or `NULL` for whole domain +- `numIds` - the number of `ids` +- `ids` - An array of the label ids in sequence for the domain +- `height` - Height of target cells in `DMPLEX` topology + +Output Parameters: +- `point` - the first labeled point +- `ds` - the `PetscDS` corresponding to the first labeled point + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetActivePoint()`, `DMLabel`, `PetscDS` + +# External Links +$(_doc_external("DM/DMGetFirstLabeledPoint")) +""" +function DMGetFirstLabeledPoint(petsclib::PetscLibType, dm::PetscDM, odm::PetscDM, label::DMLabel, numIds::PetscInt, ids::Vector{PetscInt}, height::PetscInt, ds::PetscDS) end + +@for_petsc function DMGetFirstLabeledPoint(petsclib::$UnionPetscLib, dm::PetscDM, odm::PetscDM, label::DMLabel, numIds::$PetscInt, ids::Vector{$PetscInt}, height::$PetscInt, ds::PetscDS ) + point_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetFirstLabeledPoint, $petsc_library), + PetscErrorCode, + (CDM, CDM, DMLabel, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{PetscDS}), + dm, odm, label, numIds, ids, height, point_, ds, + ) + + point = point_[] + + return point +end + +""" + DMPlexSetMigrationSF(petsclib::PetscLibType,dm::PetscDM, migrationSF::PetscSF) +Sets the `PetscSF` for migrating from a parent `DM` into this `DM` + +Logically Collective + +Input Parameters: +- `dm` - The `DM` +- `migrationSF` - The `PetscSF` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscSF`, `DMPlexDistribute()`, `DMPlexDistributeField()`, `DMPlexCreateMigrationSF()`, `DMPlexGetMigrationSF()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetMigrationSF")) +""" +function DMPlexSetMigrationSF(petsclib::PetscLibType, dm::PetscDM, migrationSF::PetscSF) end + +@for_petsc function DMPlexSetMigrationSF(petsclib::$UnionPetscLib, dm::PetscDM, migrationSF::PetscSF ) + + @chk ccall( + (:DMPlexSetMigrationSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF), + dm, migrationSF, + ) + + + return nothing +end + +""" + DMPlexGetMigrationSF(petsclib::PetscLibType,dm::PetscDM, migrationSF::PetscSF) +Gets the `PetscSF` for migrating from a parent `DM` into this `DM` + +Note Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `migrationSF` - The `PetscSF` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscSF`, `DMPlexDistribute()`, `DMPlexDistributeField()`, `DMPlexCreateMigrationSF()`, `DMPlexSetMigrationSF` + +# External Links +$(_doc_external("DMPlex/DMPlexGetMigrationSF")) +""" +function DMPlexGetMigrationSF(petsclib::PetscLibType, dm::PetscDM, migrationSF::PetscSF) end + +@for_petsc function DMPlexGetMigrationSF(petsclib::$UnionPetscLib, dm::PetscDM, migrationSF::PetscSF ) + + @chk ccall( + (:DMPlexGetMigrationSF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSF}), + dm, migrationSF, + ) + + + return nothing +end + +""" + sfNatural::PetscSF = DMPlexCreateGlobalToNaturalSF(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, sfMigration::PetscSF) +Creates the `PetscSF` for mapping Global `Vec` to the Natural `Vec` + +Input Parameters: +- `dm` - The redistributed `DM` +- `section` - The local `PetscSection` describing the `Vec` before the mesh was distributed, or `NULL` if not available +- `sfMigration` - The `PetscSF` used to distribute the mesh, or `NULL` if it cannot be computed + +Output Parameter: +- `sfNatural` - `PetscSF` for mapping the `Vec` in PETSc ordering to the canonical ordering + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscSF`, `PetscSection`, `DMPlexDistribute()`, `DMPlexDistributeField()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateGlobalToNaturalSF")) +""" +function DMPlexCreateGlobalToNaturalSF(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, sfMigration::PetscSF) end + +@for_petsc function DMPlexCreateGlobalToNaturalSF(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, sfMigration::PetscSF ) + sfNatural_ = Ref{PetscSF}() + + @chk ccall( + (:DMPlexCreateGlobalToNaturalSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, PetscSF, Ptr{PetscSF}), + dm, section, sfMigration, sfNatural_, + ) + + sfNatural = sfNatural_[] + + return sfNatural +end + +""" + DMPlexMigrateGlobalToNaturalSF(petsclib::PetscLibType,dmOld::PetscDM, dmNew::PetscDM, sfNaturalOld::PetscSF, sfMigration::PetscSF, sfNaturalNew::PetscSF) +Migrates the input `sfNatural` based on sfMigration + +Input Parameters: +- `dmOld` - The original `DM` +- `dmNew` - The `DM` to be migrated to +- `sfNaturalOld` - The sfNatural for the `dmOld` +- `sfMigration` - The `PetscSF` used to distribute the mesh, or `NULL` if it cannot be computed + +Output Parameter: +- `sfNaturalNew` - `PetscSF` for mapping the `Vec` in PETSc ordering to the canonical ordering + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscSF`, `PetscSection`, `DMPlexDistribute()`, `DMPlexDistributeField()` + +# External Links +$(_doc_external("DMPlex/DMPlexMigrateGlobalToNaturalSF")) +""" +function DMPlexMigrateGlobalToNaturalSF(petsclib::PetscLibType, dmOld::PetscDM, dmNew::PetscDM, sfNaturalOld::PetscSF, sfMigration::PetscSF, sfNaturalNew::PetscSF) end + +@for_petsc function DMPlexMigrateGlobalToNaturalSF(petsclib::$UnionPetscLib, dmOld::PetscDM, dmNew::PetscDM, sfNaturalOld::PetscSF, sfMigration::PetscSF, sfNaturalNew::PetscSF ) + + @chk ccall( + (:DMPlexMigrateGlobalToNaturalSF, $petsc_library), + PetscErrorCode, + (CDM, CDM, PetscSF, PetscSF, Ptr{PetscSF}), + dmOld, dmNew, sfNaturalOld, sfMigration, sfNaturalNew, + ) + + + return nothing +end + +""" + DMPlexGlobalToNaturalBegin(petsclib::PetscLibType,dm::PetscDM, gv::PetscVec, nv::PetscVec) +Rearranges a global `Vec` in the natural order. + +Collective + +Input Parameters: +- `dm` - The distributed `DMPLEX` +- `gv` - The global `Vec` + +Output Parameter: +- `nv` - `Vec` in the canonical ordering distributed over all processors associated with `gv` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `Vec`, `DMPlexDistribute()`, `DMPlexDistributeField()`, `DMPlexNaturalToGlobalBegin()`, `DMPlexGlobalToNaturalEnd()` + +# External Links +$(_doc_external("DMPlex/DMPlexGlobalToNaturalBegin")) +""" +function DMPlexGlobalToNaturalBegin(petsclib::PetscLibType, dm::PetscDM, gv::PetscVec, nv::PetscVec) end + +@for_petsc function DMPlexGlobalToNaturalBegin(petsclib::$UnionPetscLib, dm::PetscDM, gv::PetscVec, nv::PetscVec ) + + @chk ccall( + (:DMPlexGlobalToNaturalBegin, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec), + dm, gv, nv, + ) + + + return nothing +end + +""" + DMPlexGlobalToNaturalEnd(petsclib::PetscLibType,dm::PetscDM, gv::PetscVec, nv::PetscVec) +Rearranges a global `Vec` in the natural order. + +Collective + +Input Parameters: +- `dm` - The distributed `DMPLEX` +- `gv` - The global `Vec` + +Output Parameter: +- `nv` - The natural `Vec` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `Vec`, `DMPlexDistribute()`, `DMPlexDistributeField()`, `DMPlexNaturalToGlobalBegin()`, `DMPlexGlobalToNaturalBegin()` + +# External Links +$(_doc_external("DMPlex/DMPlexGlobalToNaturalEnd")) +""" +function DMPlexGlobalToNaturalEnd(petsclib::PetscLibType, dm::PetscDM, gv::PetscVec, nv::PetscVec) end + +@for_petsc function DMPlexGlobalToNaturalEnd(petsclib::$UnionPetscLib, dm::PetscDM, gv::PetscVec, nv::PetscVec ) + + @chk ccall( + (:DMPlexGlobalToNaturalEnd, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec), + dm, gv, nv, + ) + + + return nothing +end + +""" + DMPlexNaturalToGlobalBegin(petsclib::PetscLibType,dm::PetscDM, nv::PetscVec, gv::PetscVec) +Rearranges a `Vec` in the natural order to the Global order. + +Collective + +Input Parameters: +- `dm` - The distributed `DMPLEX` +- `nv` - The natural `Vec` + +Output Parameter: +- `gv` - The global `Vec` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `Vec`, `DMPlexDistribute()`, `DMPlexDistributeField()`, `DMPlexGlobalToNaturalEnd()` + +# External Links +$(_doc_external("DMPlex/DMPlexNaturalToGlobalBegin")) +""" +function DMPlexNaturalToGlobalBegin(petsclib::PetscLibType, dm::PetscDM, nv::PetscVec, gv::PetscVec) end + +@for_petsc function DMPlexNaturalToGlobalBegin(petsclib::$UnionPetscLib, dm::PetscDM, nv::PetscVec, gv::PetscVec ) + + @chk ccall( + (:DMPlexNaturalToGlobalBegin, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec), + dm, nv, gv, + ) + + + return nothing +end + +""" + DMPlexNaturalToGlobalEnd(petsclib::PetscLibType,dm::PetscDM, nv::PetscVec, gv::PetscVec) +Rearranges a `Vec` in the natural order to the Global order. + +Collective + +Input Parameters: +- `dm` - The distributed `DMPLEX` +- `nv` - The natural `Vec` + +Output Parameter: +- `gv` - The global `Vec` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `Vec`, `DMPlexDistribute()`, `DMPlexDistributeField()`, `DMPlexNaturalToGlobalBegin()`, `DMPlexGlobalToNaturalBegin()` + +# External Links +$(_doc_external("DMPlex/DMPlexNaturalToGlobalEnd")) +""" +function DMPlexNaturalToGlobalEnd(petsclib::PetscLibType, dm::PetscDM, nv::PetscVec, gv::PetscVec) end + +@for_petsc function DMPlexNaturalToGlobalEnd(petsclib::$UnionPetscLib, dm::PetscDM, nv::PetscVec, gv::PetscVec ) + + @chk ccall( + (:DMPlexNaturalToGlobalEnd, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec), + dm, nv, gv, + ) + + + return nothing +end + +""" + nv::PetscVec = DMPlexCreateNaturalVector(petsclib::PetscLibType,dm::PetscDM) +Provide a `Vec` capable of holding the natural ordering and distribution. + +Collective + +Input Parameter: +- `dm` - The distributed `DMPLEX` + +Output Parameter: +- `nv` - The natural `Vec` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `Vec`, `DMPlexDistribute()`, `DMPlexNaturalToGlobalBegin()`, `DMPlexGlobalToNaturalBegin()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateNaturalVector")) +""" +function DMPlexCreateNaturalVector(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexCreateNaturalVector(petsclib::$UnionPetscLib, dm::PetscDM ) + nv_ = Ref{CVec}() + + @chk ccall( + (:DMPlexCreateNaturalVector, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, nv_, + ) + + nv = PetscVec(nv_[], petsclib) + + return nv +end + +""" + processRanks::IS,sfProcess::PetscSF = DMPlexCreateProcessSF(petsclib::PetscLibType,dm::PetscDM, sfPoint::PetscSF) +Create an `PetscSF` which just has process connectivity + +Collective + +Input Parameters: +- `dm` - The `DM` +- `sfPoint` - The `PetscSF` which encodes point connectivity + +Output Parameters: +- `processRanks` - A list of process neighbors, or `NULL` +- `sfProcess` - An `PetscSF` encoding the process connectivity, or `NULL` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscSF`, `PetscSFCreate()`, `DMPlexCreateTwoSidedProcessSF()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateProcessSF")) +""" +function DMPlexCreateProcessSF(petsclib::PetscLibType, dm::PetscDM, sfPoint::PetscSF) end + +@for_petsc function DMPlexCreateProcessSF(petsclib::$UnionPetscLib, dm::PetscDM, sfPoint::PetscSF ) + processRanks_ = Ref{IS}() + sfProcess_ = Ref{PetscSF}() + + @chk ccall( + (:DMPlexCreateProcessSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF, Ptr{CIS}, Ptr{PetscSF}), + dm, sfPoint, processRanks_, sfProcess_, + ) + + processRanks = processRanks_[] + sfProcess = sfProcess_[] + + return processRanks,sfProcess +end + +""" + fpointIS::IS = DMPlexCreateCoarsePointIS(petsclib::PetscLibType,dm::PetscDM) +Creates an `IS` covering the coarse `DM` chart with the fine points as data + +Collective + +Input Parameter: +- `dm` - The coarse `DM` + +Output Parameter: +- `fpointIS` - The `IS` of all the fine points which exist in the original coarse mesh + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `IS`, `DMRefine()`, `DMPlexSetRefinementUniform()`, `DMPlexGetSubpointIS()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateCoarsePointIS")) +""" +function DMPlexCreateCoarsePointIS(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexCreateCoarsePointIS(petsclib::$UnionPetscLib, dm::PetscDM ) + fpointIS_ = Ref{IS}() + + @chk ccall( + (:DMPlexCreateCoarsePointIS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CIS}), + dm, fpointIS_, + ) + + fpointIS = fpointIS_[] + + return fpointIS +end + +""" + DMPlexSetTransformType(petsclib::PetscLibType,dm::PetscDM, type::DMPlexTransformType) +Set the transform type for uniform refinement + +Input Parameters: +- `dm` - The `DM` +- `type` - The transform type for uniform refinement + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransformType`, `DMRefine()`, `DMPlexGetTransformType()`, `DMPlexSetRefinementUniform()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetTransformType")) +""" +function DMPlexSetTransformType(petsclib::PetscLibType, dm::PetscDM, type::DMPlexTransformType) end + +@for_petsc function DMPlexSetTransformType(petsclib::$UnionPetscLib, dm::PetscDM, type::DMPlexTransformType ) + + @chk ccall( + (:DMPlexSetTransformType, $petsc_library), + PetscErrorCode, + (CDM, DMPlexTransformType), + dm, type, + ) + + + return nothing +end + +""" + type::DMPlexTransformType = DMPlexGetTransformType(petsclib::PetscLibType,dm::PetscDM) +Retrieve the transform type for uniform refinement + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `type` - The transform type for uniform refinement + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransformType`, `DMRefine()`, `DMPlexSetTransformType()`, `DMPlexGetRefinementUniform()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetTransformType")) +""" +function DMPlexGetTransformType(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetTransformType(petsclib::$UnionPetscLib, dm::PetscDM ) + type_ = Ref{DMPlexTransformType}() + + @chk ccall( + (:DMPlexGetTransformType, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMPlexTransformType}), + dm, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + DMPlexSetTransform(petsclib::PetscLibType,dm::PetscDM, tr::DMPlexTransform) + +# External Links +$(_doc_external("DMPlex/DMPlexSetTransform")) +""" +function DMPlexSetTransform(petsclib::PetscLibType, dm::PetscDM, tr::DMPlexTransform) end + +@for_petsc function DMPlexSetTransform(petsclib::$UnionPetscLib, dm::PetscDM, tr::DMPlexTransform ) + + @chk ccall( + (:DMPlexSetTransform, $petsc_library), + PetscErrorCode, + (CDM, DMPlexTransform), + dm, tr, + ) + + + return nothing +end + +""" + DMPlexGetTransform(petsclib::PetscLibType,dm::PetscDM, tr::DMPlexTransform) + +# External Links +$(_doc_external("DMPlex/DMPlexGetTransform")) +""" +function DMPlexGetTransform(petsclib::PetscLibType, dm::PetscDM, tr::DMPlexTransform) end + +@for_petsc function DMPlexGetTransform(petsclib::$UnionPetscLib, dm::PetscDM, tr::DMPlexTransform ) + + @chk ccall( + (:DMPlexGetTransform, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMPlexTransform}), + dm, tr, + ) + + + return nothing +end + +""" + DMPlexSetSaveTransform(petsclib::PetscLibType,dm::PetscDM, save::PetscBool) + +# External Links +$(_doc_external("DMPlex/DMPlexSetSaveTransform")) +""" +function DMPlexSetSaveTransform(petsclib::PetscLibType, dm::PetscDM, save::PetscBool) end + +@for_petsc function DMPlexSetSaveTransform(petsclib::$UnionPetscLib, dm::PetscDM, save::PetscBool ) + + @chk ccall( + (:DMPlexSetSaveTransform, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, save, + ) + + + return nothing +end + +""" + save::PetscBool = DMPlexGetSaveTransform(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMPlex/DMPlexGetSaveTransform")) +""" +function DMPlexGetSaveTransform(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetSaveTransform(petsclib::$UnionPetscLib, dm::PetscDM ) + save_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexGetSaveTransform, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, save_, + ) + + save = save_[] + + return save +end + +""" + DMPlexSetRefinementUniform(petsclib::PetscLibType,dm::PetscDM, refinementUniform::PetscBool) +Set the flag for uniform refinement + +Input Parameters: +- `dm` - The `DM` +- `refinementUniform` - The flag for uniform refinement + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMRefine()`, `DMPlexGetRefinementUniform()`, `DMPlexGetRefinementLimit()`, `DMPlexSetRefinementLimit()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetRefinementUniform")) +""" +function DMPlexSetRefinementUniform(petsclib::PetscLibType, dm::PetscDM, refinementUniform::PetscBool) end + +@for_petsc function DMPlexSetRefinementUniform(petsclib::$UnionPetscLib, dm::PetscDM, refinementUniform::PetscBool ) + + @chk ccall( + (:DMPlexSetRefinementUniform, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, refinementUniform, + ) + + + return nothing +end + +""" + refinementUniform::PetscBool = DMPlexGetRefinementUniform(petsclib::PetscLibType,dm::PetscDM) +Retrieve the flag for uniform refinement + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `refinementUniform` - The flag for uniform refinement + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMRefine()`, `DMPlexSetRefinementUniform()`, `DMPlexGetRefinementLimit()`, `DMPlexSetRefinementLimit()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetRefinementUniform")) +""" +function DMPlexGetRefinementUniform(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetRefinementUniform(petsclib::$UnionPetscLib, dm::PetscDM ) + refinementUniform_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexGetRefinementUniform, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, refinementUniform_, + ) + + refinementUniform = refinementUniform_[] + + return refinementUniform +end + +""" + DMPlexSetRefinementLimit(petsclib::PetscLibType,dm::PetscDM, refinementLimit::PetscReal) +Set the maximum cell volume for refinement + +Input Parameters: +- `dm` - The `DM` +- `refinementLimit` - The maximum cell volume in the refined mesh + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMRefine()`, `DMPlexGetRefinementLimit()`, `DMPlexGetRefinementUniform()`, `DMPlexSetRefinementUniform()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetRefinementLimit")) +""" +function DMPlexSetRefinementLimit(petsclib::PetscLibType, dm::PetscDM, refinementLimit::PetscReal) end + +@for_petsc function DMPlexSetRefinementLimit(petsclib::$UnionPetscLib, dm::PetscDM, refinementLimit::$PetscReal ) + + @chk ccall( + (:DMPlexSetRefinementLimit, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, refinementLimit, + ) + + + return nothing +end + +""" + refinementLimit::PetscReal = DMPlexGetRefinementLimit(petsclib::PetscLibType,dm::PetscDM) +Retrieve the maximum cell volume for refinement + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `refinementLimit` - The maximum cell volume in the refined mesh + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMRefine()`, `DMPlexSetRefinementLimit()`, `DMPlexGetRefinementUniform()`, `DMPlexSetRefinementUniform()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetRefinementLimit")) +""" +function DMPlexGetRefinementLimit(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetRefinementLimit(petsclib::$UnionPetscLib, dm::PetscDM ) + refinementLimit_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexGetRefinementLimit, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, refinementLimit_, + ) + + refinementLimit = refinementLimit_[] + + return refinementLimit +end + +""" + DMPlexSetRefinementFunction(petsclib::PetscLibType,dm::PetscDM, refinementFunc::external) +Set the function giving the maximum cell volume for refinement + +Input Parameters: +- `dm` - The `DM` +- `refinementFunc` - Function giving the maximum cell volume in the refined mesh + +Calling Sequence of `refinementFunc`: +- `coords` - Coordinates of the current point, usually a cell centroid +- `limit` - The maximum cell volume for a cell containing this point + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMRefine()`, `DMPlexGetRefinementFunction()`, `DMPlexGetRefinementUniform()`, `DMPlexSetRefinementUniform()`, `DMPlexGetRefinementLimit()`, `DMPlexSetRefinementLimit()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetRefinementFunction")) +""" +function DMPlexSetRefinementFunction(petsclib::PetscLibType, dm::PetscDM, refinementFunc::external) end + +@for_petsc function DMPlexSetRefinementFunction(petsclib::$UnionPetscLib, dm::PetscDM, refinementFunc::external ) + + @chk ccall( + (:DMPlexSetRefinementFunction, $petsc_library), + PetscErrorCode, + (CDM, external), + dm, refinementFunc, + ) + + + return nothing +end + +""" + numVertices::PetscInt,offsets::PetscInt,adjacency::PetscInt,globalNumbering::IS = DMPlexCreatePartitionerGraph(petsclib::PetscLibType,dm::PetscDM, height::PetscInt) +Create a CSR graph of point connections for the partitioner + +Collective + +Input Parameters: +- `dm` - The mesh `DM` +- `height` - Height of the strata from which to construct the graph + +Output Parameters: +- `numVertices` - Number of vertices in the graph +- `offsets` - Point offsets in the graph +- `adjacency` - Point connectivity in the graph +- `globalNumbering` - A map from the local cell numbering to the global numbering used in "adjacency". Negative indicates that the cell is a duplicate from another process. + +Options Database Key: +- `-dm_plex_csr_alg ` - Choose the algorithm for computing the CSR graph + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscPartitionerGetType()`, `PetscPartitionerCreate()`, `DMSetAdjacency()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreatePartitionerGraph")) +""" +function DMPlexCreatePartitionerGraph(petsclib::PetscLibType, dm::PetscDM, height::PetscInt) end + +@for_petsc function DMPlexCreatePartitionerGraph(petsclib::$UnionPetscLib, dm::PetscDM, height::$PetscInt ) + numVertices_ = Ref{$PetscInt}() + offsets_ = Ref{$PetscInt}() + adjacency_ = Ref{$PetscInt}() + globalNumbering_ = Ref{IS}() + + @chk ccall( + (:DMPlexCreatePartitionerGraph, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscInt, Ptr{CIS}), + dm, height, numVertices_, offsets_, adjacency_, globalNumbering_, + ) + + numVertices = numVertices_[] + offsets = offsets_[] + adjacency = adjacency_[] + globalNumbering = globalNumbering_[] + + return numVertices,offsets,adjacency,globalNumbering +end + +""" + numVertices::PetscInt,offsets::PetscInt,adjacency::PetscInt = DMPlexCreateNeighborCSR(petsclib::PetscLibType,dm::PetscDM, cellHeight::PetscInt) +Create a mesh graph (cell + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `cellHeight` - The height of mesh points to treat as cells (default should be 0) + +Output Parameters: +- `numVertices` - The number of local vertices in the graph, or cells in the mesh. +- `offsets` - The offset to the adjacency list for each cell +- `adjacency` - The adjacency list for all cells + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateNeighborCSR")) +""" +function DMPlexCreateNeighborCSR(petsclib::PetscLibType, dm::PetscDM, cellHeight::PetscInt) end + +@for_petsc function DMPlexCreateNeighborCSR(petsclib::$UnionPetscLib, dm::PetscDM, cellHeight::$PetscInt ) + numVertices_ = Ref{$PetscInt}() + offsets_ = Ref{$PetscInt}() + adjacency_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexCreateNeighborCSR, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscInt), + dm, cellHeight, numVertices_, offsets_, adjacency_, + ) + + numVertices = numVertices_[] + offsets = offsets_[] + adjacency = adjacency_[] + + return numVertices,offsets,adjacency +end + +""" + DMPlexGetPartitioner(petsclib::PetscLibType,dm::PetscDM, part::PetscPartitioner) +Get the mesh partitioner + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `part` - The `PetscPartitioner` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscPartitioner`, `PetscSection`, `DMPlexDistribute()`, `DMPlexSetPartitioner()`, `PetscPartitionerDMPlexPartition()`, `PetscPartitionerCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetPartitioner")) +""" +function DMPlexGetPartitioner(petsclib::PetscLibType, dm::PetscDM, part::PetscPartitioner) end + +@for_petsc function DMPlexGetPartitioner(petsclib::$UnionPetscLib, dm::PetscDM, part::PetscPartitioner ) + + @chk ccall( + (:DMPlexGetPartitioner, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscPartitioner}), + dm, part, + ) + + + return nothing +end + +""" + DMPlexSetPartitioner(petsclib::PetscLibType,dm::PetscDM, part::PetscPartitioner) +Set the mesh partitioner + +logically Collective + +Input Parameters: +- `dm` - The `DM` +- `part` - The partitioner + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscPartitioner`,`DMPlexDistribute()`, `DMPlexGetPartitioner()`, `PetscPartitionerCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetPartitioner")) +""" +function DMPlexSetPartitioner(petsclib::PetscLibType, dm::PetscDM, part::PetscPartitioner) end + +@for_petsc function DMPlexSetPartitioner(petsclib::$UnionPetscLib, dm::PetscDM, part::PetscPartitioner ) + + @chk ccall( + (:DMPlexSetPartitioner, $petsc_library), + PetscErrorCode, + (CDM, PetscPartitioner), + dm, part, + ) + + + return nothing +end + +""" + DMPlexPartitionLabelClosure(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) +Add the closure of all points to the partition label + +Input Parameters: +- `dm` - The `DM` +- `label` - `DMLabel` assigning ranks to remote roots + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMLabel`, `DMPlexPartitionLabelCreateSF()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexPartitionLabelClosure")) +""" +function DMPlexPartitionLabelClosure(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMPlexPartitionLabelClosure(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + + @chk ccall( + (:DMPlexPartitionLabelClosure, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, label, + ) + + + return nothing +end + +""" + DMPlexPartitionLabelAdjacency(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) +Add one level of adjacent points to the partition label + +Input Parameters: +- `dm` - The `DM` +- `label` - `DMLabel` assigning ranks to remote roots + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMLabel`, `DMPlexPartitionLabelCreateSF()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexPartitionLabelAdjacency")) +""" +function DMPlexPartitionLabelAdjacency(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMPlexPartitionLabelAdjacency(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + + @chk ccall( + (:DMPlexPartitionLabelAdjacency, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, label, + ) + + + return nothing +end + +""" + DMPlexPartitionLabelPropagate(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) +Propagate points in a partition label over the point `PetscSF` + +Input Parameters: +- `dm` - The `DM` +- `label` - `DMLabel` assigning ranks to remote roots + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMLabel`, `DMPlexPartitionLabelCreateSF()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexPartitionLabelPropagate")) +""" +function DMPlexPartitionLabelPropagate(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMPlexPartitionLabelPropagate(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + + @chk ccall( + (:DMPlexPartitionLabelPropagate, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, label, + ) + + + return nothing +end + +""" + DMPlexPartitionLabelInvert(petsclib::PetscLibType,dm::PetscDM, rootLabel::DMLabel, processSF::PetscSF, leafLabel::DMLabel) +Create a partition label of remote roots from a local root label + +Input Parameters: +- `dm` - The `DM` +- `rootLabel` - `DMLabel` assigning ranks to local roots +- `processSF` - A star forest mapping into the local index on each remote rank + +Output Parameter: +- `leafLabel` - `DMLabel` assigning ranks to remote roots + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexPartitionLabelCreateSF()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexPartitionLabelInvert")) +""" +function DMPlexPartitionLabelInvert(petsclib::PetscLibType, dm::PetscDM, rootLabel::DMLabel, processSF::PetscSF, leafLabel::DMLabel) end + +@for_petsc function DMPlexPartitionLabelInvert(petsclib::$UnionPetscLib, dm::PetscDM, rootLabel::DMLabel, processSF::PetscSF, leafLabel::DMLabel ) + + @chk ccall( + (:DMPlexPartitionLabelInvert, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, PetscSF, DMLabel), + dm, rootLabel, processSF, leafLabel, + ) + + + return nothing +end + +""" + sf::PetscSF = DMPlexPartitionLabelCreateSF(petsclib::PetscLibType,dm::PetscDM, label::DMLabel, sortRanks::PetscBool) +Create a star forest from a label that assigns ranks to points + +Input Parameters: +- `dm` - The `DM` +- `label` - `DMLabel` assigning ranks to remote roots +- `sortRanks` - Whether or not to sort the `PetscSF` leaves by rank + +Output Parameter: +- `sf` - The star forest communication context encapsulating the defined mapping + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMLabel`, `PetscSF`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexPartitionLabelCreateSF")) +""" +function DMPlexPartitionLabelCreateSF(petsclib::PetscLibType, dm::PetscDM, label::DMLabel, sortRanks::PetscBool) end + +@for_petsc function DMPlexPartitionLabelCreateSF(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel, sortRanks::PetscBool ) + sf_ = Ref{PetscSF}() + + @chk ccall( + (:DMPlexPartitionLabelCreateSF, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, PetscBool, Ptr{PetscSF}), + dm, label, sortRanks, sf_, + ) + + sf = sf_[] + + return sf +end + +""" + success::PetscBool = DMPlexRebalanceSharedPoints(petsclib::PetscLibType,dm::PetscDM, entityDepth::PetscInt, useInitialGuess::PetscBool, parallel::PetscBool) +Redistribute points in the plex that are shared in order to achieve better balancing. This routine updates the `PointSF` of the `DM` inplace. + +Input Parameters: +- `dm` - The `DMPLEX` object. +- `entityDepth` - depth of the entity to balance (0 -> balance vertices). +- `useInitialGuess` - whether to use the current distribution as initial guess (only used by ParMETIS). +- `parallel` - whether to use ParMETIS and do the partition in parallel or whether to gather the graph onto a single process and use METIS. + +Output Parameter: +- `success` - whether the graph partitioning was successful or not, optional. Unsuccessful simply means no change to the partitioning + +Options Database Keys: +- `-dm_plex_rebalance_shared_points_parmetis` - Use ParMetis instead of Metis for the partitioner +- `-dm_plex_rebalance_shared_points_use_initial_guess` - Use current partition to bootstrap ParMetis partition +- `-dm_plex_rebalance_shared_points_use_mat_partitioning` - Use the MatPartitioning object to perform the partition, the prefix for those operations is -dm_plex_rebalance_shared_points_ +- `-dm_plex_rebalance_shared_points_monitor` - Monitor the shared points rebalance process + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexRebalanceSharedPoints")) +""" +function DMPlexRebalanceSharedPoints(petsclib::PetscLibType, dm::PetscDM, entityDepth::PetscInt, useInitialGuess::PetscBool, parallel::PetscBool) end + +@for_petsc function DMPlexRebalanceSharedPoints(petsclib::$UnionPetscLib, dm::PetscDM, entityDepth::$PetscInt, useInitialGuess::PetscBool, parallel::PetscBool ) + success_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexRebalanceSharedPoints, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscBool, PetscBool, Ptr{PetscBool}), + dm, entityDepth, useInitialGuess, parallel, success_, + ) + + success = success_[] + + return success +end + +""" + DMPlexInterpolatePointSF(petsclib::PetscLibType,dm::PetscDM, pointSF::PetscSF) +Insert interpolated points in the overlap into the `PointSF` in parallel, following local interpolation + +Collective + +Input Parameters: +- `dm` - The interpolated `DMPLEX` +- `pointSF` - The initial `PetscSF` without interpolated points + +Level: developer + +-seealso: `DMPLEX`, `DMPlexInterpolate()`, `DMPlexUninterpolate()` + +# External Links +$(_doc_external("DMPlex/DMPlexInterpolatePointSF")) +""" +function DMPlexInterpolatePointSF(petsclib::PetscLibType, dm::PetscDM, pointSF::PetscSF) end + +@for_petsc function DMPlexInterpolatePointSF(petsclib::$UnionPetscLib, dm::PetscDM, pointSF::PetscSF ) + + @chk ccall( + (:DMPlexInterpolatePointSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF), + dm, pointSF, + ) + + + return nothing +end + +""" + DMPlexInterpolate(petsclib::PetscLibType,dm::PetscDM, dmInt::PetscDM) +Take in a cell + +Collective + +Input Parameter: +- `dm` - The `DMPLEX` object with only cells and vertices + +Output Parameter: +- `dmInt` - The complete `DMPLEX` object + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexUninterpolate()`, `DMPlexCreateFromCellListPetsc()`, `DMPlexCopyCoordinates()` + +# External Links +$(_doc_external("DMPlex/DMPlexInterpolate")) +""" +function DMPlexInterpolate(petsclib::PetscLibType, dm::PetscDM, dmInt::PetscDM) end + +@for_petsc function DMPlexInterpolate(petsclib::$UnionPetscLib, dm::PetscDM, dmInt::PetscDM ) + dmInt_ = Ref(dmInt.ptr) + + @chk ccall( + (:DMPlexInterpolate, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, dmInt_, + ) + + dmInt.ptr = dmInt_[] + + return nothing +end + +""" + DMPlexCopyCoordinates(petsclib::PetscLibType,dmA::PetscDM, dmB::PetscDM) +Copy coordinates from one mesh to another with the same vertices + +Collective + +Input Parameter: +- `dmA` - The `DMPLEX` object with initial coordinates + +Output Parameter: +- `dmB` - The `DMPLEX` object with copied coordinates + +Level: intermediate + +-seealso: `DMPLEX`, `DMCopyLabels()`, `DMGetCoordinates()`, `DMGetCoordinatesLocal()`, `DMGetCoordinateDM()`, `DMGetCoordinateSection()` + +# External Links +$(_doc_external("DMPlex/DMPlexCopyCoordinates")) +""" +function DMPlexCopyCoordinates(petsclib::PetscLibType, dmA::PetscDM, dmB::PetscDM) end + +@for_petsc function DMPlexCopyCoordinates(petsclib::$UnionPetscLib, dmA::PetscDM, dmB::PetscDM ) + + @chk ccall( + (:DMPlexCopyCoordinates, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dmA, dmB, + ) + + + return nothing +end + +""" + DMPlexUninterpolate(petsclib::PetscLibType,dm::PetscDM, dmUnint::PetscDM) +Take in a mesh with all intermediate faces, edges, etc. and return a cell + +Collective + +Input Parameter: +- `dm` - The complete `DMPLEX` object + +Output Parameter: +- `dmUnint` - The `DMPLEX` object with only cells and vertices + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexInterpolate()`, `DMPlexCreateFromCellListPetsc()`, `DMPlexCopyCoordinates()` + +# External Links +$(_doc_external("DMPlex/DMPlexUninterpolate")) +""" +function DMPlexUninterpolate(petsclib::PetscLibType, dm::PetscDM, dmUnint::PetscDM) end + +@for_petsc function DMPlexUninterpolate(petsclib::$UnionPetscLib, dm::PetscDM, dmUnint::PetscDM ) + dmUnint_ = Ref(dmUnint.ptr) + + @chk ccall( + (:DMPlexUninterpolate, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, dmUnint_, + ) + + dmUnint.ptr = dmUnint_[] + + return nothing +end + +""" + DMPlexIsInterpolated(petsclib::PetscLibType,dm::PetscDM, interpolated::DMPlexInterpolatedFlag) +Find out to what extent the `DMPLEX` is topologically interpolated. + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `interpolated` - Flag whether the `DM` is interpolated + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexInterpolate()`, `DMPlexIsInterpolatedCollective()` + +# External Links +$(_doc_external("DMPlex/DMPlexIsInterpolated")) +""" +function DMPlexIsInterpolated(petsclib::PetscLibType, dm::PetscDM, interpolated::DMPlexInterpolatedFlag) end + +@for_petsc function DMPlexIsInterpolated(petsclib::$UnionPetscLib, dm::PetscDM, interpolated::DMPlexInterpolatedFlag ) + + @chk ccall( + (:DMPlexIsInterpolated, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMPlexInterpolatedFlag}), + dm, interpolated, + ) + + + return nothing +end + +""" + DMPlexIsInterpolatedCollective(petsclib::PetscLibType,dm::PetscDM, interpolated::DMPlexInterpolatedFlag) +Find out to what extent the `DMPLEX` is topologically interpolated (in collective manner). + +Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `interpolated` - Flag whether the `DM` is interpolated + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexInterpolate()`, `DMPlexIsInterpolated()` + +# External Links +$(_doc_external("DMPlex/DMPlexIsInterpolatedCollective")) +""" +function DMPlexIsInterpolatedCollective(petsclib::PetscLibType, dm::PetscDM, interpolated::DMPlexInterpolatedFlag) end + +@for_petsc function DMPlexIsInterpolatedCollective(petsclib::$UnionPetscLib, dm::PetscDM, interpolated::DMPlexInterpolatedFlag ) + + @chk ccall( + (:DMPlexIsInterpolatedCollective, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMPlexInterpolatedFlag}), + dm, interpolated, + ) + + + return nothing +end + +""" + preferTensor::PetscBool = DMPlexGetInterpolatePreferTensor(petsclib::PetscLibType,dm::PetscDM) +Get the flag to prefer tensor order when interpolating a cell + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `preferTensor` - Flag to prefer tensor order + +Level: intermediate + +-seealso: `DMPlexSetInterpolatePreferTensor()`, `DMPLEX`, `DMPlexInterpolate()`, `DMPlexIsInterpolatedCollective()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetInterpolatePreferTensor")) +""" +function DMPlexGetInterpolatePreferTensor(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetInterpolatePreferTensor(petsclib::$UnionPetscLib, dm::PetscDM ) + preferTensor_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexGetInterpolatePreferTensor, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, preferTensor_, + ) + + preferTensor = preferTensor_[] + + return preferTensor +end + +""" + DMPlexSetInterpolatePreferTensor(petsclib::PetscLibType,dm::PetscDM, preferTensor::PetscBool) +Set the flag to prefer tensor order when interpolating a cell + +Logically Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `preferTensor` - Flag to prefer tensor order + +Level: intermediate + +-seealso: `DMPlexGetInterpolatePreferTensor()`, `DMPLEX`, `DMPlexInterpolate()`, `DMPlexIsInterpolatedCollective()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetInterpolatePreferTensor")) +""" +function DMPlexSetInterpolatePreferTensor(petsclib::PetscLibType, dm::PetscDM, preferTensor::PetscBool) end + +@for_petsc function DMPlexSetInterpolatePreferTensor(petsclib::$UnionPetscLib, dm::PetscDM, preferTensor::PetscBool ) + + @chk ccall( + (:DMPlexSetInterpolatePreferTensor, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, preferTensor, + ) + + + return nothing +end + +""" + DMPlexMetricSetFromOptions(petsclib::PetscLibType,dm::PetscDM) + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetFromOptions")) +""" +function DMPlexMetricSetFromOptions(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricSetFromOptions(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexMetricSetFromOptions, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexMetricSetIsotropic(petsclib::PetscLibType,dm::PetscDM, isotropic::PetscBool) +Record whether a metric is isotropic + +Input Parameters: +- `dm` - The `DM` +- `isotropic` - Is the metric isotropic? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricIsIsotropic()`, `DMPlexMetricSetUniform()`, `DMPlexMetricSetRestrictAnisotropyFirst()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetIsotropic")) +""" +function DMPlexMetricSetIsotropic(petsclib::PetscLibType, dm::PetscDM, isotropic::PetscBool) end + +@for_petsc function DMPlexMetricSetIsotropic(petsclib::$UnionPetscLib, dm::PetscDM, isotropic::PetscBool ) + + @chk ccall( + (:DMPlexMetricSetIsotropic, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, isotropic, + ) + + + return nothing +end + +""" + isotropic::PetscBool = DMPlexMetricIsIsotropic(petsclib::PetscLibType,dm::PetscDM) +Is a metric isotropic? + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `isotropic` - Is the metric isotropic? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetIsotropic()`, `DMPlexMetricIsUniform()`, `DMPlexMetricRestrictAnisotropyFirst()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricIsIsotropic")) +""" +function DMPlexMetricIsIsotropic(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricIsIsotropic(petsclib::$UnionPetscLib, dm::PetscDM ) + isotropic_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexMetricIsIsotropic, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, isotropic_, + ) + + isotropic = isotropic_[] + + return isotropic +end + +""" + DMPlexMetricSetUniform(petsclib::PetscLibType,dm::PetscDM, uniform::PetscBool) +Record whether a metric is uniform + +Input Parameters: +- `dm` - The `DM` +- `uniform` - Is the metric uniform? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricIsUniform()`, `DMPlexMetricSetIsotropic()`, `DMPlexMetricSetRestrictAnisotropyFirst()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetUniform")) +""" +function DMPlexMetricSetUniform(petsclib::PetscLibType, dm::PetscDM, uniform::PetscBool) end + +@for_petsc function DMPlexMetricSetUniform(petsclib::$UnionPetscLib, dm::PetscDM, uniform::PetscBool ) + + @chk ccall( + (:DMPlexMetricSetUniform, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, uniform, + ) + + + return nothing +end + +""" + uniform::PetscBool = DMPlexMetricIsUniform(petsclib::PetscLibType,dm::PetscDM) +Is a metric uniform? + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `uniform` - Is the metric uniform? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetUniform()`, `DMPlexMetricIsIsotropic()`, `DMPlexMetricRestrictAnisotropyFirst()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricIsUniform")) +""" +function DMPlexMetricIsUniform(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricIsUniform(petsclib::$UnionPetscLib, dm::PetscDM ) + uniform_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexMetricIsUniform, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, uniform_, + ) + + uniform = uniform_[] + + return uniform +end + +""" + DMPlexMetricSetRestrictAnisotropyFirst(petsclib::PetscLibType,dm::PetscDM, restrictAnisotropyFirst::PetscBool) +Record whether anisotropy should be restricted before normalization + +Input Parameters: +- `dm` - The `DM` +- `restrictAnisotropyFirst` - Should anisotropy be normalized first? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetIsotropic()`, `DMPlexMetricRestrictAnisotropyFirst()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetRestrictAnisotropyFirst")) +""" +function DMPlexMetricSetRestrictAnisotropyFirst(petsclib::PetscLibType, dm::PetscDM, restrictAnisotropyFirst::PetscBool) end + +@for_petsc function DMPlexMetricSetRestrictAnisotropyFirst(petsclib::$UnionPetscLib, dm::PetscDM, restrictAnisotropyFirst::PetscBool ) + + @chk ccall( + (:DMPlexMetricSetRestrictAnisotropyFirst, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, restrictAnisotropyFirst, + ) + + + return nothing +end + +""" + restrictAnisotropyFirst::PetscBool = DMPlexMetricRestrictAnisotropyFirst(petsclib::PetscLibType,dm::PetscDM) +Is anisotropy restricted before normalization or after? + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `restrictAnisotropyFirst` - Is anisotropy be normalized first? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricIsIsotropic()`, `DMPlexMetricSetRestrictAnisotropyFirst()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricRestrictAnisotropyFirst")) +""" +function DMPlexMetricRestrictAnisotropyFirst(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricRestrictAnisotropyFirst(petsclib::$UnionPetscLib, dm::PetscDM ) + restrictAnisotropyFirst_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexMetricRestrictAnisotropyFirst, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, restrictAnisotropyFirst_, + ) + + restrictAnisotropyFirst = restrictAnisotropyFirst_[] + + return restrictAnisotropyFirst +end + +""" + DMPlexMetricSetNoInsertion(petsclib::PetscLibType,dm::PetscDM, noInsert::PetscBool) +Should node insertion and deletion be turned off? + +Input Parameters: +- `dm` - The `DM` +- `noInsert` - Should node insertion and deletion be turned off? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricNoInsertion()`, `DMPlexMetricSetNoSwapping()`, `DMPlexMetricSetNoMovement()`, `DMPlexMetricSetNoSurf()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetNoInsertion")) +""" +function DMPlexMetricSetNoInsertion(petsclib::PetscLibType, dm::PetscDM, noInsert::PetscBool) end + +@for_petsc function DMPlexMetricSetNoInsertion(petsclib::$UnionPetscLib, dm::PetscDM, noInsert::PetscBool ) + + @chk ccall( + (:DMPlexMetricSetNoInsertion, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, noInsert, + ) + + + return nothing +end + +""" + noInsert::PetscBool = DMPlexMetricNoInsertion(petsclib::PetscLibType,dm::PetscDM) +Are node insertion and deletion turned off? + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `noInsert` - Are node insertion and deletion turned off? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetNoInsertion()`, `DMPlexMetricNoSwapping()`, `DMPlexMetricNoMovement()`, `DMPlexMetricNoSurf()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricNoInsertion")) +""" +function DMPlexMetricNoInsertion(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricNoInsertion(petsclib::$UnionPetscLib, dm::PetscDM ) + noInsert_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexMetricNoInsertion, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, noInsert_, + ) + + noInsert = noInsert_[] + + return noInsert +end + +""" + DMPlexMetricSetNoSwapping(petsclib::PetscLibType,dm::PetscDM, noSwap::PetscBool) +Should facet swapping be turned off? + +Input Parameters: +- `dm` - The `DM` +- `noSwap` - Should facet swapping be turned off? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricNoSwapping()`, `DMPlexMetricSetNoInsertion()`, `DMPlexMetricSetNoMovement()`, `DMPlexMetricSetNoSurf()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetNoSwapping")) +""" +function DMPlexMetricSetNoSwapping(petsclib::PetscLibType, dm::PetscDM, noSwap::PetscBool) end + +@for_petsc function DMPlexMetricSetNoSwapping(petsclib::$UnionPetscLib, dm::PetscDM, noSwap::PetscBool ) + + @chk ccall( + (:DMPlexMetricSetNoSwapping, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, noSwap, + ) + + + return nothing +end + +""" + noSwap::PetscBool = DMPlexMetricNoSwapping(petsclib::PetscLibType,dm::PetscDM) +Is facet swapping turned off? + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `noSwap` - Is facet swapping turned off? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetNoSwapping()`, `DMPlexMetricNoInsertion()`, `DMPlexMetricNoMovement()`, `DMPlexMetricNoSurf()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricNoSwapping")) +""" +function DMPlexMetricNoSwapping(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricNoSwapping(petsclib::$UnionPetscLib, dm::PetscDM ) + noSwap_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexMetricNoSwapping, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, noSwap_, + ) + + noSwap = noSwap_[] + + return noSwap +end + +""" + DMPlexMetricSetNoMovement(petsclib::PetscLibType,dm::PetscDM, noMove::PetscBool) +Should node movement be turned off? + +Input Parameters: +- `dm` - The `DM` +- `noMove` - Should node movement be turned off? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricNoMovement()`, `DMPlexMetricSetNoInsertion()`, `DMPlexMetricSetNoSwapping()`, `DMPlexMetricSetNoSurf()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetNoMovement")) +""" +function DMPlexMetricSetNoMovement(petsclib::PetscLibType, dm::PetscDM, noMove::PetscBool) end + +@for_petsc function DMPlexMetricSetNoMovement(petsclib::$UnionPetscLib, dm::PetscDM, noMove::PetscBool ) + + @chk ccall( + (:DMPlexMetricSetNoMovement, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, noMove, + ) + + + return nothing +end + +""" + noMove::PetscBool = DMPlexMetricNoMovement(petsclib::PetscLibType,dm::PetscDM) +Is node movement turned off? + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `noMove` - Is node movement turned off? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetNoMovement()`, `DMPlexMetricNoInsertion()`, `DMPlexMetricNoSwapping()`, `DMPlexMetricNoSurf()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricNoMovement")) +""" +function DMPlexMetricNoMovement(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricNoMovement(petsclib::$UnionPetscLib, dm::PetscDM ) + noMove_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexMetricNoMovement, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, noMove_, + ) + + noMove = noMove_[] + + return noMove +end + +""" + DMPlexMetricSetNoSurf(petsclib::PetscLibType,dm::PetscDM, noSurf::PetscBool) +Should surface modification be turned off? + +Input Parameters: +- `dm` - The `DM` +- `noSurf` - Should surface modification be turned off? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricNoSurf()`, `DMPlexMetricSetNoMovement()`, `DMPlexMetricSetNoInsertion()`, `DMPlexMetricSetNoSwapping()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetNoSurf")) +""" +function DMPlexMetricSetNoSurf(petsclib::PetscLibType, dm::PetscDM, noSurf::PetscBool) end + +@for_petsc function DMPlexMetricSetNoSurf(petsclib::$UnionPetscLib, dm::PetscDM, noSurf::PetscBool ) + + @chk ccall( + (:DMPlexMetricSetNoSurf, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, noSurf, + ) + + + return nothing +end + +""" + noSurf::PetscBool = DMPlexMetricNoSurf(petsclib::PetscLibType,dm::PetscDM) +Is surface modification turned off? + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `noSurf` - Is surface modification turned off? + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetNoSurf()`, `DMPlexMetricNoMovement()`, `DMPlexMetricNoInsertion()`, `DMPlexMetricNoSwapping()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricNoSurf")) +""" +function DMPlexMetricNoSurf(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricNoSurf(petsclib::$UnionPetscLib, dm::PetscDM ) + noSurf_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexMetricNoSurf, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, noSurf_, + ) + + noSurf = noSurf_[] + + return noSurf +end + +""" + DMPlexMetricSetMinimumMagnitude(petsclib::PetscLibType,dm::PetscDM, h_min::PetscReal) +Set the minimum tolerated metric magnitude + +Input Parameters: +- `dm` - The `DM` +- `h_min` - The minimum tolerated metric magnitude + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricGetMinimumMagnitude()`, `DMPlexMetricSetMaximumMagnitude()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetMinimumMagnitude")) +""" +function DMPlexMetricSetMinimumMagnitude(petsclib::PetscLibType, dm::PetscDM, h_min::PetscReal) end + +@for_petsc function DMPlexMetricSetMinimumMagnitude(petsclib::$UnionPetscLib, dm::PetscDM, h_min::$PetscReal ) + + @chk ccall( + (:DMPlexMetricSetMinimumMagnitude, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, h_min, + ) + + + return nothing +end + +""" + h_min::PetscReal = DMPlexMetricGetMinimumMagnitude(petsclib::PetscLibType,dm::PetscDM) +Get the minimum tolerated metric magnitude + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `h_min` - The minimum tolerated metric magnitude + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetMinimumMagnitude()`, `DMPlexMetricGetMaximumMagnitude()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricGetMinimumMagnitude")) +""" +function DMPlexMetricGetMinimumMagnitude(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricGetMinimumMagnitude(petsclib::$UnionPetscLib, dm::PetscDM ) + h_min_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexMetricGetMinimumMagnitude, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, h_min_, + ) + + h_min = h_min_[] + + return h_min +end + +""" + DMPlexMetricSetMaximumMagnitude(petsclib::PetscLibType,dm::PetscDM, h_max::PetscReal) +Set the maximum tolerated metric magnitude + +Input Parameters: +- `dm` - The `DM` +- `h_max` - The maximum tolerated metric magnitude + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricGetMaximumMagnitude()`, `DMPlexMetricSetMinimumMagnitude()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetMaximumMagnitude")) +""" +function DMPlexMetricSetMaximumMagnitude(petsclib::PetscLibType, dm::PetscDM, h_max::PetscReal) end + +@for_petsc function DMPlexMetricSetMaximumMagnitude(petsclib::$UnionPetscLib, dm::PetscDM, h_max::$PetscReal ) + + @chk ccall( + (:DMPlexMetricSetMaximumMagnitude, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, h_max, + ) + + + return nothing +end + +""" + h_max::PetscReal = DMPlexMetricGetMaximumMagnitude(petsclib::PetscLibType,dm::PetscDM) +Get the maximum tolerated metric magnitude + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `h_max` - The maximum tolerated metric magnitude + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetMaximumMagnitude()`, `DMPlexMetricGetMinimumMagnitude()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricGetMaximumMagnitude")) +""" +function DMPlexMetricGetMaximumMagnitude(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricGetMaximumMagnitude(petsclib::$UnionPetscLib, dm::PetscDM ) + h_max_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexMetricGetMaximumMagnitude, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, h_max_, + ) + + h_max = h_max_[] + + return h_max +end + +""" + DMPlexMetricSetMaximumAnisotropy(petsclib::PetscLibType,dm::PetscDM, a_max::PetscReal) +Set the maximum tolerated metric anisotropy + +Input Parameters: +- `dm` - The `DM` +- `a_max` - The maximum tolerated metric anisotropy + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricGetMaximumAnisotropy()`, `DMPlexMetricSetMaximumMagnitude()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetMaximumAnisotropy")) +""" +function DMPlexMetricSetMaximumAnisotropy(petsclib::PetscLibType, dm::PetscDM, a_max::PetscReal) end + +@for_petsc function DMPlexMetricSetMaximumAnisotropy(petsclib::$UnionPetscLib, dm::PetscDM, a_max::$PetscReal ) + + @chk ccall( + (:DMPlexMetricSetMaximumAnisotropy, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, a_max, + ) + + + return nothing +end + +""" + a_max::PetscReal = DMPlexMetricGetMaximumAnisotropy(petsclib::PetscLibType,dm::PetscDM) +Get the maximum tolerated metric anisotropy + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `a_max` - The maximum tolerated metric anisotropy + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetMaximumAnisotropy()`, `DMPlexMetricGetMaximumMagnitude()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricGetMaximumAnisotropy")) +""" +function DMPlexMetricGetMaximumAnisotropy(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricGetMaximumAnisotropy(petsclib::$UnionPetscLib, dm::PetscDM ) + a_max_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexMetricGetMaximumAnisotropy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, a_max_, + ) + + a_max = a_max_[] + + return a_max +end + +""" + DMPlexMetricSetTargetComplexity(petsclib::PetscLibType,dm::PetscDM, targetComplexity::PetscReal) +Set the target metric complexity + +Input Parameters: +- `dm` - The `DM` +- `targetComplexity` - The target metric complexity + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricGetTargetComplexity()`, `DMPlexMetricSetNormalizationOrder()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetTargetComplexity")) +""" +function DMPlexMetricSetTargetComplexity(petsclib::PetscLibType, dm::PetscDM, targetComplexity::PetscReal) end + +@for_petsc function DMPlexMetricSetTargetComplexity(petsclib::$UnionPetscLib, dm::PetscDM, targetComplexity::$PetscReal ) + + @chk ccall( + (:DMPlexMetricSetTargetComplexity, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, targetComplexity, + ) + + + return nothing +end + +""" + targetComplexity::PetscReal = DMPlexMetricGetTargetComplexity(petsclib::PetscLibType,dm::PetscDM) +Get the target metric complexity + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `targetComplexity` - The target metric complexity + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetTargetComplexity()`, `DMPlexMetricGetNormalizationOrder()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricGetTargetComplexity")) +""" +function DMPlexMetricGetTargetComplexity(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricGetTargetComplexity(petsclib::$UnionPetscLib, dm::PetscDM ) + targetComplexity_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexMetricGetTargetComplexity, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, targetComplexity_, + ) + + targetComplexity = targetComplexity_[] + + return targetComplexity +end + +""" + DMPlexMetricSetNormalizationOrder(petsclib::PetscLibType,dm::PetscDM, p::PetscReal) +Set the order p for L + +Input Parameters: +- `dm` - The `DM` +- `p` - The normalization order + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricGetNormalizationOrder()`, `DMPlexMetricSetTargetComplexity()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetNormalizationOrder")) +""" +function DMPlexMetricSetNormalizationOrder(petsclib::PetscLibType, dm::PetscDM, p::PetscReal) end + +@for_petsc function DMPlexMetricSetNormalizationOrder(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscReal ) + + @chk ccall( + (:DMPlexMetricSetNormalizationOrder, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, p, + ) + + + return nothing +end + +""" + p::PetscReal = DMPlexMetricGetNormalizationOrder(petsclib::PetscLibType,dm::PetscDM) +Get the order p for L + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `p` - The normalization order + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetNormalizationOrder()`, `DMPlexMetricGetTargetComplexity()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricGetNormalizationOrder")) +""" +function DMPlexMetricGetNormalizationOrder(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricGetNormalizationOrder(petsclib::$UnionPetscLib, dm::PetscDM ) + p_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexMetricGetNormalizationOrder, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, p_, + ) + + p = p_[] + + return p +end + +""" + DMPlexMetricSetGradationFactor(petsclib::PetscLibType,dm::PetscDM, beta::PetscReal) +Set the metric gradation factor + +Input Parameters: +- `dm` - The `DM` +- `beta` - The metric gradation factor + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricGetGradationFactor()`, `DMPlexMetricSetHausdorffNumber()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetGradationFactor")) +""" +function DMPlexMetricSetGradationFactor(petsclib::PetscLibType, dm::PetscDM, beta::PetscReal) end + +@for_petsc function DMPlexMetricSetGradationFactor(petsclib::$UnionPetscLib, dm::PetscDM, beta::$PetscReal ) + + @chk ccall( + (:DMPlexMetricSetGradationFactor, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, beta, + ) + + + return nothing +end + +""" + beta::PetscReal = DMPlexMetricGetGradationFactor(petsclib::PetscLibType,dm::PetscDM) +Get the metric gradation factor + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `beta` - The metric gradation factor + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetGradationFactor()`, `DMPlexMetricGetHausdorffNumber()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricGetGradationFactor")) +""" +function DMPlexMetricGetGradationFactor(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricGetGradationFactor(petsclib::$UnionPetscLib, dm::PetscDM ) + beta_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexMetricGetGradationFactor, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, beta_, + ) + + beta = beta_[] + + return beta +end + +""" + DMPlexMetricSetHausdorffNumber(petsclib::PetscLibType,dm::PetscDM, hausd::PetscReal) +Set the metric Hausdorff number + +Input Parameters: +- `dm` - The `DM` +- `hausd` - The metric Hausdorff number + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetGradationFactor()`, `DMPlexMetricGetHausdorffNumber()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetHausdorffNumber")) +""" +function DMPlexMetricSetHausdorffNumber(petsclib::PetscLibType, dm::PetscDM, hausd::PetscReal) end + +@for_petsc function DMPlexMetricSetHausdorffNumber(petsclib::$UnionPetscLib, dm::PetscDM, hausd::$PetscReal ) + + @chk ccall( + (:DMPlexMetricSetHausdorffNumber, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, hausd, + ) + + + return nothing +end + +""" + hausd::PetscReal = DMPlexMetricGetHausdorffNumber(petsclib::PetscLibType,dm::PetscDM) +Get the metric Hausdorff number + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `hausd` - The metric Hausdorff number + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricGetGradationFactor()`, `DMPlexMetricSetHausdorffNumber()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricGetHausdorffNumber")) +""" +function DMPlexMetricGetHausdorffNumber(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricGetHausdorffNumber(petsclib::$UnionPetscLib, dm::PetscDM ) + hausd_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexMetricGetHausdorffNumber, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, hausd_, + ) + + hausd = hausd_[] + + return hausd +end + +""" + DMPlexMetricSetVerbosity(petsclib::PetscLibType,dm::PetscDM, verbosity::PetscInt) +Set the verbosity of the mesh adaptation package + +Input Parameters: +- `dm` - The `DM` +- `verbosity` - The verbosity, where -1 is silent and 10 is maximum + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricGetVerbosity()`, `DMPlexMetricSetNumIterations()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetVerbosity")) +""" +function DMPlexMetricSetVerbosity(petsclib::PetscLibType, dm::PetscDM, verbosity::PetscInt) end + +@for_petsc function DMPlexMetricSetVerbosity(petsclib::$UnionPetscLib, dm::PetscDM, verbosity::$PetscInt ) + + @chk ccall( + (:DMPlexMetricSetVerbosity, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, verbosity, + ) + + + return nothing +end + +""" + verbosity::PetscInt = DMPlexMetricGetVerbosity(petsclib::PetscLibType,dm::PetscDM) +Get the verbosity of the mesh adaptation package + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `verbosity` - The verbosity, where -1 is silent and 10 is maximum + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetVerbosity()`, `DMPlexMetricGetNumIterations()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricGetVerbosity")) +""" +function DMPlexMetricGetVerbosity(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricGetVerbosity(petsclib::$UnionPetscLib, dm::PetscDM ) + verbosity_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexMetricGetVerbosity, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, verbosity_, + ) + + verbosity = verbosity_[] + + return verbosity +end + +""" + DMPlexMetricSetNumIterations(petsclib::PetscLibType,dm::PetscDM, numIter::PetscInt) +Set the number of parallel adaptation iterations + +Input Parameters: +- `dm` - The `DM` +- `numIter` - the number of parallel adaptation iterations + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetVerbosity()`, `DMPlexMetricGetNumIterations()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricSetNumIterations")) +""" +function DMPlexMetricSetNumIterations(petsclib::PetscLibType, dm::PetscDM, numIter::PetscInt) end + +@for_petsc function DMPlexMetricSetNumIterations(petsclib::$UnionPetscLib, dm::PetscDM, numIter::$PetscInt ) + + @chk ccall( + (:DMPlexMetricSetNumIterations, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, numIter, + ) + + + return nothing +end + +""" + numIter::PetscInt = DMPlexMetricGetNumIterations(petsclib::PetscLibType,dm::PetscDM) +Get the number of parallel adaptation iterations + +Input Parameters: +- `dm` - The `DM` + +Output Parameters: +- `numIter` - the number of parallel adaptation iterations + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricSetNumIterations()`, `DMPlexMetricGetVerbosity()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricGetNumIterations")) +""" +function DMPlexMetricGetNumIterations(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexMetricGetNumIterations(petsclib::$UnionPetscLib, dm::PetscDM ) + numIter_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexMetricGetNumIterations, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, numIter_, + ) + + numIter = numIter_[] + + return numIter +end + +""" + metric::PetscVec = DMPlexMetricCreate(petsclib::PetscLibType,dm::PetscDM, f::PetscInt) +Create a Riemannian metric field + +Input Parameters: +- `dm` - The `DM` +- `f` - The field number to use + +Output Parameter: +- `metric` - The metric + +Options Database Key: +- `-dm_adaptor ` - specify dm adaptor to use + +Options Database Keys for Mmg and ParMmg: +- `-dm_plex_metric_gradation_factor` - Maximum ratio by which edge lengths may grow during gradation +- `-dm_plex_metric_num_iterations` - Number of parallel mesh adaptation iterations for ParMmg +- `-dm_plex_metric_no_insert` - Should node insertion/deletion be turned off? +- `-dm_plex_metric_no_swap` - Should facet swapping be turned off? +- `-dm_plex_metric_no_move` - Should node movement be turned off? +- `-dm_plex_metric_verbosity` - Choose a verbosity level from -1 (silent) to 10 (maximum). + +Options Database Keys for Riemannian metrics: +- `-dm_plex_metric_isotropic` - Is the metric isotropic? +- `-dm_plex_metric_uniform` - Is the metric uniform? +- `-dm_plex_metric_restrict_anisotropy_first` - Should anisotropy be restricted before normalization? +- `-dm_plex_metric_h_min` - Minimum tolerated metric magnitude +- `-dm_plex_metric_h_max` - Maximum tolerated metric magnitude +- `-dm_plex_metric_a_max` - Maximum tolerated anisotropy +- `-dm_plex_metric_p` - L-p normalization order +- `-dm_plex_metric_target_complexity` - Target metric complexity + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricCreateUniform()`, `DMPlexMetricCreateIsotropic()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricCreate")) +""" +function DMPlexMetricCreate(petsclib::PetscLibType, dm::PetscDM, f::PetscInt) end + +@for_petsc function DMPlexMetricCreate(petsclib::$UnionPetscLib, dm::PetscDM, f::$PetscInt ) + metric_ = Ref{CVec}() + + @chk ccall( + (:DMPlexMetricCreate, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CVec}), + dm, f, metric_, + ) + + metric = PetscVec(metric_[], petsclib) + + return metric +end + +""" + metric::PetscVec = DMPlexMetricCreateUniform(petsclib::PetscLibType,dm::PetscDM, f::PetscInt, alpha::PetscReal) +Construct a uniform isotropic metric + +Input Parameters: +- `dm` - The `DM` +- `f` - The field number to use +- `alpha` - Scaling parameter for the diagonal + +Output Parameter: +- `metric` - The uniform metric + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricCreate()`, `DMPlexMetricCreateIsotropic()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricCreateUniform")) +""" +function DMPlexMetricCreateUniform(petsclib::PetscLibType, dm::PetscDM, f::PetscInt, alpha::PetscReal) end + +@for_petsc function DMPlexMetricCreateUniform(petsclib::$UnionPetscLib, dm::PetscDM, f::$PetscInt, alpha::$PetscReal ) + metric_ = Ref{CVec}() + + @chk ccall( + (:DMPlexMetricCreateUniform, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscReal, Ptr{CVec}), + dm, f, alpha, metric_, + ) + + metric = PetscVec(metric_[], petsclib) + + return metric +end + +""" + metric::PetscVec = DMPlexMetricCreateIsotropic(petsclib::PetscLibType,dm::PetscDM, f::PetscInt, indicator::PetscVec) +Construct an isotropic metric from an error indicator + +Input Parameters: +- `dm` - The `DM` +- `f` - The field number to use +- `indicator` - The error indicator + +Output Parameter: +- `metric` - The isotropic metric + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricCreate()`, `DMPlexMetricCreateUniform()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricCreateIsotropic")) +""" +function DMPlexMetricCreateIsotropic(petsclib::PetscLibType, dm::PetscDM, f::PetscInt, indicator::PetscVec) end + +@for_petsc function DMPlexMetricCreateIsotropic(petsclib::$UnionPetscLib, dm::PetscDM, f::$PetscInt, indicator::PetscVec ) + metric_ = Ref{CVec}() + + @chk ccall( + (:DMPlexMetricCreateIsotropic, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, CVec, Ptr{CVec}), + dm, f, indicator, metric_, + ) + + metric = PetscVec(metric_[], petsclib) + + return metric +end + +""" + determinant::PetscVec,dmDet::PetscDM = DMPlexMetricDeterminantCreate(petsclib::PetscLibType,dm::PetscDM, f::PetscInt) +Create the determinant field for a Riemannian metric + +Input Parameters: +- `dm` - The `DM` of the metric field +- `f` - The field number to use + +Output Parameters: +- `determinant` - The determinant field +- `dmDet` - The corresponding `DM` + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricCreateUniform()`, `DMPlexMetricCreateIsotropic()`, `DMPlexMetricCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricDeterminantCreate")) +""" +function DMPlexMetricDeterminantCreate(petsclib::PetscLibType, dm::PetscDM, f::PetscInt) end + +@for_petsc function DMPlexMetricDeterminantCreate(petsclib::$UnionPetscLib, dm::PetscDM, f::$PetscInt ) + determinant_ = Ref{CVec}() + dmDet_ = Ref{CDM}() + + @chk ccall( + (:DMPlexMetricDeterminantCreate, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CVec}, Ptr{CDM}), + dm, f, determinant_, dmDet_, + ) + + determinant = PetscVec(determinant_[], petsclib) + dmDet = PetscDM(dmDet_[], petsclib) + + return determinant,dmDet +end + +""" + DMPlexMetricEnforceSPD(petsclib::PetscLibType,dm::PetscDM, metricIn::PetscVec, restrictSizes::PetscBool, restrictAnisotropy::PetscBool, metricOut::PetscVec, determinant::PetscVec) +Enforce symmetric positive + +Input Parameters: +- `dm` - The `DM` +- `metricIn` - The metric +- `restrictSizes` - Should maximum/minimum metric magnitudes be enforced? +- `restrictAnisotropy` - Should maximum anisotropy be enforced? + +Output Parameters: +- `metricOut` - The metric +- `determinant` - Its determinant + +Options Database Keys: +- `-dm_plex_metric_isotropic` - Is the metric isotropic? +- `-dm_plex_metric_uniform` - Is the metric uniform? +- `-dm_plex_metric_h_min` - Minimum tolerated metric magnitude +- `-dm_plex_metric_h_max` - Maximum tolerated metric magnitude +- `-dm_plex_metric_a_max` - Maximum tolerated anisotropy + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricNormalize()`, `DMPlexMetricIntersection()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricEnforceSPD")) +""" +function DMPlexMetricEnforceSPD(petsclib::PetscLibType, dm::PetscDM, metricIn::PetscVec, restrictSizes::PetscBool, restrictAnisotropy::PetscBool, metricOut::PetscVec, determinant::PetscVec) end + +@for_petsc function DMPlexMetricEnforceSPD(petsclib::$UnionPetscLib, dm::PetscDM, metricIn::PetscVec, restrictSizes::PetscBool, restrictAnisotropy::PetscBool, metricOut::PetscVec, determinant::PetscVec ) + + @chk ccall( + (:DMPlexMetricEnforceSPD, $petsc_library), + PetscErrorCode, + (CDM, CVec, PetscBool, PetscBool, CVec, CVec), + dm, metricIn, restrictSizes, restrictAnisotropy, metricOut, determinant, + ) + + + return nothing +end + +""" + DMPlexMetricNormalize(petsclib::PetscLibType,dm::PetscDM, metricIn::PetscVec, restrictSizes::PetscBool, restrictAnisotropy::PetscBool, metricOut::PetscVec, determinant::PetscVec) +Apply L + +Input Parameters: +- `dm` - The `DM` +- `metricIn` - The unnormalized metric +- `restrictSizes` - Should maximum/minimum metric magnitudes be enforced? +- `restrictAnisotropy` - Should maximum metric anisotropy be enforced? + +Output Parameters: +- `metricOut` - The normalized metric +- `determinant` - computed determinant + +Options Database Keys: +- `-dm_plex_metric_isotropic` - Is the metric isotropic? +- `-dm_plex_metric_uniform` - Is the metric uniform? +- `-dm_plex_metric_restrict_anisotropy_first` - Should anisotropy be restricted before normalization? +- `-dm_plex_metric_h_min` - Minimum tolerated metric magnitude +- `-dm_plex_metric_h_max` - Maximum tolerated metric magnitude +- `-dm_plex_metric_a_max` - Maximum tolerated anisotropy +- `-dm_plex_metric_p` - L-p normalization order +- `-dm_plex_metric_target_complexity` - Target metric complexity + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricEnforceSPD()`, `DMPlexMetricIntersection()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricNormalize")) +""" +function DMPlexMetricNormalize(petsclib::PetscLibType, dm::PetscDM, metricIn::PetscVec, restrictSizes::PetscBool, restrictAnisotropy::PetscBool, metricOut::PetscVec, determinant::PetscVec) end + +@for_petsc function DMPlexMetricNormalize(petsclib::$UnionPetscLib, dm::PetscDM, metricIn::PetscVec, restrictSizes::PetscBool, restrictAnisotropy::PetscBool, metricOut::PetscVec, determinant::PetscVec ) + + @chk ccall( + (:DMPlexMetricNormalize, $petsc_library), + PetscErrorCode, + (CDM, CVec, PetscBool, PetscBool, CVec, CVec), + dm, metricIn, restrictSizes, restrictAnisotropy, metricOut, determinant, + ) + + + return nothing +end + +""" + DMPlexMetricAverage(petsclib::PetscLibType,dm::PetscDM, numMetrics::PetscInt, weights::Vector{PetscReal}, metrics::Vector{PetscVec}, metricAvg::PetscVec) +Compute the average of a list of metrics + +Input Parameters: +- `dm` - The `DM` +- `numMetrics` - The number of metrics to be averaged +- `weights` - Weights for the average +- `metrics` - The metrics to be averaged + +Output Parameter: +- `metricAvg` - The averaged metric + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricAverage2()`, `DMPlexMetricAverage3()`, `DMPlexMetricIntersection()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricAverage")) +""" +function DMPlexMetricAverage(petsclib::PetscLibType, dm::PetscDM, numMetrics::PetscInt, weights::Vector{PetscReal}, metrics::Vector{PetscVec}, metricAvg::PetscVec) end + +@for_petsc function DMPlexMetricAverage(petsclib::$UnionPetscLib, dm::PetscDM, numMetrics::$PetscInt, weights::Vector{$PetscReal}, metrics::Vector{PetscVec}, metricAvg::PetscVec ) + + @chk ccall( + (:DMPlexMetricAverage, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscReal}, Ptr{CVec}, CVec), + dm, numMetrics, weights, metrics, metricAvg, + ) + + + return nothing +end + +""" + DMPlexMetricAverage2(petsclib::PetscLibType,dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metricAvg::PetscVec) +Compute the unweighted average of two metrics + +Input Parameters: +- `dm` - The `DM` +- `metric1` - The first metric to be averaged +- `metric2` - The second metric to be averaged + +Output Parameter: +- `metricAvg` - The averaged metric + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricAverage()`, `DMPlexMetricAverage3()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricAverage2")) +""" +function DMPlexMetricAverage2(petsclib::PetscLibType, dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metricAvg::PetscVec) end + +@for_petsc function DMPlexMetricAverage2(petsclib::$UnionPetscLib, dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metricAvg::PetscVec ) + + @chk ccall( + (:DMPlexMetricAverage2, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec, CVec), + dm, metric1, metric2, metricAvg, + ) + + + return nothing +end + +""" + DMPlexMetricAverage3(petsclib::PetscLibType,dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metric3::PetscVec, metricAvg::PetscVec) +Compute the unweighted average of three metrics + +Input Parameters: +- `dm` - The `DM` +- `metric1` - The first metric to be averaged +- `metric2` - The second metric to be averaged +- `metric3` - The third metric to be averaged + +Output Parameter: +- `metricAvg` - The averaged metric + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricAverage()`, `DMPlexMetricAverage2()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricAverage3")) +""" +function DMPlexMetricAverage3(petsclib::PetscLibType, dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metric3::PetscVec, metricAvg::PetscVec) end + +@for_petsc function DMPlexMetricAverage3(petsclib::$UnionPetscLib, dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metric3::PetscVec, metricAvg::PetscVec ) + + @chk ccall( + (:DMPlexMetricAverage3, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec, CVec, CVec), + dm, metric1, metric2, metric3, metricAvg, + ) + + + return nothing +end + +""" + DMPlexMetricIntersection(petsclib::PetscLibType,dm::PetscDM, numMetrics::PetscInt, metrics::Vector{PetscVec}, metricInt::PetscVec) +Compute the intersection of a list of metrics + +Input Parameters: +- `dm` - The `DM` +- `numMetrics` - The number of metrics to be intersected +- `metrics` - The metrics to be intersected + +Output Parameter: +- `metricInt` - The intersected metric + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricIntersection2()`, `DMPlexMetricIntersection3()`, `DMPlexMetricAverage()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricIntersection")) +""" +function DMPlexMetricIntersection(petsclib::PetscLibType, dm::PetscDM, numMetrics::PetscInt, metrics::Vector{PetscVec}, metricInt::PetscVec) end + +@for_petsc function DMPlexMetricIntersection(petsclib::$UnionPetscLib, dm::PetscDM, numMetrics::$PetscInt, metrics::Vector{PetscVec}, metricInt::PetscVec ) + + @chk ccall( + (:DMPlexMetricIntersection, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CVec}, CVec), + dm, numMetrics, metrics, metricInt, + ) + + + return nothing +end + +""" + DMPlexMetricIntersection2(petsclib::PetscLibType,dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metricInt::PetscVec) +Compute the intersection of two metrics + +Input Parameters: +- `dm` - The `DM` +- `metric1` - The first metric to be intersected +- `metric2` - The second metric to be intersected + +Output Parameter: +- `metricInt` - The intersected metric + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricIntersection()`, `DMPlexMetricIntersection3()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricIntersection2")) +""" +function DMPlexMetricIntersection2(petsclib::PetscLibType, dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metricInt::PetscVec) end + +@for_petsc function DMPlexMetricIntersection2(petsclib::$UnionPetscLib, dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metricInt::PetscVec ) + + @chk ccall( + (:DMPlexMetricIntersection2, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec, CVec), + dm, metric1, metric2, metricInt, + ) + + + return nothing +end + +""" + DMPlexMetricIntersection3(petsclib::PetscLibType,dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metric3::PetscVec, metricInt::PetscVec) +Compute the intersection of three metrics + +Input Parameters: +- `dm` - The `DM` +- `metric1` - The first metric to be intersected +- `metric2` - The second metric to be intersected +- `metric3` - The third metric to be intersected + +Output Parameter: +- `metricInt` - The intersected metric + +Level: beginner + +-seealso: `DMPLEX`, `DMPlexMetricIntersection()`, `DMPlexMetricIntersection2()` + +# External Links +$(_doc_external("DMPlex/DMPlexMetricIntersection3")) +""" +function DMPlexMetricIntersection3(petsclib::PetscLibType, dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metric3::PetscVec, metricInt::PetscVec) end + +@for_petsc function DMPlexMetricIntersection3(petsclib::$UnionPetscLib, dm::PetscDM, metric1::PetscVec, metric2::PetscVec, metric3::PetscVec, metricInt::PetscVec ) + + @chk ccall( + (:DMPlexMetricIntersection3, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec, CVec, CVec), + dm, metric1, metric2, metric3, metricInt, + ) + + + return nothing +end + +""" + dm::PetscDM = DMPlexCreateGmshFromFile(petsclib::PetscLibType,comm::MPI_Comm, filename::String, interpolate::PetscBool) +Create a `DMPLEX` mesh from a Gmsh file + +Input Parameters: +- `comm` - The MPI communicator +- `filename` - Name of the Gmsh file +- `interpolate` - Create faces and edges in the mesh + +Output Parameter: +- `dm` - The `DM` object representing the mesh + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateFromFile()`, `DMPlexCreateGmsh()`, `DMPlexCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateGmshFromFile")) +""" +function DMPlexCreateGmshFromFile(petsclib::PetscLibType, comm::MPI_Comm, filename::String, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateGmshFromFile(petsclib::$UnionPetscLib, comm::MPI_Comm, filename::String, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateGmshFromFile, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscBool, Ptr{CDM}), + comm, filename, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateGmsh(petsclib::PetscLibType,comm::MPI_Comm, viewer::PetscViewer, interpolate::PetscBool) +Create a `DMPLEX` mesh from a Gmsh file viewer + +Collective + +Input Parameters: +- `comm` - The MPI communicator +- `viewer` - The `PetscViewer` associated with a Gmsh file +- `interpolate` - Create faces and edges in the mesh + +Output Parameter: +- `dm` - The `DM` object representing the mesh + +Options Database Keys: +- `-dm_plex_gmsh_hybrid` - Force triangular prisms to use tensor order +- `-dm_plex_gmsh_periodic` - Read Gmsh periodic section and construct a periodic Plex +- `-dm_plex_gmsh_highorder` - Generate high-order coordinates +- `-dm_plex_gmsh_project` - Project high-order coordinates to a different space, use the prefix dm_plex_gmsh_project_ to define the space +- `-dm_plex_gmsh_use_generic` - Generate generic labels, i.e. Cell Sets, Face Sets, etc. +- `-dm_plex_gmsh_use_regions` - Generate labels with region names +- `-dm_plex_gmsh_mark_vertices` - Add vertices to generated labels +- `-dm_plex_gmsh_mark_vertices_strict` - Add vertices included in a region to generated labels +- `-dm_plex_gmsh_multiple_tags` - Allow multiple tags for default labels +- `-dm_plex_gmsh_spacedim ` - Embedding space dimension, if different from topological dimension + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateGmsh")) +""" +function DMPlexCreateGmsh(petsclib::PetscLibType, comm::MPI_Comm, viewer::PetscViewer, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateGmsh(petsclib::$UnionPetscLib, comm::MPI_Comm, viewer::PetscViewer, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateGmsh, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscViewer, PetscBool, Ptr{CDM}), + comm, viewer, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateCGNSFromFile(petsclib::PetscLibType,comm::MPI_Comm, filename::String, interpolate::PetscBool) +Create a `DMPLEX` mesh from a CGNS file. + +Collective + +Input Parameters: +- `comm` - The MPI communicator +- `filename` - The name of the CGNS file +- `interpolate` - Create faces and edges in the mesh + +Output Parameter: +- `dm` - The `DM` object representing the mesh + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexCreateCGNS()`, `DMPlexCreateExodus()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateCGNSFromFile")) +""" +function DMPlexCreateCGNSFromFile(petsclib::PetscLibType, comm::MPI_Comm, filename::String, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateCGNSFromFile(petsclib::$UnionPetscLib, comm::MPI_Comm, filename::String, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateCGNSFromFile, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscBool, Ptr{CDM}), + comm, filename, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateCGNS(petsclib::PetscLibType,comm::MPI_Comm, cgid::PetscInt, interpolate::PetscBool) +Create a `DMPLEX` mesh from a CGNS file ID. + +Collective + +Input Parameters: +- `comm` - The MPI communicator +- `cgid` - The CG id associated with a file and obtained using cg_open +- `interpolate` - Create faces and edges in the mesh + +Output Parameter: +- `dm` - The `DM` object representing the mesh + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexCreateExodus()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateCGNS")) +""" +function DMPlexCreateCGNS(petsclib::PetscLibType, comm::MPI_Comm, cgid::PetscInt, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateCGNS(petsclib::$UnionPetscLib, comm::MPI_Comm, cgid::$PetscInt, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateCGNS, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, PetscBool, Ptr{CDM}), + comm, cgid, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMPlexCreateClosureIndex(petsclib::PetscLibType,dm::PetscDM, section::PetscSection) +Calculate an index for the given `PetscSection` for the closure operation on the `DM` + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `section` - The section describing the layout in the local vector, or NULL to use the default section + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscSection`, `DMPlexVecGetClosure()`, `DMPlexVecRestoreClosure()`, `DMPlexVecSetClosure()`, `DMPlexMatSetClosure()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateClosureIndex")) +""" +function DMPlexCreateClosureIndex(petsclib::PetscLibType, dm::PetscDM, section::PetscSection) end + +@for_petsc function DMPlexCreateClosureIndex(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection ) + + @chk ccall( + (:DMPlexCreateClosureIndex, $petsc_library), + PetscErrorCode, + (CDM, PetscSection), + dm, section, + ) + + + return nothing +end + +""" + dm::PetscDM = DMPlexCreateFluentFromFile(petsclib::PetscLibType,comm::MPI_Comm, filename::String, interpolate::PetscBool) +Create a `DMPLEX` mesh from a Fluent mesh file + +Collective + +Input Parameters: +- `comm` - The MPI communicator +- `filename` - Name of the Fluent mesh file +- `interpolate` - Create faces and edges in the mesh + +Output Parameter: +- `dm` - The `DM` object representing the mesh + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateFromFile()`, `DMPlexCreateFluent()`, `DMPlexCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateFluentFromFile")) +""" +function DMPlexCreateFluentFromFile(petsclib::PetscLibType, comm::MPI_Comm, filename::String, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateFluentFromFile(petsclib::$UnionPetscLib, comm::MPI_Comm, filename::String, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateFluentFromFile, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscBool, Ptr{CDM}), + comm, filename, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateFluent(petsclib::PetscLibType,comm::MPI_Comm, viewer::PetscViewer, interpolate::PetscBool) +Create a `DMPLEX` mesh from a Fluent mesh file . + +Collective + +Input Parameters: +- `comm` - The MPI communicator +- `viewer` - The `PetscViewer` associated with a Fluent mesh file +- `interpolate` - Create faces and edges in the mesh + +Output Parameter: +- `dm` - The `DM` object representing the mesh + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateFluent")) +""" +function DMPlexCreateFluent(petsclib::PetscLibType, comm::MPI_Comm, viewer::PetscViewer, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateFluent(petsclib::$UnionPetscLib, comm::MPI_Comm, viewer::PetscViewer, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateFluent, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscViewer, PetscBool, Ptr{CDM}), + comm, viewer, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + simplex::PetscBool = DMPlexIsSimplex(petsclib::PetscLibType,dm::PetscDM) +Is the first cell in this mesh a simplex? + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `simplex` - Flag checking for a simplex + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetSimplexOrBoxCells()`, `DMPlexGetCellType()`, `DMPlexGetHeightStratum()`, `DMPolytopeTypeGetNumVertices()` + +# External Links +$(_doc_external("DMPlex/DMPlexIsSimplex")) +""" +function DMPlexIsSimplex(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexIsSimplex(petsclib::$UnionPetscLib, dm::PetscDM ) + simplex_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexIsSimplex, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, simplex_, + ) + + simplex = simplex_[] + + return simplex +end + +""" + cStart::PetscInt,cEnd::PetscInt = DMPlexGetSimplexOrBoxCells(petsclib::PetscLibType,dm::PetscDM, height::PetscInt) +Get the range of cells which are neither prisms nor ghost FV cells + +Input Parameters: +- `dm` - The `DMPLEX` object +- `height` - The cell height in the Plex, 0 is the default + +Output Parameters: +- `cStart` - The first "normal" cell, pass `NULL` if not needed +- `cEnd` - The upper bound on "normal" cells, pass `NULL` if not needed + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexConstructGhostCells()`, `DMPlexGetCellTypeStratum()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetSimplexOrBoxCells")) +""" +function DMPlexGetSimplexOrBoxCells(petsclib::PetscLibType, dm::PetscDM, height::PetscInt) end + +@for_petsc function DMPlexGetSimplexOrBoxCells(petsclib::$UnionPetscLib, dm::PetscDM, height::$PetscInt ) + cStart_ = Ref{$PetscInt}() + cEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetSimplexOrBoxCells, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, height, cStart_, cEnd_, + ) + + cStart = cStart_[] + cEnd = cEnd_[] + + return cStart,cEnd +end + +""" + DMPlexVecView1D(petsclib::PetscLibType,dm::PetscDM, n::PetscInt, u::Vector{PetscVec}, viewer::PetscViewer) +Plot many 1D solutions on the same line graph + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `n` - The number of vectors +- `u` - The array of local vectors +- `viewer` - The `PetscViewer` + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `VecViewFromOptions()`, `VecView()` + +# External Links +$(_doc_external("DMPlex/DMPlexVecView1D")) +""" +function DMPlexVecView1D(petsclib::PetscLibType, dm::PetscDM, n::PetscInt, u::Vector{PetscVec}, viewer::PetscViewer) end + +@for_petsc function DMPlexVecView1D(petsclib::$UnionPetscLib, dm::PetscDM, n::$PetscInt, u::Vector{PetscVec}, viewer::PetscViewer ) + + @chk ccall( + (:DMPlexVecView1D, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CVec}, PetscViewer), + dm, n, u, viewer, + ) + + + return nothing +end + +""" + DMPlexTopologyView(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer) +Saves a `DMPLEX` topology into a file + +Collective + +Input Parameters: +- `dm` - The `DM` whose topology is to be saved +- `viewer` - The `PetscViewer` to save it in + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMView()`, `DMPlexCoordinatesView()`, `DMPlexLabelsView()`, `DMPlexTopologyLoad()`, `PetscViewer` + +# External Links +$(_doc_external("DMPlex/DMPlexTopologyView")) +""" +function DMPlexTopologyView(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer) end + +@for_petsc function DMPlexTopologyView(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer ) + + @chk ccall( + (:DMPlexTopologyView, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer), + dm, viewer, + ) + + + return nothing +end + +""" + DMPlexCoordinatesView(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer) +Saves `DMPLEX` coordinates into a file + +Collective + +Input Parameters: +- `dm` - The `DM` whose coordinates are to be saved +- `viewer` - The `PetscViewer` for saving + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMView()`, `DMPlexTopologyView()`, `DMPlexLabelsView()`, `DMPlexCoordinatesLoad()`, `PetscViewer` + +# External Links +$(_doc_external("DMPlex/DMPlexCoordinatesView")) +""" +function DMPlexCoordinatesView(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer) end + +@for_petsc function DMPlexCoordinatesView(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer ) + + @chk ccall( + (:DMPlexCoordinatesView, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer), + dm, viewer, + ) + + + return nothing +end + +""" + DMPlexLabelsView(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer) +Saves `DMPLEX` labels into a file + +Collective + +Input Parameters: +- `dm` - The `DM` whose labels are to be saved +- `viewer` - The `PetscViewer` for saving + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMView()`, `DMPlexTopologyView()`, `DMPlexCoordinatesView()`, `DMPlexLabelsLoad()`, `PetscViewer` + +# External Links +$(_doc_external("DMPlex/DMPlexLabelsView")) +""" +function DMPlexLabelsView(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer) end + +@for_petsc function DMPlexLabelsView(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer ) + + @chk ccall( + (:DMPlexLabelsView, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer), + dm, viewer, + ) + + + return nothing +end + +""" + DMPlexSectionView(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM) +Saves a section associated with a `DMPLEX` + +Collective + +Input Parameters: +- `dm` - The `DM` that contains the topology on which the section to be saved is defined +- `viewer` - The `PetscViewer` for saving +- `sectiondm` - The `DM` that contains the section to be saved, can be `NULL` + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMView()`, `DMPlexTopologyView()`, `DMPlexCoordinatesView()`, `DMPlexLabelsView()`, `DMPlexGlobalVectorView()`, `DMPlexLocalVectorView()`, `PetscSectionView()`, `DMPlexSectionLoad()`, `PetscViewer` + +# External Links +$(_doc_external("DMPlex/DMPlexSectionView")) +""" +function DMPlexSectionView(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM) end + +@for_petsc function DMPlexSectionView(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM ) + + @chk ccall( + (:DMPlexSectionView, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, CDM), + dm, viewer, sectiondm, + ) + + + return nothing +end + +""" + DMPlexGlobalVectorView(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, vec::PetscVec) +Saves a global vector + +Collective + +Input Parameters: +- `dm` - The `DM` that represents the topology +- `viewer` - The `PetscViewer` to save data with +- `sectiondm` - The `DM` that contains the global section on which vec is defined, can be `NULL` +- `vec` - The global vector to be saved + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTopologyView()`, `DMPlexSectionView()`, `DMPlexLocalVectorView()`, `DMPlexGlobalVectorLoad()`, `DMPlexLocalVectorLoad()` + +# External Links +$(_doc_external("DMPlex/DMPlexGlobalVectorView")) +""" +function DMPlexGlobalVectorView(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, vec::PetscVec) end + +@for_petsc function DMPlexGlobalVectorView(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, vec::PetscVec ) + + @chk ccall( + (:DMPlexGlobalVectorView, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, CDM, CVec), + dm, viewer, sectiondm, vec, + ) + + + return nothing +end + +""" + DMPlexLocalVectorView(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, vec::PetscVec) +Saves a local vector + +Collective + +Input Parameters: +- `dm` - The `DM` that represents the topology +- `viewer` - The `PetscViewer` to save data with +- `sectiondm` - The `DM` that contains the local section on which `vec` is defined, can be `NULL` +- `vec` - The local vector to be saved + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTopologyView()`, `DMPlexSectionView()`, `DMPlexGlobalVectorView()`, `DMPlexGlobalVectorLoad()`, `DMPlexLocalVectorLoad()` + +# External Links +$(_doc_external("DMPlex/DMPlexLocalVectorView")) +""" +function DMPlexLocalVectorView(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, vec::PetscVec) end + +@for_petsc function DMPlexLocalVectorView(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, vec::PetscVec ) + + @chk ccall( + (:DMPlexLocalVectorView, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, CDM, CVec), + dm, viewer, sectiondm, vec, + ) + + + return nothing +end + +""" + DMPlexTopologyLoad(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, globalToLocalPointSF::PetscSF) +Loads a topology into a `DMPLEX` + +Collective + +Input Parameters: +- `dm` - The `DM` into which the topology is loaded +- `viewer` - The `PetscViewer` for the saved topology + +Output Parameter: +- `globalToLocalPointSF` - The `PetscSF` that pushes points in [0, N) to the associated points in the loaded `DMPLEX`, where N is the global number of points; +`NULL` if unneeded + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMLoad()`, `DMPlexCoordinatesLoad()`, `DMPlexLabelsLoad()`, `DMView()`, `PetscViewerHDF5Open()`, `PetscViewerPushFormat()`, +`PetscViewer`, `PetscSF` + +# External Links +$(_doc_external("DMPlex/DMPlexTopologyLoad")) +""" +function DMPlexTopologyLoad(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, globalToLocalPointSF::PetscSF) end + +@for_petsc function DMPlexTopologyLoad(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, globalToLocalPointSF::PetscSF ) + + @chk ccall( + (:DMPlexTopologyLoad, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, Ptr{PetscSF}), + dm, viewer, globalToLocalPointSF, + ) + + + return nothing +end + +""" + DMPlexCoordinatesLoad(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, globalToLocalPointSF::PetscSF) +Loads coordinates into a `DMPLEX` + +Collective + +Input Parameters: +- `dm` - The `DM` into which the coordinates are loaded +- `viewer` - The `PetscViewer` for the saved coordinates +- `globalToLocalPointSF` - The `PetscSF` returned by `DMPlexTopologyLoad()` when loading dm from viewer + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMLoad()`, `DMPlexTopologyLoad()`, `DMPlexLabelsLoad()`, `DMView()`, `PetscViewerHDF5Open()`, `PetscViewerPushFormat()`, +`PetscSF`, `PetscViewer` + +# External Links +$(_doc_external("DMPlex/DMPlexCoordinatesLoad")) +""" +function DMPlexCoordinatesLoad(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, globalToLocalPointSF::PetscSF) end + +@for_petsc function DMPlexCoordinatesLoad(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, globalToLocalPointSF::PetscSF ) + + @chk ccall( + (:DMPlexCoordinatesLoad, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, PetscSF), + dm, viewer, globalToLocalPointSF, + ) + + + return nothing +end + +""" + DMPlexLabelsLoad(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, globalToLocalPointSF::PetscSF) +Loads labels into a `DMPLEX` + +Collective + +Input Parameters: +- `dm` - The `DM` into which the labels are loaded +- `viewer` - The `PetscViewer` for the saved labels +- `globalToLocalPointSF` - The `PetscSF` returned by `DMPlexTopologyLoad()` when loading `dm` from viewer + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMLoad()`, `DMPlexTopologyLoad()`, `DMPlexCoordinatesLoad()`, `DMView()`, `PetscViewerHDF5Open()`, `PetscViewerPushFormat()`, +`PetscSF`, `PetscViewer` + +# External Links +$(_doc_external("DMPlex/DMPlexLabelsLoad")) +""" +function DMPlexLabelsLoad(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, globalToLocalPointSF::PetscSF) end + +@for_petsc function DMPlexLabelsLoad(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, globalToLocalPointSF::PetscSF ) + + @chk ccall( + (:DMPlexLabelsLoad, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, PetscSF), + dm, viewer, globalToLocalPointSF, + ) + + + return nothing +end + +""" + DMPlexSectionLoad(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, globalToLocalPointSF::PetscSF, globalDofSF::PetscSF, locDofSF::PetscSF) +Loads section into a `DMPLEX` + +Collective + +Input Parameters: +- `dm` - The `DM` that represents the topology +- `viewer` - The `PetscViewer` that represents the on-disk section (sectionA) +- `sectiondm` - The `DM` into which the on-disk section (sectionA) is migrated, can be `NULL` +- `globalToLocalPointSF` - The `PetscSF` returned by `DMPlexTopologyLoad(`) when loading dm from viewer + +Output Parameters: +- `globalDofSF` - The `PetscSF` that migrates any on-disk `Vec` data associated with sectionA into a global `Vec` associated with the `sectiondm`'s global section (`NULL` if not needed) +- `localDofSF` - The `PetscSF` that migrates any on-disk `Vec` data associated with sectionA into a local `Vec` associated with the `sectiondm`'s local section (`NULL` if not needed) + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMLoad()`, `DMPlexTopologyLoad()`, `DMPlexCoordinatesLoad()`, `DMPlexLabelsLoad()`, `DMPlexGlobalVectorLoad()`, `DMPlexLocalVectorLoad()`, `PetscSectionLoad()`, `DMPlexSectionView()`, `PetscSF`, `PetscViewer` + +# External Links +$(_doc_external("DMPlex/DMPlexSectionLoad")) +""" +function DMPlexSectionLoad(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, globalToLocalPointSF::PetscSF, globalDofSF::PetscSF, locDofSF::PetscSF) end + +@for_petsc function DMPlexSectionLoad(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, globalToLocalPointSF::PetscSF, globalDofSF::PetscSF, locDofSF::PetscSF ) + + @chk ccall( + (:DMPlexSectionLoad, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, CDM, PetscSF, Ptr{PetscSF}, Ptr{PetscSF}), + dm, viewer, sectiondm, globalToLocalPointSF, globalDofSF, locDofSF, + ) + + + return nothing +end + +""" + DMPlexGlobalVectorLoad(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, sf::PetscSF, vec::PetscVec) +Loads on + +Collective + +Input Parameters: +- `dm` - The `DM` that represents the topology +- `viewer` - The `PetscViewer` that represents the on-disk vector data +- `sectiondm` - The `DM` that contains the global section on which vec is defined, can be `NULL` +- `sf` - The `PetscSF` that migrates the on-disk vector data into vec +- `vec` - The global vector to set values of + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTopologyLoad()`, `DMPlexSectionLoad()`, `DMPlexLocalVectorLoad()`, `DMPlexGlobalVectorView()`, `DMPlexLocalVectorView()`, +`PetscSF`, `PetscViewer` + +# External Links +$(_doc_external("DMPlex/DMPlexGlobalVectorLoad")) +""" +function DMPlexGlobalVectorLoad(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, sf::PetscSF, vec::PetscVec) end + +@for_petsc function DMPlexGlobalVectorLoad(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, sf::PetscSF, vec::PetscVec ) + + @chk ccall( + (:DMPlexGlobalVectorLoad, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, CDM, PetscSF, CVec), + dm, viewer, sectiondm, sf, vec, + ) + + + return nothing +end + +""" + DMPlexLocalVectorLoad(petsclib::PetscLibType,dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, sf::PetscSF, vec::PetscVec) +Loads on + +Collective + +Input Parameters: +- `dm` - The `DM` that represents the topology +- `viewer` - The `PetscViewer` that represents the on-disk vector data +- `sectiondm` - The `DM` that contains the local section on which vec is defined, can be `NULL` +- `sf` - The `PetscSF` that migrates the on-disk vector data into vec +- `vec` - The local vector to set values of + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTopologyLoad()`, `DMPlexSectionLoad()`, `DMPlexGlobalVectorLoad()`, `DMPlexGlobalVectorView()`, `DMPlexLocalVectorView()`, +`PetscSF`, `PetscViewer` + +# External Links +$(_doc_external("DMPlex/DMPlexLocalVectorLoad")) +""" +function DMPlexLocalVectorLoad(petsclib::PetscLibType, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, sf::PetscSF, vec::PetscVec) end + +@for_petsc function DMPlexLocalVectorLoad(petsclib::$UnionPetscLib, dm::PetscDM, viewer::PetscViewer, sectiondm::PetscDM, sf::PetscSF, vec::PetscVec ) + + @chk ccall( + (:DMPlexLocalVectorLoad, $petsc_library), + PetscErrorCode, + (CDM, PetscViewer, CDM, PetscSF, CVec), + dm, viewer, sectiondm, sf, vec, + ) + + + return nothing +end + +""" + DMPlexGetSubdomainSection(petsclib::PetscLibType,dm::PetscDM, subsection::PetscSection) +Returns the section associated with the subdomain + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` + +Output Parameter: +- `subsection` - The subdomain section + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscSection` + +# External Links +$(_doc_external("DMPlex/DMPlexGetSubdomainSection")) +""" +function DMPlexGetSubdomainSection(petsclib::PetscLibType, dm::PetscDM, subsection::PetscSection) end + +@for_petsc function DMPlexGetSubdomainSection(petsclib::$UnionPetscLib, dm::PetscDM, subsection::PetscSection ) + + @chk ccall( + (:DMPlexGetSubdomainSection, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSection}), + dm, subsection, + ) + + + return nothing +end + +""" + pStart::PetscInt,pEnd::PetscInt = DMPlexGetChart(petsclib::PetscLibType,dm::PetscDM) +Return the interval for all mesh points [`pStart`, `pEnd`) + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` + +Output Parameters: +- `pStart` - The first mesh point +- `pEnd` - The upper bound for mesh points + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexSetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetChart")) +""" +function DMPlexGetChart(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetChart(petsclib::$UnionPetscLib, dm::PetscDM ) + pStart_ = Ref{$PetscInt}() + pEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetChart, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, pStart_, pEnd_, + ) + + pStart = pStart_[] + pEnd = pEnd_[] + + return pStart,pEnd +end + +""" + DMPlexSetChart(petsclib::PetscLibType,dm::PetscDM, pStart::PetscInt, pEnd::PetscInt) +Set the interval for all mesh points [`pStart`, `pEnd`) + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `pStart` - The first mesh point +- `pEnd` - The upper bound for mesh points + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetChart")) +""" +function DMPlexSetChart(petsclib::PetscLibType, dm::PetscDM, pStart::PetscInt, pEnd::PetscInt) end + +@for_petsc function DMPlexSetChart(petsclib::$UnionPetscLib, dm::PetscDM, pStart::$PetscInt, pEnd::$PetscInt ) + + @chk ccall( + (:DMPlexSetChart, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt), + dm, pStart, pEnd, + ) + + + return nothing +end + +""" + size::PetscInt = DMPlexGetConeSize(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Return the number of in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` + +Output Parameter: +- `size` - The cone size for point `p` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexSetConeSize()`, `DMPlexSetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetConeSize")) +""" +function DMPlexGetConeSize(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMPlexGetConeSize(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetConeSize, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, p, size_, + ) + + size = size_[] + + return size +end + +""" + DMPlexSetConeSize(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, size::PetscInt) +Set the number of in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` +- `size` - The cone size for point `p` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetCone()`, `DMPlexCreate()`, `DMPlexGetConeSize()`, `DMPlexSetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetConeSize")) +""" +function DMPlexSetConeSize(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, size::PetscInt) end + +@for_petsc function DMPlexSetConeSize(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, size::$PetscInt ) + + @chk ccall( + (:DMPlexSetConeSize, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt), + dm, p, size, + ) + + + return nothing +end + +""" + cone::Vector{PetscInt} = DMPlexGetCone(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Return the points on the in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` + +Output Parameter: +- `cone` - An array of points which are on the in-edges for point `p`, the length of `cone` is the result of `DMPlexGetConeSize()` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetConeSize()`, `DMPlexSetCone()`, `DMPlexGetConeTuple()`, `DMPlexSetChart()`, `DMPlexRestoreCone()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetCone")) +""" +function DMPlexGetCone(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMPlexGetCone(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + cone_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetCone, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{$PetscInt}}), + dm, p, cone_, + ) + + cone = unsafe_wrap(Array, cone_[], VecGetLocalSize(petsclib, x); own = false) + + return cone +end + +""" + DMPlexGetConeTuple(petsclib::PetscLibType,dm::PetscDM, p::IS, pConesSection::PetscSection, pCones::IS) +Return the points on the in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The `IS` of points, which must lie in the chart set with `DMPlexSetChart()` + +Output Parameters: +- `pConesSection` - `PetscSection` describing the layout of `pCones` +- `pCones` - An `IS` containing the points which are on the in-edges for the point set `p` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetCone()`, `DMPlexGetConeRecursive()`, `DMPlexSetChart()`, `PetscSection`, `IS` + +# External Links +$(_doc_external("DMPlex/DMPlexGetConeTuple")) +""" +function DMPlexGetConeTuple(petsclib::PetscLibType, dm::PetscDM, p::IS, pConesSection::PetscSection, pCones::IS) end + +@for_petsc function DMPlexGetConeTuple(petsclib::$UnionPetscLib, dm::PetscDM, p::IS, pConesSection::PetscSection, pCones::IS ) + + @chk ccall( + (:DMPlexGetConeTuple, $petsc_library), + PetscErrorCode, + (CDM, CIS, Ptr{PetscSection}, Ptr{CIS}), + dm, p, pConesSection, pCones, + ) + + + return nothing +end + +""" + DMPlexGetConeRecursiveVertices(petsclib::PetscLibType,dm::PetscDM, points::IS, expandedPoints::IS) +Expand each given point into its cone points and do that recursively until we end up just with vertices. + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `points` - The `IS` of points, which must lie in the chart set with `DMPlexSetChart()` + +Output Parameter: +- `expandedPoints` - An `IS` containing the of vertices recursively expanded from input points + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetCone()`, `DMPlexGetConeTuple()`, `DMPlexGetConeRecursive()`, `DMPlexRestoreConeRecursive()`, +`DMPlexGetDepth()`, `IS` + +# External Links +$(_doc_external("DMPlex/DMPlexGetConeRecursiveVertices")) +""" +function DMPlexGetConeRecursiveVertices(petsclib::PetscLibType, dm::PetscDM, points::IS, expandedPoints::IS) end + +@for_petsc function DMPlexGetConeRecursiveVertices(petsclib::$UnionPetscLib, dm::PetscDM, points::IS, expandedPoints::IS ) + + @chk ccall( + (:DMPlexGetConeRecursiveVertices, $petsc_library), + PetscErrorCode, + (CDM, CIS, Ptr{CIS}), + dm, points, expandedPoints, + ) + + + return nothing +end + +""" + depth::PetscInt = DMPlexGetConeRecursive(petsclib::PetscLibType,dm::PetscDM, points::IS, expandedPoints::Vector{IS}, sections::Vector{PetscSection}) +Expand each given point into its cone points and do that recursively until we end up just with vertices +(DAG points of depth 0, i.e., without cones). + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `points` - The `IS` of points, which must lie in the chart set with `DMPlexSetChart()` + +Output Parameters: +- `depth` - (optional) Size of the output arrays, equal to `DMPLEX` depth, returned by `DMPlexGetDepth()` +- `expandedPoints` - (optional) An array of index sets with recursively expanded cones +- `sections` - (optional) An array of sections which describe mappings from points to their cone points + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetCone()`, `DMPlexGetConeTuple()`, `DMPlexRestoreConeRecursive()`, `DMPlexGetConeRecursiveVertices()`, +`DMPlexGetDepth()`, `PetscSection`, `IS` + +# External Links +$(_doc_external("DMPlex/DMPlexGetConeRecursive")) +""" +function DMPlexGetConeRecursive(petsclib::PetscLibType, dm::PetscDM, points::IS, expandedPoints::Vector{IS}, sections::Vector{PetscSection}) end + +@for_petsc function DMPlexGetConeRecursive(petsclib::$UnionPetscLib, dm::PetscDM, points::IS, expandedPoints::Vector{IS}, sections::Vector{PetscSection} ) + depth_ = Ref{$PetscInt}() + expandedPoints_ = Ref(pointer(expandedPoints)) + sections_ = Ref(pointer(sections)) + + @chk ccall( + (:DMPlexGetConeRecursive, $petsc_library), + PetscErrorCode, + (CDM, CIS, Ptr{$PetscInt}, Ptr{Ptr{CIS}}, Ptr{Ptr{PetscSection}}), + dm, points, depth_, expandedPoints_, sections_, + ) + + depth = depth_[] + + return depth +end + +""" + depth::PetscInt = DMPlexRestoreConeRecursive(petsclib::PetscLibType,dm::PetscDM, points::IS, expandedPoints::Vector{IS}, sections::Vector{PetscSection}) +Deallocates arrays created by `DMPlexGetConeRecursive()` + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `points` - The `IS` of points, which must lie in the chart set with `DMPlexSetChart()` + +Output Parameters: +- `depth` - (optional) Size of the output arrays, equal to `DMPLEX` depth, returned by `DMPlexGetDepth()` +- `expandedPoints` - (optional) An array of recursively expanded cones +- `sections` - (optional) An array of sections which describe mappings from points to their cone points + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetCone()`, `DMPlexGetConeTuple()`, `DMPlexGetConeRecursive()`, `DMPlexGetConeRecursiveVertices()`, +`DMPlexGetDepth()`, `IS`, `PetscSection` + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreConeRecursive")) +""" +function DMPlexRestoreConeRecursive(petsclib::PetscLibType, dm::PetscDM, points::IS, expandedPoints::Vector{IS}, sections::Vector{PetscSection}) end + +@for_petsc function DMPlexRestoreConeRecursive(petsclib::$UnionPetscLib, dm::PetscDM, points::IS, expandedPoints::Vector{IS}, sections::Vector{PetscSection} ) + depth_ = Ref{$PetscInt}() + expandedPoints_ = Ref(pointer(expandedPoints)) + sections_ = Ref(pointer(sections)) + + @chk ccall( + (:DMPlexRestoreConeRecursive, $petsc_library), + PetscErrorCode, + (CDM, CIS, Ptr{$PetscInt}, Ptr{Ptr{CIS}}, Ptr{Ptr{PetscSection}}), + dm, points, depth_, expandedPoints_, sections_, + ) + + depth = depth_[] + + return depth +end + +""" + DMPlexSetCone(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, cone::Vector{PetscInt}) +Set the points on the in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` +- `cone` - An array of points which are on the in-edges for point `p`, its length must have been previously provided with `DMPlexSetConeSize()` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetCone()`, `DMPlexSetChart()`, `DMPlexSetConeSize()`, `DMSetUp()`, `DMPlexSetSupport()`, `DMPlexSetSupportSize()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetCone")) +""" +function DMPlexSetCone(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, cone::Vector{PetscInt}) end + +@for_petsc function DMPlexSetCone(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, cone::Vector{$PetscInt} ) + + @chk ccall( + (:DMPlexSetCone, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, p, cone, + ) + + + return nothing +end + +""" + coneOrientation::Vector{PetscInt} = DMPlexGetConeOrientation(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Return the orientations on the in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` + +Output Parameter: +- `coneOrientation` - An array of orientations which are on the in-edges for point `p`. An orientation is an +integer giving the prescription for cone traversal. Its length is given by the result of `DMPlexSetConeSize()` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetConeSize()`, `DMPolytopeTypeComposeOrientation()`, `DMPolytopeTypeComposeOrientationInv()`, +`DMPlexCreate()`, `DMPlexGetCone()`, `DMPlexSetCone()`, `DMPlexSetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetConeOrientation")) +""" +function DMPlexGetConeOrientation(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMPlexGetConeOrientation(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + coneOrientation_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetConeOrientation, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{$PetscInt}}), + dm, p, coneOrientation_, + ) + + coneOrientation = unsafe_wrap(Array, coneOrientation_[], VecGetLocalSize(petsclib, x); own = false) + + return coneOrientation +end + +""" + DMPlexSetConeOrientation(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, coneOrientation::Vector{PetscInt}) +Set the orientations on the in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` +- `coneOrientation` - An array of orientations. Its length is given by the result of `DMPlexSetConeSize()` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetConeOrientation()`, `DMPlexSetCone()`, `DMPlexSetChart()`, `DMPlexSetConeSize()`, `DMSetUp()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetConeOrientation")) +""" +function DMPlexSetConeOrientation(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, coneOrientation::Vector{PetscInt}) end + +@for_petsc function DMPlexSetConeOrientation(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, coneOrientation::Vector{$PetscInt} ) + + @chk ccall( + (:DMPlexSetConeOrientation, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, p, coneOrientation, + ) + + + return nothing +end + +""" + DMPlexInsertCone(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, conePos::PetscInt, conePoint::PetscInt) +Insert a point into the in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` +- `conePos` - The local index in the cone where the point should be put +- `conePoint` - The mesh point to insert + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetCone()`, `DMPlexSetChart()`, `DMPlexSetConeSize()`, `DMSetUp()` + +# External Links +$(_doc_external("DMPlex/DMPlexInsertCone")) +""" +function DMPlexInsertCone(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, conePos::PetscInt, conePoint::PetscInt) end + +@for_petsc function DMPlexInsertCone(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, conePos::$PetscInt, conePoint::$PetscInt ) + + @chk ccall( + (:DMPlexInsertCone, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt), + dm, p, conePos, conePoint, + ) + + + return nothing +end + +""" + DMPlexInsertConeOrientation(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, conePos::PetscInt, coneOrientation::PetscInt) +Insert a point orientation for the in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` +- `conePos` - The local index in the cone where the point should be put +- `coneOrientation` - The point orientation to insert + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetCone()`, `DMPlexSetChart()`, `DMPlexSetConeSize()`, `DMSetUp()` + +# External Links +$(_doc_external("DMPlex/DMPlexInsertConeOrientation")) +""" +function DMPlexInsertConeOrientation(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, conePos::PetscInt, coneOrientation::PetscInt) end + +@for_petsc function DMPlexInsertConeOrientation(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, conePos::$PetscInt, coneOrientation::$PetscInt ) + + @chk ccall( + (:DMPlexInsertConeOrientation, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt), + dm, p, conePos, coneOrientation, + ) + + + return nothing +end + +""" + cone::Vector{PetscInt},ornt::Vector{PetscInt} = DMPlexGetOrientedCone(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Return the points and orientations on the in + +Not collective + +Input Parameters: +- `dm` - The DMPlex +- `p` - The point, which must lie in the chart set with DMPlexSetChart() + +Output Parameters: +- `cone` - An array of points which are on the in-edges for point `p` +- `ornt` - An array of orientations which are on the in-edges for point `p`. An orientation is an +integer giving the prescription for cone traversal. + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexRestoreOrientedCone()`, `DMPlexGetConeSize()`, `DMPlexGetCone()`, `DMPlexGetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetOrientedCone")) +""" +function DMPlexGetOrientedCone(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMPlexGetOrientedCone(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + cone_ = Ref{Ptr{$PetscInt}}() + ornt_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetOrientedCone, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + dm, p, cone_, ornt_, + ) + + cone = unsafe_wrap(Array, cone_[], VecGetLocalSize(petsclib, x); own = false) + ornt = unsafe_wrap(Array, ornt_[], VecGetLocalSize(petsclib, x); own = false) + + return cone,ornt +end + +""" + DMPlexRestoreOrientedCone(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, cone::Vector{PetscInt}, ornt::Vector{PetscInt}) +Restore the points and orientations on the in + +Not Collective + +Input Parameters: +- `dm` - The DMPlex +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` +- `cone` - An array of points which are on the in-edges for point p +- `ornt` - An array of orientations which are on the in-edges for point `p`. An orientation is an +integer giving the prescription for cone traversal. + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetOrientedCone()`, `DMPlexGetConeSize()`, `DMPlexGetCone()`, `DMPlexGetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreOrientedCone")) +""" +function DMPlexRestoreOrientedCone(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, cone::Vector{PetscInt}, ornt::Vector{PetscInt}) end + +@for_petsc function DMPlexRestoreOrientedCone(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, cone::Vector{$PetscInt}, ornt::Vector{$PetscInt} ) + cone_ = Ref(pointer(cone)) + ornt_ = Ref(pointer(ornt)) + + @chk ccall( + (:DMPlexRestoreOrientedCone, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + dm, p, cone_, ornt_, + ) + + + return nothing +end + +""" + size::PetscInt = DMPlexGetSupportSize(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Return the number of out + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` + +Output Parameter: +- `size` - The support size for point `p` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexSetConeSize()`, `DMPlexSetChart()`, `DMPlexGetConeSize()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetSupportSize")) +""" +function DMPlexGetSupportSize(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMPlexGetSupportSize(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetSupportSize, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, p, size_, + ) + + size = size_[] + + return size +end + +""" + DMPlexSetSupportSize(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, size::PetscInt) +Set the number of out + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` +- `size` - The support size for point `p` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetSupportSize()`, `DMPlexSetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetSupportSize")) +""" +function DMPlexSetSupportSize(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, size::PetscInt) end + +@for_petsc function DMPlexSetSupportSize(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, size::$PetscInt ) + + @chk ccall( + (:DMPlexSetSupportSize, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt), + dm, p, size, + ) + + + return nothing +end + +""" + support::Vector{PetscInt} = DMPlexGetSupport(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Return the points on the out + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` + +Output Parameter: +- `support` - An array of points which are on the out-edges for point `p`, its length is that obtained from `DMPlexGetSupportSize()` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetSupportSize()`, `DMPlexSetSupport()`, `DMPlexGetCone()`, `DMPlexSetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetSupport")) +""" +function DMPlexGetSupport(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMPlexGetSupport(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + support_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetSupport, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{$PetscInt}}), + dm, p, support_, + ) + + support = unsafe_wrap(Array, support_[], VecGetLocalSize(petsclib, x); own = false) + + return support +end + +""" + DMPlexSetSupport(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, support::Vector{PetscInt}) +Set the points on the out + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` +- `support` - An array of points which are on the out-edges for point `p`, its length is that obtained from `DMPlexGetSupportSize()` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetCone()`, `DMPlexSetConeSize()`, `DMPlexCreate()`, `DMPlexGetSupport()`, `DMPlexSetChart()`, `DMPlexSetSupportSize()`, `DMSetUp()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetSupport")) +""" +function DMPlexSetSupport(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, support::Vector{PetscInt}) end + +@for_petsc function DMPlexSetSupport(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, support::Vector{$PetscInt} ) + + @chk ccall( + (:DMPlexSetSupport, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, p, support, + ) + + + return nothing +end + +""" + DMPlexInsertSupport(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, supportPos::PetscInt, supportPoint::PetscInt) +Insert a point into the out + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The point, which must lie in the chart set with `DMPlexSetChart()` +- `supportPos` - The local index in the cone where the point should be put +- `supportPoint` - The mesh point to insert + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexGetCone()`, `DMPlexSetChart()`, `DMPlexSetConeSize()`, `DMSetUp()` + +# External Links +$(_doc_external("DMPlex/DMPlexInsertSupport")) +""" +function DMPlexInsertSupport(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, supportPos::PetscInt, supportPoint::PetscInt) end + +@for_petsc function DMPlexInsertSupport(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, supportPos::$PetscInt, supportPoint::$PetscInt ) + + @chk ccall( + (:DMPlexInsertSupport, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt), + dm, p, supportPos, supportPoint, + ) + + + return nothing +end + +""" + numPoints::PetscInt,points::Vector{PetscInt} = DMPlexGetTransitiveClosure(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, useCone::PetscBool) +Return the points on the transitive closure of the in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The mesh point +- `useCone` - `PETSC_TRUE` for the closure, otherwise return the star + +Input/Output Parameter: +- `points` - The points and point orientations, interleaved as pairs [p0, o0, p1, o1, ...]; +if *points is `NULL` on input, internal storage will be returned, use `DMPlexRestoreTransitiveClosure()`, +otherwise the provided array is used to hold the values + +Output Parameter: +- `numPoints` - The number of points in the closure, so `points` is of size 2*`numPoints` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexRestoreTransitiveClosure()`, `DMPlexCreate()`, `DMPlexSetCone()`, `DMPlexSetChart()`, `DMPlexGetCone()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetTransitiveClosure")) +""" +function DMPlexGetTransitiveClosure(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, useCone::PetscBool) end + +@for_petsc function DMPlexGetTransitiveClosure(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, useCone::PetscBool ) + numPoints_ = Ref{$PetscInt}() + points_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetTransitiveClosure, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscBool, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, p, useCone, numPoints_, points_, + ) + + numPoints = numPoints_[] + points = unsafe_wrap(Array, points_[], VecGetLocalSize(petsclib, x); own = false) + + return numPoints,points +end + +""" + DMPlexRestoreTransitiveClosure(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, useCone::PetscBool, numPoints::PetscInt, points::Vector{PetscInt}) +Restore the array of points on the transitive closure of the in + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `p` - The mesh point +- `useCone` - `PETSC_TRUE` for the closure, otherwise return the star +- `numPoints` - The number of points in the closure, so points[] is of size 2*`numPoints` +- `points` - The points and point orientations, interleaved as pairs [p0, o0, p1, o1, ...] + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetTransitiveClosure()`, `DMPlexCreate()`, `DMPlexSetCone()`, `DMPlexSetChart()`, `DMPlexGetCone()` + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreTransitiveClosure")) +""" +function DMPlexRestoreTransitiveClosure(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, useCone::PetscBool, numPoints::PetscInt, points::Vector{PetscInt}) end + +@for_petsc function DMPlexRestoreTransitiveClosure(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, useCone::PetscBool, numPoints::$PetscInt, points::Vector{$PetscInt} ) + points_ = Ref(pointer(points)) + + @chk ccall( + (:DMPlexRestoreTransitiveClosure, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscBool, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, p, useCone, numPoints, points_, + ) + + + return nothing +end + +""" + maxConeSize::PetscInt,maxSupportSize::PetscInt = DMPlexGetMaxSizes(petsclib::PetscLibType,dm::PetscDM) +Return the maximum number of in + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` + +Output Parameters: +- `maxConeSize` - The maximum number of in-edges +- `maxSupportSize` - The maximum number of out-edges + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexSetConeSize()`, `DMPlexSetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetMaxSizes")) +""" +function DMPlexGetMaxSizes(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetMaxSizes(petsclib::$UnionPetscLib, dm::PetscDM ) + maxConeSize_ = Ref{$PetscInt}() + maxSupportSize_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetMaxSizes, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, maxConeSize_, maxSupportSize_, + ) + + maxConeSize = maxConeSize_[] + maxSupportSize = maxSupportSize_[] + + return maxConeSize,maxSupportSize +end + +""" + DMPlexSymmetrize(petsclib::PetscLibType,dm::PetscDM) +Create support (out + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexSetChart()`, `DMPlexSetConeSize()`, `DMPlexSetCone()` + +# External Links +$(_doc_external("DMPlex/DMPlexSymmetrize")) +""" +function DMPlexSymmetrize(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexSymmetrize(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexSymmetrize, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexStratify(petsclib::PetscLibType,dm::PetscDM) +Computes the strata for all points in the `DMPLEX` + +Collective + +Input Parameter: +- `dm` - The `DMPLEX` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexSymmetrize()`, `DMPlexComputeCellTypes()` + +# External Links +$(_doc_external("DMPlex/DMPlexStratify")) +""" +function DMPlexStratify(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexStratify(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexStratify, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexComputeCellTypes(petsclib::PetscLibType,dm::PetscDM) +Infer the polytope type of every cell using its dimension and cone size. + +Collective + +Input Parameter: +- `dm` - The `DMPLEX` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexSymmetrize()`, `DMPlexStratify()`, `DMGetLabel()`, `DMCreateLabel()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeCellTypes")) +""" +function DMPlexComputeCellTypes(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexComputeCellTypes(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexComputeCellTypes, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + numCoveredPoints::PetscInt,coveredPoints::Vector{PetscInt} = DMPlexGetJoin(petsclib::PetscLibType,dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) +Get an array for the join of the set of points + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `numPoints` - The number of input points for the join +- `points` - The input points + +Output Parameters: +- `numCoveredPoints` - The number of points in the join +- `coveredPoints` - The points in the join + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexRestoreJoin()`, `DMPlexGetMeet()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetJoin")) +""" +function DMPlexGetJoin(petsclib::PetscLibType, dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) end + +@for_petsc function DMPlexGetJoin(petsclib::$UnionPetscLib, dm::PetscDM, numPoints::$PetscInt, points::Vector{$PetscInt} ) + numCoveredPoints_ = Ref{$PetscInt}() + coveredPoints_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetJoin, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, numPoints, points, numCoveredPoints_, coveredPoints_, + ) + + numCoveredPoints = numCoveredPoints_[] + coveredPoints = unsafe_wrap(Array, coveredPoints_[], VecGetLocalSize(petsclib, x); own = false) + + return numCoveredPoints,coveredPoints +end + +""" + numCoveredPoints::PetscInt,coveredPoints::Vector{PetscInt} = DMPlexRestoreJoin(petsclib::PetscLibType,dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) +Restore an array for the join of the set of points obtained with `DMPlexGetJoin()` + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `numPoints` - The number of input points for the join +- `points` - The input points + +Output Parameters: +- `numCoveredPoints` - The number of points in the join +- `coveredPoints` - The points in the join + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetJoin()`, `DMPlexGetFullJoin()`, `DMPlexGetMeet()` + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreJoin")) +""" +function DMPlexRestoreJoin(petsclib::PetscLibType, dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) end + +@for_petsc function DMPlexRestoreJoin(petsclib::$UnionPetscLib, dm::PetscDM, numPoints::$PetscInt, points::Vector{$PetscInt} ) + numCoveredPoints_ = Ref{$PetscInt}() + coveredPoints_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexRestoreJoin, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, numPoints, points, numCoveredPoints_, coveredPoints_, + ) + + numCoveredPoints = numCoveredPoints_[] + coveredPoints = unsafe_wrap(Array, coveredPoints_[], VecGetLocalSize(petsclib, x); own = false) + + return numCoveredPoints,coveredPoints +end + +""" + numCoveredPoints::PetscInt,coveredPoints::Vector{PetscInt} = DMPlexGetFullJoin(petsclib::PetscLibType,dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) +Get an array for the join of the set of points + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `numPoints` - The number of input points for the join +- `points` - The input points, its length is `numPoints` + +Output Parameters: +- `numCoveredPoints` - The number of points in the join +- `coveredPoints` - The points in the join, its length is `numCoveredPoints` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetJoin()`, `DMPlexRestoreJoin()`, `DMPlexGetMeet()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetFullJoin")) +""" +function DMPlexGetFullJoin(petsclib::PetscLibType, dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) end + +@for_petsc function DMPlexGetFullJoin(petsclib::$UnionPetscLib, dm::PetscDM, numPoints::$PetscInt, points::Vector{$PetscInt} ) + numCoveredPoints_ = Ref{$PetscInt}() + coveredPoints_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetFullJoin, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, numPoints, points, numCoveredPoints_, coveredPoints_, + ) + + numCoveredPoints = numCoveredPoints_[] + coveredPoints = unsafe_wrap(Array, coveredPoints_[], VecGetLocalSize(petsclib, x); own = false) + + return numCoveredPoints,coveredPoints +end + +""" + numCoveringPoints::PetscInt,coveringPoints::Vector{PetscInt} = DMPlexGetMeet(petsclib::PetscLibType,dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) +Get an array for the meet of the set of points + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `numPoints` - The number of input points for the meet +- `points` - The input points, of length `numPoints` + +Output Parameters: +- `numCoveringPoints` - The number of points in the meet +- `coveringPoints` - The points in the meet, of length `numCoveringPoints` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexRestoreMeet()`, `DMPlexGetJoin()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetMeet")) +""" +function DMPlexGetMeet(petsclib::PetscLibType, dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) end + +@for_petsc function DMPlexGetMeet(petsclib::$UnionPetscLib, dm::PetscDM, numPoints::$PetscInt, points::Vector{$PetscInt} ) + numCoveringPoints_ = Ref{$PetscInt}() + coveringPoints_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetMeet, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, numPoints, points, numCoveringPoints_, coveringPoints_, + ) + + numCoveringPoints = numCoveringPoints_[] + coveringPoints = unsafe_wrap(Array, coveringPoints_[], VecGetLocalSize(petsclib, x); own = false) + + return numCoveringPoints,coveringPoints +end + +""" + numCoveredPoints::PetscInt,coveredPoints::Vector{PetscInt} = DMPlexRestoreMeet(petsclib::PetscLibType,dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) +Restore an array for the meet of the set of points obtained with `DMPlexGetMeet()` + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `numPoints` - The number of input points for the meet +- `points` - The input points + +Output Parameters: +- `numCoveredPoints` - The number of points in the meet +- `coveredPoints` - The points in the meet + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetMeet()`, `DMPlexGetFullMeet()`, `DMPlexGetJoin()` + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreMeet")) +""" +function DMPlexRestoreMeet(petsclib::PetscLibType, dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) end + +@for_petsc function DMPlexRestoreMeet(petsclib::$UnionPetscLib, dm::PetscDM, numPoints::$PetscInt, points::Vector{$PetscInt} ) + numCoveredPoints_ = Ref{$PetscInt}() + coveredPoints_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexRestoreMeet, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, numPoints, points, numCoveredPoints_, coveredPoints_, + ) + + numCoveredPoints = numCoveredPoints_[] + coveredPoints = unsafe_wrap(Array, coveredPoints_[], VecGetLocalSize(petsclib, x); own = false) + + return numCoveredPoints,coveredPoints +end + +""" + numCoveredPoints::PetscInt,coveredPoints::Vector{PetscInt} = DMPlexGetFullMeet(petsclib::PetscLibType,dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) +Get an array for the meet of the set of points + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `numPoints` - The number of input points for the meet +- `points` - The input points, of length `numPoints` + +Output Parameters: +- `numCoveredPoints` - The number of points in the meet +- `coveredPoints` - The points in the meet, of length `numCoveredPoints` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetMeet()`, `DMPlexRestoreMeet()`, `DMPlexGetJoin()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetFullMeet")) +""" +function DMPlexGetFullMeet(petsclib::PetscLibType, dm::PetscDM, numPoints::PetscInt, points::Vector{PetscInt}) end + +@for_petsc function DMPlexGetFullMeet(petsclib::$UnionPetscLib, dm::PetscDM, numPoints::$PetscInt, points::Vector{$PetscInt} ) + numCoveredPoints_ = Ref{$PetscInt}() + coveredPoints_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetFullMeet, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, numPoints, points, numCoveredPoints_, coveredPoints_, + ) + + numCoveredPoints = numCoveredPoints_[] + coveredPoints = unsafe_wrap(Array, coveredPoints_[], VecGetLocalSize(petsclib, x); own = false) + + return numCoveredPoints,coveredPoints +end + +""" + equal::PetscBool = DMPlexEqual(petsclib::PetscLibType,dmA::PetscDM, dmB::PetscDM) +Determine if two `DM` have the same topology + +Not Collective + +Input Parameters: +- `dmA` - A `DMPLEX` object +- `dmB` - A `DMPLEX` object + +Output Parameter: +- `equal` - `PETSC_TRUE` if the topologies are identical + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCone()` + +# External Links +$(_doc_external("DMPlex/DMPlexEqual")) +""" +function DMPlexEqual(petsclib::PetscLibType, dmA::PetscDM, dmB::PetscDM) end + +@for_petsc function DMPlexEqual(petsclib::$UnionPetscLib, dmA::PetscDM, dmB::PetscDM ) + equal_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexEqual, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{PetscBool}), + dmA, dmB, equal_, + ) + + equal = equal_[] + + return equal +end + +""" + numFaceVertices::PetscInt = DMPlexGetNumFaceVertices(petsclib::PetscLibType,dm::PetscDM, cellDim::PetscInt, numCorners::PetscInt) +Returns the number of vertices on a face + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `cellDim` - The cell dimension +- `numCorners` - The number of vertices on a cell + +Output Parameter: +- `numFaceVertices` - The number of vertices on a face + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCone()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetNumFaceVertices")) +""" +function DMPlexGetNumFaceVertices(petsclib::PetscLibType, dm::PetscDM, cellDim::PetscInt, numCorners::PetscInt) end + +@for_petsc function DMPlexGetNumFaceVertices(petsclib::$UnionPetscLib, dm::PetscDM, cellDim::$PetscInt, numCorners::$PetscInt ) + numFaceVertices_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetNumFaceVertices, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscInt}), + dm, cellDim, numCorners, numFaceVertices_, + ) + + numFaceVertices = numFaceVertices_[] + + return numFaceVertices +end + +""" + DMPlexGetDepthLabel(petsclib::PetscLibType,dm::PetscDM, depthLabel::DMLabel) +Get the `DMLabel` recording the depth of each point + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `depthLabel` - The `DMLabel` recording point depth + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetDepth()`, `DMPlexGetHeightStratum()`, `DMPlexGetDepthStratum()`, `DMPlexGetPointDepth()`, + +# External Links +$(_doc_external("DMPlex/DMPlexGetDepthLabel")) +""" +function DMPlexGetDepthLabel(petsclib::PetscLibType, dm::PetscDM, depthLabel::DMLabel) end + +@for_petsc function DMPlexGetDepthLabel(petsclib::$UnionPetscLib, dm::PetscDM, depthLabel::DMLabel ) + + @chk ccall( + (:DMPlexGetDepthLabel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMLabel}), + dm, depthLabel, + ) + + + return nothing +end + +""" + depth::PetscInt = DMPlexGetDepth(petsclib::PetscLibType,dm::PetscDM) +Get the depth of the DAG representing this mesh + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `depth` - The number of strata (breadth first levels) in the DAG + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetDepthLabel()`, `DMPlexGetDepthStratum()`, `DMPlexGetPointDepth()`, `DMPlexSymmetrize()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetDepth")) +""" +function DMPlexGetDepth(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetDepth(petsclib::$UnionPetscLib, dm::PetscDM ) + depth_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetDepth, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, depth_, + ) + + depth = depth_[] + + return depth +end + +""" + start::PetscInt,end_::PetscInt = DMPlexGetDepthStratum(petsclib::PetscLibType,dm::PetscDM, depth::PetscInt) +Get the bounds [`start`, `end`) for all points at a certain depth. + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `depth` - The requested depth + +Output Parameters: +- `start` - The first point at this `depth` +- `end` - One beyond the last point at this `depth` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetHeightStratum()`, `DMPlexGetCellTypeStratum()`, `DMPlexGetDepth()`, `DMPlexGetDepthLabel()`, `DMPlexGetPointDepth()`, `DMPlexSymmetrize()`, `DMPlexInterpolate()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetDepthStratum")) +""" +function DMPlexGetDepthStratum(petsclib::PetscLibType, dm::PetscDM, depth::PetscInt) end + +@for_petsc function DMPlexGetDepthStratum(petsclib::$UnionPetscLib, dm::PetscDM, depth::$PetscInt ) + start__ = Ref{$PetscInt}() + end__ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetDepthStratum, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, depth, start__, end__, + ) + + start_ = start__[] + end_ = end__[] + + return start_,end_ +end + +""" + start::PetscInt,end_::PetscInt = DMPlexGetHeightStratum(petsclib::PetscLibType,dm::PetscDM, height::PetscInt) +Get the bounds [`start`, `end`) for all points at a certain height. + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `height` - The requested height + +Output Parameters: +- `start` - The first point at this `height` +- `end` - One beyond the last point at this `height` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetDepthStratum()`, `DMPlexGetCellTypeStratum()`, `DMPlexGetDepth()`, `DMPlexGetPointHeight()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetHeightStratum")) +""" +function DMPlexGetHeightStratum(petsclib::PetscLibType, dm::PetscDM, height::PetscInt) end + +@for_petsc function DMPlexGetHeightStratum(petsclib::$UnionPetscLib, dm::PetscDM, height::$PetscInt ) + start_ = Ref{$PetscInt}() + end__ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetHeightStratum, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, height, start_, end__, + ) + + start = start_[] + end_ = end__[] + + return start,end_ +end + +""" + depth::PetscInt = DMPlexGetPointDepth(petsclib::PetscLibType,dm::PetscDM, point::PetscInt) +Get the `depth` of a given point + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `point` - The point + +Output Parameter: +- `depth` - The depth of the `point` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellType()`, `DMPlexGetDepthLabel()`, `DMPlexGetDepth()`, `DMPlexGetPointHeight()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetPointDepth")) +""" +function DMPlexGetPointDepth(petsclib::PetscLibType, dm::PetscDM, point::PetscInt) end + +@for_petsc function DMPlexGetPointDepth(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt ) + depth_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetPointDepth, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, point, depth_, + ) + + depth = depth_[] + + return depth +end + +""" + height::PetscInt = DMPlexGetPointHeight(petsclib::PetscLibType,dm::PetscDM, point::PetscInt) +Get the `height` of a given point + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `point` - The point + +Output Parameter: +- `height` - The height of the `point` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellType()`, `DMPlexGetDepthLabel()`, `DMPlexGetDepth()`, `DMPlexGetPointDepth()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetPointHeight")) +""" +function DMPlexGetPointHeight(petsclib::PetscLibType, dm::PetscDM, point::PetscInt) end + +@for_petsc function DMPlexGetPointHeight(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt ) + height_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetPointHeight, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, point, height_, + ) + + height = height_[] + + return height +end + +""" + celltypeLabel::DMLabel = DMPlexGetCellTypeLabel(petsclib::PetscLibType,dm::PetscDM) +Get the `DMLabel` recording the polytope type of each cell + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `celltypeLabel` - The `DMLabel` recording cell polytope type + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellType()`, `DMPlexGetDepthLabel()`, `DMCreateLabel()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetCellTypeLabel")) +""" +function DMPlexGetCellTypeLabel(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetCellTypeLabel(petsclib::$UnionPetscLib, dm::PetscDM ) + celltypeLabel_ = Ref{DMLabel}() + + @chk ccall( + (:DMPlexGetCellTypeLabel, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMLabel}), + dm, celltypeLabel_, + ) + + celltypeLabel = celltypeLabel_[] + + return celltypeLabel +end + +""" + celltype::DMPolytopeType = DMPlexGetCellType(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt) +Get the polytope type of a given cell + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `cell` - The cell + +Output Parameter: +- `celltype` - The polytope type of the cell + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPolytopeType`, `DMPlexGetCellTypeLabel()`, `DMPlexGetDepthLabel()`, `DMPlexGetDepth()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetCellType")) +""" +function DMPlexGetCellType(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt) end + +@for_petsc function DMPlexGetCellType(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt ) + celltype_ = Ref{DMPolytopeType}() + + @chk ccall( + (:DMPlexGetCellType, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{DMPolytopeType}), + dm, cell, celltype_, + ) + + celltype = celltype_[] + + return celltype +end + +""" + DMPlexSetCellType(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt, celltype::DMPolytopeType) +Set the polytope type of a given cell + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `cell` - The cell +- `celltype` - The polytope type of the cell + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellTypeLabel()`, `DMPlexGetDepthLabel()`, `DMPlexGetDepth()`, `DMPlexComputeCellTypes()`, `DMCreateLabel()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetCellType")) +""" +function DMPlexSetCellType(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt, celltype::DMPolytopeType) end + +@for_petsc function DMPlexSetCellType(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt, celltype::DMPolytopeType ) + + @chk ccall( + (:DMPlexSetCellType, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, DMPolytopeType), + dm, cell, celltype, + ) + + + return nothing +end + +""" + DMPlexGetConeSection(petsclib::PetscLibType,dm::PetscDM, section::PetscSection) +Return a section which describes the layout of cone data + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `section` - The `PetscSection` object + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetSupportSection()`, `DMPlexGetCones()`, `DMPlexGetConeOrientations()`, `PetscSection` + +# External Links +$(_doc_external("DMPlex/DMPlexGetConeSection")) +""" +function DMPlexGetConeSection(petsclib::PetscLibType, dm::PetscDM, section::PetscSection) end + +@for_petsc function DMPlexGetConeSection(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection ) + + @chk ccall( + (:DMPlexGetConeSection, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSection}), + dm, section, + ) + + + return nothing +end + +""" + DMPlexGetSupportSection(petsclib::PetscLibType,dm::PetscDM, section::PetscSection) +Return a section which describes the layout of support data + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `section` - The `PetscSection` object + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetConeSection()`, `PetscSection` + +# External Links +$(_doc_external("DMPlex/DMPlexGetSupportSection")) +""" +function DMPlexGetSupportSection(petsclib::PetscLibType, dm::PetscDM, section::PetscSection) end + +@for_petsc function DMPlexGetSupportSection(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection ) + + @chk ccall( + (:DMPlexGetSupportSection, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSection}), + dm, section, + ) + + + return nothing +end + +""" + cones::Vector{PetscInt} = DMPlexGetCones(petsclib::PetscLibType,dm::PetscDM) +Return cone data + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `cones` - The cone for each point + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetConeSection()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetCones")) +""" +function DMPlexGetCones(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetCones(petsclib::$UnionPetscLib, dm::PetscDM ) + cones_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetCones, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{$PetscInt}}), + dm, cones_, + ) + + cones = unsafe_wrap(Array, cones_[], VecGetLocalSize(petsclib, x); own = false) + + return cones +end + +""" + coneOrientations::Vector{PetscInt} = DMPlexGetConeOrientations(petsclib::PetscLibType,dm::PetscDM) +Return cone orientation data + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `coneOrientations` - The array of cone orientations for all points + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetConeSection()`, `DMPlexGetConeOrientation()`, `PetscSection` + +# External Links +$(_doc_external("DMPlex/DMPlexGetConeOrientations")) +""" +function DMPlexGetConeOrientations(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetConeOrientations(petsclib::$UnionPetscLib, dm::PetscDM ) + coneOrientations_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetConeOrientations, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{$PetscInt}}), + dm, coneOrientations_, + ) + + coneOrientations = unsafe_wrap(Array, coneOrientations_[], VecGetLocalSize(petsclib, x); own = false) + + return coneOrientations +end + +""" + DMPlexSetClosurePermutationTensor(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, section::PetscSection) +Create a permutation from the default (BFS) point ordering in the closure, to a +lexicographic ordering over the tensor product cell (i.e., line, quad, hex, etc.), and set this permutation in the +section provided (or the section of the `DM`). + +Input Parameters: +- `dm` - The `DM` +- `point` - Either a cell (highest dim point) or an edge (dim 1 point), or `PETSC_DETERMINE` +- `section` - The `PetscSection` to reorder, or `NULL` for the default section + +Example: +A typical interpolated single-quad mesh might order points as +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetLocalSection()`, `PetscSectionSetClosurePermutation()`, `DMSetGlobalSection()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetClosurePermutationTensor")) +""" +function DMPlexSetClosurePermutationTensor(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, section::PetscSection) end + +@for_petsc function DMPlexSetClosurePermutationTensor(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, section::PetscSection ) + + @chk ccall( + (:DMPlexSetClosurePermutationTensor, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscSection), + dm, point, section, + ) + + + return nothing +end + +""" + numPoints::PetscInt = DMPlexGetCompressedClosure(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, point::PetscInt, ornt::PetscInt, points::PetscInt, clSec::PetscSection, clPoints::IS, clp::PetscInt) + +# External Links +$(_doc_external("DMPlex/DMPlexGetCompressedClosure")) +""" +function DMPlexGetCompressedClosure(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, point::PetscInt, ornt::PetscInt, points::PetscInt, clSec::PetscSection, clPoints::IS, clp::PetscInt) end + +@for_petsc function DMPlexGetCompressedClosure(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, point::$PetscInt, ornt::$PetscInt, points::$PetscInt, clSec::PetscSection, clPoints::IS, clp::$PetscInt ) + numPoints_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetCompressedClosure, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{PetscSection}, Ptr{CIS}, $PetscInt), + dm, section, point, ornt, numPoints_, points, clSec, clPoints, clp, + ) + + numPoints = numPoints_[] + + return numPoints +end + +""" + numPoints::PetscInt = DMPlexRestoreCompressedClosure(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, point::PetscInt, points::PetscInt, clSec::PetscSection, clPoints::IS, clp::PetscInt) + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreCompressedClosure")) +""" +function DMPlexRestoreCompressedClosure(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, point::PetscInt, points::PetscInt, clSec::PetscSection, clPoints::IS, clp::PetscInt) end + +@for_petsc function DMPlexRestoreCompressedClosure(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, point::$PetscInt, points::$PetscInt, clSec::PetscSection, clPoints::IS, clp::$PetscInt ) + numPoints_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexRestoreCompressedClosure, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{PetscSection}, Ptr{CIS}, $PetscInt), + dm, section, point, numPoints_, points, clSec, clPoints, clp, + ) + + numPoints = numPoints_[] + + return numPoints +end + +""" + csize::PetscInt,values::Vector{PetscScalar} = DMPlexVecGetOrientedClosure(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, useClPerm::PetscBool, v::PetscVec, point::PetscInt, ornt::PetscInt) +Get an array of the values on the closure of 'point' with a given orientation, optionally applying the closure permutation. + +Not collective + +Input Parameters: +- `dm` - The `DM` +- `section` - The section describing the layout in `v`, or `NULL` to use the default section +- `useClPerm` - Flag for whether the provided closure permutation should be applied to the values +- `v` - The local vector +- `point` - The point in the `DM` +- `ornt` - The orientation of the cell, an integer giving the prescription for cone traversal. Typically, this will be 0. + +Input/Output Parameters: +- `csize` - The size of the input values array, or `NULL`; on output the number of values in the closure +- `values` - An array to use for the values, or *values = `NULL` to have it allocated automatically; +if the user provided `NULL`, it is a borrowed array and should not be freed, use `DMPlexVecRestoreClosure()` to return it + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexVecGetClosure()`, `DMPlexGetCellCoordinates()`, `DMPlexVecRestoreClosure()`, `DMPlexVecSetClosure()` + +# External Links +$(_doc_external("DMPlex/DMPlexVecGetOrientedClosure")) +""" +function DMPlexVecGetOrientedClosure(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, useClPerm::PetscBool, v::PetscVec, point::PetscInt, ornt::PetscInt) end + +@for_petsc function DMPlexVecGetOrientedClosure(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, useClPerm::PetscBool, v::PetscVec, point::$PetscInt, ornt::$PetscInt ) + csize_ = Ref{$PetscInt}() + values_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexVecGetOrientedClosure, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, PetscBool, CVec, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + dm, section, useClPerm, v, point, ornt, csize_, values_, + ) + + csize = csize_[] + values = unsafe_wrap(Array, values_[], VecGetLocalSize(petsclib, x); own = false) + + return csize,values +end + +""" + csize::PetscInt,values::Vector{PetscScalar} = DMPlexVecGetClosure(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, v::PetscVec, point::PetscInt) +Get an array of the values on the closure of 'point' + +Not collective + +Input Parameters: +- `dm` - The `DM` +- `section` - The section describing the layout in `v`, or `NULL` to use the default section +- `v` - The local vector +- `point` - The point in the `DM` + +Input/Output Parameters: +- `csize` - The size of the input values array, or `NULL`; on output the number of values in the closure +- `values` - An array to use for the values, or *values = `NULL` to have it allocated automatically; +if the user provided `NULL`, it is a borrowed array and should not be freed, use `DMPlexVecRestoreClosure()` to return it + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexVecRestoreClosure()`, `DMPlexVecSetClosure()`, `DMPlexMatSetClosure()` + +# External Links +$(_doc_external("DMPlex/DMPlexVecGetClosure")) +""" +function DMPlexVecGetClosure(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, v::PetscVec, point::PetscInt) end + +@for_petsc function DMPlexVecGetClosure(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, v::PetscVec, point::$PetscInt ) + csize_ = Ref{$PetscInt}() + values_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexVecGetClosure, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, CVec, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + dm, section, v, point, csize_, values_, + ) + + csize = csize_[] + values = unsafe_wrap(Array, values_[], VecGetLocalSize(petsclib, x); own = false) + + return csize,values +end + +""" + DMPlexVecRestoreClosure(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, v::PetscVec, point::PetscInt, csize::PetscInt, values::Vector{PetscScalar}) +Restore the array of the values on the closure of 'point' obtained with `DMPlexVecGetClosure()` + +Not collective + +Input Parameters: +- `dm` - The `DM` +- `section` - The section describing the layout in `v`, or `NULL` to use the default section +- `v` - The local vector +- `point` - The point in the `DM` +- `csize` - The number of values in the closure, or `NULL` +- `values` - The array of values + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexVecGetClosure()`, `DMPlexVecSetClosure()`, `DMPlexMatSetClosure()` + +# External Links +$(_doc_external("DMPlex/DMPlexVecRestoreClosure")) +""" +function DMPlexVecRestoreClosure(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, v::PetscVec, point::PetscInt, csize::PetscInt, values::Vector{PetscScalar}) end + +@for_petsc function DMPlexVecRestoreClosure(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, v::PetscVec, point::$PetscInt, csize::$PetscInt, values::Vector{$PetscScalar} ) + values_ = Ref(pointer(values)) + + @chk ccall( + (:DMPlexVecRestoreClosure, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, CVec, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + dm, section, v, point, csize, values_, + ) + + + return nothing +end + +""" + DMPlexVecSetClosure(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, v::PetscVec, point::PetscInt, values::Vector{PetscScalar}, mode::InsertMode) +Set an array of the values on the closure of `point` + +Not collective + +Input Parameters: +- `dm` - The `DM` +- `section` - The section describing the layout in `v`, or `NULL` to use the default section +- `v` - The local vector +- `point` - The point in the `DM` +- `values` - The array of values +- `mode` - The insert mode. One of `INSERT_ALL_VALUES`, `ADD_ALL_VALUES`, `INSERT_VALUES`, `ADD_VALUES`, `INSERT_BC_VALUES`, and `ADD_BC_VALUES`, +where `INSERT_ALL_VALUES` and `ADD_ALL_VALUES` also overwrite boundary conditions. + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexVecGetClosure()`, `DMPlexMatSetClosure()` + +# External Links +$(_doc_external("DMPlex/DMPlexVecSetClosure")) +""" +function DMPlexVecSetClosure(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, v::PetscVec, point::PetscInt, values::Vector{PetscScalar}, mode::InsertMode) end + +@for_petsc function DMPlexVecSetClosure(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, v::PetscVec, point::$PetscInt, values::Vector{$PetscScalar}, mode::InsertMode ) + + @chk ccall( + (:DMPlexVecSetClosure, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, CVec, $PetscInt, Ptr{$PetscScalar}, InsertMode), + dm, section, v, point, values, mode, + ) + + + return nothing +end + +""" + numIndices::PetscInt,indices::Vector{PetscInt},outOffsets::Vector{PetscInt},values::Vector{PetscScalar} = DMPlexGetClosureIndices(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, idxSection::PetscSection, point::PetscInt, useClPerm::PetscBool) +Gets the global dof indices associated with the closure of the given point within the provided sections. + +Not collective + +Input Parameters: +- `dm` - The `DM` +- `section` - The `PetscSection` describing the points (a local section) +- `idxSection` - The `PetscSection` from which to obtain indices (may be local or global) +- `point` - The point defining the closure +- `useClPerm` - Use the closure point permutation if available + +Output Parameters: +- `numIndices` - The number of dof indices in the closure of point with the input sections +- `indices` - The dof indices +- `outOffsets` - Array, of length the number of fields plus 1, to write the field offsets into, or `NULL` +- `values` - The input values, which may be modified if sign flips are induced by the point symmetries, or `NULL` + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexRestoreClosureIndices()`, `DMPlexVecGetClosure()`, `DMPlexMatSetClosure()`, `DMGetLocalSection()`, +`PetscSection`, `DMGetGlobalSection()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetClosureIndices")) +""" +function DMPlexGetClosureIndices(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, idxSection::PetscSection, point::PetscInt, useClPerm::PetscBool) end + +@for_petsc function DMPlexGetClosureIndices(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, idxSection::PetscSection, point::$PetscInt, useClPerm::PetscBool ) + numIndices_ = Ref{$PetscInt}() + indices_ = Ref{Ptr{$PetscInt}}() + outOffsets = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + values_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexGetClosureIndices, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, PetscSection, $PetscInt, PetscBool, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + dm, section, idxSection, point, useClPerm, numIndices_, indices_, outOffsets, values_, + ) + + numIndices = numIndices_[] + indices = unsafe_wrap(Array, indices_[], VecGetLocalSize(petsclib, x); own = false) + values = unsafe_wrap(Array, values_[], VecGetLocalSize(petsclib, x); own = false) + + return numIndices,indices,outOffsets,values +end + +""" + numIndices::PetscInt,indices::Vector{PetscInt},outOffsets::Vector{PetscInt},values::Vector{PetscScalar} = DMPlexRestoreClosureIndices(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, idxSection::PetscSection, point::PetscInt, useClPerm::PetscBool) +Restores the global dof indices associated with the closure of the given point within the provided sections. + +Not collective + +Input Parameters: +- `dm` - The `DM` +- `section` - The `PetscSection` describing the points (a local section) +- `idxSection` - The `PetscSection` from which to obtain indices (may be local or global) +- `point` - The point defining the closure +- `useClPerm` - Use the closure point permutation if available + +Output Parameters: +- `numIndices` - The number of dof indices in the closure of point with the input sections +- `indices` - The dof indices +- `outOffsets` - Array to write the field offsets into, or `NULL` +- `values` - The input values, which may be modified if sign flips are induced by the point symmetries, or `NULL` + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetClosureIndices()`, `DMPlexVecGetClosure()`, `DMPlexMatSetClosure()`, `DMGetLocalSection()`, `DMGetGlobalSection()` + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreClosureIndices")) +""" +function DMPlexRestoreClosureIndices(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, idxSection::PetscSection, point::PetscInt, useClPerm::PetscBool) end + +@for_petsc function DMPlexRestoreClosureIndices(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, idxSection::PetscSection, point::$PetscInt, useClPerm::PetscBool ) + numIndices_ = Ref{$PetscInt}() + indices_ = Ref{Ptr{$PetscInt}}() + outOffsets = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + values_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexRestoreClosureIndices, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, PetscSection, $PetscInt, PetscBool, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + dm, section, idxSection, point, useClPerm, numIndices_, indices_, outOffsets, values_, + ) + + numIndices = numIndices_[] + indices = unsafe_wrap(Array, indices_[], VecGetLocalSize(petsclib, x); own = false) + values = unsafe_wrap(Array, values_[], VecGetLocalSize(petsclib, x); own = false) + + return numIndices,indices,outOffsets,values +end + +""" + DMPlexMatSetClosure(petsclib::PetscLibType,dm::PetscDM, section::PetscSection, globalSection::PetscSection, A::PetscMat, point::PetscInt, values::Vector{PetscScalar}, mode::InsertMode) +Set an array of the values on the closure of 'point' + +Not collective + +Input Parameters: +- `dm` - The `DM` +- `section` - The section describing the layout in `v`, or `NULL` to use the default section +- `globalSection` - The section describing the layout in `v`, or `NULL` to use the default global section +- `A` - The matrix +- `point` - The point in the `DM` +- `values` - The array of values +- `mode` - The insert mode, where `INSERT_ALL_VALUES` and `ADD_ALL_VALUES` also overwrite boundary conditions + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexMatSetClosureGeneral()`, `DMPlexVecGetClosure()`, `DMPlexVecSetClosure()` + +# External Links +$(_doc_external("DMPlex/DMPlexMatSetClosure")) +""" +function DMPlexMatSetClosure(petsclib::PetscLibType, dm::PetscDM, section::PetscSection, globalSection::PetscSection, A::PetscMat, point::PetscInt, values::Vector{PetscScalar}, mode::InsertMode) end + +@for_petsc function DMPlexMatSetClosure(petsclib::$UnionPetscLib, dm::PetscDM, section::PetscSection, globalSection::PetscSection, A::PetscMat, point::$PetscInt, values::Vector{$PetscScalar}, mode::InsertMode ) + + @chk ccall( + (:DMPlexMatSetClosure, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, PetscSection, CMat, $PetscInt, Ptr{$PetscScalar}, InsertMode), + dm, section, globalSection, A, point, values, mode, + ) + + + return nothing +end + +""" + DMPlexMatSetClosureGeneral(petsclib::PetscLibType,dmRow::PetscDM, sectionRow::PetscSection, globalSectionRow::PetscSection, useRowPerm::PetscBool, dmCol::PetscDM, sectionCol::PetscSection, globalSectionCol::PetscSection, useColPerm::PetscBool, A::PetscMat, point::PetscInt, values::Vector{PetscScalar}, mode::InsertMode) +Set an array of the values on the closure of 'point' using a different row and column section + +Not collective + +Input Parameters: +- `dmRow` - The `DM` for the row fields +- `sectionRow` - The section describing the layout, or `NULL` to use the default section in `dmRow` +- `useRowPerm` - The flag to use the closure permutation of the `dmRow` if available +- `globalSectionRow` - The section describing the layout, or `NULL` to use the default global section in `dmRow` +- `dmCol` - The `DM` for the column fields +- `sectionCol` - The section describing the layout, or `NULL` to use the default section in `dmCol` +- `useColPerm` - The flag to use the closure permutation of the `dmCol` if available +- `globalSectionCol` - The section describing the layout, or `NULL` to use the default global section in `dmCol` +- `A` - The matrix +- `point` - The point in the `DM` +- `values` - The array of values +- `mode` - The insert mode, where `INSERT_ALL_VALUES` and `ADD_ALL_VALUES` also overwrite boundary conditions + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexMatSetClosure()`, `DMPlexVecGetClosure()`, `DMPlexVecSetClosure()` + +# External Links +$(_doc_external("DMPlex/DMPlexMatSetClosureGeneral")) +""" +function DMPlexMatSetClosureGeneral(petsclib::PetscLibType, dmRow::PetscDM, sectionRow::PetscSection, globalSectionRow::PetscSection, useRowPerm::PetscBool, dmCol::PetscDM, sectionCol::PetscSection, globalSectionCol::PetscSection, useColPerm::PetscBool, A::PetscMat, point::PetscInt, values::Vector{PetscScalar}, mode::InsertMode) end + +@for_petsc function DMPlexMatSetClosureGeneral(petsclib::$UnionPetscLib, dmRow::PetscDM, sectionRow::PetscSection, globalSectionRow::PetscSection, useRowPerm::PetscBool, dmCol::PetscDM, sectionCol::PetscSection, globalSectionCol::PetscSection, useColPerm::PetscBool, A::PetscMat, point::$PetscInt, values::Vector{$PetscScalar}, mode::InsertMode ) + + @chk ccall( + (:DMPlexMatSetClosureGeneral, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, PetscSection, PetscBool, CDM, PetscSection, PetscSection, PetscBool, CMat, $PetscInt, Ptr{$PetscScalar}, InsertMode), + dmRow, sectionRow, globalSectionRow, useRowPerm, dmCol, sectionCol, globalSectionCol, useColPerm, A, point, values, mode, + ) + + + return nothing +end + +""" + DMPlexMatSetClosureRefined(petsclib::PetscLibType,dmf::PetscDM, fsection::PetscSection, globalFSection::PetscSection, dmc::PetscDM, csection::PetscSection, globalCSection::PetscSection, A::PetscMat, point::PetscInt, values::Vector{PetscScalar}, mode::InsertMode) + +# External Links +$(_doc_external("DMPlex/DMPlexMatSetClosureRefined")) +""" +function DMPlexMatSetClosureRefined(petsclib::PetscLibType, dmf::PetscDM, fsection::PetscSection, globalFSection::PetscSection, dmc::PetscDM, csection::PetscSection, globalCSection::PetscSection, A::PetscMat, point::PetscInt, values::Vector{PetscScalar}, mode::InsertMode) end + +@for_petsc function DMPlexMatSetClosureRefined(petsclib::$UnionPetscLib, dmf::PetscDM, fsection::PetscSection, globalFSection::PetscSection, dmc::PetscDM, csection::PetscSection, globalCSection::PetscSection, A::PetscMat, point::$PetscInt, values::Vector{$PetscScalar}, mode::InsertMode ) + + @chk ccall( + (:DMPlexMatSetClosureRefined, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, PetscSection, CDM, PetscSection, PetscSection, CMat, $PetscInt, Ptr{$PetscScalar}, InsertMode), + dmf, fsection, globalFSection, dmc, csection, globalCSection, A, point, values, mode, + ) + + + return nothing +end + +""" + DMPlexMatGetClosureIndicesRefined(petsclib::PetscLibType,dmf::PetscDM, fsection::PetscSection, globalFSection::PetscSection, dmc::PetscDM, csection::PetscSection, globalCSection::PetscSection, point::PetscInt, cindices::Vector{PetscInt}, findices::Vector{PetscInt}) + +# External Links +$(_doc_external("DMPlex/DMPlexMatGetClosureIndicesRefined")) +""" +function DMPlexMatGetClosureIndicesRefined(petsclib::PetscLibType, dmf::PetscDM, fsection::PetscSection, globalFSection::PetscSection, dmc::PetscDM, csection::PetscSection, globalCSection::PetscSection, point::PetscInt, cindices::Vector{PetscInt}, findices::Vector{PetscInt}) end + +@for_petsc function DMPlexMatGetClosureIndicesRefined(petsclib::$UnionPetscLib, dmf::PetscDM, fsection::PetscSection, globalFSection::PetscSection, dmc::PetscDM, csection::PetscSection, globalCSection::PetscSection, point::$PetscInt, cindices::Vector{$PetscInt}, findices::Vector{$PetscInt} ) + + @chk ccall( + (:DMPlexMatGetClosureIndicesRefined, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, PetscSection, CDM, PetscSection, PetscSection, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dmf, fsection, globalFSection, dmc, csection, globalCSection, point, cindices, findices, + ) + + + return nothing +end + +""" + cellHeight::PetscInt = DMPlexGetVTKCellHeight(petsclib::PetscLibType,dm::PetscDM) +Returns the height in the DAG used to determine which points are cells (normally 0) + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `cellHeight` - The height of a cell + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetVTKCellHeight()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetVTKCellHeight")) +""" +function DMPlexGetVTKCellHeight(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetVTKCellHeight(petsclib::$UnionPetscLib, dm::PetscDM ) + cellHeight_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetVTKCellHeight, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, cellHeight_, + ) + + cellHeight = cellHeight_[] + + return cellHeight +end + +""" + DMPlexSetVTKCellHeight(petsclib::PetscLibType,dm::PetscDM, cellHeight::PetscInt) +Sets the height in the DAG used to determine which points are cells (normally 0) + +Input Parameters: +- `dm` - The `DMPLEX` object +- `cellHeight` - The height of a cell + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetVTKCellHeight()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetVTKCellHeight")) +""" +function DMPlexSetVTKCellHeight(petsclib::PetscLibType, dm::PetscDM, cellHeight::PetscInt) end + +@for_petsc function DMPlexSetVTKCellHeight(petsclib::$UnionPetscLib, dm::PetscDM, cellHeight::$PetscInt ) + + @chk ccall( + (:DMPlexSetVTKCellHeight, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, cellHeight, + ) + + + return nothing +end + +""" + start::PetscInt,end_::PetscInt = DMPlexGetCellTypeStratum(petsclib::PetscLibType,dm::PetscDM, ct::DMPolytopeType) +Get the range of cells of a given celltype + +Input Parameters: +- `dm` - The `DMPLEX` object +- `ct` - The `DMPolytopeType` of the cell + +Output Parameters: +- `start` - The first cell of this type, or `NULL` +- `end` - The upper bound on this celltype, or `NULL` + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexConstructGhostCells()`, `DMPlexGetDepthStratum()`, `DMPlexGetHeightStratum()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetCellTypeStratum")) +""" +function DMPlexGetCellTypeStratum(petsclib::PetscLibType, dm::PetscDM, ct::DMPolytopeType) end + +@for_petsc function DMPlexGetCellTypeStratum(petsclib::$UnionPetscLib, dm::PetscDM, ct::DMPolytopeType ) + start_ = Ref{$PetscInt}() + end__ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetCellTypeStratum, $petsc_library), + PetscErrorCode, + (CDM, DMPolytopeType, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, ct, start_, end__, + ) + + start = start_[] + end_ = end__[] + + return start,end_ +end + +""" + gsize::PetscInt = DMPlexGetDepthStratumGlobalSize(petsclib::PetscLibType,dm::PetscDM, depth::PetscInt) +Get the global size for a given depth stratum + +Input Parameters: +- `dm` - The `DMPLEX` object +- `depth` - The depth for the given point stratum + +Output Parameter: +- `gsize` - The global number of points in the stratum + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellNumbering()`, `DMPlexGetVertexNumbering()`, `DMPlexGetDepthStratum()`, `DMPlexGetHeightStratum()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetDepthStratumGlobalSize")) +""" +function DMPlexGetDepthStratumGlobalSize(petsclib::PetscLibType, dm::PetscDM, depth::PetscInt) end + +@for_petsc function DMPlexGetDepthStratumGlobalSize(petsclib::$UnionPetscLib, dm::PetscDM, depth::$PetscInt ) + gsize_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetDepthStratumGlobalSize, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, depth, gsize_, + ) + + gsize = gsize_[] + + return gsize +end + +""" + globalCellNumbers::IS = DMPlexCreateCellNumbering(petsclib::PetscLibType,dm::PetscDM, includeAll::PetscBool) +Get a global cell numbering for all cells on this process + +Input Parameters: +- `dm` - The `DMPLEX` object +- `includeAll` - Whether to include all cells, or just the simplex and box cells + +Output Parameter: +- `globalCellNumbers` - Global cell numbers for all cells on this process + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellNumbering()`, `DMPlexGetVertexNumbering()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateCellNumbering")) +""" +function DMPlexCreateCellNumbering(petsclib::PetscLibType, dm::PetscDM, includeAll::PetscBool) end + +@for_petsc function DMPlexCreateCellNumbering(petsclib::$UnionPetscLib, dm::PetscDM, includeAll::PetscBool ) + globalCellNumbers_ = Ref{IS}() + + @chk ccall( + (:DMPlexCreateCellNumbering, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, Ptr{CIS}), + dm, includeAll, globalCellNumbers_, + ) + + globalCellNumbers = globalCellNumbers_[] + + return globalCellNumbers +end + +""" + DMPlexGetCellNumbering(petsclib::PetscLibType,dm::PetscDM, globalCellNumbers::IS) +Get a global cell numbering for all cells on this process + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `globalCellNumbers` - Global cell numbers for all cells on this process + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateCellNumbering()`, `DMPlexGetVertexNumbering()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetCellNumbering")) +""" +function DMPlexGetCellNumbering(petsclib::PetscLibType, dm::PetscDM, globalCellNumbers::IS) end + +@for_petsc function DMPlexGetCellNumbering(petsclib::$UnionPetscLib, dm::PetscDM, globalCellNumbers::IS ) + + @chk ccall( + (:DMPlexGetCellNumbering, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CIS}), + dm, globalCellNumbers, + ) + + + return nothing +end + +""" + DMPlexGetVertexNumbering(petsclib::PetscLibType,dm::PetscDM, globalVertexNumbers::IS) +Get a global vertex numbering for all vertices on this process + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `globalVertexNumbers` - Global vertex numbers for all vertices on this process + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellNumbering()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetVertexNumbering")) +""" +function DMPlexGetVertexNumbering(petsclib::PetscLibType, dm::PetscDM, globalVertexNumbers::IS) end + +@for_petsc function DMPlexGetVertexNumbering(petsclib::$UnionPetscLib, dm::PetscDM, globalVertexNumbers::IS ) + + @chk ccall( + (:DMPlexGetVertexNumbering, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CIS}), + dm, globalVertexNumbers, + ) + + + return nothing +end + +""" + globalPointNumbers::IS = DMPlexCreatePointNumbering(petsclib::PetscLibType,dm::PetscDM) +Create a global numbering for all points. + +Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `globalPointNumbers` - Global numbers for all points on this process + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellNumbering()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreatePointNumbering")) +""" +function DMPlexCreatePointNumbering(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexCreatePointNumbering(petsclib::$UnionPetscLib, dm::PetscDM ) + globalPointNumbers_ = Ref{IS}() + + @chk ccall( + (:DMPlexCreatePointNumbering, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CIS}), + dm, globalPointNumbers_, + ) + + globalPointNumbers = globalPointNumbers_[] + + return globalPointNumbers +end + +""" + globalEdgeNumbers::IS = DMPlexCreateEdgeNumbering(petsclib::PetscLibType,dm::PetscDM) +Create a global numbering for edges. + +Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `globalEdgeNumbers` - Global numbers for all edges on this process + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellNumbering()`, `DMPlexGetVertexNumbering()`, `DMPlexCreatePointNumbering()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateEdgeNumbering")) +""" +function DMPlexCreateEdgeNumbering(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexCreateEdgeNumbering(petsclib::$UnionPetscLib, dm::PetscDM ) + globalEdgeNumbers_ = Ref{IS}() + + @chk ccall( + (:DMPlexCreateEdgeNumbering, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CIS}), + dm, globalEdgeNumbers_, + ) + + globalEdgeNumbers = globalEdgeNumbers_[] + + return globalEdgeNumbers +end + +""" + ranks::PetscVec = DMPlexCreateRankField(petsclib::PetscLibType,dm::PetscDM) +Create a cell field whose value is the rank of the owner + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `ranks` - The rank field + +Options Database Key: +- `-dm_partition_view` - Adds the rank field into the `DM` output from `-dm_view` using the same viewer + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMView()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateRankField")) +""" +function DMPlexCreateRankField(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexCreateRankField(petsclib::$UnionPetscLib, dm::PetscDM ) + ranks_ = Ref{CVec}() + + @chk ccall( + (:DMPlexCreateRankField, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}), + dm, ranks_, + ) + + ranks = PetscVec(ranks_[], petsclib) + + return ranks +end + +""" + val::PetscVec = DMPlexCreateLabelField(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) +Create a field whose value is the label value for that point + +Input Parameters: +- `dm` - The `DMPLEX` +- `label` - The `DMLabel` + +Output Parameter: +- `val` - The label value field + +Options Database Key: +- `-dm_label_view` - Adds the label value field into the `DM` output from `-dm_view` using the same viewer + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMView()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateLabelField")) +""" +function DMPlexCreateLabelField(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMPlexCreateLabelField(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + val_ = Ref{CVec}() + + @chk ccall( + (:DMPlexCreateLabelField, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, Ptr{CVec}), + dm, label, val_, + ) + + val = PetscVec(val_[], petsclib) + + return val +end + +""" + DMPlexCheckSymmetry(petsclib::PetscLibType,dm::PetscDM) +Check that the adjacency information in the mesh is symmetric. + +Input Parameter: +- `dm` - The `DMPLEX` object + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DMPlex/DMPlexCheckSymmetry")) +""" +function DMPlexCheckSymmetry(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexCheckSymmetry(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexCheckSymmetry, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexCheckSkeleton(petsclib::PetscLibType,dm::PetscDM, cellHeight::PetscInt) +Check that each cell has the correct number of vertices + +Input Parameters: +- `dm` - The `DMPLEX` object +- `cellHeight` - Normally 0 + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DMPlex/DMPlexCheckSkeleton")) +""" +function DMPlexCheckSkeleton(petsclib::PetscLibType, dm::PetscDM, cellHeight::PetscInt) end + +@for_petsc function DMPlexCheckSkeleton(petsclib::$UnionPetscLib, dm::PetscDM, cellHeight::$PetscInt ) + + @chk ccall( + (:DMPlexCheckSkeleton, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, cellHeight, + ) + + + return nothing +end + +""" + DMPlexCheckFaces(petsclib::PetscLibType,dm::PetscDM, cellHeight::PetscInt) +Check that the faces of each cell give a vertex order this is consistent with what we expect from the cell type + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `cellHeight` - Normally 0 + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()`, `DMPlexGetVTKCellHeight()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DMPlex/DMPlexCheckFaces")) +""" +function DMPlexCheckFaces(petsclib::PetscLibType, dm::PetscDM, cellHeight::PetscInt) end + +@for_petsc function DMPlexCheckFaces(petsclib::$UnionPetscLib, dm::PetscDM, cellHeight::$PetscInt ) + + @chk ccall( + (:DMPlexCheckFaces, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, cellHeight, + ) + + + return nothing +end + +""" + DMPlexCheckGeometry(petsclib::PetscLibType,dm::PetscDM) +Check the geometry of mesh cells + +Input Parameter: +- `dm` - The `DMPLEX` object + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DMPlex/DMPlexCheckGeometry")) +""" +function DMPlexCheckGeometry(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexCheckGeometry(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexCheckGeometry, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexCheckPointSF(petsclib::PetscLibType,dm::PetscDM, pointSF::PetscSF, allowExtraRoots::PetscBool) +Check that several necessary conditions are met for the point `PetscSF` of this plex. + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `pointSF` - The `PetscSF`, or `NULL` for `PointSF` attached to `DM` +- `allowExtraRoots` - Flag to allow extra points not present in the `DM` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetPointSF()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DMPlex/DMPlexCheckPointSF")) +""" +function DMPlexCheckPointSF(petsclib::PetscLibType, dm::PetscDM, pointSF::PetscSF, allowExtraRoots::PetscBool) end + +@for_petsc function DMPlexCheckPointSF(petsclib::$UnionPetscLib, dm::PetscDM, pointSF::PetscSF, allowExtraRoots::PetscBool ) + + @chk ccall( + (:DMPlexCheckPointSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF, PetscBool), + dm, pointSF, allowExtraRoots, + ) + + + return nothing +end + +""" + DMPlexCheckOrphanVertices(petsclib::PetscLibType,dm::PetscDM) +Check that no vertices are disconnected from the mesh, unless the mesh only consists of disconnected vertices. + +Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCheck()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DMPlex/DMPlexCheckOrphanVertices")) +""" +function DMPlexCheckOrphanVertices(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexCheckOrphanVertices(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexCheckOrphanVertices, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexCheck(petsclib::PetscLibType,dm::PetscDM) +Perform various checks of `DMPLEX` sanity + +Input Parameter: +- `dm` - The `DMPLEX` object + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DMPlex/DMPlexCheck")) +""" +function DMPlexCheck(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexCheck(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexCheck, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexCheckCellShape(petsclib::PetscLibType,dm::PetscDM, output::PetscBool, condLimit::PetscReal) +Checks the Jacobian of the mapping from reference to real cells and computes some minimal statistics. + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `output` - If true, statistics will be displayed on `stdout` +- `condLimit` - Display all cells above this condition number, or `PETSC_DETERMINE` for no cell output + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMSetFromOptions()`, `DMPlexComputeOrthogonalQuality()` + +# External Links +$(_doc_external("DMPlex/DMPlexCheckCellShape")) +""" +function DMPlexCheckCellShape(petsclib::PetscLibType, dm::PetscDM, output::PetscBool, condLimit::PetscReal) end + +@for_petsc function DMPlexCheckCellShape(petsclib::$UnionPetscLib, dm::PetscDM, output::PetscBool, condLimit::$PetscReal ) + + @chk ccall( + (:DMPlexCheckCellShape, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, $PetscReal), + dm, output, condLimit, + ) + + + return nothing +end + +""" + DMPlexComputeOrthogonalQuality(petsclib::PetscLibType,dm::PetscDM, fv::PetscFV, atol::PetscReal, OrthQual::PetscVec, OrthQualLabel::DMLabel) +Compute cell +orthogonal quality below given tolerance. + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `fv` - Optional `PetscFV` object for pre-computed cell/face centroid information +- `atol` - [0, 1] Absolute tolerance for tagging cells. + +Output Parameters: +- `OrthQual` - `Vec` containing orthogonal quality per cell +- `OrthQualLabel` - `DMLabel` tagging cells below atol with `DM_ADAPT_REFINE` + +Options Database Keys: +- `-dm_plex_orthogonal_quality_label_view` - view OrthQualLabel if label is requested. Currently only `PETSCVIEWERASCII` is supported. +- `-dm_plex_orthogonal_quality_vec_view` - view OrthQual vector. + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCheckCellShape()`, `DMCreateLabel()`, `PetscFV`, `DMLabel`, `Vec` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeOrthogonalQuality")) +""" +function DMPlexComputeOrthogonalQuality(petsclib::PetscLibType, dm::PetscDM, fv::PetscFV, atol::PetscReal, OrthQual::PetscVec, OrthQualLabel::DMLabel) end + +@for_petsc function DMPlexComputeOrthogonalQuality(petsclib::$UnionPetscLib, dm::PetscDM, fv::PetscFV, atol::$PetscReal, OrthQual::PetscVec, OrthQualLabel::DMLabel ) + OrthQual_ = Ref(OrthQual.ptr) + + @chk ccall( + (:DMPlexComputeOrthogonalQuality, $petsc_library), + PetscErrorCode, + (CDM, PetscFV, $PetscReal, Ptr{CVec}, Ptr{DMLabel}), + dm, fv, atol, OrthQual_, OrthQualLabel, + ) + + OrthQual.ptr = OrthQual_[] + + return nothing +end + +""" + regular::PetscBool = DMPlexGetRegularRefinement(petsclib::PetscLibType,dm::PetscDM) +Get the flag indicating that this mesh was obtained by regular refinement from its coarse mesh + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `regular` - The flag + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetRegularRefinement()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetRegularRefinement")) +""" +function DMPlexGetRegularRefinement(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetRegularRefinement(petsclib::$UnionPetscLib, dm::PetscDM ) + regular_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexGetRegularRefinement, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, regular_, + ) + + regular = regular_[] + + return regular +end + +""" + DMPlexSetRegularRefinement(petsclib::PetscLibType,dm::PetscDM, regular::PetscBool) +Set the flag indicating that this mesh was obtained by regular refinement from its coarse mesh + +Input Parameters: +- `dm` - The `DMPLEX` object +- `regular` - The flag + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetRegularRefinement()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetRegularRefinement")) +""" +function DMPlexSetRegularRefinement(petsclib::PetscLibType, dm::PetscDM, regular::PetscBool) end + +@for_petsc function DMPlexSetRegularRefinement(petsclib::$UnionPetscLib, dm::PetscDM, regular::PetscBool ) + + @chk ccall( + (:DMPlexSetRegularRefinement, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, regular, + ) + + + return nothing +end + +""" + DMPlexGetAnchors(petsclib::PetscLibType,dm::PetscDM, anchorSection::PetscSection, anchorIS::IS) +Get the layout of the anchor (point +call DMPlexGetAnchors() directly: if there are anchors, then `DMPlexGetAnchors()` is called during `DMGetDefaultConstraints()`. + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameters: +- `anchorSection` - If not `NULL`, set to the section describing which points anchor the constrained points. +- `anchorIS` - If not `NULL`, set to the list of anchors indexed by `anchorSection` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetAnchors()`, `DMGetDefaultConstraints()`, `DMSetDefaultConstraints()`, `IS`, `PetscSection` + +# External Links +$(_doc_external("DMPlex/DMPlexGetAnchors")) +""" +function DMPlexGetAnchors(petsclib::PetscLibType, dm::PetscDM, anchorSection::PetscSection, anchorIS::IS) end + +@for_petsc function DMPlexGetAnchors(petsclib::$UnionPetscLib, dm::PetscDM, anchorSection::PetscSection, anchorIS::IS ) + + @chk ccall( + (:DMPlexGetAnchors, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSection}, Ptr{CIS}), + dm, anchorSection, anchorIS, + ) + + + return nothing +end + +""" + DMPlexSetAnchors(petsclib::PetscLibType,dm::PetscDM, anchorSection::PetscSection, anchorIS::IS) +Set the layout of the local anchor (point + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `anchorSection` - The section that describes the mapping from constrained points to the anchor points listed in anchorIS. +Must have a local communicator (`PETSC_COMM_SELF` or derivative). +- `anchorIS` - The list of all anchor points. Must have a local communicator (`PETSC_COMM_SELF` or derivative). + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetAnchors()`, `DMGetDefaultConstraints()`, `DMSetDefaultConstraints()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetAnchors")) +""" +function DMPlexSetAnchors(petsclib::PetscLibType, dm::PetscDM, anchorSection::PetscSection, anchorIS::CIS) end + +@for_petsc function DMPlexSetAnchors(petsclib::$UnionPetscLib, dm::PetscDM, anchorSection::PetscSection, anchorIS::IS ) + + @chk ccall( + (:DMPlexSetAnchors, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, CIS), + dm, anchorSection, anchorIS, + ) + + + return nothing +end + +""" + DMPlexMonitorThroughput(petsclib::PetscLibType,dm::PetscDM, dummy::Cvoid) +Report the cell throughput of FE integration + +Input Parameters: +- `dm` - The `DM` +- `dummy` - unused argument + +Options Database Key: +- `-dm_plex_monitor_throughput` - Activate the monitor + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMSetFromOptions()`, `DMPlexCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexMonitorThroughput")) +""" +function DMPlexMonitorThroughput(petsclib::PetscLibType, dm::PetscDM, dummy::Cvoid) end + +@for_petsc function DMPlexMonitorThroughput(petsclib::$UnionPetscLib, dm::PetscDM, dummy::Cvoid ) + + @chk ccall( + (:DMPlexMonitorThroughput, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cvoid}), + dm, dummy, + ) + + + return nothing +end + +""" + DMPlexSetAdjacencyUser(petsclib::PetscLibType,dm::PetscDM, user::external, ctx::Cvoid) +Define adjacency in the mesh using a user + +Input Parameters: +- `dm` - The DM object +- `user` - The user callback, may be `NULL` (to clear the callback) +- `ctx` - context for callback evaluation, may be `NULL` + +Level: advanced + +-seealso: `DMPLEX`, `DMSetAdjacency()`, `DMPlexDistribute()`, `DMPlexPreallocateOperator()`, `DMPlexGetAdjacency()`, `DMPlexGetAdjacencyUser()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetAdjacencyUser")) +""" +function DMPlexSetAdjacencyUser(petsclib::PetscLibType, dm::PetscDM, user::external, ctx::Cvoid) end + +@for_petsc function DMPlexSetAdjacencyUser(petsclib::$UnionPetscLib, dm::PetscDM, user::external, ctx::Cvoid ) + + @chk ccall( + (:DMPlexSetAdjacencyUser, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, user, ctx, + ) + + + return nothing +end + +""" + DMPlexSetAdjacencyUseAnchors(petsclib::PetscLibType,dm::PetscDM, useAnchors::PetscBool) +Define adjacency in the mesh using the point + +Input Parameters: +- `dm` - The `DM` object +- `useAnchors` - Flag to use the constraints. If PETSC_TRUE, then constrained points are omitted from DMPlexGetAdjacency(), and their anchor points appear in their place. + +Level: intermediate + +-seealso: `DMPLEX`, `DMGetAdjacency()`, `DMSetAdjacency()`, `DMPlexDistribute()`, `DMPlexPreallocateOperator()`, `DMPlexSetAnchors()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetAdjacencyUseAnchors")) +""" +function DMPlexSetAdjacencyUseAnchors(petsclib::PetscLibType, dm::PetscDM, useAnchors::PetscBool) end + +@for_petsc function DMPlexSetAdjacencyUseAnchors(petsclib::$UnionPetscLib, dm::PetscDM, useAnchors::PetscBool ) + + @chk ccall( + (:DMPlexSetAdjacencyUseAnchors, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, useAnchors, + ) + + + return nothing +end + +""" + useAnchors::PetscBool = DMPlexGetAdjacencyUseAnchors(petsclib::PetscLibType,dm::PetscDM) +Query whether adjacency in the mesh uses the point + +Input Parameter: +- `dm` - The `DM` object + +Output Parameter: +- `useAnchors` - Flag to use the closure. If PETSC_TRUE, then constrained points are omitted from DMPlexGetAdjacency(), and their anchor points appear in their place. + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexSetAdjacencyUseAnchors()`, `DMSetAdjacency()`, `DMGetAdjacency()`, `DMPlexDistribute()`, `DMPlexPreallocateOperator()`, `DMPlexSetAnchors()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetAdjacencyUseAnchors")) +""" +function DMPlexGetAdjacencyUseAnchors(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetAdjacencyUseAnchors(petsclib::$UnionPetscLib, dm::PetscDM ) + useAnchors_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexGetAdjacencyUseAnchors, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, useAnchors_, + ) + + useAnchors = useAnchors_[] + + return useAnchors +end + +""" + adjSize::PetscInt,adj::Vector{PetscInt} = DMPlexGetAdjacency(petsclib::PetscLibType,dm::PetscDM, p::PetscInt) +Return all points adjacent to the given point + +Input Parameters: +- `dm` - The `DM` object +- `p` - The point + +Input/Output Parameters: +- `adjSize` - The maximum size of `adj` if it is non-`NULL`, or `PETSC_DETERMINE`; +on output the number of adjacent points +- `adj` - Either `NULL` so that the array is allocated, or an existing array with size `adjSize`; +on output contains the adjacent points + +Level: advanced + +-seealso: `DMPLEX`, `DMSetAdjacency()`, `DMPlexDistribute()`, `DMCreateMatrix()`, `DMPlexPreallocateOperator()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetAdjacency")) +""" +function DMPlexGetAdjacency(petsclib::PetscLibType, dm::PetscDM, p::PetscInt) end + +@for_petsc function DMPlexGetAdjacency(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt ) + adjSize_ = Ref{$PetscInt}() + adj_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetAdjacency, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, p, adjSize_, adj_, + ) + + adjSize = adjSize_[] + adj = unsafe_wrap(Array, adj_[], VecGetLocalSize(petsclib, x); own = false) + + return adjSize,adj +end + +""" + processRanks::IS,sfProcess::PetscSF = DMPlexCreateTwoSidedProcessSF(petsclib::PetscLibType,dm::PetscDM, sfPoint::PetscSF, rootRankSection::PetscSection, rootRanks::IS, leafRankSection::PetscSection, leafRanks::IS) +Create an `PetscSF` which just has process connectivity + +Collective + +Input Parameters: +- `dm` - The `DM` +- `sfPoint` - The `PetscSF` which encodes point connectivity +- `rootRankSection` - to be documented +- `rootRanks` - to be documented +- `leafRankSection` - to be documented +- `leafRanks` - to be documented + +Output Parameters: +- `processRanks` - A list of process neighbors, or `NULL` +- `sfProcess` - An `PetscSF` encoding the two-sided process connectivity, or `NULL` + +Level: developer + +-seealso: `DMPLEX`, `PetscSFCreate()`, `DMPlexCreateProcessSF()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateTwoSidedProcessSF")) +""" +function DMPlexCreateTwoSidedProcessSF(petsclib::PetscLibType, dm::PetscDM, sfPoint::PetscSF, rootRankSection::PetscSection, rootRanks::IS, leafRankSection::PetscSection, leafRanks::IS) end + +@for_petsc function DMPlexCreateTwoSidedProcessSF(petsclib::$UnionPetscLib, dm::PetscDM, sfPoint::PetscSF, rootRankSection::PetscSection, rootRanks::IS, leafRankSection::PetscSection, leafRanks::IS ) + processRanks_ = Ref{IS}() + sfProcess_ = Ref{PetscSF}() + + @chk ccall( + (:DMPlexCreateTwoSidedProcessSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF, PetscSection, CIS, PetscSection, CIS, Ptr{CIS}, Ptr{PetscSF}), + dm, sfPoint, rootRankSection, rootRanks, leafRankSection, leafRanks, processRanks_, sfProcess_, + ) + + processRanks = processRanks_[] + sfProcess = sfProcess_[] + + return processRanks,sfProcess +end + +""" + DMPlexDistributeOwnership(petsclib::PetscLibType,dm::PetscDM, rootSection::PetscSection, rootrank::IS, leafSection::PetscSection, leafrank::IS) +Compute owner information for shared points. This basically gets two + +Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameters: +- `rootSection` - The number of leaves for a given root point +- `rootrank` - The rank of each edge into the root point +- `leafSection` - The number of processes sharing a given leaf point +- `leafrank` - The rank of each process sharing a leaf point + +Level: developer + +-seealso: `DMPLEX`, `DMPlexCreateOverlapLabel()`, `DMPlexDistribute()`, `DMPlexDistributeOverlap()` + +# External Links +$(_doc_external("DMPlex/DMPlexDistributeOwnership")) +""" +function DMPlexDistributeOwnership(petsclib::PetscLibType, dm::PetscDM, rootSection::PetscSection, rootrank::IS, leafSection::PetscSection, leafrank::IS) end + +@for_petsc function DMPlexDistributeOwnership(petsclib::$UnionPetscLib, dm::PetscDM, rootSection::PetscSection, rootrank::IS, leafSection::PetscSection, leafrank::IS ) + + @chk ccall( + (:DMPlexDistributeOwnership, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, Ptr{CIS}, PetscSection, Ptr{CIS}), + dm, rootSection, rootrank, leafSection, leafrank, + ) + + + return nothing +end + +""" + ovLabel::DMLabel = DMPlexCreateOverlapLabel(petsclib::PetscLibType,dm::PetscDM, levels::PetscInt, rootSection::PetscSection, rootrank::IS, leafSection::PetscSection, leafrank::IS) +Compute a label indicating what overlap points should be sent to new processes + +Collective + +Input Parameters: +- `dm` - The `DM` +- `levels` - Number of overlap levels +- `rootSection` - The number of leaves for a given root point +- `rootrank` - The rank of each edge into the root point +- `leafSection` - The number of processes sharing a given leaf point +- `leafrank` - The rank of each process sharing a leaf point + +Output Parameter: +- `ovLabel` - `DMLabel` containing remote overlap contributions as point/rank pairings + +Level: developer + +-seealso: `DMPLEX`, `DMPlexCreateOverlapLabelFromLabels()`, `DMPlexGetAdjacency()`, `DMPlexDistributeOwnership()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateOverlapLabel")) +""" +function DMPlexCreateOverlapLabel(petsclib::PetscLibType, dm::PetscDM, levels::PetscInt, rootSection::PetscSection, rootrank::IS, leafSection::PetscSection, leafrank::IS) end + +@for_petsc function DMPlexCreateOverlapLabel(petsclib::$UnionPetscLib, dm::PetscDM, levels::$PetscInt, rootSection::PetscSection, rootrank::IS, leafSection::PetscSection, leafrank::IS ) + ovLabel_ = Ref{DMLabel}() + + @chk ccall( + (:DMPlexCreateOverlapLabel, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscSection, CIS, PetscSection, CIS, Ptr{DMLabel}), + dm, levels, rootSection, rootrank, leafSection, leafrank, ovLabel_, + ) + + ovLabel = ovLabel_[] + + return ovLabel +end + +""" + ovLabel::DMLabel = DMPlexCreateOverlapLabelFromLabels(petsclib::PetscLibType,dm::PetscDM, numLabels::PetscInt, label::Vector{DMLabel}, value::Vector{PetscInt}, numExLabels::PetscInt, exLabel::Vector{DMLabel}, exValue::Vector{PetscInt}, rootSection::PetscSection, rootrank::IS, leafSection::PetscSection, leafrank::IS) +Compute a label indicating what overlap points should be sent to new processes + +Collective + +Input Parameters: +- `dm` - The `DM` +- `numLabels` - The number of labels to draw candidate points from +- `label` - An array of labels containing candidate points +- `value` - An array of label values marking the candidate points +- `numExLabels` - The number of labels to use for exclusion +- `exLabel` - An array of labels indicating points to be excluded, or `NULL` +- `exValue` - An array of label values to be excluded, or `NULL` +- `rootSection` - The number of leaves for a given root point +- `rootrank` - The rank of each edge into the root point +- `leafSection` - The number of processes sharing a given leaf point +- `leafrank` - The rank of each process sharing a leaf point + +Output Parameter: +- `ovLabel` - `DMLabel` containing remote overlap contributions as point/rank pairings + +Level: developer + +-seealso: `DMPLEX`, `DMPlexCreateOverlapLabel()`, `DMPlexGetAdjacency()`, `DMPlexDistributeOwnership()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateOverlapLabelFromLabels")) +""" +function DMPlexCreateOverlapLabelFromLabels(petsclib::PetscLibType, dm::PetscDM, numLabels::PetscInt, label::Vector{DMLabel}, value::Vector{PetscInt}, numExLabels::PetscInt, exLabel::Vector{DMLabel}, exValue::Vector{PetscInt}, rootSection::PetscSection, rootrank::IS, leafSection::PetscSection, leafrank::IS) end + +@for_petsc function DMPlexCreateOverlapLabelFromLabels(petsclib::$UnionPetscLib, dm::PetscDM, numLabels::$PetscInt, label::Vector{DMLabel}, value::Vector{$PetscInt}, numExLabels::$PetscInt, exLabel::Vector{DMLabel}, exValue::Vector{$PetscInt}, rootSection::PetscSection, rootrank::IS, leafSection::PetscSection, leafrank::IS ) + ovLabel_ = Ref{DMLabel}() + + @chk ccall( + (:DMPlexCreateOverlapLabelFromLabels, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{DMLabel}, Ptr{$PetscInt}, $PetscInt, Ptr{DMLabel}, Ptr{$PetscInt}, PetscSection, CIS, PetscSection, CIS, Ptr{DMLabel}), + dm, numLabels, label, value, numExLabels, exLabel, exValue, rootSection, rootrank, leafSection, leafrank, ovLabel_, + ) + + ovLabel = ovLabel_[] + + return ovLabel +end + +""" + migrationSF::PetscSF = DMPlexCreateOverlapMigrationSF(petsclib::PetscLibType,dm::PetscDM, overlapSF::PetscSF) +Create a `PetscSF` describing the new mesh distribution to make the overlap described by the input `PetscSF` + +Collective + +Input Parameters: +- `dm` - The `DM` +- `overlapSF` - The `PetscSF` mapping ghost points in overlap to owner points on other processes + +Output Parameter: +- `migrationSF` - A `PetscSF` that maps original points in old locations to points in new locations + +Level: developer + +-seealso: `DMPLEX`, `DMPlexCreateOverlapLabel()`, `DMPlexDistributeOverlap()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateOverlapMigrationSF")) +""" +function DMPlexCreateOverlapMigrationSF(petsclib::PetscLibType, dm::PetscDM, overlapSF::PetscSF) end + +@for_petsc function DMPlexCreateOverlapMigrationSF(petsclib::$UnionPetscLib, dm::PetscDM, overlapSF::PetscSF ) + migrationSF_ = Ref{PetscSF}() + + @chk ccall( + (:DMPlexCreateOverlapMigrationSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF, Ptr{PetscSF}), + dm, overlapSF, migrationSF_, + ) + + migrationSF = migrationSF_[] + + return migrationSF +end + +""" + DMPlexStratifyMigrationSF(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF, migrationSF::PetscSF) +Rearrange the leaves of a migration sf for stratification. + +Input Parameters: +- `dm` - The DM +- `sf` - A star forest with non-ordered leaves, usually defining a DM point migration + +Output Parameter: +- `migrationSF` - A star forest with added leaf indirection that ensures the resulting DM is stratified + +Level: developer + +-seealso: `DMPLEX`, `DMPlexPartitionLabelCreateSF()`, `DMPlexDistribute()`, `DMPlexDistributeOverlap()` + +# External Links +$(_doc_external("DMPlex/DMPlexStratifyMigrationSF")) +""" +function DMPlexStratifyMigrationSF(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF, migrationSF::PetscSF) end + +@for_petsc function DMPlexStratifyMigrationSF(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF, migrationSF::PetscSF ) + + @chk ccall( + (:DMPlexStratifyMigrationSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF, Ptr{PetscSF}), + dm, sf, migrationSF, + ) + + + return nothing +end + +""" + DMPlexDistributeField(petsclib::PetscLibType,dm::PetscDM, pointSF::PetscSF, originalSection::PetscSection, originalVec::PetscVec, newSection::PetscSection, newVec::PetscVec) +Distribute field data to match a given `PetscSF`, usually the `PetscSF` from mesh distribution + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `pointSF` - The `PetscSF` describing the communication pattern +- `originalSection` - The `PetscSection` for existing data layout +- `originalVec` - The existing data in a local vector + +Output Parameters: +- `newSection` - The `PetscSF` describing the new data layout +- `newVec` - The new data in a local vector + +Level: developer + +-seealso: `DMPLEX`, `DMPlexDistribute()`, `DMPlexDistributeFieldIS()`, `DMPlexDistributeData()` + +# External Links +$(_doc_external("DMPlex/DMPlexDistributeField")) +""" +function DMPlexDistributeField(petsclib::PetscLibType, dm::PetscDM, pointSF::PetscSF, originalSection::PetscSection, originalVec::PetscVec, newSection::PetscSection, newVec::PetscVec) end + +@for_petsc function DMPlexDistributeField(petsclib::$UnionPetscLib, dm::PetscDM, pointSF::PetscSF, originalSection::PetscSection, originalVec::PetscVec, newSection::PetscSection, newVec::PetscVec ) + + @chk ccall( + (:DMPlexDistributeField, $petsc_library), + PetscErrorCode, + (CDM, PetscSF, PetscSection, CVec, PetscSection, CVec), + dm, pointSF, originalSection, originalVec, newSection, newVec, + ) + + + return nothing +end + +""" + DMPlexDistributeFieldIS(petsclib::PetscLibType,dm::PetscDM, pointSF::PetscSF, originalSection::PetscSection, originalIS::IS, newSection::PetscSection, newIS::IS) +Distribute field data to match a given `PetscSF`, usually the `PetscSF` from mesh distribution + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `pointSF` - The `PetscSF` describing the communication pattern +- `originalSection` - The `PetscSection` for existing data layout +- `originalIS` - The existing data + +Output Parameters: +- `newSection` - The `PetscSF` describing the new data layout +- `newIS` - The new data + +Level: developer + +-seealso: `DMPLEX`, `DMPlexDistribute()`, `DMPlexDistributeField()`, `DMPlexDistributeData()` + +# External Links +$(_doc_external("DMPlex/DMPlexDistributeFieldIS")) +""" +function DMPlexDistributeFieldIS(petsclib::PetscLibType, dm::PetscDM, pointSF::PetscSF, originalSection::PetscSection, originalIS::IS, newSection::PetscSection, newIS::IS) end + +@for_petsc function DMPlexDistributeFieldIS(petsclib::$UnionPetscLib, dm::PetscDM, pointSF::PetscSF, originalSection::PetscSection, originalIS::IS, newSection::PetscSection, newIS::IS ) + + @chk ccall( + (:DMPlexDistributeFieldIS, $petsc_library), + PetscErrorCode, + (CDM, PetscSF, PetscSection, CIS, PetscSection, Ptr{CIS}), + dm, pointSF, originalSection, originalIS, newSection, newIS, + ) + + + return nothing +end + +""" + DMPlexSetPartitionBalance(petsclib::PetscLibType,dm::PetscDM, flg::PetscBool) +Should distribution of the `DM` attempt to balance the shared point partition? + +Input Parameters: +- `dm` - The `DMPLEX` object +- `flg` - Balance the partition? + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexDistribute()`, `DMPlexGetPartitionBalance()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetPartitionBalance")) +""" +function DMPlexSetPartitionBalance(petsclib::PetscLibType, dm::PetscDM, flg::PetscBool) end + +@for_petsc function DMPlexSetPartitionBalance(petsclib::$UnionPetscLib, dm::PetscDM, flg::PetscBool ) + + @chk ccall( + (:DMPlexSetPartitionBalance, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = DMPlexGetPartitionBalance(petsclib::PetscLibType,dm::PetscDM) +Does distribution of the `DM` attempt to balance the shared point partition? + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `flg` - Balance the partition? + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexDistribute()`, `DMPlexSetPartitionBalance()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetPartitionBalance")) +""" +function DMPlexGetPartitionBalance(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetPartitionBalance(petsclib::$UnionPetscLib, dm::PetscDM ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexGetPartitionBalance, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + pointSF::PetscSF = DMPlexCreatePointSF(petsclib::PetscLibType,dm::PetscDM, migrationSF::PetscSF, ownership::PetscBool) +Build a point `PetscSF` from an `PetscSF` describing a point migration + +Input Parameters: +- `dm` - The source `DMPLEX` object +- `migrationSF` - The star forest that describes the parallel point remapping +- `ownership` - Flag causing a vote to determine point ownership + +Output Parameter: +- `pointSF` - The star forest describing the point overlap in the remapped `DM` + +Level: developer + +-seealso: `DMPLEX`, `PetscSF`, `DM`, `DMPlexDistribute()`, `DMPlexDistributeOverlap()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreatePointSF")) +""" +function DMPlexCreatePointSF(petsclib::PetscLibType, dm::PetscDM, migrationSF::PetscSF, ownership::PetscBool) end + +@for_petsc function DMPlexCreatePointSF(petsclib::$UnionPetscLib, dm::PetscDM, migrationSF::PetscSF, ownership::PetscBool ) + pointSF_ = Ref{PetscSF}() + + @chk ccall( + (:DMPlexCreatePointSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF, PetscBool, Ptr{PetscSF}), + dm, migrationSF, ownership, pointSF_, + ) + + pointSF = pointSF_[] + + return pointSF +end + +""" + DMPlexMigrate(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF, targetDM::PetscDM) +Migrates internal `DM` data over the supplied star forest + +Collective + +Input Parameters: +- `dm` - The source `DMPLEX` object +- `sf` - The star forest communication context describing the migration pattern + +Output Parameter: +- `targetDM` - The target `DMPLEX` object + +Level: intermediate + +-seealso: `DMPLEX`, `PetscSF`, `DM`, `DMPlexDistribute()`, `DMPlexDistributeOverlap()` + +# External Links +$(_doc_external("DMPlex/DMPlexMigrate")) +""" +function DMPlexMigrate(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF, targetDM::PetscDM) end + +@for_petsc function DMPlexMigrate(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF, targetDM::PetscDM ) + + @chk ccall( + (:DMPlexMigrate, $petsc_library), + PetscErrorCode, + (CDM, PetscSF, CDM), + dm, sf, targetDM, + ) + + + return nothing +end + +""" + DMPlexRemapMigrationSF(petsclib::PetscLibType,sfOverlap::PetscSF, sfMigration::PetscSF, sfMigrationNew::PetscSF) +Rewrite the distribution SF to account for overlap + +Collective + +Input Parameters: +- `sfOverlap` - The `PetscSF` object just for the overlap +- `sfMigration` - The original distribution `PetscSF` object + +Output Parameters: +- `sfMigrationNew` - A rewritten `PetscSF` object that incorporates the overlap + +Level: developer + +-seealso: `DMPLEX`, `DM`, `DMPlexDistribute()`, `DMPlexDistributeOverlap()`, `DMPlexGetOverlap()` + +# External Links +$(_doc_external("DMPlex/DMPlexRemapMigrationSF")) +""" +function DMPlexRemapMigrationSF(petsclib::PetscLibType, sfOverlap::PetscSF, sfMigration::PetscSF, sfMigrationNew::PetscSF) end + +@for_petsc function DMPlexRemapMigrationSF(petsclib::$UnionPetscLib, sfOverlap::PetscSF, sfMigration::PetscSF, sfMigrationNew::PetscSF ) + + @chk ccall( + (:DMPlexRemapMigrationSF, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSF, Ptr{PetscSF}), + sfOverlap, sfMigration, sfMigrationNew, + ) + + + return nothing +end + +""" + DMPlexDistribute(petsclib::PetscLibType,dm::PetscDM, overlap::PetscInt, sf::PetscSF, dmParallel::PetscDM) +Distributes the mesh and any associated sections. + +Collective + +Input Parameters: +- `dm` - The original `DMPLEX` object +- `overlap` - The overlap of partitions, 0 is the default + +Output Parameters: +- `sf` - The `PetscSF` used for point distribution, or `NULL` if not needed +- `dmParallel` - The distributed `DMPLEX` object + +Level: intermediate + +-seealso: `DMPLEX`, `DM`, `DMPlexCreate()`, `DMSetAdjacency()`, `DMPlexGetOverlap()` + +# External Links +$(_doc_external("DMPlex/DMPlexDistribute")) +""" +function DMPlexDistribute(petsclib::PetscLibType, dm::PetscDM, overlap::PetscInt, sf::Union{Ptr{PetscSF}, Ptr{Nothing}}, dmParallel::PetscDM) end + +@for_petsc function DMPlexDistribute(petsclib::$UnionPetscLib, dm::PetscDM, overlap::$PetscInt, sf::Union{Ptr{PetscSF}, Ptr{Nothing}}, dmParallel::PetscDM ) + dmParallel_ = Ref(dmParallel.ptr) + sf_ = sf isa Ptr{Nothing} ? Ptr{PetscSF}(0) : sf + + @chk ccall( + (:DMPlexDistribute, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscSF}, Ptr{CDM}), + dm, overlap, sf_, dmParallel_, + ) + + dmParallel.ptr = dmParallel_[] + + return nothing +end + +""" + DMPlexDistributeOverlap(petsclib::PetscLibType,dm::PetscDM, overlap::PetscInt, sf::PetscSF, dmOverlap::PetscDM) +Add partition overlap to a distributed non + +Collective + +Input Parameters: +- `dm` - The non-overlapping distributed `DMPLEX` object +- `overlap` - The overlap of partitions (the same on all ranks) + +Output Parameters: +- `sf` - The `PetscSF` used for point distribution, or pass `NULL` if not needed +- `dmOverlap` - The overlapping distributed `DMPLEX` object + +Options Database Keys: +- `-dm_plex_overlap_labels ` - List of overlap label names +- `-dm_plex_overlap_values ` - List of overlap label values +- `-dm_plex_overlap_exclude_label ` - Label used to exclude points from overlap +- `-dm_plex_overlap_exclude_value ` - Label value used to exclude points from overlap + +Level: advanced + +-seealso: `DMPLEX`, `PetscSF`, `DM`, `DMPlexCreate()`, `DMSetAdjacency()`, `DMPlexDistribute()`, `DMPlexCreateOverlapLabel()`, `DMPlexGetOverlap()` + +# External Links +$(_doc_external("DMPlex/DMPlexDistributeOverlap")) +""" +function DMPlexDistributeOverlap(petsclib::PetscLibType, dm::PetscDM, overlap::PetscInt, sf::PetscSF, dmOverlap::PetscDM) end + +@for_petsc function DMPlexDistributeOverlap(petsclib::$UnionPetscLib, dm::PetscDM, overlap::$PetscInt, sf::PetscSF, dmOverlap::PetscDM ) + dmOverlap_ = Ref(dmOverlap.ptr) + + @chk ccall( + (:DMPlexDistributeOverlap, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscSF}, Ptr{CDM}), + dm, overlap, sf, dmOverlap_, + ) + + dmOverlap.ptr = dmOverlap_[] + + return nothing +end + +""" + overlap::PetscInt = DMPlexGetOverlap(petsclib::PetscLibType,dm::PetscDM) +Get the width of the cell overlap + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `overlap` - the width of the cell overlap + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexSetOverlap()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetOverlap")) +""" +function DMPlexGetOverlap(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetOverlap(petsclib::$UnionPetscLib, dm::PetscDM ) + overlap_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetOverlap, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, overlap_, + ) + + overlap = overlap_[] + + return overlap +end + +""" + DMPlexSetOverlap(petsclib::PetscLibType,dm::PetscDM, dmSrc::PetscDM, overlap::PetscInt) +Set the width of the cell overlap + +Logically Collective + +Input Parameters: +- `dm` - The `DM` +- `dmSrc` - The `DM` that produced this one, or `NULL` +- `overlap` - the width of the cell overlap + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexGetOverlap()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetOverlap")) +""" +function DMPlexSetOverlap(petsclib::PetscLibType, dm::PetscDM, dmSrc::PetscDM, overlap::PetscInt) end + +@for_petsc function DMPlexSetOverlap(petsclib::$UnionPetscLib, dm::PetscDM, dmSrc::PetscDM, overlap::$PetscInt ) + + @chk ccall( + (:DMPlexSetOverlap, $petsc_library), + PetscErrorCode, + (CDM, CDM, $PetscInt), + dm, dmSrc, overlap, + ) + + + return nothing +end + +""" + DMPlexDistributeSetDefault(petsclib::PetscLibType,dm::PetscDM, dist::PetscBool) +Set flag indicating whether the `DM` should be distributed by default + +Logically Collective + +Input Parameters: +- `dm` - The `DM` +- `dist` - Flag for distribution + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexDistributeGetDefault()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexDistributeSetDefault")) +""" +function DMPlexDistributeSetDefault(petsclib::PetscLibType, dm::PetscDM, dist::PetscBool) end + +@for_petsc function DMPlexDistributeSetDefault(petsclib::$UnionPetscLib, dm::PetscDM, dist::PetscBool ) + + @chk ccall( + (:DMPlexDistributeSetDefault, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, dist, + ) + + + return nothing +end + +""" + dist::PetscBool = DMPlexDistributeGetDefault(petsclib::PetscLibType,dm::PetscDM) +Get flag indicating whether the `DM` should be distributed by default + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `dist` - Flag for distribution + +Level: intermediate + +-seealso: `DMPLEX`, `DM`, `DMPlexDistributeSetDefault()`, `DMPlexDistribute()` + +# External Links +$(_doc_external("DMPlex/DMPlexDistributeGetDefault")) +""" +function DMPlexDistributeGetDefault(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexDistributeGetDefault(petsclib::$UnionPetscLib, dm::PetscDM ) + dist_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexDistributeGetDefault, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, dist_, + ) + + dist = dist_[] + + return dist +end + +""" + DMPlexGetGatherDM(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF, gatherMesh::PetscDM) +Get a copy of the `DMPLEX` that gathers all points on the +root process of the original's communicator. + +Collective + +Input Parameter: +- `dm` - the original `DMPLEX` object + +Output Parameters: +- `sf` - the `PetscSF` used for point distribution (optional) +- `gatherMesh` - the gathered `DM` object, or `NULL` + +Level: intermediate + +-seealso: `DMPLEX`, `DM`, `PetscSF`, `DMPlexDistribute()`, `DMPlexGetRedundantDM()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetGatherDM")) +""" +function DMPlexGetGatherDM(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF, gatherMesh::PetscDM) end + +@for_petsc function DMPlexGetGatherDM(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF, gatherMesh::PetscDM ) + gatherMesh_ = Ref(gatherMesh.ptr) + + @chk ccall( + (:DMPlexGetGatherDM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSF}, Ptr{CDM}), + dm, sf, gatherMesh_, + ) + + gatherMesh.ptr = gatherMesh_[] + + return nothing +end + +""" + DMPlexGetRedundantDM(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF, redundantMesh::PetscDM) +Get a copy of the `DMPLEX` that is completely copied on each process. + +Collective + +Input Parameter: +- `dm` - the original `DMPLEX` object + +Output Parameters: +- `sf` - the `PetscSF` used for point distribution (optional) +- `redundantMesh` - the redundant `DM` object, or `NULL` + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexDistribute()`, `DMPlexGetGatherDM()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetRedundantDM")) +""" +function DMPlexGetRedundantDM(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF, redundantMesh::PetscDM) end + +@for_petsc function DMPlexGetRedundantDM(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF, redundantMesh::PetscDM ) + redundantMesh_ = Ref(redundantMesh.ptr) + + @chk ccall( + (:DMPlexGetRedundantDM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSF}, Ptr{CDM}), + dm, sf, redundantMesh_, + ) + + redundantMesh.ptr = redundantMesh_[] + + return nothing +end + +""" + distributed::PetscBool = DMPlexIsDistributed(petsclib::PetscLibType,dm::PetscDM) +Find out whether this `DM` is distributed, i.e. more than one rank owns some points. + +Collective + +Input Parameter: +- `dm` - The `DM` object + +Output Parameter: +- `distributed` - Flag whether the `DM` is distributed + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexDistribute()`, `DMPlexGetOverlap()`, `DMPlexIsInterpolated()` + +# External Links +$(_doc_external("DMPlex/DMPlexIsDistributed")) +""" +function DMPlexIsDistributed(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexIsDistributed(petsclib::$UnionPetscLib, dm::PetscDM ) + distributed_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexIsDistributed, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, distributed_, + ) + + distributed = distributed_[] + + return distributed +end + +""" + DMPlexDistributionSetName(petsclib::PetscLibType,dm::PetscDM, name::String) +Set the name of the specific parallel distribution + +Input Parameters: +- `dm` - The `DM` +- `name` - The name of the specific parallel distribution + +Level: developer + +-seealso: `DMPLEX`, `DMPlexDistributionGetName()`, `DMPlexTopologyView()`, `DMPlexTopologyLoad()` + +# External Links +$(_doc_external("DMPlex/DMPlexDistributionSetName")) +""" +function DMPlexDistributionSetName(petsclib::PetscLibType, dm::PetscDM, name::String) end + +@for_petsc function DMPlexDistributionSetName(petsclib::$UnionPetscLib, dm::PetscDM, name::String ) + + @chk ccall( + (:DMPlexDistributionSetName, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + dm, name, + ) + + + return nothing +end + +""" + DMPlexDistributionGetName(petsclib::PetscLibType,dm::PetscDM, name::String) +Retrieve the name of the specific parallel distribution + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `name` - The name of the specific parallel distribution + +Level: developer + +-seealso: `DMPLEX`, `DMPlexDistributionSetName()`, `DMPlexTopologyView()`, `DMPlexTopologyLoad()` + +# External Links +$(_doc_external("DMPlex/DMPlexDistributionGetName")) +""" +function DMPlexDistributionGetName(petsclib::PetscLibType, dm::PetscDM, name::String) end + +@for_petsc function DMPlexDistributionGetName(petsclib::$UnionPetscLib, dm::PetscDM, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:DMPlexDistributionGetName, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Ptr{Cchar}}), + dm, name_, + ) + + + return nothing +end + +""" + DMPlexOrientPoint(petsclib::PetscLibType,dm::PetscDM, p::PetscInt, o::PetscInt) +Act with the given orientation on the cone points of this mesh point, and update its use in the mesh. + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `p` - The mesh point +- `o` - The orientation + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexOrient()`, `DMPlexGetCone()`, `DMPlexGetConeOrientation()`, `DMPlexInterpolate()`, `DMPlexGetChart()` + +# External Links +$(_doc_external("DMPlex/DMPlexOrientPoint")) +""" +function DMPlexOrientPoint(petsclib::PetscLibType, dm::PetscDM, p::PetscInt, o::PetscInt) end + +@for_petsc function DMPlexOrientPoint(petsclib::$UnionPetscLib, dm::PetscDM, p::$PetscInt, o::$PetscInt ) + + @chk ccall( + (:DMPlexOrientPoint, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt), + dm, p, o, + ) + + + return nothing +end + +""" + DMPlexOrient(petsclib::PetscLibType,dm::PetscDM) +Give a consistent orientation to the input mesh + +Input Parameter: +- `dm` - The `DM` + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexOrient")) +""" +function DMPlexOrient(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexOrient(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexOrient, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexOrientLabel(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) + +# External Links +$(_doc_external("DMPlex/DMPlexOrientLabel")) +""" +function DMPlexOrientLabel(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMPlexOrientLabel(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + + @chk ccall( + (:DMPlexOrientLabel, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, label, + ) + + + return nothing +end + +""" + DMPlexSetIsoperiodicFaceSF(petsclib::PetscLibType,dm::PetscDM, num_face_sfs::PetscInt, face_sfs::PetscSF) +Express periodicity from an existing mesh + +Logically Collective + +Input Parameters: +- `dm` - The `DMPLEX` on which to set periodicity +- `num_face_sfs` - Number of `PetscSF`s in `face_sfs` +- `face_sfs` - Array of `PetscSF` in which roots are (owned) donor faces and leaves are faces that must be matched to a (possibly remote) donor face. + +Level: advanced + +-seealso: [](ch_unstructured), `DMPLEX`, `DMGetGlobalSection()`, `DMPlexGetIsoperiodicFaceSF()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetIsoperiodicFaceSF")) +""" +function DMPlexSetIsoperiodicFaceSF(petsclib::PetscLibType, dm::PetscDM, num_face_sfs::PetscInt, face_sfs::PetscSF) end + +@for_petsc function DMPlexSetIsoperiodicFaceSF(petsclib::$UnionPetscLib, dm::PetscDM, num_face_sfs::$PetscInt, face_sfs::PetscSF ) + + @chk ccall( + (:DMPlexSetIsoperiodicFaceSF, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscSF}), + dm, num_face_sfs, face_sfs, + ) + + + return nothing +end + +""" + num_face_sfs::PetscInt = DMPlexGetIsoperiodicFaceSF(petsclib::PetscLibType,dm::PetscDM, face_sfs::PetscSF) +Obtain periodicity for a mesh + +Logically Collective + +Input Parameter: +- `dm` - The `DMPLEX` for which to obtain periodic relation + +Output Parameters: +- `num_face_sfs` - Number of `PetscSF`s in the array +- `face_sfs` - Array of `PetscSF` in which roots are (owned) donor faces and leaves are faces that must be matched to a (possibly remote) donor face. + +Level: advanced + +-seealso: [](ch_unstructured), `DMPLEX`, `DMGetGlobalSection()`, `DMPlexSetIsoperiodicFaceSF()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetIsoperiodicFaceSF")) +""" +function DMPlexGetIsoperiodicFaceSF(petsclib::PetscLibType, dm::PetscDM, face_sfs::PetscSF) end + +@for_petsc function DMPlexGetIsoperiodicFaceSF(petsclib::$UnionPetscLib, dm::PetscDM, face_sfs::PetscSF ) + num_face_sfs_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetIsoperiodicFaceSF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, PetscSF), + dm, num_face_sfs_, face_sfs, + ) + + num_face_sfs = num_face_sfs_[] + + return num_face_sfs +end + +""" + DMPlexSetIsoperiodicFaceTransform(petsclib::PetscLibType,dm::PetscDM, n::PetscInt, t::Vector{PetscScalar}) +set geometric transform from donor to periodic points + +Logically Collective + +Input Parameters: +- `dm` - `DMPLEX` that has been configured with `DMPlexSetIsoperiodicFaceSF()` +- `n` - Number of transforms in array +- `t` - Array of 4x4 affine transformation basis. + +Level: advanced + +-seealso: [](ch_unstructured), `DMPLEX`, `DMGetGlobalSection()`, `DMPlexSetIsoperiodicFaceSF()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetIsoperiodicFaceTransform")) +""" +function DMPlexSetIsoperiodicFaceTransform(petsclib::PetscLibType, dm::PetscDM, n::PetscInt, t::Vector{PetscScalar}) end + +@for_petsc function DMPlexSetIsoperiodicFaceTransform(petsclib::$UnionPetscLib, dm::PetscDM, n::$PetscInt, t::Vector{$PetscScalar} ) + + @chk ccall( + (:DMPlexSetIsoperiodicFaceTransform, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscScalar}), + dm, n, t, + ) + + + return nothing +end + +""" + start::PetscInt,end_::PetscInt = DMPlexGetPointLocal(petsclib::PetscLibType,dm::PetscDM, point::PetscInt) +get location of point data in local `Vec` + +Not Collective + +Input Parameters: +- `dm` - `DM` defining the topological space +- `point` - topological point + +Output Parameters: +- `start` - start of point data +- `end` - end of point data + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetPointLocalField()`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexPointLocalRead()`, `DMPlexPointLocalRef()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetPointLocal")) +""" +function DMPlexGetPointLocal(petsclib::PetscLibType, dm::PetscDM, point::PetscInt) end + +@for_petsc function DMPlexGetPointLocal(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt ) + start_ = Ref{$PetscInt}() + end__ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetPointLocal, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, point, start_, end__, + ) + + start = start_[] + end_ = end__[] + + return start,end_ +end + +""" + DMPlexPointLocalRead(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, array::PetscScalar, ptr::Cvoid) +return read access to a point in local array + +Not Collective + +Input Parameters: +- `dm` - `DM` defining topological space +- `point` - topological point +- `array` - array to index into + +Output Parameter: +- `ptr` - address of read reference to point data, type generic so user can place in structure + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexGetPointLocal()`, `DMPlexPointGlobalRead()` + +# External Links +$(_doc_external("DMPlex/DMPlexPointLocalRead")) +""" +function DMPlexPointLocalRead(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, array::PetscScalar, ptr::Cvoid) end + +@for_petsc function DMPlexPointLocalRead(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, array::$PetscScalar, ptr::Cvoid ) + + @chk ccall( + (:DMPlexPointLocalRead, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscScalar}, Ptr{Cvoid}), + dm, point, array, ptr, + ) + + + return nothing +end + +""" + DMPlexPointLocalRef(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, array::PetscScalar, ptr::Cvoid) +return read/write access to a point in local array + +Not Collective + +Input Parameters: +- `dm` - `DM` defining topological space +- `point` - topological point +- `array` - array to index into + +Output Parameter: +- `ptr` - address of reference to point data, type generic so user can place in structure + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexGetPointLocal()`, `DMPlexPointGlobalRef()` + +# External Links +$(_doc_external("DMPlex/DMPlexPointLocalRef")) +""" +function DMPlexPointLocalRef(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, array::PetscScalar, ptr::Cvoid) end + +@for_petsc function DMPlexPointLocalRef(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, array::$PetscScalar, ptr::Cvoid ) + + @chk ccall( + (:DMPlexPointLocalRef, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscScalar}, Ptr{Cvoid}), + dm, point, array, ptr, + ) + + + return nothing +end + +""" + start::PetscInt,end_::PetscInt = DMPlexGetPointLocalField(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, field::PetscInt) +get location of point field data in local Vec + +Not Collective + +Input Parameters: +- `dm` - `DM` defining the topological space +- `point` - topological point +- `field` - the field number + +Output Parameters: +- `start` - start of point data +- `end` - end of point data + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetPointLocal()`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexPointLocalRead()`, `DMPlexPointLocalRef()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetPointLocalField")) +""" +function DMPlexGetPointLocalField(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, field::PetscInt) end + +@for_petsc function DMPlexGetPointLocalField(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, field::$PetscInt ) + start_ = Ref{$PetscInt}() + end__ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetPointLocalField, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, point, field, start_, end__, + ) + + start = start_[] + end_ = end__[] + + return start,end_ +end + +""" + DMPlexPointLocalFieldRead(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, field::PetscInt, array::PetscScalar, ptr::Cvoid) +return read access to a field on a point in local array + +Not Collective + +Input Parameters: +- `dm` - `DM` defining topological space +- `point` - topological point +- `field` - field number +- `array` - array to index into + +Output Parameter: +- `ptr` - address of read reference to point data, type generic so user can place in structure + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexGetPointLocal()`, `DMPlexPointGlobalRef()` + +# External Links +$(_doc_external("DMPlex/DMPlexPointLocalFieldRead")) +""" +function DMPlexPointLocalFieldRead(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, field::PetscInt, array::PetscScalar, ptr::Cvoid) end + +@for_petsc function DMPlexPointLocalFieldRead(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, field::$PetscInt, array::$PetscScalar, ptr::Cvoid ) + + @chk ccall( + (:DMPlexPointLocalFieldRead, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{Cvoid}), + dm, point, field, array, ptr, + ) + + + return nothing +end + +""" + DMPlexPointLocalFieldRef(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, field::PetscInt, array::PetscScalar, ptr::Cvoid) +return read/write access to a field on a point in local array + +Not Collective + +Input Parameters: +- `dm` - `DM` defining topological space +- `point` - topological point +- `field` - field number +- `array` - array to index into + +Output Parameter: +- `ptr` - address of reference to point data, type generic so user can place in structure + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexGetPointLocal()`, `DMPlexPointGlobalRef()` + +# External Links +$(_doc_external("DMPlex/DMPlexPointLocalFieldRef")) +""" +function DMPlexPointLocalFieldRef(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, field::PetscInt, array::PetscScalar, ptr::Cvoid) end + +@for_petsc function DMPlexPointLocalFieldRef(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, field::$PetscInt, array::$PetscScalar, ptr::Cvoid ) + + @chk ccall( + (:DMPlexPointLocalFieldRef, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{Cvoid}), + dm, point, field, array, ptr, + ) + + + return nothing +end + +""" + start::PetscInt,end_::PetscInt = DMPlexGetPointGlobal(petsclib::PetscLibType,dm::PetscDM, point::PetscInt) +get location of point data in global Vec + +Not Collective + +Input Parameters: +- `dm` - `DM` defining the topological space +- `point` - topological point + +Output Parameters: +- `start` - start of point data; returns -(globalStart+1) if point is not owned +- `end` - end of point data; returns -(globalEnd+1) if point is not owned + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetPointGlobalField()`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexPointGlobalRead()`, `DMPlexGetPointLocal()`, `DMPlexPointGlobalRef()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetPointGlobal")) +""" +function DMPlexGetPointGlobal(petsclib::PetscLibType, dm::PetscDM, point::PetscInt) end + +@for_petsc function DMPlexGetPointGlobal(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt ) + start_ = Ref{$PetscInt}() + end_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetPointGlobal, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, point, start_, end__, + ) + + start = start_[] + end_ = end__[] + + return start,end_ +end + +""" + DMPlexPointGlobalRead(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, array::PetscScalar, ptr::Cvoid) +return read access to a point in global array + +Not Collective + +Input Parameters: +- `dm` - `DM` defining topological space +- `point` - topological point +- `array` - array to index into + +Output Parameter: +- `ptr` - address of read reference to point data, type generic so user can place in structure; returns NULL if global point is not owned + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexGetPointGlobal()`, `DMPlexPointLocalRead()`, `DMPlexPointGlobalRef()` + +# External Links +$(_doc_external("DMPlex/DMPlexPointGlobalRead")) +""" +function DMPlexPointGlobalRead(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, array::PetscScalar, ptr::Cvoid) end + +@for_petsc function DMPlexPointGlobalRead(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, array::$PetscScalar, ptr::Cvoid ) + + @chk ccall( + (:DMPlexPointGlobalRead, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscScalar}, Ptr{Cvoid}), + dm, point, array, ptr, + ) + + + return nothing +end + +""" + DMPlexPointGlobalRef(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, array::PetscScalar, ptr::Cvoid) +return read/write access to a point in global array + +Not Collective + +Input Parameters: +- `dm` - `DM` defining topological space +- `point` - topological point +- `array` - array to index into + +Output Parameter: +- `ptr` - address of reference to point data, type generic so user can place in structure; returns NULL if global point is not owned + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexGetPointGlobal()`, `DMPlexPointLocalRef()`, `DMPlexPointGlobalRead()` + +# External Links +$(_doc_external("DMPlex/DMPlexPointGlobalRef")) +""" +function DMPlexPointGlobalRef(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, array::PetscScalar, ptr::Cvoid) end + +@for_petsc function DMPlexPointGlobalRef(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, array::$PetscScalar, ptr::Cvoid ) + + @chk ccall( + (:DMPlexPointGlobalRef, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscScalar}, Ptr{Cvoid}), + dm, point, array, ptr, + ) + + + return nothing +end + +""" + start::PetscInt,end_::PetscInt = DMPlexGetPointGlobalField(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, field::PetscInt) +get location of point field data in global `Vec` + +Not Collective + +Input Parameters: +- `dm` - `DM` defining the topological space +- `point` - topological point +- `field` - the field number + +Output Parameters: +- `start` - start of point data; returns -(globalStart+1) if point is not owned +- `end` - end of point data; returns -(globalEnd+1) if point is not owned + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetPointGlobal()`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexPointGlobalRead()`, `DMPlexGetPointLocal()`, `DMPlexPointGlobalRef()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetPointGlobalField")) +""" +function DMPlexGetPointGlobalField(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, field::PetscInt) end + +@for_petsc function DMPlexGetPointGlobalField(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, field::$PetscInt ) + start_ = Ref{$PetscInt}() + end__ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetPointGlobalField, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, point, field, start_, end__, + ) + + start = start_[] + end_ = end__[] + + return start,end_ +end + +""" + DMPlexPointGlobalFieldRead(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, field::PetscInt, array::PetscScalar, ptr::Cvoid) +return read access to a field on a point in global array + +Not Collective + +Input Parameters: +- `dm` - `DM` defining topological space +- `point` - topological point +- `field` - field number +- `array` - array to index into + +Output Parameter: +- `ptr` - address of read reference to point data, type generic so user can place in structure; returns NULL if global point is not owned + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexGetPointGlobal()`, `DMPlexPointLocalRead()`, `DMPlexPointGlobalRef()` + +# External Links +$(_doc_external("DMPlex/DMPlexPointGlobalFieldRead")) +""" +function DMPlexPointGlobalFieldRead(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, field::PetscInt, array::PetscScalar, ptr::Cvoid) end + +@for_petsc function DMPlexPointGlobalFieldRead(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, field::$PetscInt, array::$PetscScalar, ptr::Cvoid ) + + @chk ccall( + (:DMPlexPointGlobalFieldRead, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{Cvoid}), + dm, point, field, array, ptr, + ) + + + return nothing +end + +""" + DMPlexPointGlobalFieldRef(petsclib::PetscLibType,dm::PetscDM, point::PetscInt, field::PetscInt, array::PetscScalar, ptr::Cvoid) +return read/write access to a field on a point in global array + +Not Collective + +Input Parameters: +- `dm` - `DM` defining topological space +- `point` - topological point +- `field` - field number +- `array` - array to index into + +Output Parameter: +- `ptr` - address of reference to point data, type generic so user can place in structure; returns NULL if global point is not owned + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetLocalSection()`, `PetscSectionGetOffset()`, `PetscSectionGetDof()`, `DMPlexGetPointGlobal()`, `DMPlexPointLocalRef()`, `DMPlexPointGlobalRead()` + +# External Links +$(_doc_external("DMPlex/DMPlexPointGlobalFieldRef")) +""" +function DMPlexPointGlobalFieldRef(petsclib::PetscLibType, dm::PetscDM, point::PetscInt, field::PetscInt, array::PetscScalar, ptr::Cvoid) end + +@for_petsc function DMPlexPointGlobalFieldRef(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt, field::$PetscInt, array::$PetscScalar, ptr::Cvoid ) + + @chk ccall( + (:DMPlexPointGlobalFieldRef, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{Cvoid}), + dm, point, field, array, ptr, + ) + + + return nothing +end + +""" + dm::PetscDM = DMPlexCreateExodusFromFile(petsclib::PetscLibType,comm::MPI_Comm, filename::String, interpolate::PetscBool) +Create a `DMPLEX` mesh from an ExodusII file. + +Collective + +Input Parameters: +- `comm` - The MPI communicator +- `filename` - The name of the ExodusII file +- `interpolate` - Create faces and edges in the mesh + +Output Parameter: +- `dm` - The `DM` object representing the mesh + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `PETSCVIEWEREXODUSII`, `DMPLEX`, `DMCreate()`, `DMPlexCreateExodus()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateExodusFromFile")) +""" +function DMPlexCreateExodusFromFile(petsclib::PetscLibType, comm::MPI_Comm, filename::String, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateExodusFromFile(petsclib::$UnionPetscLib, comm::MPI_Comm, filename::String, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateExodusFromFile, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscBool, Ptr{CDM}), + comm, filename, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMPlexCheckInterfaceCones(petsclib::PetscLibType,dm::PetscDM) +Check that points on inter + +Input Parameter: +- `dm` - The `DMPLEX` object + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCone()`, `DMPlexGetConeSize()`, `DMGetPointSF()`, `DMGetCoordinates()`, `DMSetFromOptions()` + +# External Links +$(_doc_external("DMPlex/DMPlexCheckInterfaceCones")) +""" +function DMPlexCheckInterfaceCones(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexCheckInterfaceCones(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexCheckInterfaceCones, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + scale::PetscReal = DMPlexGetScale(petsclib::PetscLibType,dm::PetscDM, unit::PetscUnit) +Get the scale for the specified fundamental unit + +Not Collective + +Input Parameters: +- `dm` - the `DM` +- `unit` - The SI unit + +Output Parameter: +- `scale` - The value used to scale all quantities with this unit + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetScale()`, `PetscUnit` + +# External Links +$(_doc_external("DMPlex/DMPlexGetScale")) +""" +function DMPlexGetScale(petsclib::PetscLibType, dm::PetscDM, unit::PetscUnit) end + +@for_petsc function DMPlexGetScale(petsclib::$UnionPetscLib, dm::PetscDM, unit::PetscUnit ) + scale_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexGetScale, $petsc_library), + PetscErrorCode, + (CDM, PetscUnit, Ptr{$PetscReal}), + dm, unit, scale_, + ) + + scale = scale_[] + + return scale +end + +""" + DMPlexSetScale(petsclib::PetscLibType,dm::PetscDM, unit::PetscUnit, scale::PetscReal) +Set the scale for the specified fundamental unit + +Not Collective + +Input Parameters: +- `dm` - the `DM` +- `unit` - The SI unit +- `scale` - The value used to scale all quantities with this unit + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetScale()`, `PetscUnit` + +# External Links +$(_doc_external("DMPlex/DMPlexSetScale")) +""" +function DMPlexSetScale(petsclib::PetscLibType, dm::PetscDM, unit::PetscUnit, scale::PetscReal) end + +@for_petsc function DMPlexSetScale(petsclib::$UnionPetscLib, dm::PetscDM, unit::PetscUnit, scale::$PetscReal ) + + @chk ccall( + (:DMPlexSetScale, $petsc_library), + PetscErrorCode, + (CDM, PetscUnit, $PetscReal), + dm, unit, scale, + ) + + + return nothing +end + +""" + useClPerm::PetscBool = DMPlexGetUseMatClosurePermutation(petsclib::PetscLibType,dm::PetscDM) +Get flag for using a closure permutation for matrix insertion + +Not collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `useClPerm` - The flag + +Level: intermediate + +-seealso: `DMPlexSetUseMatClosurePermutation()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetUseMatClosurePermutation")) +""" +function DMPlexGetUseMatClosurePermutation(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetUseMatClosurePermutation(petsclib::$UnionPetscLib, dm::PetscDM ) + useClPerm_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexGetUseMatClosurePermutation, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + dm, useClPerm_, + ) + + useClPerm = useClPerm_[] + + return useClPerm +end + +""" + DMPlexSetUseMatClosurePermutation(petsclib::PetscLibType,dm::PetscDM, useClPerm::PetscBool) +Set flag for using a closure permutation for matrix insertion + +Not collective + +Input Parameters: +- `dm` - The `DM` +- `useClPerm` - The flag + +Level: intermediate + +-seealso: `DMPlexGetUseMatClosurePermutation()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetUseMatClosurePermutation")) +""" +function DMPlexSetUseMatClosurePermutation(petsclib::PetscLibType, dm::PetscDM, useClPerm::PetscBool) end + +@for_petsc function DMPlexSetUseMatClosurePermutation(petsclib::$UnionPetscLib, dm::PetscDM, useClPerm::PetscBool ) + + @chk ccall( + (:DMPlexSetUseMatClosurePermutation, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, useClPerm, + ) + + + return nothing +end + +""" + sp::MatNullSpace = DMPlexCreateRigidBody(petsclib::PetscLibType,dm::PetscDM, field::PetscInt) +For the default global section, create rigid body modes by function space interpolation + +Collective + +Input Parameters: +- `dm` - the `DM` +- `field` - The field number for the rigid body space, or 0 for the default + +Output Parameter: +- `sp` - the null space + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `MatNullSpaceCreate()`, `PCGAMG` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateRigidBody")) +""" +function DMPlexCreateRigidBody(petsclib::PetscLibType, dm::PetscDM, field::PetscInt) end + +@for_petsc function DMPlexCreateRigidBody(petsclib::$UnionPetscLib, dm::PetscDM, field::$PetscInt ) + sp_ = Ref{MatNullSpace}() + + @chk ccall( + (:DMPlexCreateRigidBody, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{MatNullSpace}), + dm, field, sp_, + ) + + sp = sp_[] + + return sp +end + +""" + sp::MatNullSpace = DMPlexCreateRigidBodies(petsclib::PetscLibType,dm::PetscDM, nb::PetscInt, label::DMLabel, nids::Vector{PetscInt}, ids::Vector{PetscInt}) +For the default global section, create rigid body modes by function space interpolation + +Collective + +Input Parameters: +- `dm` - the `DM` +- `nb` - The number of bodies +- `label` - The `DMLabel` marking each domain +- `nids` - The number of ids per body +- `ids` - An array of the label ids in sequence for each domain + +Output Parameter: +- `sp` - the null space + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `MatNullSpaceCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateRigidBodies")) +""" +function DMPlexCreateRigidBodies(petsclib::PetscLibType, dm::PetscDM, nb::PetscInt, label::DMLabel, nids::Vector{PetscInt}, ids::Vector{PetscInt}) end + +@for_petsc function DMPlexCreateRigidBodies(petsclib::$UnionPetscLib, dm::PetscDM, nb::$PetscInt, label::DMLabel, nids::Vector{$PetscInt}, ids::Vector{$PetscInt} ) + sp_ = Ref{MatNullSpace}() + + @chk ccall( + (:DMPlexCreateRigidBodies, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, DMLabel, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{MatNullSpace}), + dm, nb, label, nids, ids, sp_, + ) + + sp = sp_[] + + return sp +end + +""" + DMPlexSetMaxProjectionHeight(petsclib::PetscLibType,dm::PetscDM, height::PetscInt) +In DMPlexProjectXXXLocal() functions, the projected values of a basis function's dofs +are computed by associating the basis function with one of the mesh points in its transitively-closed support, and +evaluating the dual space basis of that point. + +Input Parameters: +- `dm` - the `DMPLEX` object +- `height` - the maximum projection height >= 0 + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetMaxProjectionHeight()`, `DMProjectFunctionLocal()`, `DMProjectFunctionLabelLocal()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetMaxProjectionHeight")) +""" +function DMPlexSetMaxProjectionHeight(petsclib::PetscLibType, dm::PetscDM, height::PetscInt) end + +@for_petsc function DMPlexSetMaxProjectionHeight(petsclib::$UnionPetscLib, dm::PetscDM, height::$PetscInt ) + + @chk ccall( + (:DMPlexSetMaxProjectionHeight, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt), + dm, height, + ) + + + return nothing +end + +""" + height::PetscInt = DMPlexGetMaxProjectionHeight(petsclib::PetscLibType,dm::PetscDM) +Get the maximum height (w.r.t. DAG) of mesh points used to evaluate dual bases in +DMPlexProjectXXXLocal() functions. + +Input Parameter: +- `dm` - the `DMPLEX` object + +Output Parameter: +- `height` - the maximum projection height + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetMaxProjectionHeight()`, `DMProjectFunctionLocal()`, `DMProjectFunctionLabelLocal()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetMaxProjectionHeight")) +""" +function DMPlexGetMaxProjectionHeight(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetMaxProjectionHeight(petsclib::$UnionPetscLib, dm::PetscDM ) + height_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetMaxProjectionHeight, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}), + dm, height_, + ) + + height = height_[] + + return height +end + +""" + DMPlexGlobalToLocalBasis(petsclib::PetscLibType,dm::PetscDM, lv::PetscVec) +Transform the values in the given local vector from the global basis to the local basis + +Input Parameters: +- `dm` - The `DM` +- `lv` - A local vector with values in the global basis + +Output Parameter: +- `lv` - A local vector with values in the local basis + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexLocalToGlobalBasis()`, `DMGetLocalSection()`, `DMPlexCreateBasisRotation()` + +# External Links +$(_doc_external("DMPlex/DMPlexGlobalToLocalBasis")) +""" +function DMPlexGlobalToLocalBasis(petsclib::PetscLibType, dm::PetscDM, lv::PetscVec) end + +@for_petsc function DMPlexGlobalToLocalBasis(petsclib::$UnionPetscLib, dm::PetscDM, lv::PetscVec ) + + @chk ccall( + (:DMPlexGlobalToLocalBasis, $petsc_library), + PetscErrorCode, + (CDM, CVec), + dm, lv, + ) + + + return nothing +end + +""" + DMPlexLocalToGlobalBasis(petsclib::PetscLibType,dm::PetscDM, lv::PetscVec) +Transform the values in the given local vector from the local basis to the global basis + +Input Parameters: +- `dm` - The `DM` +- `lv` - A local vector with values in the local basis + +Output Parameter: +- `lv` - A local vector with values in the global basis + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGlobalToLocalBasis()`, `DMGetLocalSection()`, `DMPlexCreateBasisRotation()` + +# External Links +$(_doc_external("DMPlex/DMPlexLocalToGlobalBasis")) +""" +function DMPlexLocalToGlobalBasis(petsclib::PetscLibType, dm::PetscDM, lv::PetscVec) end + +@for_petsc function DMPlexLocalToGlobalBasis(petsclib::$UnionPetscLib, dm::PetscDM, lv::PetscVec ) + + @chk ccall( + (:DMPlexLocalToGlobalBasis, $petsc_library), + PetscErrorCode, + (CDM, CVec), + dm, lv, + ) + + + return nothing +end + +""" + DMPlexCreateBasisRotation(petsclib::PetscLibType,dm::PetscDM, alpha::PetscReal, beta::PetscReal, gamma::PetscReal) +Create an internal transformation from the global basis, used to specify boundary conditions +and global solutions, to a local basis, appropriate for discretization integrals and assembly. + +Input Parameters: +- `dm` - The `DM` +- `alpha` - The first Euler angle, and in 2D the only one +- `beta` - The second Euler angle +- `gamma` - The third Euler angle + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGlobalToLocalBasis()`, `DMPlexLocalToGlobalBasis()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateBasisRotation")) +""" +function DMPlexCreateBasisRotation(petsclib::PetscLibType, dm::PetscDM, alpha::PetscReal, beta::PetscReal, gamma::PetscReal) end + +@for_petsc function DMPlexCreateBasisRotation(petsclib::$UnionPetscLib, dm::PetscDM, alpha::$PetscReal, beta::$PetscReal, gamma::$PetscReal ) + + @chk ccall( + (:DMPlexCreateBasisRotation, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, $PetscReal, $PetscReal), + dm, alpha, beta, gamma, + ) + + + return nothing +end + +""" + DMPlexInsertBoundaryValuesEssential(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, label::DMLabel, numids::PetscInt, ids::Vector{PetscInt}, func::external, ctx::Cvoid, locX::PetscVec) +Insert boundary values into a local vector using a function of the coordinates + +Input Parameters: +- `dm` - The `DM`, with a `PetscDS` that matches the problem being constrained +- `time` - The time +- `field` - The field to constrain +- `Nc` - The number of constrained field components, or 0 for all components +- `comps` - An array of constrained component numbers, or `NULL` for all components +- `label` - The `DMLabel` defining constrained points +- `numids` - The number of `DMLabel` ids for constrained points +- `ids` - An array of ids for constrained points +- `func` - A pointwise function giving boundary values +- `ctx` - An optional user context for bcFunc + +Output Parameter: +- `locX` - A local vector to receives the boundary values + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMLabel`, `DMPlexInsertBoundaryValuesEssentialField()`, `DMPlexInsertBoundaryValuesEssentialBdField()`, `DMAddBoundary()` + +# External Links +$(_doc_external("DMPlex/DMPlexInsertBoundaryValuesEssential")) +""" +function DMPlexInsertBoundaryValuesEssential(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, label::DMLabel, numids::PetscInt, ids::Vector{PetscInt}, func::external, ctx::Cvoid, locX::PetscVec) end + +@for_petsc function DMPlexInsertBoundaryValuesEssential(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, field::$PetscInt, Nc::$PetscInt, comps::Vector{$PetscInt}, label::DMLabel, numids::$PetscInt, ids::Vector{$PetscInt}, func::external, ctx::Cvoid, locX::PetscVec ) + + @chk ccall( + (:DMPlexInsertBoundaryValuesEssential, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, $PetscInt, $PetscInt, Ptr{$PetscInt}, DMLabel, $PetscInt, Ptr{$PetscInt}, external, Ptr{Cvoid}, CVec), + dm, time, field, Nc, comps, label, numids, ids, func, ctx, locX, + ) + + + return nothing +end + +""" + DMPlexInsertBoundaryValuesEssentialField(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, locU::PetscVec, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, label::DMLabel, numids::PetscInt, ids::Vector{PetscInt}, func::external, ctx::Cvoid, locX::PetscVec) +Insert boundary values into a local vector using a function of the coordinates and field data + +Input Parameters: +- `dm` - The `DM`, with a `PetscDS` that matches the problem being constrained +- `time` - The time +- `locU` - A local vector with the input solution values +- `field` - The field to constrain +- `Nc` - The number of constrained field components, or 0 for all components +- `comps` - An array of constrained component numbers, or `NULL` for all components +- `label` - The `DMLabel` defining constrained points +- `numids` - The number of `DMLabel` ids for constrained points +- `ids` - An array of ids for constrained points +- `func` - A pointwise function giving boundary values +- `ctx` - An optional user context for bcFunc + +Output Parameter: +- `locX` - A local vector to receives the boundary values + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexInsertBoundaryValuesEssential()`, `DMPlexInsertBoundaryValuesEssentialBdField()`, `DMAddBoundary()` + +# External Links +$(_doc_external("DMPlex/DMPlexInsertBoundaryValuesEssentialField")) +""" +function DMPlexInsertBoundaryValuesEssentialField(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, locU::PetscVec, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, label::DMLabel, numids::PetscInt, ids::Vector{PetscInt}, func::external, ctx::Cvoid, locX::PetscVec) end + +@for_petsc function DMPlexInsertBoundaryValuesEssentialField(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, locU::PetscVec, field::$PetscInt, Nc::$PetscInt, comps::Vector{$PetscInt}, label::DMLabel, numids::$PetscInt, ids::Vector{$PetscInt}, func::external, ctx::Cvoid, locX::PetscVec ) + + @chk ccall( + (:DMPlexInsertBoundaryValuesEssentialField, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, $PetscInt, $PetscInt, Ptr{$PetscInt}, DMLabel, $PetscInt, Ptr{$PetscInt}, external, Ptr{Cvoid}, CVec), + dm, time, locU, field, Nc, comps, label, numids, ids, func, ctx, locX, + ) + + + return nothing +end + +""" + DMPlexInsertBoundaryValuesEssentialBdField(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, locU::PetscVec, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, label::DMLabel, numids::PetscInt, ids::Vector{PetscInt}, func::external, ctx::Cvoid, locX::PetscVec) +Insert boundary values into a local vector using a function of the coordinates and boundary field data + +Collective + +Input Parameters: +- `dm` - The `DM`, with a `PetscDS` that matches the problem being constrained +- `time` - The time +- `locU` - A local vector with the input solution values +- `field` - The field to constrain +- `Nc` - The number of constrained field components, or 0 for all components +- `comps` - An array of constrained component numbers, or `NULL` for all components +- `label` - The `DMLabel` defining constrained points +- `numids` - The number of `DMLabel` ids for constrained points +- `ids` - An array of ids for constrained points +- `func` - A pointwise function giving boundary values, the calling sequence is given in `DMProjectBdFieldLabelLocal()` +- `ctx` - An optional user context for `func` + +Output Parameter: +- `locX` - A local vector to receive the boundary values + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMProjectBdFieldLabelLocal()`, `DMPlexInsertBoundaryValuesEssential()`, `DMPlexInsertBoundaryValuesEssentialField()`, `DMAddBoundary()` + +# External Links +$(_doc_external("DMPlex/DMPlexInsertBoundaryValuesEssentialBdField")) +""" +function DMPlexInsertBoundaryValuesEssentialBdField(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, locU::PetscVec, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, label::DMLabel, numids::PetscInt, ids::Vector{PetscInt}, func::external, ctx::Cvoid, locX::PetscVec) end + +@for_petsc function DMPlexInsertBoundaryValuesEssentialBdField(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, locU::PetscVec, field::$PetscInt, Nc::$PetscInt, comps::Vector{$PetscInt}, label::DMLabel, numids::$PetscInt, ids::Vector{$PetscInt}, func::external, ctx::Cvoid, locX::PetscVec ) + + @chk ccall( + (:DMPlexInsertBoundaryValuesEssentialBdField, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, $PetscInt, $PetscInt, Ptr{$PetscInt}, DMLabel, $PetscInt, Ptr{$PetscInt}, external, Ptr{Cvoid}, CVec), + dm, time, locU, field, Nc, comps, label, numids, ids, func, ctx, locX, + ) + + + return nothing +end + +""" + DMPlexInsertBoundaryValuesRiemann(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, faceGeometry::PetscVec, cellGeometry::PetscVec, Grad::PetscVec, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, label::DMLabel, numids::PetscInt, ids::Vector{PetscInt}, func::external, ctx::Cvoid, locX::PetscVec) +Insert boundary values into a local vector + +Input Parameters: +- `dm` - The `DM`, with a `PetscDS` that matches the problem being constrained +- `time` - The time +- `faceGeometry` - A vector with the FVM face geometry information +- `cellGeometry` - A vector with the FVM cell geometry information +- `Grad` - A vector with the FVM cell gradient information +- `field` - The field to constrain +- `Nc` - The number of constrained field components, or 0 for all components +- `comps` - An array of constrained component numbers, or `NULL` for all components +- `label` - The `DMLabel` defining constrained points +- `numids` - The number of `DMLabel` ids for constrained points +- `ids` - An array of ids for constrained points +- `func` - A pointwise function giving boundary values +- `ctx` - An optional user context for bcFunc + +Output Parameter: +- `locX` - A local vector to receives the boundary values + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexInsertBoundaryValuesEssential()`, `DMPlexInsertBoundaryValuesEssentialField()`, `DMAddBoundary()` + +# External Links +$(_doc_external("DMPlex/DMPlexInsertBoundaryValuesRiemann")) +""" +function DMPlexInsertBoundaryValuesRiemann(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, faceGeometry::PetscVec, cellGeometry::PetscVec, Grad::PetscVec, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, label::DMLabel, numids::PetscInt, ids::Vector{PetscInt}, func::external, ctx::Cvoid, locX::PetscVec) end + +@for_petsc function DMPlexInsertBoundaryValuesRiemann(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, faceGeometry::PetscVec, cellGeometry::PetscVec, Grad::PetscVec, field::$PetscInt, Nc::$PetscInt, comps::Vector{$PetscInt}, label::DMLabel, numids::$PetscInt, ids::Vector{$PetscInt}, func::external, ctx::Cvoid, locX::PetscVec ) + + @chk ccall( + (:DMPlexInsertBoundaryValuesRiemann, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, CVec, CVec, $PetscInt, $PetscInt, Ptr{$PetscInt}, DMLabel, $PetscInt, Ptr{$PetscInt}, external, Ptr{Cvoid}, CVec), + dm, time, faceGeometry, cellGeometry, Grad, field, Nc, comps, label, numids, ids, func, ctx, locX, + ) + + + return nothing +end + +""" + DMPlexInsertBoundaryValues(petsclib::PetscLibType,dm::PetscDM, insertEssential::PetscBool, locX::PetscVec, time::PetscReal, faceGeomFVM::PetscVec, cellGeomFVM::PetscVec, gradFVM::PetscVec) +Puts coefficients which represent boundary values into the local solution vector + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `insertEssential` - Should I insert essential (e.g. Dirichlet) or inessential (e.g. Neumann) boundary conditions +- `time` - The time +- `faceGeomFVM` - Face geometry data for FV discretizations +- `cellGeomFVM` - Cell geometry data for FV discretizations +- `gradFVM` - Gradient reconstruction data for FV discretizations + +Output Parameter: +- `locX` - Solution updated with boundary values + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMProjectFunctionLabelLocal()`, `DMAddBoundary()` + +# External Links +$(_doc_external("DMPlex/DMPlexInsertBoundaryValues")) +""" +function DMPlexInsertBoundaryValues(petsclib::PetscLibType, dm::PetscDM, insertEssential::PetscBool, locX::PetscVec, time::PetscReal, faceGeomFVM::PetscVec, cellGeomFVM::PetscVec, gradFVM::PetscVec) end + +@for_petsc function DMPlexInsertBoundaryValues(petsclib::$UnionPetscLib, dm::PetscDM, insertEssential::PetscBool, locX::PetscVec, time::$PetscReal, faceGeomFVM::PetscVec, cellGeomFVM::PetscVec, gradFVM::PetscVec ) + + @chk ccall( + (:DMPlexInsertBoundaryValues, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, CVec, $PetscReal, CVec, CVec, CVec), + dm, insertEssential, locX, time, faceGeomFVM, cellGeomFVM, gradFVM, + ) + + + return nothing +end + +""" + DMPlexInsertTimeDerivativeBoundaryValues(petsclib::PetscLibType,dm::PetscDM, insertEssential::PetscBool, locX_t::PetscVec, time::PetscReal, faceGeomFVM::PetscVec, cellGeomFVM::PetscVec, gradFVM::PetscVec) +Puts coefficients which represent boundary values of the time derivative into the local solution vector + +Input Parameters: +- `dm` - The `DM` +- `insertEssential` - Should I insert essential (e.g. Dirichlet) or inessential (e.g. Neumann) boundary conditions +- `time` - The time +- `faceGeomFVM` - Face geometry data for FV discretizations +- `cellGeomFVM` - Cell geometry data for FV discretizations +- `gradFVM` - Gradient reconstruction data for FV discretizations + +Output Parameter: +- `locX_t` - Solution updated with boundary values + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMProjectFunctionLabelLocal()` + +# External Links +$(_doc_external("DMPlex/DMPlexInsertTimeDerivativeBoundaryValues")) +""" +function DMPlexInsertTimeDerivativeBoundaryValues(petsclib::PetscLibType, dm::PetscDM, insertEssential::PetscBool, locX_t::PetscVec, time::PetscReal, faceGeomFVM::PetscVec, cellGeomFVM::PetscVec, gradFVM::PetscVec) end + +@for_petsc function DMPlexInsertTimeDerivativeBoundaryValues(petsclib::$UnionPetscLib, dm::PetscDM, insertEssential::PetscBool, locX_t::PetscVec, time::$PetscReal, faceGeomFVM::PetscVec, cellGeomFVM::PetscVec, gradFVM::PetscVec ) + + @chk ccall( + (:DMPlexInsertTimeDerivativeBoundaryValues, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, CVec, $PetscReal, CVec, CVec, CVec), + dm, insertEssential, locX_t, time, faceGeomFVM, cellGeomFVM, gradFVM, + ) + + + return nothing +end + +""" + DMPlexInsertBounds(petsclib::PetscLibType,dm::PetscDM, lower::PetscBool, time::PetscReal, locB::PetscVec) +Puts coefficients which represent solution bounds into the local bounds vector + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `lower` - If `PETSC_TRUE` use `DM_BC_LOWER_BOUND` conditions, otherwise use `DM_BC_UPPER_BOUND` +- `time` - The time + +Output Parameter: +- `locB` - Bounds vector updated with new bounds + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMProjectFunctionLabelLocal()`, `PetscDSAddBoundary()` + +# External Links +$(_doc_external("DMPlex/DMPlexInsertBounds")) +""" +function DMPlexInsertBounds(petsclib::PetscLibType, dm::PetscDM, lower::PetscBool, time::PetscReal, locB::PetscVec) end + +@for_petsc function DMPlexInsertBounds(petsclib::$UnionPetscLib, dm::PetscDM, lower::PetscBool, time::$PetscReal, locB::PetscVec ) + + @chk ccall( + (:DMPlexInsertBounds, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, $PetscReal, CVec), + dm, lower, time, locB, + ) + + + return nothing +end + +""" + DMPlexInsertBoundaryValuesFVM(petsclib::PetscLibType,dm::PetscDM, fv::PetscFV, locX::PetscVec, time::PetscReal, locGradient::PetscVec) + +# External Links +$(_doc_external("DMPlex/DMPlexInsertBoundaryValuesFVM")) +""" +function DMPlexInsertBoundaryValuesFVM(petsclib::PetscLibType, dm::PetscDM, fv::PetscFV, locX::PetscVec, time::PetscReal, locGradient::PetscVec) end + +@for_petsc function DMPlexInsertBoundaryValuesFVM(petsclib::$UnionPetscLib, dm::PetscDM, fv::PetscFV, locX::PetscVec, time::$PetscReal, locGradient::PetscVec ) + locGradient_ = Ref(locGradient.ptr) + + @chk ccall( + (:DMPlexInsertBoundaryValuesFVM, $petsc_library), + PetscErrorCode, + (CDM, PetscFV, CVec, $PetscReal, Ptr{CVec}), + dm, fv, locX, time, locGradient_, + ) + + locGradient.ptr = locGradient_[] + + return nothing +end + +""" + DMPlexComputeL2FluxDiffVecLocal(petsclib::PetscLibType,lu::PetscVec, f::PetscInt, lmu::PetscVec, mf::PetscInt, eFlux::PetscVec) +This function computes the integral of the difference between the gradient of field `f`in `u` and field `mf` in `mu` + +Collective + +Input Parameters: +- `lu` - The local `Vec` containing the primal solution +- `f` - The field number for the potential +- `lmu` - The local `Vec` containing the mixed solution +- `mf` - The field number for the flux + +Output Parameter: +- `eFlux` - A global `Vec` which holds + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexComputeL2FluxDiffVec()`, `DMProjectFunction()`, `DMComputeL2Diff()`, `DMPlexComputeL2FieldDiff()`, `DMComputeL2GradientDiff()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeL2FluxDiffVecLocal")) +""" +function DMPlexComputeL2FluxDiffVecLocal(petsclib::PetscLibType, lu::PetscVec, f::PetscInt, lmu::PetscVec, mf::PetscInt, eFlux::PetscVec) end + +@for_petsc function DMPlexComputeL2FluxDiffVecLocal(petsclib::$UnionPetscLib, lu::PetscVec, f::$PetscInt, lmu::PetscVec, mf::$PetscInt, eFlux::PetscVec ) + + @chk ccall( + (:DMPlexComputeL2FluxDiffVecLocal, $petsc_library), + PetscErrorCode, + (CVec, $PetscInt, CVec, $PetscInt, CVec), + lu, f, lmu, mf, eFlux, + ) + + + return nothing +end + +""" + DMPlexComputeL2FluxDiffVec(petsclib::PetscLibType,u::PetscVec, f::PetscInt, mu::PetscVec, mf::PetscInt, eFlux::PetscVec) +This function computes the integral of the difference between the gradient of field `f`in `u` and field `mf` in `mu` + +Collective + +Input Parameters: +- `u` - The global `Vec` containing the primal solution +- `f` - The field number for the potential +- `mu` - The global `Vec` containing the mixed solution +- `mf` - The field number for the flux + +Output Parameter: +- `eFlux` - A global `Vec` which holds + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexComputeL2FluxDiffVecLocal()`, `DMProjectFunction()`, `DMComputeL2Diff()`, `DMPlexComputeL2FieldDiff()`, `DMComputeL2GradientDiff()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeL2FluxDiffVec")) +""" +function DMPlexComputeL2FluxDiffVec(petsclib::PetscLibType, u::PetscVec, f::PetscInt, mu::PetscVec, mf::PetscInt, eFlux::PetscVec) end + +@for_petsc function DMPlexComputeL2FluxDiffVec(petsclib::$UnionPetscLib, u::PetscVec, f::$PetscInt, mu::PetscVec, mf::$PetscInt, eFlux::PetscVec ) + + @chk ccall( + (:DMPlexComputeL2FluxDiffVec, $petsc_library), + PetscErrorCode, + (CVec, $PetscInt, CVec, $PetscInt, CVec), + u, f, mu, mf, eFlux, + ) + + + return nothing +end + +""" + DMPlexComputeClementInterpolant(petsclib::PetscLibType,dm::PetscDM, locX::PetscVec, locC::PetscVec) +This function computes the L2 projection of the cellwise values of a function u onto P1 + +Collective + +Input Parameters: +- `dm` - The `DM` +- `locX` - The coefficient vector u_h + +Output Parameter: +- `locC` - A `Vec` which holds the Clement interpolant of the function + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMProjectFunction()`, `DMComputeL2Diff()`, `DMPlexComputeL2FieldDiff()`, `DMComputeL2GradientDiff()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeClementInterpolant")) +""" +function DMPlexComputeClementInterpolant(petsclib::PetscLibType, dm::PetscDM, locX::PetscVec, locC::PetscVec) end + +@for_petsc function DMPlexComputeClementInterpolant(petsclib::$UnionPetscLib, dm::PetscDM, locX::PetscVec, locC::PetscVec ) + + @chk ccall( + (:DMPlexComputeClementInterpolant, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec), + dm, locX, locC, + ) + + + return nothing +end + +""" + DMPlexComputeGradientClementInterpolant(petsclib::PetscLibType,dm::PetscDM, locX::PetscVec, locC::PetscVec) +This function computes the L2 projection of the cellwise gradient of a function u onto P1 + +Collective + +Input Parameters: +- `dm` - The `DM` +- `locX` - The coefficient vector u_h + +Output Parameter: +- `locC` - A `Vec` which holds the Clement interpolant of the gradient + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMProjectFunction()`, `DMComputeL2Diff()`, `DMPlexComputeL2FieldDiff()`, `DMComputeL2GradientDiff()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeGradientClementInterpolant")) +""" +function DMPlexComputeGradientClementInterpolant(petsclib::PetscLibType, dm::PetscDM, locX::PetscVec, locC::PetscVec) end + +@for_petsc function DMPlexComputeGradientClementInterpolant(petsclib::$UnionPetscLib, dm::PetscDM, locX::PetscVec, locC::PetscVec ) + + @chk ccall( + (:DMPlexComputeGradientClementInterpolant, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec), + dm, locX, locC, + ) + + + return nothing +end + +""" + integral::PetscScalar = DMPlexComputeIntegralFEM(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, user::Cvoid) +Form the integral over the domain from the global input X using pointwise functions specified by the user + +Input Parameters: +- `dm` - The mesh +- `X` - Global input vector +- `user` - The user context + +Output Parameter: +- `integral` - Integral for each field + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSNESComputeResidualFEM()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeIntegralFEM")) +""" +function DMPlexComputeIntegralFEM(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexComputeIntegralFEM(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, user::Cvoid ) + integral_ = Ref{$PetscScalar}() + + @chk ccall( + (:DMPlexComputeIntegralFEM, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{$PetscScalar}, Ptr{Cvoid}), + dm, X, integral_, user, + ) + + integral = integral_[] + + return integral +end + +""" + DMPlexComputeCellwiseIntegralFEM(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, F::PetscVec, user::Cvoid) +Form the vector of cellwise integrals F from the global input X using pointwise functions specified by the user + +Input Parameters: +- `dm` - The mesh +- `X` - Global input vector +- `user` - The user context + +Output Parameter: +- `F` - Cellwise integrals for each field + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSNESComputeResidualFEM()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeCellwiseIntegralFEM")) +""" +function DMPlexComputeCellwiseIntegralFEM(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, F::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexComputeCellwiseIntegralFEM(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, F::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeCellwiseIntegralFEM, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec, Ptr{Cvoid}), + dm, X, F, user, + ) + + + return nothing +end + +#= +""" + DMPlexComputeBdIntegral(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, label::DMLabel, numVals::PetscInt, vals::Vector{PetscInt}, ::Cvoid(funcs) +Form the integral over the specified boundary from the global input X using pointwise functions specified by the user + +Input Parameters: +- `dm` - The mesh +- `X` - Global input vector +- `label` - The boundary `DMLabel` +- `numVals` - The number of label values to use, or `PETSC_DETERMINE` for all values +- `vals` - The label values to use, or NULL for all values +- `funcs` - The functions to integrate along the boundary for each field +- `user` - The user context + +Output Parameter: +- `integral` - Integral for each field + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexComputeIntegralFEM()`, `DMPlexComputeBdResidualFEM()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeBdIntegral")) +""" +function DMPlexComputeBdIntegral(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, label::DMLabel, numVals::PetscInt, vals::Vector{PetscInt}, ::Cvoid(funcs) end + +@for_petsc function DMPlexComputeBdIntegral(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, label::DMLabel, numVals::$PetscInt, vals::Vector{$PetscInt}, ::Cvoid(funcs ) + + @chk ccall( + (:DMPlexComputeBdIntegral, $petsc_library), + PetscErrorCode, + (CDM, CVec, DMLabel, $PetscInt, Ptr{$PetscInt}, Cvoid(funcs), + dm, X, label, numVals, vals, , + ) + + + return nothing +end +=# + +""" + DMPlexComputeInterpolatorNested(petsclib::PetscLibType,dmc::PetscDM, dmf::PetscDM, isRefined::PetscBool, In::PetscMat, user::Cvoid) +Form the local portion of the interpolation matrix from the coarse `DM` to a uniformly refined `DM`. + +Input Parameters: +- `dmc` - The coarse mesh +- `dmf` - The fine mesh +- `isRefined` - Flag indicating regular refinement, rather than the same topology +- `user` - The user context + +Output Parameter: +- `In` - The interpolation matrix + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexComputeInterpolatorGeneral()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeInterpolatorNested")) +""" +function DMPlexComputeInterpolatorNested(petsclib::PetscLibType, dmc::PetscDM, dmf::PetscDM, isRefined::PetscBool, In::PetscMat, user::Cvoid) end + +@for_petsc function DMPlexComputeInterpolatorNested(petsclib::$UnionPetscLib, dmc::PetscDM, dmf::PetscDM, isRefined::PetscBool, In::PetscMat, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeInterpolatorNested, $petsc_library), + PetscErrorCode, + (CDM, CDM, PetscBool, CMat, Ptr{Cvoid}), + dmc, dmf, isRefined, In, user, + ) + + + return nothing +end + +""" + DMPlexComputeMassMatrixNested(petsclib::PetscLibType,dmc::PetscDM, dmf::PetscDM, mass::PetscMat, user::Cvoid) + +# External Links +$(_doc_external("DMPlex/DMPlexComputeMassMatrixNested")) +""" +function DMPlexComputeMassMatrixNested(petsclib::PetscLibType, dmc::PetscDM, dmf::PetscDM, mass::PetscMat, user::Cvoid) end + +@for_petsc function DMPlexComputeMassMatrixNested(petsclib::$UnionPetscLib, dmc::PetscDM, dmf::PetscDM, mass::PetscMat, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeMassMatrixNested, $petsc_library), + PetscErrorCode, + (CDM, CDM, CMat, Ptr{Cvoid}), + dmc, dmf, mass, user, + ) + + + return nothing +end + +""" + DMPlexComputeInterpolatorGeneral(petsclib::PetscLibType,dmc::PetscDM, dmf::PetscDM, In::PetscMat, user::Cvoid) +Form the local portion of the interpolation matrix from the coarse `DM` to a non + +Input Parameters: +- `dmf` - The fine mesh +- `dmc` - The coarse mesh +- `user` - The user context + +Output Parameter: +- `In` - The interpolation matrix + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexComputeInterpolatorNested()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeInterpolatorGeneral")) +""" +function DMPlexComputeInterpolatorGeneral(petsclib::PetscLibType, dmc::PetscDM, dmf::PetscDM, In::PetscMat, user::Cvoid) end + +@for_petsc function DMPlexComputeInterpolatorGeneral(petsclib::$UnionPetscLib, dmc::PetscDM, dmf::PetscDM, In::PetscMat, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeInterpolatorGeneral, $petsc_library), + PetscErrorCode, + (CDM, CDM, CMat, Ptr{Cvoid}), + dmc, dmf, In, user, + ) + + + return nothing +end + +""" + DMPlexComputeMassMatrixGeneral(petsclib::PetscLibType,dmc::PetscDM, dmf::PetscDM, mass::PetscMat, user::Cvoid) +Form the local portion of the mass matrix from the coarse `DM` to a non + +Input Parameters: +- `dmf` - The fine mesh +- `dmc` - The coarse mesh +- `user` - The user context + +Output Parameter: +- `mass` - The mass matrix + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexComputeMassMatrixNested()`, `DMPlexComputeInterpolatorNested()`, `DMPlexComputeInterpolatorGeneral()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeMassMatrixGeneral")) +""" +function DMPlexComputeMassMatrixGeneral(petsclib::PetscLibType, dmc::PetscDM, dmf::PetscDM, mass::PetscMat, user::Cvoid) end + +@for_petsc function DMPlexComputeMassMatrixGeneral(petsclib::$UnionPetscLib, dmc::PetscDM, dmf::PetscDM, mass::PetscMat, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeMassMatrixGeneral, $petsc_library), + PetscErrorCode, + (CDM, CDM, CMat, Ptr{Cvoid}), + dmc, dmf, mass, user, + ) + + + return nothing +end + +""" + DMPlexComputeInjectorFEM(petsclib::PetscLibType,dmc::PetscDM, dmf::PetscDM, sc::VecScatter, user::Cvoid) +Compute a mapping from coarse unknowns to fine unknowns + +Input Parameters: +- `dmc` - The coarse mesh +- `dmf` - The fine mesh +- `user` - The user context + +Output Parameter: +- `sc` - The mapping + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexComputeInterpolatorNested()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeInjectorFEM")) +""" +function DMPlexComputeInjectorFEM(petsclib::PetscLibType, dmc::PetscDM, dmf::PetscDM, sc::VecScatter, user::Cvoid) end + +@for_petsc function DMPlexComputeInjectorFEM(petsclib::$UnionPetscLib, dmc::PetscDM, dmf::PetscDM, sc::VecScatter, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeInjectorFEM, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{VecScatter}, Ptr{Cvoid}), + dmc, dmf, sc, user, + ) + + + return nothing +end + +""" + u::Vector{PetscScalar},u_t::Vector{PetscScalar},a::Vector{PetscScalar} = DMPlexGetCellFields(petsclib::PetscLibType,dm::PetscDM, cellIS::IS, locX::PetscVec, locX_t::PetscVec, locA::PetscVec) +Retrieve the field values values for a chunk of cells + +Input Parameters: +- `dm` - The `DM` +- `cellIS` - The cells to include +- `locX` - A local vector with the solution fields +- `locX_t` - A local vector with solution field time derivatives, or `NULL` +- `locA` - A local vector with auxiliary fields, or `NULL` + +Output Parameters: +- `u` - The field coefficients +- `u_t` - The fields derivative coefficients +- `a` - The auxiliary field coefficients + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetFaceFields()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetCellFields")) +""" +function DMPlexGetCellFields(petsclib::PetscLibType, dm::PetscDM, cellIS::IS, locX::PetscVec, locX_t::PetscVec, locA::PetscVec) end + +@for_petsc function DMPlexGetCellFields(petsclib::$UnionPetscLib, dm::PetscDM, cellIS::IS, locX::PetscVec, locX_t::PetscVec, locA::PetscVec ) + u_ = Ref{Ptr{$PetscScalar}}() + u_t_ = Ref{Ptr{$PetscScalar}}() + a_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexGetCellFields, $petsc_library), + PetscErrorCode, + (CDM, CIS, CVec, CVec, CVec, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}), + dm, cellIS, locX, locX_t, locA, u_, u_t_, a_, + ) + + u = unsafe_wrap(Array, u_[], VecGetLocalSize(petsclib, x); own = false) + u_t = unsafe_wrap(Array, u_t_[], VecGetLocalSize(petsclib, x); own = false) + a = unsafe_wrap(Array, a_[], VecGetLocalSize(petsclib, x); own = false) + + return u,u_t,a +end + +""" + u::Vector{PetscScalar},u_t::Vector{PetscScalar},a::Vector{PetscScalar} = DMPlexRestoreCellFields(petsclib::PetscLibType,dm::PetscDM, cellIS::IS, locX::PetscVec, locX_t::PetscVec, locA::PetscVec) +Restore the field values values for a chunk of cells + +Input Parameters: +- `dm` - The `DM` +- `cellIS` - The cells to include +- `locX` - A local vector with the solution fields +- `locX_t` - A local vector with solution field time derivatives, or `NULL` +- `locA` - A local vector with auxiliary fields, or `NULL` + +Output Parameters: +- `u` - The field coefficients +- `u_t` - The fields derivative coefficients +- `a` - The auxiliary field coefficients + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetFaceFields()` + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreCellFields")) +""" +function DMPlexRestoreCellFields(petsclib::PetscLibType, dm::PetscDM, cellIS::IS, locX::PetscVec, locX_t::PetscVec, locA::PetscVec) end + +@for_petsc function DMPlexRestoreCellFields(petsclib::$UnionPetscLib, dm::PetscDM, cellIS::IS, locX::PetscVec, locX_t::PetscVec, locA::PetscVec ) + u_ = Ref{Ptr{$PetscScalar}}() + u_t_ = Ref{Ptr{$PetscScalar}}() + a_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexRestoreCellFields, $petsc_library), + PetscErrorCode, + (CDM, CIS, CVec, CVec, CVec, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}), + dm, cellIS, locX, locX_t, locA, u_, u_t_, a_, + ) + + u = unsafe_wrap(Array, u_[], VecGetLocalSize(petsclib, x); own = false) + u_t = unsafe_wrap(Array, u_t_[], VecGetLocalSize(petsclib, x); own = false) + a = unsafe_wrap(Array, a_[], VecGetLocalSize(petsclib, x); own = false) + + return u,u_t,a +end + +""" + Nface::PetscInt,uL::Vector{PetscScalar},uR::Vector{PetscScalar} = DMPlexGetFaceFields(petsclib::PetscLibType,dm::PetscDM, fStart::PetscInt, fEnd::PetscInt, locX::PetscVec, locX_t::PetscVec, faceGeometry::PetscVec, cellGeometry::PetscVec, locGrad::PetscVec) +Retrieve the field values values for a chunk of faces + +Input Parameters: +- `dm` - The `DM` +- `fStart` - The first face to include +- `fEnd` - The first face to exclude +- `locX` - A local vector with the solution fields +- `locX_t` - A local vector with solution field time derivatives, or `NULL` +- `faceGeometry` - A local vector with face geometry +- `cellGeometry` - A local vector with cell geometry +- `locGrad` - A local vector with field gradients, or `NULL` + +Output Parameters: +- `Nface` - The number of faces with field values +- `uL` - The field values at the left side of the face +- `uR` - The field values at the right side of the face + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellFields()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetFaceFields")) +""" +function DMPlexGetFaceFields(petsclib::PetscLibType, dm::PetscDM, fStart::PetscInt, fEnd::PetscInt, locX::PetscVec, locX_t::PetscVec, faceGeometry::PetscVec, cellGeometry::PetscVec, locGrad::PetscVec) end + +@for_petsc function DMPlexGetFaceFields(petsclib::$UnionPetscLib, dm::PetscDM, fStart::$PetscInt, fEnd::$PetscInt, locX::PetscVec, locX_t::PetscVec, faceGeometry::PetscVec, cellGeometry::PetscVec, locGrad::PetscVec ) + Nface_ = Ref{$PetscInt}() + uL_ = Ref{Ptr{$PetscScalar}}() + uR_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexGetFaceFields, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, CVec, CVec, CVec, CVec, CVec, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}), + dm, fStart, fEnd, locX, locX_t, faceGeometry, cellGeometry, locGrad, Nface_, uL_, uR_, + ) + + Nface = Nface_[] + uL = unsafe_wrap(Array, uL_[], VecGetLocalSize(petsclib, x); own = false) + uR = unsafe_wrap(Array, uR_[], VecGetLocalSize(petsclib, x); own = false) + + return Nface,uL,uR +end + +""" + Nface::PetscInt,uL::Vector{PetscScalar},uR::Vector{PetscScalar} = DMPlexRestoreFaceFields(petsclib::PetscLibType,dm::PetscDM, fStart::PetscInt, fEnd::PetscInt, locX::PetscVec, locX_t::PetscVec, faceGeometry::PetscVec, cellGeometry::PetscVec, locGrad::PetscVec) +Restore the field values values for a chunk of faces + +Input Parameters: +- `dm` - The `DM` +- `fStart` - The first face to include +- `fEnd` - The first face to exclude +- `locX` - A local vector with the solution fields +- `locX_t` - A local vector with solution field time derivatives, or `NULL` +- `faceGeometry` - A local vector with face geometry +- `cellGeometry` - A local vector with cell geometry +- `locGrad` - A local vector with field gradients, or `NULL` + +Output Parameters: +- `Nface` - The number of faces with field values +- `uL` - The field values at the left side of the face +- `uR` - The field values at the right side of the face + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetFaceFields()` + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreFaceFields")) +""" +function DMPlexRestoreFaceFields(petsclib::PetscLibType, dm::PetscDM, fStart::PetscInt, fEnd::PetscInt, locX::PetscVec, locX_t::PetscVec, faceGeometry::PetscVec, cellGeometry::PetscVec, locGrad::PetscVec) end + +@for_petsc function DMPlexRestoreFaceFields(petsclib::$UnionPetscLib, dm::PetscDM, fStart::$PetscInt, fEnd::$PetscInt, locX::PetscVec, locX_t::PetscVec, faceGeometry::PetscVec, cellGeometry::PetscVec, locGrad::PetscVec ) + Nface_ = Ref{$PetscInt}() + uL_ = Ref{Ptr{$PetscScalar}}() + uR_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexRestoreFaceFields, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, CVec, CVec, CVec, CVec, CVec, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}), + dm, fStart, fEnd, locX, locX_t, faceGeometry, cellGeometry, locGrad, Nface_, uL_, uR_, + ) + + Nface = Nface_[] + uL = unsafe_wrap(Array, uL_[], VecGetLocalSize(petsclib, x); own = false) + uR = unsafe_wrap(Array, uR_[], VecGetLocalSize(petsclib, x); own = false) + + return Nface,uL,uR +end + +""" + Nface::PetscInt,vol::Vector{PetscReal} = DMPlexGetFaceGeometry(petsclib::PetscLibType,dm::PetscDM, fStart::PetscInt, fEnd::PetscInt, faceGeometry::PetscVec, cellGeometry::PetscVec, fgeom::Vector{PetscFVFaceGeom}) +Retrieve the geometric values for a chunk of faces + +Input Parameters: +- `dm` - The `DM` +- `fStart` - The first face to include +- `fEnd` - The first face to exclude +- `faceGeometry` - A local vector with face geometry +- `cellGeometry` - A local vector with cell geometry + +Output Parameters: +- `Nface` - The number of faces with field values +- `fgeom` - The face centroid and normals +- `vol` - The cell volumes + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellFields()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetFaceGeometry")) +""" +function DMPlexGetFaceGeometry(petsclib::PetscLibType, dm::PetscDM, fStart::PetscInt, fEnd::PetscInt, faceGeometry::PetscVec, cellGeometry::PetscVec, fgeom::Vector{PetscFVFaceGeom}) end + +@for_petsc function DMPlexGetFaceGeometry(petsclib::$UnionPetscLib, dm::PetscDM, fStart::$PetscInt, fEnd::$PetscInt, faceGeometry::PetscVec, cellGeometry::PetscVec, fgeom::Vector{PetscFVFaceGeom} ) + Nface_ = Ref{$PetscInt}() + fgeom_ = Ref(pointer(fgeom)) + vol_ = Ref{Ptr{$PetscReal}}() + + @chk ccall( + (:DMPlexGetFaceGeometry, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, CVec, CVec, Ptr{$PetscInt}, Ptr{Ptr{PetscFVFaceGeom}}, Ptr{Ptr{$PetscReal}}), + dm, fStart, fEnd, faceGeometry, cellGeometry, Nface_, fgeom_, vol_, + ) + + Nface = Nface_[] + vol = unsafe_wrap(Array, vol_[], VecGetLocalSize(petsclib, x); own = false) + + return Nface,vol +end + +""" + Nface::PetscInt,vol::Vector{PetscReal} = DMPlexRestoreFaceGeometry(petsclib::PetscLibType,dm::PetscDM, fStart::PetscInt, fEnd::PetscInt, faceGeometry::PetscVec, cellGeometry::PetscVec, fgeom::Vector{PetscFVFaceGeom}) +Restore the field values values for a chunk of faces + +Input Parameters: +- `dm` - The `DM` +- `fStart` - The first face to include +- `fEnd` - The first face to exclude +- `faceGeometry` - A local vector with face geometry +- `cellGeometry` - A local vector with cell geometry + +Output Parameters: +- `Nface` - The number of faces with field values +- `fgeom` - The face centroid and normals +- `vol` - The cell volumes + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetFaceFields()` + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreFaceGeometry")) +""" +function DMPlexRestoreFaceGeometry(petsclib::PetscLibType, dm::PetscDM, fStart::PetscInt, fEnd::PetscInt, faceGeometry::PetscVec, cellGeometry::PetscVec, fgeom::Vector{PetscFVFaceGeom}) end + +@for_petsc function DMPlexRestoreFaceGeometry(petsclib::$UnionPetscLib, dm::PetscDM, fStart::$PetscInt, fEnd::$PetscInt, faceGeometry::PetscVec, cellGeometry::PetscVec, fgeom::Vector{PetscFVFaceGeom} ) + Nface_ = Ref{$PetscInt}() + fgeom_ = Ref(pointer(fgeom)) + vol_ = Ref{Ptr{$PetscReal}}() + + @chk ccall( + (:DMPlexRestoreFaceGeometry, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, CVec, CVec, Ptr{$PetscInt}, Ptr{Ptr{PetscFVFaceGeom}}, Ptr{Ptr{$PetscReal}}), + dm, fStart, fEnd, faceGeometry, cellGeometry, Nface_, fgeom_, vol_, + ) + + Nface = Nface_[] + vol = unsafe_wrap(Array, vol_[], VecGetLocalSize(petsclib, x); own = false) + + return Nface,vol +end + +""" + minRadius::PetscReal = DMPlexGetGeometryFVM(petsclib::PetscLibType,dm::PetscDM, facegeom::PetscVec, cellgeom::PetscVec) +Return precomputed geometric data + +Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameters: +- `facegeom` - The values precomputed from face geometry +- `cellgeom` - The values precomputed from cell geometry +- `minRadius` - The minimum radius over the mesh of an inscribed sphere in a cell, or `NULL` if not needed + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMTSSetRHSFunctionLocal()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeometryFVM")) +""" +function DMPlexGetGeometryFVM(petsclib::PetscLibType, dm::PetscDM, facegeom::PetscVec, cellgeom::PetscVec) end + +@for_petsc function DMPlexGetGeometryFVM(petsclib::$UnionPetscLib, dm::PetscDM, facegeom::PetscVec, cellgeom::PetscVec ) + facegeom_ = Ref(facegeom.ptr) + cellgeom_ = Ref(cellgeom.ptr) + minRadius_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexGetGeometryFVM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}, Ptr{CVec}, Ptr{$PetscReal}), + dm, facegeom_, cellgeom_, minRadius_, + ) + + facegeom.ptr = facegeom_[] + cellgeom.ptr = cellgeom_[] + minRadius = minRadius_[] + + return minRadius +end + +""" + DMPlexGetGradientDM(petsclib::PetscLibType,dm::PetscDM, fv::PetscFV, dmGrad::PetscDM) +Return gradient data layout + +Collective + +Input Parameters: +- `dm` - The `DM` +- `fv` - The `PetscFV` + +Output Parameter: +- `dmGrad` - The layout for gradient values + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetGeometryFVM()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetGradientDM")) +""" +function DMPlexGetGradientDM(petsclib::PetscLibType, dm::PetscDM, fv::PetscFV, dmGrad::PetscDM) end + +@for_petsc function DMPlexGetGradientDM(petsclib::$UnionPetscLib, dm::PetscDM, fv::PetscFV, dmGrad::PetscDM ) + dmGrad_ = Ref(dmGrad.ptr) + + @chk ccall( + (:DMPlexGetGradientDM, $petsc_library), + PetscErrorCode, + (CDM, PetscFV, Ptr{CDM}), + dm, fv, dmGrad_, + ) + + dmGrad.ptr = dmGrad_[] + + return nothing +end + +""" + DMPlexComputeBdResidualSingleByKey(petsclib::PetscLibType,dm::PetscDM, wf::PetscWeakForm, key::PetscFormKey, facetIS::IS, locX::PetscVec, locX_t::PetscVec, t::PetscReal, coordField::DMField, locF::PetscVec) +Compute the local boundary residual for terms matching the input key + +Not collective + +Input Parameters: +- `dm` - The output `DM` +- `wf` - The `PetscWeakForm` holding forms on this boundary +- `key` - The `PetscFormKey` indicating what should be integrated +- `facetIS` - The `IS` giving a set of faces to integrate over +- `locX` - The local solution +- `locX_t` - The time derivative of the local solution, or `NULL` for time-independent problems +- `t` - The time +- `coordField` - The `DMField` object with coordinates for these faces + +Output Parameter: +- `locF` - The local residual + +Level: developer + +-seealso: `DMPlexComputeBdResidualSingle()`, `DMPlexComputeJacobianByKey()`, `DMPlexComputeResidualHybridByKey()`, `DMPlexComputeJacobianHybridByKey()`, `PetscFormKey` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeBdResidualSingleByKey")) +""" +function DMPlexComputeBdResidualSingleByKey(petsclib::PetscLibType, dm::PetscDM, wf::PetscWeakForm, key::PetscFormKey, facetIS::IS, locX::PetscVec, locX_t::PetscVec, t::PetscReal, coordField::DMField, locF::PetscVec) end + +@for_petsc function DMPlexComputeBdResidualSingleByKey(petsclib::$UnionPetscLib, dm::PetscDM, wf::PetscWeakForm, key::PetscFormKey, facetIS::IS, locX::PetscVec, locX_t::PetscVec, t::$PetscReal, coordField::DMField, locF::PetscVec ) + + @chk ccall( + (:DMPlexComputeBdResidualSingleByKey, $petsc_library), + PetscErrorCode, + (CDM, PetscWeakForm, PetscFormKey, CIS, CVec, CVec, $PetscReal, DMField, CVec), + dm, wf, key, facetIS, locX, locX_t, t, coordField, locF, + ) + + + return nothing +end + +""" + DMPlexComputeBdResidualSingle(petsclib::PetscLibType,dm::PetscDM, wf::PetscWeakForm, key::PetscFormKey, locX::PetscVec, locX_t::PetscVec, t::PetscReal, locF::PetscVec) +Compute the local boundary residual + +Not collective + +Input Parameters: +- `dm` - The output `DM` +- `wf` - The `PetscWeakForm` holding forms on this boundary +- `key` - The `PetscFormKey` indicating what should be integrated +- `locX` - The local solution +- `locX_t` - The time derivative of the local solution, or `NULL` for time-independent problems +- `t` - The time + +Output Parameter: +- `locF` - The local residual + +Level: developer + +-seealso: `DMPlexComputeBdResidualSingleByKey()`, `DMPlexComputeJacobianByKey()`, `DMPlexComputeResidualHybridByKey()`, `DMPlexComputeJacobianHybridByKey()`, `PetscFormKey` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeBdResidualSingle")) +""" +function DMPlexComputeBdResidualSingle(petsclib::PetscLibType, dm::PetscDM, wf::PetscWeakForm, key::PetscFormKey, locX::PetscVec, locX_t::PetscVec, t::PetscReal, locF::PetscVec) end + +@for_petsc function DMPlexComputeBdResidualSingle(petsclib::$UnionPetscLib, dm::PetscDM, wf::PetscWeakForm, key::PetscFormKey, locX::PetscVec, locX_t::PetscVec, t::$PetscReal, locF::PetscVec ) + + @chk ccall( + (:DMPlexComputeBdResidualSingle, $petsc_library), + PetscErrorCode, + (CDM, PetscWeakForm, PetscFormKey, CVec, CVec, $PetscReal, CVec), + dm, wf, key, locX, locX_t, t, locF, + ) + + + return nothing +end + +""" + DMPlexComputeResidualByKey(petsclib::PetscLibType,dm::PetscDM, key::PetscFormKey, cellIS::IS, time::PetscReal, locX::PetscVec, locX_t::PetscVec, t::PetscReal, locF::PetscVec, user::Cvoid) +Compute the local residual for terms matching the input key + +Collective + +Input Parameters: +- `dm` - The output `DM` +- `key` - The `PetscFormKey` indicating what should be integrated +- `cellIS` - The `IS` giving a set of cells to integrate over +- `time` - The time, or `PETSC_MIN_REAL` to include implicit terms in a time-independent problems +- `locX` - The local solution +- `locX_t` - The time derivative of the local solution, or `NULL` for time-independent problems +- `t` - The time +- `user` - An optional user context, passed to the pointwise functions + +Output Parameter: +- `locF` - The local residual + +Level: developer + +-seealso: `DMPlexComputeJacobianByKey()`, `DMPlexComputeResidualHybridByKey()`, `DMPlexComputeJacobianHybridByKey()`, `PetscFormKey` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeResidualByKey")) +""" +function DMPlexComputeResidualByKey(petsclib::PetscLibType, dm::PetscDM, key::PetscFormKey, cellIS::IS, time::PetscReal, locX::PetscVec, locX_t::PetscVec, t::PetscReal, locF::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexComputeResidualByKey(petsclib::$UnionPetscLib, dm::PetscDM, key::PetscFormKey, cellIS::IS, time::$PetscReal, locX::PetscVec, locX_t::PetscVec, t::$PetscReal, locF::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeResidualByKey, $petsc_library), + PetscErrorCode, + (CDM, PetscFormKey, CIS, $PetscReal, CVec, CVec, $PetscReal, CVec, Ptr{Cvoid}), + dm, key, cellIS, time, locX, locX_t, t, locF, user, + ) + + + return nothing +end + +""" + DMPlexComputeResidualHybridByKey(petsclib::PetscLibType,dm::PetscDM, key::Vector{PetscFormKey}, cellIS::IS, time::PetscReal, locX::PetscVec, locX_t::PetscVec, t::PetscReal, locF::PetscVec, user::Cvoid) +Compute the local residual over hybrid cells for terms matching the input key + +Collective + +Input Parameters: +- `dm` - The output `DM` +- `key` - The `PetscFormKey` array (left cell, right cell, cohesive cell) indicating what should be integrated +- `cellIS` - The `IS` give a set of cells to integrate over +- `time` - The time, or `PETSC_MIN_REAL` to include implicit terms in a time-independent problems +- `locX` - The local solution +- `locX_t` - The time derivative of the local solution, or `NULL` for time-independent problems +- `t` - The time +- `user` - An optional user context, passed to the pointwise functions + +Output Parameter: +- `locF` - The local residual + +Level: developer + +-seealso: `DMPlexComputeResidualByKey()`, `DMPlexComputeJacobianByKey()`, `DMPlexComputeJacobianHybridByKey()`, `PetscFormKey` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeResidualHybridByKey")) +""" +function DMPlexComputeResidualHybridByKey(petsclib::PetscLibType, dm::PetscDM, key::Vector{PetscFormKey}, cellIS::IS, time::PetscReal, locX::PetscVec, locX_t::PetscVec, t::PetscReal, locF::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexComputeResidualHybridByKey(petsclib::$UnionPetscLib, dm::PetscDM, key::Vector{PetscFormKey}, cellIS::IS, time::$PetscReal, locX::PetscVec, locX_t::PetscVec, t::$PetscReal, locF::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeResidualHybridByKey, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscFormKey}, CIS, $PetscReal, CVec, CVec, $PetscReal, CVec, Ptr{Cvoid}), + dm, key, cellIS, time, locX, locX_t, t, locF, user, + ) + + + return nothing +end + +""" + DMPlexComputeBdJacobianSingleByLabel(petsclib::PetscLibType,dm::PetscDM, wf::PetscWeakForm, label::DMLabel, numValues::PetscInt, values::Vector{PetscInt}, fieldI::PetscInt, facetIS::IS, locX::PetscVec, locX_t::PetscVec, t::PetscReal, coordField::DMField, X_tShift::PetscReal, Jac::PetscMat, JacP::PetscMat) +Compute the local boundary Jacobian for terms matching the input label + +Not collective + +Input Parameters: +- `dm` - The output `DM` +- `wf` - The `PetscWeakForm` holding forms on this boundary +- `label` - The `DMLabel` indicating what faces should be integrated over +- `numValues` - The number of label values +- `values` - The array of label values +- `fieldI` - The test field for these integrals +- `facetIS` - The `IS` giving the set of possible faces to integrate over (intersected with the label) +- `locX` - The local solution +- `locX_t` - The time derivative of the local solution, or `NULL` for time-independent problems +- `t` - The time +- `coordField` - The `DMField` object with coordinates for these faces +- `X_tShift` - The multiplier for dF/dxdot + +Output Parameters: +- `Jac` - The local Jacobian +- `JacP` - The local Jacobian preconditioner + +Level: developer + +-seealso: `DMPlexComputeBdJacobianSingle()`, `DMPlexComputeJacobianByKey()`, `DMPlexComputeResidualHybridByKey()`, `DMPlexComputeJacobianHybridByKey()`, `PetscFormKey` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeBdJacobianSingleByLabel")) +""" +function DMPlexComputeBdJacobianSingleByLabel(petsclib::PetscLibType, dm::PetscDM, wf::PetscWeakForm, label::DMLabel, numValues::PetscInt, values::Vector{PetscInt}, fieldI::PetscInt, facetIS::IS, locX::PetscVec, locX_t::PetscVec, t::PetscReal, coordField::DMField, X_tShift::PetscReal, Jac::PetscMat, JacP::PetscMat) end + +@for_petsc function DMPlexComputeBdJacobianSingleByLabel(petsclib::$UnionPetscLib, dm::PetscDM, wf::PetscWeakForm, label::DMLabel, numValues::$PetscInt, values::Vector{$PetscInt}, fieldI::$PetscInt, facetIS::IS, locX::PetscVec, locX_t::PetscVec, t::$PetscReal, coordField::DMField, X_tShift::$PetscReal, Jac::PetscMat, JacP::PetscMat ) + + @chk ccall( + (:DMPlexComputeBdJacobianSingleByLabel, $petsc_library), + PetscErrorCode, + (CDM, PetscWeakForm, DMLabel, $PetscInt, Ptr{$PetscInt}, $PetscInt, CIS, CVec, CVec, $PetscReal, DMField, $PetscReal, CMat, CMat), + dm, wf, label, numValues, values, fieldI, facetIS, locX, locX_t, t, coordField, X_tShift, Jac, JacP, + ) + + + return nothing +end + +""" + DMPlexComputeBdJacobianSingle(petsclib::PetscLibType,dm::PetscDM, wf::PetscWeakForm, label::DMLabel, numValues::PetscInt, values::Vector{PetscInt}, fieldI::PetscInt, locX::PetscVec, locX_t::PetscVec, t::PetscReal, X_tShift::PetscReal, Jac::PetscMat, JacP::PetscMat) +Compute the local boundary Jacobian + +Not collective + +Input Parameters: +- `dm` - The output `DM` +- `wf` - The `PetscWeakForm` holding forms on this boundary +- `label` - The `DMLabel` indicating what faces should be integrated over +- `numValues` - The number of label values +- `values` - The array of label values +- `fieldI` - The test field for these integrals +- `locX` - The local solution +- `locX_t` - The time derivative of the local solution, or `NULL` for time-independent problems +- `t` - The time +- `X_tShift` - The multiplier for dF/dxdot + +Output Parameters: +- `Jac` - The local Jacobian +- `JacP` - The local Jacobian preconditioner + +Level: developer + +-seealso: `DMPlexComputeBdJacobianSingleByLabel()`, `DMPlexComputeJacobianByKey()`, `DMPlexComputeResidualHybridByKey()`, `DMPlexComputeJacobianHybridByKey()`, `PetscFormKey` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeBdJacobianSingle")) +""" +function DMPlexComputeBdJacobianSingle(petsclib::PetscLibType, dm::PetscDM, wf::PetscWeakForm, label::DMLabel, numValues::PetscInt, values::Vector{PetscInt}, fieldI::PetscInt, locX::PetscVec, locX_t::PetscVec, t::PetscReal, X_tShift::PetscReal, Jac::PetscMat, JacP::PetscMat) end + +@for_petsc function DMPlexComputeBdJacobianSingle(petsclib::$UnionPetscLib, dm::PetscDM, wf::PetscWeakForm, label::DMLabel, numValues::$PetscInt, values::Vector{$PetscInt}, fieldI::$PetscInt, locX::PetscVec, locX_t::PetscVec, t::$PetscReal, X_tShift::$PetscReal, Jac::PetscMat, JacP::PetscMat ) + + @chk ccall( + (:DMPlexComputeBdJacobianSingle, $petsc_library), + PetscErrorCode, + (CDM, PetscWeakForm, DMLabel, $PetscInt, Ptr{$PetscInt}, $PetscInt, CVec, CVec, $PetscReal, $PetscReal, CMat, CMat), + dm, wf, label, numValues, values, fieldI, locX, locX_t, t, X_tShift, Jac, JacP, + ) + + + return nothing +end + +""" + DMPlexComputeJacobianByKey(petsclib::PetscLibType,dm::PetscDM, key::PetscFormKey, cellIS::IS, t::PetscReal, X_tShift::PetscReal, locX::PetscVec, locX_t::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid) +Compute the local Jacobian for terms matching the input key + +Collective + +Input Parameters: +- `dm` - The output `DM` +- `key` - The `PetscFormKey` indicating what should be integrated +- `cellIS` - The `IS` give a set of cells to integrate over +- `t` - The time +- `X_tShift` - The multiplier for the Jacobian with respect to X_t +- `locX` - The local solution +- `locX_t` - The time derivative of the local solution, or `NULL` for time-independent problems +- `user` - An optional user context, passed to the pointwise functions + +Output Parameters: +- `Jac` - The local Jacobian +- `JacP` - The local Jacobian preconditioner + +Level: developer + +-seealso: `DMPlexComputeResidualByKey()`, `DMPlexComputeResidualHybridByKey()`, `DMPlexComputeJacobianHybridByKey()`, `PetscFormKey` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeJacobianByKey")) +""" +function DMPlexComputeJacobianByKey(petsclib::PetscLibType, dm::PetscDM, key::PetscFormKey, cellIS::IS, t::PetscReal, X_tShift::PetscReal, locX::PetscVec, locX_t::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid) end + +@for_petsc function DMPlexComputeJacobianByKey(petsclib::$UnionPetscLib, dm::PetscDM, key::PetscFormKey, cellIS::IS, t::$PetscReal, X_tShift::$PetscReal, locX::PetscVec, locX_t::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeJacobianByKey, $petsc_library), + PetscErrorCode, + (CDM, PetscFormKey, CIS, $PetscReal, $PetscReal, CVec, CVec, CMat, CMat, Ptr{Cvoid}), + dm, key, cellIS, t, X_tShift, locX, locX_t, Jac, JacP, user, + ) + + + return nothing +end + +""" + DMPlexComputeJacobianByKeyGeneral(petsclib::PetscLibType,dmr::PetscDM, dmc::PetscDM, key::PetscFormKey, cellIS::IS, t::PetscReal, X_tShift::PetscReal, locX::PetscVec, locX_t::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid) + +# External Links +$(_doc_external("DMPlex/DMPlexComputeJacobianByKeyGeneral")) +""" +function DMPlexComputeJacobianByKeyGeneral(petsclib::PetscLibType, dmr::PetscDM, dmc::PetscDM, key::PetscFormKey, cellIS::IS, t::PetscReal, X_tShift::PetscReal, locX::PetscVec, locX_t::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid) end + +@for_petsc function DMPlexComputeJacobianByKeyGeneral(petsclib::$UnionPetscLib, dmr::PetscDM, dmc::PetscDM, key::PetscFormKey, cellIS::IS, t::$PetscReal, X_tShift::$PetscReal, locX::PetscVec, locX_t::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeJacobianByKeyGeneral, $petsc_library), + PetscErrorCode, + (CDM, CDM, PetscFormKey, CIS, $PetscReal, $PetscReal, CVec, CVec, CMat, CMat, Ptr{Cvoid}), + dmr, dmc, key, cellIS, t, X_tShift, locX, locX_t, Jac, JacP, user, + ) + + + return nothing +end + +""" + DMPlexComputeJacobianHybridByKey(petsclib::PetscLibType,dm::PetscDM, key::Vector{PetscFormKey}, cellIS::IS, t::PetscReal, X_tShift::PetscReal, locX::PetscVec, locX_t::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid) +Compute the local Jacobian over hybrid cells for terms matching the input key + +Collective + +Input Parameters: +- `dm` - The output `DM` +- `key` - The `PetscFormKey` array (left cell, right cell, cohesive cell) indicating what should be integrated +- `cellIS` - The `IS` give a set of cells to integrate over +- `t` - The time +- `X_tShift` - The multiplier for the Jacobian with respect to X_t +- `locX` - The local solution +- `locX_t` - The time derivative of the local solution, or `NULL` for time-independent problems +- `user` - An optional user context, passed to the pointwise functions + +Output Parameters: +- `Jac` - The local Jacobian +- `JacP` - The local Jacobian preconditioner + +Level: developer + +-seealso: `DMPlexComputeResidualByKey()`, `DMPlexComputeJacobianByKey()`, `DMPlexComputeResidualHybridByKey()`, `PetscFormKey` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeJacobianHybridByKey")) +""" +function DMPlexComputeJacobianHybridByKey(petsclib::PetscLibType, dm::PetscDM, key::Vector{PetscFormKey}, cellIS::IS, t::PetscReal, X_tShift::PetscReal, locX::PetscVec, locX_t::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid) end + +@for_petsc function DMPlexComputeJacobianHybridByKey(petsclib::$UnionPetscLib, dm::PetscDM, key::Vector{PetscFormKey}, cellIS::IS, t::$PetscReal, X_tShift::$PetscReal, locX::PetscVec, locX_t::PetscVec, Jac::PetscMat, JacP::PetscMat, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeJacobianHybridByKey, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscFormKey}, CIS, $PetscReal, $PetscReal, CVec, CVec, CMat, CMat, Ptr{Cvoid}), + dm, key, cellIS, t, X_tShift, locX, locX_t, Jac, JacP, user, + ) + + + return nothing +end + +""" + DMPlexComputeJacobianActionByKey(petsclib::PetscLibType,dm::PetscDM, key::PetscFormKey, cellIS::IS, t::PetscReal, X_tShift::PetscReal, locX::PetscVec, locX_t::PetscVec, locY::PetscVec, locF::PetscVec, user::Cvoid) +Compute the local Jacobian for terms matching the input key + +Collective + +Input Parameters: +- `dm` - The output `DM` +- `key` - The `PetscFormKey` indicating what should be integrated +- `cellIS` - The `IS` give a set of cells to integrate over +- `t` - The time +- `X_tShift` - The multiplier for the Jacobian with respect to X_t +- `locX` - The local solution +- `locX_t` - The time derivative of the local solution, or `NULL` for time-independent problems +- `locY` - The local vector acted on by J +- `user` - An optional user context, passed to the pointwise functions + +Output Parameter: +- `locF` - The local residual F = J(X) Y + +Level: developer + +-seealso: `DMPlexComputeResidualByKey()`, `DMPlexComputeJacobianByKey()`, `DMPlexComputeResidualHybridByKey()`, `DMPlexComputeJacobianHybridByKey()`, `PetscFormKey` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeJacobianActionByKey")) +""" +function DMPlexComputeJacobianActionByKey(petsclib::PetscLibType, dm::PetscDM, key::PetscFormKey, cellIS::IS, t::PetscReal, X_tShift::PetscReal, locX::PetscVec, locX_t::PetscVec, locY::PetscVec, locF::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexComputeJacobianActionByKey(petsclib::$UnionPetscLib, dm::PetscDM, key::PetscFormKey, cellIS::IS, t::$PetscReal, X_tShift::$PetscReal, locX::PetscVec, locX_t::PetscVec, locY::PetscVec, locF::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexComputeJacobianActionByKey, $petsc_library), + PetscErrorCode, + (CDM, PetscFormKey, CIS, $PetscReal, $PetscReal, CVec, CVec, CVec, CVec, Ptr{Cvoid}), + dm, key, cellIS, t, X_tShift, locX, locX_t, locY, locF, user, + ) + + + return nothing +end + +""" + moments::Vector{PetscReal} = DMPlexComputeMoments(petsclib::PetscLibType,dm::PetscDM, u::PetscVec) +Compute the first three moments for a field + +Noncollective + +Input Parameters: +- `dm` - the `DMPLEX` +- `u` - the field + +Output Parameter: +- `moments` - the field moments + +Level: intermediate + +-seealso: `DM`, `DMPLEX`, `DMSwarmComputeMoments()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeMoments")) +""" +function DMPlexComputeMoments(petsclib::PetscLibType, dm::PetscDM, u::PetscVec) end + +@for_petsc function DMPlexComputeMoments(petsclib::$UnionPetscLib, dm::PetscDM, u::PetscVec ) + moments = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMPlexComputeMoments, $petsc_library), + PetscErrorCode, + (CDM, CVec, Ptr{$PetscReal}), + dm, u, moments, + ) + + + return moments +end + +""" + dm::PetscDM = DMPlexCreatePLYFromFile(petsclib::PetscLibType,comm::MPI_Comm, filename::String, interpolate::PetscBool) +Create a `DMPLEX` mesh from a PLY file. + +Input Parameters: +- `comm` - The MPI communicator +- `filename` - Name of the .ply file +- `interpolate` - Create faces and edges in the mesh + +Output Parameter: +- `dm` - The `DMPLEX` object representing the mesh + +Level: beginner + +-seealso: `DMPlexCreateFromFile()`, `DMPlexCreateGmsh()`, `DMPlexCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreatePLYFromFile")) +""" +function DMPlexCreatePLYFromFile(petsclib::PetscLibType, comm::MPI_Comm, filename::String, interpolate::PetscBool) end + +@for_petsc function DMPlexCreatePLYFromFile(petsclib::$UnionPetscLib, comm::MPI_Comm, filename::String, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreatePLYFromFile, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscBool, Ptr{CDM}), + comm, filename, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMPlexVTKWriteAll(petsclib::PetscLibType,odm::PetscObject, viewer::PetscViewer) +Write a file containing all the fields that have been provided to the viewer + +Collective + +Input Parameters: +- `odm` - The `DMPLEX` specifying the mesh, passed as a `PetscObject` +- `viewer` - viewer of type `PETSCVIEWERVTK` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `PETSCVIEWEREXODUSII`, `DMPLEX`, `PETSCVIEWERVTK` + +# External Links +$(_doc_external("DMPlex/DMPlexVTKWriteAll")) +""" +function DMPlexVTKWriteAll(petsclib::PetscLibType, odm::PetscObject, viewer::PetscViewer) end + +@for_petsc function DMPlexVTKWriteAll(petsclib::$UnionPetscLib, odm::PetscObject, viewer::PetscViewer ) + + @chk ccall( + (:DMPlexVTKWriteAll, $petsc_library), + PetscErrorCode, + (PetscObject, PetscViewer), + odm, viewer, + ) + + + return nothing +end + +""" + DMPlexPreallocateOperator(petsclib::PetscLibType,dm::PetscDM, bs::PetscInt, dnz::Vector{PetscInt}, onz::Vector{PetscInt}, dnzu::Vector{PetscInt}, onzu::Vector{PetscInt}, A::PetscMat, fillMatrix::PetscBool) +Calculate the matrix nonzero pattern based upon the information in the `DM`, +the `PetscDS` it contains, and the default `PetscSection`. + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `bs` - The matrix blocksize +- `dnz` - An array to hold the number of nonzeros in the diagonal block +- `onz` - An array to hold the number of nonzeros in the off-diagonal block +- `dnzu` - An array to hold the number of nonzeros in the upper triangle of the diagonal block +- `onzu` - An array to hold the number of nonzeros in the upper triangle of the off-diagonal block +- `fillMatrix` - If `PETSC_TRUE`, fill the matrix with zeros + +Output Parameter: +- `A` - The preallocated matrix + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreateMatrix()` + +# External Links +$(_doc_external("DMPlex/DMPlexPreallocateOperator")) +""" +function DMPlexPreallocateOperator(petsclib::PetscLibType, dm::PetscDM, bs::PetscInt, dnz::Vector{PetscInt}, onz::Vector{PetscInt}, dnzu::Vector{PetscInt}, onzu::Vector{PetscInt}, A::PetscMat, fillMatrix::PetscBool) end + +@for_petsc function DMPlexPreallocateOperator(petsclib::$UnionPetscLib, dm::PetscDM, bs::$PetscInt, dnz::Vector{$PetscInt}, onz::Vector{$PetscInt}, dnzu::Vector{$PetscInt}, onzu::Vector{$PetscInt}, A::PetscMat, fillMatrix::PetscBool ) + + @chk ccall( + (:DMPlexPreallocateOperator, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, CMat, PetscBool), + dm, bs, dnz, onz, dnzu, onzu, A, fillMatrix, + ) + + + return nothing +end + +""" + section::PetscSection = DMPlexCreateSection(petsclib::PetscLibType,dm::PetscDM, label::Vector{DMLabel}, numComp::Vector{PetscInt}, numDof::Vector{PetscInt}, numBC::PetscInt, bcField::Vector{PetscInt}, bcComps::Vector{IS}, bcPoints::Vector{IS}, perm::IS) +Create a `PetscSection` based upon the dof layout specification provided. + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `label` - An array of `DMLabel` of length `numFields` indicating the mesh support of each field, or `NULL` for the whole mesh +- `numComp` - An array of size `numFields` that holds the number of components for each field +- `numDof` - An array of size numFields \time (dim+1) which holds the number of dof for each field on a mesh piece of dimension d +- `numBC` - The number of boundary conditions +- `bcField` - An array of size `numBC` giving the field number for each boundary condition +- `bcComps` - [Optional] An array of size `numBC` of `IS` holding the field components to which each boundary condition applies +- `bcPoints` - An array of size `numBC` of `IS` holding the `DMPLEX` points to which each boundary condition applies +- `perm` - Optional permutation of the chart, or `NULL` + +Output Parameter: +- `section` - The `PetscSection` object + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `PetscSectionCreate()`, `PetscSectionSetPermutation()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateSection")) +""" +function DMPlexCreateSection(petsclib::PetscLibType, dm::PetscDM, label::Vector{DMLabel}, numComp::Vector{PetscInt}, numDof::Vector{PetscInt}, numBC::PetscInt, bcField::Vector{PetscInt}, bcComps::Vector{IS}, bcPoints::Vector{IS}, perm::IS) end + +@for_petsc function DMPlexCreateSection(petsclib::$UnionPetscLib, dm::PetscDM, label::Vector{DMLabel}, numComp::Vector{$PetscInt}, numDof::Vector{$PetscInt}, numBC::$PetscInt, bcField::Vector{$PetscInt}, bcComps::Vector{IS}, bcPoints::Vector{IS}, perm::IS ) + section_ = Ref{PetscSection}() + + @chk ccall( + (:DMPlexCreateSection, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMLabel}, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CIS}, Ptr{CIS}, CIS, Ptr{PetscSection}), + dm, label, numComp, numDof, numBC, bcField, bcComps, bcPoints, perm, section_, + ) + + section = section_[] + + return section +end + +""" + DMPlexSetReferenceTree(petsclib::PetscLibType,dm::PetscDM, ref::PetscDM) +set the reference tree for hierarchically non + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `ref` - The reference tree `DMPLEX` object + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`,`DMPlexGetReferenceTree()`, `DMPlexCreateDefaultReferenceTree()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetReferenceTree")) +""" +function DMPlexSetReferenceTree(petsclib::PetscLibType, dm::PetscDM, ref::PetscDM) end + +@for_petsc function DMPlexSetReferenceTree(petsclib::$UnionPetscLib, dm::PetscDM, ref::PetscDM ) + + @chk ccall( + (:DMPlexSetReferenceTree, $petsc_library), + PetscErrorCode, + (CDM, CDM), + dm, ref, + ) + + + return nothing +end + +""" + DMPlexGetReferenceTree(petsclib::PetscLibType,dm::PetscDM, ref::PetscDM) +get the reference tree for hierarchically non + +Not Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `ref` - The reference tree `DMPLEX` object + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetReferenceTree()`, `DMPlexCreateDefaultReferenceTree()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetReferenceTree")) +""" +function DMPlexGetReferenceTree(petsclib::PetscLibType, dm::PetscDM, ref::PetscDM) end + +@for_petsc function DMPlexGetReferenceTree(petsclib::$UnionPetscLib, dm::PetscDM, ref::PetscDM ) + ref_ = Ref(ref.ptr) + + @chk ccall( + (:DMPlexGetReferenceTree, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CDM}), + dm, ref_, + ) + + ref.ptr = ref_[] + + return nothing +end + +""" + childOrientB::PetscInt,childB::PetscInt = DMPlexReferenceTreeGetChildSymmetry(petsclib::PetscLibType,dm::PetscDM, parent::PetscInt, parentOrientA::PetscInt, childOrientA::PetscInt, childA::PetscInt, parentOrientB::PetscInt) +Given a reference tree, transform a childid and orientation from one parent frame to another + +Input Parameters: +- `dm` - the reference tree `DMPLEX` object +- `parent` - the parent point +- `parentOrientA` - the reference orientation for describing the parent +- `childOrientA` - the reference orientation for describing the child +- `childA` - the reference childID for describing the child +- `parentOrientB` - the new orientation for describing the parent + +Output Parameters: +- `childOrientB` - if not `NULL`, set to the new orientation for describing the child +- `childB` - if not `NULL`, the new childID for describing the child + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetReferenceTree()`, `DMPlexSetReferenceTree()`, `DMPlexSetTree()` + +# External Links +$(_doc_external("DMPlex/DMPlexReferenceTreeGetChildSymmetry")) +""" +function DMPlexReferenceTreeGetChildSymmetry(petsclib::PetscLibType, dm::PetscDM, parent::PetscInt, parentOrientA::PetscInt, childOrientA::PetscInt, childA::PetscInt, parentOrientB::PetscInt) end + +@for_petsc function DMPlexReferenceTreeGetChildSymmetry(petsclib::$UnionPetscLib, dm::PetscDM, parent::$PetscInt, parentOrientA::$PetscInt, childOrientA::$PetscInt, childA::$PetscInt, parentOrientB::$PetscInt ) + childOrientB_ = Ref{$PetscInt}() + childB_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexReferenceTreeGetChildSymmetry, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, parent, parentOrientA, childOrientA, childA, parentOrientB, childOrientB_, childB_, + ) + + childOrientB = childOrientB_[] + childB = childB_[] + + return childOrientB,childB +end + +""" + ref::PetscDM = DMPlexCreateDefaultReferenceTree(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, simplex::PetscBool) +create a reference tree for isotropic hierarchical mesh refinement. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `dim` - the spatial dimension +- `simplex` - Flag for simplex, otherwise use a tensor-product cell + +Output Parameter: +- `ref` - the reference tree `DMPLEX` object + +Level: intermediate + +-seealso: `DMPlexSetReferenceTree()`, `DMPlexGetReferenceTree()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateDefaultReferenceTree")) +""" +function DMPlexCreateDefaultReferenceTree(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, simplex::PetscBool) end + +@for_petsc function DMPlexCreateDefaultReferenceTree(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, simplex::PetscBool ) + ref_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateDefaultReferenceTree, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, PetscBool, Ptr{CDM}), + comm, dim, simplex, ref_, + ) + + ref = PetscDM(ref_[], petsclib) + + return ref +end + +""" + DMPlexSetTree(petsclib::PetscLibType,dm::PetscDM, parentSection::PetscSection, parents::Vector{PetscInt}, childIDs::Vector{PetscInt}) +set the tree that describes the hierarchy of non +the point-to-point constraints determined by the tree: a point is constrained to the points in the closure of its +tree root. + +Collective + +Input Parameters: +- `dm` - the `DMPLEX` object +- `parentSection` - a section describing the tree: a point has a parent if it has 1 dof in the section; the section +offset indexes the parent and childID list; the reference count of parentSection is incremented +- `parents` - a list of the point parents; copied, can be destroyed +- `childIDs` - identifies the relationship of the child point to the parent point; if there is a reference tree, then +the child corresponds to the point in the reference tree with index childIDs; copied, can be destroyed + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetTree()`, `DMPlexSetReferenceTree()`, `DMPlexSetAnchors()`, `DMPlexGetTreeParent()`, `DMPlexGetTreeChildren()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetTree")) +""" +function DMPlexSetTree(petsclib::PetscLibType, dm::PetscDM, parentSection::PetscSection, parents::Vector{PetscInt}, childIDs::Vector{PetscInt}) end + +@for_petsc function DMPlexSetTree(petsclib::$UnionPetscLib, dm::PetscDM, parentSection::PetscSection, parents::Vector{$PetscInt}, childIDs::Vector{$PetscInt} ) + + @chk ccall( + (:DMPlexSetTree, $petsc_library), + PetscErrorCode, + (CDM, PetscSection, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, parentSection, parents, childIDs, + ) + + + return nothing +end + +""" + parents::Vector{PetscInt},childIDs::Vector{PetscInt},children::Vector{PetscInt} = DMPlexGetTree(petsclib::PetscLibType,dm::PetscDM, parentSection::PetscSection, childSection::PetscSection) +get the tree that describes the hierarchy of non +Collective + +Input Parameter: +- `dm` - the `DMPLEX` object + +Output Parameters: +- `parentSection` - a section describing the tree: a point has a parent if it has 1 dof in the section; the section +offset indexes the parent and childID list +- `parents` - a list of the point parents +- `childIDs` - identifies the relationship of the child point to the parent point; if there is a reference tree, then +the child corresponds to the point in the reference tree with index childID +- `childSection` - the inverse of the parent section +- `children` - a list of the point children + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`,`DMPlexSetTree()`, `DMPlexSetReferenceTree()`, `DMPlexSetAnchors()`, `DMPlexGetTreeParent()`, `DMPlexGetTreeChildren()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetTree")) +""" +function DMPlexGetTree(petsclib::PetscLibType, dm::PetscDM, parentSection::PetscSection, childSection::PetscSection) end + +@for_petsc function DMPlexGetTree(petsclib::$UnionPetscLib, dm::PetscDM, parentSection::PetscSection, childSection::PetscSection ) + parents_ = Ref{Ptr{$PetscInt}}() + childIDs_ = Ref{Ptr{$PetscInt}}() + children_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetTree, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSection}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{PetscSection}, Ptr{Ptr{$PetscInt}}), + dm, parentSection, parents_, childIDs_, childSection, children_, + ) + + parents = unsafe_wrap(Array, parents_[], VecGetLocalSize(petsclib, x); own = false) + childIDs = unsafe_wrap(Array, childIDs_[], VecGetLocalSize(petsclib, x); own = false) + children = unsafe_wrap(Array, children_[], VecGetLocalSize(petsclib, x); own = false) + + return parents,childIDs,children +end + +""" + parent::PetscInt,childID::PetscInt = DMPlexGetTreeParent(petsclib::PetscLibType,dm::PetscDM, point::PetscInt) +get the parent of a point in the tree describing the point hierarchy (not the DAG) + +Input Parameters: +- `dm` - the `DMPLEX` object +- `point` - the query point + +Output Parameters: +- `parent` - if not `NULL`, set to the parent of the point, or the point itself if the point does not have a parent +- `childID` - if not `NULL`, set to the child ID of the point with respect to its parent, or 0 if the point +does not have a parent + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetTree()`, `DMPlexGetTree()`, `DMPlexGetTreeChildren()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetTreeParent")) +""" +function DMPlexGetTreeParent(petsclib::PetscLibType, dm::PetscDM, point::PetscInt) end + +@for_petsc function DMPlexGetTreeParent(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt ) + parent_ = Ref{$PetscInt}() + childID_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetTreeParent, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, point, parent_, childID_, + ) + + parent = parent_[] + childID = childID_[] + + return parent,childID +end + +""" + numChildren::PetscInt,children::Vector{PetscInt} = DMPlexGetTreeChildren(petsclib::PetscLibType,dm::PetscDM, point::PetscInt) +get the children of a point in the tree describing the point hierarchy (not the DAG) + +Input Parameters: +- `dm` - the `DMPLEX` object +- `point` - the query point + +Output Parameters: +- `numChildren` - if not `NULL`, set to the number of children +- `children` - if not `NULL`, set to a list children, or set to `NULL` if the point has no children + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexSetTree()`, `DMPlexGetTree()`, `DMPlexGetTreeParent()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetTreeChildren")) +""" +function DMPlexGetTreeChildren(petsclib::PetscLibType, dm::PetscDM, point::PetscInt) end + +@for_petsc function DMPlexGetTreeChildren(petsclib::$UnionPetscLib, dm::PetscDM, point::$PetscInt ) + numChildren_ = Ref{$PetscInt}() + children_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetTreeChildren, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, point, numChildren_, children_, + ) + + numChildren = numChildren_[] + children = unsafe_wrap(Array, children_[], VecGetLocalSize(petsclib, x); own = false) + + return numChildren,children +end + +""" + DMPlexTreeRefineCell(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt, ncdm::PetscDM) + +# External Links +$(_doc_external("DMPlex/DMPlexTreeRefineCell")) +""" +function DMPlexTreeRefineCell(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt, ncdm::PetscDM) end + +@for_petsc function DMPlexTreeRefineCell(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt, ncdm::PetscDM ) + ncdm_ = Ref(ncdm.ptr) + + @chk ccall( + (:DMPlexTreeRefineCell, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{CDM}), + dm, cell, ncdm_, + ) + + ncdm.ptr = ncdm_[] + + return nothing +end + +""" + DMPlexComputeInjectorReferenceTree(petsclib::PetscLibType,refTree::PetscDM, inj::PetscMat) + +# External Links +$(_doc_external("DMPlex/DMPlexComputeInjectorReferenceTree")) +""" +function DMPlexComputeInjectorReferenceTree(petsclib::PetscLibType, refTree::PetscDM, inj::PetscMat) end + +@for_petsc function DMPlexComputeInjectorReferenceTree(petsclib::$UnionPetscLib, refTree::PetscDM, inj::PetscMat ) + inj_ = Ref(inj.ptr) + + @chk ccall( + (:DMPlexComputeInjectorReferenceTree, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CMat}), + refTree, inj_, + ) + + inj.ptr = inj_[] + + return nothing +end + +""" + DMPlexTransferVecTree(petsclib::PetscLibType,dmIn::PetscDM, vecIn::PetscVec, dmOut::PetscDM, vecOut::PetscVec, sfRefine::PetscSF, sfCoarsen::PetscSF, cidsRefine::PetscInt, cidsCoarsen::PetscInt, useBCs::PetscBool, time::PetscReal) +transfer a vector between two meshes that differ from each other by refinement/coarsening +that can be represented by a common reference tree used by both. This routine can be used for a combination of +coarsening and refinement at the same time. + +Collective + +Input Parameters: +- `dmIn` - The `DMPLEX` mesh for the input vector +- `dmOut` - The second `DMPLEX` mesh +- `vecIn` - The input vector +- `sfRefine` - A star forest indicating points in the mesh `dmIn` (roots in the star forest) that are parents to points in +the mesh `dmOut` (leaves in the star forest), i.e. where `dmOut` is more refined than `dmIn` +- `sfCoarsen` - A star forest indicating points in the mesh `dmOut` (roots in the star forest) that are parents to points in +the mesh `dmIn` (leaves in the star forest), i.e. where `dmOut` is more coarsened than `dmIn` +- `cidsRefine` - The childIds of the points in `dmOut`. These childIds relate back to the reference tree: childid[j] = k implies +that mesh point j of `dmOut` was refined from a point in `dmIn` just as the mesh point k in the reference +tree was refined from its parent. childid[j] = -1 indicates that the point j in `dmOut` is exactly +equivalent to its root in `dmIn`, so no interpolation is necessary. childid[j] = -2 indicates that this +point j in `dmOut` is not a leaf of `sfRefine`. +- `cidsCoarsen` - The childIds of the points in `dmIn`. These childIds relate back to the reference tree: childid[j] = k implies +that mesh point j of dmIn coarsens to a point in `dmOut` just as the mesh point k in the reference +tree coarsens to its parent. childid[j] = -2 indicates that point j in `dmOut` is not a leaf in `sfCoarsen`. +- `useBCs` - `PETSC_TRUE` indicates that boundary values should be inserted into `vecIn` before transfer. +- `time` - Used if boundary values are time dependent. + +Output Parameter: +- `vecOut` - Using interpolation and injection operators calculated on the reference tree, the transferred +projection of `vecIn` from `dmIn` to `dmOut`. Note that any field discretized with a `PetscFV` finite volume +method that uses gradient reconstruction will use reconstructed gradients when interpolating from +coarse points to fine points. + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscSF`, `Vec`, `PetscFV`, `DMPlexSetReferenceTree()`, `DMPlexGetReferenceTree()`, `PetscFVGetComputeGradients()` + +# External Links +$(_doc_external("DMPlex/DMPlexTransferVecTree")) +""" +function DMPlexTransferVecTree(petsclib::PetscLibType, dmIn::PetscDM, vecIn::PetscVec, dmOut::PetscDM, vecOut::PetscVec, sfRefine::PetscSF, sfCoarsen::PetscSF, cidsRefine::PetscInt, cidsCoarsen::PetscInt, useBCs::PetscBool, time::PetscReal) end + +@for_petsc function DMPlexTransferVecTree(petsclib::$UnionPetscLib, dmIn::PetscDM, vecIn::PetscVec, dmOut::PetscDM, vecOut::PetscVec, sfRefine::PetscSF, sfCoarsen::PetscSF, cidsRefine::$PetscInt, cidsCoarsen::$PetscInt, useBCs::PetscBool, time::$PetscReal ) + + @chk ccall( + (:DMPlexTransferVecTree, $petsc_library), + PetscErrorCode, + (CDM, CVec, CDM, CVec, PetscSF, PetscSF, Ptr{$PetscInt}, Ptr{$PetscInt}, PetscBool, $PetscReal), + dmIn, vecIn, dmOut, vecOut, sfRefine, sfCoarsen, cidsRefine, cidsCoarsen, useBCs, time, + ) + + + return nothing +end + +""" + DMPlexFindVertices(petsclib::PetscLibType,dm::PetscDM, coordinates::PetscVec, eps::PetscReal, points::IS) +Try to find DAG points based on their coordinates. + +Not Collective (provided `DMGetCoordinatesLocalSetUp()` has been already called) + +Input Parameters: +- `dm` - The `DMPLEX` object +- `coordinates` - The `Vec` of coordinates of the sought points +- `eps` - The tolerance or `PETSC_DEFAULT` + +Output Parameter: +- `points` - The `IS` of found DAG points or -1 + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexCreate()`, `DMGetCoordinatesLocal()` + +# External Links +$(_doc_external("DMPlex/DMPlexFindVertices")) +""" +function DMPlexFindVertices(petsclib::PetscLibType, dm::PetscDM, coordinates::PetscVec, eps::PetscReal, points::IS) end + +@for_petsc function DMPlexFindVertices(petsclib::$UnionPetscLib, dm::PetscDM, coordinates::PetscVec, eps::$PetscReal, points::IS ) + + @chk ccall( + (:DMPlexFindVertices, $petsc_library), + PetscErrorCode, + (CDM, CVec, $PetscReal, Ptr{CIS}), + dm, coordinates, eps, points, + ) + + + return nothing +end + +""" + R::Vector{PetscReal} = DMPlexComputeProjection2Dto1D(petsclib::PetscLibType,coords::Vector{PetscScalar}) +Rewrite coordinates to be the 1D projection of the 2D coordinates + +Not Collective + +Input/Output Parameter: +- `coords` - The coordinates of a segment, on output the new y-coordinate, and 0 for x, an array of size 4, last two entries are unchanged + +Output Parameter: +- `R` - The rotation which accomplishes the projection, array of size 4 + +Level: developer + +-seealso: `DMPLEX`, `DMPlexComputeProjection3Dto1D()`, `DMPlexComputeProjection3Dto2D()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeProjection2Dto1D")) +""" +function DMPlexComputeProjection2Dto1D(petsclib::PetscLibType, coords::Vector{PetscScalar}) end + +@for_petsc function DMPlexComputeProjection2Dto1D(petsclib::$UnionPetscLib, coords::Vector{$PetscScalar} ) + R = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMPlexComputeProjection2Dto1D, $petsc_library), + PetscErrorCode, + (Ptr{$PetscScalar}, Ptr{$PetscReal}), + coords, R, + ) + + + return R +end + +""" + R::Vector{PetscReal} = DMPlexComputeProjection3Dto1D(petsclib::PetscLibType,coords::Vector{PetscScalar}) +Rewrite coordinates to be the 1D projection of the 3D coordinates + +Not Collective + +Input/Output Parameter: +- `coords` - The coordinates of a segment; on output, the new y-coordinate, and 0 for x and z, an array of size 6, the other entries are unchanged + +Output Parameter: +- `R` - The rotation which accomplishes the projection, an array of size 9 + +Level: developer + +-seealso: `DMPLEX`, `DMPlexComputeProjection2Dto1D()`, `DMPlexComputeProjection3Dto2D()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeProjection3Dto1D")) +""" +function DMPlexComputeProjection3Dto1D(petsclib::PetscLibType, coords::Vector{PetscScalar}) end + +@for_petsc function DMPlexComputeProjection3Dto1D(petsclib::$UnionPetscLib, coords::Vector{$PetscScalar} ) + R = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMPlexComputeProjection3Dto1D, $petsc_library), + PetscErrorCode, + (Ptr{$PetscScalar}, Ptr{$PetscReal}), + coords, R, + ) + + + return R +end + +""" + R::Vector{PetscReal} = DMPlexComputeProjection3Dto2D(petsclib::PetscLibType,coordSize::PetscInt, coords::Vector{PetscScalar}) +Rewrite coordinates of 3 or more coplanar 3D points to a common 2D basis for the +plane. The normal is defined by positive orientation of the first 3 points. + +Not Collective + +Input Parameter: +- `coordSize` - Length of coordinate array (3x number of points); must be at least 9 (3 points) + +Input/Output Parameter: +- `coords` - The interlaced coordinates of each coplanar 3D point; on output the first +2*coordSize/3 entries contain interlaced 2D points, with the rest undefined + +Output Parameter: +- `R` - 3x3 row-major rotation matrix whose columns are the tangent basis [t1, t2, n]. Multiplying by R^T transforms from original frame to tangent frame. + +Level: developer + +-seealso: `DMPLEX`, `DMPlexComputeProjection2Dto1D()`, `DMPlexComputeProjection3Dto1D()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeProjection3Dto2D")) +""" +function DMPlexComputeProjection3Dto2D(petsclib::PetscLibType, coordSize::PetscInt, coords::Vector{PetscScalar}) end + +@for_petsc function DMPlexComputeProjection3Dto2D(petsclib::$UnionPetscLib, coordSize::$PetscInt, coords::Vector{$PetscScalar} ) + R = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMPlexComputeProjection3Dto2D, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscScalar}, Ptr{$PetscReal}), + coordSize, coords, R, + ) + + + return R +end + +""" + isDG::PetscBool,Nc::PetscInt,array::Vector{PetscScalar},coords::Vector{PetscScalar} = DMPlexGetCellCoordinates(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt) +Get coordinates for a cell, taking into account periodicity + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `cell` - The cell number + +Output Parameters: +- `isDG` - Using cellwise coordinates +- `Nc` - The number of coordinates +- `array` - The coordinate array +- `coords` - The cell coordinates + +Level: developer + +-seealso: `DMPLEX`, `DMPlexRestoreCellCoordinates()`, `DMGetCoordinatesLocal()`, `DMGetCellCoordinatesLocal()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetCellCoordinates")) +""" +function DMPlexGetCellCoordinates(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt) end + +@for_petsc function DMPlexGetCellCoordinates(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt ) + isDG_ = Ref{PetscBool}() + Nc_ = Ref{$PetscInt}() + array_ = Ref{Ptr{$PetscScalar}}() + coords_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexGetCellCoordinates, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscBool}, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}), + dm, cell, isDG_, Nc_, array_, coords_, + ) + + isDG = isDG_[] + Nc = Nc_[] + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + coords = unsafe_wrap(Array, coords_[], VecGetLocalSize(petsclib, x); own = false) + + return isDG,Nc,array,coords +end + +""" + isDG::PetscBool,Nc::PetscInt,array::Vector{PetscScalar},coords::Vector{PetscScalar} = DMPlexRestoreCellCoordinates(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt) +Get coordinates for a cell, taking into account periodicity + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `cell` - The cell number + +Output Parameters: +- `isDG` - Using cellwise coordinates +- `Nc` - The number of coordinates +- `array` - The coordinate array +- `coords` - The cell coordinates + +Level: developer + +-seealso: `DMPLEX`, `DMPlexGetCellCoordinates()`, `DMGetCoordinatesLocal()`, `DMGetCellCoordinatesLocal()` + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreCellCoordinates")) +""" +function DMPlexRestoreCellCoordinates(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt) end + +@for_petsc function DMPlexRestoreCellCoordinates(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt ) + isDG_ = Ref{PetscBool}() + Nc_ = Ref{$PetscInt}() + array_ = Ref{Ptr{$PetscScalar}}() + coords_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexRestoreCellCoordinates, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{PetscBool}, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}), + dm, cell, isDG_, Nc_, array_, coords_, + ) + + isDG = isDG_[] + Nc = Nc_[] + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + coords = unsafe_wrap(Array, coords_[], VecGetLocalSize(petsclib, x); own = false) + + return isDG,Nc,array,coords +end + +""" + v0::Vector{PetscReal},J::Vector{PetscReal},invJ::Vector{PetscReal},detJ::PetscReal = DMPlexComputeCellGeometryAffineFEM(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt) +Assuming an affine map, compute the Jacobian, inverse Jacobian, and Jacobian determinant for a given cell + +Collective + +Input Parameters: +- `dm` - the `DMPLEX` +- `cell` - the cell + +Output Parameters: +- `v0` - the translation part of this affine transform, meaning the translation to the origin (not the first vertex of the reference cell) +- `J` - the Jacobian of the transform from the reference element +- `invJ` - the inverse of the Jacobian +- `detJ` - the Jacobian determinant + +Level: advanced + +-seealso: `DMPLEX`, `DMPlexComputeCellGeometryFEM()`, `DMGetCoordinateSection()`, `DMGetCoordinates()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeCellGeometryAffineFEM")) +""" +function DMPlexComputeCellGeometryAffineFEM(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt) end + +@for_petsc function DMPlexComputeCellGeometryAffineFEM(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt ) + v0 = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + J = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + invJ = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + detJ_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexComputeCellGeometryAffineFEM, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + dm, cell, v0, J, invJ, detJ_, + ) + + detJ = detJ_[] + + return v0,J,invJ,detJ +end + +""" + v::Vector{PetscReal},J::Vector{PetscReal},invJ::Vector{PetscReal},detJ::Vector{PetscReal} = DMPlexComputeCellGeometryFEM(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt, quad::PetscQuadrature) +Compute the Jacobian, inverse Jacobian, and Jacobian determinant at each quadrature point in the given cell + +Collective + +Input Parameters: +- `dm` - the `DMPLEX` +- `cell` - the cell +- `quad` - the quadrature containing the points in the reference element where the geometry will be evaluated. If `quad` is `NULL`, geometry will be +evaluated at the first vertex of the reference element + +Output Parameters: +- `v` - the image of the transformed quadrature points, otherwise the image of the first vertex in the closure of the reference element. This is a +one-dimensional array of size cdim * Nq where cdim is the dimension of the `DM` coordinate space and Nq is the number of quadrature points +- `J` - the Jacobian of the transform from the reference element at each quadrature point. This is a one-dimensional array of size Nq * cdim * cdim containing +each Jacobian in column-major order. +- `invJ` - the inverse of the Jacobian at each quadrature point. This is a one-dimensional array of size Nq * cdim * cdim containing +each inverse Jacobian in column-major order. +- `detJ` - the Jacobian determinant at each quadrature point. This is a one-dimensional array of size Nq. + +Level: advanced + +-seealso: `DMPLEX`, `DMGetCoordinateSection()`, `DMGetCoordinates()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeCellGeometryFEM")) +""" +function DMPlexComputeCellGeometryFEM(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt, quad::PetscQuadrature) end + +@for_petsc function DMPlexComputeCellGeometryFEM(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt, quad::PetscQuadrature ) + v = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + J = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + invJ = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + detJ = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMPlexComputeCellGeometryFEM, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscQuadrature, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + dm, cell, quad, v, J, invJ, detJ, + ) + + + return v,J,invJ,detJ +end + +""" + vol::PetscReal,centroid::Vector{PetscReal},normal::Vector{PetscReal} = DMPlexComputeCellGeometryFVM(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt) +Compute the volume for a given cell + +Collective + +Input Parameters: +- `dm` - the `DMPLEX` +- `cell` - the cell + +Output Parameters: +- `vol` - the cell volume +- `centroid` - the cell centroid +- `normal` - the cell normal, if appropriate + +Level: advanced + +-seealso: `DMPLEX`, `DMGetCoordinateSection()`, `DMGetCoordinates()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeCellGeometryFVM")) +""" +function DMPlexComputeCellGeometryFVM(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt) end + +@for_petsc function DMPlexComputeCellGeometryFVM(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt ) + vol_ = Ref{$PetscReal}() + centroid = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + normal = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMPlexComputeCellGeometryFVM, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + dm, cell, vol_, centroid, normal, + ) + + vol = vol_[] + + return vol,centroid,normal +end + +""" + DMPlexComputeGeometryFVM(petsclib::PetscLibType,dm::PetscDM, cellgeom::PetscVec, facegeom::PetscVec) +Computes the cell and face geometry for a finite volume method + +Input Parameter: +- `dm` - The `DMPLEX` + +Output Parameters: +- `cellgeom` - A `Vec` of `PetscFVCellGeom` data +- `facegeom` - A `Vec` of `PetscFVFaceGeom` data + +Level: developer + +-seealso: `DMPLEX`, `PetscFVFaceGeom`, `PetscFVCellGeom` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeGeometryFVM")) +""" +function DMPlexComputeGeometryFVM(petsclib::PetscLibType, dm::PetscDM, cellgeom::PetscVec, facegeom::PetscVec) end + +@for_petsc function DMPlexComputeGeometryFVM(petsclib::$UnionPetscLib, dm::PetscDM, cellgeom::PetscVec, facegeom::PetscVec ) + cellgeom_ = Ref(cellgeom.ptr) + facegeom_ = Ref(facegeom.ptr) + + @chk ccall( + (:DMPlexComputeGeometryFVM, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CVec}, Ptr{CVec}), + dm, cellgeom_, facegeom_, + ) + + cellgeom.ptr = cellgeom_[] + facegeom.ptr = facegeom_[] + + return nothing +end + +""" + minradius::PetscReal = DMPlexGetMinRadius(petsclib::PetscLibType,dm::PetscDM) +Returns the minimum distance from any cell centroid to a face + +Not Collective + +Input Parameter: +- `dm` - the `DMPLEX` + +Output Parameter: +- `minradius` - the minimum cell radius + +Level: developer + +-seealso: `DMPLEX`, `DMGetCoordinates()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetMinRadius")) +""" +function DMPlexGetMinRadius(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetMinRadius(petsclib::$UnionPetscLib, dm::PetscDM ) + minradius_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexGetMinRadius, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscReal}), + dm, minradius_, + ) + + minradius = minradius_[] + + return minradius +end + +""" + DMPlexSetMinRadius(petsclib::PetscLibType,dm::PetscDM, minradius::PetscReal) +Sets the minimum distance from the cell centroid to a face + +Logically Collective + +Input Parameters: +- `dm` - the `DMPLEX` +- `minradius` - the minimum cell radius + +Level: developer + +-seealso: `DMPLEX`, `DMSetCoordinates()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetMinRadius")) +""" +function DMPlexSetMinRadius(petsclib::PetscLibType, dm::PetscDM, minradius::PetscReal) end + +@for_petsc function DMPlexSetMinRadius(petsclib::$UnionPetscLib, dm::PetscDM, minradius::$PetscReal ) + + @chk ccall( + (:DMPlexSetMinRadius, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal), + dm, minradius, + ) + + + return nothing +end + +""" + DMPlexGetCoordinateMap(petsclib::PetscLibType,dm::PetscDM, coordFunc::PetscPoCintFn) +Returns the function used to map coordinates of newly generated mesh points + +Not Collective + +Input Parameter: +- `dm` - the `DMPLEX` + +Output Parameter: +- `coordFunc` - the mapping function + +Level: developer + +-seealso: `DMPLEX`, `DMGetCoordinates()`, `DMPlexSetCoordinateMap()`, `PetscPointFn` + +# External Links +$(_doc_external("DMPlex/DMPlexGetCoordinateMap")) +""" +function DMPlexGetCoordinateMap(petsclib::PetscLibType, dm::PetscDM, coordFunc::PetscPoCintFn) end + +@for_petsc function DMPlexGetCoordinateMap(petsclib::$UnionPetscLib, dm::PetscDM, coordFunc::PetscPoCintFn ) + + @chk ccall( + (:DMPlexGetCoordinateMap, $petsc_library), + PetscErrorCode, + (CDM, PetscPoCintFn), + dm, coordFunc, + ) + + + return nothing +end + +""" + DMPlexSetCoordinateMap(petsclib::PetscLibType,dm::PetscDM, coordFunc::PetscPoCintFn) +Sets the function used to map coordinates of newly generated mesh points + +Logically Collective + +Input Parameters: +- `dm` - the `DMPLEX` +- `coordFunc` - the mapping function + +Level: developer + +-seealso: `DMPLEX`, `DMSetCoordinates()`, `DMPlexGetCoordinateMap()`, `PetscPointFn` + +# External Links +$(_doc_external("DMPlex/DMPlexSetCoordinateMap")) +""" +function DMPlexSetCoordinateMap(petsclib::PetscLibType, dm::PetscDM, coordFunc::PetscPoCintFn) end + +@for_petsc function DMPlexSetCoordinateMap(petsclib::$UnionPetscLib, dm::PetscDM, coordFunc::PetscPoCintFn ) + + @chk ccall( + (:DMPlexSetCoordinateMap, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscPoCintFn}), + dm, coordFunc, + ) + + + return nothing +end + +""" + DMPlexComputeGradientFVM(petsclib::PetscLibType,dm::PetscDM, fvm::PetscFV, faceGeometry::PetscVec, cellGeometry::PetscVec, dmGrad::PetscDM) +Compute geometric factors for gradient reconstruction, which are stored in the geometry data, and compute layout for gradient data + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `fvm` - The `PetscFV` +- `cellGeometry` - The face geometry from `DMPlexComputeCellGeometryFVM()` + +Input/Output Parameter: +- `faceGeometry` - The face geometry from `DMPlexComputeFaceGeometryFVM()`; on output +the geometric factors for gradient calculation are inserted + +Output Parameter: +- `dmGrad` - The `DM` describing the layout of gradient data + +Level: developer + +-seealso: `DMPLEX`, `DMPlexGetFaceGeometryFVM()`, `DMPlexGetCellGeometryFVM()` + +# External Links +$(_doc_external("DMPlex/DMPlexComputeGradientFVM")) +""" +function DMPlexComputeGradientFVM(petsclib::PetscLibType, dm::PetscDM, fvm::PetscFV, faceGeometry::PetscVec, cellGeometry::PetscVec, dmGrad::PetscDM) end + +@for_petsc function DMPlexComputeGradientFVM(petsclib::$UnionPetscLib, dm::PetscDM, fvm::PetscFV, faceGeometry::PetscVec, cellGeometry::PetscVec, dmGrad::PetscDM ) + dmGrad_ = Ref(dmGrad.ptr) + + @chk ccall( + (:DMPlexComputeGradientFVM, $petsc_library), + PetscErrorCode, + (CDM, PetscFV, CVec, CVec, Ptr{CDM}), + dm, fvm, faceGeometry, cellGeometry, dmGrad_, + ) + + dmGrad.ptr = dmGrad_[] + + return nothing +end + +""" + DMPlexGetDataFVM(petsclib::PetscLibType,dm::PetscDM, fv::PetscFV, cellgeom::PetscVec, facegeom::PetscVec, gradDM::PetscDM) +Retrieve precomputed cell geometry + +Collective + +Input Parameters: +- `dm` - The `DM` +- `fv` - The `PetscFV` + +Output Parameters: +- `cellgeom` - The cell geometry +- `facegeom` - The face geometry +- `gradDM` - The gradient matrices + +Level: developer + +-seealso: `DMPLEX`, `DMPlexComputeGeometryFVM()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetDataFVM")) +""" +function DMPlexGetDataFVM(petsclib::PetscLibType, dm::PetscDM, fv::PetscFV, cellgeom::PetscVec, facegeom::PetscVec, gradDM::PetscDM) end + +@for_petsc function DMPlexGetDataFVM(petsclib::$UnionPetscLib, dm::PetscDM, fv::PetscFV, cellgeom::PetscVec, facegeom::PetscVec, gradDM::PetscDM ) + cellgeom_ = Ref(cellgeom.ptr) + facegeom_ = Ref(facegeom.ptr) + gradDM_ = Ref(gradDM.ptr) + + @chk ccall( + (:DMPlexGetDataFVM, $petsc_library), + PetscErrorCode, + (CDM, PetscFV, Ptr{CVec}, Ptr{CVec}, Ptr{CDM}), + dm, fv, cellgeom_, facegeom_, gradDM_, + ) + + cellgeom.ptr = cellgeom_[] + facegeom.ptr = facegeom_[] + gradDM.ptr = gradDM_[] + + return nothing +end + +""" + refCoords::Vector{PetscReal} = DMPlexCoordinatesToReference(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt, numPoints::PetscInt, realCoords::Vector{PetscReal}) +Pull coordinates back from the mesh to the reference element +using a single element map. + +Not Collective + +Input Parameters: +- `dm` - The mesh, with coordinate maps defined either by a `PetscDS` for the coordinate `DM` (see `DMGetCoordinateDM()`) or +implicitly by the coordinates of the corner vertices of the cell: as an affine map for simplicial elements, or +as a multilinear map for tensor-product elements +- `cell` - the cell whose map is used. +- `numPoints` - the number of points to locate +- `realCoords` - (numPoints x coordinate dimension) array of coordinates (see `DMGetCoordinateDim()`) + +Output Parameter: +- `refCoords` - (`numPoints` x `dimension`) array of reference coordinates (see `DMGetDimension()`) + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexReferenceToCoordinates()` + +# External Links +$(_doc_external("DMPlex/DMPlexCoordinatesToReference")) +""" +function DMPlexCoordinatesToReference(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt, numPoints::PetscInt, realCoords::Vector{PetscReal}) end + +@for_petsc function DMPlexCoordinatesToReference(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt, numPoints::$PetscInt, realCoords::Vector{$PetscReal} ) + refCoords = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMPlexCoordinatesToReference, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}), + dm, cell, numPoints, realCoords, refCoords, + ) + + + return refCoords +end + +""" + realCoords::Vector{PetscReal} = DMPlexReferenceToCoordinates(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt, numPoints::PetscInt, refCoords::Vector{PetscReal}) +Map references coordinates to coordinates in the mesh for a single element map. + +Not Collective + +Input Parameters: +- `dm` - The mesh, with coordinate maps defined either by a PetscDS for the coordinate `DM` (see `DMGetCoordinateDM()`) or +implicitly by the coordinates of the corner vertices of the cell: as an affine map for simplicial elements, or +as a multilinear map for tensor-product elements +- `cell` - the cell whose map is used. +- `numPoints` - the number of points to locate +- `refCoords` - (numPoints x dimension) array of reference coordinates (see `DMGetDimension()`) + +Output Parameter: +- `realCoords` - (numPoints x coordinate dimension) array of coordinates (see `DMGetCoordinateDim()`) + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexCoordinatesToReference()` + +# External Links +$(_doc_external("DMPlex/DMPlexReferenceToCoordinates")) +""" +function DMPlexReferenceToCoordinates(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt, numPoints::PetscInt, refCoords::Vector{PetscReal}) end + +@for_petsc function DMPlexReferenceToCoordinates(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt, numPoints::$PetscInt, refCoords::Vector{$PetscReal} ) + realCoords = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMPlexReferenceToCoordinates, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}), + dm, cell, numPoints, refCoords, realCoords, + ) + + + return realCoords +end + +""" + DMPlexRemapGeometry(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, func::external) +This function maps the original `DM` coordinates to new coordinates. + +Not Collective + +Input Parameters: +- `dm` - The `DM` +- `time` - The time +- `func` - The function transforming current coordinates to new coordinates + +Calling sequence of `func`: +- `dim` - The spatial dimension +- `Nf` - The number of input fields (here 1) +- `NfAux` - The number of input auxiliary fields +- `uOff` - The offset of the coordinates in u[] (here 0) +- `uOff_x` - The offset of the coordinates in u_x[] (here 0) +- `u` - The coordinate values at this point in space +- `u_t` - The coordinate time derivative at this point in space (here `NULL`) +- `u_x` - The coordinate derivatives at this point in space +- `aOff` - The offset of each auxiliary field in u[] +- `aOff_x` - The offset of each auxiliary field in u_x[] +- `a` - The auxiliary field values at this point in space +- `a_t` - The auxiliary field time derivative at this point in space (or `NULL`) +- `a_x` - The auxiliary field derivatives at this point in space +- `t` - The current time +- `x` - The coordinates of this point (here not used) +- `numConstants` - The number of constants +- `constants` - The value of each constant +- `f` - The new coordinates at this point in space + +Level: intermediate + +-seealso: `DMPLEX`, `DMGetCoordinates()`, `DMGetCoordinatesLocal()`, `DMGetCoordinateDM()`, `DMProjectFieldLocal()`, `DMProjectFieldLabelLocal()` + +# External Links +$(_doc_external("DMPlex/DMPlexRemapGeometry")) +""" +function DMPlexRemapGeometry(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, func::external) end + +@for_petsc function DMPlexRemapGeometry(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, func::external ) + + @chk ccall( + (:DMPlexRemapGeometry, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, external), + dm, time, func, + ) + + + return nothing +end + +""" + DMPlexShearGeometry(petsclib::PetscLibType,dm::PetscDM, direction::DMDirection, multipliers::Vector{PetscReal}) +This shears the domain, meaning adds a multiple of the shear coordinate to all other coordinates. + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `direction` - The shear coordinate direction, e.g. `DM_X` is the x-axis +- `multipliers` - The multiplier m for each direction which is not the shear direction + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexRemapGeometry()`, `DMDirection`, `DM_X`, `DM_Y`, `DM_Z` + +# External Links +$(_doc_external("DMPlex/DMPlexShearGeometry")) +""" +function DMPlexShearGeometry(petsclib::PetscLibType, dm::PetscDM, direction::DMDirection, multipliers::Vector{PetscReal}) end + +@for_petsc function DMPlexShearGeometry(petsclib::$UnionPetscLib, dm::PetscDM, direction::DMDirection, multipliers::Vector{$PetscReal} ) + + @chk ccall( + (:DMPlexShearGeometry, $petsc_library), + PetscErrorCode, + (CDM, DMDirection, Ptr{$PetscReal}), + dm, direction, multipliers, + ) + + + return nothing +end + +""" + num_cells::PetscInt,cell_size::PetscInt,num_comp::PetscInt,l_size::PetscInt,offsets::Vector{PetscInt} = DMPlexGetLocalOffsets(petsclib::PetscLibType,dm::PetscDM, domain_label::DMLabel, label_value::PetscInt, height::PetscInt, dm_field::PetscInt) +Allocate and populate array of local offsets for each cell closure. + +Not collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `domain_label` - label for `DMPLEX` domain, or NULL for whole domain +- `label_value` - Stratum value +- `height` - Height of target cells in `DMPLEX` topology +- `dm_field` - Index of `DMPLEX` field + +Output Parameters: +- `num_cells` - Number of local cells +- `cell_size` - Size of each cell, given by cell_size * num_comp = num_dof +- `num_comp` - Number of components per dof +- `l_size` - Size of local vector +- `offsets` - Allocated offsets array for cells + +Level: developer + +-seealso: [](ch_unstructured), `DMPlexGetLocalOffsetsSupport()`, `DM`, `DMPLEX`, `DMLabel`, `DMPlexGetClosureIndices()`, `DMPlexSetClosurePermutationTensor()`, `DMPlexGetCeedRestriction()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetLocalOffsets")) +""" +function DMPlexGetLocalOffsets(petsclib::PetscLibType, dm::PetscDM, domain_label::DMLabel, label_value::PetscInt, height::PetscInt, dm_field::PetscInt) end + +@for_petsc function DMPlexGetLocalOffsets(petsclib::$UnionPetscLib, dm::PetscDM, domain_label::DMLabel, label_value::$PetscInt, height::$PetscInt, dm_field::$PetscInt ) + num_cells_ = Ref{$PetscInt}() + cell_size_ = Ref{$PetscInt}() + num_comp_ = Ref{$PetscInt}() + l_size_ = Ref{$PetscInt}() + offsets_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexGetLocalOffsets, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + dm, domain_label, label_value, height, dm_field, num_cells_, cell_size_, num_comp_, l_size_, offsets_, + ) + + num_cells = num_cells_[] + cell_size = cell_size_[] + num_comp = num_comp_[] + l_size = l_size_[] + offsets = unsafe_wrap(Array, offsets_[], VecGetLocalSize(petsclib, x); own = false) + + return num_cells,cell_size,num_comp,l_size,offsets +end + +""" + num_faces::PetscInt,num_comp::PetscInt,l_size::PetscInt,offsetsNeg::PetscInt,offsetsPos::PetscInt = DMPlexGetLocalOffsetsSupport(petsclib::PetscLibType,dm::PetscDM, domain_label::DMLabel, label_value::PetscInt) +Allocate and populate arrays of local offsets for each face support. + +Not collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `domain_label` - label for `DMPLEX` domain, or NULL for whole domain +- `label_value` - Stratum value + +Output Parameters: +- `num_faces` - Number of local, non-boundary faces +- `num_comp` - Number of components per dof +- `l_size` - Size of local vector +- `offsetsNeg` - Allocated offsets array for cells on the inward normal side of each face +- `offsetsPos` - Allocated offsets array for cells on the outward normal side of each face + +Level: developer + +-seealso: [](ch_unstructured), `DMPlexGetLocalOffsets()`, `DM`, `DMPLEX`, `DMLabel`, `DMPlexGetClosureIndices()`, `DMPlexSetClosurePermutationTensor()`, `DMPlexGetCeedRestriction()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetLocalOffsetsSupport")) +""" +function DMPlexGetLocalOffsetsSupport(petsclib::PetscLibType, dm::PetscDM, domain_label::DMLabel, label_value::PetscInt) end + +@for_petsc function DMPlexGetLocalOffsetsSupport(petsclib::$UnionPetscLib, dm::PetscDM, domain_label::DMLabel, label_value::$PetscInt ) + num_faces_ = Ref{$PetscInt}() + num_comp_ = Ref{$PetscInt}() + l_size_ = Ref{$PetscInt}() + offsetsNeg_ = Ref{$PetscInt}() + offsetsPos_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetLocalOffsetsSupport, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt, $PetscInt), + dm, domain_label, label_value, num_faces_, num_comp_, l_size_, offsetsNeg_, offsetsPos_, + ) + + num_faces = num_faces_[] + num_comp = num_comp_[] + l_size = l_size_[] + offsetsNeg = offsetsNeg_[] + offsetsPos = offsetsPos_[] + + return num_faces,num_comp,l_size,offsetsNeg,offsetsPos +end + +""" + DMPlexGetOrdering(petsclib::PetscLibType,dm::PetscDM, otype::MatOrderingType, label::DMLabel, perm::IS) +Calculate a reordering of the mesh + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `otype` - type of reordering, see `MatOrderingType` +- `label` - [Optional] Label used to segregate ordering into sets, or `NULL` + +Output Parameter: +- `perm` - The point permutation as an `IS`, `perm`[old point number] = new point number + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexPermute()`, `MatOrderingType`, `MatGetOrdering()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetOrdering")) +""" +function DMPlexGetOrdering(petsclib::PetscLibType, dm::PetscDM, otype::MatOrderingType, label::DMLabel, perm::IS) end + +@for_petsc function DMPlexGetOrdering(petsclib::$UnionPetscLib, dm::PetscDM, otype::MatOrderingType, label::DMLabel, perm::IS ) + + @chk ccall( + (:DMPlexGetOrdering, $petsc_library), + PetscErrorCode, + (CDM, MatOrderingType, DMLabel, Ptr{CIS}), + dm, otype, label, perm, + ) + + + return nothing +end + +""" + DMPlexGetOrdering1D(petsclib::PetscLibType,dm::PetscDM, perm::IS) +Reorder the vertices so that the mesh is in a line + +Collective + +Input Parameter: +- `dm` - The `DMPLEX` object + +Output Parameter: +- `perm` - The point permutation as an `IS`, `perm`[old point number] = new point number + +Level: intermediate + +-seealso: `DMPLEX`, `DMPlexGetOrdering()`, `DMPlexPermute()`, `MatGetOrdering()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetOrdering1D")) +""" +function DMPlexGetOrdering1D(petsclib::PetscLibType, dm::PetscDM, perm::IS) end + +@for_petsc function DMPlexGetOrdering1D(petsclib::$UnionPetscLib, dm::PetscDM, perm::IS ) + + @chk ccall( + (:DMPlexGetOrdering1D, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CIS}), + dm, perm, + ) + + + return nothing +end + +""" + DMPlexPermute(petsclib::PetscLibType,dm::PetscDM, perm::IS, pdm::PetscDM) +Reorder the mesh according to the input permutation + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `perm` - The point permutation, `perm`[old point number] = new point number + +Output Parameter: +- `pdm` - The permuted `DM` + +Level: intermediate + +-seealso: `DMPLEX`, `MatPermute()` + +# External Links +$(_doc_external("DMPlex/DMPlexPermute")) +""" +function DMPlexPermute(petsclib::PetscLibType, dm::PetscDM, perm::IS, pdm::PetscDM) end + +@for_petsc function DMPlexPermute(petsclib::$UnionPetscLib, dm::PetscDM, perm::IS, pdm::PetscDM ) + pdm_ = Ref(pdm.ptr) + + @chk ccall( + (:DMPlexPermute, $petsc_library), + PetscErrorCode, + (CDM, CIS, Ptr{CDM}), + dm, perm, pdm_, + ) + + pdm.ptr = pdm_[] + + return nothing +end + +""" + DMPlexReorderSetDefault(petsclib::PetscLibType,dm::PetscDM, reorder::DMReorderDefaultFlag) +Set flag indicating whether the DM should be reordered by default + +Logically Collective + +Input Parameters: +- `dm` - The `DM` +- `reorder` - Flag for reordering + +Level: intermediate + +-seealso: `DMPlexReorderGetDefault()` + +# External Links +$(_doc_external("DMPlex/DMPlexReorderSetDefault")) +""" +function DMPlexReorderSetDefault(petsclib::PetscLibType, dm::PetscDM, reorder::DMReorderDefaultFlag) end + +@for_petsc function DMPlexReorderSetDefault(petsclib::$UnionPetscLib, dm::PetscDM, reorder::DMReorderDefaultFlag ) + + @chk ccall( + (:DMPlexReorderSetDefault, $petsc_library), + PetscErrorCode, + (CDM, DMReorderDefaultFlag), + dm, reorder, + ) + + + return nothing +end + +""" + DMPlexReorderGetDefault(petsclib::PetscLibType,dm::PetscDM, reorder::DMReorderDefaultFlag) +Get flag indicating whether the DM should be reordered by default + +Not Collective + +Input Parameter: +- `dm` - The `DM` + +Output Parameter: +- `reorder` - Flag for reordering + +Level: intermediate + +-seealso: `DMPlexReorderSetDefault()` + +# External Links +$(_doc_external("DMPlex/DMPlexReorderGetDefault")) +""" +function DMPlexReorderGetDefault(petsclib::PetscLibType, dm::PetscDM, reorder::DMReorderDefaultFlag) end + +@for_petsc function DMPlexReorderGetDefault(petsclib::$UnionPetscLib, dm::PetscDM, reorder::DMReorderDefaultFlag ) + + @chk ccall( + (:DMPlexReorderGetDefault, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMReorderDefaultFlag}), + dm, reorder, + ) + + + return nothing +end + +""" + DMPlexExtrude(petsclib::PetscLibType,dm::PetscDM, layers::PetscInt, thickness::PetscReal, tensor::PetscBool, symmetric::PetscBool, periodic::PetscBool, normal::Vector{PetscReal}, thicknesses::Vector{PetscReal}, activeLabel::DMLabel, edm::PetscDM) +Extrude a volumetric mesh from the input surface mesh + +Input Parameters: +- `dm` - The surface mesh +- `layers` - The number of extruded layers +- `thickness` - The total thickness of the extruded layers, or `PETSC_DETERMINE` +- `tensor` - Flag to create tensor produt cells +- `symmetric` - Flag to extrude symmetrically about the surface +- `periodic` - Flag to extrude periodically +- `normal` - Surface normal vector, or `NULL` +- `thicknesses` - Thickness of each layer, or `NULL` +- `activeLabel` - `DMLabel` to extrude from, or `NULL` to extrude entire mesh + +Output Parameter: +- `edm` - The volumetric mesh + +Options Database Keys: +- `-dm_plex_transform_extrude_thickness ` - The total thickness of extruded layers +- `-dm_plex_transform_extrude_use_tensor ` - Use tensor cells when extruding +- `-dm_plex_transform_extrude_symmetric ` - Extrude layers symmetrically about the surface +- `-dm_plex_transform_extrude_periodic ` - Extrude layers periodically +- `-dm_plex_transform_extrude_normal ` - Specify the extrusion direction +- `-dm_plex_transform_extrude_thicknesses ` - Specify thickness of each layer + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMExtrude()`, `DMPlexTransform`, `DMPlexTransformExtrudeSetThickness()`, `DMPlexTransformExtrudeSetTensor()` + +# External Links +$(_doc_external("DMPlex/DMPlexExtrude")) +""" +function DMPlexExtrude(petsclib::PetscLibType, dm::PetscDM, layers::PetscInt, thickness::PetscReal, tensor::PetscBool, symmetric::PetscBool, periodic::PetscBool, normal::Vector{PetscReal}, thicknesses::Vector{PetscReal}, activeLabel::DMLabel, edm::PetscDM) end + +@for_petsc function DMPlexExtrude(petsclib::$UnionPetscLib, dm::PetscDM, layers::$PetscInt, thickness::$PetscReal, tensor::PetscBool, symmetric::PetscBool, periodic::PetscBool, normal::Vector{$PetscReal}, thicknesses::Vector{$PetscReal}, activeLabel::DMLabel, edm::PetscDM ) + edm_ = Ref(edm.ptr) + + @chk ccall( + (:DMPlexExtrude, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscReal, PetscBool, PetscBool, PetscBool, Ptr{$PetscReal}, Ptr{$PetscReal}, DMLabel, Ptr{CDM}), + dm, layers, thickness, tensor, symmetric, periodic, normal, thicknesses, activeLabel, edm_, + ) + + edm.ptr = edm_[] + + return nothing +end + +""" + DMPlexInflateToGeomModelUseXYZ(petsclib::PetscLibType,dm::PetscDM) +Snaps the vertex coordinates of a `DMPLEX` object representing the mesh to its geometry if some vertices depart from the model. This usually happens with non + +Collective + +Input Parameter: +- `dm` - The uninflated `DM` object representing the mesh + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()`, `DMPlexCreateEGADS()` + +# External Links +$(_doc_external("DMPlex/DMPlexInflateToGeomModelUseXYZ")) +""" +function DMPlexInflateToGeomModelUseXYZ(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexInflateToGeomModelUseXYZ(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexInflateToGeomModelUseXYZ, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + dm::PetscDM = DMPlexCreateGeomFromFile(petsclib::PetscLibType,comm::MPI_Comm, filename::String, islite::PetscBool) +Create a `DMPLEX` mesh from an EGADS, IGES, or STEP file. + +Collective + +Input Parameters: +- `comm` - The MPI communicator +- `filename` - The name of the EGADS, IGES, or STEP file +- `islite` - Flag for EGADSlite support + +Output Parameter: +- `dm` - The `DM` object representing the mesh + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()`, `DMPlexCreateEGADS()`, `DMPlexCreateEGADSliteFromFile()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateGeomFromFile")) +""" +function DMPlexCreateGeomFromFile(petsclib::PetscLibType, comm::MPI_Comm, filename::String, islite::PetscBool) end + +@for_petsc function DMPlexCreateGeomFromFile(petsclib::$UnionPetscLib, comm::MPI_Comm, filename::String, islite::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateGeomFromFile, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{CDM}, PetscBool), + comm, filename, dm_, islite, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMPlexGeomDataAndGrads(petsclib::PetscLibType,dm::PetscDM, fullGeomGrad::PetscBool) +Exposes Control Points and Control Point Weights defining the underlying geometry allowing user manipulation of the geometry. + +Collective + +Input Parameters: +- `dm` - The DM object representing the mesh with PetscContainer containing an EGADS geometry model +- `fullGeomGrad` - PetscBool flag. Determines how the Surface Area and Volume Gradients wrt to Control Points and Control Point Weights are calculated. +PETSC_FALSE :: Surface Area Gradient wrt Control Points and Control Point Weights are calculated using the change in the local +FACE changes (not the entire body). Volume Gradients are not calculated. Faster computations. +PETSC_TRUE :: Surface Area Gradietn wrt to Control Points and Control Point Weights are calculated using the change observed in +the entire solid body. Volume Gradients are calculated. Slower computation due to the need to generate a new solid +body geometry for every Control Point and Control Point Weight change. + +Output Parameter: +- `dm` - The updated DM object representing the mesh with PetscContainers containing the Control Point, Control Point Weight and Gradient Data. + +Level: intermediate + +-seealso: `DMPLEX`, `DMCreate()`, `DMPlexCreateGeom()`, `DMPlexModifyEGADSGeomModel()` + +# External Links +$(_doc_external("DMPlex/DMPlexGeomDataAndGrads")) +""" +function DMPlexGeomDataAndGrads(petsclib::PetscLibType, dm::PetscDM, fullGeomGrad::PetscBool) end + +@for_petsc function DMPlexGeomDataAndGrads(petsclib::$UnionPetscLib, dm::PetscDM, fullGeomGrad::PetscBool ) + + @chk ccall( + (:DMPlexGeomDataAndGrads, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, fullGeomGrad, + ) + + + return nothing +end + +""" + DMPlexModifyGeomModel(petsclib::PetscLibType,dm::PetscDM, comm::MPI_Comm, newCP::Vector{PetscScalar}, newW::Vector{PetscScalar}, autoInflate::PetscBool, saveGeom::PetscBool, stpName::String) +Generates a new EGADS geometry model based in user provided Control Points and Control Points Weights. Optionally, the function will inflate the DM to the new geometry and save the new geometry to a file. + +Collective + +Input Parameters: +- `dm` - The DM object representing the mesh with PetscContainer containing an EGADS geometry model +- `comm` - MPI_Comm object +- `newCP` - C Array of [x, y, z] New/Updated Control Point Coordinates defining the geometry (See DMPlexGeomDataAndGrads() for format) +- `newW` - C Array of New/Updated Control Point Weights associated with the Control Points defining the new geometry (See DMPlexGemGrads() for format) +- `autoInflate` - PetscBool Flag denoting if the user would like to inflate the DM points to the new geometry. +- `saveGeom` - PetscBool Flag denoting if the user would iike to save the new geometry to a file. +- `stpName` - Char Array indicating the name of the file to save the new geometry to. Extension must be included and will denote type of file written. +*.stp or *.step = STEP File +*.igs or *.iges = IGES File +*.egads = EGADS File +*.brep = BRep File (OpenCASCADE File) + +Output Parameter: +- `dm` - The updated DM object representing the mesh with PetscContainers containing the updated/modified geometry + +Level: intermediate + +-seealso: `DMPLEX`, `DMCreate()`, `DMPlexCreateGeom()`, `DMPlexGeomDataAndGrads()` + +# External Links +$(_doc_external("DMPlex/DMPlexModifyGeomModel")) +""" +function DMPlexModifyGeomModel(petsclib::PetscLibType, dm::PetscDM, comm::MPI_Comm, newCP::Vector{PetscScalar}, newW::Vector{PetscScalar}, autoInflate::PetscBool, saveGeom::PetscBool, stpName::String) end + +@for_petsc function DMPlexModifyGeomModel(petsclib::$UnionPetscLib, dm::PetscDM, comm::MPI_Comm, newCP::Vector{$PetscScalar}, newW::Vector{$PetscScalar}, autoInflate::PetscBool, saveGeom::PetscBool, stpName::String ) + + @chk ccall( + (:DMPlexModifyGeomModel, $petsc_library), + PetscErrorCode, + (CDM, MPI_Comm, Ptr{$PetscScalar}, Ptr{$PetscScalar}, PetscBool, PetscBool, Ptr{Cchar}), + dm, comm, newCP, newW, autoInflate, saveGeom, stpName, + ) + + + return nothing +end + +""" + DMPlexGetGeomModelTUV(petsclib::PetscLibType,dm::PetscDM) +Gets the [t] (EDGES) and [u, v] (FACES) geometry parameters of DM points that are associated geometry relationships. Requires a DM with a EGADS model attached. + +Collective + +Input Parameter: +- `dm` - The DM object representing the mesh with PetscContainer containing an EGADS geometry model + +Level: intermediate + +-seealso: `DMPLEX`, `DMCreate()`, `DMPlexCreateGeom()`, `DMPlexGeomDataAndGrads()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelTUV")) +""" +function DMPlexGetGeomModelTUV(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetGeomModelTUV(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexGetGeomModelTUV, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexInflateToGeomModelUseTUV(petsclib::PetscLibType,dm::PetscDM) +Inflates the DM to the associated underlying geometry using the [t] {EDGES) and [u, v] (FACES} associated parameters. Requires a DM with an EGADS model attached and a previous call to DMPlexGetGeomModelTUV(). + +Collective + +Input Parameter: +- `dm` - The DM object representing the mesh with PetscContainer containing an EGADS geometry model + +Level: intermediate + +-seealso: `DMPLEX`, `DMCreate()`, `DMPlexCreateGeom()`, `DMPlexGeomDataAndGrads()`, `DMPlexGetGeomModelTUV()` + +# External Links +$(_doc_external("DMPlex/DMPlexInflateToGeomModelUseTUV")) +""" +function DMPlexInflateToGeomModelUseTUV(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexInflateToGeomModelUseTUV(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexInflateToGeomModelUseTUV, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexInflateToGeomModel(petsclib::PetscLibType,dm::PetscDM, useTUV::PetscBool) +Wrapper function allowing two methods for inflating refined meshes to the underlying geometric domain. + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `useTUV` - PetscBool indicating if the user would like to inflate the DMPlex to the underlying geometry +using (t) for nodes on EDGEs and (u, v) for nodes on FACEs or using the nodes (x, y, z) coordinates +and shortest distance routine. +If useTUV = PETSC_TRUE, use the (t) or (u, v) parameters to inflate the DMPlex to the CAD geometry. +If useTUV = PETSC_FALSE, use the nodes (x, y, z) coordinates and the shortest disctance routine. + +-seealso: `DMPlexGetGeomModelTUV()`, `DMPlexInflateToGeomModelUseTUV()`, `DMPlexInflateToGeomModelUseXYZ()` + +# External Links +$(_doc_external("DMPlex/DMPlexInflateToGeomModel")) +""" +function DMPlexInflateToGeomModel(petsclib::PetscLibType, dm::PetscDM, useTUV::PetscBool) end + +@for_petsc function DMPlexInflateToGeomModel(petsclib::$UnionPetscLib, dm::PetscDM, useTUV::PetscBool ) + + @chk ccall( + (:DMPlexInflateToGeomModel, $petsc_library), + PetscErrorCode, + (CDM, PetscBool), + dm, useTUV, + ) + + + return nothing +end + +""" + numBodies::PetscInt = DMPlexGetGeomModelBodies(petsclib::PetscLibType,dm::PetscDM, bodies::PetscGeom) +Returns an array of `PetscGeom` BODY objects attached to the referenced geometric model entity as well as the number of BODYs. + +Collective + +Input Parameter: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object + +Output Parameters: +- `bodies` - Array of PetscGeom BODY objects referenced by the geometric model. +- `numBodies` - Number of BODYs referenced by the geometric model. Also the size of **bodies array. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelBodies")) +""" +function DMPlexGetGeomModelBodies(petsclib::PetscLibType, dm::PetscDM, bodies::PetscGeom) end + +@for_petsc function DMPlexGetGeomModelBodies(petsclib::$UnionPetscLib, dm::PetscDM, bodies::PetscGeom ) + numBodies_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomModelBodies, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, Ptr{$PetscInt}), + dm, bodies, numBodies_, + ) + + numBodies = numBodies_[] + + return numBodies +end + +""" + numShells::PetscInt = DMPlexGetGeomModelBodyShells(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, shells::PetscGeom) +Returns an array of `PetscGeom` SHELL objects attached to the referenced BODY geometric entity as well as the number of SHELLs. + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom BODY object containing the SHELL objects of interest. + +Output Parameters: +- `shells` - Array of PetscGeom SHELL objects referenced by the PetscGeom BODY object +- `numShells` - Number of SHELLs referenced by the PetscGeom BODY object. Also the size of **shells array. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelBodyShells")) +""" +function DMPlexGetGeomModelBodyShells(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, shells::PetscGeom) end + +@for_petsc function DMPlexGetGeomModelBodyShells(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, shells::PetscGeom ) + numShells_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomModelBodyShells, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, PetscGeom, Ptr{$PetscInt}), + dm, body, shells, numShells_, + ) + + numShells = numShells_[] + + return numShells +end + +""" + numFaces::PetscInt = DMPlexGetGeomModelBodyFaces(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, faces::PetscGeom) +Returns an array of `PetscGeom` FACE objects attached to the referenced BODY geometric entity as well as the number of FACEs. + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom BODY object containing the FACE objects of interest. + +Output Parameters: +- `faces` - Array of PetscGeom FACE objects referenced by the PetscGeom BODY object +- `numFaces` - Number of FACEs referenced by the PetscGeom BODY object. Also the size of **faces array. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelBodyFaces")) +""" +function DMPlexGetGeomModelBodyFaces(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, faces::PetscGeom) end + +@for_petsc function DMPlexGetGeomModelBodyFaces(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, faces::PetscGeom ) + numFaces_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomModelBodyFaces, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, PetscGeom, Ptr{$PetscInt}), + dm, body, faces, numFaces_, + ) + + numFaces = numFaces_[] + + return numFaces +end + +""" + numLoops::PetscInt = DMPlexGetGeomModelBodyLoops(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, loops::PetscGeom) +Returns an array of `PetscGeom` Loop objects attached to the referenced BODY geometric entity as well as the number of LOOPs. + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom BODY object containing the LOOP objects of interest. + +Output Parameters: +- `loops` - Array of PetscGeom FACE objects referenced by the PetscGeom SHELL object +- `numLoops` - Number of LOOPs referenced by the PetscGeom BODY object. Also the size of **loops array. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelBodyLoops")) +""" +function DMPlexGetGeomModelBodyLoops(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, loops::PetscGeom) end + +@for_petsc function DMPlexGetGeomModelBodyLoops(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, loops::PetscGeom ) + numLoops_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomModelBodyLoops, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, PetscGeom, Ptr{$PetscInt}), + dm, body, loops, numLoops_, + ) + + numLoops = numLoops_[] + + return numLoops +end + +""" + numFaces::PetscInt = DMPlexGetGeomModelShellFaces(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, shell::PetscGeom, faces::PetscGeom) +Returns an array of `PetscGeom` FACE objects attached to the referenced SHELL geometric entity as well as the number of FACEs. + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom BODY object containing the FACE objects of interest. +- `shell` - PetscGeom SHELL object with FACEs of interest. + +Output Parameters: +- `faces` - Array of PetscGeom FACE objects referenced by the PetscGeom SHELL object +- `numFaces` - Number of FACEs referenced by the PetscGeom SHELL object. Also the size of **faces array. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelShellFaces")) +""" +function DMPlexGetGeomModelShellFaces(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, shell::PetscGeom, faces::PetscGeom) end + +@for_petsc function DMPlexGetGeomModelShellFaces(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, shell::PetscGeom, faces::PetscGeom ) + numFaces_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomModelShellFaces, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, PetscGeom, PetscGeom, Ptr{$PetscInt}), + dm, body, shell, faces, numFaces_, + ) + + numFaces = numFaces_[] + + return numFaces +end + +""" + numLoops::PetscInt = DMPlexGetGeomModelFaceLoops(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, face::PetscGeom, loops::PetscGeom) +Returns an array of `PetscGeom` LOOP objects attached to the referenced FACE geometric entity as well as the number of LOOPs. + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom BODY object containing the LOOP objects of interest. +- `face` - PetscGeom FACE object with LOOPs of interest. + +Output Parameters: +- `loops` - Array of PetscGeom LOOP objects referenced by the PetscGeom FACE object +- `numLoops` - Number of LOOPs referenced by the PetscGeom FACE object. Also the size of **loops array. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelFaceLoops")) +""" +function DMPlexGetGeomModelFaceLoops(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, face::PetscGeom, loops::PetscGeom) end + +@for_petsc function DMPlexGetGeomModelFaceLoops(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, face::PetscGeom, loops::PetscGeom ) + numLoops_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomModelFaceLoops, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, PetscGeom, PetscGeom, Ptr{$PetscInt}), + dm, body, face, loops, numLoops_, + ) + + numLoops = numLoops_[] + + return numLoops +end + +""" + numEdges::PetscInt = DMPlexGetGeomModelFaceEdges(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, face::PetscGeom, edges::PetscGeom) +Returns an array of `PetscGeom` EDGE objects attached to the referenced FACE geometric entity as well as the number of EDGEs. + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom Body object containing the EDGE objects of interest. +- `face` - PetscGeom FACE object with EDGEs of interest. + +Output Parameters: +- `edges` - Array of PetscGeom EDGE objects referenced by the PetscGeom FACE object +- `numEdges` - Number of EDGEs referenced by the PetscGeom FACE object. Also the size of **edges array. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelFaceEdges")) +""" +function DMPlexGetGeomModelFaceEdges(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, face::PetscGeom, edges::PetscGeom) end + +@for_petsc function DMPlexGetGeomModelFaceEdges(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, face::PetscGeom, edges::PetscGeom ) + numEdges_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomModelFaceEdges, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, PetscGeom, PetscGeom, Ptr{$PetscInt}), + dm, body, face, edges, numEdges_, + ) + + numEdges = numEdges_[] + + return numEdges +end + +""" + numEdges::PetscInt = DMPlexGetGeomModelBodyEdges(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, edges::PetscGeom) +Returns an array of `PetscGeom` EDGE objects attached to the referenced BODY geometric entity as well as the number of EDGEs. + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom body object of interest. + +Output Parameters: +- `edges` - Array of PetscGeom EDGE objects referenced by the PetscGeom BODY object +- `numEdges` - Number of EDGEs referenced by the PetscGeom BODY object. Also the size of **edges array. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelBodyEdges")) +""" +function DMPlexGetGeomModelBodyEdges(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, edges::PetscGeom) end + +@for_petsc function DMPlexGetGeomModelBodyEdges(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, edges::PetscGeom ) + numEdges_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomModelBodyEdges, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, PetscGeom, Ptr{$PetscInt}), + dm, body, edges, numEdges_, + ) + + numEdges = numEdges_[] + + return numEdges +end + +""" + numNodes::PetscInt = DMPlexGetGeomModelBodyNodes(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, nodes::PetscGeom) +Returns an array of `PetscGeom` NODE objects attached to the referenced BODY geometric entity as well as the number of NODES. + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom body object of interest. + +Output Parameters: +- `nodes` - Array of PetscGeom NODE objects referenced by the PetscGeom BODY object +- `numNodes` - Number of NODEs referenced by the PetscGeom BODY object. Also the size of **nodes array. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelBodyNodes")) +""" +function DMPlexGetGeomModelBodyNodes(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, nodes::PetscGeom) end + +@for_petsc function DMPlexGetGeomModelBodyNodes(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, nodes::PetscGeom ) + numNodes_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomModelBodyNodes, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, PetscGeom, Ptr{$PetscInt}), + dm, body, nodes, numNodes_, + ) + + numNodes = numNodes_[] + + return numNodes +end + +""" + numNodes::PetscInt = DMPlexGetGeomModelEdgeNodes(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, edge::PetscGeom, nodes::PetscGeom) +Returns an array of `PetscGeom` NODE objects attached to the referenced EDGE geometric entity as well as the number of NODES. + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom body object containing the EDGE object of interest. +- `edge` - PetscGeom EDGE object with NODEs of interest. + +Output Parameters: +- `nodes` - Array of PetscGeom NODE objects referenced by the PetscGeom EDGE object +- `numNodes` - Number of Nodes referenced by the PetscGeom EDGE object. Also the size of **nodes array. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomModelEdgeNodes")) +""" +function DMPlexGetGeomModelEdgeNodes(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, edge::PetscGeom, nodes::PetscGeom) end + +@for_petsc function DMPlexGetGeomModelEdgeNodes(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, edge::PetscGeom, nodes::PetscGeom ) + numNodes_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomModelEdgeNodes, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, PetscGeom, PetscGeom, Ptr{$PetscInt}), + dm, body, edge, nodes, numNodes_, + ) + + numNodes = numNodes_[] + + return numNodes +end + +""" + id::PetscInt = DMPlexGetGeomID(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, topoObj::PetscGeom) +Returns ID number of the entity in the geometric (CAD) model + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom body object containing the lower level entity the ID number is being requested. +- `topoObj` - PetscGeom SHELL, FACE, LOOP, EDGE, or NODE object for which ID number is being requested. + +Output Parameter: +- `id` - ID number of the entity + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomID")) +""" +function DMPlexGetGeomID(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, topoObj::PetscGeom) end + +@for_petsc function DMPlexGetGeomID(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, topoObj::PetscGeom ) + id_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomID, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, PetscGeom, Ptr{$PetscInt}), + dm, body, topoObj, id_, + ) + + id = id_[] + + return id +end + +""" + DMPlexGetGeomObject(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, geomType::PetscInt, geomID::PetscInt, geomObj::PetscGeom) +Returns Geometry Object using the objects ID in the geometric (CAD) model + +Collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom body object containing the lower level entity the referenced by the ID. +- `geomType` - Keyword SHELL, FACE, LOOP, EDGE, or NODE of the geometry type for which ID number is being requested. +- `geomID` - ID number of the geometry entity being requested. + +Output Parameter: +- `geomObj` - Geometry Object referenced by the ID number requested. + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomObject")) +""" +function DMPlexGetGeomObject(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, geomType::PetscInt, geomID::PetscInt, geomObj::PetscGeom) end + +@for_petsc function DMPlexGetGeomObject(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, geomType::$PetscInt, geomID::$PetscInt, geomObj::PetscGeom ) + + @chk ccall( + (:DMPlexGetGeomObject, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, $PetscInt, $PetscInt, Ptr{PetscGeom}), + dm, body, geomType, geomID, geomObj, + ) + + + return nothing +end + +""" + numCntrlPnts::PetscInt = DMPlexGetGeomFaceNumOfControlPoints(petsclib::PetscLibType,dm::PetscDM, face::PetscGeom) +Returns the total number of Control Points (and associated Weights) defining a FACE of a Geometry + +Not collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `face` - PetscGeom FACE object + +Output Parameter: +- `numCntrlPnts` - Number of Control Points (and Weights) defining the FACE + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomFaceNumOfControlPoints")) +""" +function DMPlexGetGeomFaceNumOfControlPoints(petsclib::PetscLibType, dm::PetscDM, face::PetscGeom) end + +@for_petsc function DMPlexGetGeomFaceNumOfControlPoints(petsclib::$UnionPetscLib, dm::PetscDM, face::PetscGeom ) + numCntrlPnts_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomFaceNumOfControlPoints, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, Ptr{$PetscInt}), + dm, face, numCntrlPnts_, + ) + + numCntrlPnts = numCntrlPnts_[] + + return numCntrlPnts +end + +""" + volume::PetscScalar,surfArea::PetscScalar,centerOfGravity::PetscScalar,COGsize::PetscInt,inertiaMatrixCOG::PetscScalar,IMCOGsize::PetscInt = DMPlexGetGeomBodyMassProperties(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom) +Returns the Volume, Surface Area, Center of Gravity, and Inertia about the Body's Center of Gravity + +Not collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `body` - PetscGeom BODY object + +Output Parameters: +- `volume` - Volume of the CAD Body attached to the DM Plex +- `surfArea` - Surface Area of the CAD Body attached to the DM Plex +- `centerOfGravity` - Array with the Center of Gravity coordinates of the CAD Body attached to the DM Plex [x, y, z] +- `COGszie` - Size of centerOfGravity[] Array +- `inertiaMatrixCOG` - Array containing the Inertia about the Body's Center of Gravity [Ixx, Ixy, Ixz, Iyx, Iyy, Iyz, Izx, Izy, Izz] +- `IMCOGsize` - Size of inertiaMatrixCOG[] Array + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomBodyMassProperties")) +""" +function DMPlexGetGeomBodyMassProperties(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom) end + +@for_petsc function DMPlexGetGeomBodyMassProperties(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom ) + volume_ = Ref{$PetscScalar}() + surfArea_ = Ref{$PetscScalar}() + centerOfGravity_ = Ref{$PetscScalar}() + COGsize_ = Ref{$PetscInt}() + inertiaMatrixCOG_ = Ref{$PetscScalar}() + IMCOGsize_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomBodyMassProperties, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, Ptr{$PetscScalar}, Ptr{$PetscScalar}, $PetscScalar, Ptr{$PetscInt}, $PetscScalar, Ptr{$PetscInt}), + dm, body, volume_, surfArea_, centerOfGravity_, COGsize_, inertiaMatrixCOG_, IMCOGsize_, + ) + + volume = volume_[] + surfArea = surfArea_[] + centerOfGravity = centerOfGravity_[] + COGsize = COGsize_[] + inertiaMatrixCOG = inertiaMatrixCOG_[] + IMCOGsize = IMCOGsize_[] + + return volume,surfArea,centerOfGravity,COGsize,inertiaMatrixCOG,IMCOGsize +end + +""" + volume::PetscScalar,surfArea::PetscScalar,COGsize::PetscInt,IMCOGsize::PetscInt = DMPlexRestoreGeomBodyMassProperties(petsclib::PetscLibType,dm::PetscDM, body::PetscGeom, centerOfGravity::PetscScalar, inertiaMatrixCOG::PetscScalar) + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreGeomBodyMassProperties")) +""" +function DMPlexRestoreGeomBodyMassProperties(petsclib::PetscLibType, dm::PetscDM, body::PetscGeom, centerOfGravity::PetscScalar, inertiaMatrixCOG::PetscScalar) end + +@for_petsc function DMPlexRestoreGeomBodyMassProperties(petsclib::$UnionPetscLib, dm::PetscDM, body::PetscGeom, centerOfGravity::$PetscScalar, inertiaMatrixCOG::$PetscScalar ) + volume_ = Ref{$PetscScalar}() + surfArea_ = Ref{$PetscScalar}() + COGsize_ = Ref{$PetscInt}() + IMCOGsize_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexRestoreGeomBodyMassProperties, $petsc_library), + PetscErrorCode, + (CDM, PetscGeom, Ptr{$PetscScalar}, Ptr{$PetscScalar}, $PetscScalar, Ptr{$PetscInt}, $PetscScalar, Ptr{$PetscInt}), + dm, body, volume_, surfArea_, centerOfGravity, COGsize_, inertiaMatrixCOG, IMCOGsize_, + ) + + volume = volume_[] + surfArea = surfArea_[] + COGsize = COGsize_[] + IMCOGsize = IMCOGsize_[] + + return volume,surfArea,COGsize,IMCOGsize +end + +""" + DMPlexFreeGeomObject(petsclib::PetscLibType,dm::PetscDM, geomObj::PetscGeom) +Frees PetscGeom Objects + +Not collective + +Input Parameters: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object +- `geomObj` - PetscGeom object + +Level: intermediate + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexFreeGeomObject")) +""" +function DMPlexFreeGeomObject(petsclib::PetscLibType, dm::PetscDM, geomObj::PetscGeom) end + +@for_petsc function DMPlexFreeGeomObject(petsclib::$UnionPetscLib, dm::PetscDM, geomObj::PetscGeom ) + + @chk ccall( + (:DMPlexFreeGeomObject, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscGeom}), + dm, geomObj, + ) + + + return nothing +end + +""" + cpCoordDataLength::PetscInt,cpCoordData::PetscScalar,maxNumEquiv::PetscInt,wDataLength::PetscInt,wData::PetscScalar = DMPlexGetGeomCntrlPntAndWeightData(petsclib::PetscLibType,dm::PetscDM, cpHashTable::PetscHMapI, cpEquiv::PetscMat, wHashTable::PetscHMapI) +Gets Control Point and Associated Weight Data for the Geometry attached to the DMPlex + +Not collective + +Input Parameter: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object + +Output Parameters: +- `cpHashTable` - Hash Table containing the relationship between FACE ID and Control Point IDs. +- `cpCoordDataLength` - Length of cpCoordData Array. +- `cpCoordData` - Array holding the Geometry Control Point Coordinate Data. +- `maxNumEquiv` - Maximum Number of Equivalent Control Points (Control Points with the same coordinates but different IDs). +- `cpEquiv` - Matrix with a size(Number of Control Points, Number or Control Points) which stores a value of 1.0 in locations where Control Points with different IDS (row or column) have the same coordinates +- `wHashTable` - Hash Table containing the relationship between FACE ID and Control Point Weight. +- `wDataLength` - Length of wData Array. +- `wData` - Array holding the Weight for an associated Geometry Control Point. + +-seealso: + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomCntrlPntAndWeightData")) +""" +function DMPlexGetGeomCntrlPntAndWeightData(petsclib::PetscLibType, dm::PetscDM, cpHashTable::PetscHMapI, cpEquiv::PetscMat, wHashTable::PetscHMapI) end + +@for_petsc function DMPlexGetGeomCntrlPntAndWeightData(petsclib::$UnionPetscLib, dm::PetscDM, cpHashTable::PetscHMapI, cpEquiv::PetscMat, wHashTable::PetscHMapI ) + cpCoordDataLength_ = Ref{$PetscInt}() + cpCoordData_ = Ref{$PetscScalar}() + maxNumEquiv_ = Ref{$PetscInt}() + cpEquiv_ = Ref(cpEquiv.ptr) + wDataLength_ = Ref{$PetscInt}() + wData_ = Ref{$PetscScalar}() + + @chk ccall( + (:DMPlexGetGeomCntrlPntAndWeightData, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscHMapI}, Ptr{$PetscInt}, $PetscScalar, Ptr{$PetscInt}, Ptr{CMat}, Ptr{PetscHMapI}, Ptr{$PetscInt}, $PetscScalar), + dm, cpHashTable, cpCoordDataLength_, cpCoordData_, maxNumEquiv_, cpEquiv_, wHashTable, wDataLength_, wData_, + ) + + cpCoordDataLength = cpCoordDataLength_[] + cpCoordData = cpCoordData_[] + maxNumEquiv = maxNumEquiv_[] + cpEquiv.ptr = cpEquiv_[] + wDataLength = wDataLength_[] + wData = wData_[] + + return cpCoordDataLength,cpCoordData,maxNumEquiv,wDataLength,wData +end + +""" + cpCoordDataLength::PetscInt,maxNumEquiv::PetscInt,wDataLength::PetscInt = DMPlexRestoreGeomCntrlPntAndWeightData(petsclib::PetscLibType,dm::PetscDM, cpHashTable::PetscHMapI, cpCoordData::PetscScalar, cpEquiv::PetscMat, wHashTable::PetscHMapI, wData::PetscScalar) + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreGeomCntrlPntAndWeightData")) +""" +function DMPlexRestoreGeomCntrlPntAndWeightData(petsclib::PetscLibType, dm::PetscDM, cpHashTable::PetscHMapI, cpCoordData::PetscScalar, cpEquiv::PetscMat, wHashTable::PetscHMapI, wData::PetscScalar) end + +@for_petsc function DMPlexRestoreGeomCntrlPntAndWeightData(petsclib::$UnionPetscLib, dm::PetscDM, cpHashTable::PetscHMapI, cpCoordData::$PetscScalar, cpEquiv::PetscMat, wHashTable::PetscHMapI, wData::$PetscScalar ) + cpCoordDataLength_ = Ref{$PetscInt}() + maxNumEquiv_ = Ref{$PetscInt}() + cpEquiv_ = Ref(cpEquiv.ptr) + wDataLength_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexRestoreGeomCntrlPntAndWeightData, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscHMapI}, Ptr{$PetscInt}, $PetscScalar, Ptr{$PetscInt}, Ptr{CMat}, Ptr{PetscHMapI}, Ptr{$PetscInt}, $PetscScalar), + dm, cpHashTable, cpCoordDataLength_, cpCoordData, maxNumEquiv_, cpEquiv_, wHashTable, wDataLength_, wData, + ) + + cpCoordDataLength = cpCoordDataLength_[] + maxNumEquiv = maxNumEquiv_[] + cpEquiv.ptr = cpEquiv_[] + wDataLength = wDataLength_[] + + return cpCoordDataLength,maxNumEquiv,wDataLength +end + +""" + cpArraySize::PetscInt,gradSACP::PetscScalar,gradVolCP::PetscScalar,wArraySize::PetscInt,gradSAW::PetscScalar,gradVolW::PetscScalar = DMPlexGetGeomGradData(petsclib::PetscLibType,dm::PetscDM, cpSurfGradHashTable::PetscHMapI, cpSurfGrad::PetscMat) +Gets Point, Surface and Volume Gradients with respect to changes in Control Points and their associated Weights for the Geometry attached to the DMPlex . + +Not collective + +Input Parameter: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object + +Output Parameters: +- `cpSurfGradHashTable` - Hash Table Relating the Control Point ID to the the Row in the cpSurfGrad Matrix +- `cpSurfGrad` - Matrix containing the Surface Gradient with respect to the Control Point Data. Data is ranged where the Row corresponds to Control Point ID and the Columns are associated with the Geometric FACE. +- `cpArraySize` - The size of arrays gradSACP and gradVolCP and is equal to 3 * total number of Control Points in the Geometry +- `gradSACP` - Array containing the Surface Area Gradient with respect to Control Point Data. Data is arranged by Control Point ID * 3 where 3 is for the coordinate dimension. +- `gradVolCP` - Array containing the Volume Gradient with respect to Control Point Data. Data is arranged by Control Point ID * 3 where 3 is for the coordinate dimension. +- `wArraySize` - The size of arrayws gradSAW and gradVolW and is equal to the total number of Control Points in the Geometry. +- `gradSAW` - Array containing the Surface Area Gradient with respect to Control Point Weight. Data is arranged by Control Point ID. +- `gradVolW` - Array containing the Volume Gradient with respect to Control Point Weight. Data is arranged by Control Point ID. + +-seealso: DMPlexGeomDataAndGrads + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomGradData")) +""" +function DMPlexGetGeomGradData(petsclib::PetscLibType, dm::PetscDM, cpSurfGradHashTable::PetscHMapI, cpSurfGrad::PetscMat) end + +@for_petsc function DMPlexGetGeomGradData(petsclib::$UnionPetscLib, dm::PetscDM, cpSurfGradHashTable::PetscHMapI, cpSurfGrad::PetscMat ) + cpSurfGrad_ = Ref(cpSurfGrad.ptr) + cpArraySize_ = Ref{$PetscInt}() + gradSACP_ = Ref{$PetscScalar}() + gradVolCP_ = Ref{$PetscScalar}() + wArraySize_ = Ref{$PetscInt}() + gradSAW_ = Ref{$PetscScalar}() + gradVolW_ = Ref{$PetscScalar}() + + @chk ccall( + (:DMPlexGetGeomGradData, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscHMapI}, Ptr{CMat}, Ptr{$PetscInt}, $PetscScalar, $PetscScalar, Ptr{$PetscInt}, $PetscScalar, $PetscScalar), + dm, cpSurfGradHashTable, cpSurfGrad_, cpArraySize_, gradSACP_, gradVolCP_, wArraySize_, gradSAW_, gradVolW_, + ) + + cpSurfGrad.ptr = cpSurfGrad_[] + cpArraySize = cpArraySize_[] + gradSACP = gradSACP_[] + gradVolCP = gradVolCP_[] + wArraySize = wArraySize_[] + gradSAW = gradSAW_[] + gradVolW = gradVolW_[] + + return cpArraySize,gradSACP,gradVolCP,wArraySize,gradSAW,gradVolW +end + +""" + cpArraySize::PetscInt,wArraySize::PetscInt = DMPlexRestoreGeomGradData(petsclib::PetscLibType,dm::PetscDM, cpSurfGradHashTable::PetscHMapI, cpSurfGrad::PetscMat, gradSACP::PetscScalar, gradVolCP::PetscScalar, gradSAW::PetscScalar, gradVolW::PetscScalar) + +# External Links +$(_doc_external("DMPlex/DMPlexRestoreGeomGradData")) +""" +function DMPlexRestoreGeomGradData(petsclib::PetscLibType, dm::PetscDM, cpSurfGradHashTable::PetscHMapI, cpSurfGrad::PetscMat, gradSACP::PetscScalar, gradVolCP::PetscScalar, gradSAW::PetscScalar, gradVolW::PetscScalar) end + +@for_petsc function DMPlexRestoreGeomGradData(petsclib::$UnionPetscLib, dm::PetscDM, cpSurfGradHashTable::PetscHMapI, cpSurfGrad::PetscMat, gradSACP::$PetscScalar, gradVolCP::$PetscScalar, gradSAW::$PetscScalar, gradVolW::$PetscScalar ) + cpSurfGrad_ = Ref(cpSurfGrad.ptr) + cpArraySize_ = Ref{$PetscInt}() + wArraySize_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexRestoreGeomGradData, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscHMapI}, Ptr{CMat}, Ptr{$PetscInt}, $PetscScalar, $PetscScalar, Ptr{$PetscInt}, $PetscScalar, $PetscScalar), + dm, cpSurfGradHashTable, cpSurfGrad_, cpArraySize_, gradSACP, gradVolCP, wArraySize_, gradSAW, gradVolW, + ) + + cpSurfGrad.ptr = cpSurfGrad_[] + cpArraySize = cpArraySize_[] + wArraySize = wArraySize_[] + + return cpArraySize,wArraySize +end + +""" + numCntrlPnts::PetscInt,cntrlPntFaceMap::PetscInt,cntrlPntWeightFaceMap::PetscInt,cntrlPntEdgeMap::PetscInt,cntrlPntWeightEdgeMap::PetscInt,cntrlPntVertexMap::PetscInt,cntrlPntWeightVertexMap::PetscInt = DMPlexGetGeomCntrlPntMaps(petsclib::PetscLibType,dm::PetscDM) +Gets arrays which maps Control Point IDs to their associated Geometry FACE, EDGE, and VERTEX. + +Not collective + +Input Parameter: +- `dm` - The DMPlex object with an attached PetscContainer storing a CAD Geometry object + +Output Parameters: +- `numCntrlPnts` - Number of Control Points defining the Geometry attached to the DMPlex +- `cntrlPntFaceMap` - Array containing the FACE ID for the Control Point. Array index corresponds to Control Point ID. +- `cntrlPntWeightFaceMap` - Array containing the FACE ID for the Control Point Weight. Array index corresponds to Control Point ID. +- `cntrlPntEdgeMap` - Array containing the EDGE ID for the Control Point. Array index corresponds to Control Point ID. +- `cntrlPntWeightEdgeMap` - Array containing the EDGE ID for the Control Point Weight. Array index corresponds to Control Point ID. +- `cntrlPntVertexMap` - Array containing the VERTEX ID for the Control Point. Array index corresponds to Control Point ID. +- `cntrlPntWeightVertexMap` - Array containing the VERTEX ID for the Control Point Weight. Array index corresponds to Control Point ID. + +-seealso: DMPlexGeomDataAndGrads + +# External Links +$(_doc_external("DMPlex/DMPlexGetGeomCntrlPntMaps")) +""" +function DMPlexGetGeomCntrlPntMaps(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexGetGeomCntrlPntMaps(petsclib::$UnionPetscLib, dm::PetscDM ) + numCntrlPnts_ = Ref{$PetscInt}() + cntrlPntFaceMap_ = Ref{$PetscInt}() + cntrlPntWeightFaceMap_ = Ref{$PetscInt}() + cntrlPntEdgeMap_ = Ref{$PetscInt}() + cntrlPntWeightEdgeMap_ = Ref{$PetscInt}() + cntrlPntVertexMap_ = Ref{$PetscInt}() + cntrlPntWeightVertexMap_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexGetGeomCntrlPntMaps, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt), + dm, numCntrlPnts_, cntrlPntFaceMap_, cntrlPntWeightFaceMap_, cntrlPntEdgeMap_, cntrlPntWeightEdgeMap_, cntrlPntVertexMap_, cntrlPntWeightVertexMap_, + ) + + numCntrlPnts = numCntrlPnts_[] + cntrlPntFaceMap = cntrlPntFaceMap_[] + cntrlPntWeightFaceMap = cntrlPntWeightFaceMap_[] + cntrlPntEdgeMap = cntrlPntEdgeMap_[] + cntrlPntWeightEdgeMap = cntrlPntWeightEdgeMap_[] + cntrlPntVertexMap = cntrlPntVertexMap_[] + cntrlPntWeightVertexMap = cntrlPntWeightVertexMap_[] + + return numCntrlPnts,cntrlPntFaceMap,cntrlPntWeightFaceMap,cntrlPntEdgeMap,cntrlPntWeightEdgeMap,cntrlPntVertexMap,cntrlPntWeightVertexMap +end + +""" + DMPlexInvertCell(petsclib::PetscLibType,cellType::DMPolytopeType, cone::Vector{PetscInt}) +Flips cell orientations since `DMPLEX` stores some of them internally with outward normals. + +Input Parameters: +- `cellType` - The cell type +- `cone` - The incoming cone + +Output Parameter: +- `cone` - The inverted cone (in-place) + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPolytopeType`, `DMPlexGenerate()` + +# External Links +$(_doc_external("DMPlex/DMPlexInvertCell")) +""" +function DMPlexInvertCell(petsclib::PetscLibType, cellType::DMPolytopeType, cone::Vector{PetscInt}) end + +@for_petsc function DMPlexInvertCell(petsclib::$UnionPetscLib, cellType::DMPolytopeType, cone::Vector{$PetscInt} ) + + @chk ccall( + (:DMPlexInvertCell, $petsc_library), + PetscErrorCode, + (DMPolytopeType, Ptr{$PetscInt}), + cellType, cone, + ) + + + return nothing +end + +""" + DMPlexReorderCell(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt, cone::Vector{PetscInt}) +Flips cell orientations since `DMPLEX` stores some of them internally with outward normals. + +Input Parameters: +- `dm` - The `DMPLEX` object +- `cell` - The cell +- `cone` - The incoming cone + +Output Parameter: +- `cone` - The reordered cone (in-place) + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPolytopeType`, `DMPlexGenerate()` + +# External Links +$(_doc_external("DMPlex/DMPlexReorderCell")) +""" +function DMPlexReorderCell(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt, cone::Vector{PetscInt}) end + +@for_petsc function DMPlexReorderCell(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt, cone::Vector{$PetscInt} ) + + @chk ccall( + (:DMPlexReorderCell, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + dm, cell, cone, + ) + + + return nothing +end + +""" + DMPlexTriangleSetOptions(petsclib::PetscLibType,dm::PetscDM, opts::String) +Set the options used for the Triangle mesh generator + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `opts` - The command line options + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTetgenSetOptions()`, `DMPlexGenerate()` + +# External Links +$(_doc_external("DMPlex/DMPlexTriangleSetOptions")) +""" +function DMPlexTriangleSetOptions(petsclib::PetscLibType, dm::PetscDM, opts::String) end + +@for_petsc function DMPlexTriangleSetOptions(petsclib::$UnionPetscLib, dm::PetscDM, opts::String ) + + @chk ccall( + (:DMPlexTriangleSetOptions, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + dm, opts, + ) + + + return nothing +end + +""" + DMPlexTetgenSetOptions(petsclib::PetscLibType,dm::PetscDM, opts::String) +Set the options used for the Tetgen mesh generator + +Not Collective + +Input Parameters: +- `dm` - The `DMPLEX` object +- `opts` - The command line options + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTriangleSetOptions()`, `DMPlexGenerate()` + +# External Links +$(_doc_external("DMPlex/DMPlexTetgenSetOptions")) +""" +function DMPlexTetgenSetOptions(petsclib::PetscLibType, dm::PetscDM, opts::String) end + +@for_petsc function DMPlexTetgenSetOptions(petsclib::$UnionPetscLib, dm::PetscDM, opts::String ) + + @chk ccall( + (:DMPlexTetgenSetOptions, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + dm, opts, + ) + + + return nothing +end + +""" + DMPlexGenerate(petsclib::PetscLibType,boundary::PetscDM, name::String, interpolate::PetscBool, mesh::PetscDM) +Generates a mesh. + +Not Collective + +Input Parameters: +- `boundary` - The `DMPLEX` boundary object +- `name` - The mesh generation package name +- `interpolate` - Flag to create intermediate mesh elements + +Output Parameter: +- `mesh` - The `DMPLEX` object + +Options Database Keys: +- `-dm_plex_generate ` - package to generate mesh, for example, triangle, ctetgen or tetgen +- `-dm_generator ` - package to generate mesh, for example, triangle, ctetgen or tetgen + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMRefine()` + +# External Links +$(_doc_external("DMPlex/DMPlexGenerate")) +""" +function DMPlexGenerate(petsclib::PetscLibType, boundary::PetscDM, name::String, interpolate::PetscBool, mesh::PetscDM) end + +@for_petsc function DMPlexGenerate(petsclib::$UnionPetscLib, boundary::PetscDM, name::String, interpolate::PetscBool, mesh::PetscDM ) + mesh_ = Ref(mesh.ptr) + + @chk ccall( + (:DMPlexGenerate, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, PetscBool, Ptr{CDM}), + boundary, name, interpolate, mesh_, + ) + + mesh.ptr = mesh_[] + + return nothing +end + +""" + DMPlexReconstructGradientsFVM(petsclib::PetscLibType,dm::PetscDM, locX::PetscVec, grad::PetscVec) +reconstruct the gradient of a vector using a finite volume method. + +Input Parameters: +- `dm` - the mesh +- `locX` - the local representation of the vector + +Output Parameter: +- `grad` - the global representation of the gradient + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `Vec`, `DMPlexGetGradientDM()` + +# External Links +$(_doc_external("DMPlex/DMPlexReconstructGradientsFVM")) +""" +function DMPlexReconstructGradientsFVM(petsclib::PetscLibType, dm::PetscDM, locX::PetscVec, grad::PetscVec) end + +@for_petsc function DMPlexReconstructGradientsFVM(petsclib::$UnionPetscLib, dm::PetscDM, locX::PetscVec, grad::PetscVec ) + + @chk ccall( + (:DMPlexReconstructGradientsFVM, $petsc_library), + PetscErrorCode, + (CDM, CVec, CVec), + dm, locX, grad, + ) + + + return nothing +end + +""" + DMPlexCreateCoordinateSpace(petsclib::PetscLibType,dm::PetscDM, degree::PetscInt, locized::PetscBool, project::PetscBool) +Creates a finite element space for the coordinates + +Collective + +Input Parameters: +- `dm` - The `DMPLEX` +- `degree` - The degree of the finite element or `PETSC_DECIDE` +- `localized` - Flag to create a localized (DG) coordinate space +- `project` - Flag to project current coordinates into the space + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscPointFn`, `PetscFECreateLagrange()`, `DMGetCoordinateDM()`, `DMPlexSetCoordinateMap()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateCoordinateSpace")) +""" +function DMPlexCreateCoordinateSpace(petsclib::PetscLibType, dm::PetscDM, degree::PetscInt, locized::PetscBool, project::PetscBool) end + +@for_petsc function DMPlexCreateCoordinateSpace(petsclib::$UnionPetscLib, dm::PetscDM, degree::$PetscInt, locized::PetscBool, project::PetscBool ) + + @chk ccall( + (:DMPlexCreateCoordinateSpace, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscBool, PetscBool), + dm, degree, locized, project, + ) + + + return nothing +end + +""" + newdm::PetscDM = DMPlexCreateDoublet(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, simplex::PetscBool, interpolate::PetscBool, refinementLimit::PetscReal) +Creates a mesh of two cells of the specified type, optionally with later refinement. + +Collective + +Input Parameters: +- `comm` - The communicator for the `DM` object +- `dim` - The spatial dimension +- `simplex` - Flag for simplicial cells, otherwise they are tensor product cells +- `interpolate` - Flag to create intermediate mesh pieces (edges, faces) +- `refinementLimit` - A nonzero number indicates the largest admissible volume for a refined cell + +Output Parameter: +- `newdm` - The `DM` object + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateDoublet")) +""" +function DMPlexCreateDoublet(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, simplex::PetscBool, interpolate::PetscBool, refinementLimit::PetscReal) end + +@for_petsc function DMPlexCreateDoublet(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, simplex::PetscBool, interpolate::PetscBool, refinementLimit::$PetscReal ) + newdm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateDoublet, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, PetscBool, PetscBool, $PetscReal, Ptr{CDM}), + comm, dim, simplex, interpolate, refinementLimit, newdm_, + ) + + newdm = PetscDM(newdm_[], petsclib) + + return newdm +end + +""" + dm::PetscDM = DMPlexCreateBoxSurfaceMesh(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, faces::Vector{PetscInt}, lower::Vector{PetscReal}, upper::Vector{PetscReal}, interpolate::PetscBool) +Creates a mesh on the surface of the tensor product of unit intervals (box) using tensor cells (hexahedra). + +Collective + +Input Parameters: +- `comm` - The communicator for the `DM` object +- `dim` - The spatial dimension of the box, so the resulting mesh is has dimension `dim`-1 +- `faces` - Number of faces per dimension, or `NULL` for (1,) in 1D and (2, 2) in 2D and (1, 1, 1) in 3D +- `lower` - The lower left corner, or `NULL` for (0, 0, 0) +- `upper` - The upper right corner, or `NULL` for (1, 1, 1) +- `interpolate` - Flag to create intermediate mesh pieces (edges, faces) + +Output Parameter: +- `dm` - The `DM` object + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMSetFromOptions()`, `DMPlexCreateBoxMesh()`, `DMPlexCreateFromFile()`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateBoxSurfaceMesh")) +""" +function DMPlexCreateBoxSurfaceMesh(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, faces::Vector{PetscInt}, lower::Vector{PetscReal}, upper::Vector{PetscReal}, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateBoxSurfaceMesh(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, faces::Vector{$PetscInt}, lower::Vector{$PetscReal}, upper::Vector{$PetscReal}, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateBoxSurfaceMesh, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscReal}, Ptr{$PetscReal}, PetscBool, Ptr{CDM}), + comm, dim, faces, lower, upper, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateBoxMesh(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, simplex::PetscBool, faces::Vector{PetscInt}, lower::Vector{PetscReal}, upper::Vector{PetscReal}, periodicity::Vector{DMBoundaryType}, interpolate::PetscBool, locizationHeight::PetscInt, sparseLocalize::PetscBool) +Creates a mesh on the tensor product of unit intervals (box) using simplices or tensor cells (hexahedra). + +Collective + +Input Parameters: +- `comm` - The communicator for the `DM` object +- `dim` - The spatial dimension +- `simplex` - `PETSC_TRUE` for simplices, `PETSC_FALSE` for tensor cells +- `faces` - Number of faces per dimension, or `NULL` for (1,) in 1D and (2, 2) in 2D and (1, 1, 1) in 3D +- `lower` - The lower left corner, or `NULL` for (0, 0, 0) +- `upper` - The upper right corner, or `NULL` for (1, 1, 1) +- `periodicity` - The boundary type for the X,Y,Z direction, or `NULL` for `DM_BOUNDARY_NONE` +- `interpolate` - Flag to create intermediate mesh pieces (edges, faces) +- `localizationHeight` - Flag to localize edges and faces in addition to cells; only significant for periodic meshes +- `sparseLocalize` - Flag to localize coordinates only for cells near the periodic boundary; only significant for periodic meshes + +Output Parameter: +- `dm` - The `DM` object + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMSetFromOptions()`, `DMPlexCreateFromFile()`, `DMPlexCreateHexCylinderMesh()`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateBoxMesh")) +""" +function DMPlexCreateBoxMesh(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, simplex::PetscBool, faces::Vector{PetscInt}, lower::Vector{PetscReal}, upper::Vector{PetscReal}, periodicity::Vector{DMBoundaryType}, interpolate::PetscBool, locizationHeight::PetscInt, sparseLocalize::PetscBool) end + +@for_petsc function DMPlexCreateBoxMesh(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, simplex::PetscBool, faces::Vector{$PetscInt}, lower::Vector{$PetscReal}, upper::Vector{$PetscReal}, periodicity::Vector{DMBoundaryType}, interpolate::PetscBool, locizationHeight::$PetscInt, sparseLocalize::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateBoxMesh, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, PetscBool, Ptr{$PetscInt}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{DMBoundaryType}, PetscBool, $PetscInt, PetscBool, Ptr{CDM}), + comm, dim, simplex, faces, lower, upper, periodicity, interpolate, locizationHeight, sparseLocalize, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateWedgeBoxMesh(petsclib::PetscLibType,comm::MPI_Comm, faces::Vector{PetscInt}, lower::Vector{PetscReal}, upper::Vector{PetscReal}, periodicity::Vector{DMBoundaryType}, orderHeight::PetscBool, interpolate::PetscBool) +Creates a 3 + +Collective + +Input Parameters: +- `comm` - The communicator for the `DM` object +- `faces` - Number of faces per dimension, or `NULL` for (1, 1, 1) +- `lower` - The lower left corner, or `NULL` for (0, 0, 0) +- `upper` - The upper right corner, or `NULL` for (1, 1, 1) +- `periodicity` - The boundary type for the X,Y,Z direction, or `NULL` for `DM_BOUNDARY_NONE` +- `orderHeight` - If `PETSC_TRUE`, orders the extruded cells in the height first. Otherwise, orders the cell on the layers first +- `interpolate` - Flag to create intermediate mesh pieces (edges, faces) + +Output Parameter: +- `dm` - The `DM` object + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateHexCylinderMesh()`, `DMPlexCreateWedgeCylinderMesh()`, `DMExtrude()`, `DMPlexCreateBoxMesh()`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateWedgeBoxMesh")) +""" +function DMPlexCreateWedgeBoxMesh(petsclib::PetscLibType, comm::MPI_Comm, faces::Vector{PetscInt}, lower::Vector{PetscReal}, upper::Vector{PetscReal}, periodicity::Vector{DMBoundaryType}, orderHeight::PetscBool, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateWedgeBoxMesh(petsclib::$UnionPetscLib, comm::MPI_Comm, faces::Vector{$PetscInt}, lower::Vector{$PetscReal}, upper::Vector{$PetscReal}, periodicity::Vector{DMBoundaryType}, orderHeight::PetscBool, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateWedgeBoxMesh, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{$PetscInt}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{DMBoundaryType}, PetscBool, PetscBool, Ptr{CDM}), + comm, faces, lower, upper, periodicity, orderHeight, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateHypercubicMesh(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, edges::Vector{PetscInt}, lower::Vector{PetscReal}, upper::Vector{PetscReal}, overlap::PetscInt) +Creates a periodic mesh on the tensor product of unit intervals using only vertices and edges. + +Collective + +Input Parameters: +- `comm` - The communicator for the `DM` object +- `dim` - The spatial dimension +- `edges` - Number of edges per dimension, or `NULL` for (1,) in 1D and (2, 2) in 2D and (1, 1, 1) in 3D +- `lower` - The lower left corner, or `NULL` for (0, 0, 0) +- `upper` - The upper right corner, or `NULL` for (1, 1, 1) +- `overlap` - The number of vertices in each direction to include in the overlap (default is 1) + +Output Parameter: +- `dm` - The DM object + +Level: beginner + +-seealso: `DMSetFromOptions()`, `DMPlexCreateFromFile()`, `DMPlexCreateHexCylinderMesh()`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateHypercubicMesh")) +""" +function DMPlexCreateHypercubicMesh(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, edges::Vector{PetscInt}, lower::Vector{PetscReal}, upper::Vector{PetscReal}, overlap::PetscInt) end + +@for_petsc function DMPlexCreateHypercubicMesh(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, edges::Vector{$PetscInt}, lower::Vector{$PetscReal}, upper::Vector{$PetscReal}, overlap::$PetscInt ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateHypercubicMesh, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscInt, Ptr{CDM}), + comm, dim, edges, lower, upper, overlap, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMPlexSetOptionsPrefix(petsclib::PetscLibType,dm::PetscDM, prefix::String) +Sets the prefix used for searching for all `DM` options in the database. + +Logically Collective + +Input Parameters: +- `dm` - the `DM` context +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `SNESSetFromOptions()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetOptionsPrefix")) +""" +function DMPlexSetOptionsPrefix(petsclib::PetscLibType, dm::PetscDM, prefix::String) end + +@for_petsc function DMPlexSetOptionsPrefix(petsclib::$UnionPetscLib, dm::PetscDM, prefix::String ) + + @chk ccall( + (:DMPlexSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}), + dm, prefix, + ) + + + return nothing +end + +""" + dm::PetscDM = DMPlexCreateHexCylinderMesh(petsclib::PetscLibType,comm::MPI_Comm, periodicZ::DMBoundaryType, Nr::PetscInt) +Creates a mesh on the tensor product of the unit interval with the circle (cylinder) using hexahedra. + +Collective + +Input Parameters: +- `comm` - The communicator for the `DM` object +- `periodicZ` - The boundary type for the Z direction +- `Nr` - The number of refinements to carry out + +Output Parameter: +- `dm` - The `DM` object + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateBoxMesh()`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateHexCylinderMesh")) +""" +function DMPlexCreateHexCylinderMesh(petsclib::PetscLibType, comm::MPI_Comm, periodicZ::DMBoundaryType, Nr::PetscInt) end + +@for_petsc function DMPlexCreateHexCylinderMesh(petsclib::$UnionPetscLib, comm::MPI_Comm, periodicZ::DMBoundaryType, Nr::$PetscInt ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateHexCylinderMesh, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMBoundaryType, $PetscInt, Ptr{CDM}), + comm, periodicZ, Nr, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateWedgeCylinderMesh(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, interpolate::PetscBool) +Creates a mesh on the tensor product of the unit interval with the circle (cylinder) using wedges. + +Collective + +Input Parameters: +- `comm` - The communicator for the `DM` object +- `n` - The number of wedges around the origin +- `interpolate` - Create edges and faces + +Output Parameter: +- `dm` - The `DM` object + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateHexCylinderMesh()`, `DMPlexCreateBoxMesh()`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateWedgeCylinderMesh")) +""" +function DMPlexCreateWedgeCylinderMesh(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateWedgeCylinderMesh(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateWedgeCylinderMesh, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, PetscBool, Ptr{CDM}), + comm, n, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateTPSMesh(petsclib::PetscLibType,comm::MPI_Comm, tpstype::DMPlexTPSType, extent::Vector{PetscInt}, periodic::Vector{DMBoundaryType}, tps_distribute::PetscBool, refinements::PetscInt, layers::PetscInt, thickness::PetscReal) +Create a distributed, interpolated mesh of a triply + +Collective + +Input Parameters: +- `comm` - The communicator for the `DM` object +- `tpstype` - Type of triply-periodic surface +- `extent` - Array of length 3 containing number of periods in each direction +- `periodic` - array of length 3 with periodicity, or `NULL` for non-periodic +- `tps_distribute` - Distribute 2D manifold mesh prior to refinement and extrusion (more scalable) +- `refinements` - Number of factor-of-2 refinements of 2D manifold mesh +- `layers` - Number of cell layers extruded in normal direction +- `thickness` - Thickness in normal direction + +Output Parameter: +- `dm` - The `DM` object + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateSphereMesh()`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateTPSMesh")) +""" +function DMPlexCreateTPSMesh(petsclib::PetscLibType, comm::MPI_Comm, tpstype::DMPlexTPSType, extent::Vector{PetscInt}, periodic::Vector{DMBoundaryType}, tps_distribute::PetscBool, refinements::PetscInt, layers::PetscInt, thickness::PetscReal) end + +@for_petsc function DMPlexCreateTPSMesh(petsclib::$UnionPetscLib, comm::MPI_Comm, tpstype::DMPlexTPSType, extent::Vector{$PetscInt}, periodic::Vector{DMBoundaryType}, tps_distribute::PetscBool, refinements::$PetscInt, layers::$PetscInt, thickness::$PetscReal ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateTPSMesh, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMPlexTPSType, Ptr{$PetscInt}, Ptr{DMBoundaryType}, PetscBool, $PetscInt, $PetscInt, $PetscReal, Ptr{CDM}), + comm, tpstype, extent, periodic, tps_distribute, refinements, layers, thickness, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateSphereMesh(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, simplex::PetscBool, R::PetscReal) +Creates a mesh on the d + +Collective + +Input Parameters: +- `comm` - The communicator for the `DM` object +- `dim` - The dimension +- `simplex` - Use simplices, or tensor product cells +- `R` - The radius + +Output Parameter: +- `dm` - The `DM` object + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateBallMesh()`, `DMPlexCreateBoxMesh()`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateSphereMesh")) +""" +function DMPlexCreateSphereMesh(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, simplex::PetscBool, R::PetscReal) end + +@for_petsc function DMPlexCreateSphereMesh(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, simplex::PetscBool, R::$PetscReal ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateSphereMesh, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, PetscBool, $PetscReal, Ptr{CDM}), + comm, dim, simplex, R, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateBallMesh(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, R::PetscReal) +Creates a simplex mesh on the d + +Collective + +Input Parameters: +- `comm` - The communicator for the `DM` object +- `dim` - The dimension +- `R` - The radius + +Output Parameter: +- `dm` - The `DM` object + +Options Database Key: +- `bd_dm_refine` - This will refine the surface mesh preserving the sphere geometry + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateSphereMesh()`, `DMPlexCreateBoxMesh()`, `DMSetType()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateBallMesh")) +""" +function DMPlexCreateBallMesh(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, R::PetscReal) end + +@for_petsc function DMPlexCreateBallMesh(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, R::$PetscReal ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateBallMesh, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscReal, Ptr{CDM}), + comm, dim, R, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + refdm::PetscDM = DMPlexCreateReferenceCell(petsclib::PetscLibType,comm::MPI_Comm, ct::DMPolytopeType) +Create a `DMPLEX` with the appropriate FEM reference cell + +Collective + +Input Parameters: +- `comm` - The communicator +- `ct` - The cell type of the reference cell + +Output Parameter: +- `refdm` - The reference cell + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateBoxMesh()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateReferenceCell")) +""" +function DMPlexCreateReferenceCell(petsclib::PetscLibType, comm::MPI_Comm, ct::DMPolytopeType) end + +@for_petsc function DMPlexCreateReferenceCell(petsclib::$UnionPetscLib, comm::MPI_Comm, ct::DMPolytopeType ) + refdm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateReferenceCell, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMPolytopeType, Ptr{CDM}), + comm, ct, refdm_, + ) + + refdm = PetscDM(refdm_[], petsclib) + + return refdm +end + +""" + mesh::PetscDM = DMPlexCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a `DMPLEX` object, which encapsulates an unstructured mesh, or CW complex, which can be expressed using a Hasse Diagram. + +Collective + +Input Parameter: +- `comm` - The communicator for the `DMPLEX` object + +Output Parameter: +- `mesh` - The `DMPLEX` object + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMType`, `DMCreate()`, `DMSetType()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreate")) +""" +function DMPlexCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMPlexCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + mesh_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CDM}), + comm, mesh_, + ) + + mesh = PetscDM(mesh_[], petsclib) + + return mesh +end + +""" + verticesAdjSaved::Vector{PetscInt} = DMPlexBuildFromCellListParallel(petsclib::PetscLibType,dm::PetscDM, numCells::PetscInt, numVertices::PetscInt, NVertices::PetscInt, numCorners::PetscInt, cells::Vector{PetscInt}, vertexSF::PetscSF) +Build a distributed `DMPLEX` topology from a list of vertices for each cell (common mesh generator output) where all cells have the same celltype + +Collective; No Fortran Support + +Input Parameters: +- `dm` - The `DM` +- `numCells` - The number of cells owned by this process +- `numVertices` - The number of vertices to be owned by this process, or `PETSC_DECIDE` +- `NVertices` - The global number of vertices, or `PETSC_DETERMINE` +- `numCorners` - The number of vertices for each cell +- `cells` - An array of numCells \times numCorners numbers, the global vertex numbers for each cell + +Output Parameters: +- `vertexSF` - (Optional) `PetscSF` describing complete vertex ownership +- `verticesAdjSaved` - (Optional) vertex adjacency array + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexBuildFromCellList()`, `DMPlexCreateFromCellListParallelPetsc()`, `DMPlexBuildCoordinatesFromCellListParallel()`, +`PetscSF` + +# External Links +$(_doc_external("DMPlex/DMPlexBuildFromCellListParallel")) +""" +function DMPlexBuildFromCellListParallel(petsclib::PetscLibType, dm::PetscDM, numCells::PetscInt, numVertices::PetscInt, NVertices::PetscInt, numCorners::PetscInt, cells::Vector{PetscInt}, vertexSF::PetscSF) end + +@for_petsc function DMPlexBuildFromCellListParallel(petsclib::$UnionPetscLib, dm::PetscDM, numCells::$PetscInt, numVertices::$PetscInt, NVertices::$PetscInt, numCorners::$PetscInt, cells::Vector{$PetscInt}, vertexSF::PetscSF ) + verticesAdjSaved_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexBuildFromCellListParallel, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{PetscSF}, Ptr{Ptr{$PetscInt}}), + dm, numCells, numVertices, NVertices, numCorners, cells, vertexSF, verticesAdjSaved_, + ) + + verticesAdjSaved = unsafe_wrap(Array, verticesAdjSaved_[], VecGetLocalSize(petsclib, x); own = false) + + return verticesAdjSaved +end + +""" + verticesAdjSaved::Vector{PetscInt} = DMPlexBuildFromCellSectionParallel(petsclib::PetscLibType,dm::PetscDM, numCells::PetscInt, numVertices::PetscInt, NVertices::PetscInt, cellSection::PetscSection, cells::Vector{PetscInt}, vertexSF::PetscSF) +Build distributed `DMPLEX` topology from a list of vertices for each cell (common mesh generator output) allowing multiple celltypes + +Collective; No Fortran Support + +Input Parameters: +- `dm` - The `DM` +- `numCells` - The number of cells owned by this process +- `numVertices` - The number of vertices to be owned by this process, or `PETSC_DECIDE` +- `NVertices` - The global number of vertices, or `PETSC_DETERMINE` +- `cellSection` - The `PetscSection` giving the number of vertices for each cell (layout of cells) +- `cells` - An array of the global vertex numbers for each cell + +Output Parameters: +- `vertexSF` - (Optional) `PetscSF` describing complete vertex ownership +- `verticesAdjSaved` - (Optional) vertex adjacency array + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexBuildFromCellListParallel()`, `DMPlexCreateFromCellSectionParallel()`, `DMPlexBuildCoordinatesFromCellListParallel()`, +`PetscSF` + +# External Links +$(_doc_external("DMPlex/DMPlexBuildFromCellSectionParallel")) +""" +function DMPlexBuildFromCellSectionParallel(petsclib::PetscLibType, dm::PetscDM, numCells::PetscInt, numVertices::PetscInt, NVertices::PetscInt, cellSection::PetscSection, cells::Vector{PetscInt}, vertexSF::PetscSF) end + +@for_petsc function DMPlexBuildFromCellSectionParallel(petsclib::$UnionPetscLib, dm::PetscDM, numCells::$PetscInt, numVertices::$PetscInt, NVertices::$PetscInt, cellSection::PetscSection, cells::Vector{$PetscInt}, vertexSF::PetscSF ) + verticesAdjSaved_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexBuildFromCellSectionParallel, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, PetscSection, Ptr{$PetscInt}, Ptr{PetscSF}, Ptr{Ptr{$PetscInt}}), + dm, numCells, numVertices, NVertices, cellSection, cells, vertexSF, verticesAdjSaved_, + ) + + verticesAdjSaved = unsafe_wrap(Array, verticesAdjSaved_[], VecGetLocalSize(petsclib, x); own = false) + + return verticesAdjSaved +end + +""" + DMPlexBuildCoordinatesFromCellListParallel(petsclib::PetscLibType,dm::PetscDM, spaceDim::PetscInt, sfVert::PetscSF, vertexCoords::Vector{PetscReal}) +Build `DM` coordinates from a list of coordinates for each owned vertex (common mesh generator output) + +Collective; No Fortran Support + +Input Parameters: +- `dm` - The `DM` +- `spaceDim` - The spatial dimension used for coordinates +- `sfVert` - `PetscSF` describing complete vertex ownership +- `vertexCoords` - An array of numVertices*spaceDim numbers, the coordinates of each vertex + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexBuildCoordinatesFromCellList()`, `DMPlexCreateFromCellListParallelPetsc()`, `DMPlexBuildFromCellListParallel()` + +# External Links +$(_doc_external("DMPlex/DMPlexBuildCoordinatesFromCellListParallel")) +""" +function DMPlexBuildCoordinatesFromCellListParallel(petsclib::PetscLibType, dm::PetscDM, spaceDim::PetscInt, sfVert::PetscSF, vertexCoords::Vector{PetscReal}) end + +@for_petsc function DMPlexBuildCoordinatesFromCellListParallel(petsclib::$UnionPetscLib, dm::PetscDM, spaceDim::$PetscInt, sfVert::PetscSF, vertexCoords::Vector{$PetscReal} ) + + @chk ccall( + (:DMPlexBuildCoordinatesFromCellListParallel, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, PetscSF, Ptr{$PetscReal}), + dm, spaceDim, sfVert, vertexCoords, + ) + + + return nothing +end + +""" + vertexSF::PetscSF,verticesAdj::Vector{PetscInt},dm::PetscDM = DMPlexCreateFromCellListParallelPetsc(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, numCells::PetscInt, numVertices::PetscInt, NVertices::PetscInt, numCorners::PetscInt, interpolate::PetscBool, cells::Vector{PetscInt}, spaceDim::PetscInt, vertexCoords::Vector{PetscReal}) +Create distributed `DMPLEX` from a list of vertices for each cell (common mesh generator output) where all cells have the same celltype + +Collective + +Input Parameters: +- `comm` - The communicator +- `dim` - The topological dimension of the mesh +- `numCells` - The number of cells owned by this process +- `numVertices` - The number of vertices owned by this process, or `PETSC_DECIDE` +- `NVertices` - The global number of vertices, or `PETSC_DECIDE` +- `numCorners` - The number of vertices for each cell +- `interpolate` - Flag indicating that intermediate mesh entities (faces, edges) should be created automatically +- `cells` - An array of numCells*numCorners numbers, the global vertex numbers for each cell +- `spaceDim` - The spatial dimension used for coordinates +- `vertexCoords` - An array of numVertices*spaceDim numbers, the coordinates of each vertex + +Output Parameters: +- `dm` - The `DM` +- `vertexSF` - (Optional) `PetscSF` describing complete vertex ownership +- `verticesAdj` - (Optional) vertex adjacency array + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateFromCellListPetsc()`, `DMPlexBuildFromCellListParallel()`, `DMPlexBuildCoordinatesFromCellListParallel()`, `DMPlexCreateFromDAG()`, `DMPlexCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateFromCellListParallelPetsc")) +""" +function DMPlexCreateFromCellListParallelPetsc(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, numCells::PetscInt, numVertices::PetscInt, NVertices::PetscInt, numCorners::PetscInt, interpolate::PetscBool, cells::Vector{PetscInt}, spaceDim::PetscInt, vertexCoords::Vector{PetscReal}) end + +@for_petsc function DMPlexCreateFromCellListParallelPetsc(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, numCells::$PetscInt, numVertices::$PetscInt, NVertices::$PetscInt, numCorners::$PetscInt, interpolate::PetscBool, cells::Vector{$PetscInt}, spaceDim::$PetscInt, vertexCoords::Vector{$PetscReal} ) + vertexSF_ = Ref{PetscSF}() + verticesAdj_ = Ref{Ptr{$PetscInt}}() + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateFromCellListParallelPetsc, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, PetscBool, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscReal}, Ptr{PetscSF}, Ptr{Ptr{$PetscInt}}, Ptr{CDM}), + comm, dim, numCells, numVertices, NVertices, numCorners, interpolate, cells, spaceDim, vertexCoords, vertexSF_, verticesAdj_, dm_, + ) + + vertexSF = vertexSF_[] + verticesAdj = unsafe_wrap(Array, verticesAdj_[], VecGetLocalSize(petsclib, x); own = false) + dm = PetscDM(dm_[], petsclib) + + return vertexSF,verticesAdj,dm +end + +""" + vertexSF::PetscSF,verticesAdj::Vector{PetscInt},dm::PetscDM = DMPlexCreateFromCellSectionParallel(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, numCells::PetscInt, numVertices::PetscInt, NVertices::PetscInt, cellSection::PetscSection, interpolate::PetscBool, cells::Vector{PetscInt}, spaceDim::PetscInt, vertexCoords::Vector{PetscReal}) +Create distributed `DMPLEX` from a list of vertices for each cell (common mesh generator output) and supports multiple celltypes + +Collective + +Input Parameters: +- `comm` - The communicator +- `dim` - The topological dimension of the mesh +- `numCells` - The number of cells owned by this process +- `numVertices` - The number of vertices owned by this process, or `PETSC_DECIDE` +- `NVertices` - The global number of vertices, or `PETSC_DECIDE` +- `cellSection` - The `PetscSection` giving the number of vertices for each cell (layout of cells) +- `interpolate` - Flag indicating that intermediate mesh entities (faces, edges) should be created automatically +- `cells` - An array of the global vertex numbers for each cell +- `spaceDim` - The spatial dimension used for coordinates +- `vertexCoords` - An array of numVertices*spaceDim numbers, the coordinates of each vertex + +Output Parameters: +- `dm` - The `DM` +- `vertexSF` - (Optional) `PetscSF` describing complete vertex ownership +- `verticesAdj` - (Optional) vertex adjacency array + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateFromCellListPetsc()`, `DMPlexBuildFromCellListParallel()`, `DMPlexBuildCoordinatesFromCellListParallel()`, `DMPlexCreateFromDAG()`, `DMPlexCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateFromCellSectionParallel")) +""" +function DMPlexCreateFromCellSectionParallel(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, numCells::PetscInt, numVertices::PetscInt, NVertices::PetscInt, cellSection::PetscSection, interpolate::PetscBool, cells::Vector{PetscInt}, spaceDim::PetscInt, vertexCoords::Vector{PetscReal}) end + +@for_petsc function DMPlexCreateFromCellSectionParallel(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, numCells::$PetscInt, numVertices::$PetscInt, NVertices::$PetscInt, cellSection::PetscSection, interpolate::PetscBool, cells::Vector{$PetscInt}, spaceDim::$PetscInt, vertexCoords::Vector{$PetscReal} ) + vertexSF_ = Ref{PetscSF}() + verticesAdj_ = Ref{Ptr{$PetscInt}}() + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateFromCellSectionParallel, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, PetscSection, PetscBool, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscReal}, Ptr{PetscSF}, Ptr{Ptr{$PetscInt}}, Ptr{CDM}), + comm, dim, numCells, numVertices, NVertices, cellSection, interpolate, cells, spaceDim, vertexCoords, vertexSF_, verticesAdj_, dm_, + ) + + vertexSF = vertexSF_[] + verticesAdj = unsafe_wrap(Array, verticesAdj_[], VecGetLocalSize(petsclib, x); own = false) + dm = PetscDM(dm_[], petsclib) + + return vertexSF,verticesAdj,dm +end + +""" + DMPlexBuildFromCellList(petsclib::PetscLibType,dm::PetscDM, numCells::PetscInt, numVertices::PetscInt, numCorners::PetscInt, cells::Vector{PetscInt}) +Build `DMPLEX` topology from a list of vertices for each cell (common mesh generator output) + +Collective; No Fortran Support + +Input Parameters: +- `dm` - The `DM` +- `numCells` - The number of cells owned by this process +- `numVertices` - The number of vertices owned by this process, or `PETSC_DETERMINE` +- `numCorners` - The number of vertices for each cell +- `cells` - An array of `numCells` x `numCorners` numbers, the global vertex numbers for each cell + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexBuildFromCellListParallel()`, `DMPlexBuildCoordinatesFromCellList()`, `DMPlexCreateFromCellListPetsc()` + +# External Links +$(_doc_external("DMPlex/DMPlexBuildFromCellList")) +""" +function DMPlexBuildFromCellList(petsclib::PetscLibType, dm::PetscDM, numCells::PetscInt, numVertices::PetscInt, numCorners::PetscInt, cells::Vector{PetscInt}) end + +@for_petsc function DMPlexBuildFromCellList(petsclib::$UnionPetscLib, dm::PetscDM, numCells::$PetscInt, numVertices::$PetscInt, numCorners::$PetscInt, cells::Vector{$PetscInt} ) + + @chk ccall( + (:DMPlexBuildFromCellList, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}), + dm, numCells, numVertices, numCorners, cells, + ) + + + return nothing +end + +""" + DMPlexBuildCoordinatesFromCellList(petsclib::PetscLibType,dm::PetscDM, spaceDim::PetscInt, vertexCoords::Vector{PetscReal}) +Build `DM` coordinates from a list of coordinates for each owned vertex (common mesh generator output) + +Collective + +Input Parameters: +- `dm` - The `DM` +- `spaceDim` - The spatial dimension used for coordinates +- `vertexCoords` - An array of numVertices*spaceDim numbers, the coordinates of each vertex + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexBuildCoordinatesFromCellListParallel()`, `DMPlexCreateFromCellListPetsc()`, `DMPlexBuildFromCellList()` + +# External Links +$(_doc_external("DMPlex/DMPlexBuildCoordinatesFromCellList")) +""" +function DMPlexBuildCoordinatesFromCellList(petsclib::PetscLibType, dm::PetscDM, spaceDim::PetscInt, vertexCoords::Vector{PetscReal}) end + +@for_petsc function DMPlexBuildCoordinatesFromCellList(petsclib::$UnionPetscLib, dm::PetscDM, spaceDim::$PetscInt, vertexCoords::Vector{$PetscReal} ) + + @chk ccall( + (:DMPlexBuildCoordinatesFromCellList, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscReal}), + dm, spaceDim, vertexCoords, + ) + + + return nothing +end + +""" + dm::PetscDM = DMPlexCreateFromCellListPetsc(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, numCells::PetscInt, numVertices::PetscInt, numCorners::PetscInt, interpolate::PetscBool, cells::Vector{PetscInt}, spaceDim::PetscInt, vertexCoords::Vector{PetscReal}) +Create `DMPLEX` from a list of vertices for each cell (common mesh generator output), but only process 0 takes in the input + +Collective + +Input Parameters: +- `comm` - The communicator +- `dim` - The topological dimension of the mesh +- `numCells` - The number of cells, only on process 0 +- `numVertices` - The number of vertices owned by this process, or `PETSC_DECIDE`, only on process 0 +- `numCorners` - The number of vertices for each cell, only on process 0 +- `interpolate` - Flag indicating that intermediate mesh entities (faces, edges) should be created automatically +- `cells` - An array of numCells \times numCorners numbers, the vertices for each cell, only on process 0 +- `spaceDim` - The spatial dimension used for coordinates +- `vertexCoords` - An array of numVertices \times spaceDim numbers, the coordinates of each vertex, only on process 0 + +Output Parameter: +- `dm` - The `DM`, which only has points on process 0 + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateFromCellListParallelPetsc()`, `DMPlexBuildFromCellList()`, `DMPlexBuildCoordinatesFromCellList()`, `DMPlexCreateFromDAG()`, `DMPlexCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateFromCellListPetsc")) +""" +function DMPlexCreateFromCellListPetsc(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, numCells::PetscInt, numVertices::PetscInt, numCorners::PetscInt, interpolate::PetscBool, cells::Vector{PetscInt}, spaceDim::PetscInt, vertexCoords::Vector{PetscReal}) end + +@for_petsc function DMPlexCreateFromCellListPetsc(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, numCells::$PetscInt, numVertices::$PetscInt, numCorners::$PetscInt, interpolate::PetscBool, cells::Vector{$PetscInt}, spaceDim::$PetscInt, vertexCoords::Vector{$PetscReal} ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateFromCellListPetsc, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, PetscBool, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscReal}, Ptr{CDM}), + comm, dim, numCells, numVertices, numCorners, interpolate, cells, spaceDim, vertexCoords, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMPlexCreateFromDAG(petsclib::PetscLibType,dm::PetscDM, depth::PetscInt, numPoints::Vector{PetscInt}, coneSize::Vector{PetscInt}, cones::Vector{PetscInt}, coneOrientations::Vector{PetscInt}, vertexCoords::Vector{PetscScalar}) +This takes as input the adjacency + +Input Parameters: +- `dm` - The empty `DM` object, usually from `DMCreate()` and `DMSetDimension()` +- `depth` - The depth of the DAG +- `numPoints` - Array of size depth + 1 containing the number of points at each `depth` +- `coneSize` - The cone size of each point +- `cones` - The concatenation of the cone points for each point, the cone list must be oriented correctly for each point +- `coneOrientations` - The orientation of each cone point +- `vertexCoords` - An array of numPoints[0] \times spacedim numbers representing the coordinates of each vertex, with `spacedim` the value set via `DMSetCoordinateDim()` + +Output Parameter: +- `dm` - The `DM` + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateFromCellListPetsc()`, `DMPlexCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateFromDAG")) +""" +function DMPlexCreateFromDAG(petsclib::PetscLibType, dm::PetscDM, depth::PetscInt, numPoints::Vector{PetscInt}, coneSize::Vector{PetscInt}, cones::Vector{PetscInt}, coneOrientations::Vector{PetscInt}, vertexCoords::Vector{PetscScalar}) end + +@for_petsc function DMPlexCreateFromDAG(petsclib::$UnionPetscLib, dm::PetscDM, depth::$PetscInt, numPoints::Vector{$PetscInt}, coneSize::Vector{$PetscInt}, cones::Vector{$PetscInt}, coneOrientations::Vector{$PetscInt}, vertexCoords::Vector{$PetscScalar} ) + + @chk ccall( + (:DMPlexCreateFromDAG, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}), + dm, depth, numPoints, coneSize, cones, coneOrientations, vertexCoords, + ) + + + return nothing +end + +""" + dm::PetscDM = DMPlexCreateFromFile(petsclib::PetscLibType,comm::MPI_Comm, filename::String, plexname::String, interpolate::PetscBool) +This takes a filename and produces a `DM` + +Collective + +Input Parameters: +- `comm` - The communicator +- `filename` - A file name +- `plexname` - The object name of the resulting `DM`, also used for intra-datafile lookup by some formats +- `interpolate` - Flag to create intermediate mesh pieces (edges, faces) + +Output Parameter: +- `dm` - The `DM` + +Options Database Key: +- `-dm_plex_create_from_hdf5_xdmf` - use the `PETSC_VIEWER_HDF5_XDMF` format for reading HDF5 + +Use `-dm_plex_create_ prefix` to pass options to the internal `PetscViewer`, e.g. `-dm_plex_create_viewer_hdf5_collective` + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateFromDAG()`, `DMPlexCreateFromCellListPetsc()`, `DMPlexCreate()`, `PetscObjectSetName()`, `DMView()`, `DMLoad()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateFromFile")) +""" +function DMPlexCreateFromFile(petsclib::PetscLibType, comm::MPI_Comm, filename::String, plexname::String, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateFromFile(petsclib::$UnionPetscLib, comm::MPI_Comm, filename::String, plexname::String, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateFromFile, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, PetscBool, Ptr{CDM}), + comm, filename, plexname, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + dm::PetscDM = DMPlexCreateEphemeral(petsclib::PetscLibType,tr::DMPlexTransform, prefix::String) +This takes a `DMPlexTransform` and a base `DMPlex` and produces an ephemeral `DM`, meaning one that is created on the fly in response to queries. + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `prefix` - An options prefix, or NULL + +Output Parameter: +- `dm` - The `DM` + +Level: beginner + +-seealso: `DMPlexCreateFromFile`, `DMPlexCreateFromDAG()`, `DMPlexCreateFromCellListPetsc()`, `DMPlexCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateEphemeral")) +""" +function DMPlexCreateEphemeral(petsclib::PetscLibType, tr::DMPlexTransform, prefix::String) end + +@for_petsc function DMPlexCreateEphemeral(petsclib::$UnionPetscLib, tr::DMPlexTransform, prefix::String ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateEphemeral, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{Cchar}, Ptr{CDM}), + tr, prefix, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + DMPlexMarkBoundaryFaces(petsclib::PetscLibType,dm::PetscDM, val::PetscInt, label::DMLabel) +Mark all faces on the boundary + +Collective + +Input Parameters: +- `dm` - The original `DM` +- `val` - The marker value, or `PETSC_DETERMINE` to use some value in the closure (or 1 if none are found) + +Output Parameter: +- `label` - The `DMLabel` marking boundary faces with the given value + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMLabelCreate()`, `DMCreateLabel()` + +# External Links +$(_doc_external("DMPlex/DMPlexMarkBoundaryFaces")) +""" +function DMPlexMarkBoundaryFaces(petsclib::PetscLibType, dm::PetscDM, val::PetscInt, label::DMLabel) end + +@for_petsc function DMPlexMarkBoundaryFaces(petsclib::$UnionPetscLib, dm::PetscDM, val::$PetscInt, label::DMLabel ) + + @chk ccall( + (:DMPlexMarkBoundaryFaces, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, DMLabel), + dm, val, label, + ) + + + return nothing +end + +""" + DMPlexLabelComplete(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) +Starting with a label marking points on a surface, we add the transitive closure to the surface + +Input Parameters: +- `dm` - The `DM` +- `label` - A `DMLabel` marking the surface points + +Output Parameter: +- `label` - A `DMLabel` marking all surface points in the transitive closure + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexLabelCohesiveComplete()` + +# External Links +$(_doc_external("DMPlex/DMPlexLabelComplete")) +""" +function DMPlexLabelComplete(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMPlexLabelComplete(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + + @chk ccall( + (:DMPlexLabelComplete, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, label, + ) + + + return nothing +end + +""" + DMPlexLabelAddCells(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) +Starting with a label marking points on a surface, we add a cell for each point + +Input Parameters: +- `dm` - The `DM` +- `label` - A `DMLabel` marking the surface points + +Output Parameter: +- `label` - A `DMLabel` incorporating cells + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexLabelAddFaceCells()`, `DMPlexLabelComplete()`, `DMPlexLabelCohesiveComplete()` + +# External Links +$(_doc_external("DMPlex/DMPlexLabelAddCells")) +""" +function DMPlexLabelAddCells(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMPlexLabelAddCells(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + + @chk ccall( + (:DMPlexLabelAddCells, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, label, + ) + + + return nothing +end + +""" + DMPlexLabelAddFaceCells(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) +Starting with a label marking faces on a surface, we add a cell for each face + +Input Parameters: +- `dm` - The `DM` +- `label` - A `DMLabel` marking the surface points + +Output Parameter: +- `label` - A `DMLabel` incorporating cells + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexLabelAddCells()`, `DMPlexLabelComplete()`, `DMPlexLabelCohesiveComplete()` + +# External Links +$(_doc_external("DMPlex/DMPlexLabelAddFaceCells")) +""" +function DMPlexLabelAddFaceCells(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMPlexLabelAddFaceCells(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + + @chk ccall( + (:DMPlexLabelAddFaceCells, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, label, + ) + + + return nothing +end + +""" + DMPlexLabelClearCells(petsclib::PetscLibType,dm::PetscDM, label::DMLabel) +Remove cells from a label + +Input Parameters: +- `dm` - The `DM` +- `label` - A `DMLabel` marking surface points and their adjacent cells + +Output Parameter: +- `label` - A `DMLabel` without cells + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexLabelComplete()`, `DMPlexLabelCohesiveComplete()`, `DMPlexLabelAddCells()` + +# External Links +$(_doc_external("DMPlex/DMPlexLabelClearCells")) +""" +function DMPlexLabelClearCells(petsclib::PetscLibType, dm::PetscDM, label::DMLabel) end + +@for_petsc function DMPlexLabelClearCells(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel ) + + @chk ccall( + (:DMPlexLabelClearCells, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, label, + ) + + + return nothing +end + +""" + numGhostCells::PetscInt = DMPlexConstructGhostCells(petsclib::PetscLibType,dm::PetscDM, labelName::String, dmGhosted::PetscDM) +Construct ghost cells which connect to every boundary face + +Collective + +Input Parameters: +- `dm` - The original `DM` +- `labelName` - The label specifying the boundary faces, or "Face Sets" if this is `NULL` + +Output Parameters: +- `numGhostCells` - The number of ghost cells added to the `DM` +- `dmGhosted` - The new `DM` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexConstructGhostCells")) +""" +function DMPlexConstructGhostCells(petsclib::PetscLibType, dm::PetscDM, labelName::String, dmGhosted::PetscDM) end + +@for_petsc function DMPlexConstructGhostCells(petsclib::$UnionPetscLib, dm::PetscDM, labelName::String, dmGhosted::PetscDM ) + numGhostCells_ = Ref{$PetscInt}() + dmGhosted_ = Ref(dmGhosted.ptr) + + @chk ccall( + (:DMPlexConstructGhostCells, $petsc_library), + PetscErrorCode, + (CDM, Ptr{Cchar}, Ptr{$PetscInt}, Ptr{CDM}), + dm, labelName, numGhostCells_, dmGhosted_, + ) + + numGhostCells = numGhostCells_[] + dmGhosted.ptr = dmGhosted_[] + + return numGhostCells +end + +""" + DMPlexConstructCohesiveCells(petsclib::PetscLibType,dm::PetscDM, label::DMLabel, splitLabel::DMLabel, dmSplit::PetscDM) +Construct cohesive cells which split the face along an internal interface + +Collective + +Input Parameters: +- `dm` - The original `DM` +- `label` - The `DMLabel` specifying the boundary faces (this could be auto-generated) + +Output Parameters: +- `splitLabel` - The `DMLabel` containing the split points, or `NULL` if no output is desired +- `dmSplit` - The new `DM` + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()`, `DMPlexLabelCohesiveComplete()` + +# External Links +$(_doc_external("DMPlex/DMPlexConstructCohesiveCells")) +""" +function DMPlexConstructCohesiveCells(petsclib::PetscLibType, dm::PetscDM, label::DMLabel, splitLabel::DMLabel, dmSplit::PetscDM) end + +@for_petsc function DMPlexConstructCohesiveCells(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel, splitLabel::DMLabel, dmSplit::PetscDM ) + dmSplit_ = Ref(dmSplit.ptr) + + @chk ccall( + (:DMPlexConstructCohesiveCells, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, DMLabel, Ptr{CDM}), + dm, label, splitLabel, dmSplit_, + ) + + dmSplit.ptr = dmSplit_[] + + return nothing +end + +""" + DMPlexLabelCohesiveComplete(petsclib::PetscLibType,dm::PetscDM, label::DMLabel, blabel::DMLabel, bvalue::PetscInt, flip::PetscBool, split::PetscBool, subdm::PetscDM) +Starting with a label marking points on an internal surface, we add all other mesh pieces +to complete the surface + +Input Parameters: +- `dm` - The `DM` +- `label` - A `DMLabel` marking the surface +- `blabel` - A `DMLabel` marking the vertices on the boundary which will not be duplicated, or `NULL` to find them automatically +- `bvalue` - Value of `DMLabel` marking the vertices on the boundary +- `flip` - Flag to flip the submesh normal and replace points on the other side +- `split` - Split faces impinging on the surface, rather than clamping the surface boundary +- `subdm` - The `DM` associated with the label, or `NULL` + +Output Parameter: +- `label` - A `DMLabel` marking all surface points + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexConstructCohesiveCells()`, `DMPlexLabelComplete()` + +# External Links +$(_doc_external("DMPlex/DMPlexLabelCohesiveComplete")) +""" +function DMPlexLabelCohesiveComplete(petsclib::PetscLibType, dm::PetscDM, label::DMLabel, blabel::DMLabel, bvalue::PetscInt, flip::PetscBool, split::PetscBool, subdm::PetscDM) end + +@for_petsc function DMPlexLabelCohesiveComplete(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel, blabel::DMLabel, bvalue::$PetscInt, flip::PetscBool, split::PetscBool, subdm::PetscDM ) + + @chk ccall( + (:DMPlexLabelCohesiveComplete, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, DMLabel, $PetscInt, PetscBool, PetscBool, CDM), + dm, label, blabel, bvalue, flip, split, subdm, + ) + + + return nothing +end + +""" + hybridLabel::DMLabel,splitLabel::DMLabel,dmInterface::PetscDM,dmHybrid::PetscDM = DMPlexCreateHybridMesh(petsclib::PetscLibType,dm::PetscDM, label::DMLabel, bdlabel::DMLabel, bdvalue::PetscInt) +Create a mesh with hybrid cells along an internal interface + +Collective + +Input Parameters: +- `dm` - The original `DM` +- `label` - The label specifying the interface vertices +- `bdlabel` - The optional label specifying the interface boundary vertices +- `bdvalue` - Value of optional label specifying the interface boundary vertices + +Output Parameters: +- `hybridLabel` - The label fully marking the interface, or `NULL` if no output is desired +- `splitLabel` - The label containing the split points, or `NULL` if no output is desired +- `dmInterface` - The new interface `DM`, or `NULL` +- `dmHybrid` - The new `DM` with cohesive cells + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexConstructCohesiveCells()`, `DMPlexLabelCohesiveComplete()`, `DMPlexGetSubpointMap()`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateHybridMesh")) +""" +function DMPlexCreateHybridMesh(petsclib::PetscLibType, dm::PetscDM, label::DMLabel, bdlabel::DMLabel, bdvalue::PetscInt) end + +@for_petsc function DMPlexCreateHybridMesh(petsclib::$UnionPetscLib, dm::PetscDM, label::DMLabel, bdlabel::DMLabel, bdvalue::$PetscInt ) + hybridLabel_ = Ref{DMLabel}() + splitLabel_ = Ref{DMLabel}() + dmInterface_ = Ref{CDM}() + dmHybrid_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateHybridMesh, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, DMLabel, $PetscInt, Ptr{DMLabel}, Ptr{DMLabel}, Ptr{CDM}, Ptr{CDM}), + dm, label, bdlabel, bdvalue, hybridLabel_, splitLabel_, dmInterface_, dmHybrid_, + ) + + hybridLabel = hybridLabel_[] + splitLabel = splitLabel_[] + dmInterface = PetscDM(dmInterface_[], petsclib) + dmHybrid = PetscDM(dmHybrid_[], petsclib) + + return hybridLabel,splitLabel,dmInterface,dmHybrid +end + +""" + faceVertices::Vector{PetscInt},posOriented::PetscBool = DMPlexGetOrientedFace(petsclib::PetscLibType,dm::PetscDM, cell::PetscInt, faceSize::PetscInt, face::Vector{PetscInt}, numCorners::PetscInt, indices::Vector{PetscInt}, origVertices::Vector{PetscInt}) +Given a cell and a face, as a set of vertices, return the oriented face, as a set of vertices, +in faceVertices. The orientation is such that the face normal points out of the cell + +Not Collective + +Input Parameters: +- `dm` - The original mesh +- `cell` - The cell mesh point +- `faceSize` - The number of vertices on the face +- `face` - The face vertices +- `numCorners` - The number of vertices on the cell +- `indices` - Local numbering of face vertices in cell cone +- `origVertices` - Original face vertices + +Output Parameters: +- `faceVertices` - The face vertices properly oriented +- `posOriented` - `PETSC_TRUE` if the face was oriented with outward normal + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCone()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetOrientedFace")) +""" +function DMPlexGetOrientedFace(petsclib::PetscLibType, dm::PetscDM, cell::PetscInt, faceSize::PetscInt, face::Vector{PetscInt}, numCorners::PetscInt, indices::Vector{PetscInt}, origVertices::Vector{PetscInt}) end + +@for_petsc function DMPlexGetOrientedFace(petsclib::$UnionPetscLib, dm::PetscDM, cell::$PetscInt, faceSize::$PetscInt, face::Vector{$PetscInt}, numCorners::$PetscInt, indices::Vector{$PetscInt}, origVertices::Vector{$PetscInt} ) + faceVertices = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + posOriented_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexGetOrientedFace, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{PetscBool}), + dm, cell, faceSize, face, numCorners, indices, origVertices, faceVertices, posOriented_, + ) + + posOriented = posOriented_[] + + return faceVertices,posOriented +end + +""" + subdm::PetscDM = DMPlexCreateSubmesh(petsclib::PetscLibType,dm::PetscDM, vertexLabel::DMLabel, value::PetscInt, markedFaces::PetscBool) +Extract a hypersurface from the mesh using vertices defined by a label + +Input Parameters: +- `dm` - The original mesh +- `vertexLabel` - The `DMLabel` marking points contained in the surface +- `value` - The label value to use +- `markedFaces` - `PETSC_TRUE` if surface faces are marked in addition to vertices, `PETSC_FALSE` if only vertices are marked + +Output Parameter: +- `subdm` - The surface mesh + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetSubpointMap()`, `DMGetLabel()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateSubmesh")) +""" +function DMPlexCreateSubmesh(petsclib::PetscLibType, dm::PetscDM, vertexLabel::DMLabel, value::PetscInt, markedFaces::PetscBool) end + +@for_petsc function DMPlexCreateSubmesh(petsclib::$UnionPetscLib, dm::PetscDM, vertexLabel::DMLabel, value::$PetscInt, markedFaces::PetscBool ) + subdm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateSubmesh, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, $PetscInt, PetscBool, Ptr{CDM}), + dm, vertexLabel, value, markedFaces, subdm_, + ) + + subdm = PetscDM(subdm_[], petsclib) + + return subdm +end + +""" + subdm::PetscDM = DMPlexCreateCohesiveSubmesh(petsclib::PetscLibType,dm::PetscDM, hasLagrange::PetscBool, label::String, value::PetscInt) +Extract from a mesh with cohesive cells the hypersurface defined by one face of the cells. Optionally, a label can be given to restrict the cells. + +Input Parameters: +- `dm` - The original mesh +- `hasLagrange` - The mesh has Lagrange unknowns in the cohesive cells +- `label` - A label name, or `NULL` +- `value` - A label value + +Output Parameter: +- `subdm` - The surface mesh + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetSubpointMap()`, `DMPlexCreateSubmesh()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateCohesiveSubmesh")) +""" +function DMPlexCreateCohesiveSubmesh(petsclib::PetscLibType, dm::PetscDM, hasLagrange::PetscBool, label::String, value::PetscInt) end + +@for_petsc function DMPlexCreateCohesiveSubmesh(petsclib::$UnionPetscLib, dm::PetscDM, hasLagrange::PetscBool, label::String, value::$PetscInt ) + subdm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateCohesiveSubmesh, $petsc_library), + PetscErrorCode, + (CDM, PetscBool, Ptr{Cchar}, $PetscInt, Ptr{CDM}), + dm, hasLagrange, label, value, subdm_, + ) + + subdm = PetscDM(subdm_[], petsclib) + + return subdm +end + +""" + DMPlexReorderCohesiveSupports(petsclib::PetscLibType,dm::PetscDM) +Ensure that face supports for cohesive end caps are ordered + +Not Collective + +Input Parameter: +- `dm` - The `DM` containing cohesive cells + +Level: developer + +-seealso: `DMPlexConstructCohesiveCells()`, `DMPlexCreateCohesiveSubmesh()` + +# External Links +$(_doc_external("DMPlex/DMPlexReorderCohesiveSupports")) +""" +function DMPlexReorderCohesiveSupports(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexReorderCohesiveSupports(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMPlexReorderCohesiveSupports, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexFilter(petsclib::PetscLibType,dm::PetscDM, cellLabel::DMLabel, value::PetscInt, ignoreLabelHalo::PetscBool, sanitizeSubmesh::PetscBool, ownershipTransferSF::PetscSF, subdm::PetscDM) +Extract a subset of mesh cells defined by a label as a separate mesh + +Input Parameters: +- `dm` - The original mesh +- `cellLabel` - The `DMLabel` marking cells contained in the new mesh +- `value` - The label value to use +- `ignoreLabelHalo` - The flag indicating if labeled points that are in the halo are ignored +- `sanitizeSubmesh` - The flag indicating if a subpoint is forced to be owned by a rank that owns a subcell that contains that point in its closure + +Output Parameters: +- `ownershipTransferSF` - The `PetscSF` representing the ownership transfers between parent local meshes due to submeshing. +- `subdm` - The new mesh + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetSubpointMap()`, `DMGetLabel()`, `DMLabelSetValue()`, `DMPlexCreateSubmesh()` + +# External Links +$(_doc_external("DMPlex/DMPlexFilter")) +""" +function DMPlexFilter(petsclib::PetscLibType, dm::PetscDM, cellLabel::DMLabel, value::PetscInt, ignoreLabelHalo::PetscBool, sanitizeSubmesh::PetscBool, ownershipTransferSF::PetscSF, subdm::PetscDM) end + +@for_petsc function DMPlexFilter(petsclib::$UnionPetscLib, dm::PetscDM, cellLabel::DMLabel, value::$PetscInt, ignoreLabelHalo::PetscBool, sanitizeSubmesh::PetscBool, ownershipTransferSF::PetscSF, subdm::PetscDM ) + subdm_ = Ref(subdm.ptr) + + @chk ccall( + (:DMPlexFilter, $petsc_library), + PetscErrorCode, + (CDM, DMLabel, $PetscInt, PetscBool, PetscBool, Ptr{PetscSF}, Ptr{CDM}), + dm, cellLabel, value, ignoreLabelHalo, sanitizeSubmesh, ownershipTransferSF, subdm_, + ) + + subdm.ptr = subdm_[] + + return nothing +end + +""" + DMPlexGetSubpointMap(petsclib::PetscLibType,dm::PetscDM, subpointMap::DMLabel) +Returns a `DMLabel` with point dimension as values + +Input Parameter: +- `dm` - The submesh `DM` + +Output Parameter: +- `subpointMap` - The `DMLabel` of all the points from the original mesh in this submesh, or `NULL` if this is not a submesh + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateSubmesh()`, `DMPlexGetSubpointIS()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetSubpointMap")) +""" +function DMPlexGetSubpointMap(petsclib::PetscLibType, dm::PetscDM, subpointMap::DMLabel) end + +@for_petsc function DMPlexGetSubpointMap(petsclib::$UnionPetscLib, dm::PetscDM, subpointMap::DMLabel ) + + @chk ccall( + (:DMPlexGetSubpointMap, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMLabel}), + dm, subpointMap, + ) + + + return nothing +end + +""" + DMPlexSetSubpointMap(petsclib::PetscLibType,dm::PetscDM, subpointMap::DMLabel) +Sets the `DMLabel` with point dimension as values + +Input Parameters: +- `dm` - The submesh `DM` +- `subpointMap` - The `DMLabel` of all the points from the original mesh in this submesh + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateSubmesh()`, `DMPlexGetSubpointIS()` + +# External Links +$(_doc_external("DMPlex/DMPlexSetSubpointMap")) +""" +function DMPlexSetSubpointMap(petsclib::PetscLibType, dm::PetscDM, subpointMap::DMLabel) end + +@for_petsc function DMPlexSetSubpointMap(petsclib::$UnionPetscLib, dm::PetscDM, subpointMap::DMLabel ) + + @chk ccall( + (:DMPlexSetSubpointMap, $petsc_library), + PetscErrorCode, + (CDM, DMLabel), + dm, subpointMap, + ) + + + return nothing +end + +""" + DMPlexGetSubpointIS(petsclib::PetscLibType,dm::PetscDM, subpointIS::IS) +Returns an `IS` covering the entire subdm chart with the original points as data + +Input Parameter: +- `dm` - The submesh `DM` + +Output Parameter: +- `subpointIS` - The `IS` of all the points from the original mesh in this submesh, or `NULL` if this is not a submesh + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreateSubmesh()`, `DMPlexGetSubpointMap()` + +# External Links +$(_doc_external("DMPlex/DMPlexGetSubpointIS")) +""" +function DMPlexGetSubpointIS(petsclib::PetscLibType, dm::PetscDM, subpointIS::IS) end + +@for_petsc function DMPlexGetSubpointIS(petsclib::$UnionPetscLib, dm::PetscDM, subpointIS::IS ) + + @chk ccall( + (:DMPlexGetSubpointIS, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CIS}), + dm, subpointIS, + ) + + + return nothing +end + +""" + DMGetEnclosureRelation(petsclib::PetscLibType,dmA::PetscDM, dmB::PetscDM, rel::DMEnclosureType) +Get the relationship between `dmA` and `dmB` + +Input Parameters: +- `dmA` - The first `DM` +- `dmB` - The second `DM` + +Output Parameter: +- `rel` - The relation of `dmA` to `dmB` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetEnclosurePoint()` + +# External Links +$(_doc_external("DM/DMGetEnclosureRelation")) +""" +function DMGetEnclosureRelation(petsclib::PetscLibType, dmA::PetscDM, dmB::PetscDM, rel::DMEnclosureType) end + +@for_petsc function DMGetEnclosureRelation(petsclib::$UnionPetscLib, dmA::PetscDM, dmB::PetscDM, rel::DMEnclosureType ) + + @chk ccall( + (:DMGetEnclosureRelation, $petsc_library), + PetscErrorCode, + (CDM, CDM, Ptr{DMEnclosureType}), + dmA, dmB, rel, + ) + + + return nothing +end + +""" + pA::PetscInt = DMGetEnclosurePoint(petsclib::PetscLibType,dmA::PetscDM, dmB::PetscDM, etype::DMEnclosureType, pB::PetscInt) +Get the point `pA` in `dmA` which corresponds to the point `pB` in `dmB` + +Input Parameters: +- `dmA` - The first `DM` +- `dmB` - The second `DM` +- `etype` - The type of enclosure relation that `dmA` has to `dmB` +- `pB` - A point of `dmB` + +Output Parameter: +- `pA` - The corresponding point of `dmA` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMGetEnclosureRelation()` + +# External Links +$(_doc_external("DM/DMGetEnclosurePoint")) +""" +function DMGetEnclosurePoint(petsclib::PetscLibType, dmA::PetscDM, dmB::PetscDM, etype::DMEnclosureType, pB::PetscInt) end + +@for_petsc function DMGetEnclosurePoint(petsclib::$UnionPetscLib, dmA::PetscDM, dmB::PetscDM, etype::DMEnclosureType, pB::$PetscInt ) + pA_ = Ref{$PetscInt}() + + @chk ccall( + (:DMGetEnclosurePoint, $petsc_library), + PetscErrorCode, + (CDM, CDM, DMEnclosureType, $PetscInt, Ptr{$PetscInt}), + dmA, dmB, etype, pB, pA_, + ) + + pA = pA_[] + + return pA +end + +""" + dm::PetscDM = DMPlexCreateExodus(petsclib::PetscLibType,comm::MPI_Comm, exoid::PetscExodusIIInt, interpolate::PetscBool) +Create a `DMPLEX` mesh from an ExodusII file ID. + +Collective + +Input Parameters: +- `comm` - The MPI communicator +- `exoid` - The ExodusII id associated with a exodus file and obtained using ex_open +- `interpolate` - Create faces and edges in the mesh + +Output Parameter: +- `dm` - The `DM` object representing the mesh + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `PETSCVIEWEREXODUSII`, `DMPLEX`, `DMCreate()` + +# External Links +$(_doc_external("DMPlex/DMPlexCreateExodus")) +""" +function DMPlexCreateExodus(petsclib::PetscLibType, comm::MPI_Comm, exoid::PetscExodusIIInt, interpolate::PetscBool) end + +@for_petsc function DMPlexCreateExodus(petsclib::$UnionPetscLib, comm::MPI_Comm, exoid::PetscExodusIIInt, interpolate::PetscBool ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMPlexCreateExodus, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscExodusIIInt, PetscBool, Ptr{CDM}), + comm, exoid, interpolate, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + Nf::PetscInt,v0::Vector{PetscReal},J::Vector{PetscReal},invJ::Vector{PetscReal},detJ::Vector{PetscReal} = DMPlexRefineRegularGetAffineFaceTransforms(petsclib::PetscLibType,tr::DMPlexTransform, ct::DMPolytopeType) +Gets the affine map from the reference face cell to each face in the given cell + +Input Parameters: +- `tr` - The `DMPlexTransform` object +- `ct` - The cell type + +Output Parameters: +- `Nf` - The number of faces for this cell type +- `v0` - The translation of the first vertex for each face +- `J` - The Jacobian for each face (map from original cell to subcell) +- `invJ` - The inverse Jacobian for each face +- `detJ` - The determinant of the Jacobian for each face + +Level: developer + +-seealso: `DMPLEX`, `DM`, `DMPlexTransform`, `DMPolytopeType`, `DMPlexCellRefinerGetAffineTransforms()` + +# External Links +$(_doc_external("DMPlex/DMPlexRefineRegularGetAffineFaceTransforms")) +""" +function DMPlexRefineRegularGetAffineFaceTransforms(petsclib::PetscLibType, tr::DMPlexTransform, ct::DMPolytopeType) end + +@for_petsc function DMPlexRefineRegularGetAffineFaceTransforms(petsclib::$UnionPetscLib, tr::DMPlexTransform, ct::DMPolytopeType ) + Nf_ = Ref{$PetscInt}() + v0_ = Ref{Ptr{$PetscReal}}() + J_ = Ref{Ptr{$PetscReal}}() + invJ_ = Ref{Ptr{$PetscReal}}() + detJ_ = Ref{Ptr{$PetscReal}}() + + @chk ccall( + (:DMPlexRefineRegularGetAffineFaceTransforms, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, Ptr{$PetscInt}, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}), + tr, ct, Nf_, v0_, J_, invJ_, detJ_, + ) + + Nf = Nf_[] + v0 = unsafe_wrap(Array, v0_[], VecGetLocalSize(petsclib, x); own = false) + J = unsafe_wrap(Array, J_[], VecGetLocalSize(petsclib, x); own = false) + invJ = unsafe_wrap(Array, invJ_[], VecGetLocalSize(petsclib, x); own = false) + detJ = unsafe_wrap(Array, detJ_[], VecGetLocalSize(petsclib, x); own = false) + + return Nf,v0,J,invJ,detJ +end + +""" + Nc::PetscInt,v0::Vector{PetscReal},J::Vector{PetscReal},invJ::Vector{PetscReal} = DMPlexRefineRegularGetAffineTransforms(petsclib::PetscLibType,tr::DMPlexTransform, ct::DMPolytopeType) +Gets the affine map from the reference cell to each subcell + +Input Parameters: +- `tr` - The `DMPlexTransform` object +- `ct` - The cell type + +Output Parameters: +- `Nc` - The number of subcells produced from this cell type +- `v0` - The translation of the first vertex for each subcell, an array of length dim * Nc. Pass `NULL` to ignore. +- `J` - The Jacobian for each subcell (map from reference cell to subcell), an array of length dim^2 * Nc. Pass `NULL` to ignore. +- `invJ` - The inverse Jacobian for each subcell, an array of length dim^2 * Nc. Pass `NULL` to ignore. + +Level: developer + +-seealso: `DMPLEX`, `DM`, `DMPlexTransform`, `DMPolytopeType`, `DMPlexRefineRegularGetAffineFaceTransforms()`, `DMPLEXREFINEREGULAR` + +# External Links +$(_doc_external("DMPlex/DMPlexRefineRegularGetAffineTransforms")) +""" +function DMPlexRefineRegularGetAffineTransforms(petsclib::PetscLibType, tr::DMPlexTransform, ct::DMPolytopeType) end + +@for_petsc function DMPlexRefineRegularGetAffineTransforms(petsclib::$UnionPetscLib, tr::DMPlexTransform, ct::DMPolytopeType ) + Nc_ = Ref{$PetscInt}() + v0_ = Ref{Ptr{$PetscReal}}() + J_ = Ref{Ptr{$PetscReal}}() + invJ_ = Ref{Ptr{$PetscReal}}() + + @chk ccall( + (:DMPlexRefineRegularGetAffineTransforms, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, Ptr{$PetscInt}, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}), + tr, ct, Nc_, v0_, J_, invJ_, + ) + + Nc = Nc_[] + v0 = unsafe_wrap(Array, v0_[], VecGetLocalSize(petsclib, x); own = false) + J = unsafe_wrap(Array, J_[], VecGetLocalSize(petsclib, x); own = false) + invJ = unsafe_wrap(Array, invJ_[], VecGetLocalSize(petsclib, x); own = false) + + return Nc,v0,J,invJ +end + +""" + DMSlicedSetGhosts(petsclib::PetscLibType,dm::PetscDM, bs::PetscInt, nloc::PetscInt, Nghosts::PetscInt, ghosts::Vector{PetscInt}) +Sets the global indices of other processes elements that will +be ghosts on this process + +Not Collective + +Input Parameters: +- `dm` - the `DMSLICED` object +- `bs` - block size +- `nlocal` - number of local (owned, non-ghost) blocks +- `Nghosts` - number of ghost blocks on this process +- `ghosts` - global indices of each ghost block + +Level: advanced + +-seealso: `DM`, `DMSLICED`, `DMDestroy()`, `DMCreateGlobalVector()` + +# External Links +$(_doc_external("DM/DMSlicedSetGhosts")) +""" +function DMSlicedSetGhosts(petsclib::PetscLibType, dm::PetscDM, bs::PetscInt, nloc::PetscInt, Nghosts::PetscInt, ghosts::Vector{PetscInt}) end + +@for_petsc function DMSlicedSetGhosts(petsclib::$UnionPetscLib, dm::PetscDM, bs::$PetscInt, nloc::$PetscInt, Nghosts::$PetscInt, ghosts::Vector{$PetscInt} ) + + @chk ccall( + (:DMSlicedSetGhosts, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}), + dm, bs, nloc, Nghosts, ghosts, + ) + + + return nothing +end + +""" + DMSlicedSetPreallocation(petsclib::PetscLibType,dm::PetscDM, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +sets the matrix memory preallocation for matrices computed by `DMSLICED` + +Not Collective + +Input Parameters: +- `dm` - the `DM` object +- `d_nz` - number of block nonzeros per block row in diagonal portion of local +submatrix (same for all local rows) +- `d_nnz` - array containing the number of block nonzeros in the various block rows +of the in diagonal portion of the local (possibly different for each block +row) or `NULL`. +- `o_nz` - number of block nonzeros per block row in the off-diagonal portion of local +submatrix (same for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various block rows of the +off-diagonal portion of the local submatrix (possibly different for +each block row) or `NULL`. + +Level: advanced + +-seealso: `DM`, `DMSLICED`, `DMDestroy()`, `DMCreateGlobalVector()`, `MatMPIAIJSetPreallocation()`, +`MatMPIBAIJSetPreallocation()`, `DMSlicedGetMatrix()`, `DMSlicedSetBlockFills()` + +# External Links +$(_doc_external("DM/DMSlicedSetPreallocation")) +""" +function DMSlicedSetPreallocation(petsclib::PetscLibType, dm::PetscDM, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) end + +@for_petsc function DMSlicedSetPreallocation(petsclib::$UnionPetscLib, dm::PetscDM, d_nz::$PetscInt, d_nnz::Vector{$PetscInt}, o_nz::$PetscInt, o_nnz::Vector{$PetscInt} ) + + @chk ccall( + (:DMSlicedSetPreallocation, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}), + dm, d_nz, d_nnz, o_nz, o_nnz, + ) + + + return nothing +end + +""" + DMSlicedSetBlockFills(petsclib::PetscLibType,dm::PetscDM, dfill::Vector{PetscInt}, ofill::Vector{PetscInt}) +Sets the fill pattern in each block for a multi +of the matrix returned by `DMSlicedGetMatrix()`. + +Logically Collective + +Input Parameters: +- `dm` - the `DM` object +- `dfill` - the fill pattern in the diagonal block (may be `NULL`, means use dense block) +- `ofill` - the fill pattern in the off-diagonal blocks + +Level: advanced + +-seealso: `DM`, `DMSLICED`, `DMSlicedGetMatrix()`, `DMDASetBlockFills()` + +# External Links +$(_doc_external("DM/DMSlicedSetBlockFills")) +""" +function DMSlicedSetBlockFills(petsclib::PetscLibType, dm::PetscDM, dfill::Vector{PetscInt}, ofill::Vector{PetscInt}) end + +@for_petsc function DMSlicedSetBlockFills(petsclib::$UnionPetscLib, dm::PetscDM, dfill::Vector{$PetscInt}, ofill::Vector{$PetscInt} ) + + @chk ccall( + (:DMSlicedSetBlockFills, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + dm, dfill, ofill, + ) + + + return nothing +end + +""" + dm::PetscDM = DMSlicedCreate(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, nloc::PetscInt, Nghosts::PetscInt, ghosts::Vector{PetscInt}, d_nnz::Vector{PetscInt}, o_nnz::Vector{PetscInt}) +Creates a `DM` object, used to manage data for a unstructured problem + +Collective + +Input Parameters: +- `comm` - the processors that will share the global vector +- `bs` - the block size +- `nlocal` - number of vector entries on this process +- `Nghosts` - number of ghost points needed on this process +- `ghosts` - global indices of all ghost points for this process +- `d_nnz` - matrix preallocation information representing coupling within this process +- `o_nnz` - matrix preallocation information representing coupling between this process and other processes + +Output Parameter: +- `dm` - the slice object + +Level: advanced + +-seealso: `DM`, `DMSLICED`, `DMDestroy()`, `DMCreateGlobalVector()`, `DMSetType()`, `DMSlicedSetGhosts()`, `DMSlicedSetPreallocation()`, +`VecGhostUpdateBegin()`, `VecGhostUpdateEnd()`, +`VecGhostGetLocalForm()`, `VecGhostRestoreLocalForm()` + +# External Links +$(_doc_external("DM/DMSlicedCreate")) +""" +function DMSlicedCreate(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, nloc::PetscInt, Nghosts::PetscInt, ghosts::Vector{PetscInt}, d_nnz::Vector{PetscInt}, o_nnz::Vector{PetscInt}) end + +@for_petsc function DMSlicedCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, nloc::$PetscInt, Nghosts::$PetscInt, ghosts::Vector{$PetscInt}, d_nnz::Vector{$PetscInt}, o_nnz::Vector{$PetscInt} ) + dm_ = Ref{CDM}() + + @chk ccall( + (:DMSlicedCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{CDM}), + comm, bs, nloc, Nghosts, ghosts, d_nnz, o_nnz, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + x::PetscScalar,y::PetscScalar = DMDAMapCoordsToPeriodicDomain(petsclib::PetscLibType,da::PetscDM) + +# External Links +$(_doc_external("Ts/DMDAMapCoordsToPeriodicDomain")) +""" +function DMDAMapCoordsToPeriodicDomain(petsclib::PetscLibType, da::PetscDM) end + +@for_petsc function DMDAMapCoordsToPeriodicDomain(petsclib::$UnionPetscLib, da::PetscDM ) + x_ = Ref{$PetscScalar}() + y_ = Ref{$PetscScalar}() + + @chk ccall( + (:DMDAMapCoordsToPeriodicDomain, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + da, x_, y_, + ) + + x = x_[] + y = y_[] + + return x,y +end + +""" + DMTSSetIFunction(petsclib::PetscLibType,dm::PetscDM, func::TSIFunctionFn, ctx::Cvoid) +set `TS` implicit function evaluation function into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `func` - function evaluating f(t,u,u_t) +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TS`, `DM`, `TSIFunctionFn` + +# External Links +$(_doc_external("Ts/DMTSSetIFunction")) +""" +function DMTSSetIFunction(petsclib::PetscLibType, dm::PetscDM, func::TSIFunctionFn, ctx::Cvoid) end + +@for_petsc function DMTSSetIFunction(petsclib::$UnionPetscLib, dm::PetscDM, func::TSIFunctionFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetIFunction, $petsc_library), + PetscErrorCode, + (CDM, Ptr{TSIFunctionFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetIFunctionContextDestroy(petsclib::PetscLibType,dm::PetscDM, f::PetscCtxDestroyFn) +set `TS` implicit evaluation context destroy function into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `f` - implicit evaluation context destroy function, see `PetscCtxDestroyFn` for its calling sequence + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `DMTSSetIFunction()`, `TSSetIFunction()`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("Ts/DMTSSetIFunctionContextDestroy")) +""" +function DMTSSetIFunctionContextDestroy(petsclib::PetscLibType, dm::PetscDM, f::PetscCtxDestroyFn) end + +@for_petsc function DMTSSetIFunctionContextDestroy(petsclib::$UnionPetscLib, dm::PetscDM, f::PetscCtxDestroyFn ) + + @chk ccall( + (:DMTSSetIFunctionContextDestroy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscCtxDestroyFn}), + dm, f, + ) + + + return nothing +end + +""" + DMTSGetIFunction(petsclib::PetscLibType,dm::PetscDM, func::TSIFunctionFn, ctx::Cvoid) +get `TS` implicit residual evaluation function from a `DMTS` + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `TS` + +Output Parameters: +- `func` - function evaluation function, for calling sequence see `TSIFunctionFn` +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TS`, `DM`, `DMTSSetIFunction()`, `TSIFunctionFn` + +# External Links +$(_doc_external("Ts/DMTSGetIFunction")) +""" +function DMTSGetIFunction(petsclib::PetscLibType, dm::PetscDM, func::TSIFunctionFn, ctx::Cvoid) end + +@for_petsc function DMTSGetIFunction(petsclib::$UnionPetscLib, dm::PetscDM, func::TSIFunctionFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSGetIFunction, $petsc_library), + PetscErrorCode, + (CDM, TSIFunctionFn, Cvoid), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetI2Function(petsclib::PetscLibType,dm::PetscDM, fun::TSI2FunctionFn, ctx::Cvoid) +set `TS` implicit function evaluation function for 2nd order systems into a `TSDM` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `fun` - function evaluation routine +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `TSSetI2Function()` + +# External Links +$(_doc_external("Ts/DMTSSetI2Function")) +""" +function DMTSSetI2Function(petsclib::PetscLibType, dm::PetscDM, fun::TSI2FunctionFn, ctx::Cvoid) end + +@for_petsc function DMTSSetI2Function(petsclib::$UnionPetscLib, dm::PetscDM, fun::TSI2FunctionFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetI2Function, $petsc_library), + PetscErrorCode, + (CDM, Ptr{TSI2FunctionFn}, Ptr{Cvoid}), + dm, fun, ctx, + ) + + + return nothing +end + +""" + DMTSSetI2FunctionContextDestroy(petsclib::PetscLibType,dm::PetscDM, f::PetscCtxDestroyFn) +set `TS` implicit evaluation for 2nd order systems context destroy into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `f` - implicit evaluation context destroy function, see `PetscCtxDestroyFn` for its calling sequence + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TSSetI2FunctionContextDestroy()`, `DMTSSetI2Function()`, `TSSetI2Function()` + +# External Links +$(_doc_external("Ts/DMTSSetI2FunctionContextDestroy")) +""" +function DMTSSetI2FunctionContextDestroy(petsclib::PetscLibType, dm::PetscDM, f::PetscCtxDestroyFn) end + +@for_petsc function DMTSSetI2FunctionContextDestroy(petsclib::$UnionPetscLib, dm::PetscDM, f::PetscCtxDestroyFn ) + + @chk ccall( + (:DMTSSetI2FunctionContextDestroy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscCtxDestroyFn}), + dm, f, + ) + + + return nothing +end + +""" + DMTSGetI2Function(petsclib::PetscLibType,dm::PetscDM, fun::TSI2FunctionFn, ctx::Cvoid) +get `TS` implicit residual evaluation function for 2nd order systems from a `DMTS` + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `TS` + +Output Parameters: +- `fun` - function evaluation function, for calling sequence see `TSSetI2Function()` +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `DMTSSetI2Function()`, `TSGetI2Function()` + +# External Links +$(_doc_external("Ts/DMTSGetI2Function")) +""" +function DMTSGetI2Function(petsclib::PetscLibType, dm::PetscDM, fun::TSI2FunctionFn, ctx::Cvoid) end + +@for_petsc function DMTSGetI2Function(petsclib::$UnionPetscLib, dm::PetscDM, fun::TSI2FunctionFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSGetI2Function, $petsc_library), + PetscErrorCode, + (CDM, TSI2FunctionFn, Cvoid), + dm, fun, ctx, + ) + + + return nothing +end + +""" + DMTSSetI2Jacobian(petsclib::PetscLibType,dm::PetscDM, jac::TSI2JacobianFn, ctx::Cvoid) +set `TS` implicit Jacobian evaluation function for 2nd order systems from a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `jac` - Jacobian evaluation routine +- `ctx` - context for Jacobian evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `TSI2JacobianFn`, `TSSetI2Jacobian()` + +# External Links +$(_doc_external("Ts/DMTSSetI2Jacobian")) +""" +function DMTSSetI2Jacobian(petsclib::PetscLibType, dm::PetscDM, jac::TSI2JacobianFn, ctx::Cvoid) end + +@for_petsc function DMTSSetI2Jacobian(petsclib::$UnionPetscLib, dm::PetscDM, jac::TSI2JacobianFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetI2Jacobian, $petsc_library), + PetscErrorCode, + (CDM, Ptr{TSI2JacobianFn}, Ptr{Cvoid}), + dm, jac, ctx, + ) + + + return nothing +end + +""" + DMTSSetI2JacobianContextDestroy(petsclib::PetscLibType,dm::PetscDM, f::PetscCtxDestroyFn) +set `TS` implicit Jacobian evaluation for 2nd order systems context destroy function into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `f` - implicit Jacobian evaluation context destroy function, see `PetscCtxDestroyFn` for its calling sequence + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `TSSetI2JacobianContextDestroy()`, `DMTSSetI2Jacobian()`, `TSSetI2Jacobian()` + +# External Links +$(_doc_external("Ts/DMTSSetI2JacobianContextDestroy")) +""" +function DMTSSetI2JacobianContextDestroy(petsclib::PetscLibType, dm::PetscDM, f::PetscCtxDestroyFn) end + +@for_petsc function DMTSSetI2JacobianContextDestroy(petsclib::$UnionPetscLib, dm::PetscDM, f::PetscCtxDestroyFn ) + + @chk ccall( + (:DMTSSetI2JacobianContextDestroy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscCtxDestroyFn}), + dm, f, + ) + + + return nothing +end + +""" + DMTSGetI2Jacobian(petsclib::PetscLibType,dm::PetscDM, jac::TSI2JacobianFn, ctx::Cvoid) +get `TS` implicit Jacobian evaluation function for 2nd order systems from a `DMTS` + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `TS` + +Output Parameters: +- `jac` - Jacobian evaluation function, for calling sequence see `TSI2JacobianFn` +- `ctx` - context for Jacobian evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `DMTSSetI2Jacobian()`, `TSGetI2Jacobian()`, `TSI2JacobianFn` + +# External Links +$(_doc_external("Ts/DMTSGetI2Jacobian")) +""" +function DMTSGetI2Jacobian(petsclib::PetscLibType, dm::PetscDM, jac::TSI2JacobianFn, ctx::Cvoid) end + +@for_petsc function DMTSGetI2Jacobian(petsclib::$UnionPetscLib, dm::PetscDM, jac::TSI2JacobianFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSGetI2Jacobian, $petsc_library), + PetscErrorCode, + (CDM, TSI2JacobianFn, Cvoid), + dm, jac, ctx, + ) + + + return nothing +end + +""" + DMTSSetRHSFunction(petsclib::PetscLibType,dm::PetscDM, func::TSRHSFunctionFn, ctx::Cvoid) +set `TS` explicit residual evaluation function into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `func` - RHS function evaluation routine, see `TSRHSFunctionFn` for the calling sequence +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `TSRHSFunctionFn` + +# External Links +$(_doc_external("Ts/DMTSSetRHSFunction")) +""" +function DMTSSetRHSFunction(petsclib::PetscLibType, dm::PetscDM, func::TSRHSFunctionFn, ctx::Cvoid) end + +@for_petsc function DMTSSetRHSFunction(petsclib::$UnionPetscLib, dm::PetscDM, func::TSRHSFunctionFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetRHSFunction, $petsc_library), + PetscErrorCode, + (CDM, Ptr{TSRHSFunctionFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetRHSFunctionContextDestroy(petsclib::PetscLibType,dm::PetscDM, f::PetscCtxDestroyFn) +set `TS` explicit residual evaluation context destroy function into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `f` - explicit evaluation context destroy function, see `PetscCtxDestroyFn` for its calling sequence + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TSSetRHSFunctionContextDestroy()`, `DMTSSetRHSFunction()`, `TSSetRHSFunction()` + +# External Links +$(_doc_external("Ts/DMTSSetRHSFunctionContextDestroy")) +""" +function DMTSSetRHSFunctionContextDestroy(petsclib::PetscLibType, dm::PetscDM, f::PetscCtxDestroyFn) end + +@for_petsc function DMTSSetRHSFunctionContextDestroy(petsclib::$UnionPetscLib, dm::PetscDM, f::PetscCtxDestroyFn ) + + @chk ccall( + (:DMTSSetRHSFunctionContextDestroy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscCtxDestroyFn}), + dm, f, + ) + + + return nothing +end + +""" + DMTSSetTransientVariable(petsclib::PetscLibType,dm::PetscDM, tvar::TSTransientVariableFn, ctx::Cvoid) +sets function to transform from state to transient variables into a `DMTS` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `tvar` - a function that transforms to transient variables, see `TSTransientVariableFn` for the calling sequence +- `ctx` - a context for tvar + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TS`, `TSBDF`, `TSSetTransientVariable()`, `DMTSGetTransientVariable()`, `DMTSSetIFunction()`, `DMTSSetIJacobian()`, `TSTransientVariableFn` + +# External Links +$(_doc_external("Ts/DMTSSetTransientVariable")) +""" +function DMTSSetTransientVariable(petsclib::PetscLibType, dm::PetscDM, tvar::TSTransientVariableFn, ctx::Cvoid) end + +@for_petsc function DMTSSetTransientVariable(petsclib::$UnionPetscLib, dm::PetscDM, tvar::TSTransientVariableFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetTransientVariable, $petsc_library), + PetscErrorCode, + (CDM, Ptr{TSTransientVariableFn}, Ptr{Cvoid}), + dm, tvar, ctx, + ) + + + return nothing +end + +""" + DMTSGetTransientVariable(petsclib::PetscLibType,dm::PetscDM, tvar::TSTransientVariableFn, ctx::Cvoid) +gets function to transform from state to transient variables set with `DMTSSetTransientVariable()` from a `TSDM` + +Logically Collective + +Input Parameter: +- `dm` - `DM` to be used with `TS` + +Output Parameters: +- `tvar` - a function that transforms to transient variables, see `TSTransientVariableFn` for the calling sequence +- `ctx` - a context for tvar + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `DMTSSetTransientVariable()`, `DMTSGetIFunction()`, `DMTSGetIJacobian()`, `TSTransientVariableFn` + +# External Links +$(_doc_external("Ts/DMTSGetTransientVariable")) +""" +function DMTSGetTransientVariable(petsclib::PetscLibType, dm::PetscDM, tvar::TSTransientVariableFn, ctx::Cvoid) end + +@for_petsc function DMTSGetTransientVariable(petsclib::$UnionPetscLib, dm::PetscDM, tvar::TSTransientVariableFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSGetTransientVariable, $petsc_library), + PetscErrorCode, + (CDM, TSTransientVariableFn, Ptr{Cvoid}), + dm, tvar, ctx, + ) + + + return nothing +end + +""" + DMTSGetSolutionFunction(petsclib::PetscLibType,dm::PetscDM, func::TSSolutionFn, ctx::Cvoid) +gets the `TS` solution evaluation function from a `DMTS` + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `TS` + +Output Parameters: +- `func` - solution function evaluation function, for calling sequence see `TSSolutionFn` +- `ctx` - context for solution evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TS`, `DM`, `DMTSSetSolutionFunction()`, `TSSolutionFn` + +# External Links +$(_doc_external("Ts/DMTSGetSolutionFunction")) +""" +function DMTSGetSolutionFunction(petsclib::PetscLibType, dm::PetscDM, func::TSSolutionFn, ctx::Cvoid) end + +@for_petsc function DMTSGetSolutionFunction(petsclib::$UnionPetscLib, dm::PetscDM, func::TSSolutionFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSGetSolutionFunction, $petsc_library), + PetscErrorCode, + (CDM, TSSolutionFn, Cvoid), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetSolutionFunction(petsclib::PetscLibType,dm::PetscDM, func::TSSolutionFn, ctx::Cvoid) +set `TS` solution evaluation function into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `func` - solution function evaluation routine, for calling sequence see `TSSolutionFn` +- `ctx` - context for solution evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `DMTSGetSolutionFunction()`, `TSSolutionFn` + +# External Links +$(_doc_external("Ts/DMTSSetSolutionFunction")) +""" +function DMTSSetSolutionFunction(petsclib::PetscLibType, dm::PetscDM, func::TSSolutionFn, ctx::Cvoid) end + +@for_petsc function DMTSSetSolutionFunction(petsclib::$UnionPetscLib, dm::PetscDM, func::TSSolutionFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetSolutionFunction, $petsc_library), + PetscErrorCode, + (CDM, Ptr{TSSolutionFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetForcingFunction(petsclib::PetscLibType,dm::PetscDM, func::TSForcingFn, ctx::Cvoid) +set `TS` forcing function evaluation function into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `func` - forcing function evaluation routine, for calling sequence see `TSForcingFn` +- `ctx` - context for solution evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `TSForcingFn`, `TSSetForcingFunction()`, `DMTSGetForcingFunction()` + +# External Links +$(_doc_external("Ts/DMTSSetForcingFunction")) +""" +function DMTSSetForcingFunction(petsclib::PetscLibType, dm::PetscDM, func::TSForcingFn, ctx::Cvoid) end + +@for_petsc function DMTSSetForcingFunction(petsclib::$UnionPetscLib, dm::PetscDM, func::TSForcingFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetForcingFunction, $petsc_library), + PetscErrorCode, + (CDM, Ptr{TSForcingFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSGetForcingFunction(petsclib::PetscLibType,dm::PetscDM, f::TSForcingFn, ctx::Cvoid) +get `TS` forcing function evaluation function from a `DMTS` + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `TS` + +Output Parameters: +- `f` - forcing function evaluation function; see `TSForcingFn` for the calling sequence +- `ctx` - context for solution evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TS`, `DM`, `TSSetForcingFunction()`, `TSForcingFn` + +# External Links +$(_doc_external("Ts/DMTSGetForcingFunction")) +""" +function DMTSGetForcingFunction(petsclib::PetscLibType, dm::PetscDM, f::TSForcingFn, ctx::Cvoid) end + +@for_petsc function DMTSGetForcingFunction(petsclib::$UnionPetscLib, dm::PetscDM, f::TSForcingFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSGetForcingFunction, $petsc_library), + PetscErrorCode, + (CDM, TSForcingFn, Cvoid), + dm, f, ctx, + ) + + + return nothing +end + +""" + DMTSGetRHSFunction(petsclib::PetscLibType,dm::PetscDM, func::TSRHSFunctionFn, ctx::Cvoid) +get `TS` explicit residual evaluation function from a `DMTS` + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `TS` + +Output Parameters: +- `func` - residual evaluation function, for calling sequence see `TSRHSFunctionFn` +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `TSRHSFunctionFn`, `TSGetRHSFunction()` + +# External Links +$(_doc_external("Ts/DMTSGetRHSFunction")) +""" +function DMTSGetRHSFunction(petsclib::PetscLibType, dm::PetscDM, func::TSRHSFunctionFn, ctx::Cvoid) end + +@for_petsc function DMTSGetRHSFunction(petsclib::$UnionPetscLib, dm::PetscDM, func::TSRHSFunctionFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSGetRHSFunction, $petsc_library), + PetscErrorCode, + (CDM, TSRHSFunctionFn, Cvoid), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetIJacobian(petsclib::PetscLibType,dm::PetscDM, func::TSIJacobianFn, ctx::Cvoid) +set `TS` Jacobian evaluation function into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `func` - Jacobian evaluation routine, see `TSIJacobianFn` for the calling sequence +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TS`, `DM`, `TSIJacobianFn`, `DMTSGetIJacobian()`, `TSSetIJacobian()` + +# External Links +$(_doc_external("Ts/DMTSSetIJacobian")) +""" +function DMTSSetIJacobian(petsclib::PetscLibType, dm::PetscDM, func::TSIJacobianFn, ctx::Cvoid) end + +@for_petsc function DMTSSetIJacobian(petsclib::$UnionPetscLib, dm::PetscDM, func::TSIJacobianFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetIJacobian, $petsc_library), + PetscErrorCode, + (CDM, Ptr{TSIJacobianFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetIJacobianContextDestroy(petsclib::PetscLibType,dm::PetscDM, f::PetscCtxDestroyFn) +set `TS` Jacobian evaluation context destroy function into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `f` - Jacobian evaluation context destroy function, see `PetscCtxDestroyFn` for its calling sequence + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TSSetIJacobianContextDestroy()`, `TSSetI2JacobianContextDestroy()`, `DMTSSetIJacobian()`, `TSSetIJacobian()` + +# External Links +$(_doc_external("Ts/DMTSSetIJacobianContextDestroy")) +""" +function DMTSSetIJacobianContextDestroy(petsclib::PetscLibType, dm::PetscDM, f::PetscCtxDestroyFn) end + +@for_petsc function DMTSSetIJacobianContextDestroy(petsclib::$UnionPetscLib, dm::PetscDM, f::PetscCtxDestroyFn ) + + @chk ccall( + (:DMTSSetIJacobianContextDestroy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscCtxDestroyFn}), + dm, f, + ) + + + return nothing +end + +""" + DMTSGetIJacobian(petsclib::PetscLibType,dm::PetscDM, func::TSIJacobianFn, ctx::Cvoid) +get `TS` Jacobian evaluation function from a `DMTS` + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `TS` + +Output Parameters: +- `func` - Jacobian evaluation function, for calling sequence see `TSIJacobianFn` +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `DMTSSetIJacobian()`, `TSIJacobianFn` + +# External Links +$(_doc_external("Ts/DMTSGetIJacobian")) +""" +function DMTSGetIJacobian(petsclib::PetscLibType, dm::PetscDM, func::TSIJacobianFn, ctx::Cvoid) end + +@for_petsc function DMTSGetIJacobian(petsclib::$UnionPetscLib, dm::PetscDM, func::TSIJacobianFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSGetIJacobian, $petsc_library), + PetscErrorCode, + (CDM, TSIJacobianFn, Cvoid), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetRHSJacobian(petsclib::PetscLibType,dm::PetscDM, func::TSRHSJacobianFn, ctx::Cvoid) +set `TS` Jacobian evaluation function into a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `func` - Jacobian evaluation routine, for calling sequence see `TSIJacobianFn` +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TSRHSJacobianFn`, `DMTSGetRHSJacobian()`, `TSSetRHSJacobian()` + +# External Links +$(_doc_external("Ts/DMTSSetRHSJacobian")) +""" +function DMTSSetRHSJacobian(petsclib::PetscLibType, dm::PetscDM, func::TSRHSJacobianFn, ctx::Cvoid) end + +@for_petsc function DMTSSetRHSJacobian(petsclib::$UnionPetscLib, dm::PetscDM, func::TSRHSJacobianFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetRHSJacobian, $petsc_library), + PetscErrorCode, + (CDM, Ptr{TSRHSJacobianFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetRHSJacobianContextDestroy(petsclib::PetscLibType,dm::PetscDM, f::PetscCtxDestroyFn) +set `TS` Jacobian evaluation context destroy function from a `DMTS` + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `f` - Jacobian evaluation context destroy function, see `PetscCtxDestroyFn` for its calling sequence + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `TS`, `TSSetRHSJacobianContextDestroy()`, `DMTSSetRHSJacobian()`, `TSSetRHSJacobian()` + +# External Links +$(_doc_external("Ts/DMTSSetRHSJacobianContextDestroy")) +""" +function DMTSSetRHSJacobianContextDestroy(petsclib::PetscLibType, dm::PetscDM, f::PetscCtxDestroyFn) end + +@for_petsc function DMTSSetRHSJacobianContextDestroy(petsclib::$UnionPetscLib, dm::PetscDM, f::PetscCtxDestroyFn ) + + @chk ccall( + (:DMTSSetRHSJacobianContextDestroy, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscCtxDestroyFn}), + dm, f, + ) + + + return nothing +end + +""" + DMTSGetRHSJacobian(petsclib::PetscLibType,dm::PetscDM, func::TSRHSJacobianFn, ctx::Cvoid) +get `TS` Jacobian evaluation function from a `DMTS` + +Not Collective + +Input Parameter: +- `dm` - `DM` to be used with `TS` + +Output Parameters: +- `func` - Jacobian evaluation function, for calling sequence see `TSRHSJacobianFn` +- `ctx` - context for residual evaluation + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS`, `DMTSSetRHSJacobian()`, `TSRHSJacobianFn` + +# External Links +$(_doc_external("Ts/DMTSGetRHSJacobian")) +""" +function DMTSGetRHSJacobian(petsclib::PetscLibType, dm::PetscDM, func::TSRHSJacobianFn, ctx::Cvoid) end + +@for_petsc function DMTSGetRHSJacobian(petsclib::$UnionPetscLib, dm::PetscDM, func::TSRHSJacobianFn, ctx::Cvoid ) + + @chk ccall( + (:DMTSGetRHSJacobian, $petsc_library), + PetscErrorCode, + (CDM, TSRHSJacobianFn, Cvoid), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetIFunctionSerialize(petsclib::PetscLibType,dm::PetscDM, view::external, load::external) +sets functions used to view and load a `TSIFunctionFn` context + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `view` - viewer function +- `load` - loading function + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS` + +# External Links +$(_doc_external("Ts/DMTSSetIFunctionSerialize")) +""" +function DMTSSetIFunctionSerialize(petsclib::PetscLibType, dm::PetscDM, view::external, load::external) end + +@for_petsc function DMTSSetIFunctionSerialize(petsclib::$UnionPetscLib, dm::PetscDM, view::external, load::external ) + + @chk ccall( + (:DMTSSetIFunctionSerialize, $petsc_library), + PetscErrorCode, + (CDM, external, external), + dm, view, load, + ) + + + return nothing +end + +""" + DMTSSetIJacobianSerialize(petsclib::PetscLibType,dm::PetscDM, view::external, load::external) +sets functions used to view and load a `TSIJacobianFn` context + +Not Collective + +Input Parameters: +- `dm` - `DM` to be used with `TS` +- `view` - viewer function +- `load` - loading function + +Level: developer + +-seealso: [](ch_ts), `DMTS`, `DM`, `TS` + +# External Links +$(_doc_external("Ts/DMTSSetIJacobianSerialize")) +""" +function DMTSSetIJacobianSerialize(petsclib::PetscLibType, dm::PetscDM, view::external, load::external) end + +@for_petsc function DMTSSetIJacobianSerialize(petsclib::$UnionPetscLib, dm::PetscDM, view::external, load::external ) + + @chk ccall( + (:DMTSSetIJacobianSerialize, $petsc_library), + PetscErrorCode, + (CDM, external, external), + dm, view, load, + ) + + + return nothing +end + +""" + DMTSSetBoundaryLocal(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set the function for essential boundary data for a local implicit function evaluation. + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local function evaluation +- `ctx` - context for function evaluation + +Level: intermediate + +-seealso: [](ch_ts), `DM`, `TS`, `DMTSSetIFunction()`, `DMTSSetIJacobianLocal()` + +# External Links +$(_doc_external("Ts/DMTSSetBoundaryLocal")) +""" +function DMTSSetBoundaryLocal(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMTSSetBoundaryLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetBoundaryLocal, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetIFunctionLocal(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a local implicit function evaluation function. This function is called with local vector +containing the local vector information PLUS ghost point information. It should compute a result for all local +elements and `DM` will automatically accumulate the overlapping values. + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local function evaluation +- `ctx` - context for function evaluation + +Level: beginner + +-seealso: [](ch_ts), `DM`, `DMTSGetIFunctionLocal()`, `DMTSSetIFunction()`, `DMTSSetIJacobianLocal()` + +# External Links +$(_doc_external("Ts/DMTSSetIFunctionLocal")) +""" +function DMTSSetIFunctionLocal(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMTSSetIFunctionLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetIFunctionLocal, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetIJacobianLocal(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a local Jacobian evaluation function + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local Jacobian evaluation +- `ctx` - optional context for local Jacobian evaluation + +Level: beginner + +-seealso: [](ch_ts), `DM`, `DMTSGetIJacobianLocal()`, `DMTSSetIFunctionLocal()`, `DMTSSetIJacobian()`, `DMTSSetIFunction()` + +# External Links +$(_doc_external("Ts/DMTSSetIJacobianLocal")) +""" +function DMTSSetIJacobianLocal(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMTSSetIJacobianLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetIJacobianLocal, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSSetRHSFunctionLocal(petsclib::PetscLibType,dm::PetscDM, func::external, ctx::Cvoid) +set a local rhs function evaluation function. This function is called with local vector +containing the local vector information PLUS ghost point information. It should compute a result for all local +elements and `DM` will automatically accumulate the overlapping values. + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local function evaluation +- `ctx` - context for function evaluation + +Level: beginner + +-seealso: [](ch_ts), `DM`, `DMTSGetRHSFunctionLocal()`, `DMTSSetRHSFunction()`, `DMTSSetIFunction()`, `DMTSSetIJacobianLocal()` + +# External Links +$(_doc_external("Ts/DMTSSetRHSFunctionLocal")) +""" +function DMTSSetRHSFunctionLocal(petsclib::PetscLibType, dm::PetscDM, func::external, ctx::Cvoid) end + +@for_petsc function DMTSSetRHSFunctionLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::external, ctx::Cvoid ) + + @chk ccall( + (:DMTSSetRHSFunctionLocal, $petsc_library), + PetscErrorCode, + (CDM, external, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMTSCreateRHSMassMatrix(petsclib::PetscLibType,dm::PetscDM) +This creates the mass matrix associated with the given `DM`, and a solver to invert it, and stores them in the `DM` context. + +Collective + +Input Parameter: +- `dm` - `DM` providing the mass matrix + +Level: developer + +-seealso: [](ch_ts), `DM`, `DMTSCreateRHSMassMatrixLumped()`, `DMTSDestroyRHSMassMatrix()`, `DMCreateMassMatrix()`, `DMTS` + +# External Links +$(_doc_external("Ts/DMTSCreateRHSMassMatrix")) +""" +function DMTSCreateRHSMassMatrix(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMTSCreateRHSMassMatrix(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMTSCreateRHSMassMatrix, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMTSCreateRHSMassMatrixLumped(petsclib::PetscLibType,dm::PetscDM) +This creates the lumped mass matrix associated with the given `DM`, and a solver to invert it, and stores them in the `DM` context. + +Collective + +Input Parameter: +- `dm` - `DM` providing the mass matrix + +Level: developer + +-seealso: [](ch_ts), `DM`, `DMTSCreateRHSMassMatrix()`, `DMTSDestroyRHSMassMatrix()`, `DMCreateMassMatrix()`, `DMTS` + +# External Links +$(_doc_external("Ts/DMTSCreateRHSMassMatrixLumped")) +""" +function DMTSCreateRHSMassMatrixLumped(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMTSCreateRHSMassMatrixLumped(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMTSCreateRHSMassMatrixLumped, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMTSDestroyRHSMassMatrix(petsclib::PetscLibType,dm::PetscDM) +Destroys the mass matrix and solver stored in the `DM` context, if they exist. + +Logically Collective + +Input Parameter: +- `dm` - `DM` providing the mass matrix + +Level: developer + +-seealso: [](ch_ts), `DM`, `DMTSCreateRHSMassMatrixLumped()`, `DMCreateMassMatrix()`, `DMTS` + +# External Links +$(_doc_external("Ts/DMTSDestroyRHSMassMatrix")) +""" +function DMTSDestroyRHSMassMatrix(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMTSDestroyRHSMassMatrix(petsclib::$UnionPetscLib, dm::PetscDM ) + + @chk ccall( + (:DMTSDestroyRHSMassMatrix, $petsc_library), + PetscErrorCode, + (CDM,), + dm, + ) + + + return nothing +end + +""" + DMPlexTSComputeRHSFunctionFVM(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, locX::PetscVec, F::PetscVec, user::Cvoid) +Form the forcing `F` from the local input `locX` using pointwise functions specified by the user + +Input Parameters: +- `dm` - The mesh +- `time` - The time +- `locX` - Local solution +- `user` - The user context + +Output Parameter: +- `F` - Global output vector + +Level: developer + +-seealso: [](ch_ts), `DMPLEX`, `TS`, `DMPlexComputeJacobianActionFEM()` + +# External Links +$(_doc_external("Ts/DMPlexTSComputeRHSFunctionFVM")) +""" +function DMPlexTSComputeRHSFunctionFVM(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, locX::PetscVec, F::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexTSComputeRHSFunctionFVM(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, locX::PetscVec, F::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexTSComputeRHSFunctionFVM, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, CVec, Ptr{Cvoid}), + dm, time, locX, F, user, + ) + + + return nothing +end + +""" + DMPlexTSComputeBoundary(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, locX::PetscVec, locX_t::PetscVec, user::Cvoid) +Insert the essential boundary values into the local input `locX` and/or its time derivative `locX_t` using pointwise functions specified by the user + +Input Parameters: +- `dm` - The mesh +- `time` - The time +- `locX` - Local solution +- `locX_t` - Local solution time derivative, or `NULL` +- `user` - The user context + +Level: developer + +-seealso: [](ch_ts), `DMPLEX`, `TS`, `DMPlexComputeJacobianActionFEM()` + +# External Links +$(_doc_external("Ts/DMPlexTSComputeBoundary")) +""" +function DMPlexTSComputeBoundary(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, locX::PetscVec, locX_t::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexTSComputeBoundary(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, locX::PetscVec, locX_t::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexTSComputeBoundary, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, CVec, Ptr{Cvoid}), + dm, time, locX, locX_t, user, + ) + + + return nothing +end + +""" + DMPlexTSComputeIFunctionFEM(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, locX::PetscVec, locX_t::PetscVec, locF::PetscVec, user::Cvoid) +Form the local residual `locF` from the local input `locX` using pointwise functions specified by the user + +Input Parameters: +- `dm` - The mesh +- `time` - The time +- `locX` - Local solution +- `locX_t` - Local solution time derivative, or `NULL` +- `user` - The user context + +Output Parameter: +- `locF` - Local output vector + +Level: developer + +-seealso: [](ch_ts), `DMPLEX`, `TS`, `DMPlexTSComputeRHSFunctionFEM()` + +# External Links +$(_doc_external("Ts/DMPlexTSComputeIFunctionFEM")) +""" +function DMPlexTSComputeIFunctionFEM(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, locX::PetscVec, locX_t::PetscVec, locF::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexTSComputeIFunctionFEM(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, locX::PetscVec, locX_t::PetscVec, locF::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexTSComputeIFunctionFEM, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, CVec, CVec, Ptr{Cvoid}), + dm, time, locX, locX_t, locF, user, + ) + + + return nothing +end + +""" + DMPlexTSComputeIJacobianFEM(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, locX::PetscVec, locX_t::PetscVec, X_tShift::PetscReal, Jac::PetscMat, JacP::PetscMat, user::Cvoid) +Form the Jacobian `Jac` from the local input `locX` using pointwise functions specified by the user + +Input Parameters: +- `dm` - The mesh +- `time` - The time +- `locX` - Local solution +- `locX_t` - Local solution time derivative, or `NULL` +- `X_tShift` - The multiplicative parameter for dF/du_t +- `user` - The user context + +Output Parameters: +- `Jac` - the Jacobian +- `JacP` - an additional approximation for the Jacobian to be used to compute the preconditioner (often is `Jac`) + +Level: developer + +-seealso: [](ch_ts), `TS`, `DM`, `DMPlexTSComputeIFunctionFEM()`, `DMPlexTSComputeRHSFunctionFEM()` + +# External Links +$(_doc_external("Ts/DMPlexTSComputeIJacobianFEM")) +""" +function DMPlexTSComputeIJacobianFEM(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, locX::PetscVec, locX_t::PetscVec, X_tShift::PetscReal, Jac::PetscMat, JacP::PetscMat, user::Cvoid) end + +@for_petsc function DMPlexTSComputeIJacobianFEM(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, locX::PetscVec, locX_t::PetscVec, X_tShift::$PetscReal, Jac::PetscMat, JacP::PetscMat, user::Cvoid ) + + @chk ccall( + (:DMPlexTSComputeIJacobianFEM, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, CVec, $PetscReal, CMat, CMat, Ptr{Cvoid}), + dm, time, locX, locX_t, X_tShift, Jac, JacP, user, + ) + + + return nothing +end + +""" + DMPlexTSComputeRHSFunctionFEM(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, locX::PetscVec, locG::PetscVec, user::Cvoid) +Form the local residual `locG` from the local input `locX` using pointwise functions specified by the user + +Input Parameters: +- `dm` - The mesh +- `time` - The time +- `locX` - Local solution +- `user` - The user context + +Output Parameter: +- `locG` - Local output vector + +Level: developer + +-seealso: [](ch_ts), `TS`, `DM`, `DMPlexTSComputeIFunctionFEM()`, `DMPlexTSComputeIJacobianFEM()` + +# External Links +$(_doc_external("Ts/DMPlexTSComputeRHSFunctionFEM")) +""" +function DMPlexTSComputeRHSFunctionFEM(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, locX::PetscVec, locG::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexTSComputeRHSFunctionFEM(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, locX::PetscVec, locG::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexTSComputeRHSFunctionFEM, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, CVec, Ptr{Cvoid}), + dm, time, locX, locG, user, + ) + + + return nothing +end + +""" + residual::PetscReal = DMTSCheckResidual(petsclib::PetscLibType,ts::TS, dm::PetscDM, t::PetscReal, u::PetscVec, u_t::PetscVec, tol::PetscReal) +Check the residual of the exact solution + +Input Parameters: +- `ts` - the `TS` object +- `dm` - the `DM` +- `t` - the time +- `u` - a `DM` vector +- `u_t` - a `DM` vector +- `tol` - A tolerance for the check, or -1 to print the results instead + +Output Parameter: +- `residual` - The residual norm of the exact solution, or `NULL` + +Level: developer + +-seealso: [](ch_ts), `DM`, `DMTSCheckFromOptions()`, `DMTSCheckJacobian()`, `DNSNESCheckFromOptions()`, `DMSNESCheckDiscretization()`, `DMSNESCheckJacobian()` + +# External Links +$(_doc_external("Ts/DMTSCheckResidual")) +""" +function DMTSCheckResidual(petsclib::PetscLibType, ts::TS, dm::PetscDM, t::PetscReal, u::PetscVec, u_t::PetscVec, tol::PetscReal) end + +@for_petsc function DMTSCheckResidual(petsclib::$UnionPetscLib, ts::TS, dm::PetscDM, t::$PetscReal, u::PetscVec, u_t::PetscVec, tol::$PetscReal ) + residual_ = Ref{$PetscReal}() + + @chk ccall( + (:DMTSCheckResidual, $petsc_library), + PetscErrorCode, + (CTS, CDM, $PetscReal, CVec, CVec, $PetscReal, Ptr{$PetscReal}), + ts, dm, t, u, u_t, tol, residual_, + ) + + residual = residual_[] + + return residual +end + +""" + isLinear::PetscBool,convRate::PetscReal = DMTSCheckJacobian(petsclib::PetscLibType,ts::TS, dm::PetscDM, t::PetscReal, u::PetscVec, u_t::PetscVec, tol::PetscReal) +Check the Jacobian of the exact solution against the residual using the Taylor Test + +Input Parameters: +- `ts` - the `TS` object +- `dm` - the `DM` +- `t` - the time +- `u` - a `DM` vector +- `u_t` - a `DM` vector +- `tol` - A tolerance for the check, or -1 to print the results instead + +Output Parameters: +- `isLinear` - Flag indicating that the function looks linear, or `NULL` +- `convRate` - The rate of convergence of the linear model, or `NULL` + +Level: developer + +-seealso: [](ch_ts), `DNTSCheckFromOptions()`, `DMTSCheckResidual()`, `DNSNESCheckFromOptions()`, `DMSNESCheckDiscretization()`, `DMSNESCheckResidual()` + +# External Links +$(_doc_external("Ts/DMTSCheckJacobian")) +""" +function DMTSCheckJacobian(petsclib::PetscLibType, ts::TS, dm::PetscDM, t::PetscReal, u::PetscVec, u_t::PetscVec, tol::PetscReal) end + +@for_petsc function DMTSCheckJacobian(petsclib::$UnionPetscLib, ts::TS, dm::PetscDM, t::$PetscReal, u::PetscVec, u_t::PetscVec, tol::$PetscReal ) + isLinear_ = Ref{PetscBool}() + convRate_ = Ref{$PetscReal}() + + @chk ccall( + (:DMTSCheckJacobian, $petsc_library), + PetscErrorCode, + (CIS, CDM, $PetscReal, CVec, CVec, $PetscReal, Ptr{PetscBool}, Ptr{$PetscReal}), + ts, dm, t, u, u_t, tol, isLinear_, convRate_, + ) + + isLinear = isLinear_[] + convRate = convRate_[] + + return isLinear,convRate +end + +""" + DMTSCheckFromOptions(petsclib::PetscLibType,ts::TS, u::PetscVec) +Check the residual and Jacobian functions using the exact solution by outputting some diagnostic information based on +values in the options database + +Input Parameters: +- `ts` - the `TS` object +- `u` - representative `TS` vector + +Level: developer + +-seealso: `DMTS` + +# External Links +$(_doc_external("Ts/DMTSCheckFromOptions")) +""" +function DMTSCheckFromOptions(petsclib::PetscLibType, ts::TS, u::PetscVec) end + +@for_petsc function DMTSCheckFromOptions(petsclib::$UnionPetscLib, ts::TS, u::PetscVec ) + + @chk ccall( + (:DMTSCheckFromOptions, $petsc_library), + PetscErrorCode, + (CTS, CVec), + ts, u, + ) + + + return nothing +end + +""" + DMDATSSetRHSFunctionLocal(petsclib::PetscLibType,dm::PetscDM, imode::InsertMode, func::DMDATSRHSFunctionLocalFn, ctx::Cvoid) +set a local residual evaluation function for use with `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `imode` - insert mode for the residual +- `func` - local residual evaluation, see `DMDATSRHSFunctionLocalFn` for the calling sequence +- `ctx` - optional context for local residual evaluation + +Level: beginner + +-seealso: [](ch_ts), `DMDA`, `DMDATSRHSFunctionLocalFn`, `TS`, `TSSetRHSFunction()`, `DMTSSetRHSFunction()`, `DMDATSSetRHSJacobianLocal()`, `DMDASNESSetFunctionLocal()` + +# External Links +$(_doc_external("Ts/DMDATSSetRHSFunctionLocal")) +""" +function DMDATSSetRHSFunctionLocal(petsclib::PetscLibType, dm::PetscDM, imode::InsertMode, func::DMDATSRHSFunctionLocalFn, ctx::Cvoid) end + +@for_petsc function DMDATSSetRHSFunctionLocal(petsclib::$UnionPetscLib, dm::PetscDM, imode::InsertMode, func::DMDATSRHSFunctionLocalFn, ctx::Cvoid ) + + @chk ccall( + (:DMDATSSetRHSFunctionLocal, $petsc_library), + PetscErrorCode, + (CDM, InsertMode, Ptr{DMDATSRHSFunctionLocalFn}, Ptr{Cvoid}), + dm, imode, func, ctx, + ) + + + return nothing +end + +""" + DMDATSSetRHSJacobianLocal(petsclib::PetscLibType,dm::PetscDM, func::DMDATSRHSJacobianLocalFn, ctx::Cvoid) +set a local residual evaluation function for use with `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local RHS Jacobian evaluation routine, see `DMDATSRHSJacobianLocalFn` for the calling sequence +- `ctx` - optional context for local jacobian evaluation + +Level: beginner + +-seealso: [](ch_ts), `DMDA`, `DMDATSRHSJacobianLocalFn`, `DMTSSetRHSJacobian()`, +`DMDATSSetRHSFunctionLocal()`, `DMDASNESSetJacobianLocal()` + +# External Links +$(_doc_external("Ts/DMDATSSetRHSJacobianLocal")) +""" +function DMDATSSetRHSJacobianLocal(petsclib::PetscLibType, dm::PetscDM, func::DMDATSRHSJacobianLocalFn, ctx::Cvoid) end + +@for_petsc function DMDATSSetRHSJacobianLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::DMDATSRHSJacobianLocalFn, ctx::Cvoid ) + + @chk ccall( + (:DMDATSSetRHSJacobianLocal, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMDATSRHSJacobianLocalFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMDATSSetIFunctionLocal(petsclib::PetscLibType,dm::PetscDM, imode::InsertMode, func::DMDATSIFunctionLocalFn, ctx::Cvoid) +set a local residual evaluation function for use with `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `imode` - the insert mode of the function +- `func` - local residual evaluation, see `DMDATSIFunctionLocalFn` for the calling sequence +- `ctx` - optional context for local residual evaluation + +Level: beginner + +-seealso: [](ch_ts), `DMDA`, `DMDATSIFunctionLocalFn`, `DMTSSetIFunction()`, +`DMDATSSetIJacobianLocal()`, `DMDASNESSetFunctionLocal()` + +# External Links +$(_doc_external("Ts/DMDATSSetIFunctionLocal")) +""" +function DMDATSSetIFunctionLocal(petsclib::PetscLibType, dm::PetscDM, imode::InsertMode, func::DMDATSIFunctionLocalFn, ctx::Cvoid) end + +@for_petsc function DMDATSSetIFunctionLocal(petsclib::$UnionPetscLib, dm::PetscDM, imode::InsertMode, func::DMDATSIFunctionLocalFn, ctx::Cvoid ) + + @chk ccall( + (:DMDATSSetIFunctionLocal, $petsc_library), + PetscErrorCode, + (CDM, InsertMode, Ptr{DMDATSIFunctionLocalFn}, Ptr{Cvoid}), + dm, imode, func, ctx, + ) + + + return nothing +end + +""" + DMDATSSetIJacobianLocal(petsclib::PetscLibType,dm::PetscDM, func::DMDATSIJacobianLocalFn, ctx::Cvoid) +set a local residual evaluation function for use with `DMDA` + +Logically Collective + +Input Parameters: +- `dm` - `DM` to associate callback with +- `func` - local residual evaluation, see `DMDATSIJacobianLocalFn` for the calling sequence +- `ctx` - optional context for local residual evaluation + +Level: beginner + +-seealso: [](ch_ts), `DMDA`, `DMDATSIJacobianLocalFn`, `DMTSSetIJacobian()`, +`DMDATSSetIFunctionLocal()`, `DMDASNESSetJacobianLocal()` + +# External Links +$(_doc_external("Ts/DMDATSSetIJacobianLocal")) +""" +function DMDATSSetIJacobianLocal(petsclib::PetscLibType, dm::PetscDM, func::DMDATSIJacobianLocalFn, ctx::Cvoid) end + +@for_petsc function DMDATSSetIJacobianLocal(petsclib::$UnionPetscLib, dm::PetscDM, func::DMDATSIJacobianLocalFn, ctx::Cvoid ) + + @chk ccall( + (:DMDATSSetIJacobianLocal, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMDATSIJacobianLocalFn}, Ptr{Cvoid}), + dm, func, ctx, + ) + + + return nothing +end + +""" + DMPlexTSComputeRHSFunctionFVMCEED(petsclib::PetscLibType,dm::PetscDM, time::PetscReal, locX::PetscVec, F::PetscVec, user::Cvoid) + +# External Links +$(_doc_external("Ts/DMPlexTSComputeRHSFunctionFVMCEED")) +""" +function DMPlexTSComputeRHSFunctionFVMCEED(petsclib::PetscLibType, dm::PetscDM, time::PetscReal, locX::PetscVec, F::PetscVec, user::Cvoid) end + +@for_petsc function DMPlexTSComputeRHSFunctionFVMCEED(petsclib::$UnionPetscLib, dm::PetscDM, time::$PetscReal, locX::PetscVec, F::PetscVec, user::Cvoid ) + + @chk ccall( + (:DMPlexTSComputeRHSFunctionFVMCEED, $petsc_library), + PetscErrorCode, + (CDM, $PetscReal, CVec, CVec, Ptr{Cvoid}), + dm, time, locX, F, user, + ) + + + return nothing +end + +""" + DMPlexLandauAddMaxwellians(petsclib::PetscLibType,dm::PetscDM, X::PetscVec, time::PetscReal, temps::Vector{PetscReal}, ns::Vector{PetscReal}, grid::PetscInt, b_id::PetscInt, n_batch::PetscInt, actx::Cvoid) +Add a Maxwellian distribution to a state + +Collective + +Input Parameters: +- `dm` - The mesh (local) +- `time` - Current time +- `temps` - Temperatures of each species (global) +- `ns` - Number density of each species (global) +- `grid` - index into current grid - just used for offset into `temp` and `ns` +- `b_id` - batch index +- `n_batch` - number of batches +- `actx` - Landau context + +Output Parameter: +- `X` - The state (local to this grid) + +Level: beginner + +-seealso: `DMPlexLandauCreateVelocitySpace()` + +# External Links +$(_doc_external("Ts/DMPlexLandauAddMaxwellians")) +""" +function DMPlexLandauAddMaxwellians(petsclib::PetscLibType, dm::PetscDM, X::PetscVec, time::PetscReal, temps::Vector{PetscReal}, ns::Vector{PetscReal}, grid::PetscInt, b_id::PetscInt, n_batch::PetscInt, actx::Cvoid) end + +@for_petsc function DMPlexLandauAddMaxwellians(petsclib::$UnionPetscLib, dm::PetscDM, X::PetscVec, time::$PetscReal, temps::Vector{$PetscReal}, ns::Vector{$PetscReal}, grid::$PetscInt, b_id::$PetscInt, n_batch::$PetscInt, actx::Cvoid ) + + @chk ccall( + (:DMPlexLandauAddMaxwellians, $petsc_library), + PetscErrorCode, + (CDM, CVec, $PetscReal, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscInt, $PetscInt, $PetscInt, Ptr{Cvoid}), + dm, X, time, temps, ns, grid, b_id, n_batch, actx, + ) + + + return nothing +end + +""" + X::PetscVec,J::PetscMat,pack::PetscDM = DMPlexLandauCreateVelocitySpace(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, prefix::String) +Create a `DMPLEX` velocity space mesh + +Collective + +Input Parameters: +- `comm` - The MPI communicator +- `dim` - velocity space dimension (2 for axisymmetric, 3 for full 3X + 3V solver) +- `prefix` - prefix for options (not tested) + +Output Parameters: +- `pack` - The `DM` object representing the mesh +- `X` - A vector (user destroys) +- `J` - Optional matrix (object destroys) + +Level: beginner + +-seealso: `DMPlexCreate()`, `DMPlexLandauDestroyVelocitySpace()` + +# External Links +$(_doc_external("Ts/DMPlexLandauCreateVelocitySpace")) +""" +function DMPlexLandauCreateVelocitySpace(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, prefix::String) end + +@for_petsc function DMPlexLandauCreateVelocitySpace(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, prefix::String ) + X_ = Ref{CVec}() + J_ = Ref{CMat}() + pack_ = Ref{CDM}() + + @chk ccall( + (:DMPlexLandauCreateVelocitySpace, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{Cchar}, Ptr{CVec}, Ptr{CMat}, Ptr{CDM}), + comm, dim, prefix, X_, J_, pack_, + ) + + X = PetscVec(X_[], petsclib) + J = PetscMat(J_[], petsclib) + pack = PetscDM(pack_[], petsclib) + + return X,J,pack +end + +""" + DMPlexLandauAccess(petsclib::PetscLibType,pack::PetscDM, X::PetscVec, func::external, user_ctx::Cvoid) +Access to the distribution function with user callback + +Collective + +Input Parameters: +- `pack` - the `DMCOMPOSITE` +- `func` - call back function +- `user_ctx` - user context + +Input/Output Parameter: +- `X` - Vector to data to + +Level: advanced + +-seealso: `DMPlexLandauCreateVelocitySpace()` + +# External Links +$(_doc_external("Ts/DMPlexLandauAccess")) +""" +function DMPlexLandauAccess(petsclib::PetscLibType, pack::PetscDM, X::PetscVec, func::external, user_ctx::Cvoid) end + +@for_petsc function DMPlexLandauAccess(petsclib::$UnionPetscLib, pack::PetscDM, X::PetscVec, func::external, user_ctx::Cvoid ) + + @chk ccall( + (:DMPlexLandauAccess, $petsc_library), + PetscErrorCode, + (CDM, CVec, external, Ptr{Cvoid}), + pack, X, func, user_ctx, + ) + + + return nothing +end + +""" + DMPlexLandauDestroyVelocitySpace(petsclib::PetscLibType,dm::PetscDM) +Destroy a `DMPLEX` velocity space mesh + +Collective + +Input/Output Parameters: +- `dm` - the `DM` to destroy + +Level: beginner + +-seealso: `DMPlexLandauCreateVelocitySpace()` + +# External Links +$(_doc_external("Ts/DMPlexLandauDestroyVelocitySpace")) +""" +function DMPlexLandauDestroyVelocitySpace(petsclib::PetscLibType, dm::PetscDM) end + +@for_petsc function DMPlexLandauDestroyVelocitySpace(petsclib::$UnionPetscLib, dm::PetscDM ) + dm_ = Ref(dm.ptr) + + @chk ccall( + (:DMPlexLandauDestroyVelocitySpace, $petsc_library), + PetscErrorCode, + (Ptr{CDM},), + dm_, + ) + + dm.ptr = dm_[] + + return nothing +end + +""" + DMPlexLandauPrintNorms(petsclib::PetscLibType,X::PetscVec, stepi::PetscInt) +collects moments and prints them + +Collective + +Input Parameters: +- `X` - the state +- `stepi` - current step to print + +Level: beginner + +-seealso: `DMPlexLandauCreateVelocitySpace()` + +# External Links +$(_doc_external("Ts/DMPlexLandauPrintNorms")) +""" +function DMPlexLandauPrintNorms(petsclib::PetscLibType, X::PetscVec, stepi::PetscInt) end + +@for_petsc function DMPlexLandauPrintNorms(petsclib::$UnionPetscLib, X::PetscVec, stepi::$PetscInt ) + + @chk ccall( + (:DMPlexLandauPrintNorms, $petsc_library), + PetscErrorCode, + (CVec, $PetscInt), + X, stepi, + ) + + + return nothing +end + +""" + Amat::PetscMat = DMPlexLandauCreateMassMatrix(petsclib::PetscLibType,pack::PetscDM) +Create mass matrix for Landau in Plex space (not field major order of Jacobian) +- `puts mass matrix into ctx->M` + +Collective + +Input Parameter: +- `pack` - the `DM` object. Puts matrix in Landau context M field + +Output Parameter: +- `Amat` - The mass matrix (optional), mass matrix is added to the `DM` context + +Level: beginner + +-seealso: `DMPlexLandauCreateVelocitySpace()` + +# External Links +$(_doc_external("Ts/DMPlexLandauCreateMassMatrix")) +""" +function DMPlexLandauCreateMassMatrix(petsclib::PetscLibType, pack::PetscDM) end + +@for_petsc function DMPlexLandauCreateMassMatrix(petsclib::$UnionPetscLib, pack::PetscDM ) + Amat_ = Ref{CMat}() + + @chk ccall( + (:DMPlexLandauCreateMassMatrix, $petsc_library), + PetscErrorCode, + (CDM, Ptr{CMat}), + pack, Amat_, + ) + + Amat = PetscMat(Amat_[], petsclib) + + return Amat +end + +""" + DMPlexLandauIFunction(petsclib::PetscLibType,ts::TS, time_dummy::PetscReal, X::PetscVec, X_t::PetscVec, F::PetscVec, actx::Cvoid) +`TS` residual calculation, confusingly this computes the Jacobian w/o mass + +Collective + +Input Parameters: +- `ts` - The time stepping context +- `time_dummy` - current time (not used) +- `X` - Current state +- `X_t` - Time derivative of current state +- `actx` - Landau context + +Output Parameter: +- `F` - The residual + +Level: beginner + +-seealso: `DMPlexLandauCreateVelocitySpace()`, `DMPlexLandauIJacobian()` + +# External Links +$(_doc_external("Ts/DMPlexLandauIFunction")) +""" +function DMPlexLandauIFunction(petsclib::PetscLibType, ts::TS, time_dummy::PetscReal, X::PetscVec, X_t::PetscVec, F::PetscVec, actx::Cvoid) end + +@for_petsc function DMPlexLandauIFunction(petsclib::$UnionPetscLib, ts::TS, time_dummy::$PetscReal, X::PetscVec, X_t::PetscVec, F::PetscVec, actx::Cvoid ) + + @chk ccall( + (:DMPlexLandauIFunction, $petsc_library), + PetscErrorCode, + (CTS, $PetscReal, CVec, CVec, CVec, Ptr{Cvoid}), + ts, time_dummy, X, X_t, F, actx, + ) + + + return nothing +end + +""" + DMPlexLandauIJacobian(petsclib::PetscLibType,ts::TS, time_dummy::PetscReal, X::PetscVec, U_tdummy::PetscVec, shift::PetscReal, Amat::PetscMat, Pmat::PetscMat, actx::Cvoid) +`TS` Jacobian construction, confusingly this adds mass + +Collective + +Input Parameters: +- `ts` - The time stepping context +- `time_dummy` - current time (not used) +- `X` - Current state +- `U_tdummy` - Time derivative of current state (not used) +- `shift` - shift for du/dt term +- `actx` - Landau context + +Output Parameters: +- `Amat` - Jacobian +- `Pmat` - same as Amat + +Level: beginner + +-seealso: `DMPlexLandauCreateVelocitySpace()`, `DMPlexLandauIFunction()` + +# External Links +$(_doc_external("Ts/DMPlexLandauIJacobian")) +""" +function DMPlexLandauIJacobian(petsclib::PetscLibType, ts::TS, time_dummy::PetscReal, X::PetscVec, U_tdummy::PetscVec, shift::PetscReal, Amat::PetscMat, Pmat::PetscMat, actx::Cvoid) end + +@for_petsc function DMPlexLandauIJacobian(petsclib::$UnionPetscLib, ts::TS, time_dummy::$PetscReal, X::PetscVec, U_tdummy::PetscVec, shift::$PetscReal, Amat::PetscMat, Pmat::PetscMat, actx::Cvoid ) + + @chk ccall( + (:DMPlexLandauIJacobian, $petsc_library), + PetscErrorCode, + (CTS, $PetscReal, CVec, CVec, $PetscReal, CMat, CMat, Ptr{Cvoid}), + ts, time_dummy, X, U_tdummy, shift, Amat, Pmat, actx, + ) + + + return nothing +end + +""" + DMPlexSetGlobalToNaturalSF(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF) + +# External Links +$(_doc_external("DMPlex/DMPlexSetGlobalToNaturalSF")) +""" +function DMPlexSetGlobalToNaturalSF(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF) end + +@for_petsc function DMPlexSetGlobalToNaturalSF(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF ) + + @chk ccall( + (:DMPlexSetGlobalToNaturalSF, $petsc_library), + PetscErrorCode, + (CDM, PetscSF), + dm, sf, + ) + + + return nothing +end + +""" + DMPlexGetGlobalToNaturalSF(petsclib::PetscLibType,dm::PetscDM, sf::PetscSF) + +# External Links +$(_doc_external("DMPlex/DMPlexGetGlobalToNaturalSF")) +""" +function DMPlexGetGlobalToNaturalSF(petsclib::PetscLibType, dm::PetscDM, sf::PetscSF) end + +@for_petsc function DMPlexGetGlobalToNaturalSF(petsclib::$UnionPetscLib, dm::PetscDM, sf::PetscSF ) + + @chk ccall( + (:DMPlexGetGlobalToNaturalSF, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscSF}), + dm, sf, + ) + + + return nothing +end + diff --git a/src/autowrapped/DMaddons_wrappers.jl b/src/autowrapped/DMaddons_wrappers.jl new file mode 100644 index 00000000..73afee73 --- /dev/null +++ b/src/autowrapped/DMaddons_wrappers.jl @@ -0,0 +1,6815 @@ +# autodefined type arguments for class ------ +mutable struct _n_DMAdaptor end +const DMAdaptor = Ptr{_n_DMAdaptor} + +# ------------------------------------------------------- +# autodefined type arguments for class ------ +mutable struct _n_DMSwarmDataField end +const DMSwarmDataField = Ptr{_n_DMSwarmDataField} + +# ------------------------------------------------------- +# autodefined type arguments for class ------ +mutable struct _n_DMSwarmDataBucket end +const DMSwarmDataBucket = Ptr{_n_DMSwarmDataBucket} + +#mutable struct _n_DMSwarmCellDM end +#const DMSwarmCellDM = Ptr{_n_DMSwarmCellDM} + +# ------------------------------------------------------- +# autodefined type arguments for class ------ +mutable struct _n_DMSwarmSort end +const DMSwarmSort = Ptr{_n_DMSwarmSort} + +mutable struct _n_DMPlexPoCintQueue end +const DMPlexPoCintQueue = Ptr{_n_DMPlexPoCintQueue} + +mutable struct _n_DMNetworkMonitor end +const DMNetworkMonitor = Ptr{_n_DMNetworkMonitor} + +#mutable struct _n_DMField end +#const DMField = Ptr{_n_DMField} +# +#mutable struct _n_DMPlexTransform end +#const DMPlexTransform = Ptr{_n_DMPlexTransform} + +#mutable struct _n_PetscSimplePoCintFn end +#const PetscSimplePoCintFn = Ptr{_n_PetscSimplePoCintFn} + + +# ------------------------------------------------------- +# autodefined type arguments for class ------ +# ------------------------------------------------------- +""" + DMAdaptorRegisterAll(petsclib::PetscLibType) +Registers all of the adaptor components in the `DM` package. + +Not Collective + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMAdaptorType`, `DMRegisterAll()`, `DMAdaptorRegisterDestroy()` + +# External Links +$(_doc_external("DM/DMAdaptorRegisterAll")) +""" +function DMAdaptorRegisterAll(petsclib::PetscLibType) end + +@for_petsc function DMAdaptorRegisterAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMAdaptorRegisterAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMAdaptorRegisterDestroy(petsclib::PetscLibType) +This function destroys the registered `DMAdaptorType`. It is called from `PetscFinalize()`. + +Not collective + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMAdaptorRegisterAll()`, `DMAdaptorType`, `PetscFinalize()` + +# External Links +$(_doc_external("DM/DMAdaptorRegisterDestroy")) +""" +function DMAdaptorRegisterDestroy(petsclib::PetscLibType) end + +@for_petsc function DMAdaptorRegisterDestroy(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMAdaptorRegisterDestroy, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMAdaptorMonitorRegister(petsclib::PetscLibType,name::String, vtype::PetscViewerType, format::PetscViewerFormat, monitor::external, create::external, destroy::external) +Registers a mesh adaptation monitor routine that may be accessed with `DMAdaptorMonitorSetFromOptions()` + +Not Collective + +Input Parameters: +- `name` - name of a new monitor routine +- `vtype` - A `PetscViewerType` for the output +- `format` - A `PetscViewerFormat` for the output +- `monitor` - Monitor routine +- `create` - Creation routine, or `NULL` +- `destroy` - Destruction routine, or `NULL` + +Level: advanced + +-seealso: [](ch_snes), `DMAdaptor`, `DMAdaptorMonitorSet()`, `DMAdaptorMonitorRegisterAll()`, `DMAdaptorMonitorSetFromOptions()` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorRegister")) +""" +function DMAdaptorMonitorRegister(petsclib::PetscLibType, name::String, vtype::PetscViewerType, format::PetscViewerFormat, monitor::external, create::external, destroy::external) end + +@for_petsc function DMAdaptorMonitorRegister(petsclib::$UnionPetscLib, name::String, vtype::PetscViewerType, format::PetscViewerFormat, monitor::external, create::external, destroy::external ) + + @chk ccall( + (:DMAdaptorMonitorRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, PetscViewerType, PetscViewerFormat, external, external, external), + name, vtype, format, monitor, create, destroy, + ) + + + return nothing +end + +""" + DMAdaptorMonitorRegisterDestroy(petsclib::PetscLibType) +This function destroys the registered monitors for `DMAdaptor`. It is called from `PetscFinalize()`. + +Not collective + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMAdaptorMonitorRegisterAll()`, `DMAdaptor`, `PetscFinalize()` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorRegisterDestroy")) +""" +function DMAdaptorMonitorRegisterDestroy(petsclib::PetscLibType) end + +@for_petsc function DMAdaptorMonitorRegisterDestroy(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMAdaptorMonitorRegisterDestroy, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + adaptor::DMAdaptor = DMAdaptorCreate(petsclib::PetscLibType,comm::MPI_Comm) +Create a `DMAdaptor` object. Its purpose is to construct a adaptation `DMLabel` or metric `Vec` that can be used to modify the `DM`. + +Collective + +Input Parameter: +- `comm` - The communicator for the `DMAdaptor` object + +Output Parameter: +- `adaptor` - The `DMAdaptor` object + +Level: beginner + +See also: +=== +`DM`, `DMAdaptor`, `DMAdaptorDestroy()`, `DMAdaptorAdapt()`, `PetscConvEst`, `PetscConvEstCreate()` + +# External Links +$(_doc_external("DM/DMAdaptorCreate")) +""" +function DMAdaptorCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMAdaptorCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + adaptor_ = Ref{DMAdaptor}() + + @chk ccall( + (:DMAdaptorCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{DMAdaptor}), + comm, adaptor_, + ) + + adaptor = adaptor_[] + + return adaptor +end + +""" + DMAdaptorDestroy(petsclib::PetscLibType,adaptor::DMAdaptor) +Destroys a `DMAdaptor` object + +Collective + +Input Parameter: +- `adaptor` - The `DMAdaptor` object + +Level: beginner + +See also: +=== +`DM`, `DMAdaptor`, `DMAdaptorCreate()`, `DMAdaptorAdapt()` + +# External Links +$(_doc_external("DM/DMAdaptorDestroy")) +""" +function DMAdaptorDestroy(petsclib::PetscLibType, adaptor::DMAdaptor) end + +@for_petsc function DMAdaptorDestroy(petsclib::$UnionPetscLib, adaptor::DMAdaptor ) + + @chk ccall( + (:DMAdaptorDestroy, $petsc_library), + PetscErrorCode, + (Ptr{DMAdaptor},), + adaptor, + ) + + + return nothing +end + +""" + DMAdaptorSetType(petsclib::PetscLibType,adaptor::DMAdaptor, method::DMAdaptorType) +Sets the particular implementation for a adaptor. + +Collective + +Input Parameters: +- `adaptor` - The `DMAdaptor` +- `method` - The name of the adaptor type + +Options Database Key: +- `-adaptor_type ` - Sets the adaptor type; see `DMAdaptorType` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMAdaptor`, `DMAdaptorType`, `DMAdaptorGetType()`, `DMAdaptorCreate()` + +# External Links +$(_doc_external("DM/DMAdaptorSetType")) +""" +function DMAdaptorSetType(petsclib::PetscLibType, adaptor::DMAdaptor, method::DMAdaptorType) end + +@for_petsc function DMAdaptorSetType(petsclib::$UnionPetscLib, adaptor::DMAdaptor, method::DMAdaptorType ) + + @chk ccall( + (:DMAdaptorSetType, $petsc_library), + PetscErrorCode, + (DMAdaptor, DMAdaptorType), + adaptor, method, + ) + + + return nothing +end + +""" + type::DMAdaptorType = DMAdaptorGetType(petsclib::PetscLibType,adaptor::DMAdaptor) +Gets the type name (as a string) from the adaptor. + +Not Collective + +Input Parameter: +- `adaptor` - The `DMAdaptor` + +Output Parameter: +- `type` - The `DMAdaptorType` name + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMAdaptor`, `DMAdaptorType`, `DMAdaptorSetType()`, `DMAdaptorCreate()` + +# External Links +$(_doc_external("DM/DMAdaptorGetType")) +""" +function DMAdaptorGetType(petsclib::PetscLibType, adaptor::DMAdaptor) end + +@for_petsc function DMAdaptorGetType(petsclib::$UnionPetscLib, adaptor::DMAdaptor ) + type_ = Ref{DMAdaptorType}() + + @chk ccall( + (:DMAdaptorGetType, $petsc_library), + PetscErrorCode, + (DMAdaptor, Ptr{DMAdaptorType}), + adaptor, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + DMAdaptorMonitorSet(petsclib::PetscLibType,adaptor::DMAdaptor, monitor::external, ctx::Cvoid, monitordestroy::PetscCtxDestroyFn) +Sets an ADDITIONAL function to be called at every iteration to monitor +the error etc. + +Logically Collective + +Input Parameters: +- `adaptor` - the `DMAdaptor` +- `monitor` - pointer to function (if this is `NULL`, it turns off monitoring +- `ctx` - [optional] context for private data for the monitor routine (use `NULL` if no context is needed) +- `monitordestroy` - [optional] routine that frees monitor context (may be `NULL`), see `PetscCtxDestroyFn` for its calling sequence + +Calling sequence of `monitor`: +- `adaptor` - the `DMAdaptor` +- `it` - iteration number +- `odm` - the original `DM` +- `adm` - the adapted `DM` +- `Nf` - number of fields +- `enorms` - (estimated) 2-norm of the error for each field +- `error` - `Vec` of cellwise errors +- `ctx` - optional monitoring context, as set by `DMAdaptorMonitorSet()` + +Options Database Keys: +- `-adaptor_monitor_size` - sets `DMAdaptorMonitorSize()` +- `-adaptor_monitor_error` - sets `DMAdaptorMonitorError()` +- `-adaptor_monitor_error draw` - sets `DMAdaptorMonitorErrorDraw()` and plots error +- `-adaptor_monitor_error draw::draw_lg` - sets `DMAdaptorMonitorErrorDrawLG()` and plots error +- `-dm_adaptor_monitor_cancel` - Cancels all monitors that have been hardwired into a code by calls to `DMAdaptorMonitorSet()`, but does not cancel those set via the options database. + +Level: beginner + +-seealso: [](ch_snes), `DMAdaptorMonitorError()`, `DMAdaptor`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorSet")) +""" +function DMAdaptorMonitorSet(petsclib::PetscLibType, adaptor::DMAdaptor, monitor::external, ctx::Cvoid, monitordestroy::PetscCtxDestroyFn) end + +@for_petsc function DMAdaptorMonitorSet(petsclib::$UnionPetscLib, adaptor::DMAdaptor, monitor::external, ctx::Cvoid, monitordestroy::PetscCtxDestroyFn ) + + @chk ccall( + (:DMAdaptorMonitorSet, $petsc_library), + PetscErrorCode, + (DMAdaptor, external, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + adaptor, monitor, ctx, monitordestroy, + ) + + + return nothing +end + +""" + DMAdaptorMonitorCancel(petsclib::PetscLibType,adaptor::DMAdaptor) +Clears all monitors for a `DMAdaptor` object. + +Logically Collective + +Input Parameter: +- `adaptor` - the `DMAdaptor` + +Options Database Key: +- `-dm_adaptor_monitor_cancel` - Cancels all monitors that have been hardwired into a code by calls to `DMAdaptorMonitorSet()`, but does not cancel those set via the options database. + +Level: intermediate + +-seealso: [](ch_snes), `DMAdaptorMonitorError()`, `DMAdaptorMonitorSet()`, `DMAdaptor` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorCancel")) +""" +function DMAdaptorMonitorCancel(petsclib::PetscLibType, adaptor::DMAdaptor) end + +@for_petsc function DMAdaptorMonitorCancel(petsclib::$UnionPetscLib, adaptor::DMAdaptor ) + + @chk ccall( + (:DMAdaptorMonitorCancel, $petsc_library), + PetscErrorCode, + (DMAdaptor,), + adaptor, + ) + + + return nothing +end + +""" + DMAdaptorMonitorSetFromOptions(petsclib::PetscLibType,adaptor::DMAdaptor, opt::String, name::String, ctx::Cvoid) +Sets a monitor function and viewer appropriate for the type indicated by the user in the options database + +Collective + +Input Parameters: +- `adaptor` - `DMadaptor` object you wish to monitor +- `opt` - the command line option for this monitor +- `name` - the monitor type one is seeking +- `ctx` - An optional user context for the monitor, or `NULL` + +Level: developer + +-seealso: [](ch_snes), `DMAdaptorMonitorRegister()`, `DMAdaptorMonitorSet()`, `PetscOptionsGetViewer()` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorSetFromOptions")) +""" +function DMAdaptorMonitorSetFromOptions(petsclib::PetscLibType, adaptor::DMAdaptor, opt::String, name::String, ctx::Cvoid) end + +@for_petsc function DMAdaptorMonitorSetFromOptions(petsclib::$UnionPetscLib, adaptor::DMAdaptor, opt::String, name::String, ctx::Cvoid ) + + @chk ccall( + (:DMAdaptorMonitorSetFromOptions, $petsc_library), + PetscErrorCode, + (DMAdaptor, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cvoid}), + adaptor, opt, name, ctx, + ) + + + return nothing +end + +""" + DMAdaptorSetOptionsPrefix(petsclib::PetscLibType,adaptor::DMAdaptor, prefix::String) +Sets the prefix used for searching for all `DMAdaptor` options in the database. + +Logically Collective + +Input Parameters: +- `adaptor` - the `DMAdaptor` +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: [](ch_snes), `DMAdaptor`, `SNESSetOptionsPrefix()`, `DMAdaptorSetFromOptions()` + +# External Links +$(_doc_external("DM/DMAdaptorSetOptionsPrefix")) +""" +function DMAdaptorSetOptionsPrefix(petsclib::PetscLibType, adaptor::DMAdaptor, prefix::String) end + +@for_petsc function DMAdaptorSetOptionsPrefix(petsclib::$UnionPetscLib, adaptor::DMAdaptor, prefix::String ) + + @chk ccall( + (:DMAdaptorSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (DMAdaptor, Ptr{Cchar}), + adaptor, prefix, + ) + + + return nothing +end + +""" + DMAdaptorSetFromOptions(petsclib::PetscLibType,adaptor::DMAdaptor) +Sets properties of a `DMAdaptor` object from values in the options database + +Collective + +Input Parameter: +- `adaptor` - The `DMAdaptor` object + +Options Database Keys: +- `-adaptor_monitor_size` - Monitor the mesh size +- `-adaptor_monitor_error` - Monitor the solution error +- `-adaptor_sequence_num ` - Number of adaptations to generate an optimal grid +- `-adaptor_target_num ` - Set the target number of vertices N_adapt, -1 for automatic determination +- `-adaptor_refinement_factor ` - Set r such that N_adapt = r^dim N_orig +- `-adaptor_mixed_setup_function ` - Set the function func that sets up the mixed problem + +Level: beginner + +See also: +=== +`DM`, `DMAdaptor`, `DMAdaptorCreate()`, `DMAdaptorAdapt()` + +# External Links +$(_doc_external("DM/DMAdaptorSetFromOptions")) +""" +function DMAdaptorSetFromOptions(petsclib::PetscLibType, adaptor::DMAdaptor) end + +@for_petsc function DMAdaptorSetFromOptions(petsclib::$UnionPetscLib, adaptor::DMAdaptor ) + + @chk ccall( + (:DMAdaptorSetFromOptions, $petsc_library), + PetscErrorCode, + (DMAdaptor,), + adaptor, + ) + + + return nothing +end + +""" + DMAdaptorView(petsclib::PetscLibType,adaptor::DMAdaptor, viewer::PetscViewer) +Views a `DMAdaptor` object + +Collective + +Input Parameters: +- `adaptor` - The `DMAdaptor` object +- `viewer` - The `PetscViewer` object + +Level: beginner + +See also: +=== +`DM`, `DMAdaptor`, `DMAdaptorCreate()`, `DMAdaptorAdapt()` + +# External Links +$(_doc_external("DM/DMAdaptorView")) +""" +function DMAdaptorView(petsclib::PetscLibType, adaptor::DMAdaptor, viewer::PetscViewer) end + +@for_petsc function DMAdaptorView(petsclib::$UnionPetscLib, adaptor::DMAdaptor, viewer::PetscViewer ) + + @chk ccall( + (:DMAdaptorView, $petsc_library), + PetscErrorCode, + (DMAdaptor, PetscViewer), + adaptor, viewer, + ) + + + return nothing +end + +""" + DMAdaptorGetSolver(petsclib::PetscLibType,adaptor::DMAdaptor, snes::PetscSNES) +Gets the solver used to produce discrete solutions + +Not Collective + +Input Parameter: +- `adaptor` - The `DMAdaptor` object + +Output Parameter: +- `snes` - The solver + +Level: intermediate + +See also: +=== +`DM`, `DMAdaptor`, `DMAdaptorSetSolver()`, `DMAdaptorCreate()`, `DMAdaptorAdapt()` + +# External Links +$(_doc_external("DM/DMAdaptorGetSolver")) +""" +function DMAdaptorGetSolver(petsclib::PetscLibType, adaptor::DMAdaptor, snes::PetscSNES) end + +@for_petsc function DMAdaptorGetSolver(petsclib::$UnionPetscLib, adaptor::DMAdaptor, snes::PetscSNES ) + snes_ = Ref(snes.ptr) + + @chk ccall( + (:DMAdaptorGetSolver, $petsc_library), + PetscErrorCode, + (DMAdaptor, Ptr{CSNES}), + adaptor, snes_, + ) + + snes.ptr = C_NULL + + return nothing +end + +""" + DMAdaptorSetSolver(petsclib::PetscLibType,adaptor::DMAdaptor, snes::PetscSNES) +Sets the solver used to produce discrete solutions + +Not Collective + +Input Parameters: +- `adaptor` - The `DMAdaptor` object +- `snes` - The solver, this MUST have an attached `DM`/`PetscDS`, so that the exact solution can be computed + +Level: intermediate + +See also: +=== +`DMAdaptor`, `DMAdaptorGetSolver()`, `DMAdaptorCreate()`, `DMAdaptorAdapt()` + +# External Links +$(_doc_external("DM/DMAdaptorSetSolver")) +""" +function DMAdaptorSetSolver(petsclib::PetscLibType, adaptor::DMAdaptor, snes::PetscSNES) end + +@for_petsc function DMAdaptorSetSolver(petsclib::$UnionPetscLib, adaptor::DMAdaptor, snes::PetscSNES ) + + @chk ccall( + (:DMAdaptorSetSolver, $petsc_library), + PetscErrorCode, + (DMAdaptor, CSNES), + adaptor, snes, + ) + + + return nothing +end + +""" + num::PetscInt = DMAdaptorGetSequenceLength(petsclib::PetscLibType,adaptor::DMAdaptor) +Gets the number of sequential adaptations used by an adapter + +Not Collective + +Input Parameter: +- `adaptor` - The `DMAdaptor` object + +Output Parameter: +- `num` - The number of adaptations + +Level: intermediate + +See also: +=== +`DMAdaptor`, `DMAdaptorSetSequenceLength()`, `DMAdaptorCreate()`, `DMAdaptorAdapt()` + +# External Links +$(_doc_external("DM/DMAdaptorGetSequenceLength")) +""" +function DMAdaptorGetSequenceLength(petsclib::PetscLibType, adaptor::DMAdaptor) end + +@for_petsc function DMAdaptorGetSequenceLength(petsclib::$UnionPetscLib, adaptor::DMAdaptor ) + num_ = Ref{$PetscInt}() + + @chk ccall( + (:DMAdaptorGetSequenceLength, $petsc_library), + PetscErrorCode, + (DMAdaptor, Ptr{$PetscInt}), + adaptor, num_, + ) + + num = num_[] + + return num +end + +""" + DMAdaptorSetSequenceLength(petsclib::PetscLibType,adaptor::DMAdaptor, num::PetscInt) +Sets the number of sequential adaptations + +Not Collective + +Input Parameters: +- `adaptor` - The `DMAdaptor` object +- `num` - The number of adaptations + +Level: intermediate + +See also: +=== +`DMAdaptorGetSequenceLength()`, `DMAdaptorCreate()`, `DMAdaptorAdapt()` + +# External Links +$(_doc_external("DM/DMAdaptorSetSequenceLength")) +""" +function DMAdaptorSetSequenceLength(petsclib::PetscLibType, adaptor::DMAdaptor, num::PetscInt) end + +@for_petsc function DMAdaptorSetSequenceLength(petsclib::$UnionPetscLib, adaptor::DMAdaptor, num::$PetscInt ) + + @chk ccall( + (:DMAdaptorSetSequenceLength, $petsc_library), + PetscErrorCode, + (DMAdaptor, $PetscInt), + adaptor, num, + ) + + + return nothing +end + +""" + DMAdaptorSetUp(petsclib::PetscLibType,adaptor::DMAdaptor) +After the solver is specified, creates data structures for controlling adaptivity + +Collective + +Input Parameter: +- `adaptor` - The `DMAdaptor` object + +Level: beginner + +See also: +=== +`DMAdaptor`, `DMAdaptorCreate()`, `DMAdaptorAdapt()` + +# External Links +$(_doc_external("DM/DMAdaptorSetUp")) +""" +function DMAdaptorSetUp(petsclib::PetscLibType, adaptor::DMAdaptor) end + +@for_petsc function DMAdaptorSetUp(petsclib::$UnionPetscLib, adaptor::DMAdaptor ) + + @chk ccall( + (:DMAdaptorSetUp, $petsc_library), + PetscErrorCode, + (DMAdaptor,), + adaptor, + ) + + + return nothing +end + +""" + DMAdaptorSetTransferFunction(petsclib::PetscLibType,adaptor::DMAdaptor, tfunc::external) + +# External Links +$(_doc_external("DM/DMAdaptorSetTransferFunction")) +""" +function DMAdaptorSetTransferFunction(petsclib::PetscLibType, adaptor::DMAdaptor, tfunc::external) end + +@for_petsc function DMAdaptorSetTransferFunction(petsclib::$UnionPetscLib, adaptor::DMAdaptor, tfunc::external ) + + @chk ccall( + (:DMAdaptorSetTransferFunction, $petsc_library), + PetscErrorCode, + (DMAdaptor, external), + adaptor, tfunc, + ) + + + return nothing +end + +""" + DMAdaptorMonitor(petsclib::PetscLibType,adaptor::DMAdaptor, it::PetscInt, odm::PetscDM, adm::PetscDM, Nf::PetscInt, enorms::Vector{PetscReal}, error::PetscVec) +runs the user provided monitor routines, if they exist + +Collective + +Input Parameters: +- `adaptor` - the `DMAdaptor` +- `it` - iteration number +- `odm` - the original `DM` +- `adm` - the adapted `DM` +- `Nf` - the number of fields +- `enorms` - the 2-norm error values for each field +- `error` - `Vec` of cellwise errors + +Level: developer + +-seealso: [](ch_snes), `DMAdaptorMonitorSet()` + +# External Links +$(_doc_external("DM/DMAdaptorMonitor")) +""" +function DMAdaptorMonitor(petsclib::PetscLibType, adaptor::DMAdaptor, it::PetscInt, odm::PetscDM, adm::PetscDM, Nf::PetscInt, enorms::Vector{PetscReal}, error::PetscVec) end + +@for_petsc function DMAdaptorMonitor(petsclib::$UnionPetscLib, adaptor::DMAdaptor, it::$PetscInt, odm::PetscDM, adm::PetscDM, Nf::$PetscInt, enorms::Vector{$PetscReal}, error::PetscVec ) + + @chk ccall( + (:DMAdaptorMonitor, $petsc_library), + PetscErrorCode, + (DMAdaptor, $PetscInt, CDM, CDM, $PetscInt, Ptr{$PetscReal}, CVec), + adaptor, it, odm, adm, Nf, enorms, error, + ) + + + return nothing +end + +""" + DMAdaptorMonitorSize(petsclib::PetscLibType,adaptor::DMAdaptor, n::PetscInt, odm::PetscDM, adm::PetscDM, Nf::PetscInt, enorms::Vector{PetscReal}, error::PetscVec, vf::PetscViewerAndFormat) +Prints the mesh sizes at each iteration of an adaptation loop. + +Collective + +Input Parameters: +- `adaptor` - the `DMAdaptor` +- `n` - iteration number +- `odm` - the original `DM` +- `adm` - the adapted `DM` +- `Nf` - number of fields +- `enorms` - 2-norm error values for each field (may be estimated). +- `error` - `Vec` of cellwise errors +- `vf` - The viewer context + +Options Database Key: +- `-adaptor_monitor_size` - Activates `DMAdaptorMonitorSize()` + +Level: intermediate + +-seealso: [](ch_snes), `DMAdaptor`, `DMAdaptorMonitorSet()`, `DMAdaptorMonitorError()`, `DMAdaptorMonitorErrorDraw()`, `DMAdaptorMonitorErrorDrawLG()` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorSize")) +""" +function DMAdaptorMonitorSize(petsclib::PetscLibType, adaptor::DMAdaptor, n::PetscInt, odm::PetscDM, adm::PetscDM, Nf::PetscInt, enorms::Vector{PetscReal}, error::PetscVec, vf::PetscViewerAndFormat) end + +@for_petsc function DMAdaptorMonitorSize(petsclib::$UnionPetscLib, adaptor::DMAdaptor, n::$PetscInt, odm::PetscDM, adm::PetscDM, Nf::$PetscInt, enorms::Vector{$PetscReal}, error::PetscVec, vf::PetscViewerAndFormat ) + + @chk ccall( + (:DMAdaptorMonitorSize, $petsc_library), + PetscErrorCode, + (DMAdaptor, $PetscInt, CDM, CDM, $PetscInt, Ptr{$PetscReal}, CVec, Ptr{PetscViewerAndFormat}), + adaptor, n, odm, adm, Nf, enorms, error, vf, + ) + + + return nothing +end + +""" + DMAdaptorMonitorError(petsclib::PetscLibType,adaptor::DMAdaptor, n::PetscInt, odm::PetscDM, adm::PetscDM, Nf::PetscInt, enorms::Vector{PetscReal}, error::PetscVec, vf::PetscViewerAndFormat) +Prints the error norm at each iteration of an adaptation loop. + +Collective + +Input Parameters: +- `adaptor` - the `DMAdaptor` +- `n` - iteration number +- `odm` - the original `DM` +- `adm` - the adapted `DM` +- `Nf` - number of fields +- `enorms` - 2-norm error values for each field (may be estimated). +- `error` - `Vec` of cellwise errors +- `vf` - The viewer context + +Options Database Key: +- `-adaptor_monitor_error` - Activates `DMAdaptorMonitorError()` + +Level: intermediate + +-seealso: [](ch_snes), `DMAdaptor`, `DMAdaptorMonitorSet()`, `DMAdaptorMonitorErrorDraw()`, `DMAdaptorMonitorErrorDrawLG()` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorError")) +""" +function DMAdaptorMonitorError(petsclib::PetscLibType, adaptor::DMAdaptor, n::PetscInt, odm::PetscDM, adm::PetscDM, Nf::PetscInt, enorms::Vector{PetscReal}, error::PetscVec, vf::PetscViewerAndFormat) end + +@for_petsc function DMAdaptorMonitorError(petsclib::$UnionPetscLib, adaptor::DMAdaptor, n::$PetscInt, odm::PetscDM, adm::PetscDM, Nf::$PetscInt, enorms::Vector{$PetscReal}, error::PetscVec, vf::PetscViewerAndFormat ) + + @chk ccall( + (:DMAdaptorMonitorError, $petsc_library), + PetscErrorCode, + (DMAdaptor, $PetscInt, CDM, CDM, $PetscInt, Ptr{$PetscReal}, CVec, Ptr{PetscViewerAndFormat}), + adaptor, n, odm, adm, Nf, enorms, error, vf, + ) + + + return nothing +end + +""" + DMAdaptorMonitorErrorDraw(petsclib::PetscLibType,adaptor::DMAdaptor, n::PetscInt, odm::PetscDM, adm::PetscDM, Nf::PetscInt, enorms::Vector{PetscReal}, error::PetscVec, vf::PetscViewerAndFormat) +Plots the error at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `adaptor` - the `DMAdaptor` +- `n` - iteration number +- `odm` - the original `DM` +- `adm` - the adapted `DM` +- `Nf` - number of fields +- `enorms` - 2-norm error values for each field (may be estimated). +- `error` - `Vec` of cellwise errors +- `vf` - The viewer context + +Options Database Key: +- `-adaptor_monitor_error draw` - Activates `DMAdaptorMonitorErrorDraw()` + +Level: intermediate + +-seealso: [](ch_snes), `PETSCVIEWERDRAW`, `DMAdaptor`, `DMAdaptorMonitorSet()`, `DMAdaptorMonitorErrorDrawLG()` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorErrorDraw")) +""" +function DMAdaptorMonitorErrorDraw(petsclib::PetscLibType, adaptor::DMAdaptor, n::PetscInt, odm::PetscDM, adm::PetscDM, Nf::PetscInt, enorms::Vector{PetscReal}, error::PetscVec, vf::PetscViewerAndFormat) end + +@for_petsc function DMAdaptorMonitorErrorDraw(petsclib::$UnionPetscLib, adaptor::DMAdaptor, n::$PetscInt, odm::PetscDM, adm::PetscDM, Nf::$PetscInt, enorms::Vector{$PetscReal}, error::PetscVec, vf::PetscViewerAndFormat ) + + @chk ccall( + (:DMAdaptorMonitorErrorDraw, $petsc_library), + PetscErrorCode, + (DMAdaptor, $PetscInt, CDM, CDM, $PetscInt, Ptr{$PetscReal}, CVec, Ptr{PetscViewerAndFormat}), + adaptor, n, odm, adm, Nf, enorms, error, vf, + ) + + + return nothing +end + +""" + vf::PetscViewerAndFormat = DMAdaptorMonitorErrorDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) +Creates the context for the error plotter `DMAdaptorMonitorErrorDrawLG()` + +Collective + +Input Parameters: +- `viewer` - The `PetscViewer` +- `format` - The viewer format +- `ctx` - An optional user context + +Output Parameter: +- `vf` - The viewer context + +Level: intermediate + +-seealso: [](ch_snes), `PETSCVIEWERDRAW`, `PetscViewerMonitorGLSetUp()`, `DMAdaptor`, `DMAdaptorMonitorSet()`, `DMAdaptorMonitorErrorDrawLG()` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorErrorDrawLGCreate")) +""" +function DMAdaptorMonitorErrorDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) end + +@for_petsc function DMAdaptorMonitorErrorDrawLGCreate(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid ) + vf_ = Ref{PetscViewerAndFormat}() + + @chk ccall( + (:DMAdaptorMonitorErrorDrawLGCreate, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerFormat, Ptr{Cvoid}, PetscViewerAndFormat), + viewer, format, ctx, vf_, + ) + + vf = vf_[] + + return vf +end + +""" + DMAdaptorMonitorErrorDrawLG(petsclib::PetscLibType,adaptor::DMAdaptor, n::PetscInt, odm::PetscDM, adm::PetscDM, Nf::PetscInt, enorms::Vector{PetscReal}, error::PetscVec, vf::PetscViewerAndFormat) +Plots the error norm at each iteration of an adaptive loop. + +Collective + +Input Parameters: +- `adaptor` - the `DMAdaptor` +- `n` - iteration number +- `odm` - the original `DM` +- `adm` - the adapted `DM` +- `Nf` - number of fields +- `enorms` - 2-norm error values for each field (may be estimated). +- `error` - `Vec` of cellwise errors +- `vf` - The viewer context, obtained via `DMAdaptorMonitorErrorDrawLGCreate()` + +Options Database Key: +- `-adaptor_error draw::draw_lg` - Activates `DMAdaptorMonitorErrorDrawLG()` + +Level: intermediate + +-seealso: [](ch_snes), `PETSCVIEWERDRAW`, `DMAdaptor`, `DMAdaptorMonitorSet()`, `DMAdaptorMonitorErrorDraw()`, `DMAdaptorMonitorError()`, +`DMAdaptorMonitorTrueResidualDrawLGCreate()` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorErrorDrawLG")) +""" +function DMAdaptorMonitorErrorDrawLG(petsclib::PetscLibType, adaptor::DMAdaptor, n::PetscInt, odm::PetscDM, adm::PetscDM, Nf::PetscInt, enorms::Vector{PetscReal}, error::PetscVec, vf::PetscViewerAndFormat) end + +@for_petsc function DMAdaptorMonitorErrorDrawLG(petsclib::$UnionPetscLib, adaptor::DMAdaptor, n::$PetscInt, odm::PetscDM, adm::PetscDM, Nf::$PetscInt, enorms::Vector{$PetscReal}, error::PetscVec, vf::PetscViewerAndFormat ) + + @chk ccall( + (:DMAdaptorMonitorErrorDrawLG, $petsc_library), + PetscErrorCode, + (DMAdaptor, $PetscInt, CDM, CDM, $PetscInt, Ptr{$PetscReal}, CVec, Ptr{PetscViewerAndFormat}), + adaptor, n, odm, adm, Nf, enorms, error, vf, + ) + + + return nothing +end + +""" + DMAdaptorMonitorRegisterAll(petsclib::PetscLibType) +Registers all of the mesh adaptation monitors in the `SNES` package. + +Not Collective + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `DM`, `DMAdaptorMonitorRegister()`, `DMAdaptorRegister()` + +# External Links +$(_doc_external("DM/DMAdaptorMonitorRegisterAll")) +""" +function DMAdaptorMonitorRegisterAll(petsclib::PetscLibType) end + +@for_petsc function DMAdaptorMonitorRegisterAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMAdaptorMonitorRegisterAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMAdaptorAdapt(petsclib::PetscLibType,adaptor::DMAdaptor, x::PetscVec, strategy::DMAdaptationStrategy, adm::PetscDM, ax::PetscVec) +Creates a new `DM` that is adapted to the problem + +Not Collective + +Input Parameters: +- `adaptor` - The `DMAdaptor` object +- `x` - The global approximate solution +- `strategy` - The adaptation strategy, see `DMAdaptationStrategy` + +Output Parameters: +- `adm` - The adapted `DM` +- `ax` - The adapted solution + +Options Database Keys: +- `-snes_adapt ` - initial, sequential, multigrid +- `-adapt_gradient_view` - View the Clement interpolant of the solution gradient +- `-adapt_hessian_view` - View the Clement interpolant of the solution Hessian +- `-adapt_metric_view` - View the metric tensor for adaptive mesh refinement + +Level: intermediate + +See also: +=== +`DMAdaptor`, `DMAdaptationStrategy`, `DMAdaptorSetSolver()`, `DMAdaptorCreate()` + +# External Links +$(_doc_external("DM/DMAdaptorAdapt")) +""" +function DMAdaptorAdapt(petsclib::PetscLibType, adaptor::DMAdaptor, x::PetscVec, strategy::DMAdaptationStrategy, adm::PetscDM, ax::PetscVec) end + +@for_petsc function DMAdaptorAdapt(petsclib::$UnionPetscLib, adaptor::DMAdaptor, x::PetscVec, strategy::DMAdaptationStrategy, adm::PetscDM, ax::PetscVec ) + adm_ = Ref(adm.ptr) + ax_ = Ref(ax.ptr) + + @chk ccall( + (:DMAdaptorAdapt, $petsc_library), + PetscErrorCode, + (DMAdaptor, CVec, DMAdaptationStrategy, Ptr{CDM}, Ptr{CVec}), + adaptor, x, strategy, adm_, ax_, + ) + + adm.ptr = C_NULL + ax.ptr = C_NULL + + return nothing +end + +""" + DMAdaptorSetMixedSetupFunction(petsclib::PetscLibType,adaptor::DMAdaptor, setupFunc::external) +Set the function setting up the mixed problem + +Not Collective + +Input Parameters: +- `adaptor` - the `DMAdaptor` +- `setupFunc` - the function setting up the mixed problem + +Level: advanced + +-seealso: `DMAdaptor`, `DMAdaptorGetMixedSetupFunction()`, `DMAdaptorAdapt()` + +# External Links +$(_doc_external("DM/DMAdaptorSetMixedSetupFunction")) +""" +function DMAdaptorSetMixedSetupFunction(petsclib::PetscLibType, adaptor::DMAdaptor, setupFunc::external) end + +@for_petsc function DMAdaptorSetMixedSetupFunction(petsclib::$UnionPetscLib, adaptor::DMAdaptor, setupFunc::external ) + + @chk ccall( + (:DMAdaptorSetMixedSetupFunction, $petsc_library), + PetscErrorCode, + (DMAdaptor, external), + adaptor, setupFunc, + ) + + + return nothing +end + +""" + DMAdaptorGetCriterion(petsclib::PetscLibType,adaptor::DMAdaptor, criterion::DMAdaptationCriterion) +Get the adaptation criterion + +Not Collective + +Input Parameter: +- `adaptor` - the `DMAdaptor` + +Output Parameter: +- `criterion` - the criterion for adaptation + +Level: advanced + +-seealso: `DMAdaptor`, `DMAdaptorSetCriterion()`, `DMAdaptationCriterion` + +# External Links +$(_doc_external("DM/DMAdaptorGetCriterion")) +""" +function DMAdaptorGetCriterion(petsclib::PetscLibType, adaptor::DMAdaptor, criterion::DMAdaptationCriterion) end + +@for_petsc function DMAdaptorGetCriterion(petsclib::$UnionPetscLib, adaptor::DMAdaptor, criterion::DMAdaptationCriterion ) + + @chk ccall( + (:DMAdaptorGetCriterion, $petsc_library), + PetscErrorCode, + (DMAdaptor, Ptr{DMAdaptationCriterion}), + adaptor, criterion, + ) + + + return nothing +end + +""" + DMAdaptorSetCriterion(petsclib::PetscLibType,adaptor::DMAdaptor, criterion::DMAdaptationCriterion) +Set the adaptation criterion + +Not Collective + +Input Parameters: +- `adaptor` - the `DMAdaptor` +- `criterion` - the adaptation criterion + +Level: advanced + +-seealso: `DMAdaptor`, `DMAdaptorGetCriterion()`, `DMAdaptationCriterion` + +# External Links +$(_doc_external("DM/DMAdaptorSetCriterion")) +""" +function DMAdaptorSetCriterion(petsclib::PetscLibType, adaptor::DMAdaptor, criterion::DMAdaptationCriterion) end + +@for_petsc function DMAdaptorSetCriterion(petsclib::$UnionPetscLib, adaptor::DMAdaptor, criterion::DMAdaptationCriterion ) + + @chk ccall( + (:DMAdaptorSetCriterion, $petsc_library), + PetscErrorCode, + (DMAdaptor, DMAdaptationCriterion), + adaptor, criterion, + ) + + + return nothing +end + +""" + DMSwarmDataFieldGetEntries(petsclib::PetscLibType,gfield::DMSwarmDataField, data::Cvoid) + +# External Links +$(_doc_external("DM/DMSwarmDataFieldGetEntries")) +""" +function DMSwarmDataFieldGetEntries(petsclib::PetscLibType, gfield::DMSwarmDataField, data::Cvoid) end + +@for_petsc function DMSwarmDataFieldGetEntries(petsclib::$UnionPetscLib, gfield::DMSwarmDataField, data::Cvoid ) + + @chk ccall( + (:DMSwarmDataFieldGetEntries, $petsc_library), + PetscErrorCode, + (DMSwarmDataField, Cvoid), + gfield, data, + ) + + + return nothing +end + +""" + DMSwarmDataFieldRestoreEntries(petsclib::PetscLibType,gfield::DMSwarmDataField, data::Cvoid) + +# External Links +$(_doc_external("DM/DMSwarmDataFieldRestoreEntries")) +""" +function DMSwarmDataFieldRestoreEntries(petsclib::PetscLibType, gfield::DMSwarmDataField, data::Cvoid) end + +@for_petsc function DMSwarmDataFieldRestoreEntries(petsclib::$UnionPetscLib, gfield::DMSwarmDataField, data::Cvoid ) + + @chk ccall( + (:DMSwarmDataFieldRestoreEntries, $petsc_library), + PetscErrorCode, + (DMSwarmDataField, Cvoid), + gfield, data, + ) + + + return nothing +end + +""" + idx::PetscInt = DMSwarmDataBucketGetDMSwarmDataFieldIdByName(petsclib::PetscLibType,db::DMSwarmDataBucket, name::String) + +# External Links +$(_doc_external("DM/DMSwarmDataBucketGetDMSwarmDataFieldIdByName")) +""" +function DMSwarmDataBucketGetDMSwarmDataFieldIdByName(petsclib::PetscLibType, db::DMSwarmDataBucket, name::String) end + +@for_petsc function DMSwarmDataBucketGetDMSwarmDataFieldIdByName(petsclib::$UnionPetscLib, db::DMSwarmDataBucket, name::String ) + idx_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmDataBucketGetDMSwarmDataFieldIdByName, $petsc_library), + PetscErrorCode, + (DMSwarmDataBucket, Ptr{Cchar}, Ptr{$PetscInt}), + db, name, idx_, + ) + + idx = idx_[] + + return idx +end + +""" + DMSwarmDataBucketGetDMSwarmDataFieldByName(petsclib::PetscLibType,db::DMSwarmDataBucket, name::String, gfield::DMSwarmDataField) + +# External Links +$(_doc_external("DM/DMSwarmDataBucketGetDMSwarmDataFieldByName")) +""" +function DMSwarmDataBucketGetDMSwarmDataFieldByName(petsclib::PetscLibType, db::DMSwarmDataBucket, name::String, gfield::DMSwarmDataField) end + +@for_petsc function DMSwarmDataBucketGetDMSwarmDataFieldByName(petsclib::$UnionPetscLib, db::DMSwarmDataBucket, name::String, gfield::DMSwarmDataField ) + + @chk ccall( + (:DMSwarmDataBucketGetDMSwarmDataFieldByName, $petsc_library), + PetscErrorCode, + (DMSwarmDataBucket, Ptr{Cchar}, Ptr{DMSwarmDataField}), + db, name, gfield, + ) + + + return nothing +end + +""" + found::PetscBool = DMSwarmDataBucketQueryDMSwarmDataFieldByName(petsclib::PetscLibType,db::DMSwarmDataBucket, name::String) + +# External Links +$(_doc_external("DM/DMSwarmDataBucketQueryDMSwarmDataFieldByName")) +""" +function DMSwarmDataBucketQueryDMSwarmDataFieldByName(petsclib::PetscLibType, db::DMSwarmDataBucket, name::String) end + +@for_petsc function DMSwarmDataBucketQueryDMSwarmDataFieldByName(petsclib::$UnionPetscLib, db::DMSwarmDataBucket, name::String ) + found_ = Ref{PetscBool}() + + @chk ccall( + (:DMSwarmDataBucketQueryDMSwarmDataFieldByName, $petsc_library), + PetscErrorCode, + (DMSwarmDataBucket, Ptr{Cchar}, Ptr{PetscBool}), + db, name, found_, + ) + + found = found_[] + + return found +end + +""" + DMSwarmSortDestroy(petsclib::PetscLibType,_ctx::DMSwarmSort) + +# External Links +$(_doc_external("DM/DMSwarmSortDestroy")) +""" +function DMSwarmSortDestroy(petsclib::PetscLibType, _ctx::DMSwarmSort) end + +@for_petsc function DMSwarmSortDestroy(petsclib::$UnionPetscLib, _ctx::DMSwarmSort ) + + @chk ccall( + (:DMSwarmSortDestroy, $petsc_library), + PetscErrorCode, + (Ptr{DMSwarmSort},), + _ctx, + ) + + + return nothing +end + +""" + npoints::PetscInt = DMSwarmSortGetNumberOfPointsPerCell(petsclib::PetscLibType,sw::PetscDM, cell::PetscInt) +Returns the number of points in a cell + +Not Collective + +Input Parameters: +- `sw` - a `DMSWARM` objects +- `cell` - the cell number in the cell `DM` + +Output Parameter: +- `npoints` - the number of points in the cell + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmSetType()`, `DMSwarmSortGetAccess()`, `DMSwarmSortGetPointsPerCell()` + +# External Links +$(_doc_external("DM/DMSwarmSortGetNumberOfPointsPerCell")) +""" +function DMSwarmSortGetNumberOfPointsPerCell(petsclib::PetscLibType, sw::PetscDM, cell::PetscInt) end + +@for_petsc function DMSwarmSortGetNumberOfPointsPerCell(petsclib::$UnionPetscLib, sw::PetscDM, cell::$PetscInt ) + npoints_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmSortGetNumberOfPointsPerCell, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}), + sw, cell, npoints_, + ) + + npoints = npoints_[] + + return npoints +end + +""" + DMSwarmSortGetPointsPerCell(petsclib::PetscLibType,sw::PetscDM, cell::PetscInt, npoints::PetscInt, pidlist::PetscInt) +Creates an array of point indices for all points in a cell + +Not Collective + +Input Parameters: +- `sw` - a `DMSWARM` object +- `cell` - the cell number in the cell `DM` +- `npoints` - the number of points in the cell +- `pidlist` - array of the indices identifying all points in cell e + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmSetType()`, `DMSwarmRestorePointsPerCell()`, `DMSwarmSortGetAccess()`, `DMSwarmSortGetNumberOfPointsPerCell()` + +# External Links +$(_doc_external("DM/DMSwarmSortGetPointsPerCell")) +""" +function DMSwarmSortGetPointsPerCell(petsclib::PetscLibType, sw::PetscDM, cell::PetscInt, npoints::PetscInt, pidlist::PetscInt) end + +@for_petsc function DMSwarmSortGetPointsPerCell(petsclib::$UnionPetscLib, sw::PetscDM, cell::$PetscInt, npoints::$PetscInt, pidlist::$PetscInt ) + + @chk ccall( + (:DMSwarmSortGetPointsPerCell, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, $PetscInt), + sw, cell, npoints, pidlist, + ) + + + return nothing +end + +""" + DMSwarmSortRestorePointsPerCell(petsclib::PetscLibType,dm::PetscDM, e::PetscInt, npoints::PetscInt, pidlist::PetscInt) +Restores an array of point indices for all points in a cell + +Not Collective + +Input Parameters: +- `dm` - a `DMSWARM` object +- `e` - the index of the cell +- `npoints` - the number of points in the cell +- `pidlist` - array of the indices identifying all points in cell e + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmSetType()`, `DMSwarmSortGetPointsPerCell()`, `DMSwarmSortGetAccess()`, `DMSwarmSortGetNumberOfPointsPerCell()` + +# External Links +$(_doc_external("DM/DMSwarmSortRestorePointsPerCell")) +""" +function DMSwarmSortRestorePointsPerCell(petsclib::PetscLibType, dm::PetscDM, e::PetscInt, npoints::PetscInt, pidlist::PetscInt) end + +@for_petsc function DMSwarmSortRestorePointsPerCell(petsclib::$UnionPetscLib, dm::PetscDM, e::$PetscInt, npoints::$PetscInt, pidlist::$PetscInt ) + + @chk ccall( + (:DMSwarmSortRestorePointsPerCell, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscInt}, $PetscInt), + dm, e, npoints, pidlist, + ) + + + return nothing +end + +""" + DMSwarmSortGetAccess(petsclib::PetscLibType,sw::PetscDM) +Setups up a `DMSWARM` point sort context for efficient traversal of points within a cell + +Not Collective + +Input Parameter: +- `sw` - a `DMSWARM` object + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmSetType()`, `DMSwarmSortRestoreAccess()` + +# External Links +$(_doc_external("DM/DMSwarmSortGetAccess")) +""" +function DMSwarmSortGetAccess(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmSortGetAccess(petsclib::$UnionPetscLib, sw::PetscDM ) + + @chk ccall( + (:DMSwarmSortGetAccess, $petsc_library), + PetscErrorCode, + (CDM,), + sw, + ) + + + return nothing +end + +""" + DMSwarmSortRestoreAccess(petsclib::PetscLibType,sw::PetscDM) +Invalidates the `DMSWARM` point sorting context previously computed with `DMSwarmSortGetAccess()` + +Not Collective + +Input Parameter: +- `sw` - a `DMSWARM` object + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmSetType()`, `DMSwarmSortGetAccess()` + +# External Links +$(_doc_external("DM/DMSwarmSortRestoreAccess")) +""" +function DMSwarmSortRestoreAccess(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmSortRestoreAccess(petsclib::$UnionPetscLib, sw::PetscDM ) + + @chk ccall( + (:DMSwarmSortRestoreAccess, $petsc_library), + PetscErrorCode, + (CDM,), + sw, + ) + + + return nothing +end + +""" + isvalid::PetscBool = DMSwarmSortGetIsValid(petsclib::PetscLibType,sw::PetscDM) +Gets the isvalid flag associated with a `DMSWARM` point sorting context + +Not Collective + +Input Parameter: +- `sw` - a `DMSWARM` object + +Output Parameter: +- `isvalid` - flag indicating whether the sort context is up-to-date + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmSetType()`, `DMSwarmSortGetAccess()` + +# External Links +$(_doc_external("DM/DMSwarmSortGetIsValid")) +""" +function DMSwarmSortGetIsValid(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmSortGetIsValid(petsclib::$UnionPetscLib, sw::PetscDM ) + isvalid_ = Ref{PetscBool}() + + @chk ccall( + (:DMSwarmSortGetIsValid, $petsc_library), + PetscErrorCode, + (CDM, Ptr{PetscBool}), + sw, isvalid_, + ) + + isvalid = isvalid_[] + + return isvalid +end + +""" + ncells::PetscInt,npoints::PetscInt = DMSwarmSortGetSizes(petsclib::PetscLibType,sw::PetscDM) +Gets the sizes associated with a `DMSWARM` point sorting context + +Not Collective + +Input Parameter: +- `sw` - a `DMSWARM` object + +Output Parameters: +- `ncells` - number of cells within the sort context (pass `NULL` to ignore) +- `npoints` - number of points used to create the sort context (pass `NULL` to ignore) + +Level: advanced + +-seealso: `DMSWARM`, `DMSwarmSetType()`, `DMSwarmSortGetAccess()` + +# External Links +$(_doc_external("DM/DMSwarmSortGetSizes")) +""" +function DMSwarmSortGetSizes(petsclib::PetscLibType, sw::PetscDM) end + +@for_petsc function DMSwarmSortGetSizes(petsclib::$UnionPetscLib, sw::PetscDM ) + ncells_ = Ref{$PetscInt}() + npoints_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmSortGetSizes, $petsc_library), + PetscErrorCode, + (CDM, Ptr{$PetscInt}, Ptr{$PetscInt}), + sw, ncells_, npoints_, + ) + + ncells = ncells_[] + npoints = npoints_[] + + return ncells,npoints +end + +""" + DMSwarmCellDMDestroy(petsclib::PetscLibType,celldm::DMSwarmCellDM) +destroy a `DMSwarmCellDM` + +Collective + +Input Parameter: +- `celldm` - address of `DMSwarmCellDM` + +Level: advanced + +-seealso: `DMSwarmCellDM`, `DMSwarmCellDMCreate()` + +# External Links +$(_doc_external("DM/DMSwarmCellDMDestroy")) +""" +function DMSwarmCellDMDestroy(petsclib::PetscLibType, celldm::DMSwarmCellDM) end + +@for_petsc function DMSwarmCellDMDestroy(petsclib::$UnionPetscLib, celldm::DMSwarmCellDM ) + + @chk ccall( + (:DMSwarmCellDMDestroy, $petsc_library), + PetscErrorCode, + (Ptr{DMSwarmCellDM},), + celldm, + ) + + + return nothing +end + +""" + DMSwarmCellDMView(petsclib::PetscLibType,celldm::DMSwarmCellDM, viewer::PetscViewer) +view a `DMSwarmCellDM` + +Collective + +Input Parameters: +- `celldm` - `DMSwarmCellDM` +- `viewer` - viewer to display field, for example `PETSC_VIEWER_STDOUT_WORLD` + +Level: advanced + +-seealso: `DMSwarmCellDM`, `DMSwarmCellDMCreate()` + +# External Links +$(_doc_external("DM/DMSwarmCellDMView")) +""" +function DMSwarmCellDMView(petsclib::PetscLibType, celldm::DMSwarmCellDM, viewer::PetscViewer) end + +@for_petsc function DMSwarmCellDMView(petsclib::$UnionPetscLib, celldm::DMSwarmCellDM, viewer::PetscViewer ) + + @chk ccall( + (:DMSwarmCellDMView, $petsc_library), + PetscErrorCode, + (DMSwarmCellDM, PetscViewer), + celldm, viewer, + ) + + + return nothing +end + +""" + DMSwarmCellDMGetDM(petsclib::PetscLibType,celldm::DMSwarmCellDM, dm::PetscDM) +Returns the background `DM` for the `DMSwarm` + +Not Collective + +Input Parameter: +- `celldm` - The `DMSwarmCellDM` object + +Output Parameter: +- `dm` - The `DM` object + +Level: intermediate + +-seealso: `DMSwarmCellDM`, `DM`, `DMSwarmSetCellDM()` + +# External Links +$(_doc_external("DM/DMSwarmCellDMGetDM")) +""" +function DMSwarmCellDMGetDM(petsclib::PetscLibType, celldm::DMSwarmCellDM, dm::PetscDM) end + +@for_petsc function DMSwarmCellDMGetDM(petsclib::$UnionPetscLib, celldm::DMSwarmCellDM, dm::PetscDM ) + dm_ = Ref(dm.ptr) + + @chk ccall( + (:DMSwarmCellDMGetDM, $petsc_library), + PetscErrorCode, + (DMSwarmCellDM, Ptr{CDM}), + celldm, dm_, + ) + + dm.ptr = C_NULL + + return nothing +end + +""" + Nf::PetscInt = DMSwarmCellDMGetFields(petsclib::PetscLibType,celldm::DMSwarmCellDM, names::String) +Returns the `DM` fields for the `DMSwarm` + +Not Collective + +Input Parameter: +- `celldm` - The `DMSwarmCellDM` object + +Output Parameters: +- `Nf` - The number of fields +- `names` - The array of field names in the `DMSWARM` + +Level: intermediate + +-seealso: `DMSwarmCellDM`, `DM`, `DMSwarmSetCellDM()` + +# External Links +$(_doc_external("DM/DMSwarmCellDMGetFields")) +""" +function DMSwarmCellDMGetFields(petsclib::PetscLibType, celldm::DMSwarmCellDM, names::String) end + +@for_petsc function DMSwarmCellDMGetFields(petsclib::$UnionPetscLib, celldm::DMSwarmCellDM, names::String ) + Nf_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmCellDMGetFields, $petsc_library), + PetscErrorCode, + (DMSwarmCellDM, Ptr{$PetscInt}, Ptr{Cchar}), + celldm, Nf_, names, + ) + + Nf = Nf_[] + + return Nf +end + +""" + Nfc::PetscInt = DMSwarmCellDMGetCoordinateFields(petsclib::PetscLibType,celldm::DMSwarmCellDM, names::String) +Returns the `DM` coordinate fields for the `DMSwarm` + +Not Collective + +Input Parameter: +- `celldm` - The `DMSwarmCellDM` object + +Output Parameters: +- `Nfc` - The number of coordinate fields +- `names` - The array of coordinate field names in the `DMSWARM` + +Level: intermediate + +-seealso: `DMSwarmCellDM`, `DM`, `DMSwarmSetCellDM()` + +# External Links +$(_doc_external("DM/DMSwarmCellDMGetCoordinateFields")) +""" +function DMSwarmCellDMGetCoordinateFields(petsclib::PetscLibType, celldm::DMSwarmCellDM, names::String) end + +@for_petsc function DMSwarmCellDMGetCoordinateFields(petsclib::$UnionPetscLib, celldm::DMSwarmCellDM, names::String ) + Nfc_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmCellDMGetCoordinateFields, $petsc_library), + PetscErrorCode, + (DMSwarmCellDM, Ptr{$PetscInt}, Ptr{Cchar}), + celldm, Nfc_, names, + ) + + Nfc = Nfc_[] + + return Nfc +end + +""" + DMSwarmCellDMGetCellID(petsclib::PetscLibType,celldm::DMSwarmCellDM, cellid::String) +Returns the cell id field name for the `DMSwarm` + +Not Collective + +Input Parameter: +- `celldm` - The `DMSwarmCellDM` object + +Output Parameters: +- `cellid` - The cell id field name in the `DMSWARM` + +Level: intermediate + +-seealso: `DMSwarmCellDM`, `DM`, `DMSwarmSetCellDM()` + +# External Links +$(_doc_external("DM/DMSwarmCellDMGetCellID")) +""" +function DMSwarmCellDMGetCellID(petsclib::PetscLibType, celldm::DMSwarmCellDM, cellid::String) end + +@for_petsc function DMSwarmCellDMGetCellID(petsclib::$UnionPetscLib, celldm::DMSwarmCellDM, cellid::String ) + cellid_ = Ref(pointer(cellid)) + + @chk ccall( + (:DMSwarmCellDMGetCellID, $petsc_library), + PetscErrorCode, + (DMSwarmCellDM, Ptr{Ptr{Cchar}}), + celldm, cellid_, + ) + + + return nothing +end + +""" + DMSwarmCellDMGetSort(petsclib::PetscLibType,celldm::DMSwarmCellDM, sort::DMSwarmSort) +Returns the sort context over the active `DMSwarmCellDM` for the `DMSwarm` + +Not Collective + +Input Parameter: +- `celldm` - The `DMSwarmCellDM` object + +Output Parameter: +- `sort` - The `DMSwarmSort` object + +Level: intermediate + +-seealso: `DMSwarmCellDM`, `DM`, `DMSwarmSetCellDM()` + +# External Links +$(_doc_external("DM/DMSwarmCellDMGetSort")) +""" +function DMSwarmCellDMGetSort(petsclib::PetscLibType, celldm::DMSwarmCellDM, sort::DMSwarmSort) end + +@for_petsc function DMSwarmCellDMGetSort(petsclib::$UnionPetscLib, celldm::DMSwarmCellDM, sort::DMSwarmSort ) + + @chk ccall( + (:DMSwarmCellDMGetSort, $petsc_library), + PetscErrorCode, + (DMSwarmCellDM, Ptr{DMSwarmSort}), + celldm, sort, + ) + + + return nothing +end + +""" + DMSwarmCellDMSetSort(petsclib::PetscLibType,celldm::DMSwarmCellDM, sort::DMSwarmSort) +Sets the sort context over the active `DMSwarmCellDM` for the `DMSwarm` + +Not Collective + +Input Parameters: +- `celldm` - The `DMSwarmCellDM` object +- `sort` - The `DMSwarmSort` object + +Level: intermediate + +-seealso: `DMSwarmCellDM`, `DM`, `DMSwarmSetCellDM()` + +# External Links +$(_doc_external("DM/DMSwarmCellDMSetSort")) +""" +function DMSwarmCellDMSetSort(petsclib::PetscLibType, celldm::DMSwarmCellDM, sort::DMSwarmSort) end + +@for_petsc function DMSwarmCellDMSetSort(petsclib::$UnionPetscLib, celldm::DMSwarmCellDM, sort::DMSwarmSort ) + + @chk ccall( + (:DMSwarmCellDMSetSort, $petsc_library), + PetscErrorCode, + (DMSwarmCellDM, DMSwarmSort), + celldm, sort, + ) + + + return nothing +end + +""" + bs::PetscInt = DMSwarmCellDMGetBlockSize(petsclib::PetscLibType,celldm::DMSwarmCellDM, sw::PetscDM) +Returns the total blocksize for the `DM` fields + +Not Collective + +Input Parameters: +- `celldm` - The `DMSwarmCellDM` object +- `sw` - The `DMSwarm` object + +Output Parameter: +- `bs` - The total block size + +Level: intermediate + +-seealso: `DMSwarmCellDM`, `DM`, `DMSwarmSetCellDM()` + +# External Links +$(_doc_external("DM/DMSwarmCellDMGetBlockSize")) +""" +function DMSwarmCellDMGetBlockSize(petsclib::PetscLibType, celldm::DMSwarmCellDM, sw::PetscDM) end + +@for_petsc function DMSwarmCellDMGetBlockSize(petsclib::$UnionPetscLib, celldm::DMSwarmCellDM, sw::PetscDM ) + bs_ = Ref{$PetscInt}() + + @chk ccall( + (:DMSwarmCellDMGetBlockSize, $petsc_library), + PetscErrorCode, + (DMSwarmCellDM, CDM, Ptr{$PetscInt}), + celldm, sw, bs_, + ) + + bs = bs_[] + + return bs +end + +""" + celldm::DMSwarmCellDM = DMSwarmCellDMCreate(petsclib::PetscLibType,dm::PetscDM, Nf::PetscInt, dmFields::String, Nfc::PetscInt, coordFields::String) +create a `DMSwarmCellDM` + +Collective + +Input Parameters: +- `dm` - The background `DM` for the `DMSwarm` +- `Nf` - The number of swarm fields defined over `dm` +- `dmFields` - The swarm field names for the `dm` fields +- `Nfc` - The number of swarm fields to use for coordinates over `dm` +- `coordFields` - The swarm field names for the `dm` coordinate fields + +Output Parameter: +- `celldm` - The new `DMSwarmCellDM` + +Level: advanced + +-seealso: `DMSwarmCellDM`, `DMSWARM`, `DMSetType()` + +# External Links +$(_doc_external("DM/DMSwarmCellDMCreate")) +""" +function DMSwarmCellDMCreate(petsclib::PetscLibType, dm::PetscDM, Nf::PetscInt, dmFields::String, Nfc::PetscInt, coordFields::String) end + +@for_petsc function DMSwarmCellDMCreate(petsclib::$UnionPetscLib, dm::PetscDM, Nf::$PetscInt, dmFields::String, Nfc::$PetscInt, coordFields::String ) + dmFields_ = Ref(pointer(dmFields)) + coordFields_ = Ref(pointer(coordFields)) + celldm_ = Ref{DMSwarmCellDM}() + + @chk ccall( + (:DMSwarmCellDMCreate, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{Ptr{Cchar}}, $PetscInt, Ptr{Ptr{Cchar}}, Ptr{DMSwarmCellDM}), + dm, Nf, dmFields_, Nfc, coordFields_, celldm_, + ) + + celldm = celldm_[] + + return celldm +end + +""" + queue::DMPlexPoCintQueue = DMPlexPointQueueCreate(petsclib::PetscLibType,size::PetscInt) + +# External Links +$(_doc_external("DM/DMPlexPointQueueCreate")) +""" +function DMPlexPointQueueCreate(petsclib::PetscLibType, size::PetscInt) end + +@for_petsc function DMPlexPointQueueCreate(petsclib::$UnionPetscLib, size::$PetscInt ) + queue_ = Ref{DMPlexPoCintQueue}() + + @chk ccall( + (:DMPlexPointQueueCreate, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{DMPlexPoCintQueue}), + size, queue_, + ) + + queue = queue_[] + + return queue +end + +""" + DMPlexPointQueueDestroy(petsclib::PetscLibType,queue::DMPlexPoCintQueue) + +# External Links +$(_doc_external("DM/DMPlexPointQueueDestroy")) +""" +function DMPlexPointQueueDestroy(petsclib::PetscLibType, queue::DMPlexPoCintQueue) end + +@for_petsc function DMPlexPointQueueDestroy(petsclib::$UnionPetscLib, queue::DMPlexPoCintQueue ) + + @chk ccall( + (:DMPlexPointQueueDestroy, $petsc_library), + PetscErrorCode, + (Ptr{DMPlexPoCintQueue},), + queue, + ) + + + return nothing +end + +""" + DMPlexPointQueueEnsureSize(petsclib::PetscLibType,queue::DMPlexPoCintQueue) + +# External Links +$(_doc_external("DM/DMPlexPointQueueEnsureSize")) +""" +function DMPlexPointQueueEnsureSize(petsclib::PetscLibType, queue::DMPlexPoCintQueue) end + +@for_petsc function DMPlexPointQueueEnsureSize(petsclib::$UnionPetscLib, queue::DMPlexPoCintQueue ) + + @chk ccall( + (:DMPlexPointQueueEnsureSize, $petsc_library), + PetscErrorCode, + (DMPlexPoCintQueue,), + queue, + ) + + + return nothing +end + +""" + DMPlexPointQueueEnqueue(petsclib::PetscLibType,queue::DMPlexPoCintQueue, p::PetscInt) + +# External Links +$(_doc_external("DM/DMPlexPointQueueEnqueue")) +""" +function DMPlexPointQueueEnqueue(petsclib::PetscLibType, queue::DMPlexPoCintQueue, p::PetscInt) end + +@for_petsc function DMPlexPointQueueEnqueue(petsclib::$UnionPetscLib, queue::DMPlexPoCintQueue, p::$PetscInt ) + + @chk ccall( + (:DMPlexPointQueueEnqueue, $petsc_library), + PetscErrorCode, + (DMPlexPoCintQueue, $PetscInt), + queue, p, + ) + + + return nothing +end + +""" + p::PetscInt = DMPlexPointQueueDequeue(petsclib::PetscLibType,queue::DMPlexPoCintQueue) + +# External Links +$(_doc_external("DM/DMPlexPointQueueDequeue")) +""" +function DMPlexPointQueueDequeue(petsclib::PetscLibType, queue::DMPlexPoCintQueue) end + +@for_petsc function DMPlexPointQueueDequeue(petsclib::$UnionPetscLib, queue::DMPlexPoCintQueue ) + p_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexPointQueueDequeue, $petsc_library), + PetscErrorCode, + (DMPlexPoCintQueue, Ptr{$PetscInt}), + queue, p_, + ) + + p = p_[] + + return p +end + +""" + p::PetscInt = DMPlexPointQueueFront(petsclib::PetscLibType,queue::DMPlexPoCintQueue) + +# External Links +$(_doc_external("DM/DMPlexPointQueueFront")) +""" +function DMPlexPointQueueFront(petsclib::PetscLibType, queue::DMPlexPoCintQueue) end + +@for_petsc function DMPlexPointQueueFront(petsclib::$UnionPetscLib, queue::DMPlexPoCintQueue ) + p_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexPointQueueFront, $petsc_library), + PetscErrorCode, + (DMPlexPoCintQueue, Ptr{$PetscInt}), + queue, p_, + ) + + p = p_[] + + return p +end + +""" + p::PetscInt = DMPlexPointQueueBack(petsclib::PetscLibType,queue::DMPlexPoCintQueue) + +# External Links +$(_doc_external("DM/DMPlexPointQueueBack")) +""" +function DMPlexPointQueueBack(petsclib::PetscLibType, queue::DMPlexPoCintQueue) end + +@for_petsc function DMPlexPointQueueBack(petsclib::$UnionPetscLib, queue::DMPlexPoCintQueue ) + p_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexPointQueueBack, $petsc_library), + PetscErrorCode, + (DMPlexPoCintQueue, Ptr{$PetscInt}), + queue, p_, + ) + + p = p_[] + + return p +end + +""" + empty::PetscBool = DMPlexPointQueueEmptyCollective(petsclib::PetscLibType,obj::PetscObject, queue::DMPlexPoCintQueue) + +# External Links +$(_doc_external("DM/DMPlexPointQueueEmptyCollective")) +""" +function DMPlexPointQueueEmptyCollective(petsclib::PetscLibType, obj::PetscObject, queue::DMPlexPoCintQueue) end + +@for_petsc function DMPlexPointQueueEmptyCollective(petsclib::$UnionPetscLib, obj::PetscObject, queue::DMPlexPoCintQueue ) + empty_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexPointQueueEmptyCollective, $petsc_library), + PetscErrorCode, + (PetscObject, DMPlexPoCintQueue, Ptr{PetscBool}), + obj, queue, empty_, + ) + + empty = empty_[] + + return empty +end + +""" + DMFieldDestroy(petsclib::PetscLibType,field::DMField) +destroy a `DMField` + +Collective + +Input Parameter: +- `field` - address of `DMField` + +Level: advanced + +-seealso: `DMField`, `DMFieldCreate()` + +# External Links +$(_doc_external("DM/DMFieldDestroy")) +""" +function DMFieldDestroy(petsclib::PetscLibType, field::DMField) end + +@for_petsc function DMFieldDestroy(petsclib::$UnionPetscLib, field::DMField ) + + @chk ccall( + (:DMFieldDestroy, $petsc_library), + PetscErrorCode, + (Ptr{DMField},), + field, + ) + + + return nothing +end + +""" + DMFieldView(petsclib::PetscLibType,field::DMField, viewer::PetscViewer) +view a `DMField` + +Collective + +Input Parameters: +- `field` - `DMField` +- `viewer` - viewer to display field, for example `PETSC_VIEWER_STDOUT_WORLD` + +Level: advanced + +-seealso: `DMField`, `DMFieldCreate()` + +# External Links +$(_doc_external("DM/DMFieldView")) +""" +function DMFieldView(petsclib::PetscLibType, field::DMField, viewer::PetscViewer) end + +@for_petsc function DMFieldView(petsclib::$UnionPetscLib, field::DMField, viewer::PetscViewer ) + + @chk ccall( + (:DMFieldView, $petsc_library), + PetscErrorCode, + (DMField, PetscViewer), + field, viewer, + ) + + + return nothing +end + +""" + DMFieldSetType(petsclib::PetscLibType,field::DMField, type::DMFieldType) +set the `DMField` implementation + +Collective + +Input Parameters: +- `field` - the `DMField` context +- `type` - a known method + +Level: advanced + +-seealso: `DMField`, `DMFieldGetType()`, `DMFieldType`, + +# External Links +$(_doc_external("DM/DMFieldSetType")) +""" +function DMFieldSetType(petsclib::PetscLibType, field::DMField, type::DMFieldType) end + +@for_petsc function DMFieldSetType(petsclib::$UnionPetscLib, field::DMField, type::DMFieldType ) + + @chk ccall( + (:DMFieldSetType, $petsc_library), + PetscErrorCode, + (DMField, DMFieldType), + field, type, + ) + + + return nothing +end + +""" + type::DMFieldType = DMFieldGetType(petsclib::PetscLibType,field::DMField) +Gets the `DMFieldType` name (as a string) from the `DMField`. + +Not Collective + +Input Parameter: +- `field` - The `DMField` context + +Output Parameter: +- `type` - The `DMFieldType` name + +Level: advanced + +-seealso: `DMField`, `DMFieldSetType()`, `DMFieldType` + +# External Links +$(_doc_external("DM/DMFieldGetType")) +""" +function DMFieldGetType(petsclib::PetscLibType, field::DMField) end + +@for_petsc function DMFieldGetType(petsclib::$UnionPetscLib, field::DMField ) + type_ = Ref{DMFieldType}() + + @chk ccall( + (:DMFieldGetType, $petsc_library), + PetscErrorCode, + (DMField, Ptr{DMFieldType}), + field, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + nc::PetscInt = DMFieldGetNumComponents(petsclib::PetscLibType,field::DMField) +Returns the number of components in the field + +Not Collective + +Input Parameter: +- `field` - The `DMField` object + +Output Parameter: +- `nc` - The number of field components + +Level: intermediate + +-seealso: `DMField`, `DMFieldEvaluate()` + +# External Links +$(_doc_external("DM/DMFieldGetNumComponents")) +""" +function DMFieldGetNumComponents(petsclib::PetscLibType, field::DMField) end + +@for_petsc function DMFieldGetNumComponents(petsclib::$UnionPetscLib, field::DMField ) + nc_ = Ref{$PetscInt}() + + @chk ccall( + (:DMFieldGetNumComponents, $petsc_library), + PetscErrorCode, + (DMField, Ptr{$PetscInt}), + field, nc_, + ) + + nc = nc_[] + + return nc +end + +""" + DMFieldGetDM(petsclib::PetscLibType,field::DMField, dm::PetscDM) +Returns the `DM` for the manifold over which the field is defined. + +Not Collective + +Input Parameter: +- `field` - The `DMField` object + +Output Parameter: +- `dm` - The `DM` object + +Level: intermediate + +-seealso: `DMField`, `DM`, `DMFieldEvaluate()` + +# External Links +$(_doc_external("DM/DMFieldGetDM")) +""" +function DMFieldGetDM(petsclib::PetscLibType, field::DMField, dm::PetscDM) end + +@for_petsc function DMFieldGetDM(petsclib::$UnionPetscLib, field::DMField, dm::PetscDM ) + dm_ = Ref(dm.ptr) + + @chk ccall( + (:DMFieldGetDM, $petsc_library), + PetscErrorCode, + (DMField, Ptr{CDM}), + field, dm_, + ) + + dm.ptr = C_NULL + + return nothing +end + +""" + DMFieldEvaluate(petsclib::PetscLibType,field::DMField, points::PetscVec, datatype::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid) +Evaluate the field and its derivatives on a set of points + +Collective + +Input Parameters: +- `field` - The `DMField` object +- `points` - The points at which to evaluate the field. Should have size d x n, +where d is the coordinate dimension of the manifold and n is the number +of points +- `datatype` - The PetscDataType of the output arrays: either `PETSC_REAL` or `PETSC_SCALAR`. +If the field is complex and datatype is `PETSC_REAL`, the real part of the +field is returned. + +Output Parameters: +- `B` - pointer to data of size c * n * sizeof(datatype), where c is the number of components in the field. +If B is not `NULL`, the values of the field are written in this array, varying first by component, +then by point. +- `D` - pointer to data of size d * c * n * sizeof(datatype). +If `D` is not `NULL`, the values of the field's spatial derivatives are written in this array, +varying first by the partial derivative component, then by field component, then by point. +- `H` - pointer to data of size d * d * c * n * sizeof(datatype). +If `H` is not `NULL`, the values of the field's second spatial derivatives are written in this array, +varying first by the second partial derivative component, then by field component, then by point. + +Level: intermediate + +-seealso: `DMField`, `DMFieldGetDM()`, `DMFieldGetNumComponents()`, `DMFieldEvaluateFE()`, `DMFieldEvaluateFV()`, `PetscDataType` + +# External Links +$(_doc_external("DM/DMFieldEvaluate")) +""" +function DMFieldEvaluate(petsclib::PetscLibType, field::DMField, points::PetscVec, datatype::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid) end + +@for_petsc function DMFieldEvaluate(petsclib::$UnionPetscLib, field::DMField, points::PetscVec, datatype::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid ) + + @chk ccall( + (:DMFieldEvaluate, $petsc_library), + PetscErrorCode, + (DMField, CVec, PetscDataType, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), + field, points, datatype, B, D, H, + ) + + + return nothing +end + +""" + DMFieldEvaluateFE(petsclib::PetscLibType,field::DMField, cellIS::IS, points::PetscQuadrature, datatype::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid) +Evaluate the field and its derivatives on a set of points mapped from +quadrature points on a reference point. The derivatives are taken with respect to the +reference coordinates. + +Not Collective + +Input Parameters: +- `field` - The `DMField` object +- `cellIS` - Index set for cells on which to evaluate the field +- `points` - The quadature containing the points in the reference cell at which to evaluate the field. +- `datatype` - The PetscDataType of the output arrays: either `PETSC_REAL` or `PETSC_SCALAR`. +If the field is complex and datatype is `PETSC_REAL`, the real part of the +field is returned. + +Output Parameters: +- `B` - pointer to data of size c * n * sizeof(datatype), where c is the number of components in the field. +If B is not `NULL`, the values of the field are written in this array, varying first by component, +then by point. +- `D` - pointer to data of size d * c * n * sizeof(datatype). +If D is not `NULL`, the values of the field's spatial derivatives are written in this array, +varying first by the partial derivative component, then by field component, then by point. +- `H` - pointer to data of size d * d * c * n * sizeof(datatype). +If H is not `NULL`, the values of the field's second spatial derivatives are written in this array, +varying first by the second partial derivative component, then by field component, then by point. + +Level: intermediate + +-seealso: `DMField`, `DM`, `DMFieldGetNumComponents()`, `DMFieldEvaluate()`, `DMFieldEvaluateFV()` + +# External Links +$(_doc_external("DM/DMFieldEvaluateFE")) +""" +function DMFieldEvaluateFE(petsclib::PetscLibType, field::DMField, cellIS::IS, points::PetscQuadrature, datatype::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid) end + +@for_petsc function DMFieldEvaluateFE(petsclib::$UnionPetscLib, field::DMField, cellIS::IS, points::PetscQuadrature, datatype::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid ) + + @chk ccall( + (:DMFieldEvaluateFE, $petsc_library), + PetscErrorCode, + (DMField, CIS, PetscQuadrature, PetscDataType, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), + field, cellIS, points, datatype, B, D, H, + ) + + + return nothing +end + +""" + DMFieldEvaluateFV(petsclib::PetscLibType,field::DMField, cellIS::IS, datatype::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid) +Evaluate the mean of a field and its finite volume derivatives on a set of points. + +Not Collective + +Input Parameters: +- `field` - The `DMField` object +- `cellIS` - Index set for cells on which to evaluate the field +- `datatype` - The PetscDataType of the output arrays: either `PETSC_REAL` or `PETSC_SCALAR`. +If the field is complex and datatype is `PETSC_REAL`, the real part of the +field is returned. + +Output Parameters: +- `B` - pointer to data of size c * n * sizeof(datatype), where c is the number of components in the field. +If B is not `NULL`, the values of the field are written in this array, varying first by component, +then by point. +- `D` - pointer to data of size d * c * n * sizeof(datatype). +If D is not `NULL`, the values of the field's spatial derivatives are written in this array, +varying first by the partial derivative component, then by field component, then by point. +- `H` - pointer to data of size d * d * c * n * sizeof(datatype). +If H is not `NULL`, the values of the field's second spatial derivatives are written in this array, +varying first by the second partial derivative component, then by field component, then by point. + +Level: intermediate + +-seealso: `DMField`, `IS`, `DMFieldGetNumComponents()`, `DMFieldEvaluate()`, `DMFieldEvaluateFE()`, `PetscDataType` + +# External Links +$(_doc_external("DM/DMFieldEvaluateFV")) +""" +function DMFieldEvaluateFV(petsclib::PetscLibType, field::DMField, cellIS::IS, datatype::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid) end + +@for_petsc function DMFieldEvaluateFV(petsclib::$UnionPetscLib, field::DMField, cellIS::IS, datatype::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid ) + + @chk ccall( + (:DMFieldEvaluateFV, $petsc_library), + PetscErrorCode, + (DMField, CIS, PetscDataType, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), + field, cellIS, datatype, B, D, H, + ) + + + return nothing +end + +""" + minDegree::PetscInt,maxDegree::PetscInt = DMFieldGetDegree(petsclib::PetscLibType,field::DMField, cellIS::IS) +Get the polynomial degree of a field when pulled back onto the +reference element + +Not Collective + +Input Parameters: +- `field` - the `DMField` object +- `cellIS` - the index set of points over which we want know the invariance + +Output Parameters: +- `minDegree` - the degree of the largest polynomial space contained in the field on each element +- `maxDegree` - the largest degree of the smallest polynomial space containing the field on any element + +Level: intermediate + +-seealso: `DMField`, `IS`, `DMFieldEvaluateFE()` + +# External Links +$(_doc_external("DM/DMFieldGetDegree")) +""" +function DMFieldGetDegree(petsclib::PetscLibType, field::DMField, cellIS::IS) end + +@for_petsc function DMFieldGetDegree(petsclib::$UnionPetscLib, field::DMField, cellIS::IS ) + minDegree_ = Ref{$PetscInt}() + maxDegree_ = Ref{$PetscInt}() + + @chk ccall( + (:DMFieldGetDegree, $petsc_library), + PetscErrorCode, + (DMField, CIS, Ptr{$PetscInt}, Ptr{$PetscInt}), + field, cellIS, minDegree_, maxDegree_, + ) + + minDegree = minDegree_[] + maxDegree = maxDegree_[] + + return minDegree,maxDegree +end + +""" + quad::PetscQuadrature = DMFieldCreateDefaultQuadrature(petsclib::PetscLibType,field::DMField, pointIS::IS) +Creates a quadrature sufficient to integrate the field on the selected +points via pullback onto the reference element + +Not Collective + +Input Parameters: +- `field` - the `DMField` object +- `pointIS` - the index set of points over which we wish to integrate the field + +Output Parameter: +- `quad` - a `PetscQuadrature` object + +Level: developer + +-seealso: `DMFieldCreateDefaultFaceQuadrature()`, `DMField`, `PetscQuadrature`, `IS`, `DMFieldEvaluteFE()`, `DMFieldGetDegree()` + +# External Links +$(_doc_external("DM/DMFieldCreateDefaultQuadrature")) +""" +function DMFieldCreateDefaultQuadrature(petsclib::PetscLibType, field::DMField, pointIS::IS) end + +@for_petsc function DMFieldCreateDefaultQuadrature(petsclib::$UnionPetscLib, field::DMField, pointIS::IS ) + quad_ = Ref{PetscQuadrature}() + + @chk ccall( + (:DMFieldCreateDefaultQuadrature, $petsc_library), + PetscErrorCode, + (DMField, CIS, Ptr{PetscQuadrature}), + field, pointIS, quad_, + ) + + quad = quad_[] + + return quad +end + +""" + quad::PetscQuadrature = DMFieldCreateDefaultFaceQuadrature(petsclib::PetscLibType,field::DMField, pointIS::IS) +Creates a quadrature sufficient to integrate the field on all faces of the selected cells via pullback onto the reference element + +Not Collective + +Input Parameters: +- `field` - the `DMField` object +- `pointIS` - the index set of points over which we wish to integrate the field over faces + +Output Parameter: +- `quad` - a `PetscQuadrature` object + +Level: developer + +-seealso: `DMFieldCreateDefaultQuadrature()`, `DMField`, `PetscQuadrature`, `IS`, `DMFieldEvaluteFE()`, `DMFieldGetDegree()` + +# External Links +$(_doc_external("DM/DMFieldCreateDefaultFaceQuadrature")) +""" +function DMFieldCreateDefaultFaceQuadrature(petsclib::PetscLibType, field::DMField, pointIS::IS) end + +@for_petsc function DMFieldCreateDefaultFaceQuadrature(petsclib::$UnionPetscLib, field::DMField, pointIS::IS ) + quad_ = Ref{PetscQuadrature}() + + @chk ccall( + (:DMFieldCreateDefaultFaceQuadrature, $petsc_library), + PetscErrorCode, + (DMField, CIS, Ptr{PetscQuadrature}), + field, pointIS, quad_, + ) + + quad = quad_[] + + return quad +end + +""" + geom::PetscFEGeom = DMFieldCreateFEGeom(petsclib::PetscLibType,field::DMField, pointIS::IS, quad::PetscQuadrature, mode::PetscFEGeomMode) +Compute and create the geometric factors of a coordinate field + +Not Collective + +Input Parameters: +- `field` - the `DMField` object +- `pointIS` - the index set of points over which we wish to integrate the field +- `quad` - the quadrature points at which to evaluate the geometric factors +- `mode` - Type of geometry data to store + +Output Parameter: +- `geom` - the geometric factors + +Level: developer + +-seealso: `DMField`, `PetscQuadrature`, `IS`, `PetscFEGeom`, `DMFieldEvaluateFE()`, `DMFieldCreateDefaulteQuadrature()`, `DMFieldGetDegree()` + +# External Links +$(_doc_external("DM/DMFieldCreateFEGeom")) +""" +function DMFieldCreateFEGeom(petsclib::PetscLibType, field::DMField, pointIS::IS, quad::PetscQuadrature, mode::PetscFEGeomMode) end + +@for_petsc function DMFieldCreateFEGeom(petsclib::$UnionPetscLib, field::DMField, pointIS::IS, quad::PetscQuadrature, mode::PetscFEGeomMode ) + geom_ = Ref{PetscFEGeom}() + + @chk ccall( + (:DMFieldCreateFEGeom, $petsc_library), + PetscErrorCode, + (DMField, CIS, PetscQuadrature, PetscFEGeomMode, PetscFEGeom), + field, pointIS, quad, mode, geom_, + ) + + geom = geom_[] + + return geom +end + +""" + DMFieldInitializePackage(petsclib::PetscLibType) +Initialize `DMField` package + +Logically Collective + +Level: developer + +-seealso: `DMFieldFinalizePackage()` + +# External Links +$(_doc_external("DM/DMFieldInitializePackage")) +""" +function DMFieldInitializePackage(petsclib::PetscLibType) end + +@for_petsc function DMFieldInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMFieldInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMFieldFinalizePackage(petsclib::PetscLibType) +Finalize `DMField` package, it is called from `PetscFinalize()` + +Logically Collective + +Level: developer + +-seealso: `DMFieldInitializePackage()` + +# External Links +$(_doc_external("DM/DMFieldFinalizePackage")) +""" +function DMFieldFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function DMFieldFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMFieldFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMFieldRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds an implementation of the `DMField` object. + +Not collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined implementation +- `function` - routine to create method context + +-seealso: `DMField`, `DMFieldRegisterAll()`, `DMFieldRegisterDestroy()` + +# External Links +$(_doc_external("DM/DMFieldRegister")) +""" +function DMFieldRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function DMFieldRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:DMFieldRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + cornerValues::PetscScalar,field::DMField = DMFieldCreateDA(petsclib::PetscLibType,dm::PetscDM, nc::PetscInt) + +# External Links +$(_doc_external("DM/DMFieldCreateDA")) +""" +function DMFieldCreateDA(petsclib::PetscLibType, dm::PetscDM, nc::PetscInt) end + +@for_petsc function DMFieldCreateDA(petsclib::$UnionPetscLib, dm::PetscDM, nc::$PetscInt ) + cornerValues_ = Ref{$PetscScalar}() + field_ = Ref{DMField}() + + @chk ccall( + (:DMFieldCreateDA, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, Ptr{$PetscScalar}, Ptr{DMField}), + dm, nc, cornerValues_, field_, + ) + + cornerValues = cornerValues_[] + field = field_[] + + return cornerValues,field +end + +""" + field::DMField = DMFieldCreateDSWithDG(petsclib::PetscLibType,dm::PetscDM, dmDG::PetscDM, fieldNum::PetscInt, vec::PetscVec, vecDG::PetscVec) + +# External Links +$(_doc_external("DM/DMFieldCreateDSWithDG")) +""" +function DMFieldCreateDSWithDG(petsclib::PetscLibType, dm::PetscDM, dmDG::PetscDM, fieldNum::PetscInt, vec::PetscVec, vecDG::PetscVec) end + +@for_petsc function DMFieldCreateDSWithDG(petsclib::$UnionPetscLib, dm::PetscDM, dmDG::PetscDM, fieldNum::$PetscInt, vec::PetscVec, vecDG::PetscVec ) + field_ = Ref{DMField}() + + @chk ccall( + (:DMFieldCreateDSWithDG, $petsc_library), + PetscErrorCode, + (CDM, CDM, $PetscInt, CVec, CVec, Ptr{DMField}), + dm, dmDG, fieldNum, vec, vecDG, field_, + ) + + field = field_[] + + return field +end + +""" + field::DMField = DMFieldCreateDS(petsclib::PetscLibType,dm::PetscDM, fieldNum::PetscInt, vec::PetscVec) + +# External Links +$(_doc_external("DM/DMFieldCreateDS")) +""" +function DMFieldCreateDS(petsclib::PetscLibType, dm::PetscDM, fieldNum::PetscInt, vec::PetscVec) end + +@for_petsc function DMFieldCreateDS(petsclib::$UnionPetscLib, dm::PetscDM, fieldNum::$PetscInt, vec::PetscVec ) + field_ = Ref{DMField}() + + @chk ccall( + (:DMFieldCreateDS, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, CVec, Ptr{DMField}), + dm, fieldNum, vec, field_, + ) + + field = field_[] + + return field +end + +""" + DMFieldShellGetContext(petsclib::PetscLibType,field::DMField, ctx::Cvoid) + +# External Links +$(_doc_external("DM/DMFieldShellGetContext")) +""" +function DMFieldShellGetContext(petsclib::PetscLibType, field::DMField, ctx::Cvoid) end + +@for_petsc function DMFieldShellGetContext(petsclib::$UnionPetscLib, field::DMField, ctx::Cvoid ) + + @chk ccall( + (:DMFieldShellGetContext, $petsc_library), + PetscErrorCode, + (DMField, Ptr{Cvoid}), + field, ctx, + ) + + + return nothing +end + +""" + DMFieldShellEvaluateFEDefault(petsclib::PetscLibType,field::DMField, pointIS::IS, quad::PetscQuadrature, type::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid) + +# External Links +$(_doc_external("DM/DMFieldShellEvaluateFEDefault")) +""" +function DMFieldShellEvaluateFEDefault(petsclib::PetscLibType, field::DMField, pointIS::IS, quad::PetscQuadrature, type::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid) end + +@for_petsc function DMFieldShellEvaluateFEDefault(petsclib::$UnionPetscLib, field::DMField, pointIS::IS, quad::PetscQuadrature, type::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid ) + + @chk ccall( + (:DMFieldShellEvaluateFEDefault, $petsc_library), + PetscErrorCode, + (DMField, CIS, PetscQuadrature, PetscDataType, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), + field, pointIS, quad, type, B, D, H, + ) + + + return nothing +end + +""" + DMFieldShellEvaluateFVDefault(petsclib::PetscLibType,field::DMField, pointIS::IS, type::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid) + +# External Links +$(_doc_external("DM/DMFieldShellEvaluateFVDefault")) +""" +function DMFieldShellEvaluateFVDefault(petsclib::PetscLibType, field::DMField, pointIS::IS, type::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid) end + +@for_petsc function DMFieldShellEvaluateFVDefault(petsclib::$UnionPetscLib, field::DMField, pointIS::IS, type::PetscDataType, B::Cvoid, D::Cvoid, H::Cvoid ) + + @chk ccall( + (:DMFieldShellEvaluateFVDefault, $petsc_library), + PetscErrorCode, + (DMField, CIS, PetscDataType, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), + field, pointIS, type, B, D, H, + ) + + + return nothing +end + +""" + DMFieldShellSetDestroy(petsclib::PetscLibType,field::DMField, destroy::external) + +# External Links +$(_doc_external("DM/DMFieldShellSetDestroy")) +""" +function DMFieldShellSetDestroy(petsclib::PetscLibType, field::DMField, destroy::external) end + +@for_petsc function DMFieldShellSetDestroy(petsclib::$UnionPetscLib, field::DMField, destroy::external ) + + @chk ccall( + (:DMFieldShellSetDestroy, $petsc_library), + PetscErrorCode, + (DMField, external), + field, destroy, + ) + + + return nothing +end + +""" + DMFieldShellSetEvaluate(petsclib::PetscLibType,field::DMField, evaluate::external) + +# External Links +$(_doc_external("DM/DMFieldShellSetEvaluate")) +""" +function DMFieldShellSetEvaluate(petsclib::PetscLibType, field::DMField, evaluate::external) end + +@for_petsc function DMFieldShellSetEvaluate(petsclib::$UnionPetscLib, field::DMField, evaluate::external ) + + @chk ccall( + (:DMFieldShellSetEvaluate, $petsc_library), + PetscErrorCode, + (DMField, external), + field, evaluate, + ) + + + return nothing +end + +""" + DMFieldShellSetEvaluateFE(petsclib::PetscLibType,field::DMField, evaluateFE::external) + +# External Links +$(_doc_external("DM/DMFieldShellSetEvaluateFE")) +""" +function DMFieldShellSetEvaluateFE(petsclib::PetscLibType, field::DMField, evaluateFE::external) end + +@for_petsc function DMFieldShellSetEvaluateFE(petsclib::$UnionPetscLib, field::DMField, evaluateFE::external ) + + @chk ccall( + (:DMFieldShellSetEvaluateFE, $petsc_library), + PetscErrorCode, + (DMField, external), + field, evaluateFE, + ) + + + return nothing +end + +""" + DMFieldShellSetEvaluateFV(petsclib::PetscLibType,field::DMField, evaluateFV::external) + +# External Links +$(_doc_external("DM/DMFieldShellSetEvaluateFV")) +""" +function DMFieldShellSetEvaluateFV(petsclib::PetscLibType, field::DMField, evaluateFV::external) end + +@for_petsc function DMFieldShellSetEvaluateFV(petsclib::$UnionPetscLib, field::DMField, evaluateFV::external ) + + @chk ccall( + (:DMFieldShellSetEvaluateFV, $petsc_library), + PetscErrorCode, + (DMField, external), + field, evaluateFV, + ) + + + return nothing +end + +""" + DMFieldShellSetGetDegree(petsclib::PetscLibType,field::DMField, getDegree::external) + +# External Links +$(_doc_external("DM/DMFieldShellSetGetDegree")) +""" +function DMFieldShellSetGetDegree(petsclib::PetscLibType, field::DMField, getDegree::external) end + +@for_petsc function DMFieldShellSetGetDegree(petsclib::$UnionPetscLib, field::DMField, getDegree::external ) + + @chk ccall( + (:DMFieldShellSetGetDegree, $petsc_library), + PetscErrorCode, + (DMField, external), + field, getDegree, + ) + + + return nothing +end + +""" + DMFieldShellSetCreateDefaultQuadrature(petsclib::PetscLibType,field::DMField, createDefaultQuadrature::external) + +# External Links +$(_doc_external("DM/DMFieldShellSetCreateDefaultQuadrature")) +""" +function DMFieldShellSetCreateDefaultQuadrature(petsclib::PetscLibType, field::DMField, createDefaultQuadrature::external) end + +@for_petsc function DMFieldShellSetCreateDefaultQuadrature(petsclib::$UnionPetscLib, field::DMField, createDefaultQuadrature::external ) + + @chk ccall( + (:DMFieldShellSetCreateDefaultQuadrature, $petsc_library), + PetscErrorCode, + (DMField, external), + field, createDefaultQuadrature, + ) + + + return nothing +end + +""" + ctx::Cvoid,field::DMField = DMFieldCreateShell(petsclib::PetscLibType,dm::PetscDM, numComponents::PetscInt, continuity::DMFieldContinuity) + +# External Links +$(_doc_external("DM/DMFieldCreateShell")) +""" +function DMFieldCreateShell(petsclib::PetscLibType, dm::PetscDM, numComponents::PetscInt, continuity::DMFieldContinuity) end + +@for_petsc function DMFieldCreateShell(petsclib::$UnionPetscLib, dm::PetscDM, numComponents::$PetscInt, continuity::DMFieldContinuity ) + ctx_ = Ref{Cvoid}() + field_ = Ref{DMField}() + + @chk ccall( + (:DMFieldCreateShell, $petsc_library), + PetscErrorCode, + (CDM, $PetscInt, DMFieldContinuity, Ptr{Cvoid}, Ptr{DMField}), + dm, numComponents, continuity, ctx_, field_, + ) + + ctx = ctx_[] + field = field_[] + + return ctx,field +end + +""" + DMPlexTransformRegisterAll(petsclib::PetscLibType) +Registers all of the transform components in the `DM` package. + +Not Collective + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransformType`, `DMRegisterAll()`, `DMPlexTransformRegisterDestroy()` + +# External Links +$(_doc_external("DM/DMPlexTransformRegisterAll")) +""" +function DMPlexTransformRegisterAll(petsclib::PetscLibType) end + +@for_petsc function DMPlexTransformRegisterAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMPlexTransformRegisterAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMPlexTransformRegisterDestroy(petsclib::PetscLibType) +This function destroys the registered `DMPlexTransformType`. It is called from `PetscFinalize()`. + +Not collective + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMRegisterAll()`, `DMPlexTransformType`, `PetscInitialize()` + +# External Links +$(_doc_external("DM/DMPlexTransformRegisterDestroy")) +""" +function DMPlexTransformRegisterDestroy(petsclib::PetscLibType) end + +@for_petsc function DMPlexTransformRegisterDestroy(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMPlexTransformRegisterDestroy, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + tr::DMPlexTransform = DMPlexTransformCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty transform object. The type can then be set with `DMPlexTransformSetType()`. + +Collective + +Input Parameter: +- `comm` - The communicator for the transform object + +Output Parameter: +- `tr` - The transform object + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformType`, `DMPlexTransformSetType()`, `DMPLEXREFINEREGULAR`, `DMPLEXTRANSFORMFILTER` + +# External Links +$(_doc_external("DM/DMPlexTransformCreate")) +""" +function DMPlexTransformCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function DMPlexTransformCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + tr_ = Ref{DMPlexTransform}() + + @chk ccall( + (:DMPlexTransformCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{DMPlexTransform}), + comm, tr_, + ) + + tr = tr_[] + + return tr +end + +""" + DMPlexTransformSetType(petsclib::PetscLibType,tr::DMPlexTransform, method::DMPlexTransformType) +Sets the particular implementation for a transform. + +Collective + +Input Parameters: +- `tr` - The transform +- `method` - The name of the transform type + +Options Database Key: +- `-dm_plex_transform_type ` - Sets the transform type; see `DMPlexTransformType` + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformType`, `DMPlexTransformGetType()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformSetType")) +""" +function DMPlexTransformSetType(petsclib::PetscLibType, tr::DMPlexTransform, method::DMPlexTransformType) end + +@for_petsc function DMPlexTransformSetType(petsclib::$UnionPetscLib, tr::DMPlexTransform, method::DMPlexTransformType ) + + @chk ccall( + (:DMPlexTransformSetType, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPlexTransformType), + tr, method, + ) + + + return nothing +end + +""" + type::DMPlexTransformType = DMPlexTransformGetType(petsclib::PetscLibType,tr::DMPlexTransform) +Gets the type name (as a string) from the transform. + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `type` - The `DMPlexTransformType` name + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformType`, `DMPlexTransformSetType()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformGetType")) +""" +function DMPlexTransformGetType(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformGetType(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + type_ = Ref{DMPlexTransformType}() + + @chk ccall( + (:DMPlexTransformGetType, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{DMPlexTransformType}), + tr, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + DMPlexTransformView(petsclib::PetscLibType,tr::DMPlexTransform, v::PetscViewer) +Views a `DMPlexTransform` + +Collective + +Input Parameters: +- `tr` - the `DMPlexTransform` object to view +- `v` - the viewer + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformType`, `PetscViewer`, `DMPlexTransformDestroy()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformView")) +""" +function DMPlexTransformView(petsclib::PetscLibType, tr::DMPlexTransform, v::PetscViewer) end + +@for_petsc function DMPlexTransformView(petsclib::$UnionPetscLib, tr::DMPlexTransform, v::PetscViewer ) + + @chk ccall( + (:DMPlexTransformView, $petsc_library), + PetscErrorCode, + (DMPlexTransform, PetscViewer), + tr, v, + ) + + + return nothing +end + +""" + DMPlexTransformSetFromOptions(petsclib::PetscLibType,tr::DMPlexTransform) +Sets parameters in a transform from values in the options database + +Collective + +Input Parameter: +- `tr` - the `DMPlexTransform` object to set options for + +Options Database Keys: +- `-dm_plex_transform_type` - Set the transform type, e.g. refine_regular +- `-dm_plex_transform_label_match_strata` - Only label points of the same stratum as the producing point +- `-dm_plex_transform_label_replica_inc ` - Increment for the label value to be multiplied by the replica number, so that the new label value is oldValue + r * inc +- `-dm_plex_transform_active ` - Name for active mesh label +- `-dm_plex_transform_active_values ` - Values in the active label + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformView()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformSetFromOptions")) +""" +function DMPlexTransformSetFromOptions(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformSetFromOptions(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + + @chk ccall( + (:DMPlexTransformSetFromOptions, $petsc_library), + PetscErrorCode, + (DMPlexTransform,), + tr, + ) + + + return nothing +end + +""" + DMPlexTransformDestroy(petsclib::PetscLibType,tr::DMPlexTransform) +Destroys a `DMPlexTransform` + +Collective + +Input Parameter: +- `tr` - the transform object to destroy + +Level: beginner + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformView()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformDestroy")) +""" +function DMPlexTransformDestroy(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformDestroy(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + + @chk ccall( + (:DMPlexTransformDestroy, $petsc_library), + PetscErrorCode, + (Ptr{DMPlexTransform},), + tr, + ) + + + return nothing +end + +""" + DMPlexTransformSetUp(petsclib::PetscLibType,tr::DMPlexTransform) +Create the tables that drive the transform + +Input Parameter: +- `tr` - The `DMPlexTransform` object + +Level: intermediate + +-seealso: [](plex_transform_table), [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformApply()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformSetUp")) +""" +function DMPlexTransformSetUp(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformSetUp(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + + @chk ccall( + (:DMPlexTransformSetUp, $petsc_library), + PetscErrorCode, + (DMPlexTransform,), + tr, + ) + + + return nothing +end + +""" + DMPlexTransformGetDM(petsclib::PetscLibType,tr::DMPlexTransform, dm::PetscDM) +Get the base `DM` for the transform + +Input Parameter: +- `tr` - The `DMPlexTransform` object + +Output Parameter: +- `dm` - The original `DM` which will be transformed + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformSetDM()`, `DMPlexTransformApply()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformGetDM")) +""" +function DMPlexTransformGetDM(petsclib::PetscLibType, tr::DMPlexTransform, dm::PetscDM) end + +@for_petsc function DMPlexTransformGetDM(petsclib::$UnionPetscLib, tr::DMPlexTransform, dm::PetscDM ) + dm_ = Ref(dm.ptr) + + @chk ccall( + (:DMPlexTransformGetDM, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{CDM}), + tr, dm_, + ) + + dm.ptr = C_NULL + + return nothing +end + +""" + DMPlexTransformSetDM(petsclib::PetscLibType,tr::DMPlexTransform, dm::PetscDM) +Set the base `DM` for the transform + +Input Parameters: +- `tr` - The `DMPlexTransform` object +- `dm` - The original `DM` which will be transformed + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformGetDM()`, `DMPlexTransformApply()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformSetDM")) +""" +function DMPlexTransformSetDM(petsclib::PetscLibType, tr::DMPlexTransform, dm::PetscDM) end + +@for_petsc function DMPlexTransformSetDM(petsclib::$UnionPetscLib, tr::DMPlexTransform, dm::PetscDM ) + + @chk ccall( + (:DMPlexTransformSetDM, $petsc_library), + PetscErrorCode, + (DMPlexTransform, CDM), + tr, dm, + ) + + + return nothing +end + +""" + DMPlexTransformGetActive(petsclib::PetscLibType,tr::DMPlexTransform, active::DMLabel) +Get the `DMLabel` marking the active points for the transform + +Input Parameter: +- `tr` - The `DMPlexTransform` object + +Output Parameter: +- `active` - The `DMLabel` indicating which points will be transformed + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformSetActive()`, `DMPlexTransformApply()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformGetActive")) +""" +function DMPlexTransformGetActive(petsclib::PetscLibType, tr::DMPlexTransform, active::DMLabel) end + +@for_petsc function DMPlexTransformGetActive(petsclib::$UnionPetscLib, tr::DMPlexTransform, active::DMLabel ) + + @chk ccall( + (:DMPlexTransformGetActive, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{DMLabel}), + tr, active, + ) + + + return nothing +end + +""" + DMPlexTransformSetActive(petsclib::PetscLibType,tr::DMPlexTransform, active::DMLabel) +Set the `DMLabel` marking the active points for the transform + +Input Parameters: +- `tr` - The `DMPlexTransform` object +- `active` - The `DMLabel` indicating which points will be transformed + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformGetActive()`, `DMPlexTransformApply()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformSetActive")) +""" +function DMPlexTransformSetActive(petsclib::PetscLibType, tr::DMPlexTransform, active::DMLabel) end + +@for_petsc function DMPlexTransformSetActive(petsclib::$UnionPetscLib, tr::DMPlexTransform, active::DMLabel ) + + @chk ccall( + (:DMPlexTransformSetActive, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMLabel), + tr, active, + ) + + + return nothing +end + +""" + trType::DMLabel = DMPlexTransformGetTransformTypes(petsclib::PetscLibType,tr::DMPlexTransform) +Get the `DMLabel` marking the transform type of each point for the transform + +Input Parameter: +- `tr` - The `DMPlexTransform` object + +Output Parameter: +- `trType` - The `DMLabel` indicating the transform type for each point + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexSetTransformType()`, `DMPlexTransformGetActive()`, `DMPlexTransformApply()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformGetTransformTypes")) +""" +function DMPlexTransformGetTransformTypes(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformGetTransformTypes(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + trType_ = Ref{DMLabel}() + + @chk ccall( + (:DMPlexTransformGetTransformTypes, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{DMLabel}), + tr, trType_, + ) + + trType = trType_[] + + return trType +end + +""" + DMPlexTransformSetTransformTypes(petsclib::PetscLibType,tr::DMPlexTransform, trType::DMLabel) +Set the `DMLabel` marking the transform type of each point for the transform + +Input Parameters: +- `tr` - The `DMPlexTransform` object +- `trType` - The original `DM` which will be transformed + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformGetTransformTypes()`, `DMPlexTransformGetActive())`, `DMPlexTransformApply()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformSetTransformTypes")) +""" +function DMPlexTransformSetTransformTypes(petsclib::PetscLibType, tr::DMPlexTransform, trType::DMLabel) end + +@for_petsc function DMPlexTransformSetTransformTypes(petsclib::$UnionPetscLib, tr::DMPlexTransform, trType::DMLabel ) + + @chk ccall( + (:DMPlexTransformSetTransformTypes, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMLabel), + tr, trType, + ) + + + return nothing +end + +""" + DMPlexTransformSetDimensions(petsclib::PetscLibType,tr::DMPlexTransform, dm::PetscDM, tdm::PetscDM) +Set the dimensions for the transformed `DM` + +Input Parameters: +- `tr` - The `DMPlexTransform` object +- `dm` - The original `DM` + +Output Parameter: +- `tdm` - The transformed `DM` + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformApply()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformSetDimensions")) +""" +function DMPlexTransformSetDimensions(petsclib::PetscLibType, tr::DMPlexTransform, dm::PetscDM, tdm::PetscDM) end + +@for_petsc function DMPlexTransformSetDimensions(petsclib::$UnionPetscLib, tr::DMPlexTransform, dm::PetscDM, tdm::PetscDM ) + + @chk ccall( + (:DMPlexTransformSetDimensions, $petsc_library), + PetscErrorCode, + (DMPlexTransform, CDM, CDM), + tr, dm, tdm, + ) + + + return nothing +end + +""" + pStart::PetscInt,pEnd::PetscInt = DMPlexTransformGetChart(petsclib::PetscLibType,tr::DMPlexTransform) + +# External Links +$(_doc_external("DM/DMPlexTransformGetChart")) +""" +function DMPlexTransformGetChart(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformGetChart(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + pStart_ = Ref{$PetscInt}() + pEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexTransformGetChart, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{$PetscInt}, Ptr{$PetscInt}), + tr, pStart_, pEnd_, + ) + + pStart = pStart_[] + pEnd = pEnd_[] + + return pStart,pEnd +end + +""" + celltype::DMPolytopeType = DMPlexTransformGetCellType(petsclib::PetscLibType,tr::DMPlexTransform, cell::PetscInt) + +# External Links +$(_doc_external("DM/DMPlexTransformGetCellType")) +""" +function DMPlexTransformGetCellType(petsclib::PetscLibType, tr::DMPlexTransform, cell::PetscInt) end + +@for_petsc function DMPlexTransformGetCellType(petsclib::$UnionPetscLib, tr::DMPlexTransform, cell::$PetscInt ) + celltype_ = Ref{DMPolytopeType}() + + @chk ccall( + (:DMPlexTransformGetCellType, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscInt, Ptr{DMPolytopeType}), + tr, cell, celltype_, + ) + + celltype = unsafe_string(celltype_[]) + + return celltype +end + +""" + start::PetscInt,end_::PetscInt = DMPlexTransformGetCellTypeStratum(petsclib::PetscLibType,tr::DMPlexTransform, celltype::DMPolytopeType) + +# External Links +$(_doc_external("DM/DMPlexTransformGetCellTypeStratum")) +""" +function DMPlexTransformGetCellTypeStratum(petsclib::PetscLibType, tr::DMPlexTransform, celltype::DMPolytopeType) end + +@for_petsc function DMPlexTransformGetCellTypeStratum(petsclib::$UnionPetscLib, tr::DMPlexTransform, celltype::DMPolytopeType ) + start_ = Ref{$PetscInt}() + end__ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexTransformGetCellTypeStratum, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, Ptr{$PetscInt}, Ptr{$PetscInt}), + tr, celltype, start_, end__, + ) + + start = start_[] + end_ = end__[] + + return start,end_ +end + +""" + depth::PetscInt = DMPlexTransformGetDepth(petsclib::PetscLibType,tr::DMPlexTransform) + +# External Links +$(_doc_external("DM/DMPlexTransformGetDepth")) +""" +function DMPlexTransformGetDepth(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformGetDepth(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + depth_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexTransformGetDepth, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{$PetscInt}), + tr, depth_, + ) + + depth = depth_[] + + return depth +end + +""" + start::PetscInt,end_::PetscInt = DMPlexTransformGetDepthStratum(petsclib::PetscLibType,tr::DMPlexTransform, depth::PetscInt) + +# External Links +$(_doc_external("DM/DMPlexTransformGetDepthStratum")) +""" +function DMPlexTransformGetDepthStratum(petsclib::PetscLibType, tr::DMPlexTransform, depth::PetscInt) end + +@for_petsc function DMPlexTransformGetDepthStratum(petsclib::$UnionPetscLib, tr::DMPlexTransform, depth::$PetscInt ) + start_ = Ref{$PetscInt}() + end__ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexTransformGetDepthStratum, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + tr, depth, start_, end__, + ) + + start = start_[] + end_ = end__[] + + return start,end_ +end + +""" + match::PetscBool = DMPlexTransformGetMatchStrata(petsclib::PetscLibType,tr::DMPlexTransform) +Get the flag which determines what points get added to the transformed labels + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `match` - If `PETSC_TRUE`, only add produced points at the same stratum as the original point to new labels + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformSetMatchStrata()`, `DMPlexGetPointDepth()` + +# External Links +$(_doc_external("DM/DMPlexTransformGetMatchStrata")) +""" +function DMPlexTransformGetMatchStrata(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformGetMatchStrata(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + match_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexTransformGetMatchStrata, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{PetscBool}), + tr, match_, + ) + + match = match_[] + + return match +end + +""" + DMPlexTransformSetMatchStrata(petsclib::PetscLibType,tr::DMPlexTransform, match::PetscBool) +Set the flag which determines what points get added to the transformed labels + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `match` - If `PETSC_TRUE`, only add produced points at the same stratum as the original point to new labels + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformGetMatchStrata()`, `DMPlexGetPointDepth()` + +# External Links +$(_doc_external("DM/DMPlexTransformSetMatchStrata")) +""" +function DMPlexTransformSetMatchStrata(petsclib::PetscLibType, tr::DMPlexTransform, match::PetscBool) end + +@for_petsc function DMPlexTransformSetMatchStrata(petsclib::$UnionPetscLib, tr::DMPlexTransform, match::PetscBool ) + + @chk ccall( + (:DMPlexTransformSetMatchStrata, $petsc_library), + PetscErrorCode, + (DMPlexTransform, PetscBool), + tr, match, + ) + + + return nothing +end + +""" + pNew::PetscInt = DMPlexTransformGetTargetPoint(petsclib::PetscLibType,tr::DMPlexTransform, ct::DMPolytopeType, ctNew::DMPolytopeType, p::PetscInt, r::PetscInt) +Get the number of a point in the transformed mesh based on information from the original mesh. + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `ct` - The type of the original point which produces the new point +- `ctNew` - The type of the new point +- `p` - The original point which produces the new point +- `r` - The replica number of the new point, meaning it is the rth point of type `ctNew` produced from `p` + +Output Parameter: +- `pNew` - The new point number + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPolytopeType`, `DMPlexTransformGetSourcePoint()`, `DMPlexTransformCellTransform()` + +# External Links +$(_doc_external("DM/DMPlexTransformGetTargetPoint")) +""" +function DMPlexTransformGetTargetPoint(petsclib::PetscLibType, tr::DMPlexTransform, ct::DMPolytopeType, ctNew::DMPolytopeType, p::PetscInt, r::PetscInt) end + +@for_petsc function DMPlexTransformGetTargetPoint(petsclib::$UnionPetscLib, tr::DMPlexTransform, ct::DMPolytopeType, ctNew::DMPolytopeType, p::$PetscInt, r::$PetscInt ) + pNew_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexTransformGetTargetPoint, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, DMPolytopeType, $PetscInt, $PetscInt, Ptr{$PetscInt}), + tr, ct, ctNew, p, r, pNew_, + ) + + pNew = pNew_[] + + return pNew +end + +""" + p::PetscInt,r::PetscInt = DMPlexTransformGetSourcePoint(petsclib::PetscLibType,tr::DMPlexTransform, pNew::PetscInt, ct::DMPolytopeType, ctNew::DMPolytopeType) +Get the number of a point in the original mesh based on information from the transformed mesh. + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `pNew` - The new point number + +Output Parameters: +- `ct` - The type of the original point which produces the new point +- `ctNew` - The type of the new point +- `p` - The original point which produces the new point +- `r` - The replica number of the new point, meaning it is the rth point of type ctNew produced from p + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPolytopeType`, `DMPlexTransformGetTargetPoint()`, `DMPlexTransformCellTransform()` + +# External Links +$(_doc_external("DM/DMPlexTransformGetSourcePoint")) +""" +function DMPlexTransformGetSourcePoint(petsclib::PetscLibType, tr::DMPlexTransform, pNew::PetscInt, ct::DMPolytopeType, ctNew::DMPolytopeType) end + +@for_petsc function DMPlexTransformGetSourcePoint(petsclib::$UnionPetscLib, tr::DMPlexTransform, pNew::$PetscInt, ct::DMPolytopeType, ctNew::DMPolytopeType ) + p_ = Ref{$PetscInt}() + r_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexTransformGetSourcePoint, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscInt, Ptr{DMPolytopeType}, Ptr{DMPolytopeType}, Ptr{$PetscInt}, Ptr{$PetscInt}), + tr, pNew, ct, ctNew, p_, r_, + ) + + p = p_[] + r = r_[] + + return p,r +end + +""" + rt::PetscInt,Nt::PetscInt,size::Vector{PetscInt},cone::Vector{PetscInt},ornt::Vector{PetscInt} = DMPlexTransformCellTransform(petsclib::PetscLibType,tr::DMPlexTransform, source::DMPolytopeType, p::PetscInt, target::Vector{DMPolytopeType}) +Describes the transform of a given source cell into a set of other target cells. These produced cells become the new mesh. + +Input Parameters: +- `tr` - The `DMPlexTransform` object +- `source` - The source cell type +- `p` - The source point, which can also determine the refine type + +Output Parameters: +- `rt` - The refine type for this point +- `Nt` - The number of types produced by this point +- `target` - An array of length `Nt` giving the types produced +- `size` - An array of length `Nt` giving the number of cells of each type produced +- `cone` - An array of length `Nt`*size[t]*coneSize[t] giving the cell type for each point in the cone of each produced point +- `ornt` - An array of length `Nt`*size[t]*coneSize[t] giving the orientation for each point in the cone of each produced point + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPolytopeType`, `DMPlexTransformApply()`, `DMPlexTransformCreate()` + +# External Links +$(_doc_external("DM/DMPlexTransformCellTransform")) +""" +function DMPlexTransformCellTransform(petsclib::PetscLibType, tr::DMPlexTransform, source::DMPolytopeType, p::PetscInt, target::Vector{DMPolytopeType}) end + +@for_petsc function DMPlexTransformCellTransform(petsclib::$UnionPetscLib, tr::DMPlexTransform, source::DMPolytopeType, p::$PetscInt, target::Vector{DMPolytopeType} ) + rt_ = Ref{$PetscInt}() + Nt_ = Ref{$PetscInt}() + target_ = Ref(pointer(target)) + size_ = Ref{Ptr{$PetscInt}}() + cone_ = Ref{Ptr{$PetscInt}}() + ornt_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexTransformCellTransform, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{DMPolytopeType}}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + tr, source, p, rt_, Nt_, target_, size_, cone_, ornt_, + ) + + rt = rt_[] + Nt = Nt_[] + size = unsafe_wrap(Array, size_[], VecGetLocalSize(petsclib, x); own = false) + cone = unsafe_wrap(Array, cone_[], VecGetLocalSize(petsclib, x); own = false) + ornt = unsafe_wrap(Array, ornt_[], VecGetLocalSize(petsclib, x); own = false) + + return rt,Nt,size,cone,ornt +end + +""" + rnew::PetscInt,onew::PetscInt = DMPlexTransformGetSubcellOrientationIdentity(petsclib::PetscLibType,tr::DMPlexTransform, sct::DMPolytopeType, sp::PetscInt, so::PetscInt, tct::DMPolytopeType, r::PetscInt, o::PetscInt) + +# External Links +$(_doc_external("DM/DMPlexTransformGetSubcellOrientationIdentity")) +""" +function DMPlexTransformGetSubcellOrientationIdentity(petsclib::PetscLibType, tr::DMPlexTransform, sct::DMPolytopeType, sp::PetscInt, so::PetscInt, tct::DMPolytopeType, r::PetscInt, o::PetscInt) end + +@for_petsc function DMPlexTransformGetSubcellOrientationIdentity(petsclib::$UnionPetscLib, tr::DMPlexTransform, sct::DMPolytopeType, sp::$PetscInt, so::$PetscInt, tct::DMPolytopeType, r::$PetscInt, o::$PetscInt ) + rnew_ = Ref{$PetscInt}() + onew_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexTransformGetSubcellOrientationIdentity, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, $PetscInt, $PetscInt, DMPolytopeType, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + tr, sct, sp, so, tct, r, o, rnew_, onew_, + ) + + rnew = rnew_[] + onew = onew_[] + + return rnew,onew +end + +""" + rt::PetscInt,Nt::PetscInt,size::Vector{PetscInt},cone::Vector{PetscInt},ornt::Vector{PetscInt} = DMPlexTransformCellTransformIdentity(petsclib::PetscLibType,tr::DMPlexTransform, source::DMPolytopeType, p::PetscInt, target::Vector{DMPolytopeType}) + +# External Links +$(_doc_external("DM/DMPlexTransformCellTransformIdentity")) +""" +function DMPlexTransformCellTransformIdentity(petsclib::PetscLibType, tr::DMPlexTransform, source::DMPolytopeType, p::PetscInt, target::Vector{DMPolytopeType}) end + +@for_petsc function DMPlexTransformCellTransformIdentity(petsclib::$UnionPetscLib, tr::DMPlexTransform, source::DMPolytopeType, p::$PetscInt, target::Vector{DMPolytopeType} ) + rt_ = Ref{$PetscInt}() + Nt_ = Ref{$PetscInt}() + target_ = Ref(pointer(target)) + size_ = Ref{Ptr{$PetscInt}}() + cone_ = Ref{Ptr{$PetscInt}}() + ornt_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexTransformCellTransformIdentity, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{DMPolytopeType}}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + tr, source, p, rt_, Nt_, target_, size_, cone_, ornt_, + ) + + rt = rt_[] + Nt = Nt_[] + size = unsafe_wrap(Array, size_[], VecGetLocalSize(petsclib, x); own = false) + cone = unsafe_wrap(Array, cone_[], VecGetLocalSize(petsclib, x); own = false) + ornt = unsafe_wrap(Array, ornt_[], VecGetLocalSize(petsclib, x); own = false) + + return rt,Nt,size,cone,ornt +end + +""" + rnew::PetscInt,onew::PetscInt = DMPlexTransformGetSubcellOrientation(petsclib::PetscLibType,tr::DMPlexTransform, sct::DMPolytopeType, sp::PetscInt, so::PetscInt, tct::DMPolytopeType, r::PetscInt, o::PetscInt) +Transform the replica number and orientation for a target point according to the group action for the source point + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `sct` - The source point cell type, from whom the new cell is being produced +- `sp` - The source point +- `so` - The orientation of the source point in its enclosing parent +- `tct` - The target point cell type +- `r` - The replica number requested for the produced cell type +- `o` - The orientation of the replica + +Output Parameters: +- `rnew` - The replica number, given the orientation of the parent +- `onew` - The replica orientation, given the orientation of the parent + +Level: advanced + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPolytopeType`, `DMPlexTransformCellTransform()`, `DMPlexTransformApply()` + +# External Links +$(_doc_external("DM/DMPlexTransformGetSubcellOrientation")) +""" +function DMPlexTransformGetSubcellOrientation(petsclib::PetscLibType, tr::DMPlexTransform, sct::DMPolytopeType, sp::PetscInt, so::PetscInt, tct::DMPolytopeType, r::PetscInt, o::PetscInt) end + +@for_petsc function DMPlexTransformGetSubcellOrientation(petsclib::$UnionPetscLib, tr::DMPlexTransform, sct::DMPolytopeType, sp::$PetscInt, so::$PetscInt, tct::DMPolytopeType, r::$PetscInt, o::$PetscInt ) + rnew_ = Ref{$PetscInt}() + onew_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexTransformGetSubcellOrientation, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, $PetscInt, $PetscInt, DMPolytopeType, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + tr, sct, sp, so, tct, r, o, rnew_, onew_, + ) + + rnew = rnew_[] + onew = onew_[] + + return rnew,onew +end + +""" + coneSize::PetscInt = DMPlexTransformGetConeSize(petsclib::PetscLibType,tr::DMPlexTransform, q::PetscInt) + +# External Links +$(_doc_external("DM/DMPlexTransformGetConeSize")) +""" +function DMPlexTransformGetConeSize(petsclib::PetscLibType, tr::DMPlexTransform, q::PetscInt) end + +@for_petsc function DMPlexTransformGetConeSize(petsclib::$UnionPetscLib, tr::DMPlexTransform, q::$PetscInt ) + coneSize_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexTransformGetConeSize, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscInt, Ptr{$PetscInt}), + tr, q, coneSize_, + ) + + coneSize = coneSize_[] + + return coneSize +end + +""" + cone::Vector{PetscInt},ornt::Vector{PetscInt} = DMPlexTransformGetConeOriented(petsclib::PetscLibType,tr::DMPlexTransform, q::PetscInt, po::PetscInt) + +# External Links +$(_doc_external("DM/DMPlexTransformGetConeOriented")) +""" +function DMPlexTransformGetConeOriented(petsclib::PetscLibType, tr::DMPlexTransform, q::PetscInt, po::PetscInt) end + +@for_petsc function DMPlexTransformGetConeOriented(petsclib::$UnionPetscLib, tr::DMPlexTransform, q::$PetscInt, po::$PetscInt ) + cone_ = Ref{Ptr{$PetscInt}}() + ornt_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexTransformGetConeOriented, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscInt, $PetscInt, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + tr, q, po, cone_, ornt_, + ) + + cone = unsafe_wrap(Array, cone_[], VecGetLocalSize(petsclib, x); own = false) + ornt = unsafe_wrap(Array, ornt_[], VecGetLocalSize(petsclib, x); own = false) + + return cone,ornt +end + +""" + cone::Vector{PetscInt},ornt::Vector{PetscInt} = DMPlexTransformGetCone(petsclib::PetscLibType,tr::DMPlexTransform, q::PetscInt) + +# External Links +$(_doc_external("DM/DMPlexTransformGetCone")) +""" +function DMPlexTransformGetCone(petsclib::PetscLibType, tr::DMPlexTransform, q::PetscInt) end + +@for_petsc function DMPlexTransformGetCone(petsclib::$UnionPetscLib, tr::DMPlexTransform, q::$PetscInt ) + cone_ = Ref{Ptr{$PetscInt}}() + ornt_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexTransformGetCone, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscInt, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + tr, q, cone_, ornt_, + ) + + cone = unsafe_wrap(Array, cone_[], VecGetLocalSize(petsclib, x); own = false) + ornt = unsafe_wrap(Array, ornt_[], VecGetLocalSize(petsclib, x); own = false) + + return cone,ornt +end + +""" + cone::Vector{PetscInt},ornt::Vector{PetscInt} = DMPlexTransformRestoreCone(petsclib::PetscLibType,tr::DMPlexTransform, q::PetscInt) + +# External Links +$(_doc_external("DM/DMPlexTransformRestoreCone")) +""" +function DMPlexTransformRestoreCone(petsclib::PetscLibType, tr::DMPlexTransform, q::PetscInt) end + +@for_petsc function DMPlexTransformRestoreCone(petsclib::$UnionPetscLib, tr::DMPlexTransform, q::$PetscInt ) + cone_ = Ref{Ptr{$PetscInt}}() + ornt_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexTransformRestoreCone, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscInt, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + tr, q, cone_, ornt_, + ) + + cone = unsafe_wrap(Array, cone_[], VecGetLocalSize(petsclib, x); own = false) + ornt = unsafe_wrap(Array, ornt_[], VecGetLocalSize(petsclib, x); own = false) + + return cone,ornt +end + +""" + Nv::PetscInt,trVerts::Vector{PetscScalar} = DMPlexTransformGetCellVertices(petsclib::PetscLibType,tr::DMPlexTransform, ct::DMPolytopeType) +Get the set of transformed vertices lying in the closure of a reference cell of given type + +Input Parameters: +- `tr` - The `DMPlexTransform` object +- `ct` - The cell type + +Output Parameters: +- `Nv` - The number of transformed vertices in the closure of the reference cell of given type +- `trVerts` - The coordinates of these vertices in the reference cell + +Level: developer + +-seealso: `DMPLEX`, `DMPlexTransform`, `DMPolytopeType`, `DMPlexTransformGetSubcellVertices()` + +# External Links +$(_doc_external("DM/DMPlexTransformGetCellVertices")) +""" +function DMPlexTransformGetCellVertices(petsclib::PetscLibType, tr::DMPlexTransform, ct::DMPolytopeType) end + +@for_petsc function DMPlexTransformGetCellVertices(petsclib::$UnionPetscLib, tr::DMPlexTransform, ct::DMPolytopeType ) + Nv_ = Ref{$PetscInt}() + trVerts_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:DMPlexTransformGetCellVertices, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + tr, ct, Nv_, trVerts_, + ) + + Nv = Nv_[] + trVerts = unsafe_wrap(Array, trVerts_[], VecGetLocalSize(petsclib, x); own = false) + + return Nv,trVerts +end + +""" + subVerts::Vector{PetscInt} = DMPlexTransformGetSubcellVertices(petsclib::PetscLibType,tr::DMPlexTransform, ct::DMPolytopeType, rct::DMPolytopeType, r::PetscInt) +Get the set of transformed vertices defining a subcell in the reference cell of given type + +Input Parameters: +- `tr` - The `DMPlexTransform` object +- `ct` - The cell type +- `rct` - The subcell type +- `r` - The subcell index + +Output Parameter: +- `subVerts` - The indices of these vertices in the set of vertices returned by `DMPlexTransformGetCellVertices()` + +Level: developer + +-seealso: `DMPLEX`, `DMPlexTransform`, `DMPolytopeType`, `DMPlexTransformGetCellVertices()` + +# External Links +$(_doc_external("DM/DMPlexTransformGetSubcellVertices")) +""" +function DMPlexTransformGetSubcellVertices(petsclib::PetscLibType, tr::DMPlexTransform, ct::DMPolytopeType, rct::DMPolytopeType, r::PetscInt) end + +@for_petsc function DMPlexTransformGetSubcellVertices(petsclib::$UnionPetscLib, tr::DMPlexTransform, ct::DMPolytopeType, rct::DMPolytopeType, r::$PetscInt ) + subVerts_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:DMPlexTransformGetSubcellVertices, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, DMPolytopeType, $PetscInt, Ptr{Ptr{$PetscInt}}), + tr, ct, rct, r, subVerts_, + ) + + subVerts = unsafe_wrap(Array, subVerts_[], VecGetLocalSize(petsclib, x); own = false) + + return subVerts +end + +""" + out::Vector{PetscScalar} = DMPlexTransformMapCoordinates(petsclib::PetscLibType,tr::DMPlexTransform, pct::DMPolytopeType, ct::DMPolytopeType, p::PetscInt, r::PetscInt, Nv::PetscInt, dE::PetscInt, in::Vector{PetscScalar}) +Calculate new coordinates for produced points + +Not collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `pct` - The cell type of the parent, from whom the new cell is being produced +- `ct` - The type being produced +- `p` - The original point +- `r` - The replica number requested for the produced cell type +- `Nv` - Number of vertices in the closure of the parent cell +- `dE` - Spatial dimension +- `in` - array of size Nv*dE, holding coordinates of the vertices in the closure of the parent cell + +Output Parameter: +- `out` - The coordinates of the new vertices + +Level: intermediate + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPolytopeType`, `DMPlexTransformApply()` + +# External Links +$(_doc_external("DM/DMPlexTransformMapCoordinates")) +""" +function DMPlexTransformMapCoordinates(petsclib::PetscLibType, tr::DMPlexTransform, pct::DMPolytopeType, ct::DMPolytopeType, p::PetscInt, r::PetscInt, Nv::PetscInt, dE::PetscInt, in::Vector{PetscScalar}) end + +@for_petsc function DMPlexTransformMapCoordinates(petsclib::$UnionPetscLib, tr::DMPlexTransform, pct::DMPolytopeType, ct::DMPolytopeType, p::$PetscInt, r::$PetscInt, Nv::$PetscInt, dE::$PetscInt, in::Vector{$PetscScalar} ) + out = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMPlexTransformMapCoordinates, $petsc_library), + PetscErrorCode, + (DMPlexTransform, DMPolytopeType, DMPolytopeType, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + tr, pct, ct, p, r, Nv, dE, in, out, + ) + + + return out +end + +""" + DMPlexTransformCreateDiscLabels(petsclib::PetscLibType,tr::DMPlexTransform, rdm::PetscDM) + +# External Links +$(_doc_external("DM/DMPlexTransformCreateDiscLabels")) +""" +function DMPlexTransformCreateDiscLabels(petsclib::PetscLibType, tr::DMPlexTransform, rdm::PetscDM) end + +@for_petsc function DMPlexTransformCreateDiscLabels(petsclib::$UnionPetscLib, tr::DMPlexTransform, rdm::PetscDM ) + + @chk ccall( + (:DMPlexTransformCreateDiscLabels, $petsc_library), + PetscErrorCode, + (DMPlexTransform, CDM), + tr, rdm, + ) + + + return nothing +end + +""" + DMPlexTransformApply(petsclib::PetscLibType,tr::DMPlexTransform, dm::PetscDM, tdm::PetscDM) +Execute the transformation, producing another `DM` + +Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` object +- `dm` - The original `DM` + +Output Parameter: +- `tdm` - The transformed `DM` + +Level: intermediate + +Options Database Keys: +- `-dm_plex_transform_label_match_strata` - Only label points of the same stratum as the producing point +- `-dm_plex_transform_label_replica_inc ` - Increment for the label value to be multiplied by the replica number +- `-dm_plex_transform_active ` - Name for active mesh label + +-seealso: [](plex_transform_table), [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexTransform`, `DMPlexTransformCreate()`, `DMPlexTransformSetDM()` + +# External Links +$(_doc_external("DM/DMPlexTransformApply")) +""" +function DMPlexTransformApply(petsclib::PetscLibType, tr::DMPlexTransform, dm::PetscDM, tdm::PetscDM) end + +@for_petsc function DMPlexTransformApply(petsclib::$UnionPetscLib, tr::DMPlexTransform, dm::PetscDM, tdm::PetscDM ) + tdm_ = Ref(tdm.ptr) + + @chk ccall( + (:DMPlexTransformApply, $petsc_library), + PetscErrorCode, + (DMPlexTransform, CDM, Ptr{CDM}), + tr, dm, tdm_, + ) + + tdm.ptr = C_NULL + + return nothing +end + +""" + DMPlexTransformAdaptLabel(petsclib::PetscLibType,dm::PetscDM, metric::PetscVec, adaptLabel::DMLabel, rgLabel::DMLabel, rdm::PetscDM) + +# External Links +$(_doc_external("DM/DMPlexTransformAdaptLabel")) +""" +function DMPlexTransformAdaptLabel(petsclib::PetscLibType, dm::PetscDM, metric::PetscVec, adaptLabel::DMLabel, rgLabel::DMLabel, rdm::PetscDM) end + +@for_petsc function DMPlexTransformAdaptLabel(petsclib::$UnionPetscLib, dm::PetscDM, metric::PetscVec, adaptLabel::DMLabel, rgLabel::DMLabel, rdm::PetscDM ) + rdm_ = Ref(rdm.ptr) + + @chk ccall( + (:DMPlexTransformAdaptLabel, $petsc_library), + PetscErrorCode, + (CDM, CVec, DMLabel, DMLabel, Ptr{CDM}), + dm, metric, adaptLabel, rgLabel, rdm_, + ) + + rdm.ptr = C_NULL + + return nothing +end + +""" + useTensor::PetscBool = DMPlexTransformCohesiveExtrudeGetTensor(petsclib::PetscLibType,tr::DMPlexTransform) +Get the flag to use tensor cells + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `useTensor` - The flag to use tensor cells + +-seealso: `DMPlexTransform`, `DMPlexTransformCohesiveExtrudeSetTensor()`, `DMPlexTransformExtrudeGetTensor()` + +# External Links +$(_doc_external("DM/DMPlexTransformCohesiveExtrudeGetTensor")) +""" +function DMPlexTransformCohesiveExtrudeGetTensor(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformCohesiveExtrudeGetTensor(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + useTensor_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexTransformCohesiveExtrudeGetTensor, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{PetscBool}), + tr, useTensor_, + ) + + useTensor = useTensor_[] + + return useTensor +end + +""" + DMPlexTransformCohesiveExtrudeSetTensor(petsclib::PetscLibType,tr::DMPlexTransform, useTensor::PetscBool) +Set the flag to use tensor cells + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `useTensor` - The flag for tensor cells + +-seealso: `DMPlexTransform`, `DMPlexTransformCohesiveExtrudeGetTensor()`, `DMPlexTransformExtrudeSetTensor()` + +# External Links +$(_doc_external("DM/DMPlexTransformCohesiveExtrudeSetTensor")) +""" +function DMPlexTransformCohesiveExtrudeSetTensor(petsclib::PetscLibType, tr::DMPlexTransform, useTensor::PetscBool) end + +@for_petsc function DMPlexTransformCohesiveExtrudeSetTensor(petsclib::$UnionPetscLib, tr::DMPlexTransform, useTensor::PetscBool ) + + @chk ccall( + (:DMPlexTransformCohesiveExtrudeSetTensor, $petsc_library), + PetscErrorCode, + (DMPlexTransform, PetscBool), + tr, useTensor, + ) + + + return nothing +end + +""" + width::PetscReal = DMPlexTransformCohesiveExtrudeGetWidth(petsclib::PetscLibType,tr::DMPlexTransform) +Get the width of extruded cells + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `width` - The width of extruded cells, or 0. + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformCohesiveExtrudeSetWidth()` + +# External Links +$(_doc_external("DM/DMPlexTransformCohesiveExtrudeGetWidth")) +""" +function DMPlexTransformCohesiveExtrudeGetWidth(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformCohesiveExtrudeGetWidth(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + width_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexTransformCohesiveExtrudeGetWidth, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{$PetscReal}), + tr, width_, + ) + + width = width_[] + + return width +end + +""" + DMPlexTransformCohesiveExtrudeSetWidth(petsclib::PetscLibType,tr::DMPlexTransform, width::PetscReal) +Set the width of extruded cells + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `width` - The width of the extruded cells, or 0. + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformCohesiveExtrudeGetWidth()` + +# External Links +$(_doc_external("DM/DMPlexTransformCohesiveExtrudeSetWidth")) +""" +function DMPlexTransformCohesiveExtrudeSetWidth(petsclib::PetscLibType, tr::DMPlexTransform, width::PetscReal) end + +@for_petsc function DMPlexTransformCohesiveExtrudeSetWidth(petsclib::$UnionPetscLib, tr::DMPlexTransform, width::$PetscReal ) + + @chk ccall( + (:DMPlexTransformCohesiveExtrudeSetWidth, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscReal), + tr, width, + ) + + + return nothing +end + +""" + DMPlexTransformCohesiveExtrudeGetUnsplit(petsclib::PetscLibType,tr::DMPlexTransform, unsplit::DMLabel) +Get a new label marking the unsplit points in the transformed mesh + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `unsplit` - A new `DMLabel` marking the unsplit points in the transformed mesh + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformGetTransformTypes()` + +# External Links +$(_doc_external("DM/DMPlexTransformCohesiveExtrudeGetUnsplit")) +""" +function DMPlexTransformCohesiveExtrudeGetUnsplit(petsclib::PetscLibType, tr::DMPlexTransform, unsplit::DMLabel) end + +@for_petsc function DMPlexTransformCohesiveExtrudeGetUnsplit(petsclib::$UnionPetscLib, tr::DMPlexTransform, unsplit::DMLabel ) + + @chk ccall( + (:DMPlexTransformCohesiveExtrudeGetUnsplit, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{DMLabel}), + tr, unsplit, + ) + + + return nothing +end + +""" + layers::PetscInt = DMPlexTransformExtrudeGetLayers(petsclib::PetscLibType,tr::DMPlexTransform) +Get the number of extruded layers. + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `layers` - The number of layers + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeSetLayers()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeGetLayers")) +""" +function DMPlexTransformExtrudeGetLayers(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformExtrudeGetLayers(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + layers_ = Ref{$PetscInt}() + + @chk ccall( + (:DMPlexTransformExtrudeGetLayers, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{$PetscInt}), + tr, layers_, + ) + + layers = layers_[] + + return layers +end + +""" + DMPlexTransformExtrudeSetLayers(petsclib::PetscLibType,tr::DMPlexTransform, layers::PetscInt) +Set the number of extruded layers. + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `layers` - The number of layers + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeGetLayers()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeSetLayers")) +""" +function DMPlexTransformExtrudeSetLayers(petsclib::PetscLibType, tr::DMPlexTransform, layers::PetscInt) end + +@for_petsc function DMPlexTransformExtrudeSetLayers(petsclib::$UnionPetscLib, tr::DMPlexTransform, layers::$PetscInt ) + + @chk ccall( + (:DMPlexTransformExtrudeSetLayers, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscInt), + tr, layers, + ) + + + return nothing +end + +""" + thickness::PetscReal = DMPlexTransformExtrudeGetThickness(petsclib::PetscLibType,tr::DMPlexTransform) +Get the total thickness of the layers + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `thickness` - The total thickness of the layers + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeSetThickness()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeGetThickness")) +""" +function DMPlexTransformExtrudeGetThickness(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformExtrudeGetThickness(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + thickness_ = Ref{$PetscReal}() + + @chk ccall( + (:DMPlexTransformExtrudeGetThickness, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{$PetscReal}), + tr, thickness_, + ) + + thickness = thickness_[] + + return thickness +end + +""" + DMPlexTransformExtrudeSetThickness(petsclib::PetscLibType,tr::DMPlexTransform, thickness::PetscReal) +Set the total thickness of the layers + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `thickness` - The total thickness of the layers + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeGetThickness()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeSetThickness")) +""" +function DMPlexTransformExtrudeSetThickness(petsclib::PetscLibType, tr::DMPlexTransform, thickness::PetscReal) end + +@for_petsc function DMPlexTransformExtrudeSetThickness(petsclib::$UnionPetscLib, tr::DMPlexTransform, thickness::$PetscReal ) + + @chk ccall( + (:DMPlexTransformExtrudeSetThickness, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscReal), + tr, thickness, + ) + + + return nothing +end + +""" + useTensor::PetscBool = DMPlexTransformExtrudeGetTensor(petsclib::PetscLibType,tr::DMPlexTransform) +Get the flag to use tensor cells + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `useTensor` - The flag to use tensor cells + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeSetTensor()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeGetTensor")) +""" +function DMPlexTransformExtrudeGetTensor(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformExtrudeGetTensor(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + useTensor_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexTransformExtrudeGetTensor, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{PetscBool}), + tr, useTensor_, + ) + + useTensor = useTensor_[] + + return useTensor +end + +""" + DMPlexTransformExtrudeSetTensor(petsclib::PetscLibType,tr::DMPlexTransform, useTensor::PetscBool) +Set the flag to use tensor cells + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `useTensor` - The flag for tensor cells + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeGetTensor()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeSetTensor")) +""" +function DMPlexTransformExtrudeSetTensor(petsclib::PetscLibType, tr::DMPlexTransform, useTensor::PetscBool) end + +@for_petsc function DMPlexTransformExtrudeSetTensor(petsclib::$UnionPetscLib, tr::DMPlexTransform, useTensor::PetscBool ) + + @chk ccall( + (:DMPlexTransformExtrudeSetTensor, $petsc_library), + PetscErrorCode, + (DMPlexTransform, PetscBool), + tr, useTensor, + ) + + + return nothing +end + +""" + symmetric::PetscBool = DMPlexTransformExtrudeGetSymmetric(petsclib::PetscLibType,tr::DMPlexTransform) +Get the flag to extrude symmetrically from the initial surface + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `symmetric` - The flag to extrude symmetrically + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeSetSymmetric()`, `DMPlexTransformExtrudeGetPeriodic()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeGetSymmetric")) +""" +function DMPlexTransformExtrudeGetSymmetric(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformExtrudeGetSymmetric(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + symmetric_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexTransformExtrudeGetSymmetric, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{PetscBool}), + tr, symmetric_, + ) + + symmetric = symmetric_[] + + return symmetric +end + +""" + DMPlexTransformExtrudeSetSymmetric(petsclib::PetscLibType,tr::DMPlexTransform, symmetric::PetscBool) +Set the flag to extrude symmetrically from the initial surface + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `symmetric` - The flag to extrude symmetrically + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeGetSymmetric()`, `DMPlexTransformExtrudeSetPeriodic()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeSetSymmetric")) +""" +function DMPlexTransformExtrudeSetSymmetric(petsclib::PetscLibType, tr::DMPlexTransform, symmetric::PetscBool) end + +@for_petsc function DMPlexTransformExtrudeSetSymmetric(petsclib::$UnionPetscLib, tr::DMPlexTransform, symmetric::PetscBool ) + + @chk ccall( + (:DMPlexTransformExtrudeSetSymmetric, $petsc_library), + PetscErrorCode, + (DMPlexTransform, PetscBool), + tr, symmetric, + ) + + + return nothing +end + +""" + periodic::PetscBool = DMPlexTransformExtrudeGetPeriodic(petsclib::PetscLibType,tr::DMPlexTransform) +Get the flag to extrude periodically from the initial surface + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `periodic` - The flag to extrude periodically + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeSetPeriodic()`, `DMPlexTransformExtrudeGetSymmetric()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeGetPeriodic")) +""" +function DMPlexTransformExtrudeGetPeriodic(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformExtrudeGetPeriodic(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + periodic_ = Ref{PetscBool}() + + @chk ccall( + (:DMPlexTransformExtrudeGetPeriodic, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{PetscBool}), + tr, periodic_, + ) + + periodic = periodic_[] + + return periodic +end + +""" + DMPlexTransformExtrudeSetPeriodic(petsclib::PetscLibType,tr::DMPlexTransform, periodic::PetscBool) +Set the flag to extrude periodically from the initial surface + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `periodic` - The flag to extrude periodically + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeGetPeriodic()`, `DMPlexTransformExtrudeSetSymmetric()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeSetPeriodic")) +""" +function DMPlexTransformExtrudeSetPeriodic(petsclib::PetscLibType, tr::DMPlexTransform, periodic::PetscBool) end + +@for_petsc function DMPlexTransformExtrudeSetPeriodic(petsclib::$UnionPetscLib, tr::DMPlexTransform, periodic::PetscBool ) + + @chk ccall( + (:DMPlexTransformExtrudeSetPeriodic, $petsc_library), + PetscErrorCode, + (DMPlexTransform, PetscBool), + tr, periodic, + ) + + + return nothing +end + +""" + normal::Vector{PetscReal} = DMPlexTransformExtrudeGetNormal(petsclib::PetscLibType,tr::DMPlexTransform) +Get the extrusion normal vector + +Not Collective + +Input Parameter: +- `tr` - The `DMPlexTransform` + +Output Parameter: +- `normal` - The extrusion direction + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeSetNormal()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeGetNormal")) +""" +function DMPlexTransformExtrudeGetNormal(petsclib::PetscLibType, tr::DMPlexTransform) end + +@for_petsc function DMPlexTransformExtrudeGetNormal(petsclib::$UnionPetscLib, tr::DMPlexTransform ) + normal = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:DMPlexTransformExtrudeGetNormal, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{$PetscReal}), + tr, normal, + ) + + + return normal +end + +""" + DMPlexTransformExtrudeSetNormal(petsclib::PetscLibType,tr::DMPlexTransform, normal::Vector{PetscReal}) +Set the extrusion normal + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `normal` - The extrusion direction + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeGetNormal()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeSetNormal")) +""" +function DMPlexTransformExtrudeSetNormal(petsclib::PetscLibType, tr::DMPlexTransform, normal::Vector{PetscReal}) end + +@for_petsc function DMPlexTransformExtrudeSetNormal(petsclib::$UnionPetscLib, tr::DMPlexTransform, normal::Vector{$PetscReal} ) + + @chk ccall( + (:DMPlexTransformExtrudeSetNormal, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{$PetscReal}), + tr, normal, + ) + + + return nothing +end + +""" + DMPlexTransformExtrudeSetNormalFunction(petsclib::PetscLibType,tr::DMPlexTransform, normalFunc::PetscSimplePoCintFn) +Set a function to determine the extrusion normal + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `normalFunc` - A function determining the extrusion direction, see `PetscSimplePointFn` for the calling sequence + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeGetNormal()`, `PetscSimplePointFn` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeSetNormalFunction")) +""" +function DMPlexTransformExtrudeSetNormalFunction(petsclib::PetscLibType, tr::DMPlexTransform, normalFunc::PetscSimplePoCintFn) end + +@for_petsc function DMPlexTransformExtrudeSetNormalFunction(petsclib::$UnionPetscLib, tr::DMPlexTransform, normalFunc::PetscSimplePoCintFn ) + + @chk ccall( + (:DMPlexTransformExtrudeSetNormalFunction, $petsc_library), + PetscErrorCode, + (DMPlexTransform, Ptr{PetscSimplePoCintFn}), + tr, normalFunc, + ) + + + return nothing +end + +""" + DMPlexTransformExtrudeSetThicknesses(petsclib::PetscLibType,tr::DMPlexTransform, Nth::PetscInt, thicknesses::Vector{PetscReal}) +Set the thickness of each layer + +Not Collective + +Input Parameters: +- `tr` - The `DMPlexTransform` +- `Nth` - The number of thicknesses +- `thicknesses` - The array of thicknesses + +Level: intermediate + +-seealso: `DMPlexTransform`, `DMPlexTransformExtrudeSetThickness()`, `DMPlexTransformExtrudeGetThickness()` + +# External Links +$(_doc_external("DM/DMPlexTransformExtrudeSetThicknesses")) +""" +function DMPlexTransformExtrudeSetThicknesses(petsclib::PetscLibType, tr::DMPlexTransform, Nth::PetscInt, thicknesses::Vector{PetscReal}) end + +@for_petsc function DMPlexTransformExtrudeSetThicknesses(petsclib::$UnionPetscLib, tr::DMPlexTransform, Nth::$PetscInt, thicknesses::Vector{$PetscReal} ) + + @chk ccall( + (:DMPlexTransformExtrudeSetThicknesses, $petsc_library), + PetscErrorCode, + (DMPlexTransform, $PetscInt, Ptr{$PetscReal}), + tr, Nth, thicknesses, + ) + + + return nothing +end + +""" + monitorptr::DMNetworkMonitor = DMNetworkMonitorCreate(petsclib::PetscLibType,network::PetscDM) +Creates a network monitor context + +Collective + +Input Parameter: +- `network` - network to monitor + +Output Parameter: +- `monitorptr` - the `DMNetworkMonitor` object + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkMonitor`, `DMNetworkMonitorDestroy()`, `DMNetworkMonitorAdd()` + +# External Links +$(_doc_external("DM/DMNetworkMonitorCreate")) +""" +function DMNetworkMonitorCreate(petsclib::PetscLibType, network::PetscDM) end + +@for_petsc function DMNetworkMonitorCreate(petsclib::$UnionPetscLib, network::PetscDM ) + monitorptr_ = Ref{DMNetworkMonitor}() + + @chk ccall( + (:DMNetworkMonitorCreate, $petsc_library), + PetscErrorCode, + (CDM, Ptr{DMNetworkMonitor}), + network, monitorptr_, + ) + + monitorptr = monitorptr_[] + + return monitorptr +end + +""" + DMNetworkMonitorDestroy(petsclib::PetscLibType,monitor::DMNetworkMonitor) +Destroys a network monitor and all associated viewers + +Collective + +Input Parameter: +- `monitor` - monitor to destroy + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkMonitor`, `DMNetworkMonitorCreate()`, `DMNetworkMonitorAdd()` + +# External Links +$(_doc_external("DM/DMNetworkMonitorDestroy")) +""" +function DMNetworkMonitorDestroy(petsclib::PetscLibType, monitor::DMNetworkMonitor) end + +@for_petsc function DMNetworkMonitorDestroy(petsclib::$UnionPetscLib, monitor::DMNetworkMonitor ) + + @chk ccall( + (:DMNetworkMonitorDestroy, $petsc_library), + PetscErrorCode, + (Ptr{DMNetworkMonitor},), + monitor, + ) + + + return nothing +end + +""" + DMNetworkMonitorPop(petsclib::PetscLibType,monitor::DMNetworkMonitor) +Removes the most recently added viewer to a `DMNetworkMonitor` + +Collective + +Input Parameter: +- `monitor` - the monitor + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkMonitor`, `DMNetworkMonitorCreate()`, `DMNetworkMonitorDestroy()` + +# External Links +$(_doc_external("DM/DMNetworkMonitorPop")) +""" +function DMNetworkMonitorPop(petsclib::PetscLibType, monitor::DMNetworkMonitor) end + +@for_petsc function DMNetworkMonitorPop(petsclib::$UnionPetscLib, monitor::DMNetworkMonitor ) + + @chk ccall( + (:DMNetworkMonitorPop, $petsc_library), + PetscErrorCode, + (DMNetworkMonitor,), + monitor, + ) + + + return nothing +end + +""" + DMNetworkMonitorAdd(petsclib::PetscLibType,monitor::DMNetworkMonitor, name::String, element::PetscInt, nodes::PetscInt, start::PetscInt, blocksize::PetscInt, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, hold::PetscBool) +Adds a new viewer to a `DMNetworkMonitor` + +Collective + +Input Parameters: +- `monitor` - the monitor +- `name` - name of viewer +- `element` - vertex / edge number +- `nodes` - number of nodes +- `start` - variable starting offset +- `blocksize` - variable blocksize +- `xmin` - xmin (or `PETSC_DECIDE`) for viewer +- `xmax` - xmax (or `PETSC_DECIDE`) for viewer +- `ymin` - ymin for viewer +- `ymax` - ymax for viewer +- `hold` - determines if plot limits should be held + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkMonitor`, `DMNetworkMonitorCreate()`, `DMNetworkMonitorDestroy()` + +# External Links +$(_doc_external("DM/DMNetworkMonitorAdd")) +""" +function DMNetworkMonitorAdd(petsclib::PetscLibType, monitor::DMNetworkMonitor, name::String, element::PetscInt, nodes::PetscInt, start::PetscInt, blocksize::PetscInt, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, hold::PetscBool) end + +@for_petsc function DMNetworkMonitorAdd(petsclib::$UnionPetscLib, monitor::DMNetworkMonitor, name::String, element::$PetscInt, nodes::$PetscInt, start::$PetscInt, blocksize::$PetscInt, xmin::$PetscReal, xmax::$PetscReal, ymin::$PetscReal, ymax::$PetscReal, hold::PetscBool ) + + @chk ccall( + (:DMNetworkMonitorAdd, $petsc_library), + PetscErrorCode, + (DMNetworkMonitor, Ptr{Cchar}, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscReal, $PetscReal, $PetscReal, $PetscReal, PetscBool), + monitor, name, element, nodes, start, blocksize, xmin, xmax, ymin, ymax, hold, + ) + + + return nothing +end + +""" + DMNetworkMonitorView(petsclib::PetscLibType,monitor::DMNetworkMonitor, x::PetscVec) +A `DMNETWORK` specific monitor function for `TSMonitorSet()` + +Collective, No Fortran support + +Input Parameters: +- `monitor` - `DMNetworkMonitor` object +- `x` - `TS` solution vector + +Level: intermediate + +-seealso: `DM`, `DMNETWORK`, `DMNetworkMonitor`, `DMNetworkMonitorCreate()`, `DMNetworkMonitorDestroy()`, `DMNetworkMonitorAdd()` + +# External Links +$(_doc_external("DM/DMNetworkMonitorView")) +""" +function DMNetworkMonitorView(petsclib::PetscLibType, monitor::DMNetworkMonitor, x::PetscVec) end + +@for_petsc function DMNetworkMonitorView(petsclib::$UnionPetscLib, monitor::DMNetworkMonitor, x::PetscVec ) + + @chk ccall( + (:DMNetworkMonitorView, $petsc_library), + PetscErrorCode, + (DMNetworkMonitor, CVec), + monitor, x, + ) + + + return nothing +end + +""" + label::DMLabel = DMLabelCreate(petsclib::PetscLibType,comm::MPI_Comm, name::String) +Create a `DMLabel` object, which is a multimap + +Collective + +Input Parameters: +- `comm` - The communicator, usually `PETSC_COMM_SELF` +- `name` - The label name + +Output Parameter: +- `label` - The `DMLabel` + +Level: beginner + +-seealso: `DMLabel`, `DM`, `DMLabelDestroy()` + +# External Links +$(_doc_external("DM/DMLabelCreate")) +""" +function DMLabelCreate(petsclib::PetscLibType, comm::MPI_Comm, name::String) end + +@for_petsc function DMLabelCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, name::String ) + label_ = Ref{DMLabel}() + + @chk ccall( + (:DMLabelCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{DMLabel}), + comm, name, label_, + ) + + label = label_[] + + return label +end + +""" + DMLabelSetUp(petsclib::PetscLibType,label::DMLabel) +SetUp a `DMLabel` object + +Collective + +Input Parameters: +- `label` - The `DMLabel` + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelDestroy()` + +# External Links +$(_doc_external("DM/DMLabelSetUp")) +""" +function DMLabelSetUp(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelSetUp(petsclib::$UnionPetscLib, label::DMLabel ) + + @chk ccall( + (:DMLabelSetUp, $petsc_library), + PetscErrorCode, + (DMLabel,), + label, + ) + + + return nothing +end + +""" + DMLabelAddStratum(petsclib::PetscLibType,label::DMLabel, value::PetscInt) +Adds a new stratum value in a `DMLabel` + +Input Parameters: +- `label` - The `DMLabel` +- `value` - The stratum value + +Level: beginner + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelDestroy()` + +# External Links +$(_doc_external("DM/DMLabelAddStratum")) +""" +function DMLabelAddStratum(petsclib::PetscLibType, label::DMLabel, value::PetscInt) end + +@for_petsc function DMLabelAddStratum(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt ) + + @chk ccall( + (:DMLabelAddStratum, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt), + label, value, + ) + + + return nothing +end + +""" + DMLabelAddStrata(petsclib::PetscLibType,label::DMLabel, numStrata::PetscInt, stratumValues::Vector{PetscInt}) +Adds new stratum values in a `DMLabel` + +Not Collective + +Input Parameters: +- `label` - The `DMLabel` +- `numStrata` - The number of stratum values +- `stratumValues` - The stratum values + +Level: beginner + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelDestroy()` + +# External Links +$(_doc_external("DM/DMLabelAddStrata")) +""" +function DMLabelAddStrata(petsclib::PetscLibType, label::DMLabel, numStrata::PetscInt, stratumValues::Vector{PetscInt}) end + +@for_petsc function DMLabelAddStrata(petsclib::$UnionPetscLib, label::DMLabel, numStrata::$PetscInt, stratumValues::Vector{$PetscInt} ) + + @chk ccall( + (:DMLabelAddStrata, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, Ptr{$PetscInt}), + label, numStrata, stratumValues, + ) + + + return nothing +end + +""" + DMLabelAddStrataIS(petsclib::PetscLibType,label::DMLabel, valueIS::IS) +Adds new stratum values in a `DMLabel` + +Not Collective + +Input Parameters: +- `label` - The `DMLabel` +- `valueIS` - Index set with stratum values + +Level: beginner + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelDestroy()` + +# External Links +$(_doc_external("DM/DMLabelAddStrataIS")) +""" +function DMLabelAddStrataIS(petsclib::PetscLibType, label::DMLabel, valueIS::IS) end + +@for_petsc function DMLabelAddStrataIS(petsclib::$UnionPetscLib, label::DMLabel, valueIS::IS ) + + @chk ccall( + (:DMLabelAddStrataIS, $petsc_library), + PetscErrorCode, + (DMLabel, CIS), + label, valueIS, + ) + + + return nothing +end + +""" + DMLabelView(petsclib::PetscLibType,label::DMLabel, viewer::PetscViewer) +View the label + +Collective + +Input Parameters: +- `label` - The `DMLabel` +- `viewer` - The `PetscViewer` + +Level: intermediate + +-seealso: `DMLabel`, `PetscViewer`, `DM`, `DMLabelCreate()`, `DMLabelDestroy()` + +# External Links +$(_doc_external("DM/DMLabelView")) +""" +function DMLabelView(petsclib::PetscLibType, label::DMLabel, viewer::PetscViewer) end + +@for_petsc function DMLabelView(petsclib::$UnionPetscLib, label::DMLabel, viewer::PetscViewer ) + + @chk ccall( + (:DMLabelView, $petsc_library), + PetscErrorCode, + (DMLabel, PetscViewer), + label, viewer, + ) + + + return nothing +end + +""" + DMLabelReset(petsclib::PetscLibType,label::DMLabel) +Destroys internal data structures in a `DMLabel` + +Not Collective + +Input Parameter: +- `label` - The `DMLabel` + +Level: beginner + +-seealso: `DMLabel`, `DM`, `DMLabelDestroy()`, `DMLabelCreate()` + +# External Links +$(_doc_external("DM/DMLabelReset")) +""" +function DMLabelReset(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelReset(petsclib::$UnionPetscLib, label::DMLabel ) + + @chk ccall( + (:DMLabelReset, $petsc_library), + PetscErrorCode, + (DMLabel,), + label, + ) + + + return nothing +end + +""" + DMLabelDestroy(petsclib::PetscLibType,label::DMLabel) +Destroys a `DMLabel` + +Collective + +Input Parameter: +- `label` - The `DMLabel` + +Level: beginner + +-seealso: `DMLabel`, `DM`, `DMLabelReset()`, `DMLabelCreate()` + +# External Links +$(_doc_external("DM/DMLabelDestroy")) +""" +function DMLabelDestroy(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelDestroy(petsclib::$UnionPetscLib, label::DMLabel ) + + @chk ccall( + (:DMLabelDestroy, $petsc_library), + PetscErrorCode, + (Ptr{DMLabel},), + label, + ) + + + return nothing +end + +""" + labelnew::DMLabel = DMLabelDuplicate(petsclib::PetscLibType,label::DMLabel) +Duplicates a `DMLabel` + +Collective + +Input Parameter: +- `label` - The `DMLabel` + +Output Parameter: +- `labelnew` - new label + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelDestroy()` + +# External Links +$(_doc_external("DM/DMLabelDuplicate")) +""" +function DMLabelDuplicate(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelDuplicate(petsclib::$UnionPetscLib, label::DMLabel ) + labelnew_ = Ref{DMLabel}() + + @chk ccall( + (:DMLabelDuplicate, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{DMLabel}), + label, labelnew_, + ) + + labelnew = labelnew_[] + + return labelnew +end + +""" + equal::PetscBool = DMLabelCompare(petsclib::PetscLibType,comm::MPI_Comm, l0::DMLabel, l1::DMLabel, message::Cchar) +Compare two `DMLabel` objects + +Collective; No Fortran Support + +Input Parameters: +- `comm` - Comm over which to compare labels +- `l0` - First `DMLabel` +- `l1` - Second `DMLabel` + +Output Parameters: +- `equal` - (Optional) Flag whether the two labels are equal +- `message` - (Optional) Message describing the difference + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMCompareLabels()`, `DMLabelGetNumValues()`, `DMLabelGetDefaultValue()`, `DMLabelGetNonEmptyStratumValuesIS()`, `DMLabelGetStratumIS()` + +# External Links +$(_doc_external("DM/DMLabelCompare")) +""" +function DMLabelCompare(petsclib::PetscLibType, comm::MPI_Comm, l0::DMLabel, l1::DMLabel, message::Cchar) end + +@for_petsc function DMLabelCompare(petsclib::$UnionPetscLib, comm::MPI_Comm, l0::DMLabel, l1::DMLabel, message::Cchar ) + equal_ = Ref{PetscBool}() + + @chk ccall( + (:DMLabelCompare, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMLabel, DMLabel, Ptr{PetscBool}, Cchar), + comm, l0, l1, equal_, message, + ) + + equal = equal_[] + + return equal +end + +""" + DMLabelComputeIndex(petsclib::PetscLibType,label::DMLabel) +Create an index structure for membership determination, automatically determining the bounds + +Not Collective + +Input Parameter: +- `label` - The `DMLabel` + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelHasPoint()`, `DMLabelCreateIndex()`, `DMLabelDestroyIndex()`, `DMLabelGetValue()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DM/DMLabelComputeIndex")) +""" +function DMLabelComputeIndex(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelComputeIndex(petsclib::$UnionPetscLib, label::DMLabel ) + + @chk ccall( + (:DMLabelComputeIndex, $petsc_library), + PetscErrorCode, + (DMLabel,), + label, + ) + + + return nothing +end + +""" + DMLabelCreateIndex(petsclib::PetscLibType,label::DMLabel, pStart::PetscInt, pEnd::PetscInt) +Create an index structure for membership determination + +Not Collective + +Input Parameters: +- `label` - The `DMLabel` +- `pStart` - The smallest point +- `pEnd` - The largest point + 1 + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelHasPoint()`, `DMLabelComputeIndex()`, `DMLabelDestroyIndex()`, `DMLabelGetValue()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DM/DMLabelCreateIndex")) +""" +function DMLabelCreateIndex(petsclib::PetscLibType, label::DMLabel, pStart::PetscInt, pEnd::PetscInt) end + +@for_petsc function DMLabelCreateIndex(petsclib::$UnionPetscLib, label::DMLabel, pStart::$PetscInt, pEnd::$PetscInt ) + + @chk ccall( + (:DMLabelCreateIndex, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, $PetscInt), + label, pStart, pEnd, + ) + + + return nothing +end + +""" + DMLabelDestroyIndex(petsclib::PetscLibType,label::DMLabel) +Destroy the index structure + +Not Collective + +Input Parameter: +- `label` - the `DMLabel` + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelHasPoint()`, `DMLabelCreateIndex()`, `DMLabelGetValue()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DM/DMLabelDestroyIndex")) +""" +function DMLabelDestroyIndex(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelDestroyIndex(petsclib::$UnionPetscLib, label::DMLabel ) + + @chk ccall( + (:DMLabelDestroyIndex, $petsc_library), + PetscErrorCode, + (DMLabel,), + label, + ) + + + return nothing +end + +""" + pStart::PetscInt,pEnd::PetscInt = DMLabelGetBounds(petsclib::PetscLibType,label::DMLabel) +Return the smallest and largest point in the label + +Not Collective + +Input Parameter: +- `label` - the `DMLabel` + +Output Parameters: +- `pStart` - The smallest point +- `pEnd` - The largest point + 1 + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelHasPoint()`, `DMLabelCreateIndex()`, `DMLabelGetValue()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DM/DMLabelGetBounds")) +""" +function DMLabelGetBounds(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelGetBounds(petsclib::$UnionPetscLib, label::DMLabel ) + pStart_ = Ref{$PetscInt}() + pEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:DMLabelGetBounds, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{$PetscInt}, Ptr{$PetscInt}), + label, pStart_, pEnd_, + ) + + pStart = pStart_[] + pEnd = pEnd_[] + + return pStart,pEnd +end + +""" + contains::PetscBool = DMLabelHasValue(petsclib::PetscLibType,label::DMLabel, value::PetscInt) +Determine whether a label assigns the value to any point + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `value` - the value + +Output Parameter: +- `contains` - Flag indicating whether the label maps this value to any point + +Level: developer + +-seealso: `DMLabel`, `DM`, `DMLabelHasPoint()`, `DMLabelGetValue()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DM/DMLabelHasValue")) +""" +function DMLabelHasValue(petsclib::PetscLibType, label::DMLabel, value::PetscInt) end + +@for_petsc function DMLabelHasValue(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt ) + contains_ = Ref{PetscBool}() + + @chk ccall( + (:DMLabelHasValue, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, Ptr{PetscBool}), + label, value, contains_, + ) + + contains = contains_[] + + return contains +end + +""" + contains::PetscBool = DMLabelHasPoint(petsclib::PetscLibType,label::DMLabel, point::PetscInt) +Determine whether a label assigns a value to a point + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `point` - the point + +Output Parameter: +- `contains` - Flag indicating whether the label maps this point to a value + +Level: developer + +-seealso: `DMLabel`, `DM`, `DMLabelCreateIndex()`, `DMLabelGetValue()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DM/DMLabelHasPoint")) +""" +function DMLabelHasPoint(petsclib::PetscLibType, label::DMLabel, point::PetscInt) end + +@for_petsc function DMLabelHasPoint(petsclib::$UnionPetscLib, label::DMLabel, point::$PetscInt ) + contains_ = Ref{PetscBool}() + + @chk ccall( + (:DMLabelHasPoint, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, Ptr{PetscBool}), + label, point, contains_, + ) + + contains = contains_[] + + return contains +end + +""" + contains::PetscBool = DMLabelStratumHasPoint(petsclib::PetscLibType,label::DMLabel, value::PetscInt, point::PetscInt) +Return true if the stratum contains a point + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `value` - the stratum value +- `point` - the point + +Output Parameter: +- `contains` - true if the stratum contains the point + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelStratumHasPoint")) +""" +function DMLabelStratumHasPoint(petsclib::PetscLibType, label::DMLabel, value::PetscInt, point::PetscInt) end + +@for_petsc function DMLabelStratumHasPoint(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt, point::$PetscInt ) + contains_ = Ref{PetscBool}() + + @chk ccall( + (:DMLabelStratumHasPoint, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, $PetscInt, Ptr{PetscBool}), + label, value, point, contains_, + ) + + contains = contains_[] + + return contains +end + +""" + defaultValue::PetscInt = DMLabelGetDefaultValue(petsclib::PetscLibType,label::DMLabel) +Get the default value returned by `DMLabelGetValue()` if a point has not been explicitly given a value. +When a label is created, it is initialized to -1. + +Not Collective + +Input Parameter: +- `label` - a `DMLabel` object + +Output Parameter: +- `defaultValue` - the default value + +Level: beginner + +-seealso: `DMLabel`, `DM`, `DMLabelSetDefaultValue()`, `DMLabelGetValue()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DM/DMLabelGetDefaultValue")) +""" +function DMLabelGetDefaultValue(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelGetDefaultValue(petsclib::$UnionPetscLib, label::DMLabel ) + defaultValue_ = Ref{$PetscInt}() + + @chk ccall( + (:DMLabelGetDefaultValue, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{$PetscInt}), + label, defaultValue_, + ) + + defaultValue = defaultValue_[] + + return defaultValue +end + +""" + defaultValue::PetscInt = DMLabelSetDefaultValue(petsclib::PetscLibType,label::DMLabel) +Set the default value returned by `DMLabelGetValue()` if a point has not been explicitly given a value. +When a label is created, it is initialized to -1. + +Not Collective + +Input Parameter: +- `label` - a `DMLabel` object + +Output Parameter: +- `defaultValue` - the default value + +Level: beginner + +-seealso: `DMLabel`, `DM`, `DMLabelGetDefaultValue()`, `DMLabelGetValue()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DM/DMLabelSetDefaultValue")) +""" +function DMLabelSetDefaultValue(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelSetDefaultValue(petsclib::$UnionPetscLib, label::DMLabel ) + defaultValue_ = Ref{$PetscInt}() + + @chk ccall( + (:DMLabelSetDefaultValue, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt), + label, defaultValue_, + ) + + defaultValue = defaultValue_[] + + return defaultValue +end + +""" + value::PetscInt = DMLabelGetValue(petsclib::PetscLibType,label::DMLabel, point::PetscInt) +Return the value a label assigns to a point, or the label's default value (which is initially +`DMLabelSetDefaultValue()`) + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `point` - the point + +Output Parameter: +- `value` - The point value, or the default value (-1 by default) + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelSetValue()`, `DMLabelClearValue()`, `DMLabelGetDefaultValue()`, `DMLabelSetDefaultValue()` + +# External Links +$(_doc_external("DM/DMLabelGetValue")) +""" +function DMLabelGetValue(petsclib::PetscLibType, label::DMLabel, point::PetscInt) end + +@for_petsc function DMLabelGetValue(petsclib::$UnionPetscLib, label::DMLabel, point::$PetscInt ) + value_ = Ref{$PetscInt}() + + @chk ccall( + (:DMLabelGetValue, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, Ptr{$PetscInt}), + label, point, value_, + ) + + value = value_[] + + return value +end + +""" + DMLabelSetValue(petsclib::PetscLibType,label::DMLabel, point::PetscInt, value::PetscInt) +Set the value a label assigns to a point. If the value is the same as the label's default value (which is initially +be changed with `DMLabelSetDefaultValue()` to something different), then this function will do nothing. + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `point` - the point +- `value` - The point value + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelClearValue()`, `DMLabelGetDefaultValue()`, `DMLabelSetDefaultValue()` + +# External Links +$(_doc_external("DM/DMLabelSetValue")) +""" +function DMLabelSetValue(petsclib::PetscLibType, label::DMLabel, point::PetscInt, value::PetscInt) end + +@for_petsc function DMLabelSetValue(petsclib::$UnionPetscLib, label::DMLabel, point::$PetscInt, value::$PetscInt ) + + @chk ccall( + (:DMLabelSetValue, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, $PetscInt), + label, point, value, + ) + + + return nothing +end + +""" + DMLabelClearValue(petsclib::PetscLibType,label::DMLabel, point::PetscInt, value::PetscInt) +Clear the value a label assigns to a point + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `point` - the point +- `value` - The point value + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DM/DMLabelClearValue")) +""" +function DMLabelClearValue(petsclib::PetscLibType, label::DMLabel, point::PetscInt, value::PetscInt) end + +@for_petsc function DMLabelClearValue(petsclib::$UnionPetscLib, label::DMLabel, point::$PetscInt, value::$PetscInt ) + + @chk ccall( + (:DMLabelClearValue, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, $PetscInt), + label, point, value, + ) + + + return nothing +end + +""" + DMLabelInsertIS(petsclib::PetscLibType,label::DMLabel, is::IS, value::PetscInt) +Set all points in the `IS` to a value + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `is` - the point `IS` +- `value` - The point value + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelInsertIS")) +""" +function DMLabelInsertIS(petsclib::PetscLibType, label::DMLabel, is::IS, value::PetscInt) end + +@for_petsc function DMLabelInsertIS(petsclib::$UnionPetscLib, label::DMLabel, is::IS, value::$PetscInt ) + + @chk ccall( + (:DMLabelInsertIS, $petsc_library), + PetscErrorCode, + (DMLabel, CIS, $PetscInt), + label, is, value, + ) + + + return nothing +end + +""" + numValues::PetscInt = DMLabelGetNumValues(petsclib::PetscLibType,label::DMLabel) +Get the number of values that the `DMLabel` takes + +Not Collective + +Input Parameter: +- `label` - the `DMLabel` + +Output Parameter: +- `numValues` - the number of values + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelGetNumValues")) +""" +function DMLabelGetNumValues(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelGetNumValues(petsclib::$UnionPetscLib, label::DMLabel ) + numValues_ = Ref{$PetscInt}() + + @chk ccall( + (:DMLabelGetNumValues, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{$PetscInt}), + label, numValues_, + ) + + numValues = numValues_[] + + return numValues +end + +""" + DMLabelGetValueIS(petsclib::PetscLibType,label::DMLabel, values::IS) +Get an `IS` of all values that the `DMlabel` takes + +Not Collective + +Input Parameter: +- `label` - the `DMLabel` + +Output Parameter: +- `values` - the value `IS` + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelGetNonEmptyStratumValuesIS()`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelGetValueIS")) +""" +function DMLabelGetValueIS(petsclib::PetscLibType, label::DMLabel, values::IS) end + +@for_petsc function DMLabelGetValueIS(petsclib::$UnionPetscLib, label::DMLabel, values::IS ) + values_ = Ref(values.ptr) + + @chk ccall( + (:DMLabelGetValueIS, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{CIS}), + label, values_, + ) + + values.ptr = C_NULL + + return nothing +end + +""" + minValue::PetscInt,maxValue::PetscInt = DMLabelGetValueBounds(petsclib::PetscLibType,label::DMLabel) +Return the smallest and largest value in the label + +Not Collective + +Input Parameter: +- `label` - the `DMLabel` + +Output Parameters: +- `minValue` - The smallest value +- `maxValue` - The largest value + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelGetBounds()`, `DMLabelGetValue()`, `DMLabelSetValue()` + +# External Links +$(_doc_external("DM/DMLabelGetValueBounds")) +""" +function DMLabelGetValueBounds(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelGetValueBounds(petsclib::$UnionPetscLib, label::DMLabel ) + minValue_ = Ref{$PetscInt}() + maxValue_ = Ref{$PetscInt}() + + @chk ccall( + (:DMLabelGetValueBounds, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{$PetscInt}, Ptr{$PetscInt}), + label, minValue_, maxValue_, + ) + + minValue = minValue_[] + maxValue = maxValue_[] + + return minValue,maxValue +end + +""" + DMLabelGetNonEmptyStratumValuesIS(petsclib::PetscLibType,label::DMLabel, values::IS) +Get an `IS` of all values that the `DMlabel` takes + +Not Collective + +Input Parameter: +- `label` - the `DMLabel` + +Output Parameter: +- `values` - the value `IS` + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelGetValueIS()`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelGetNonEmptyStratumValuesIS")) +""" +function DMLabelGetNonEmptyStratumValuesIS(petsclib::PetscLibType, label::DMLabel, values::IS) end + +@for_petsc function DMLabelGetNonEmptyStratumValuesIS(petsclib::$UnionPetscLib, label::DMLabel, values::IS ) + values_ = Ref(values.ptr) + + @chk ccall( + (:DMLabelGetNonEmptyStratumValuesIS, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{CIS}), + label, values_, + ) + + values.ptr = C_NULL + + return nothing +end + +""" + index::PetscInt = DMLabelGetValueIndex(petsclib::PetscLibType,label::DMLabel, value::PetscInt) +Get the index of a given value in the list of values for the `DMlabel`, or + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `value` - the value + +Output Parameter: +- `index` - the index of value in the list of values + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelGetValueIS()`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelGetValueIndex")) +""" +function DMLabelGetValueIndex(petsclib::PetscLibType, label::DMLabel, value::PetscInt) end + +@for_petsc function DMLabelGetValueIndex(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt ) + index_ = Ref{$PetscInt}() + + @chk ccall( + (:DMLabelGetValueIndex, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, Ptr{$PetscInt}), + label, value, index_, + ) + + index = index_[] + + return index +end + +""" + exists::PetscBool = DMLabelHasStratum(petsclib::PetscLibType,label::DMLabel, value::PetscInt) +Determine whether points exist with the given value + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `value` - the stratum value + +Output Parameter: +- `exists` - Flag saying whether points exist + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelHasStratum")) +""" +function DMLabelHasStratum(petsclib::PetscLibType, label::DMLabel, value::PetscInt) end + +@for_petsc function DMLabelHasStratum(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt ) + exists_ = Ref{PetscBool}() + + @chk ccall( + (:DMLabelHasStratum, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, Ptr{PetscBool}), + label, value, exists_, + ) + + exists = exists_[] + + return exists +end + +""" + size::PetscInt = DMLabelGetStratumSize(petsclib::PetscLibType,label::DMLabel, value::PetscInt) +Get the size of a stratum + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `value` - the stratum value + +Output Parameter: +- `size` - The number of points in the stratum + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelGetStratumSize")) +""" +function DMLabelGetStratumSize(petsclib::PetscLibType, label::DMLabel, value::PetscInt) end + +@for_petsc function DMLabelGetStratumSize(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:DMLabelGetStratumSize, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, Ptr{$PetscInt}), + label, value, size_, + ) + + size = size_[] + + return size +end + +""" + start::PetscInt,end_::PetscInt = DMLabelGetStratumBounds(petsclib::PetscLibType,label::DMLabel, value::PetscInt) +Get the largest and smallest point of a stratum + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `value` - the stratum value + +Output Parameters: +- `start` - the smallest point in the stratum +- `end` - the largest point in the stratum + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelGetStratumBounds")) +""" +function DMLabelGetStratumBounds(petsclib::PetscLibType, label::DMLabel, value::PetscInt) end + +@for_petsc function DMLabelGetStratumBounds(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt ) + start_ = Ref{$PetscInt}() + end__ = Ref{$PetscInt}() + + @chk ccall( + (:DMLabelGetStratumBounds, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + label, value, start_, end__, + ) + + start = start_[] + end_ = end__[] + + return start,end_ +end + +""" + DMLabelGetStratumIS(petsclib::PetscLibType,label::DMLabel, value::PetscInt, points::IS) +Get an `IS` with the stratum points + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `value` - the stratum value + +Output Parameter: +- `points` - The stratum points + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelGetStratumIS")) +""" +function DMLabelGetStratumIS(petsclib::PetscLibType, label::DMLabel, value::PetscInt, points::IS) end + +@for_petsc function DMLabelGetStratumIS(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt, points::IS ) + points_ = Ref(points.ptr) + + @chk ccall( + (:DMLabelGetStratumIS, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, Ptr{CIS}), + label, value, points_, + ) + + points.ptr = C_NULL + + return nothing +end + +""" + DMLabelSetStratumIS(petsclib::PetscLibType,label::DMLabel, value::PetscInt, is::IS) +Set the stratum points using an `IS` + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `value` - the stratum value +- `is` - The stratum points + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelSetStratumIS")) +""" +function DMLabelSetStratumIS(petsclib::PetscLibType, label::DMLabel, value::PetscInt, is::IS) end + +@for_petsc function DMLabelSetStratumIS(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt, is::IS ) + + @chk ccall( + (:DMLabelSetStratumIS, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, CIS), + label, value, is, + ) + + + return nothing +end + +""" + DMLabelClearStratum(petsclib::PetscLibType,label::DMLabel, value::PetscInt) +Remove a stratum + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `value` - the stratum value + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelClearStratum")) +""" +function DMLabelClearStratum(petsclib::PetscLibType, label::DMLabel, value::PetscInt) end + +@for_petsc function DMLabelClearStratum(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt ) + + @chk ccall( + (:DMLabelClearStratum, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt), + label, value, + ) + + + return nothing +end + +""" + DMLabelSetStratumBounds(petsclib::PetscLibType,label::DMLabel, value::PetscInt, pStart::PetscInt, pEnd::PetscInt) +Efficiently give a contiguous set of points a given label value + +Not Collective + +Input Parameters: +- `label` - The `DMLabel` +- `value` - The label value for all points +- `pStart` - The first point +- `pEnd` - A point beyond all marked points + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelSetStratumIS()`, `DMLabelGetStratumIS()` + +# External Links +$(_doc_external("DM/DMLabelSetStratumBounds")) +""" +function DMLabelSetStratumBounds(petsclib::PetscLibType, label::DMLabel, value::PetscInt, pStart::PetscInt, pEnd::PetscInt) end + +@for_petsc function DMLabelSetStratumBounds(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt, pStart::$PetscInt, pEnd::$PetscInt ) + + @chk ccall( + (:DMLabelSetStratumBounds, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, $PetscInt, $PetscInt), + label, value, pStart, pEnd, + ) + + + return nothing +end + +""" + index::PetscInt = DMLabelGetStratumPointIndex(petsclib::PetscLibType,label::DMLabel, value::PetscInt, p::PetscInt) +Get the index of a point in a given stratum + +Not Collective + +Input Parameters: +- `label` - The `DMLabel` +- `value` - The label value +- `p` - A point with this value + +Output Parameter: +- `index` - The index of this point in the stratum, or -1 if the point is not in the stratum or the stratum does not exist + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelGetValueIndex()`, `DMLabelGetStratumIS()`, `DMLabelCreate()` + +# External Links +$(_doc_external("DM/DMLabelGetStratumPointIndex")) +""" +function DMLabelGetStratumPointIndex(petsclib::PetscLibType, label::DMLabel, value::PetscInt, p::PetscInt) end + +@for_petsc function DMLabelGetStratumPointIndex(petsclib::$UnionPetscLib, label::DMLabel, value::$PetscInt, p::$PetscInt ) + index_ = Ref{$PetscInt}() + + @chk ccall( + (:DMLabelGetStratumPointIndex, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, $PetscInt, Ptr{$PetscInt}), + label, value, p, index_, + ) + + index = index_[] + + return index +end + +""" + DMLabelFilter(petsclib::PetscLibType,label::DMLabel, start::PetscInt, end_::PetscInt) +Remove all points outside of [`start`, `end`) + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `start` - the first point kept +- `end` - one more than the last point kept + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelFilter")) +""" +function DMLabelFilter(petsclib::PetscLibType, label::DMLabel, start::PetscInt, end_::PetscInt) end + +@for_petsc function DMLabelFilter(petsclib::$UnionPetscLib, label::DMLabel, start::$PetscInt, end_::$PetscInt ) + + @chk ccall( + (:DMLabelFilter, $petsc_library), + PetscErrorCode, + (DMLabel, $PetscInt, $PetscInt), + label, start, end_, + ) + + + return nothing +end + +""" + DMLabelPermute(petsclib::PetscLibType,label::DMLabel, permutation::IS, labelNew::DMLabel) +Create a new label with permuted points + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `permutation` - the point permutation + +Output Parameter: +- `labelNew` - the new label containing the permuted points + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelPermute")) +""" +function DMLabelPermute(petsclib::PetscLibType, label::DMLabel, permutation::IS, labelNew::DMLabel) end + +@for_petsc function DMLabelPermute(petsclib::$UnionPetscLib, label::DMLabel, permutation::IS, labelNew::DMLabel ) + + @chk ccall( + (:DMLabelPermute, $petsc_library), + PetscErrorCode, + (DMLabel, CIS, Ptr{DMLabel}), + label, permutation, labelNew, + ) + + + return nothing +end + +""" + DMLabelPermuteValues(petsclib::PetscLibType,label::DMLabel, permutation::IS) +Permute the values in a label + +Not collective + +Input Parameters: +- `label` - the `DMLabel` +- `permutation` - the value permutation, permutation[old value] = new value + +Output Parameter: +- `label` - the `DMLabel` now with permuted values + +-seealso: `DMLabelRewriteValues()`, `DMLabel`, `DM`, `DMLabelPermute()`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelPermuteValues")) +""" +function DMLabelPermuteValues(petsclib::PetscLibType, label::DMLabel, permutation::IS) end + +@for_petsc function DMLabelPermuteValues(petsclib::$UnionPetscLib, label::DMLabel, permutation::IS ) + + @chk ccall( + (:DMLabelPermuteValues, $petsc_library), + PetscErrorCode, + (DMLabel, CIS), + label, permutation, + ) + + + return nothing +end + +""" + DMLabelRewriteValues(petsclib::PetscLibType,label::DMLabel, permutation::IS) +Permute the values in a label, but some may be omitted + +Not collective + +Input Parameters: +- `label` - the `DMLabel` +- `permutation` - the value permutation, permutation[old value] = new value, but some maybe omitted + +Output Parameter: +- `label` - the `DMLabel` now with permuted values + +-seealso: `DMLabelPermuteValues()`, `DMLabel`, `DM`, `DMLabelPermute()`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelRewriteValues")) +""" +function DMLabelRewriteValues(petsclib::PetscLibType, label::DMLabel, permutation::IS) end + +@for_petsc function DMLabelRewriteValues(petsclib::$UnionPetscLib, label::DMLabel, permutation::IS ) + + @chk ccall( + (:DMLabelRewriteValues, $petsc_library), + PetscErrorCode, + (DMLabel, CIS), + label, permutation, + ) + + + return nothing +end + +""" + DMLabelDistribute(petsclib::PetscLibType,label::DMLabel, sf::PetscSF, labelNew::DMLabel) +Create a new label pushed forward over the `PetscSF` + +Collective + +Input Parameters: +- `label` - the `DMLabel` +- `sf` - the map from old to new distribution + +Output Parameter: +- `labelNew` - the new redistributed label + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelCreate()`, `DMLabelGetValue()`, `DMLabelSetValue()`, `DMLabelClearValue()` + +# External Links +$(_doc_external("DM/DMLabelDistribute")) +""" +function DMLabelDistribute(petsclib::PetscLibType, label::DMLabel, sf::PetscSF, labelNew::DMLabel) end + +@for_petsc function DMLabelDistribute(petsclib::$UnionPetscLib, label::DMLabel, sf::PetscSF, labelNew::DMLabel ) + + @chk ccall( + (:DMLabelDistribute, $petsc_library), + PetscErrorCode, + (DMLabel, PetscSF, Ptr{DMLabel}), + label, sf, labelNew, + ) + + + return nothing +end + +""" + DMLabelGather(petsclib::PetscLibType,label::DMLabel, sf::PetscSF, labelNew::DMLabel) +Gather all label values from leafs into roots + +Collective + +Input Parameters: +- `label` - the `DMLabel` +- `sf` - the `PetscSF` communication map + +Output Parameter: +- `labelNew` - the new `DMLabel` with localised leaf values + +Level: developer + +-seealso: `DMLabel`, `DM`, `DMLabelDistribute()` + +# External Links +$(_doc_external("DM/DMLabelGather")) +""" +function DMLabelGather(petsclib::PetscLibType, label::DMLabel, sf::PetscSF, labelNew::DMLabel) end + +@for_petsc function DMLabelGather(petsclib::$UnionPetscLib, label::DMLabel, sf::PetscSF, labelNew::DMLabel ) + + @chk ccall( + (:DMLabelGather, $petsc_library), + PetscErrorCode, + (DMLabel, PetscSF, Ptr{DMLabel}), + label, sf, labelNew, + ) + + + return nothing +end + +""" + DMLabelPropagateBegin(petsclib::PetscLibType,label::DMLabel, sf::PetscSF) +Setup a cycle of label propagation + +Collective + +Input Parameters: +- `label` - The `DMLabel` to propagate across processes +- `sf` - The `PetscSF` describing parallel layout of the label points + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelPropagateEnd()`, `DMLabelPropagatePush()` + +# External Links +$(_doc_external("DM/DMLabelPropagateBegin")) +""" +function DMLabelPropagateBegin(petsclib::PetscLibType, label::DMLabel, sf::PetscSF) end + +@for_petsc function DMLabelPropagateBegin(petsclib::$UnionPetscLib, label::DMLabel, sf::PetscSF ) + + @chk ccall( + (:DMLabelPropagateBegin, $petsc_library), + PetscErrorCode, + (DMLabel, PetscSF), + label, sf, + ) + + + return nothing +end + +""" + DMLabelPropagateEnd(petsclib::PetscLibType,label::DMLabel, pointSF::PetscSF) +Tear down a cycle of label propagation + +Collective + +Input Parameters: +- `label` - The `DMLabel` to propagate across processes +- `pointSF` - The `PetscSF` describing parallel layout of the label points + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelPropagateBegin()`, `DMLabelPropagatePush()` + +# External Links +$(_doc_external("DM/DMLabelPropagateEnd")) +""" +function DMLabelPropagateEnd(petsclib::PetscLibType, label::DMLabel, pointSF::PetscSF) end + +@for_petsc function DMLabelPropagateEnd(petsclib::$UnionPetscLib, label::DMLabel, pointSF::PetscSF ) + + @chk ccall( + (:DMLabelPropagateEnd, $petsc_library), + PetscErrorCode, + (DMLabel, PetscSF), + label, pointSF, + ) + + + return nothing +end + +""" + DMLabelPropagatePush(petsclib::PetscLibType,label::DMLabel, pointSF::PetscSF, markPoint::external, ctx::Cvoid) +Tear down a cycle of label propagation + +Collective + +Input Parameters: +- `label` - The `DMLabel` to propagate across processes +- `pointSF` - The `PetscSF` describing parallel layout of the label points +- `markPoint` - An optional callback that is called when a point is marked, or `NULL` +- `ctx` - An optional user context for the callback, or `NULL` + +Calling sequence of `markPoint`: +- `label` - The `DMLabel` +- `p` - The point being marked +- `val` - The label value for `p` +- `ctx` - An optional user context + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelPropagateBegin()`, `DMLabelPropagateEnd()` + +# External Links +$(_doc_external("DM/DMLabelPropagatePush")) +""" +function DMLabelPropagatePush(petsclib::PetscLibType, label::DMLabel, pointSF::PetscSF, markPoint::external, ctx::Cvoid) end + +@for_petsc function DMLabelPropagatePush(petsclib::$UnionPetscLib, label::DMLabel, pointSF::PetscSF, markPoint::external, ctx::Cvoid ) + + @chk ccall( + (:DMLabelPropagatePush, $petsc_library), + PetscErrorCode, + (DMLabel, PetscSF, external, Ptr{Cvoid}), + label, pointSF, markPoint, ctx, + ) + + + return nothing +end + +""" + DMLabelConvertToSection(petsclib::PetscLibType,label::DMLabel, section::PetscSection, is::IS) +Make a `PetscSection`/`IS` pair that encodes the label + +Not Collective + +Input Parameter: +- `label` - the `DMLabel` + +Output Parameters: +- `section` - the section giving offsets for each stratum +- `is` - An `IS` containing all the label points + +Level: developer + +-seealso: `DMLabel`, `DM`, `DMLabelDistribute()` + +# External Links +$(_doc_external("DM/DMLabelConvertToSection")) +""" +function DMLabelConvertToSection(petsclib::PetscLibType, label::DMLabel, section::PetscSection, is::IS) end + +@for_petsc function DMLabelConvertToSection(petsclib::$UnionPetscLib, label::DMLabel, section::PetscSection, is::IS ) + is_ = Ref(is.ptr) + + @chk ccall( + (:DMLabelConvertToSection, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{PetscSection}, Ptr{CIS}), + label, section, is_, + ) + + is.ptr = C_NULL + + return nothing +end + +""" + DMLabelRegisterAll(petsclib::PetscLibType) +Registers all of the `DMLabel` implementations in the `DM` package. + +Not Collective + +Level: advanced + +-seealso: `DMLabel`, `DM`, `DMRegisterAll()`, `DMLabelRegisterDestroy()` + +# External Links +$(_doc_external("DM/DMLabelRegisterAll")) +""" +function DMLabelRegisterAll(petsclib::PetscLibType) end + +@for_petsc function DMLabelRegisterAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMLabelRegisterAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMLabelRegisterDestroy(petsclib::PetscLibType) +This function destroys the `DMLabel` registry. It is called from `PetscFinalize()`. + +Level: developer + +-seealso: `DMLabel`, `DM`, `PetscInitialize()` + +# External Links +$(_doc_external("DM/DMLabelRegisterDestroy")) +""" +function DMLabelRegisterDestroy(petsclib::PetscLibType) end + +@for_petsc function DMLabelRegisterDestroy(petsclib::$UnionPetscLib) + + @chk ccall( + (:DMLabelRegisterDestroy, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + DMLabelSetType(petsclib::PetscLibType,label::DMLabel, method::DMLabelType) +Sets the particular implementation for a label. + +Collective + +Input Parameters: +- `label` - The label +- `method` - The name of the label type + +Options Database Key: +- `-dm_label_type ` - Sets the label type; use -help for a list of available types or see `DMLabelType` + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelGetType()`, `DMLabelCreate()` + +# External Links +$(_doc_external("DM/DMLabelSetType")) +""" +function DMLabelSetType(petsclib::PetscLibType, label::DMLabel, method::DMLabelType) end + +@for_petsc function DMLabelSetType(petsclib::$UnionPetscLib, label::DMLabel, method::DMLabelType ) + + @chk ccall( + (:DMLabelSetType, $petsc_library), + PetscErrorCode, + (DMLabel, DMLabelType), + label, method, + ) + + + return nothing +end + +""" + type::DMLabelType = DMLabelGetType(petsclib::PetscLibType,label::DMLabel) +Gets the type name (as a string) from the label. + +Not Collective + +Input Parameter: +- `label` - The `DMLabel` + +Output Parameter: +- `type` - The `DMLabel` type name + +Level: intermediate + +-seealso: `DMLabel`, `DM`, `DMLabelSetType()`, `DMLabelCreate()` + +# External Links +$(_doc_external("DM/DMLabelGetType")) +""" +function DMLabelGetType(petsclib::PetscLibType, label::DMLabel) end + +@for_petsc function DMLabelGetType(petsclib::$UnionPetscLib, label::DMLabel ) + type_ = Ref{DMLabelType}() + + @chk ccall( + (:DMLabelGetType, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{DMLabelType}), + label, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + DMLabelEphemeralGetLabel(petsclib::PetscLibType,label::DMLabel, olabel::DMLabel) +Get the base label for this ephemeral label + +Not Collective + +Input Parameter: +- `label` - the `DMLabel` + +Output Parameter: +- `olabel` - the base label for this ephemeral label + +Level: intermediate + +-seealso: `DMLabelEphemeralSetLabel()`, `DMLabelEphemeralGetTransform()`, `DMLabelSetType()` + +# External Links +$(_doc_external("DM/DMLabelEphemeralGetLabel")) +""" +function DMLabelEphemeralGetLabel(petsclib::PetscLibType, label::DMLabel, olabel::DMLabel) end + +@for_petsc function DMLabelEphemeralGetLabel(petsclib::$UnionPetscLib, label::DMLabel, olabel::DMLabel ) + + @chk ccall( + (:DMLabelEphemeralGetLabel, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{DMLabel}), + label, olabel, + ) + + + return nothing +end + +""" + DMLabelEphemeralSetLabel(petsclib::PetscLibType,label::DMLabel, olabel::DMLabel) +Set the base label for this ephemeral label + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `olabel` - the base label for this ephemeral label + +Level: intermediate + +-seealso: `DMLabelEphemeralGetLabel()`, `DMLabelEphemeralSetTransform()`, `DMLabelSetType()` + +# External Links +$(_doc_external("DM/DMLabelEphemeralSetLabel")) +""" +function DMLabelEphemeralSetLabel(petsclib::PetscLibType, label::DMLabel, olabel::DMLabel) end + +@for_petsc function DMLabelEphemeralSetLabel(petsclib::$UnionPetscLib, label::DMLabel, olabel::DMLabel ) + + @chk ccall( + (:DMLabelEphemeralSetLabel, $petsc_library), + PetscErrorCode, + (DMLabel, DMLabel), + label, olabel, + ) + + + return nothing +end + +""" + DMLabelEphemeralGetTransform(petsclib::PetscLibType,label::DMLabel, tr::DMPlexTransform) +Get the transform for this ephemeral label + +Not Collective + +Input Parameter: +- `label` - the `DMLabel` + +Output Parameter: +- `tr` - the transform for this ephemeral label + +Level: intermediate + +-seealso: `DMLabelEphemeralSetTransform()`, `DMLabelEphemeralGetLabel()`, `DMLabelSetType()` + +# External Links +$(_doc_external("DM/DMLabelEphemeralGetTransform")) +""" +function DMLabelEphemeralGetTransform(petsclib::PetscLibType, label::DMLabel, tr::DMPlexTransform) end + +@for_petsc function DMLabelEphemeralGetTransform(petsclib::$UnionPetscLib, label::DMLabel, tr::DMPlexTransform ) + + @chk ccall( + (:DMLabelEphemeralGetTransform, $petsc_library), + PetscErrorCode, + (DMLabel, Ptr{DMPlexTransform}), + label, tr, + ) + + + return nothing +end + +""" + DMLabelEphemeralSetTransform(petsclib::PetscLibType,label::DMLabel, tr::DMPlexTransform) +Set the transform for this ephemeral label + +Not Collective + +Input Parameters: +- `label` - the `DMLabel` +- `tr` - the transform for this ephemeral label + +Level: intermediate + +-seealso: `DMLabelEphemeralGetTransform()`, `DMLabelEphemeralSetLabel()`, `DMLabelSetType()` + +# External Links +$(_doc_external("DM/DMLabelEphemeralSetTransform")) +""" +function DMLabelEphemeralSetTransform(petsclib::PetscLibType, label::DMLabel, tr::DMPlexTransform) end + +@for_petsc function DMLabelEphemeralSetTransform(petsclib::$UnionPetscLib, label::DMLabel, tr::DMPlexTransform ) + + @chk ccall( + (:DMLabelEphemeralSetTransform, $petsc_library), + PetscErrorCode, + (DMLabel, DMPlexTransform), + label, tr, + ) + + + return nothing +end + diff --git a/src/autowrapped/IS_wrappers.jl b/src/autowrapped/IS_wrappers.jl new file mode 100644 index 00000000..88174705 --- /dev/null +++ b/src/autowrapped/IS_wrappers.jl @@ -0,0 +1,3168 @@ +# autodefined type arguments for class ------ +mutable struct _n_ISColoringValue end +const ISColoringValue = Ptr{_n_ISColoringValue} +# ------------------------------------------------------- + +""" + is::IS = ISCreate(petsclib::PetscLibType,comm::MPI_Comm) +Create an index set object. `IS`, index sets, are PETSc objects used to do efficient indexing into other data structures such as `Vec` and `Mat` + +Collective + +Input Parameter: +- `comm` - the MPI communicator + +Output Parameter: +- `is` - the new index set + +Level: beginner + +-seealso: [](sec_scatter), `IS`, `ISType()`, `ISSetType()`, `ISCreateGeneral()`, `ISCreateStride()`, `ISCreateBlock()`, `ISAllGather()` + +# External Links +$(_doc_external("Vec/ISCreate")) +""" +function ISCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function ISCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + is_ = Ref{CIS}() + + @chk ccall( + (:ISCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CIS}), + comm, is_, + ) + + is = IS(is_[], petsclib) + + return is +end + +""" + ISSetType(petsclib::PetscLibType,is::IS, method::ISType) +Builds a index set, for a particular `ISType` + +Collective + +Input Parameters: +- `is` - The index set object +- `method` - The name of the index set type + +Options Database Key: +- `-is_type ` - Sets the index set type; use `-help` for a list of available types + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISGENERAL`, `ISBLOCK`, `ISGetType()`, `ISCreate()`, `ISCreateGeneral()`, `ISCreateStride()`, `ISCreateBlock()` + +# External Links +$(_doc_external("Vec/ISSetType")) +""" +function ISSetType(petsclib::PetscLibType, is::IS, method::ISType) end + +@for_petsc function ISSetType(petsclib::$UnionPetscLib, is::IS, method::ISType ) + + @chk ccall( + (:ISSetType, $petsc_library), + PetscErrorCode, + (CIS, ISType), + is, method, + ) + + + return nothing +end + +""" + type::ISType = ISGetType(petsclib::PetscLibType,is::IS) +Gets the index set type name, `ISType`, (as a string) from the `IS`. + +Not Collective + +Input Parameter: +- `is` - The index set + +Output Parameter: +- `type` - The index set type name + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISType`, `ISSetType()`, `ISCreate()` + +# External Links +$(_doc_external("Vec/ISGetType")) +""" +function ISGetType(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISGetType(petsclib::$UnionPetscLib, is::IS ) + type_ = Ref{ISType}() + + @chk ccall( + (:ISGetType, $petsc_library), + PetscErrorCode, + (CIS, Ptr{ISType}), + is, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + ISRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new index set implementation + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine itself + +-seealso: [](sec_scatter), `IS`, `ISType`, `ISSetType()`, `ISRegisterAll()`, `ISRegisterDestroy()` + +# External Links +$(_doc_external("Vec/ISRegister")) +""" +function ISRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function ISRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:ISRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + N::PetscInt = ISRenumber(petsclib::PetscLibType,subset::IS, subset_mult::IS, subset_n::IS) +Renumbers the non + +Collective + +Input Parameters: +- `subset` - the index set +- `subset_mult` - the multiplicity of each entry in subset (optional, can be `NULL`) + +Output Parameters: +- `N` - one past the largest entry of the new `IS` +- `subset_n` - the new `IS` + +Level: intermediate + +-seealso: `IS` + +# External Links +$(_doc_external("Vec/ISRenumber")) +""" +function ISRenumber(petsclib::PetscLibType, subset::IS, subset_mult::IS, subset_n::IS) end + +@for_petsc function ISRenumber(petsclib::$UnionPetscLib, subset::IS, subset_mult::IS, subset_n::IS ) + N_ = Ref{$PetscInt}() + subset_n_ = Ref(subset_n.ptr) + + @chk ccall( + (:ISRenumber, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{$PetscInt}, Ptr{CIS}), + subset, subset_mult, N_, subset_n_, + ) + + N = N_[] + subset_n.ptr = C_NULL + + return N +end + +""" + subis::IS = ISCreateSubIS(petsclib::PetscLibType,is::IS, comps::IS) +Create a sub index set from a global index set selecting some components. + +Collective + +Input Parameters: +- `is` - the index set +- `comps` - which components we will extract from `is` + +Output Parameters: +- `subis` - the new sub index set + +Example usage: +We have an index set `is` living on 3 processes with the following values: +| 4 9 0 | 2 6 7 | 10 11 1| +and another index set `comps` used to indicate which components of is we want to take, +| 7 5 | 1 2 | 0 4| +The output index set `subis` should look like: +| 11 7 | 9 0 | 4 6| + +Level: intermediate + +-seealso: `IS`, `VecGetSubVector()`, `MatCreateSubMatrix()` + +# External Links +$(_doc_external("Vec/ISCreateSubIS")) +""" +function ISCreateSubIS(petsclib::PetscLibType, is::IS, comps::IS) end + +@for_petsc function ISCreateSubIS(petsclib::$UnionPetscLib, is::IS, comps::IS ) + subis_ = Ref{CIS}() + + @chk ccall( + (:ISCreateSubIS, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{CIS}), + is, comps, subis_, + ) + + subis = IS(subis_[], petsclib) + + return subis +end + +""" + ISClearInfoCache(petsclib::PetscLibType,is::IS, clear_permanent_loc::PetscBool) +clear the cache of computed index set properties + +Not Collective + +Input Parameters: +- `is` - the index set +- `clear_permanent_local` - whether to remove the permanent status of local properties + +Level: developer + +-seealso: `IS`, `ISInfo`, `ISInfoType`, `ISSetInfo()` + +# External Links +$(_doc_external("Vec/ISClearInfoCache")) +""" +function ISClearInfoCache(petsclib::PetscLibType, is::IS, clear_permanent_loc::PetscBool) end + +@for_petsc function ISClearInfoCache(petsclib::$UnionPetscLib, is::IS, clear_permanent_loc::PetscBool ) + + @chk ccall( + (:ISClearInfoCache, $petsc_library), + PetscErrorCode, + (CIS, PetscBool), + is, clear_permanent_loc, + ) + + + return nothing +end + +""" + ISSetInfo(petsclib::PetscLibType,is::IS, info::ISInfo, type::ISInfoType, permanent::PetscBool, flg::PetscBool) +Set known information about an index set. + +Logically Collective if `ISInfoType` is `IS_GLOBAL` + +Input Parameters: +- `is` - the index set +- `info` - describing a property of the index set, one of those listed below, +- `type` - `IS_LOCAL` if the information describes the local portion of the index set, +`IS_GLOBAL` if it describes the whole index set +- `permanent` - `PETSC_TRUE` if it is known that the property will persist through changes to the index set, `PETSC_FALSE` otherwise +If the user sets a property as permanently known, it will bypass computation of that property +- `flg` - set the described property as true (`PETSC_TRUE`) or false (`PETSC_FALSE`) + +Values of `info` Describing `IS` Structure: +- `IS_SORTED` - the [local part of the] index set is sorted in ascending order +- `IS_UNIQUE` - each entry in the [local part of the] index set is unique +- `IS_PERMUTATION` - the [local part of the] index set is a permutation of the integers {0, 1, ..., N-1}, where N is the size of the [local part of the] index set +- `IS_INTERVAL` - the [local part of the] index set is equal to a contiguous range of integers {f, f + 1, ..., f + N-1} +- `IS_IDENTITY` - the [local part of the] index set is equal to the integers {0, 1, ..., N-1} + +Level: advanced + +-seealso: `ISInfo`, `ISInfoType`, `IS` + +# External Links +$(_doc_external("Vec/ISSetInfo")) +""" +function ISSetInfo(petsclib::PetscLibType, is::IS, info::ISInfo, type::ISInfoType, permanent::PetscBool, flg::PetscBool) end + +@for_petsc function ISSetInfo(petsclib::$UnionPetscLib, is::IS, info::ISInfo, type::ISInfoType, permanent::PetscBool, flg::PetscBool ) + + @chk ccall( + (:ISSetInfo, $petsc_library), + PetscErrorCode, + (CIS, ISInfo, ISInfoType, PetscBool, PetscBool), + is, info, type, permanent, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = ISGetInfo(petsclib::PetscLibType,is::IS, info::ISInfo, type::ISInfoType, compute::PetscBool) +Determine whether an index set satisfies a given property + +Collective or Logically Collective if the type is `IS_GLOBAL` (logically collective if the value of the property has been permanently set with `ISSetInfo()`) + +Input Parameters: +- `is` - the index set +- `info` - describing a property of the index set, one of those listed in the documentation of `ISSetInfo()` +- `compute` - if `PETSC_FALSE`, the property will not be computed if it is not already known and the property will be assumed to be false +- `type` - whether the property is local (`IS_LOCAL`) or global (`IS_GLOBAL`) + +Output Parameter: +- `flg` - whether the property is true (`PETSC_TRUE`) or false (`PETSC_FALSE`) + +Level: advanced + +-seealso: `IS`, `ISInfo`, `ISInfoType`, `ISSetInfo()`, `ISClearInfoCache()` + +# External Links +$(_doc_external("Vec/ISGetInfo")) +""" +function ISGetInfo(petsclib::PetscLibType, is::IS, info::ISInfo, type::ISInfoType, compute::PetscBool) end + +@for_petsc function ISGetInfo(petsclib::$UnionPetscLib, is::IS, info::ISInfo, type::ISInfoType, compute::PetscBool ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:ISGetInfo, $petsc_library), + PetscErrorCode, + (CIS, ISInfo, ISInfoType, PetscBool, Ptr{PetscBool}), + is, info, type, compute, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + ident::PetscBool = ISIdentity(petsclib::PetscLibType,is::IS) +Determines whether index set is the identity mapping. + +Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `ident` - `PETSC_TRUE` if an identity, else `PETSC_FALSE` + +Level: intermediate + +-seealso: `IS`, `ISSetIdentity()`, `ISGetInfo()` + +# External Links +$(_doc_external("Vec/ISIdentity")) +""" +function ISIdentity(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISIdentity(petsclib::$UnionPetscLib, is::IS ) + ident_ = Ref{PetscBool}() + + @chk ccall( + (:ISIdentity, $petsc_library), + PetscErrorCode, + (CIS, Ptr{PetscBool}), + is, ident_, + ) + + ident = ident_[] + + return ident +end + +""" + ISSetIdentity(petsclib::PetscLibType,is::IS) +Informs the index set that it is an identity. + +Logically Collective + +Input Parameter: +- `is` - the index set + +Level: intermediate + +-seealso: `IS`, `ISIdentity()`, `ISSetInfo()`, `ISClearInfoCache()` + +# External Links +$(_doc_external("Vec/ISSetIdentity")) +""" +function ISSetIdentity(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISSetIdentity(petsclib::$UnionPetscLib, is::IS ) + + @chk ccall( + (:ISSetIdentity, $petsc_library), + PetscErrorCode, + (CIS,), + is, + ) + + + return nothing +end + +""" + start::PetscInt,contig::PetscBool = ISContiguousLocal(petsclib::PetscLibType,is::IS, gstart::PetscInt, gend::PetscInt) +Locates an index set with contiguous range within a global range, if possible + +Not Collective + +Input Parameters: +- `is` - the index set +- `gstart` - global start +- `gend` - global end + +Output Parameters: +- `start` - start of contiguous block, as an offset from `gstart` +- `contig` - `PETSC_TRUE` if the index set refers to contiguous entries on this process, else `PETSC_FALSE` + +Level: developer + +-seealso: `IS`, `ISGetLocalSize()`, `VecGetOwnershipRange()` + +# External Links +$(_doc_external("Vec/ISContiguousLocal")) +""" +function ISContiguousLocal(petsclib::PetscLibType, is::IS, gstart::PetscInt, gend::PetscInt) end + +@for_petsc function ISContiguousLocal(petsclib::$UnionPetscLib, is::IS, gstart::$PetscInt, gend::$PetscInt ) + start_ = Ref{$PetscInt}() + contig_ = Ref{PetscBool}() + + @chk ccall( + (:ISContiguousLocal, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{PetscBool}), + is, gstart, gend, start_, contig_, + ) + + start = start_[] + contig = contig_[] + + return start,contig +end + +""" + perm::PetscBool = ISPermutation(petsclib::PetscLibType,is::IS) +`PETSC_TRUE` or `PETSC_FALSE` depending on whether the +index set has been declared to be a permutation. + +Logically Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `perm` - `PETSC_TRUE` if a permutation, else `PETSC_FALSE` + +Level: intermediate + +-seealso: `IS`, `ISSetPermutation()`, `ISGetInfo()` + +# External Links +$(_doc_external("Vec/ISPermutation")) +""" +function ISPermutation(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISPermutation(petsclib::$UnionPetscLib, is::IS ) + perm_ = Ref{PetscBool}() + + @chk ccall( + (:ISPermutation, $petsc_library), + PetscErrorCode, + (CIS, Ptr{PetscBool}), + is, perm_, + ) + + perm = perm_[] + + return perm +end + +""" + ISSetPermutation(petsclib::PetscLibType,is::IS) +Informs the index set that it is a permutation. + +Logically Collective + +Input Parameter: +- `is` - the index set + +Level: intermediate + +-seealso: `IS`, `ISPermutation()`, `ISSetInfo()`, `ISClearInfoCache().` + +# External Links +$(_doc_external("Vec/ISSetPermutation")) +""" +function ISSetPermutation(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISSetPermutation(petsclib::$UnionPetscLib, is::IS ) + + @chk ccall( + (:ISSetPermutation, $petsc_library), + PetscErrorCode, + (CIS,), + is, + ) + + + return nothing +end + +""" + ISDestroy(petsclib::PetscLibType,is::IS) +Destroys an index set. + +Collective + +Input Parameter: +- `is` - the index set + +Level: beginner + +-seealso: `IS`, `ISCreateGeneral()`, `ISCreateStride()`, `ISCreateBlock()` + +# External Links +$(_doc_external("Vec/ISDestroy")) +""" +function ISDestroy(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISDestroy(petsclib::$UnionPetscLib, is::IS ) + is_ = Ref(is.ptr) + + @chk ccall( + (:ISDestroy, $petsc_library), + PetscErrorCode, + (Ptr{CIS},), + is_, + ) + + is.ptr = C_NULL + + return nothing +end + +""" + ISInvertPermutation(petsclib::PetscLibType,is::IS, nloc::PetscInt, isout::IS) +Creates a new permutation that is the inverse of +a given permutation. + +Collective + +Input Parameters: +- `is` - the index set +- `nlocal` - number of indices on this processor in result (ignored for 1 processor) or +use `PETSC_DECIDE` + +Output Parameter: +- `isout` - the inverse permutation + +Level: intermediate + +-seealso: `IS`, `ISGetInfo()`, `ISSetPermutation()`, `ISGetPermutation()` + +# External Links +$(_doc_external("Vec/ISInvertPermutation")) +""" +function ISInvertPermutation(petsclib::PetscLibType, is::IS, nloc::PetscInt, isout::IS) end + +@for_petsc function ISInvertPermutation(petsclib::$UnionPetscLib, is::IS, nloc::$PetscInt, isout::IS ) + isout_ = Ref(isout.ptr) + + @chk ccall( + (:ISInvertPermutation, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, Ptr{CIS}), + is, nloc, isout_, + ) + + isout.ptr = C_NULL + + return nothing +end + +""" + size::PetscInt = ISGetSize(petsclib::PetscLibType,is::IS) +Returns the global length of an index set. + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `size` - the global size + +Level: beginner + +-seealso: `IS` + +# External Links +$(_doc_external("Vec/ISGetSize")) +""" +function ISGetSize(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISGetSize(petsclib::$UnionPetscLib, is::IS ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:ISGetSize, $petsc_library), + PetscErrorCode, + (CIS, Ptr{$PetscInt}), + is, size_, + ) + + size = size_[] + + return size +end + +""" + size::PetscInt = ISGetLocalSize(petsclib::PetscLibType,is::IS) +Returns the local (processor) length of an index set. + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `size` - the local size + +Level: beginner + +-seealso: `IS`, `ISGetSize()` + +# External Links +$(_doc_external("Vec/ISGetLocalSize")) +""" +function ISGetLocalSize(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISGetLocalSize(petsclib::$UnionPetscLib, is::IS ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:ISGetLocalSize, $petsc_library), + PetscErrorCode, + (CIS, Ptr{$PetscInt}), + is, size_, + ) + + size = size_[] + + return size +end + +""" + ISGetLayout(petsclib::PetscLibType,is::IS, map::PetscLayout) +get `PetscLayout` describing index set layout + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `map` - the layout + +Level: developer + +-seealso: `IS`, `PetscLayout`, `ISSetLayout()`, `ISGetSize()`, `ISGetLocalSize()` + +# External Links +$(_doc_external("Vec/ISGetLayout")) +""" +function ISGetLayout(petsclib::PetscLibType, is::IS, map::PetscLayout) end + +@for_petsc function ISGetLayout(petsclib::$UnionPetscLib, is::IS, map::PetscLayout ) + + @chk ccall( + (:ISGetLayout, $petsc_library), + PetscErrorCode, + (CIS, Ptr{PetscLayout}), + is, map, + ) + + + return nothing +end + +""" + ISSetLayout(petsclib::PetscLibType,is::IS, map::PetscLayout) +set `PetscLayout` describing index set layout + +Collective + +Input Parameters: +- `is` - the index set +- `map` - the layout + +Level: developer + +-seealso: `IS`, `PetscLayout`, `ISCreate()`, `ISGetLayout()`, `ISGetSize()`, `ISGetLocalSize()` + +# External Links +$(_doc_external("Vec/ISSetLayout")) +""" +function ISSetLayout(petsclib::PetscLibType, is::IS, map::PetscLayout) end + +@for_petsc function ISSetLayout(petsclib::$UnionPetscLib, is::IS, map::PetscLayout ) + + @chk ccall( + (:ISSetLayout, $petsc_library), + PetscErrorCode, + (CIS, PetscLayout), + is, map, + ) + + + return nothing +end + +""" + ptr::Vector{PetscInt} = ISGetIndices(petsclib::PetscLibType,is::IS) +Returns a pointer to the indices. The user should call +`ISRestoreIndices()` after having looked at the indices. The user should +NOT change the indices. + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `ptr` - the location to put the pointer to the indices + +Level: intermediate + +-seealso: `IS`, `ISRestoreIndices()` + +# External Links +$(_doc_external("Vec/ISGetIndices")) +""" +function ISGetIndices(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISGetIndices(petsclib::$UnionPetscLib, is::IS ) + ptr_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISGetIndices, $petsc_library), + PetscErrorCode, + (CIS, Ptr{Ptr{$PetscInt}}), + is, ptr_, + ) + + ptr = unsafe_wrap(Array, ptr_[], ISGetLocalSize(petsclib, is); own = false) + + return ptr +end + +""" + min::PetscInt,max::PetscInt = ISGetMinMax(petsclib::PetscLibType,is::IS) +Gets the minimum and maximum values in an `IS` + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameters: +- `min` - the minimum value, you may pass `NULL` +- `max` - the maximum value, you may pass `NULL` + +Level: intermediate + +-seealso: `IS`, `ISGetIndices()`, `ISRestoreIndices()` + +# External Links +$(_doc_external("Vec/ISGetMinMax")) +""" +function ISGetMinMax(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISGetMinMax(petsclib::$UnionPetscLib, is::IS ) + min_ = Ref{$PetscInt}() + max_ = Ref{$PetscInt}() + + @chk ccall( + (:ISGetMinMax, $petsc_library), + PetscErrorCode, + (CIS, Ptr{$PetscInt}, Ptr{$PetscInt}), + is, min_, max_, + ) + + min = min_[] + max = max_[] + + return min,max +end + +""" + location::PetscInt = ISLocate(petsclib::PetscLibType,is::IS, key::PetscInt) +determine the location of an index within the local component of an index set + +Not Collective + +Input Parameters: +- `is` - the index set +- `key` - the search key + +Output Parameter: +- `location` - if >= 0, a location within the index set that is equal to the key, otherwise the key is not in the index set + +Level: intermediate + +-seealso: `IS` + +# External Links +$(_doc_external("Vec/ISLocate")) +""" +function ISLocate(petsclib::PetscLibType, is::IS, key::PetscInt) end + +@for_petsc function ISLocate(petsclib::$UnionPetscLib, is::IS, key::$PetscInt ) + location_ = Ref{$PetscInt}() + + @chk ccall( + (:ISLocate, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, Ptr{$PetscInt}), + is, key, location_, + ) + + location = location_[] + + return location +end + +""" + ISRestoreIndices(petsclib::PetscLibType,is::IS, ptr::Vector{PetscInt}) +Restores an index set to a usable state after a call to `ISGetIndices()`. + +Not Collective + +Input Parameters: +- `is` - the index set +- `ptr` - the pointer obtained by `ISGetIndices()` + +Level: intermediate + +-seealso: `IS`, `ISGetIndices()` + +# External Links +$(_doc_external("Vec/ISRestoreIndices")) +""" +function ISRestoreIndices(petsclib::PetscLibType, is::IS, ptr::Vector{PetscInt}) end + +@for_petsc function ISRestoreIndices(petsclib::$UnionPetscLib, is::IS, ptr::Vector{$PetscInt} ) + ptr_ = Ref(pointer(ptr)) + + @chk ccall( + (:ISRestoreIndices, $petsc_library), + PetscErrorCode, + (CIS, Ptr{Ptr{$PetscInt}}), + is, ptr_, + ) + + + return nothing +end + +""" + indices::Vector{PetscInt} = ISGetTotalIndices(petsclib::PetscLibType,is::IS) +Retrieve an array containing all indices across the communicator. + +Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `indices` - total indices with rank 0 indices first, and so on; total array size is +the same as returned with `ISGetSize()`. + +Level: intermediate + +-seealso: `IS`, `ISRestoreTotalIndices()`, `ISGetNonlocalIndices()`, `ISGetSize()` + +# External Links +$(_doc_external("Vec/ISGetTotalIndices")) +""" +function ISGetTotalIndices(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISGetTotalIndices(petsclib::$UnionPetscLib, is::IS ) + indices_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISGetTotalIndices, $petsc_library), + PetscErrorCode, + (CIS, Ptr{Ptr{$PetscInt}}), + is, indices_, + ) + + indices = unsafe_wrap(Array, indices_[], VecGetLocalSize(petsclib, x); own = false) + + return indices +end + +""" + ISRestoreTotalIndices(petsclib::PetscLibType,is::IS, indices::Vector{PetscInt}) +Restore the index array obtained with `ISGetTotalIndices()`. + +Not Collective. + +Input Parameters: +- `is` - the index set +- `indices` - index array; must be the array obtained with `ISGetTotalIndices()` + +Level: intermediate + +-seealso: `IS`, `ISGetNonlocalIndices()` + +# External Links +$(_doc_external("Vec/ISRestoreTotalIndices")) +""" +function ISRestoreTotalIndices(petsclib::PetscLibType, is::IS, indices::Vector{PetscInt}) end + +@for_petsc function ISRestoreTotalIndices(petsclib::$UnionPetscLib, is::IS, indices::Vector{$PetscInt} ) + indices_ = Ref(pointer(indices)) + + @chk ccall( + (:ISRestoreTotalIndices, $petsc_library), + PetscErrorCode, + (CIS, Ptr{Ptr{$PetscInt}}), + is, indices_, + ) + + + return nothing +end + +""" + indices::Vector{PetscInt} = ISGetNonlocalIndices(petsclib::PetscLibType,is::IS) +Retrieve an array of indices from remote processors +in this communicator. + +Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `indices` - indices with rank 0 indices first, and so on, omitting +the current rank. Total number of indices is the difference +total and local, obtained with `ISGetSize()` and `ISGetLocalSize()`, +respectively. + +Level: intermediate + +-seealso: `IS`, `ISGetTotalIndices()`, `ISRestoreNonlocalIndices()`, `ISGetSize()`, `ISGetLocalSize().` + +# External Links +$(_doc_external("Vec/ISGetNonlocalIndices")) +""" +function ISGetNonlocalIndices(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISGetNonlocalIndices(petsclib::$UnionPetscLib, is::IS ) + indices_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISGetNonlocalIndices, $petsc_library), + PetscErrorCode, + (CIS, Ptr{Ptr{$PetscInt}}), + is, indices_, + ) + + indices = unsafe_wrap(Array, indices_[], VecGetLocalSize(petsclib, x); own = false) + + return indices +end + +""" + ISRestoreNonlocalIndices(petsclib::PetscLibType,is::IS, indices::Vector{PetscInt}) +Restore the index array obtained with `ISGetNonlocalIndices()`. + +Not Collective. + +Input Parameters: +- `is` - the index set +- `indices` - index array; must be the array obtained with `ISGetNonlocalIndices()` + +Level: intermediate + +-seealso: `IS`, `ISGetTotalIndices()`, `ISGetNonlocalIndices()`, `ISRestoreTotalIndices()` + +# External Links +$(_doc_external("Vec/ISRestoreNonlocalIndices")) +""" +function ISRestoreNonlocalIndices(petsclib::PetscLibType, is::IS, indices::Vector{PetscInt}) end + +@for_petsc function ISRestoreNonlocalIndices(petsclib::$UnionPetscLib, is::IS, indices::Vector{$PetscInt} ) + indices_ = Ref(pointer(indices)) + + @chk ccall( + (:ISRestoreNonlocalIndices, $petsc_library), + PetscErrorCode, + (CIS, Ptr{Ptr{$PetscInt}}), + is, indices_, + ) + + + return nothing +end + +""" + ISGetNonlocalIS(petsclib::PetscLibType,is::IS, complement::IS) +Gather all nonlocal indices for this `IS` and present +them as another sequential index set. + +Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `complement` - sequential `IS` with indices identical to the result of +`ISGetNonlocalIndices()` + +Level: intermediate + +-seealso: `IS`, `ISGetNonlocalIndices()`, `ISRestoreNonlocalIndices()`, `ISAllGather()`, `ISGetSize()` + +# External Links +$(_doc_external("Vec/ISGetNonlocalIS")) +""" +function ISGetNonlocalIS(petsclib::PetscLibType, is::IS, complement::IS) end + +@for_petsc function ISGetNonlocalIS(petsclib::$UnionPetscLib, is::IS, complement::IS ) + complement_ = Ref(complement.ptr) + + @chk ccall( + (:ISGetNonlocalIS, $petsc_library), + PetscErrorCode, + (CIS, Ptr{CIS}), + is, complement_, + ) + + complement.ptr = C_NULL + + return nothing +end + +""" + ISRestoreNonlocalIS(petsclib::PetscLibType,is::IS, complement::IS) +Restore the `IS` obtained with `ISGetNonlocalIS()`. + +Not collective. + +Input Parameters: +- `is` - the index set +- `complement` - index set of `is`'s nonlocal indices + +Level: intermediate + +-seealso: `IS`, `ISGetNonlocalIS()`, `ISGetNonlocalIndices()`, `ISRestoreNonlocalIndices()` + +# External Links +$(_doc_external("Vec/ISRestoreNonlocalIS")) +""" +function ISRestoreNonlocalIS(petsclib::PetscLibType, is::IS, complement::IS) end + +@for_petsc function ISRestoreNonlocalIS(petsclib::$UnionPetscLib, is::IS, complement::IS ) + complement_ = Ref(complement.ptr) + + @chk ccall( + (:ISRestoreNonlocalIS, $petsc_library), + PetscErrorCode, + (CIS, Ptr{CIS}), + is, complement_, + ) + + complement.ptr = C_NULL + + return nothing +end + +""" + ISViewFromOptions(petsclib::PetscLibType,A::IS, obj::PetscObject, name::String) +View an `IS` based on options in the options database + +Collective + +Input Parameters: +- `A` - the index set +- `obj` - Optional object that provides the prefix for the options database +- `name` - command line option + +Level: intermediate + +-seealso: `IS`, `ISView()`, `PetscObjectViewFromOptions()`, `ISCreate()` + +# External Links +$(_doc_external("Vec/ISViewFromOptions")) +""" +function ISViewFromOptions(petsclib::PetscLibType, A::IS, obj::PetscObject, name::String) end + +@for_petsc function ISViewFromOptions(petsclib::$UnionPetscLib, A::IS, obj::PetscObject, name::String ) + + @chk ccall( + (:ISViewFromOptions, $petsc_library), + PetscErrorCode, + (CIS, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + ISView(petsclib::PetscLibType,is::IS, viewer::PetscViewer) +Displays an index set. + +Collective + +Input Parameters: +- `is` - the index set +- `viewer` - viewer used to display the set, for example `PETSC_VIEWER_STDOUT_SELF`. + +Level: intermediate + +-seealso: `IS`, `PetscViewer`, `PetscViewerASCIIOpen()`, `ISViewFromOptions()` + +# External Links +$(_doc_external("Vec/ISView")) +""" +function ISView(petsclib::PetscLibType, is::IS, viewer::PetscViewer) end + +@for_petsc function ISView(petsclib::$UnionPetscLib, is::IS, viewer::PetscViewer ) + + @chk ccall( + (:ISView, $petsc_library), + PetscErrorCode, + (CIS, PetscViewer), + is, viewer, + ) + + + return nothing +end + +""" + ISLoad(petsclib::PetscLibType,is::IS, viewer::PetscViewer) +Loads an index set that has been stored in binary or HDF5 format with `ISView()`. + +Collective + +Input Parameters: +- `is` - the newly loaded index set, this needs to have been created with `ISCreate()` or some related function before a call to `ISLoad()`. +- `viewer` - binary file viewer, obtained from `PetscViewerBinaryOpen()` or HDF5 file viewer, obtained from `PetscViewerHDF5Open()` + +Level: intermediate + +-seealso: `IS`, `PetscViewerBinaryOpen()`, `ISView()`, `MatLoad()`, `VecLoad()` + +# External Links +$(_doc_external("Vec/ISLoad")) +""" +function ISLoad(petsclib::PetscLibType, is::IS, viewer::PetscViewer) end + +@for_petsc function ISLoad(petsclib::$UnionPetscLib, is::IS, viewer::PetscViewer ) + + @chk ccall( + (:ISLoad, $petsc_library), + PetscErrorCode, + (CIS, PetscViewer), + is, viewer, + ) + + + return nothing +end + +""" + ISSort(petsclib::PetscLibType,is::IS) +Sorts the indices of an index set. + +Collective + +Input Parameter: +- `is` - the index set + +Level: intermediate + +-seealso: `IS`, `ISSortRemoveDups()`, `ISSorted()` + +# External Links +$(_doc_external("Vec/ISSort")) +""" +function ISSort(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISSort(petsclib::$UnionPetscLib, is::IS ) + + @chk ccall( + (:ISSort, $petsc_library), + PetscErrorCode, + (CIS,), + is, + ) + + + return nothing +end + +""" + ISSortRemoveDups(petsclib::PetscLibType,is::IS) +Sorts the indices of an index set, removing duplicates. + +Collective + +Input Parameter: +- `is` - the index set + +Level: intermediate + +-seealso: `IS`, `ISSort()`, `ISSorted()` + +# External Links +$(_doc_external("Vec/ISSortRemoveDups")) +""" +function ISSortRemoveDups(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISSortRemoveDups(petsclib::$UnionPetscLib, is::IS ) + + @chk ccall( + (:ISSortRemoveDups, $petsc_library), + PetscErrorCode, + (CIS,), + is, + ) + + + return nothing +end + +""" + ISToGeneral(petsclib::PetscLibType,is::IS) +Converts an IS object of any type to `ISGENERAL` type + +Collective + +Input Parameter: +- `is` - the index set + +Level: intermediate + +-seealso: `IS`, `ISSorted()` + +# External Links +$(_doc_external("Vec/ISToGeneral")) +""" +function ISToGeneral(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISToGeneral(petsclib::$UnionPetscLib, is::IS ) + + @chk ccall( + (:ISToGeneral, $petsc_library), + PetscErrorCode, + (CIS,), + is, + ) + + + return nothing +end + +""" + flg::PetscBool = ISSorted(petsclib::PetscLibType,is::IS) +Checks the indices to determine whether they have been sorted. + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `flg` - output flag, either `PETSC_TRUE` if the index set is sorted, +or `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `ISSort()`, `ISSortRemoveDups()` + +# External Links +$(_doc_external("Vec/ISSorted")) +""" +function ISSorted(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISSorted(petsclib::$UnionPetscLib, is::IS ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:ISSorted, $petsc_library), + PetscErrorCode, + (CIS, Ptr{PetscBool}), + is, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + newIS::IS = ISDuplicate(petsclib::PetscLibType,is::IS) +Creates a duplicate copy of an index set. + +Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `newIS` - the copy of the index set + +Level: beginner + +-seealso: `IS`, `ISCreateGeneral()`, `ISCopy()` + +# External Links +$(_doc_external("Vec/ISDuplicate")) +""" +function ISDuplicate(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISDuplicate(petsclib::$UnionPetscLib, is::IS ) + newIS_ = Ref{CIS}() + + @chk ccall( + (:ISDuplicate, $petsc_library), + PetscErrorCode, + (CIS, Ptr{CIS}), + is, newIS_, + ) + + newIS = IS(newIS_[], petsclib) + + return newIS +end + +""" + ISCopy(petsclib::PetscLibType,is::IS, isy::IS) +Copies an index set. + +Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `isy` - the copy of the index set + +Level: beginner + +-seealso: `IS`, `ISDuplicate()`, `ISShift()` + +# External Links +$(_doc_external("Vec/ISCopy")) +""" +function ISCopy(petsclib::PetscLibType, is::IS, isy::IS) end + +@for_petsc function ISCopy(petsclib::$UnionPetscLib, is::IS, isy::IS ) + + @chk ccall( + (:ISCopy, $petsc_library), + PetscErrorCode, + (CIS, CIS), + is, isy, + ) + + + return nothing +end + +""" + ISShift(petsclib::PetscLibType,is::IS, offset::PetscInt, isy::IS) +Shift all indices by given offset + +Collective + +Input Parameters: +- `is` - the index set +- `offset` - the offset + +Output Parameter: +- `isy` - the shifted copy of the input index set + +Level: beginner + +-seealso: `ISDuplicate()`, `ISCopy()` + +# External Links +$(_doc_external("Vec/ISShift")) +""" +function ISShift(petsclib::PetscLibType, is::IS, offset::PetscInt, isy::IS) end + +@for_petsc function ISShift(petsclib::$UnionPetscLib, is::IS, offset::$PetscInt, isy::IS ) + + @chk ccall( + (:ISShift, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, CIS), + is, offset, isy, + ) + + + return nothing +end + +""" + ISOnComm(petsclib::PetscLibType,is::IS, comm::MPI_Comm, mode::PetscCopyMode, newis::IS) +Split a parallel `IS` on subcomms (usually self) or concatenate index sets on subcomms into a parallel index set + +Collective + +Input Parameters: +- `is` - index set +- `comm` - communicator for new index set +- `mode` - copy semantics, `PETSC_USE_POINTER` for no-copy if possible, otherwise `PETSC_COPY_VALUES` + +Output Parameter: +- `newis` - new `IS` on `comm` + +Level: advanced + +-seealso: `IS` + +# External Links +$(_doc_external("Vec/ISOnComm")) +""" +function ISOnComm(petsclib::PetscLibType, is::IS, comm::MPI_Comm, mode::PetscCopyMode, newis::IS) end + +@for_petsc function ISOnComm(petsclib::$UnionPetscLib, is::IS, comm::MPI_Comm, mode::PetscCopyMode, newis::IS ) + newis_ = Ref(newis.ptr) + + @chk ccall( + (:ISOnComm, $petsc_library), + PetscErrorCode, + (CIS, MPI_Comm, PetscCopyMode, Ptr{CIS}), + is, comm, mode, newis_, + ) + + newis.ptr = C_NULL + + return nothing +end + +""" + ISSetBlockSize(petsclib::PetscLibType,is::IS, bs::PetscInt) +informs an index set that it has a given block size + +Logicall Collective + +Input Parameters: +- `is` - index set +- `bs` - block size + +Level: intermediate + +-seealso: `IS`, `ISGetBlockSize()`, `ISCreateBlock()`, `ISBlockGetIndices()`, + +# External Links +$(_doc_external("Vec/ISSetBlockSize")) +""" +function ISSetBlockSize(petsclib::PetscLibType, is::IS, bs::PetscInt) end + +@for_petsc function ISSetBlockSize(petsclib::$UnionPetscLib, is::IS, bs::$PetscInt ) + + @chk ccall( + (:ISSetBlockSize, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt), + is, bs, + ) + + + return nothing +end + +""" + size::PetscInt = ISGetBlockSize(petsclib::PetscLibType,is::IS) +Returns the number of elements in a block. + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `size` - the number of elements in a block + +Level: intermediate + +-seealso: `IS`, `ISBlockGetSize()`, `ISGetSize()`, `ISCreateBlock()`, `ISSetBlockSize()` + +# External Links +$(_doc_external("Vec/ISGetBlockSize")) +""" +function ISGetBlockSize(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISGetBlockSize(petsclib::$UnionPetscLib, is::IS ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:ISGetBlockSize, $petsc_library), + PetscErrorCode, + (CIS, Ptr{$PetscInt}), + is, size_, + ) + + size = size_[] + + return size +end + +""" + ISSetCompressOutput(petsclib::PetscLibType,is::IS, compress::PetscBool) +set the flag for output compression + +Logicall Collective + +Input Parameters: +- `is` - index set +- `compress` - flag for output compression + +Level: intermediate + +-seealso: `IS`, `ISGetCompressOutput()`, `ISView()` + +# External Links +$(_doc_external("Vec/ISSetCompressOutput")) +""" +function ISSetCompressOutput(petsclib::PetscLibType, is::IS, compress::PetscBool) end + +@for_petsc function ISSetCompressOutput(petsclib::$UnionPetscLib, is::IS, compress::PetscBool ) + + @chk ccall( + (:ISSetCompressOutput, $petsc_library), + PetscErrorCode, + (CIS, PetscBool), + is, compress, + ) + + + return nothing +end + +""" + compress::PetscBool = ISGetCompressOutput(petsclib::PetscLibType,is::IS) +Returns the flag for output compression + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `compress` - the flag to compress output + +Level: intermediate + +-seealso: `IS`, `ISSetCompressOutput()`, `ISView()` + +# External Links +$(_doc_external("Vec/ISGetCompressOutput")) +""" +function ISGetCompressOutput(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISGetCompressOutput(petsclib::$UnionPetscLib, is::IS ) + compress_ = Ref{PetscBool}() + + @chk ccall( + (:ISGetCompressOutput, $petsc_library), + PetscErrorCode, + (CIS, Ptr{PetscBool}), + is, compress_, + ) + + compress = compress_[] + + return compress +end + +""" + ISRegisterAll(petsclib::PetscLibType) +Registers all of the index set components in the `IS` package. + +Not Collective + +Level: advanced + +-seealso: [](sec_scatter), `IS`, `ISType`, `ISRegister()` + +# External Links +$(_doc_external("Vec/ISRegisterAll")) +""" +function ISRegisterAll(petsclib::PetscLibType) end + +@for_petsc function ISRegisterAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:ISRegisterAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + is::IS = ISCreateGeneral(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, idx::Vector{PetscInt}, mode::PetscCopyMode) +Creates a data structure for an index set containing a list of integers. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `n` - the length of the index set +- `idx` - the list of integers +- `mode` - `PETSC_COPY_VALUES`, `PETSC_OWN_POINTER`, or `PETSC_USE_POINTER`; see `PetscCopyMode` for meaning of this flag. + +Output Parameter: +- `is` - the new index set + +Level: beginner + +-seealso: [](sec_scatter), `IS`, `ISGENERAL`, `ISCreateStride()`, `ISCreateBlock()`, `ISAllGather()`, `PETSC_COPY_VALUES`, `PETSC_OWN_POINTER`, +`PETSC_USE_POINTER`, `PetscCopyMode`, `ISGeneralSetIndicesFromMask()` + +# External Links +$(_doc_external("Vec/ISCreateGeneral")) +""" +function ISCreateGeneral(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, idx::Vector{PetscInt}, mode::PetscCopyMode) end + +@for_petsc function ISCreateGeneral(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, idx::Vector{$PetscInt}, mode::PetscCopyMode ) + is_ = Ref{CIS}() + + @chk ccall( + (:ISCreateGeneral, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{$PetscInt}, PetscCopyMode, Ptr{CIS}), + comm, n, idx, mode, is_, + ) + + is = IS(is_[], petsclib) + + return is +end + +""" + ISGeneralSetIndices(petsclib::PetscLibType,is::IS, n::PetscInt, idx::Vector{PetscInt}, mode::PetscCopyMode) +Sets the indices for an `ISGENERAL` index set + +Logically Collective + +Input Parameters: +- `is` - the index set +- `n` - the length of the index set +- `idx` - the list of integers +- `mode` - see `PetscCopyMode` for meaning of this flag. + +Level: beginner + +-seealso: [](sec_scatter), `IS`, `ISBLOCK`, `ISCreateGeneral()`, `ISGeneralSetIndicesFromMask()`, `ISBlockSetIndices()`, `ISGENERAL`, `PetscCopyMode` + +# External Links +$(_doc_external("Vec/ISGeneralSetIndices")) +""" +function ISGeneralSetIndices(petsclib::PetscLibType, is::IS, n::PetscInt, idx::Vector{PetscInt}, mode::PetscCopyMode) end + +@for_petsc function ISGeneralSetIndices(petsclib::$UnionPetscLib, is::IS, n::$PetscInt, idx::Vector{$PetscInt}, mode::PetscCopyMode ) + + @chk ccall( + (:ISGeneralSetIndices, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, Ptr{$PetscInt}, PetscCopyMode), + is, n, idx, mode, + ) + + + return nothing +end + +""" + ISGeneralSetIndicesFromMask(petsclib::PetscLibType,is::IS, rstart::PetscInt, rend::PetscInt, mask::Vector{PetscBool}) +Sets the indices for an `ISGENERAL` index set using a boolean mask + +Collective + +Input Parameters: +- `is` - the index set +- `rstart` - the range start index (inclusive) +- `rend` - the range end index (exclusive) +- `mask` - the boolean mask array of length rend-rstart, indices will be set for each `PETSC_TRUE` value in the array + +Level: beginner + +-seealso: [](sec_scatter), `IS`, `ISCreateGeneral()`, `ISGeneralSetIndices()`, `ISGENERAL` + +# External Links +$(_doc_external("Vec/ISGeneralSetIndicesFromMask")) +""" +function ISGeneralSetIndicesFromMask(petsclib::PetscLibType, is::IS, rstart::PetscInt, rend::PetscInt, mask::Vector{PetscBool}) end + +@for_petsc function ISGeneralSetIndicesFromMask(petsclib::$UnionPetscLib, is::IS, rstart::$PetscInt, rend::$PetscInt, mask::Vector{PetscBool} ) + + @chk ccall( + (:ISGeneralSetIndicesFromMask, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, $PetscInt, Ptr{PetscBool}), + is, rstart, rend, mask, + ) + + + return nothing +end + +""" + ISGeneralFilter(petsclib::PetscLibType,is::IS, start::PetscInt, _::PetscInt) +Remove all indices outside of [start, end) from an `ISGENERAL` + +Collective + +Input Parameters: +- `is` - the index set +- `start` - the lowest index kept +- `end` - one more than the highest index kept, `start` ≤ `end_` + +Level: beginner + +-seealso: [](sec_scatter), `IS`, `ISGENERAL`, `ISCreateGeneral()`, `ISGeneralSetIndices()` + +# External Links +$(_doc_external("Vec/ISGeneralFilter")) +""" +function ISGeneralFilter(petsclib::PetscLibType, is::IS, start::PetscInt, end_::PetscInt) end + +@for_petsc function ISGeneralFilter(petsclib::$UnionPetscLib, is::IS, start::$PetscInt, end_::$PetscInt ) + + @chk ccall( + (:ISGeneralFilter, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, $PetscInt), + is, start, end_, + ) + + + return nothing +end + +""" + first::PetscInt,step::PetscInt = ISStrideGetInfo(petsclib::PetscLibType,is::IS) +Returns the first index in a stride index set and the stride width from an `IS` of `ISType` `ISSTRIDE` + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameters: +- `first` - the first index +- `step` - the stride width + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISCreateStride()`, `ISGetSize()`, `ISSTRIDE` + +# External Links +$(_doc_external("Vec/ISStrideGetInfo")) +""" +function ISStrideGetInfo(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISStrideGetInfo(petsclib::$UnionPetscLib, is::IS ) + first_ = Ref{$PetscInt}() + step_ = Ref{$PetscInt}() + + @chk ccall( + (:ISStrideGetInfo, $petsc_library), + PetscErrorCode, + (CIS, Ptr{$PetscInt}, Ptr{$PetscInt}), + is, first_, step_, + ) + + first = first_[] + step = step_[] + + return first,step +end + +""" + ISStrideSetStride(petsclib::PetscLibType,is::IS, n::PetscInt, first::PetscInt, step::PetscInt) +Sets the stride information for a stride index set. + +Logically Collective + +Input Parameters: +- `is` - the index set +- `n` - the length of the locally owned portion of the index set +- `first` - the first element of the locally owned portion of the index set +- `step` - the change to the next index + +Level: beginner + +-seealso: [](sec_scatter), `IS`, `ISCreateGeneral()`, `ISCreateBlock()`, `ISAllGather()`, `ISSTRIDE`, `ISCreateStride()`, `ISStrideGetInfo()` + +# External Links +$(_doc_external("Vec/ISStrideSetStride")) +""" +function ISStrideSetStride(petsclib::PetscLibType, is::IS, n::PetscInt, first::PetscInt, step::PetscInt) end + +@for_petsc function ISStrideSetStride(petsclib::$UnionPetscLib, is::IS, n::$PetscInt, first::$PetscInt, step::$PetscInt ) + + @chk ccall( + (:ISStrideSetStride, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, $PetscInt, $PetscInt), + is, n, first, step, + ) + + + return nothing +end + +""" + is::IS = ISCreateStride(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, first::PetscInt, step::PetscInt) +Creates a data structure for an index set containing a list of evenly spaced integers. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `n` - the length of the locally owned portion of the index set +- `first` - the first element of the locally owned portion of the index set +- `step` - the change to the next index + +Output Parameter: +- `is` - the new index set + +Level: beginner + +-seealso: [](sec_scatter), `IS`, `ISStrideSetStride()`, `ISCreateGeneral()`, `ISCreateBlock()`, `ISAllGather()`, `ISSTRIDE` + +# External Links +$(_doc_external("Vec/ISCreateStride")) +""" +function ISCreateStride(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, first::PetscInt, step::PetscInt) end + +@for_petsc function ISCreateStride(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, first::$PetscInt, step::$PetscInt ) + is_ = Ref{CIS}() + + @chk ccall( + (:ISCreateStride, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{CIS}), + comm, n, first, step, is_, + ) + + is = IS(is_[], petsclib) + + return is +end + +""" + ISBlockSetIndices(petsclib::PetscLibType,is::IS, bs::PetscInt, n::PetscInt, idx::Vector{PetscInt}, mode::PetscCopyMode) +Set integers representing blocks of indices in an index set of `ISType` `ISBLOCK` + +Collective + +Input Parameters: +- `is` - the index set +- `bs` - number of elements in each block +- `n` - the length of the index set (the number of blocks) +- `idx` - the list of integers, one for each block, the integers contain the index of the first index of each block divided by the block size +- `mode` - see `PetscCopyMode`, only `PETSC_COPY_VALUES` and `PETSC_OWN_POINTER` are supported + +Level: beginner + +-seealso: [](sec_scatter), `IS`, `ISCreateStride()`, `ISCreateGeneral()`, `ISAllGather()`, `ISCreateBlock()`, `ISBLOCK`, `ISGeneralSetIndices()` + +# External Links +$(_doc_external("Vec/ISBlockSetIndices")) +""" +function ISBlockSetIndices(petsclib::PetscLibType, is::IS, bs::PetscInt, n::PetscInt, idx::Vector{PetscInt}, mode::PetscCopyMode) end + +@for_petsc function ISBlockSetIndices(petsclib::$UnionPetscLib, is::IS, bs::$PetscInt, n::$PetscInt, idx::Vector{$PetscInt}, mode::PetscCopyMode ) + + @chk ccall( + (:ISBlockSetIndices, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, $PetscInt, Ptr{$PetscInt}, PetscCopyMode), + is, bs, n, idx, mode, + ) + + + return nothing +end + +""" + is::IS = ISCreateBlock(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, n::PetscInt, idx::Vector{PetscInt}, mode::PetscCopyMode) +Creates a data structure for an index set containing +a list of integers. Each integer represents a fixed block size set of indices. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `bs` - number of elements in each block +- `n` - the length of the index set (the number of blocks) +- `idx` - the list of integers, one for each block, the integers contain the index of the first entry of each block divided by the block size +- `mode` - see `PetscCopyMode`, only `PETSC_COPY_VALUES` and `PETSC_OWN_POINTER` are supported in this routine + +Output Parameter: +- `is` - the new index set + +Level: beginner + +-seealso: [](sec_scatter), `IS`, `ISCreateStride()`, `ISCreateGeneral()`, `ISAllGather()`, `ISBlockSetIndices()`, `ISBLOCK`, `ISGENERAL` + +# External Links +$(_doc_external("Vec/ISCreateBlock")) +""" +function ISCreateBlock(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, n::PetscInt, idx::Vector{PetscInt}, mode::PetscCopyMode) end + +@for_petsc function ISCreateBlock(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, n::$PetscInt, idx::Vector{$PetscInt}, mode::PetscCopyMode ) + is_ = Ref{CIS}() + + @chk ccall( + (:ISCreateBlock, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{$PetscInt}, PetscCopyMode, Ptr{CIS}), + comm, bs, n, idx, mode, is_, + ) + + is = IS(is_[], petsclib) + + return is +end + +""" + idx::Vector{PetscInt} = ISBlockGetIndices(petsclib::PetscLibType,is::IS) +Gets the indices associated with each block in an `ISBLOCK` + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `idx` - the integer indices, one for each block and count of block not indices + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISBLOCK`, `ISGetIndices()`, `ISBlockRestoreIndices()`, `ISBlockSetIndices()`, `ISCreateBlock()` + +# External Links +$(_doc_external("Vec/ISBlockGetIndices")) +""" +function ISBlockGetIndices(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISBlockGetIndices(petsclib::$UnionPetscLib, is::IS ) + idx_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISBlockGetIndices, $petsc_library), + PetscErrorCode, + (CIS, Ptr{Ptr{$PetscInt}}), + is, idx_, + ) + + idx = unsafe_wrap(Array, idx_[], VecGetLocalSize(petsclib, x); own = false) + + return idx +end + +""" + idx::Vector{PetscInt} = ISBlockRestoreIndices(petsclib::PetscLibType,is::IS) +Restores the indices associated with each block in an `ISBLOCK` obtained with `ISBlockGetIndices()` + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `idx` - the integer indices + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISBLOCK`, `ISRestoreIndices()`, `ISBlockGetIndices()` + +# External Links +$(_doc_external("Vec/ISBlockRestoreIndices")) +""" +function ISBlockRestoreIndices(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISBlockRestoreIndices(petsclib::$UnionPetscLib, is::IS ) + idx_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISBlockRestoreIndices, $petsc_library), + PetscErrorCode, + (CIS, Ptr{Ptr{$PetscInt}}), + is, idx_, + ) + + idx = unsafe_wrap(Array, idx_[], VecGetLocalSize(petsclib, x); own = false) + + return idx +end + +""" + size::PetscInt = ISBlockGetLocalSize(petsclib::PetscLibType,is::IS) +Returns the local number of blocks in the index set of `ISType` `ISBLOCK` + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `size` - the local number of blocks + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISGetBlockSize()`, `ISBlockGetSize()`, `ISGetSize()`, `ISCreateBlock()`, `ISBLOCK` + +# External Links +$(_doc_external("Vec/ISBlockGetLocalSize")) +""" +function ISBlockGetLocalSize(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISBlockGetLocalSize(petsclib::$UnionPetscLib, is::IS ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:ISBlockGetLocalSize, $petsc_library), + PetscErrorCode, + (CIS, Ptr{$PetscInt}), + is, size_, + ) + + size = size_[] + + return size +end + +""" + size::PetscInt = ISBlockGetSize(petsclib::PetscLibType,is::IS) +Returns the global number of blocks in parallel in the index set of `ISType` `ISBLOCK` + +Not Collective + +Input Parameter: +- `is` - the index set + +Output Parameter: +- `size` - the global number of blocks + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISGetBlockSize()`, `ISBlockGetLocalSize()`, `ISGetSize()`, `ISCreateBlock()`, `ISBLOCK` + +# External Links +$(_doc_external("Vec/ISBlockGetSize")) +""" +function ISBlockGetSize(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISBlockGetSize(petsclib::$UnionPetscLib, is::IS ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:ISBlockGetSize, $petsc_library), + PetscErrorCode, + (CIS, Ptr{$PetscInt}), + is, size_, + ) + + size = size_[] + + return size +end + +""" + ISBuildTwoSided(petsclib::PetscLibType,ito::IS, toindx::IS, rows::IS) +Takes an `IS` that describes where each element will be mapped globally over all ranks. +Generates an `IS` that contains new numbers from remote or local on the `IS`. + +Collective + +Input Parameters: +- `ito` - an `IS` describes to which rank each entry will be mapped. Negative target rank will be ignored +- `toindx` - an `IS` describes what indices should send. `NULL` means sending natural numbering + +Output Parameter: +- `rows` - contains new numbers from remote or local + +Level: advanced + +-seealso: [](sec_scatter), `IS`, `MatPartitioningCreate()`, `ISPartitioningToNumbering()`, `ISPartitioningCount()` + +# External Links +$(_doc_external("Vec/ISBuildTwoSided")) +""" +function ISBuildTwoSided(petsclib::PetscLibType, ito::IS, toindx::IS, rows::IS) end + +@for_petsc function ISBuildTwoSided(petsclib::$UnionPetscLib, ito::IS, toindx::IS, rows::IS ) + rows_ = Ref(rows.ptr) + + @chk ccall( + (:ISBuildTwoSided, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{CIS}), + ito, toindx, rows_, + ) + + rows.ptr = C_NULL + + return nothing +end + +""" + ISPartitioningToNumbering(petsclib::PetscLibType,part::IS, is::IS) +Takes an `IS' that represents a partitioning (the MPI rank that each local entry belongs to) and on each MPI process +generates an `IS` that contains a new global node number in the new ordering for each entry + +Collective + +Input Parameter: +- `part` - a partitioning as generated by `MatPartitioningApply()` or `MatPartitioningApplyND()` + +Output Parameter: +- `is` - on each processor the index set that defines the global numbers +(in the new numbering) for all the nodes currently (before the partitioning) +on that processor + +Level: advanced + +-seealso: [](sec_scatter), `IS`, `MatPartitioningCreate()`, `AOCreateBasic()`, `ISPartitioningCount()` + +# External Links +$(_doc_external("Vec/ISPartitioningToNumbering")) +""" +function ISPartitioningToNumbering(petsclib::PetscLibType, part::IS, is::IS) end + +@for_petsc function ISPartitioningToNumbering(petsclib::$UnionPetscLib, part::IS, is::IS ) + is_ = Ref(is.ptr) + + @chk ccall( + (:ISPartitioningToNumbering, $petsc_library), + PetscErrorCode, + (CIS, Ptr{CIS}), + part, is_, + ) + + is.ptr = C_NULL + + return nothing +end + +""" + count::Vector{PetscInt} = ISPartitioningCount(petsclib::PetscLibType,part::IS, len::PetscInt) +Takes a `IS` that represents a partitioning (the MPI rank that each local entry belongs to) and determines the number of +resulting elements on each (partition) rank + +Collective + +Input Parameters: +- `part` - a partitioning as generated by `MatPartitioningApply()` or `MatPartitioningApplyND()` +- `len` - length of the array count, this is the total number of partitions + +Output Parameter: +- `count` - array of length size, to contain the number of elements assigned +to each partition, where size is the number of partitions generated +(see notes below). + +Level: advanced + +-seealso: [](sec_scatter), `IS`, `MatPartitioningCreate()`, `AOCreateBasic()`, `ISPartitioningToNumbering()`, +`MatPartitioningSetNParts()`, `MatPartitioningApply()`, `MatPartitioningApplyND()` + +# External Links +$(_doc_external("Vec/ISPartitioningCount")) +""" +function ISPartitioningCount(petsclib::PetscLibType, part::IS, len::PetscInt) end + +@for_petsc function ISPartitioningCount(petsclib::$UnionPetscLib, part::IS, len::$PetscInt ) + count = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:ISPartitioningCount, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, Ptr{$PetscInt}), + part, len, count, + ) + + + return count +end + +""" + ISAllGather(petsclib::PetscLibType,is::IS, isout::IS) +Given an index set `IS` on each processor, generates a large +index set (same on each processor) by concatenating together each +processors index set. + +Collective + +Input Parameter: +- `is` - the distributed index set + +Output Parameter: +- `isout` - the concatenated index set (same on all processors) + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISCreateGeneral()`, `ISCreateStride()`, `ISCreateBlock()` + +# External Links +$(_doc_external("Vec/ISAllGather")) +""" +function ISAllGather(petsclib::PetscLibType, is::IS, isout::IS) end + +@for_petsc function ISAllGather(petsclib::$UnionPetscLib, is::IS, isout::IS ) + isout_ = Ref(isout.ptr) + + @chk ccall( + (:ISAllGather, $petsc_library), + PetscErrorCode, + (CIS, Ptr{CIS}), + is, isout_, + ) + + isout.ptr = C_NULL + + return nothing +end + +""" + outN::PetscInt = ISAllGatherColors(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, lindices::Vector{ISColoringValue}, outindices::Vector{ISColoringValue}) +Given a set of colors on each processor, generates a large +set (same on each processor) by concatenating together each processors colors + +Collective + +Input Parameters: +- `comm` - communicator to share the indices +- `n` - local size of set +- `lindices` - local colors + +Output Parameters: +- `outN` - total number of indices +- `outindices` - all of the colors + +Level: intermediate + +-seealso: `ISColoringValue`, `ISColoring()`, `ISCreateGeneral()`, `ISCreateStride()`, `ISCreateBlock()`, `ISAllGather()` + +# External Links +$(_doc_external("Vec/ISAllGatherColors")) +""" +function ISAllGatherColors(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, lindices::Vector{ISColoringValue}, outindices::Vector{ISColoringValue}) end + +@for_petsc function ISAllGatherColors(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, lindices::Vector{ISColoringValue}, outindices::Vector{ISColoringValue} ) + outN_ = Ref{$PetscInt}() + outindices_ = Ref(pointer(outindices)) + + @chk ccall( + (:ISAllGatherColors, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{ISColoringValue}, Ptr{$PetscInt}, Ptr{Ptr{ISColoringValue}}), + comm, n, lindices, outN_, outindices_, + ) + + outN = outN_[] + + return outN +end + +""" + ISComplement(petsclib::PetscLibType,is::IS, nmin::PetscInt, nmax::PetscInt, isout::IS) +Given an index set `IS` generates the complement index set. That is +all indices that are NOT in the given set. + +Collective + +Input Parameters: +- `is` - the index set +- `nmin` - the first index desired in the local part of the complement +- `nmax` - the largest index desired in the local part of the complement (note that all indices in `is` must be greater or equal to `nmin` and less than `nmax`) + +Output Parameter: +- `isout` - the complement + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISCreateGeneral()`, `ISCreateStride()`, `ISCreateBlock()`, `ISAllGather()` + +# External Links +$(_doc_external("Vec/ISComplement")) +""" +function ISComplement(petsclib::PetscLibType, is::IS, nmin::PetscInt, nmax::PetscInt, isout::IS) end + +@for_petsc function ISComplement(petsclib::$UnionPetscLib, is::IS, nmin::$PetscInt, nmax::$PetscInt, isout::IS ) + isout_ = Ref(isout.ptr) + + @chk ccall( + (:ISComplement, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, $PetscInt, Ptr{CIS}), + is, nmin, nmax, isout_, + ) + + isout.ptr = C_NULL + + return nothing +end + +""" + ISCompressIndicesGeneral(petsclib::PetscLibType,n::PetscInt, nkeys::PetscInt, bs::PetscInt, imax::PetscInt, is_in::Vector{IS}, is_out::Vector{IS}) +convert the indices of an array of `IS` into an array of `ISGENERAL` of block indices + +Input Parameters: +- `n` - maximum possible length of the index set +- `nkeys` - expected number of keys when using `PETSC_USE_CTABLE` +- `bs` - the size of block +- `imax` - the number of index sets +- `is_in` - the non-blocked array of index sets + +Output Parameter: +- `is_out` - the blocked new index set, as `ISGENERAL`, not as `ISBLOCK` + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISGENERAL`, `ISExpandIndicesGeneral()` + +# External Links +$(_doc_external("Vec/ISCompressIndicesGeneral")) +""" +function ISCompressIndicesGeneral(petsclib::PetscLibType, n::PetscInt, nkeys::PetscInt, bs::PetscInt, imax::PetscInt, is_in::Vector{IS}, is_out::Vector{IS}) end + +@for_petsc function ISCompressIndicesGeneral(petsclib::$UnionPetscLib, n::$PetscInt, nkeys::$PetscInt, bs::$PetscInt, imax::$PetscInt, is_in::Vector{IS}, is_out::Vector{IS} ) + + @chk ccall( + (:ISCompressIndicesGeneral, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{CIS}, Ptr{CIS}), + n, nkeys, bs, imax, is_in, is_out, + ) + + + return nothing +end + +""" + ISExpandIndicesGeneral(petsclib::PetscLibType,n::PetscInt, nkeys::PetscInt, bs::PetscInt, imax::PetscInt, is_in::Vector{IS}, is_out::Vector{IS}) +convert the indices of an array `IS` into non + +Input Parameters: +- `n` - the length of the index set (not being used) +- `nkeys` - expected number of keys when `PETSC_USE_CTABLE` is used +- `bs` - the size of block +- `imax` - the number of index sets +- `is_in` - the blocked array of index sets, must be as large as `imax` + +Output Parameter: +- `is_out` - the non-blocked new index set, as `ISGENERAL`, must be as large as `imax` + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISGENERAL`, `ISCompressIndicesGeneral()` + +# External Links +$(_doc_external("Vec/ISExpandIndicesGeneral")) +""" +function ISExpandIndicesGeneral(petsclib::PetscLibType, n::PetscInt, nkeys::PetscInt, bs::PetscInt, imax::PetscInt, is_in::Vector{IS}, is_out::Vector{IS}) end + +@for_petsc function ISExpandIndicesGeneral(petsclib::$UnionPetscLib, n::$PetscInt, nkeys::$PetscInt, bs::$PetscInt, imax::$PetscInt, is_in::Vector{IS}, is_out::Vector{IS} ) + + @chk ccall( + (:ISExpandIndicesGeneral, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{CIS}, Ptr{CIS}), + n, nkeys, bs, imax, is_in, is_out, + ) + + + return nothing +end + +""" + ISDifference(petsclib::PetscLibType,is1::IS, is2::IS, isout::IS) +Computes the difference between two index sets. + +Collective + +Input Parameters: +- `is1` - first index, to have items removed from it +- `is2` - index values to be removed + +Output Parameter: +- `isout` - is1 - is2 + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISDestroy()`, `ISView()`, `ISSum()`, `ISExpand()` + +# External Links +$(_doc_external("Vec/ISDifference")) +""" +function ISDifference(petsclib::PetscLibType, is1::IS, is2::IS, isout::IS) end + +@for_petsc function ISDifference(petsclib::$UnionPetscLib, is1::IS, is2::IS, isout::IS ) + isout_ = Ref(isout.ptr) + + @chk ccall( + (:ISDifference, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{CIS}), + is1, is2, isout_, + ) + + isout.ptr = C_NULL + + return nothing +end + +""" + ISSum(petsclib::PetscLibType,is1::IS, is2::IS, is3::IS) +Computes the sum (union) of two index sets. + +Only sequential version (at the moment) + +Input Parameters: +- `is1` - index set to be extended +- `is2` - index values to be added + +Output Parameter: +- `is3` - the sum; this can not be `is1` or `is2` + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISDestroy()`, `ISView()`, `ISDifference()`, `ISExpand()` + +# External Links +$(_doc_external("Vec/ISSum")) +""" +function ISSum(petsclib::PetscLibType, is1::IS, is2::IS, is3::IS) end + +@for_petsc function ISSum(petsclib::$UnionPetscLib, is1::IS, is2::IS, is3::IS ) + is3_ = Ref(is3.ptr) + + @chk ccall( + (:ISSum, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{CIS}), + is1, is2, is3_, + ) + + is3.ptr = C_NULL + + return nothing +end + +""" + ISExpand(petsclib::PetscLibType,is1::IS, is2::IS, isout::IS) +Computes the union of two index sets, by concatenating 2 lists and +removing duplicates. + +Collective + +Input Parameters: +- `is1` - first index set +- `is2` - index values to be added + +Output Parameter: +- `isout` - `is1` + `is2` The index set `is2` is appended to `is1` removing duplicates + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISDestroy()`, `ISView()`, `ISDifference()`, `ISSum()`, `ISIntersect()` + +# External Links +$(_doc_external("Vec/ISExpand")) +""" +function ISExpand(petsclib::PetscLibType, is1::IS, is2::IS, isout::IS) end + +@for_petsc function ISExpand(petsclib::$UnionPetscLib, is1::IS, is2::IS, isout::IS ) + isout_ = Ref(isout.ptr) + + @chk ccall( + (:ISExpand, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{CIS}), + is1, is2, isout_, + ) + + isout.ptr = C_NULL + + return nothing +end + +""" + ISIntersect(petsclib::PetscLibType,is1::IS, is2::IS, isout::IS) +Computes the intersection of two index sets, by sorting and comparing. + +Collective + +Input Parameters: +- `is1` - first index set +- `is2` - second index set + +Output Parameter: +- `isout` - the sorted intersection of `is1` and `is2` + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISDestroy()`, `ISView()`, `ISDifference()`, `ISSum()`, `ISExpand()`, `ISConcatenate()` + +# External Links +$(_doc_external("Vec/ISIntersect")) +""" +function ISIntersect(petsclib::PetscLibType, is1::IS, is2::IS, isout::IS) end + +@for_petsc function ISIntersect(petsclib::$UnionPetscLib, is1::IS, is2::IS, isout::IS ) + isout_ = Ref(isout.ptr) + + @chk ccall( + (:ISIntersect, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{CIS}), + is1, is2, isout_, + ) + + isout.ptr = C_NULL + + return nothing +end + +""" + ISConcatenate(petsclib::PetscLibType,comm::MPI_Comm, len::PetscInt, islist::Vector{IS}, isout::IS) +Forms a new `IS` by locally concatenating the indices from an `IS` list without reordering. + +Collective + +Input Parameters: +- `comm` - communicator of the concatenated `IS`. +- `len` - size of islist array (nonnegative) +- `islist` - array of index sets + +Output Parameter: +- `isout` - The concatenated index set; empty, if `len` == 0. + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISDifference()`, `ISSum()`, `ISExpand()`, `ISIntersect()` + +# External Links +$(_doc_external("Vec/ISConcatenate")) +""" +function ISConcatenate(petsclib::PetscLibType, comm::MPI_Comm, len::PetscInt, islist::Vector{IS}, isout::IS) end + +@for_petsc function ISConcatenate(petsclib::$UnionPetscLib, comm::MPI_Comm, len::$PetscInt, islist::Vector{IS}, isout::IS ) + isout_ = Ref(isout.ptr) + + @chk ccall( + (:ISConcatenate, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{CIS}, Ptr{CIS}), + comm, len, islist, isout_, + ) + + isout.ptr = C_NULL + + return nothing +end + +""" + ISListToPair(petsclib::PetscLibType,comm::MPI_Comm, listlen::PetscInt, islist::Vector{IS}, xis::IS, yis::IS) +Convert an `IS` list to a pair of `IS` of equal length defining an equivalent integer multimap. +Each `IS` in `islist` is assigned an integer j so that all of the indices of that `IS` are +mapped to j. + +Collective + +Input Parameters: +- `comm` - `MPI_Comm` +- `listlen` - `IS` list length +- `islist` - `IS` list + +Output Parameters: +- `xis` - domain `IS` +- `yis` - range `IS` + +Level: developer + +-seealso: `IS`, `ISPairToList()` + +# External Links +$(_doc_external("Vec/ISListToPair")) +""" +function ISListToPair(petsclib::PetscLibType, comm::MPI_Comm, listlen::PetscInt, islist::Vector{IS}, xis::IS, yis::IS) end + +@for_petsc function ISListToPair(petsclib::$UnionPetscLib, comm::MPI_Comm, listlen::$PetscInt, islist::Vector{IS}, xis::IS, yis::IS ) + xis_ = Ref(xis.ptr) + yis_ = Ref(yis.ptr) + + @chk ccall( + (:ISListToPair, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{CIS}, Ptr{CIS}, Ptr{CIS}), + comm, listlen, islist, xis_, yis_, + ) + + xis.ptr = C_NULL + yis.ptr = C_NULL + + return nothing +end + +""" + listlen::PetscInt = ISPairToList(petsclib::PetscLibType,xis::IS, yis::IS, islist::IS) +Convert an `IS` pair encoding an integer map to a list of `IS`. + +Collective + +Input Parameters: +- `xis` - domain `IS` +- `yis` - range `IS`, the maximum value must be less than `PETSC_MPI_INT_MAX` + +Output Parameters: +- `listlen` - length of `islist` +- `islist` - list of `IS`s breaking up indices by color + +Level: developer + +-seealso: `IS`, `ISListToPair()` + +# External Links +$(_doc_external("Vec/ISPairToList")) +""" +function ISPairToList(petsclib::PetscLibType, xis::IS, yis::IS, islist::IS) end + +@for_petsc function ISPairToList(petsclib::$UnionPetscLib, xis::IS, yis::IS, islist::IS ) + listlen_ = Ref{$PetscInt}() + + @chk ccall( + (:ISPairToList, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{$PetscInt}, CIS), + xis, yis, listlen_, islist, + ) + + listlen = listlen_[] + + return listlen +end + +""" + ISEmbed(petsclib::PetscLibType,a::IS, b::IS, drop::PetscBool, c::IS) +Embed `IS` `a` into `IS` `b` by finding the locations in `b` that have the same indices as in `a`. +If `c` is the `IS` of these locations, we have `a = b*c`, regarded as a composition of the +corresponding `ISLocalToGlobalMapping`. + +Not Collective + +Input Parameters: +- `a` - `IS` to embed +- `b` - `IS` to embed into +- `drop` - flag indicating whether to drop indices of `a` that are not in `b`. + +Output Parameter: +- `c` - local embedding indices + +Level: developer + +-seealso: `IS`, `ISLocalToGlobalMapping` + +# External Links +$(_doc_external("Vec/ISEmbed")) +""" +function ISEmbed(petsclib::PetscLibType, a::IS, b::IS, drop::PetscBool, c::IS) end + +@for_petsc function ISEmbed(petsclib::$UnionPetscLib, a::IS, b::IS, drop::PetscBool, c::IS ) + c_ = Ref(c.ptr) + + @chk ccall( + (:ISEmbed, $petsc_library), + PetscErrorCode, + (CIS, CIS, PetscBool, Ptr{CIS}), + a, b, drop, c_, + ) + + c.ptr = C_NULL + + return nothing +end + +""" + ISSortPermutation(petsclib::PetscLibType,f::IS, always::PetscBool, h::IS) +calculate the permutation of the indices into a nondecreasing order. + +Not Collective + +Input Parameters: +- `f` - `IS` to sort +- `always` - build the permutation even when `f`'s indices are nondecreasing. + +Output Parameter: +- `h` - permutation or `NULL`, if `f` is nondecreasing and `always` == `PETSC_FALSE`. + +Level: advanced + +-seealso: `IS`, `ISLocalToGlobalMapping`, `ISSort()` + +# External Links +$(_doc_external("Vec/ISSortPermutation")) +""" +function ISSortPermutation(petsclib::PetscLibType, f::IS, always::PetscBool, h::IS) end + +@for_petsc function ISSortPermutation(petsclib::$UnionPetscLib, f::IS, always::PetscBool, h::IS ) + h_ = Ref(h.ptr) + + @chk ccall( + (:ISSortPermutation, $petsc_library), + PetscErrorCode, + (CIS, PetscBool, Ptr{CIS}), + f, always, h_, + ) + + h.ptr = C_NULL + + return nothing +end + +""" + flg::PetscBool = ISEqual(petsclib::PetscLibType,is1::IS, is2::IS) +Compares if two index sets have the same set of indices. + +Collective + +Input Parameters: +- `is1` - first index set to compare +- `is2` - second index set to compare + +Output Parameter: +- `flg` - output flag, either `PETSC_TRUE` (if both index sets have the +same indices), or `PETSC_FALSE` if the index sets differ by size +or by the set of indices) + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISEqualUnsorted()` + +# External Links +$(_doc_external("Vec/ISEqual")) +""" +function ISEqual(petsclib::PetscLibType, is1::IS, is2::IS) end + +@for_petsc function ISEqual(petsclib::$UnionPetscLib, is1::IS, is2::IS ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:ISEqual, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{PetscBool}), + is1, is2, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = ISEqualUnsorted(petsclib::PetscLibType,is1::IS, is2::IS) +Compares if two index sets have the same indices. + +Collective + +Input Parameters: +- `is1` - first index set to compare +- `is2` - second index set to compare + +Output Parameter: +- `flg` - output flag, either `PETSC_TRUE` (if both index sets have the +same indices), or `PETSC_FALSE` if the index sets differ by size +or by the set of indices) + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISEqual()` + +# External Links +$(_doc_external("Vec/ISEqualUnsorted")) +""" +function ISEqualUnsorted(petsclib::PetscLibType, is1::IS, is2::IS) end + +@for_petsc function ISEqualUnsorted(petsclib::$UnionPetscLib, is1::IS, is2::IS ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:ISEqualUnsorted, $petsc_library), + PetscErrorCode, + (CIS, CIS, Ptr{PetscBool}), + is1, is2, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + pStart::PetscInt,pEnd::PetscInt,points::Vector{PetscInt} = ISGetPointRange(petsclib::PetscLibType,pointIS::IS) +Returns a description of the points in an `IS` suitable for traversal + +Not Collective + +Input Parameter: +- `pointIS` - The `IS` object + +Output Parameters: +- `pStart` - The first index, see notes +- `pEnd` - One past the last index, see notes +- `points` - The indices, see notes + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISRestorePointRange()`, `ISGetPointSubrange()`, `ISGetIndices()`, `ISCreateStride()` + +# External Links +$(_doc_external("Vec/ISGetPointRange")) +""" +function ISGetPointRange(petsclib::PetscLibType, pointIS::IS) end + +@for_petsc function ISGetPointRange(petsclib::$UnionPetscLib, pointIS::IS ) + pStart_ = Ref{$PetscInt}() + pEnd_ = Ref{$PetscInt}() + points_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISGetPointRange, $petsc_library), + PetscErrorCode, + (CIS, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + pointIS, pStart_, pEnd_, points_, + ) + + pStart = pStart_[] + pEnd = pEnd_[] + points = unsafe_wrap(Array, points_[], VecGetLocalSize(petsclib, x); own = false) + + return pStart,pEnd,points +end + +""" + ISRestorePointRange(petsclib::PetscLibType,pointIS::IS, pStart::PetscInt, pEnd::PetscInt, points::Vector{PetscInt}) +Destroys the traversal description created with `ISGetPointRange()` + +Not Collective + +Input Parameters: +- `pointIS` - The `IS` object +- `pStart` - The first index, from `ISGetPointRange()` +- `pEnd` - One past the last index, from `ISGetPointRange()` +- `points` - The indices, from `ISGetPointRange()` + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISGetPointRange()`, `ISGetPointSubrange()`, `ISGetIndices()`, `ISCreateStride()` + +# External Links +$(_doc_external("Vec/ISRestorePointRange")) +""" +function ISRestorePointRange(petsclib::PetscLibType, pointIS::IS, pStart::PetscInt, pEnd::PetscInt, points::Vector{PetscInt}) end + +@for_petsc function ISRestorePointRange(petsclib::$UnionPetscLib, pointIS::IS, pStart::$PetscInt, pEnd::$PetscInt, points::Vector{$PetscInt} ) + points_ = Ref(pointer(points)) + + @chk ccall( + (:ISRestorePointRange, $petsc_library), + PetscErrorCode, + (CIS, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + pointIS, pStart, pEnd, points_, + ) + + + return nothing +end + +""" + ISGetPointSubrange(petsclib::PetscLibType,subpointIS::IS, pStart::PetscInt, pEnd::PetscInt, points::Vector{PetscInt}) +Configures the input `IS` to be a subrange for the traversal information given + +Not Collective + +Input Parameters: +- `subpointIS` - The `IS` object to be configured +- `pStart` - The first index of the subrange +- `pEnd` - One past the last index for the subrange +- `points` - The indices for the entire range, from `ISGetPointRange()` + +Output Parameters: +- `subpointIS` - The `IS` object now configured to be a subrange + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `ISGetPointRange()`, `ISRestorePointRange()`, `ISGetIndices()`, `ISCreateStride()` + +# External Links +$(_doc_external("Vec/ISGetPointSubrange")) +""" +function ISGetPointSubrange(petsclib::PetscLibType, subpointIS::IS, pStart::PetscInt, pEnd::PetscInt, points::Vector{PetscInt}) end + +@for_petsc function ISGetPointSubrange(petsclib::$UnionPetscLib, subpointIS::IS, pStart::$PetscInt, pEnd::$PetscInt, points::Vector{$PetscInt} ) + + @chk ccall( + (:ISGetPointSubrange, $petsc_library), + PetscErrorCode, + (CIS, $PetscInt, $PetscInt, Ptr{$PetscInt}), + subpointIS, pStart, pEnd, points, + ) + + + return nothing +end + +""" + nout::PetscInt,idxout::Vector{PetscInt} = ISGlobalToLocalMappingApply(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, type::ISGlobalToLocalMappingMode, n::PetscInt, idx::Vector{PetscInt}) +Provides the local numbering for a list of integers +specified with a global numbering. + +Not Collective + +Input Parameters: +- `mapping` - mapping between local and global numbering +- `type` - `IS_GTOLM_MASK` - maps global indices with no local value to -1 in the output list (i.e., mask them) +`IS_GTOLM_DROP` - drops the indices with no local value from the output list +- `n` - number of global indices to map +- `idx` - global indices to map + +Output Parameters: +- `nout` - number of indices in output array (if type == `IS_GTOLM_MASK` then nout = n) +- `idxout` - local index of each global index, one must pass in an array long enough +to hold all the indices. You can call `ISGlobalToLocalMappingApply()` with +idxout == NULL to determine the required length (returned in nout) +and then allocate the required space and call `ISGlobalToLocalMappingApply()` +a second time to set the values. + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingApply()`, `ISGlobalToLocalMappingApplyBlock()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingDestroy()` + +# External Links +$(_doc_external("Vec/ISGlobalToLocalMappingApply")) +""" +function ISGlobalToLocalMappingApply(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, type::ISGlobalToLocalMappingMode, n::PetscInt, idx::Vector{PetscInt}) end + +@for_petsc function ISGlobalToLocalMappingApply(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, type::ISGlobalToLocalMappingMode, n::$PetscInt, idx::Vector{$PetscInt} ) + nout_ = Ref{$PetscInt}() + idxout = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:ISGlobalToLocalMappingApply, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, ISGlobalToLocalMappingMode, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + mapping, type, n, idx, nout_, idxout, + ) + + nout = nout_[] + + return nout,idxout +end + +""" + ISGlobalToLocalMappingApplyIS(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, type::ISGlobalToLocalMappingMode, is::IS, newis::IS) +Creates from an `IS` in the global numbering +a new index set using the local numbering defined in an `ISLocalToGlobalMapping` +context. + +Not Collective + +Input Parameters: +- `mapping` - mapping between local and global numbering +- `type` - `IS_GTOLM_MASK` - maps global indices with no local value to -1 in the output list (i.e., mask them) +`IS_GTOLM_DROP` - drops the indices with no local value from the output list +- `is` - index set in global numbering + +Output Parameter: +- `newis` - index set in local numbering + +Level: advanced + +-seealso: [](sec_scatter), `ISGlobalToLocalMapping`, `ISGlobalToLocalMappingApply()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingDestroy()` + +# External Links +$(_doc_external("Vec/ISGlobalToLocalMappingApplyIS")) +""" +function ISGlobalToLocalMappingApplyIS(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, type::ISGlobalToLocalMappingMode, is::IS, newis::IS) end + +@for_petsc function ISGlobalToLocalMappingApplyIS(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, type::ISGlobalToLocalMappingMode, is::IS, newis::IS ) + newis_ = Ref(newis.ptr) + + @chk ccall( + (:ISGlobalToLocalMappingApplyIS, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, ISGlobalToLocalMappingMode, CIS, Ptr{CIS}), + mapping, type, is, newis_, + ) + + newis.ptr = C_NULL + + return nothing +end + +""" + nout::PetscInt,idxout::Vector{PetscInt} = ISGlobalToLocalMappingApplyBlock(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, type::ISGlobalToLocalMappingMode, n::PetscInt, idx::Vector{PetscInt}) +Provides the local block numbering for a list of integers +specified with a block global numbering. + +Not Collective + +Input Parameters: +- `mapping` - mapping between local and global numbering +- `type` - `IS_GTOLM_MASK` - maps global indices with no local value to -1 in the output list (i.e., mask them) +`IS_GTOLM_DROP` - drops the indices with no local value from the output list +- `n` - number of global indices to map +- `idx` - global indices to map + +Output Parameters: +- `nout` - number of indices in output array (if type == `IS_GTOLM_MASK` then nout = n) +- `idxout` - local index of each global index, one must pass in an array long enough +to hold all the indices. You can call `ISGlobalToLocalMappingApplyBlock()` with +idxout == NULL to determine the required length (returned in nout) +and then allocate the required space and call `ISGlobalToLocalMappingApplyBlock()` +a second time to set the values. + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingApply()`, `ISGlobalToLocalMappingApply()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingDestroy()` + +# External Links +$(_doc_external("Vec/ISGlobalToLocalMappingApplyBlock")) +""" +function ISGlobalToLocalMappingApplyBlock(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, type::ISGlobalToLocalMappingMode, n::PetscInt, idx::Vector{PetscInt}) end + +@for_petsc function ISGlobalToLocalMappingApplyBlock(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, type::ISGlobalToLocalMappingMode, n::$PetscInt, idx::Vector{$PetscInt} ) + nout_ = Ref{$PetscInt}() + idxout = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:ISGlobalToLocalMappingApplyBlock, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, ISGlobalToLocalMappingMode, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + mapping, type, n, idx, nout_, idxout, + ) + + nout = nout_[] + + return nout,idxout +end + +""" + ISFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the `IS` package. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: `PetscFinalize()` + +# External Links +$(_doc_external("Vec/ISFinalizePackage")) +""" +function ISFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function ISFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:ISFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + ISInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `IS` package. It is called +from PetscDLLibraryRegister_petscvec() when using dynamic libraries, and on the first call to ISCreateXXXX() +when using shared or static libraries. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("Vec/ISInitializePackage")) +""" +function ISInitializePackage(petsclib::PetscLibType) end + +@for_petsc function ISInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:ISInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + ISComplementVec(petsclib::PetscLibType,S::IS, V::PetscVec, T::IS) +Creates the complement of the index set relative to a layout defined by a `Vec` + +Collective + +Input Parameters: +- `S` - a PETSc `IS` +- `V` - the reference vector space + +Output Parameter: +- `T` - the complement of S + +Level: advanced + +-seealso: `IS`, `Vec`, `ISCreateGeneral()` + +# External Links +$(_doc_external("Vec/ISComplementVec")) +""" +function ISComplementVec(petsclib::PetscLibType, S::IS, V::PetscVec, T::IS) end + +@for_petsc function ISComplementVec(petsclib::$UnionPetscLib, S::IS, V::PetscVec, T::IS ) + T_ = Ref(T.ptr) + + @chk ccall( + (:ISComplementVec, $petsc_library), + PetscErrorCode, + (CIS, CVec, Ptr{CIS}), + S, V, T_, + ) + + T.ptr = C_NULL + + return nothing +end + diff --git a/src/autowrapped/ISaddons_wrappers.jl b/src/autowrapped/ISaddons_wrappers.jl new file mode 100644 index 00000000..7b22049e --- /dev/null +++ b/src/autowrapped/ISaddons_wrappers.jl @@ -0,0 +1,1565 @@ +""" + nltog::ISLocalToGlobalMapping = ISLocalToGlobalMappingDuplicate(petsclib::PetscLibType,ltog::ISLocalToGlobalMapping) +Duplicates the local to global mapping object + +Not Collective + +Input Parameter: +- `ltog` - local to global mapping + +Output Parameter: +- `nltog` - the duplicated local to global mapping + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreate()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingDuplicate")) +""" +function ISLocalToGlobalMappingDuplicate(petsclib::PetscLibType, ltog::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingDuplicate(petsclib::$UnionPetscLib, ltog::ISLocalToGlobalMapping ) + nltog_ = Ref{ISLocalToGlobalMapping}() + + @chk ccall( + (:ISLocalToGlobalMappingDuplicate, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{ISLocalToGlobalMapping}), + ltog, nltog_, + ) + + nltog = nltog_[] + + return nltog +end + +""" + n::PetscInt = ISLocalToGlobalMappingGetSize(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping) +Gets the local size of a local to global mapping + +Not Collective + +Input Parameter: +- `mapping` - local to global mapping + +Output Parameter: +- `n` - the number of entries in the local mapping, `ISLocalToGlobalMappingGetIndices()` returns an array of this length + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreate()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingGetSize")) +""" +function ISLocalToGlobalMappingGetSize(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingGetSize(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:ISLocalToGlobalMappingGetSize, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{$PetscInt}), + mapping, n_, + ) + + n = n_[] + + return n +end + +""" + ISLocalToGlobalMappingViewFromOptions(petsclib::PetscLibType,A::ISLocalToGlobalMapping, obj::PetscObject, name::String) +View an `ISLocalToGlobalMapping` based on values in the options database + +Collective + +Input Parameters: +- `A` - the local to global mapping object +- `obj` - Optional object that provides the options prefix used for the options database query +- `name` - command line option + +Level: intermediate + +-seealso: [](sec_scatter), `PetscViewer`, `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingView`, `PetscObjectViewFromOptions()`, `ISLocalToGlobalMappingCreate()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingViewFromOptions")) +""" +function ISLocalToGlobalMappingViewFromOptions(petsclib::PetscLibType, A::ISLocalToGlobalMapping, obj::PetscObject, name::String) end + +@for_petsc function ISLocalToGlobalMappingViewFromOptions(petsclib::$UnionPetscLib, A::ISLocalToGlobalMapping, obj::PetscObject, name::String ) + + @chk ccall( + (:ISLocalToGlobalMappingViewFromOptions, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + ISLocalToGlobalMappingView(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, viewer::PetscViewer) +View a local to global mapping + +Collective on viewer + +Input Parameters: +- `mapping` - local to global mapping +- `viewer` - viewer + +Level: intermediate + +-seealso: [](sec_scatter), `PetscViewer`, `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreate()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingView")) +""" +function ISLocalToGlobalMappingView(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, viewer::PetscViewer) end + +@for_petsc function ISLocalToGlobalMappingView(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, viewer::PetscViewer ) + + @chk ccall( + (:ISLocalToGlobalMappingView, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, PetscViewer), + mapping, viewer, + ) + + + return nothing +end + +""" + ISLocalToGlobalMappingLoad(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, viewer::PetscViewer) +Loads a local + +Collective on viewer + +Input Parameters: +- `mapping` - the newly loaded map, this needs to have been created with `ISLocalToGlobalMappingCreate()` or some related function before a call to `ISLocalToGlobalMappingLoad()` +- `viewer` - binary file viewer, obtained from `PetscViewerBinaryOpen()` + +Level: intermediate + +-seealso: [](sec_scatter), `PetscViewer`, `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingView()`, `ISLocalToGlobalMappingCreate()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingLoad")) +""" +function ISLocalToGlobalMappingLoad(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, viewer::PetscViewer) end + +@for_petsc function ISLocalToGlobalMappingLoad(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, viewer::PetscViewer ) + + @chk ccall( + (:ISLocalToGlobalMappingLoad, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, PetscViewer), + mapping, viewer, + ) + + + return nothing +end + +""" + mapping::ISLocalToGlobalMapping = ISLocalToGlobalMappingCreateIS(petsclib::PetscLibType,is::IS) +Creates a mapping between a local (0 to n) +ordering and a global parallel ordering. + +Not Collective + +Input Parameter: +- `is` - index set containing the global numbers for each local number + +Output Parameter: +- `mapping` - new mapping data structure + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingSetFromOptions()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingCreateIS")) +""" +function ISLocalToGlobalMappingCreateIS(petsclib::PetscLibType, is::IS) end + +@for_petsc function ISLocalToGlobalMappingCreateIS(petsclib::$UnionPetscLib, is::IS ) + mapping_ = Ref{ISLocalToGlobalMapping}() + + @chk ccall( + (:ISLocalToGlobalMappingCreateIS, $petsc_library), + PetscErrorCode, + (CIS, Ptr{ISLocalToGlobalMapping}), + is, mapping_, + ) + + mapping = mapping_[] + + return mapping +end + +""" + mapping::ISLocalToGlobalMapping = ISLocalToGlobalMappingCreateSF(petsclib::PetscLibType,sf::PetscSF, start::PetscInt) +Creates a mapping between a local (0 to n) ordering and a global parallel ordering induced by a star forest. + +Collective + +Input Parameters: +- `sf` - star forest mapping contiguous local indices to (rank, offset) +- `start` - first global index on this process, or `PETSC_DECIDE` to compute contiguous global numbering automatically + +Output Parameter: +- `mapping` - new mapping data structure + +Level: advanced + +-seealso: [](sec_scatter), `PetscSF`, `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingCreateIS()`, `ISLocalToGlobalMappingSetFromOptions()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingCreateSF")) +""" +function ISLocalToGlobalMappingCreateSF(petsclib::PetscLibType, sf::PetscSF, start::PetscInt) end + +@for_petsc function ISLocalToGlobalMappingCreateSF(petsclib::$UnionPetscLib, sf::PetscSF, start::$PetscInt ) + mapping_ = Ref{ISLocalToGlobalMapping}() + + @chk ccall( + (:ISLocalToGlobalMappingCreateSF, $petsc_library), + PetscErrorCode, + (PetscSF, $PetscInt, Ptr{ISLocalToGlobalMapping}), + sf, start, mapping_, + ) + + mapping = mapping_[] + + return mapping +end + +""" + ISLocalToGlobalMappingSetBlockSize(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, bs::PetscInt) +Sets the blocksize of the mapping + +Not Collective + +Input Parameters: +- `mapping` - mapping data structure +- `bs` - the blocksize + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingSetBlockSize")) +""" +function ISLocalToGlobalMappingSetBlockSize(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, bs::PetscInt) end + +@for_petsc function ISLocalToGlobalMappingSetBlockSize(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, bs::$PetscInt ) + + @chk ccall( + (:ISLocalToGlobalMappingSetBlockSize, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, $PetscInt), + mapping, bs, + ) + + + return nothing +end + +""" + bs::PetscInt = ISLocalToGlobalMappingGetBlockSize(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping) +Gets the blocksize of the mapping +ordering and a global parallel ordering. + +Not Collective + +Input Parameter: +- `mapping` - mapping data structure + +Output Parameter: +- `bs` - the blocksize + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingGetBlockSize")) +""" +function ISLocalToGlobalMappingGetBlockSize(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingGetBlockSize(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping ) + bs_ = Ref{$PetscInt}() + + @chk ccall( + (:ISLocalToGlobalMappingGetBlockSize, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{$PetscInt}), + mapping, bs_, + ) + + bs = bs_[] + + return bs +end + +""" + mapping::ISLocalToGlobalMapping = ISLocalToGlobalMappingCreate(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, n::PetscInt, indices::Vector{PetscInt}, mode::PetscCopyMode) +Creates a mapping between a local (0 to n) +ordering and a global parallel ordering. + +Not Collective, but communicator may have more than one process + +Input Parameters: +- `comm` - MPI communicator +- `bs` - the block size +- `n` - the number of local elements divided by the block size, or equivalently the number of block indices +- `indices` - the global index for each local element, these do not need to be in increasing order (sorted), these values should not be scaled (i.e. multiplied) by the blocksize bs +- `mode` - see PetscCopyMode + +Output Parameter: +- `mapping` - new mapping data structure + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()`, `ISLocalToGlobalMappingSetFromOptions()`, +`ISLOCALTOGLOBALMAPPINGBASIC`, `ISLOCALTOGLOBALMAPPINGHASH` +`ISLocalToGlobalMappingSetType()`, `ISLocalToGlobalMappingType` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingCreate")) +""" +function ISLocalToGlobalMappingCreate(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, n::PetscInt, indices::Vector{PetscInt}, mode::PetscCopyMode) end + +@for_petsc function ISLocalToGlobalMappingCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, n::$PetscInt, indices::Vector{$PetscInt}, mode::PetscCopyMode ) + mapping_ = Ref{ISLocalToGlobalMapping}() + + @chk ccall( + (:ISLocalToGlobalMappingCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{$PetscInt}, PetscCopyMode, Ptr{ISLocalToGlobalMapping}), + comm, bs, n, indices, mode, mapping_, + ) + + mapping = mapping_[] + + return mapping +end + +""" + ISLocalToGlobalMappingSetFromOptions(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping) +Set mapping options from the options database. + +Not Collective + +Input Parameter: +- `mapping` - mapping data structure + +Options Database Key: +- `-islocaltoglobalmapping_type` - nonscalable and scalable versions + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingDestroy()`, +`ISLocalToGlobalMappingCreateIS()`, `ISLOCALTOGLOBALMAPPINGBASIC`, +`ISLOCALTOGLOBALMAPPINGHASH`, `ISLocalToGlobalMappingSetType()`, `ISLocalToGlobalMappingType` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingSetFromOptions")) +""" +function ISLocalToGlobalMappingSetFromOptions(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingSetFromOptions(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping ) + + @chk ccall( + (:ISLocalToGlobalMappingSetFromOptions, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping,), + mapping, + ) + + + return nothing +end + +""" + ISLocalToGlobalMappingDestroy(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping) +Destroys a mapping between a local (0 to n) +ordering and a global parallel ordering. + +Not Collective + +Input Parameter: +- `mapping` - mapping data structure + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingCreate()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingDestroy")) +""" +function ISLocalToGlobalMappingDestroy(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingDestroy(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping ) + + @chk ccall( + (:ISLocalToGlobalMappingDestroy, $petsc_library), + PetscErrorCode, + (Ptr{ISLocalToGlobalMapping},), + mapping, + ) + + + return nothing +end + +""" + ISLocalToGlobalMappingApplyIS(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, is::IS, newis::IS) +Creates from an `IS` in the local numbering +a new index set using the global numbering defined in an `ISLocalToGlobalMapping` +context. + +Collective + +Input Parameters: +- `mapping` - mapping between local and global numbering +- `is` - index set in local numbering + +Output Parameter: +- `newis` - index set in global numbering + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingApply()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingDestroy()`, `ISGlobalToLocalMappingApply()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingApplyIS")) +""" +function ISLocalToGlobalMappingApplyIS(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, is::IS, newis::IS) end + +@for_petsc function ISLocalToGlobalMappingApplyIS(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, is::IS, newis::IS ) + newis_ = Ref(newis.ptr) + + @chk ccall( + (:ISLocalToGlobalMappingApplyIS, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, CIS, Ptr{CIS}), + mapping, is, newis_, + ) + + newis.ptr = C_NULL + + return nothing +end + +""" + out::Vector{PetscInt} = ISLocalToGlobalMappingApply(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, N::PetscInt, in::Vector{PetscInt}) +Takes a list of integers in a local numbering +and converts them to the global numbering. + +Not Collective + +Input Parameters: +- `mapping` - the local to global mapping context +- `N` - number of integers +- `in` - input indices in local numbering + +Output Parameter: +- `out` - indices in global numbering + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingApplyBlock()`, `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingDestroy()`, +`ISLocalToGlobalMappingApplyIS()`, `AOCreateBasic()`, `AOApplicationToPetsc()`, +`AOPetscToApplication()`, `ISGlobalToLocalMappingApply()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingApply")) +""" +function ISLocalToGlobalMappingApply(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, N::PetscInt, in::Vector{PetscInt}) end + +@for_petsc function ISLocalToGlobalMappingApply(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, N::$PetscInt, in::Vector{$PetscInt} ) + out = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:ISLocalToGlobalMappingApply, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + mapping, N, in, out, + ) + + + return out +end + +""" + out::Vector{PetscInt} = ISLocalToGlobalMappingApplyBlock(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, N::PetscInt, in::Vector{PetscInt}) +Takes a list of integers in a local block numbering and converts them to the global block numbering + +Not Collective + +Input Parameters: +- `mapping` - the local to global mapping context +- `N` - number of integers +- `in` - input indices in local block numbering + +Output Parameter: +- `out` - indices in global block numbering + +Example: +If the index values are {0,1,6,7} set with a call to `ISLocalToGlobalMappingCreate`(`PETSC_COMM_SELF`,2,2,{0,3}) then the mapping applied to 0 +(the first block) would produce 0 and the mapping applied to 1 (the second block) would produce 3. + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingApply()`, `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingDestroy()`, +`ISLocalToGlobalMappingApplyIS()`, `AOCreateBasic()`, `AOApplicationToPetsc()`, +`AOPetscToApplication()`, `ISGlobalToLocalMappingApply()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingApplyBlock")) +""" +function ISLocalToGlobalMappingApplyBlock(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, N::PetscInt, in::Vector{PetscInt}) end + +@for_petsc function ISLocalToGlobalMappingApplyBlock(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, N::$PetscInt, in::Vector{$PetscInt} ) + out = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:ISLocalToGlobalMappingApplyBlock, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + mapping, N, in, out, + ) + + + return out +end + +""" + nproc::PetscInt,procs::Vector{PetscInt},numprocs::Vector{PetscInt},indices::Vector{PetscInt} = ISLocalToGlobalMappingGetBlockInfo(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping) +Gets the neighbor information + +Collective the first time it is called + +Input Parameter: +- `mapping` - the mapping from local to global indexing + +Output Parameters: +- `nproc` - number of processes that are connected to the calling process +- `procs` - neighboring processes +- `numprocs` - number of block indices for each process +- `indices` - block indices (in local numbering) shared with neighbors (sorted by global numbering) + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingRestoreBlockInfo()`, `ISLocalToGlobalMappingGetBlockMultiLeavesSF()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingGetBlockInfo")) +""" +function ISLocalToGlobalMappingGetBlockInfo(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingGetBlockInfo(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping ) + nproc_ = Ref{$PetscInt}() + procs_ = Ref{Ptr{$PetscInt}}() + numprocs_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISLocalToGlobalMappingGetBlockInfo, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}), + mapping, nproc_, procs_, numprocs_, indices, + ) + + nproc = nproc_[] + procs = unsafe_wrap(Array, procs_[], VecGetLocalSize(petsclib, x); own = false) + numprocs = unsafe_wrap(Array, numprocs_[], VecGetLocalSize(petsclib, x); own = false) + + return nproc,procs,numprocs,indices +end + +""" + n::PetscInt,n_procs::Vector{PetscInt},procs::Vector{PetscInt} = ISLocalToGlobalMappingGetBlockNodeInfo(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping) +Gets the neighbor information for each local block index + +Collective the first time it is called + +Input Parameter: +- `mapping` - the mapping from local to global indexing + +Output Parameters: +- `n` - number of local block nodes +- `n_procs` - an array storing the number of processes for each local block node (including self) +- `procs` - the processes' rank for each local block node (sorted, self is first) + +Level: advanced + +-seealso: `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingGetBlockInfo()`, `ISLocalToGlobalMappingRestoreBlockNodeInfo()`, `ISLocalToGlobalMappingGetNodeInfo()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingGetBlockNodeInfo")) +""" +function ISLocalToGlobalMappingGetBlockNodeInfo(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingGetBlockNodeInfo(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping ) + n_ = Ref{$PetscInt}() + n_procs_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISLocalToGlobalMappingGetBlockNodeInfo, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}), + mapping, n_, n_procs_, procs, + ) + + n = n_[] + n_procs = unsafe_wrap(Array, n_procs_[], VecGetLocalSize(petsclib, x); own = false) + + return n,n_procs,procs +end + +""" + ISLocalToGlobalMappingRestoreBlockNodeInfo(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, n::PetscInt, n_procs::Vector{PetscInt}, procs::Vector{PetscInt}) +Frees the memory allocated by `ISLocalToGlobalMappingGetBlockNodeInfo()` + +Not Collective + +Input Parameters: +- `mapping` - the mapping from local to global indexing +- `n` - number of local block nodes +- `n_procs` - an array storing the number of processes for each local block nodes (including self) +- `procs` - the processes' rank for each local block node (sorted, self is first) + +Level: advanced + +-seealso: `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingGetBlockNodeInfo()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingRestoreBlockNodeInfo")) +""" +function ISLocalToGlobalMappingRestoreBlockNodeInfo(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, n::PetscInt, n_procs::Vector{PetscInt}, procs::Vector{PetscInt}) end + +@for_petsc function ISLocalToGlobalMappingRestoreBlockNodeInfo(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, n::$PetscInt, n_procs::Vector{$PetscInt}, procs::Vector{$PetscInt} ) + n_procs_ = Ref(pointer(n_procs)) + + @chk ccall( + (:ISLocalToGlobalMappingRestoreBlockNodeInfo, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}), + mapping, n, n_procs_, procs, + ) + + + return nothing +end + +""" + ISLocalToGlobalMappingGetBlockMultiLeavesSF(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, mlsf::PetscSF) +Get the star + +Collective the first time it is called + +Input Parameter: +- `mapping` - the mapping from local to global indexing + +Output Parameter: +- `mlsf` - the `PetscSF` + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingGetBlockNodeInfo()`, `PetscSF` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingGetBlockMultiLeavesSF")) +""" +function ISLocalToGlobalMappingGetBlockMultiLeavesSF(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, mlsf::PetscSF) end + +@for_petsc function ISLocalToGlobalMappingGetBlockMultiLeavesSF(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, mlsf::PetscSF ) + + @chk ccall( + (:ISLocalToGlobalMappingGetBlockMultiLeavesSF, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{PetscSF}), + mapping, mlsf, + ) + + + return nothing +end + +""" + ISLocalToGlobalMappingRestoreBlockInfo(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, nproc::PetscInt, procs::Vector{PetscInt}, numprocs::Vector{PetscInt}, indices::Vector{PetscInt}) +Frees the memory allocated by `ISLocalToGlobalMappingGetBlockInfo()` + +Not Collective + +Input Parameters: +- `mapping` - the mapping from local to global indexing +- `nproc` - number of processes that are connected to the calling process +- `procs` - neighboring processes +- `numprocs` - number of block indices for each process +- `indices` - block indices (in local numbering) shared with neighbors (sorted by global numbering) + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingGetInfo()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingRestoreBlockInfo")) +""" +function ISLocalToGlobalMappingRestoreBlockInfo(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, nproc::PetscInt, procs::Vector{PetscInt}, numprocs::Vector{PetscInt}, indices::Vector{PetscInt}) end + +@for_petsc function ISLocalToGlobalMappingRestoreBlockInfo(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, nproc::$PetscInt, procs::Vector{$PetscInt}, numprocs::Vector{$PetscInt}, indices::Vector{$PetscInt} ) + procs_ = Ref(pointer(procs)) + numprocs_ = Ref(pointer(numprocs)) + + @chk ccall( + (:ISLocalToGlobalMappingRestoreBlockInfo, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}), + mapping, nproc, procs_, numprocs_, indices, + ) + + + return nothing +end + +""" + nproc::PetscInt,procs::Vector{PetscInt},numprocs::Vector{PetscInt},indices::Vector{PetscInt} = ISLocalToGlobalMappingGetInfo(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping) +Gets the neighbor information for each process + +Collective the first time it is called + +Input Parameter: +- `mapping` - the mapping from local to global indexing + +Output Parameters: +- `nproc` - number of processes that are connected to the calling process +- `procs` - neighboring processes +- `numprocs` - number of indices for each process +- `indices` - indices (in local numbering) shared with neighbors (sorted by global numbering) + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingRestoreInfo()`, `ISLocalToGlobalMappingGetNodeInfo()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingGetInfo")) +""" +function ISLocalToGlobalMappingGetInfo(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingGetInfo(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping ) + nproc_ = Ref{$PetscInt}() + procs_ = Ref{Ptr{$PetscInt}}() + numprocs_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISLocalToGlobalMappingGetInfo, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}), + mapping, nproc_, procs_, numprocs_, indices, + ) + + nproc = nproc_[] + procs = unsafe_wrap(Array, procs_[], VecGetLocalSize(petsclib, x); own = false) + numprocs = unsafe_wrap(Array, numprocs_[], VecGetLocalSize(petsclib, x); own = false) + + return nproc,procs,numprocs,indices +end + +""" + ISLocalToGlobalMappingRestoreInfo(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, nproc::PetscInt, procs::Vector{PetscInt}, numprocs::Vector{PetscInt}, indices::Vector{PetscInt}) +Frees the memory allocated by `ISLocalToGlobalMappingGetInfo()` + +Not Collective + +Input Parameters: +- `mapping` - the mapping from local to global indexing +- `nproc` - number of processes that are connected to the calling process +- `procs` - neighboring processes +- `numprocs` - number of indices for each process +- `indices` - indices (in local numbering) shared with neighbors (sorted by global numbering) + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingGetInfo()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingRestoreInfo")) +""" +function ISLocalToGlobalMappingRestoreInfo(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, nproc::PetscInt, procs::Vector{PetscInt}, numprocs::Vector{PetscInt}, indices::Vector{PetscInt}) end + +@for_petsc function ISLocalToGlobalMappingRestoreInfo(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, nproc::$PetscInt, procs::Vector{$PetscInt}, numprocs::Vector{$PetscInt}, indices::Vector{$PetscInt} ) + procs_ = Ref(pointer(procs)) + numprocs_ = Ref(pointer(numprocs)) + + @chk ccall( + (:ISLocalToGlobalMappingRestoreInfo, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}), + mapping, nproc, procs_, numprocs_, indices, + ) + + + return nothing +end + +""" + n::PetscInt,n_procs::Vector{PetscInt},procs::Vector{PetscInt} = ISLocalToGlobalMappingGetNodeInfo(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping) +Gets the neighbor information of local nodes + +Collective the first time it is called + +Input Parameter: +- `mapping` - the mapping from local to global indexing + +Output Parameters: +- `n` - number of local nodes +- `n_procs` - an array storing the number of processes for each local node (including self) +- `procs` - the processes' rank for each local node (sorted, self is first) + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingGetInfo()`, `ISLocalToGlobalMappingRestoreNodeInfo()`, `ISLocalToGlobalMappingGetBlockNodeInfo()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingGetNodeInfo")) +""" +function ISLocalToGlobalMappingGetNodeInfo(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingGetNodeInfo(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping ) + n_ = Ref{$PetscInt}() + n_procs_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISLocalToGlobalMappingGetNodeInfo, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}), + mapping, n_, n_procs_, procs, + ) + + n = n_[] + n_procs = unsafe_wrap(Array, n_procs_[], VecGetLocalSize(petsclib, x); own = false) + + return n,n_procs,procs +end + +""" + ISLocalToGlobalMappingRestoreNodeInfo(petsclib::PetscLibType,mapping::ISLocalToGlobalMapping, n::PetscInt, n_procs::Vector{PetscInt}, procs::Vector{PetscInt}) +Frees the memory allocated by `ISLocalToGlobalMappingGetNodeInfo()` + +Not Collective + +Input Parameters: +- `mapping` - the mapping from local to global indexing +- `n` - number of local nodes +- `n_procs` - an array storing the number of processes for each local node (including self) +- `procs` - the processes' rank for each local node (sorted, self is first) + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingDestroy()`, `ISLocalToGlobalMappingCreateIS()`, `ISLocalToGlobalMappingCreate()`, +`ISLocalToGlobalMappingGetInfo()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingRestoreNodeInfo")) +""" +function ISLocalToGlobalMappingRestoreNodeInfo(petsclib::PetscLibType, mapping::ISLocalToGlobalMapping, n::PetscInt, n_procs::Vector{PetscInt}, procs::Vector{PetscInt}) end + +@for_petsc function ISLocalToGlobalMappingRestoreNodeInfo(petsclib::$UnionPetscLib, mapping::ISLocalToGlobalMapping, n::$PetscInt, n_procs::Vector{$PetscInt}, procs::Vector{$PetscInt} ) + n_procs_ = Ref(pointer(n_procs)) + + @chk ccall( + (:ISLocalToGlobalMappingRestoreNodeInfo, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}), + mapping, n, n_procs_, procs, + ) + + + return nothing +end + +""" + array::Vector{PetscInt} = ISLocalToGlobalMappingGetIndices(petsclib::PetscLibType,ltog::ISLocalToGlobalMapping) +Get global indices for every local point that is mapped + +Not Collective + +Input Parameter: +- `ltog` - local to global mapping + +Output Parameter: +- `array` - array of indices, the length of this array may be obtained with `ISLocalToGlobalMappingGetSize()` + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingApply()`, `ISLocalToGlobalMappingRestoreIndices()`, +`ISLocalToGlobalMappingGetBlockIndices()`, `ISLocalToGlobalMappingRestoreBlockIndices()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingGetIndices")) +""" +function ISLocalToGlobalMappingGetIndices(petsclib::PetscLibType, ltog::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingGetIndices(petsclib::$UnionPetscLib, ltog::ISLocalToGlobalMapping ) + array_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISLocalToGlobalMappingGetIndices, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{Ptr{$PetscInt}}), + ltog, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + ISLocalToGlobalMappingRestoreIndices(petsclib::PetscLibType,ltog::ISLocalToGlobalMapping, array::Vector{PetscInt}) +Restore indices obtained with `ISLocalToGlobalMappingGetIndices()` + +Not Collective + +Input Parameters: +- `ltog` - local to global mapping +- `array` - array of indices + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingApply()`, `ISLocalToGlobalMappingGetIndices()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingRestoreIndices")) +""" +function ISLocalToGlobalMappingRestoreIndices(petsclib::PetscLibType, ltog::ISLocalToGlobalMapping, array::Vector{PetscInt}) end + +@for_petsc function ISLocalToGlobalMappingRestoreIndices(petsclib::$UnionPetscLib, ltog::ISLocalToGlobalMapping, array::Vector{$PetscInt} ) + array_ = Ref(pointer(array)) + + @chk ccall( + (:ISLocalToGlobalMappingRestoreIndices, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{Ptr{$PetscInt}}), + ltog, array_, + ) + + + return nothing +end + +""" + array::Vector{PetscInt} = ISLocalToGlobalMappingGetBlockIndices(petsclib::PetscLibType,ltog::ISLocalToGlobalMapping) +Get global indices for every local block in a `ISLocalToGlobalMapping` + +Not Collective + +Input Parameter: +- `ltog` - local to global mapping + +Output Parameter: +- `array` - array of indices + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingApply()`, +`ISLocalToGlobalMappingRestoreBlockIndices()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingGetBlockIndices")) +""" +function ISLocalToGlobalMappingGetBlockIndices(petsclib::PetscLibType, ltog::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingGetBlockIndices(petsclib::$UnionPetscLib, ltog::ISLocalToGlobalMapping ) + array_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:ISLocalToGlobalMappingGetBlockIndices, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{Ptr{$PetscInt}}), + ltog, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + ISLocalToGlobalMappingRestoreBlockIndices(petsclib::PetscLibType,ltog::ISLocalToGlobalMapping, array::Vector{PetscInt}) +Restore indices obtained with `ISLocalToGlobalMappingGetBlockIndices()` + +Not Collective + +Input Parameters: +- `ltog` - local to global mapping +- `array` - array of indices + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingApply()`, `ISLocalToGlobalMappingGetIndices()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingRestoreBlockIndices")) +""" +function ISLocalToGlobalMappingRestoreBlockIndices(petsclib::PetscLibType, ltog::ISLocalToGlobalMapping, array::Vector{PetscInt}) end + +@for_petsc function ISLocalToGlobalMappingRestoreBlockIndices(petsclib::$UnionPetscLib, ltog::ISLocalToGlobalMapping, array::Vector{$PetscInt} ) + array_ = Ref(pointer(array)) + + @chk ccall( + (:ISLocalToGlobalMappingRestoreBlockIndices, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{Ptr{$PetscInt}}), + ltog, array_, + ) + + + return nothing +end + +""" + ISLocalToGlobalMappingConcatenate(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, ltogs::Vector{ISLocalToGlobalMapping}, ltogcat::ISLocalToGlobalMapping) +Create a new mapping that concatenates a list of mappings + +Not Collective + +Input Parameters: +- `comm` - communicator for the new mapping, must contain the communicator of every mapping to concatenate +- `n` - number of mappings to concatenate +- `ltogs` - local to global mappings + +Output Parameter: +- `ltogcat` - new mapping + +Level: advanced + +-seealso: [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingCreate()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingConcatenate")) +""" +function ISLocalToGlobalMappingConcatenate(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, ltogs::Vector{ISLocalToGlobalMapping}, ltogcat::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingConcatenate(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, ltogs::Vector{ISLocalToGlobalMapping}, ltogcat::ISLocalToGlobalMapping ) + + @chk ccall( + (:ISLocalToGlobalMappingConcatenate, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{ISLocalToGlobalMapping}, Ptr{ISLocalToGlobalMapping}), + comm, n, ltogs, ltogcat, + ) + + + return nothing +end + +""" + ISLocalToGlobalMappingRegister(petsclib::PetscLibType,sname::String, fnc::external) +Registers a method for applying a global to local mapping with an `ISLocalToGlobalMapping` + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new method +- `function` - routine to create method context + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingRegisterAll()`, `ISLocalToGlobalMappingRegisterDestroy()`, `ISLOCALTOGLOBALMAPPINGBASIC`, +`ISLOCALTOGLOBALMAPPINGHASH`, `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingApply()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingRegister")) +""" +function ISLocalToGlobalMappingRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function ISLocalToGlobalMappingRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:ISLocalToGlobalMappingRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + ISLocalToGlobalMappingSetType(petsclib::PetscLibType,ltog::ISLocalToGlobalMapping, type::ISLocalToGlobalMappingType) +Sets the implementation type `ISLocalToGlobalMapping` will use + +Logically Collective + +Input Parameters: +- `ltog` - the `ISLocalToGlobalMapping` object +- `type` - a known method + +Options Database Key: +- `-islocaltoglobalmapping_type ` - Sets the method; use -help for a list of available methods (for instance, basic or hash) + +Level: intermediate + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingType`, `ISLocalToGlobalMappingRegister()`, `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingGetType()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingSetType")) +""" +function ISLocalToGlobalMappingSetType(petsclib::PetscLibType, ltog::ISLocalToGlobalMapping, type::ISLocalToGlobalMappingType) end + +@for_petsc function ISLocalToGlobalMappingSetType(petsclib::$UnionPetscLib, ltog::ISLocalToGlobalMapping, type::ISLocalToGlobalMappingType ) + + @chk ccall( + (:ISLocalToGlobalMappingSetType, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, ISLocalToGlobalMappingType), + ltog, type, + ) + + + return nothing +end + +""" + type::ISLocalToGlobalMappingType = ISLocalToGlobalMappingGetType(petsclib::PetscLibType,ltog::ISLocalToGlobalMapping) +Get the type of the `ISLocalToGlobalMapping` + +Not Collective + +Input Parameter: +- `ltog` - the `ISLocalToGlobalMapping` object + +Output Parameter: +- `type` - the type + +Level: intermediate + +-seealso: [](sec_scatter), `ISLocalToGlobalMappingType`, `ISLocalToGlobalMappingRegister()`, `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingSetType()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingGetType")) +""" +function ISLocalToGlobalMappingGetType(petsclib::PetscLibType, ltog::ISLocalToGlobalMapping) end + +@for_petsc function ISLocalToGlobalMappingGetType(petsclib::$UnionPetscLib, ltog::ISLocalToGlobalMapping ) + type_ = Ref{ISLocalToGlobalMappingType}() + + @chk ccall( + (:ISLocalToGlobalMappingGetType, $petsc_library), + PetscErrorCode, + (ISLocalToGlobalMapping, Ptr{ISLocalToGlobalMappingType}), + ltog, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + ISLocalToGlobalMappingRegisterAll(petsclib::PetscLibType) +Registers all of the local to global mapping components in the `IS` package. + +Not Collective + +Level: advanced + +-seealso: [](sec_scatter), `ISRegister()`, `ISLocalToGlobalRegister()` + +# External Links +$(_doc_external("Vec/ISLocalToGlobalMappingRegisterAll")) +""" +function ISLocalToGlobalMappingRegisterAll(petsclib::PetscLibType) end + +@for_petsc function ISLocalToGlobalMappingRegisterAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:ISLocalToGlobalMappingRegisterAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + ISColoringReference(petsclib::PetscLibType,coloring::ISColoring) + +# External Links +$(_doc_external("Vec/ISColoringReference")) +""" +function ISColoringReference(petsclib::PetscLibType, coloring::ISColoring) end + +@for_petsc function ISColoringReference(petsclib::$UnionPetscLib, coloring::ISColoring ) + + @chk ccall( + (:ISColoringReference, $petsc_library), + PetscErrorCode, + (ISColoring,), + coloring, + ) + + + return nothing +end + +""" + ISColoringSetType(petsclib::PetscLibType,coloring::ISColoring, type::ISColoringType) +indicates if the coloring is for the local representation (including ghost points) or the global representation of a `Mat` + +Collective + +Input Parameters: +- `coloring` - the coloring object +- `type` - either `IS_COLORING_LOCAL` or `IS_COLORING_GLOBAL` + +Level: intermediate + +-seealso: `MatFDColoringCreate()`, `ISColoring`, `ISColoringType`, `ISColoringCreate()`, `IS_COLORING_LOCAL`, `IS_COLORING_GLOBAL`, `ISColoringGetType()` + +# External Links +$(_doc_external("Vec/ISColoringSetType")) +""" +function ISColoringSetType(petsclib::PetscLibType, coloring::ISColoring, type::ISColoringType) end + +@for_petsc function ISColoringSetType(petsclib::$UnionPetscLib, coloring::ISColoring, type::ISColoringType ) + + @chk ccall( + (:ISColoringSetType, $petsc_library), + PetscErrorCode, + (ISColoring, ISColoringType), + coloring, type, + ) + + + return nothing +end + +""" + type::ISColoringType = ISColoringGetType(petsclib::PetscLibType,coloring::ISColoring) +gets if the coloring is for the local representation (including ghost points) or the global representation + +Collective + +Input Parameter: +- `coloring` - the coloring object + +Output Parameter: +- `type` - either `IS_COLORING_LOCAL` or `IS_COLORING_GLOBAL` + +Level: intermediate + +-seealso: `MatFDColoringCreate()`, `ISColoring`, `ISColoringType`, `ISColoringCreate()`, `IS_COLORING_LOCAL`, `IS_COLORING_GLOBAL`, `ISColoringSetType()` + +# External Links +$(_doc_external("Vec/ISColoringGetType")) +""" +function ISColoringGetType(petsclib::PetscLibType, coloring::ISColoring) end + +@for_petsc function ISColoringGetType(petsclib::$UnionPetscLib, coloring::ISColoring ) + type_ = Ref{ISColoringType}() + + @chk ccall( + (:ISColoringGetType, $petsc_library), + PetscErrorCode, + (ISColoring, Ptr{ISColoringType}), + coloring, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + ISColoringDestroy(petsclib::PetscLibType,iscoloring::ISColoring) +Destroys an `ISColoring` coloring context. + +Collective + +Input Parameter: +- `iscoloring` - the coloring context + +Level: advanced + +-seealso: `ISColoring`, `ISColoringView()`, `MatColoring` + +# External Links +$(_doc_external("Vec/ISColoringDestroy")) +""" +function ISColoringDestroy(petsclib::PetscLibType, iscoloring::ISColoring) end + +@for_petsc function ISColoringDestroy(petsclib::$UnionPetscLib, iscoloring::ISColoring ) + + @chk ccall( + (:ISColoringDestroy, $petsc_library), + PetscErrorCode, + (Ptr{ISColoring},), + iscoloring, + ) + + + return nothing +end + +""" + ISColoringViewFromOptions(petsclib::PetscLibType,obj::ISColoring, bobj::PetscObject, optionname::String) +Processes command line options to determine if/how an `ISColoring` object is to be viewed. + +Collective + +Input Parameters: +- `obj` - the `ISColoring` object +- `bobj` - prefix to use for viewing, or `NULL` to use prefix of `mat` +- `optionname` - option to activate viewing + +Level: intermediate + +-seealso: `ISColoring`, `ISColoringView()` + +# External Links +$(_doc_external("Vec/ISColoringViewFromOptions")) +""" +function ISColoringViewFromOptions(petsclib::PetscLibType, obj::ISColoring, bobj::PetscObject, optionname::String) end + +@for_petsc function ISColoringViewFromOptions(petsclib::$UnionPetscLib, obj::ISColoring, bobj::PetscObject, optionname::String ) + + @chk ccall( + (:ISColoringViewFromOptions, $petsc_library), + PetscErrorCode, + (ISColoring, PetscObject, Ptr{Cchar}), + obj, bobj, optionname, + ) + + + return nothing +end + +""" + ISColoringView(petsclib::PetscLibType,iscoloring::ISColoring, viewer::PetscViewer) +Views an `ISColoring` coloring context. + +Collective + +Input Parameters: +- `iscoloring` - the coloring context +- `viewer` - the viewer + +Level: advanced + +-seealso: `ISColoring()`, `ISColoringViewFromOptions()`, `ISColoringDestroy()`, `ISColoringGetIS()`, `MatColoring` + +# External Links +$(_doc_external("Vec/ISColoringView")) +""" +function ISColoringView(petsclib::PetscLibType, iscoloring::ISColoring, viewer::PetscViewer) end + +@for_petsc function ISColoringView(petsclib::$UnionPetscLib, iscoloring::ISColoring, viewer::PetscViewer ) + + @chk ccall( + (:ISColoringView, $petsc_library), + PetscErrorCode, + (ISColoring, PetscViewer), + iscoloring, viewer, + ) + + + return nothing +end + +""" + n::PetscInt,nc::PetscInt = ISColoringGetColors(petsclib::PetscLibType,iscoloring::ISColoring, colors::ISColoringValue) +Returns an array with the color for each local node + +Not Collective + +Input Parameter: +- `iscoloring` - the coloring context + +Output Parameters: +- `n` - number of nodes +- `nc` - number of colors +- `colors` - color for each node + +Level: advanced + +-seealso: `ISColoring`, `ISColoringValue`, `ISColoringRestoreIS()`, `ISColoringView()`, `ISColoringGetIS()` + +# External Links +$(_doc_external("Vec/ISColoringGetColors")) +""" +function ISColoringGetColors(petsclib::PetscLibType, iscoloring::ISColoring, colors::ISColoringValue) end + +@for_petsc function ISColoringGetColors(petsclib::$UnionPetscLib, iscoloring::ISColoring, colors::ISColoringValue ) + n_ = Ref{$PetscInt}() + nc_ = Ref{$PetscInt}() + + @chk ccall( + (:ISColoringGetColors, $petsc_library), + PetscErrorCode, + (ISColoring, Ptr{$PetscInt}, Ptr{$PetscInt}, ISColoringValue), + iscoloring, n_, nc_, colors, + ) + + n = n_[] + nc = nc_[] + + return n,nc +end + +""" + nn::PetscInt = ISColoringGetIS(petsclib::PetscLibType,iscoloring::ISColoring, mode::PetscCopyMode, isis::Vector{IS}) +Extracts index sets from the coloring context. Each is contains the nodes of one color + +Collective + +Input Parameters: +- `iscoloring` - the coloring context +- `mode` - if this value is `PETSC_OWN_POINTER` then the caller owns the pointer and must free the array of `IS` and each `IS` in the array + +Output Parameters: +- `nn` - number of index sets in the coloring context +- `isis` - array of index sets + +Level: advanced + +-seealso: `ISColoring`, `IS`, `ISColoringRestoreIS()`, `ISColoringView()`, `ISColoringGetColoring()`, `ISColoringGetColors()` + +# External Links +$(_doc_external("Vec/ISColoringGetIS")) +""" +function ISColoringGetIS(petsclib::PetscLibType, iscoloring::ISColoring, mode::PetscCopyMode, isis::Vector{IS}) end + +@for_petsc function ISColoringGetIS(petsclib::$UnionPetscLib, iscoloring::ISColoring, mode::PetscCopyMode, isis::Vector{IS} ) + nn_ = Ref{$PetscInt}() + isis_ = Ref(pointer(isis)) + + @chk ccall( + (:ISColoringGetIS, $petsc_library), + PetscErrorCode, + (ISColoring, PetscCopyMode, Ptr{$PetscInt}, Ptr{Ptr{CIS}}), + iscoloring, mode, nn_, isis_, + ) + + nn = nn_[] + + return nn +end + +""" + ISColoringRestoreIS(petsclib::PetscLibType,iscoloring::ISColoring, mode::PetscCopyMode, is::Vector{IS}) +Restores the index sets extracted from the coloring context with `ISColoringGetIS()` using `PETSC_USE_POINTER` + +Collective + +Input Parameters: +- `iscoloring` - the coloring context +- `mode` - who retains ownership of the is +- `is` - array of index sets + +Level: advanced + +-seealso: `ISColoring()`, `IS`, `ISColoringGetIS()`, `ISColoringView()`, `PetscCopyMode` + +# External Links +$(_doc_external("Vec/ISColoringRestoreIS")) +""" +function ISColoringRestoreIS(petsclib::PetscLibType, iscoloring::ISColoring, mode::PetscCopyMode, is::Vector{IS}) end + +@for_petsc function ISColoringRestoreIS(petsclib::$UnionPetscLib, iscoloring::ISColoring, mode::PetscCopyMode, is::Vector{IS} ) + is_ = Ref(pointer(is)) + + @chk ccall( + (:ISColoringRestoreIS, $petsc_library), + PetscErrorCode, + (ISColoring, PetscCopyMode, Ptr{Ptr{CIS}}), + iscoloring, mode, is_, + ) + + + return nothing +end + +""" + iscoloring::ISColoring = ISColoringCreate(petsclib::PetscLibType,comm::MPI_Comm, ncolors::PetscInt, n::PetscInt, colors::Vector{ISColoringValue}, mode::PetscCopyMode) +Generates an `ISColoring` context from lists (provided by each MPI process) of colors for each node. + +Collective + +Input Parameters: +- `comm` - communicator for the processors creating the coloring +- `ncolors` - max color value +- `n` - number of nodes on this processor +- `colors` - array containing the colors for this MPI rank, color numbers begin at 0, for each local node +- `mode` - see `PetscCopyMode` for meaning of this flag. + +Output Parameter: +- `iscoloring` - the resulting coloring data structure + +Options Database Key: +- `-is_coloring_view` - Activates `ISColoringView()` + +Level: advanced + +-seealso: `ISColoring`, `ISColoringValue`, `MatColoringCreate()`, `ISColoringView()`, `ISColoringDestroy()`, `ISColoringSetType()` + +# External Links +$(_doc_external("Vec/ISColoringCreate")) +""" +function ISColoringCreate(petsclib::PetscLibType, comm::MPI_Comm, ncolors::PetscInt, n::PetscInt, colors::Vector{ISColoringValue}, mode::PetscCopyMode) end + +@for_petsc function ISColoringCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, ncolors::$PetscInt, n::$PetscInt, colors::Vector{ISColoringValue}, mode::PetscCopyMode ) + iscoloring_ = Ref{ISColoring}() + + @chk ccall( + (:ISColoringCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{ISColoringValue}, PetscCopyMode, Ptr{ISColoring}), + comm, ncolors, n, colors, mode, iscoloring_, + ) + + iscoloring = iscoloring_[] + + return iscoloring +end + +""" + ISColoringValueCast(petsclib::PetscLibType,a::PetscCount, b::ISColoringValue) + +# External Links +$(_doc_external("Vec/ISColoringValueCast")) +""" +function ISColoringValueCast(petsclib::PetscLibType, a::PetscCount, b::ISColoringValue) end + +@for_petsc function ISColoringValueCast(petsclib::$UnionPetscLib, a::PetscCount, b::ISColoringValue ) + + @chk ccall( + (:ISColoringValueCast, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{ISColoringValue}), + a, b, + ) + + + return nothing +end + diff --git a/src/autowrapped/KSPGuess_wrappers.jl b/src/autowrapped/KSPGuess_wrappers.jl new file mode 100644 index 00000000..8661a0e1 --- /dev/null +++ b/src/autowrapped/KSPGuess_wrappers.jl @@ -0,0 +1,425 @@ +""" + KSPGuessRegister(petsclib::PetscLibType,sname::String, fnc::external) +Registers a method for initial guess computation in Krylov subspace solver package. + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined solver +- `function` - routine to create method context + +-seealso: [](ch_ksp), `KSPGuess`, `KSPGuessRegisterAll()` + +# External Links +$(_doc_external("Ksp/KSPGuessRegister")) +""" +function KSPGuessRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function KSPGuessRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:KSPGuessRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + KSPGuessSetFromOptions(petsclib::PetscLibType,guess::KSPGuess) +Sets the options for a `KSPGuess` from the options database + +Collective + +Input Parameter: +- `guess` - `KSPGuess` object + +Options Database Keys: +- `-ksp_guess_type ` - Turns on generation of initial guesses and sets the method; use -help for a list of available methods +- `-ksp_guess_view ` - view the `KSPGuess` object +- `-ksp_guess_fischer_model ` - set details for the Fischer models +- `-ksp_guess_fischer_monitor` - monitor the Fischer models +- `-ksp_guess_fischer_tol ` - set the tolerance for the Fischer models +- `-ksp_guess_pod_size ` - Number of snapshots +- `-ksp_guess_pod_monitor true` - monitor the pod initial guess processing +- `-ksp_guess_pod_tol ` - Tolerance to retain eigenvectors +- `-ksp_guess_pod_Ainner true` - Use the operator as inner product (must be SPD) + +Level: developer + +-seealso: [](ch_ksp), `KSPGuess`, `KSPGetGuess()`, `KSPGuessSetType()`, `KSPGuessType` + +# External Links +$(_doc_external("Ksp/KSPGuessSetFromOptions")) +""" +function KSPGuessSetFromOptions(petsclib::PetscLibType, guess::KSPGuess) end + +@for_petsc function KSPGuessSetFromOptions(petsclib::$UnionPetscLib, guess::KSPGuess ) + + @chk ccall( + (:KSPGuessSetFromOptions, $petsc_library), + PetscErrorCode, + (KSPGuess,), + guess, + ) + + + return nothing +end + +""" + KSPGuessSetTolerance(petsclib::PetscLibType,guess::KSPGuess, tol::PetscReal) +Sets the relative tolerance used in either eigenvalue (POD) or singular value (Fischer type 3) calculations. + +Collective + +Input Parameters: +- `guess` - `KSPGuess` object +- `tol` - the tolerance + +Options Database Key: +- `-ksp_guess_fischer_tol ` - set the tolerance for the Fischer models +- `-ksp_guess_pod_tol ` - set the tolerance for the Pod models + +Level: developer + +-seealso: [](ch_ksp), `KSPGuess`, `KSPGuessType`, `KSPGuessSetFromOptions()` + +# External Links +$(_doc_external("Ksp/KSPGuessSetTolerance")) +""" +function KSPGuessSetTolerance(petsclib::PetscLibType, guess::KSPGuess, tol::PetscReal) end + +@for_petsc function KSPGuessSetTolerance(petsclib::$UnionPetscLib, guess::KSPGuess, tol::$PetscReal ) + + @chk ccall( + (:KSPGuessSetTolerance, $petsc_library), + PetscErrorCode, + (KSPGuess, $PetscReal), + guess, tol, + ) + + + return nothing +end + +""" + KSPGuessDestroy(petsclib::PetscLibType,guess::KSPGuess) +Destroys `KSPGuess` context. + +Collective + +Input Parameter: +- `guess` - initial guess object + +Level: developer + +-seealso: [](ch_ksp), `KSPGuessCreate()`, `KSPGuess`, `KSPGuessType` + +# External Links +$(_doc_external("Ksp/KSPGuessDestroy")) +""" +function KSPGuessDestroy(petsclib::PetscLibType, guess::KSPGuess) end + +@for_petsc function KSPGuessDestroy(petsclib::$UnionPetscLib, guess::KSPGuess ) + + @chk ccall( + (:KSPGuessDestroy, $petsc_library), + PetscErrorCode, + (Ptr{KSPGuess},), + guess, + ) + + + return nothing +end + +""" + KSPGuessView(petsclib::PetscLibType,guess::KSPGuess, view::PetscViewer) +View the `KSPGuess` object + +Logically Collective + +Input Parameters: +- `guess` - the initial guess object for the Krylov method +- `view` - the viewer object + +Options Database Key: +- `-ksp_guess_view viewer` - view the `KSPGuess` object + +Level: developer + +-seealso: [](ch_ksp), `KSP`, `KSPGuess`, `KSPGuessType`, `KSPGuessRegister()`, `KSPGuessCreate()`, `PetscViewer` + +# External Links +$(_doc_external("Ksp/KSPGuessView")) +""" +function KSPGuessView(petsclib::PetscLibType, guess::KSPGuess, view::PetscViewer) end + +@for_petsc function KSPGuessView(petsclib::$UnionPetscLib, guess::KSPGuess, view::PetscViewer ) + + @chk ccall( + (:KSPGuessView, $petsc_library), + PetscErrorCode, + (KSPGuess, PetscViewer), + guess, view, + ) + + + return nothing +end + +""" + guess::KSPGuess = KSPGuessCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a `KSPGuess` context. + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `guess` - location to put the `KSPGuess` context + +Options Database Keys: +- `-ksp_guess_type ` - Turns on generation of initial guesses and sets the method; use -help for a list of available methods +- `-ksp_guess_view ` - view the `KSPGuess` object +- `-ksp_guess_fischer_model ` - set details for the Fischer models +- `-ksp_guess_fischer_monitor` - monitor the fischer models +- `-ksp_guess_fischer_tol ` - set the tolerance for the Fischer models +- `-ksp_guess_pod_size ` - Number of snapshots +- `-ksp_guess_pod_monitor true` - monitor the pod initial guess processing +- `-ksp_guess_pod_tol ` - Tolerance to retain eigenvectors +- `-ksp_guess_pod_Ainner true` - Use the operator as inner product (must be SPD) + +Level: developer + +-seealso: [](ch_ksp), `KSPSolve()`, `KSPGuessDestroy()`, `KSPGuess`, `KSPGuessType`, `KSP` + +# External Links +$(_doc_external("Ksp/KSPGuessCreate")) +""" +function KSPGuessCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function KSPGuessCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + guess_ = Ref{KSPGuess}() + + @chk ccall( + (:KSPGuessCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{KSPGuess}), + comm, guess_, + ) + + guess = guess_[] + + return guess +end + +""" + KSPGuessSetType(petsclib::PetscLibType,guess::KSPGuess, type::KSPGuessType) +Sets the type of a `KSPGuess`. Each `KSPGuessType` provides a different algorithm for computing the initial guess. + +Logically Collective + +Input Parameters: +- `guess` - the initial guess object for the Krylov method +- `type` - a known `KSPGuessType` + +Options Database Key: +- `-ksp_guess_type ` - Turns on generation of initial guesses and sets the method; see `KSPGuessType` for a list of available types + +Level: developer + +-seealso: [](ch_ksp), `KSP`, `KSPGuess`, `KSPGuessType`, `KSPGuessRegister()`, `KSPGuessCreate()`, `KSPGUESSFISCHER`, `KSPGUESSPOD` + +# External Links +$(_doc_external("Ksp/KSPGuessSetType")) +""" +function KSPGuessSetType(petsclib::PetscLibType, guess::KSPGuess, type::KSPGuessType) end + +@for_petsc function KSPGuessSetType(petsclib::$UnionPetscLib, guess::KSPGuess, type::KSPGuessType ) + + @chk ccall( + (:KSPGuessSetType, $petsc_library), + PetscErrorCode, + (KSPGuess, KSPGuessType), + guess, type, + ) + + + return nothing +end + +""" + type::KSPGuessType = KSPGuessGetType(petsclib::PetscLibType,guess::KSPGuess) +Gets the `KSPGuessType` as a string from the `KSPGuess` object. + +Not Collective + +Input Parameter: +- `guess` - the initial guess context + +Output Parameter: +- `type` - type of `KSPGuess` method + +Level: developer + +-seealso: [](ch_ksp), `KSPGuess`, `KSPGuessSetType()` + +# External Links +$(_doc_external("Ksp/KSPGuessGetType")) +""" +function KSPGuessGetType(petsclib::PetscLibType, guess::KSPGuess) end + +@for_petsc function KSPGuessGetType(petsclib::$UnionPetscLib, guess::KSPGuess ) + type_ = Ref{KSPGuessType}() + + @chk ccall( + (:KSPGuessGetType, $petsc_library), + PetscErrorCode, + (KSPGuess, Ptr{KSPGuessType}), + guess, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + KSPGuessUpdate(petsclib::PetscLibType,guess::KSPGuess, rhs::PetscVec, sol::PetscVec) +Updates the guess object with the current solution and rhs vector + +Collective + +Input Parameters: +- `guess` - the initial guess context +- `rhs` - the corresponding rhs +- `sol` - the computed solution + +Level: developer + +-seealso: [](ch_ksp), `KSPGuessCreate()`, `KSPGuess` + +# External Links +$(_doc_external("Ksp/KSPGuessUpdate")) +""" +function KSPGuessUpdate(petsclib::PetscLibType, guess::KSPGuess, rhs::PetscVec, sol::PetscVec) end + +@for_petsc function KSPGuessUpdate(petsclib::$UnionPetscLib, guess::KSPGuess, rhs::PetscVec, sol::PetscVec ) + + @chk ccall( + (:KSPGuessUpdate, $petsc_library), + PetscErrorCode, + (KSPGuess, CVec, CVec), + guess, rhs, sol, + ) + + + return nothing +end + +""" + KSPGuessFormGuess(petsclib::PetscLibType,guess::KSPGuess, rhs::PetscVec, sol::PetscVec) +Form the initial guess + +Collective + +Input Parameters: +- `guess` - the initial guess context +- `rhs` - the current right-hand side vector +- `sol` - the initial guess vector + +Level: developer + +-seealso: [](ch_ksp), `KSPGuessCreate()`, `KSPGuess` + +# External Links +$(_doc_external("Ksp/KSPGuessFormGuess")) +""" +function KSPGuessFormGuess(petsclib::PetscLibType, guess::KSPGuess, rhs::PetscVec, sol::PetscVec) end + +@for_petsc function KSPGuessFormGuess(petsclib::$UnionPetscLib, guess::KSPGuess, rhs::PetscVec, sol::PetscVec ) + + @chk ccall( + (:KSPGuessFormGuess, $petsc_library), + PetscErrorCode, + (KSPGuess, CVec, CVec), + guess, rhs, sol, + ) + + + return nothing +end + +""" + KSPGuessSetUp(petsclib::PetscLibType,guess::KSPGuess) +Setup the initial guess object + +Collective + +Input Parameter: +- `guess` - the initial guess context + +Level: developer + +-seealso: [](ch_ksp), `KSPGuessCreate()`, `KSPGuess` + +# External Links +$(_doc_external("Ksp/KSPGuessSetUp")) +""" +function KSPGuessSetUp(petsclib::PetscLibType, guess::KSPGuess) end + +@for_petsc function KSPGuessSetUp(petsclib::$UnionPetscLib, guess::KSPGuess ) + + @chk ccall( + (:KSPGuessSetUp, $petsc_library), + PetscErrorCode, + (KSPGuess,), + guess, + ) + + + return nothing +end + +""" + KSPGuessFischerSetModel(petsclib::PetscLibType,guess::KSPGuess, model::PetscInt, size::PetscInt) +Set the Paul Fischer algorithm or its variants to compute the initial guess for a `KSPSolve()` + +Logically Collective + +Input Parameters: +- `guess` - the initial guess context +- `model` - use model 1, model 2, model 3, or any other number to turn it off +- `size` - size of subspace used to generate initial guess + +Options Database Key: +- `-ksp_guess_fischer_model ` - uses the Fischer initial guess generator for repeated linear solves + +Level: advanced + +-seealso: [](ch_ksp), `KSPGuess`, `KSPGuessCreate()`, `KSPSetUseFischerGuess()`, `KSPSetGuess()`, `KSPGetGuess()`, `KSP` + +# External Links +$(_doc_external("Ksp/KSPGuessFischerSetModel")) +""" +function KSPGuessFischerSetModel(petsclib::PetscLibType, guess::KSPGuess, model::PetscInt, size::PetscInt) end + +@for_petsc function KSPGuessFischerSetModel(petsclib::$UnionPetscLib, guess::KSPGuess, model::$PetscInt, size::$PetscInt ) + + @chk ccall( + (:KSPGuessFischerSetModel, $petsc_library), + PetscErrorCode, + (KSPGuess, $PetscInt, $PetscInt), + guess, model, size, + ) + + + return nothing +end + diff --git a/src/autowrapped/KSP_wrappers.jl b/src/autowrapped/KSP_wrappers.jl new file mode 100644 index 00000000..92009dd6 --- /dev/null +++ b/src/autowrapped/KSP_wrappers.jl @@ -0,0 +1,8666 @@ +# autodefined type arguments for class ------ +mutable struct KSPConvergedReasonViewFn end + +mutable struct KSPMonitorFn end + +mutable struct KSPConvergenceTestFn end + +mutable struct KSPComputeOperatorsFn end + +mutable struct KSPComputeRHSFn end + +mutable struct KSPComputeInitialGuessFn end + +mutable struct _n_PeCtx end +const PeCtx = Ptr{_n_PeCtx} + +mutable struct KSPPSolveFn end + +mutable struct KSPMonitorRegisterFn end + +mutable struct KSPMonitorRegisterCreateFn end + +mutable struct KSPMonitorRegisterDestroyFn end + +mutable struct _n_KSPGuess end +const KSPGuess = Ptr{_n_KSPGuess} + +mutable struct KSPFlexibleModifyPCFn end + +# ------------------------------------------------------- +""" + KSPComputeOperator(petsclib::PetscLibType,ksp::PetscKSP, mattype::MatType, mat::PetscMat) +Computes the explicit preconditioned operator, including diagonal scaling and null +space removal if applicable. + +Collective + +Input Parameters: +- `ksp` - the Krylov subspace context +- `mattype` - the matrix type to be used + +Output Parameter: +- `mat` - the explicit preconditioned operator + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPSetOperators()`, `KSPComputeEigenvaluesExplicitly()`, `PCComputeOperator()`, `KSPSetDiagonalScale()`, `KSPSetNullSpace()`, `MatType` + +# External Links +$(_doc_external("KSP/KSPComputeOperator")) +""" +function KSPComputeOperator(petsclib::PetscLibType, ksp::PetscKSP, mattype::MatType, mat::PetscMat) end + +@for_petsc function KSPComputeOperator(petsclib::$UnionPetscLib, ksp::PetscKSP, mattype::MatType, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:KSPComputeOperator, $petsc_library), + PetscErrorCode, + (CKSP, MatType, Ptr{CMat}), + ksp, mattype, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + r::Vector{PetscReal},c::Vector{PetscReal} = KSPComputeEigenvaluesExplicitly(petsclib::PetscLibType,ksp::PetscKSP, nmax::PetscInt) +Computes all of the eigenvalues of the +preconditioned operator using LAPACK. + +Collective + +Input Parameters: +- `ksp` - iterative context obtained from `KSPCreate()` +- `nmax` - size of arrays `r` and `c` + +Output Parameters: +- `r` - real part of computed eigenvalues, provided by user with a dimension at least of `n` +- `c` - complex part of computed eigenvalues, provided by user with a dimension at least of `n` + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPComputeEigenvalues()`, `KSPMonitorSingularValue()`, `KSPComputeExtremeSingularValues()`, `KSPSetOperators()`, `KSPSolve()` + +# External Links +$(_doc_external("KSP/KSPComputeEigenvaluesExplicitly")) +""" +function KSPComputeEigenvaluesExplicitly(petsclib::PetscLibType, ksp::PetscKSP, nmax::PetscInt) end + +@for_petsc function KSPComputeEigenvaluesExplicitly(petsclib::$UnionPetscLib, ksp::PetscKSP, nmax::$PetscInt ) + r = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + c = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:KSPComputeEigenvaluesExplicitly, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}), + ksp, nmax, r, c, + ) + + + return r,c +end + +""" + KSPMonitorLGRange(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, monctx::Cvoid) + +# External Links +$(_doc_external("KSP/KSPMonitorLGRange")) +""" +function KSPMonitorLGRange(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, monctx::Cvoid) end + +@for_petsc function KSPMonitorLGRange(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, monctx::Cvoid ) + + @chk ccall( + (:KSPMonitorLGRange, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{Cvoid}), + ksp, n, rnorm, monctx, + ) + + + return nothing +end + +""" + emax::PetscReal,emin::PetscReal = KSPComputeExtremeSingularValues(petsclib::PetscLibType,ksp::PetscKSP) +Computes the extreme singular values +for the preconditioned operator. Called after or during `KSPSolve()`. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameters: +- `emax` - maximum estimated singular value +- `emin` - minimum estimated singular value + +Options Database Key: +- `-ksp_view_singularvalues` - compute extreme singular values and print when `KSPSolve()` completes. + +Level: advanced + +-seealso: [](ch_ksp), `KSPSetComputeSingularValues()`, `KSPMonitorSingularValue()`, `KSPComputeEigenvalues()`, `KSP`, `KSPComputeRitz()` + +# External Links +$(_doc_external("KSP/KSPComputeExtremeSingularValues")) +""" +function KSPComputeExtremeSingularValues(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPComputeExtremeSingularValues(petsclib::$UnionPetscLib, ksp::PetscKSP ) + emax_ = Ref{$PetscReal}() + emin_ = Ref{$PetscReal}() + + @chk ccall( + (:KSPComputeExtremeSingularValues, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}, Ptr{$PetscReal}), + ksp, emax_, emin_, + ) + + emax = emax_[] + emin = emin_[] + + return emax,emin +end + +""" + r::Vector{PetscReal},c::Vector{PetscReal},neig::PetscInt = KSPComputeEigenvalues(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt) +Computes the extreme eigenvalues for the +preconditioned operator. Called after or during `KSPSolve()`. + +Not Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `n` - size of arrays `r` and `c`. The number of eigenvalues computed `neig` will, in general, be less than this. + +Output Parameters: +- `r` - real part of computed eigenvalues, provided by user with a dimension of at least `n` +- `c` - complex part of computed eigenvalues, provided by user with a dimension of at least `n` +- `neig` - actual number of eigenvalues computed (will be less than or equal to `n`) + +Options Database Key: +- `-ksp_view_eigenvalues` - Prints eigenvalues to stdout + +Level: advanced + +-seealso: [](ch_ksp), `KSPSetComputeEigenvalues()`, `KSPSetComputeSingularValues()`, `KSPMonitorSingularValue()`, `KSPComputeExtremeSingularValues()`, `KSP`, `KSPComputeRitz()` + +# External Links +$(_doc_external("KSP/KSPComputeEigenvalues")) +""" +function KSPComputeEigenvalues(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt) end + +@for_petsc function KSPComputeEigenvalues(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt ) + r = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + c = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + neig_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPComputeEigenvalues, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscInt}), + ksp, n, r, c, neig_, + ) + + neig = neig_[] + + return r,c,neig +end + +""" + nrit::PetscInt,tetar::Vector{PetscReal},tetai::Vector{PetscReal} = KSPComputeRitz(petsclib::PetscLibType,ksp::PetscKSP, ritz::PetscBool, small::PetscBool, S::Vector{PetscVec}) +Computes the Ritz or harmonic Ritz pairs associated with the +smallest or largest in modulus, for the preconditioned operator. + +Not Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `ritz` - `PETSC_TRUE` or `PETSC_FALSE` for Ritz pairs or harmonic Ritz pairs, respectively +- `small` - `PETSC_TRUE` or `PETSC_FALSE` for smallest or largest (harmonic) Ritz values, respectively + +Output Parameters: +- `nrit` - On input number of (harmonic) Ritz pairs to compute; on output, actual number of computed (harmonic) Ritz pairs +- `S` - an array of the Ritz vectors, pass in an array of vectors of size `nrit` +- `tetar` - real part of the Ritz values, pass in an array of size `nrit` +- `tetai` - imaginary part of the Ritz values, pass in an array of size `nrit` + +Level: advanced + +-seealso: [](ch_ksp), `KSPSetComputeRitz()`, `KSP`, `KSPGMRES`, `KSPComputeEigenvalues()`, `KSPSetComputeSingularValues()`, `KSPMonitorSingularValue()` + +# External Links +$(_doc_external("KSP/KSPComputeRitz")) +""" +function KSPComputeRitz(petsclib::PetscLibType, ksp::PetscKSP, ritz::PetscBool, small::PetscBool, S::Vector{PetscVec}) end + +@for_petsc function KSPComputeRitz(petsclib::$UnionPetscLib, ksp::PetscKSP, ritz::PetscBool, small::PetscBool, S::Vector{PetscVec} ) + nrit_ = Ref{$PetscInt}() + tetar = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + tetai = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:KSPComputeRitz, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool, PetscBool, Ptr{$PetscInt}, Ptr{CVec}, Ptr{$PetscReal}, Ptr{$PetscReal}), + ksp, ritz, small, nrit_, S, tetar, tetai, + ) + + nrit = nrit_[] + + return nrit,tetar,tetai +end + +""" + KSPSetUpOnBlocks(petsclib::PetscLibType,ksp::PetscKSP) +Sets up the preconditioner for each block in +the block Jacobi `PCJACOBI`, overlapping Schwarz `PCASM`, and fieldsplit `PCFIELDSPLIT` preconditioners + +Collective + +Input Parameter: +- `ksp` - the `KSP` context + +Level: advanced + +-seealso: [](ch_ksp), `PCSetUpOnBlocks()`, `KSPSetUp()`, `PCSetUp()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetUpOnBlocks")) +""" +function KSPSetUpOnBlocks(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPSetUpOnBlocks(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPSetUpOnBlocks, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPSetReusePreconditioner(petsclib::PetscLibType,ksp::PetscKSP, flag::PetscBool) +reuse the current preconditioner for future `KSPSolve()`, do not construct a new preconditioner even if the `Mat` operator +in the `KSP` has different values + +Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `flag` - `PETSC_TRUE` to reuse the current preconditioner, or `PETSC_FALSE` to construct a new preconditioner + +Options Database Key: +- `-ksp_reuse_preconditioner ` - reuse the previously computed preconditioner + +Level: intermediate + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSolve()`, `KSPDestroy()`, `KSP`, `KSPGetReusePreconditioner()`, +`SNESSetLagPreconditioner()`, `SNES` + +# External Links +$(_doc_external("KSP/KSPSetReusePreconditioner")) +""" +function KSPSetReusePreconditioner(petsclib::PetscLibType, ksp::PetscKSP, flag::PetscBool) end + +@for_petsc function KSPSetReusePreconditioner(petsclib::$UnionPetscLib, ksp::PetscKSP, flag::PetscBool ) + + @chk ccall( + (:KSPSetReusePreconditioner, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flag, + ) + + + return nothing +end + +""" + flag::PetscBool = KSPGetReusePreconditioner(petsclib::PetscLibType,ksp::PetscKSP) +Determines if the `KSP` reuses the current preconditioner even if the `Mat` operator in the `KSP` has changed. + +Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `flag` - the boolean flag indicating if the current preconditioner should be reused + +Level: intermediate + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSolve()`, `KSPDestroy()`, `KSPSetReusePreconditioner()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetReusePreconditioner")) +""" +function KSPGetReusePreconditioner(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetReusePreconditioner(petsclib::$UnionPetscLib, ksp::PetscKSP ) + flag_ = Ref{PetscBool}() + + @chk ccall( + (:KSPGetReusePreconditioner, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, flag_, + ) + + flag = flag_[] + + return flag +end + +""" + KSPSetSkipPCSetFromOptions(petsclib::PetscLibType,ksp::PetscKSP, flag::PetscBool) +prevents `KSPSetFromOptions()` from calling `PCSetFromOptions()`. +This is used if the same `PC` is shared by more than one `KSP` so its options are not reset for each `KSP` + +Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `flag` - `PETSC_TRUE` to skip calling the `PCSetFromOptions()` + +Level: developer + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSolve()`, `KSPDestroy()`, `PCSetReusePreconditioner()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetSkipPCSetFromOptions")) +""" +function KSPSetSkipPCSetFromOptions(petsclib::PetscLibType, ksp::PetscKSP, flag::PetscBool) end + +@for_petsc function KSPSetSkipPCSetFromOptions(petsclib::$UnionPetscLib, ksp::PetscKSP, flag::PetscBool ) + + @chk ccall( + (:KSPSetSkipPCSetFromOptions, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flag, + ) + + + return nothing +end + +""" + KSPSetUp(petsclib::PetscLibType,ksp::PetscKSP) +Sets up the internal data structures for the +later use `KSPSolve()` the `KSP` linear iterative solver. + +Collective + +Input Parameter: +- `ksp` - iterative solver, `KSP`, obtained from `KSPCreate()` + +Level: developer + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSolve()`, `KSPDestroy()`, `KSP`, `KSPSetUpOnBlocks()` + +# External Links +$(_doc_external("KSP/KSPSetUp")) +""" +function KSPSetUp(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPSetUp(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPSetUp, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPConvergedReasonView(petsclib::PetscLibType,ksp::PetscKSP, viewer::PetscViewer) +Displays the reason a `KSP` solve converged or diverged, `KSPConvergedReason` to a `PetscViewer` + +Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `viewer` - the `PetscViewer` on which to display the reason + +Options Database Keys: +- `-ksp_converged_reason` - print reason for converged or diverged, also prints number of iterations +- `-ksp_converged_reason ::failed` - only print reason and number of iterations when diverged + +Level: beginner + +-seealso: [](ch_ksp), `KSPConvergedReasonViewFromOptions()`, `KSPCreate()`, `KSPSetUp()`, `KSPDestroy()`, `KSPSetTolerances()`, `KSPConvergedDefault()`, +`KSPSolveTranspose()`, `KSPGetIterationNumber()`, `KSP`, `KSPGetConvergedReason()`, `PetscViewerPushFormat()`, `PetscViewerPopFormat()` + +# External Links +$(_doc_external("KSP/KSPConvergedReasonView")) +""" +function KSPConvergedReasonView(petsclib::PetscLibType, ksp::PetscKSP, viewer::PetscViewer) end + +@for_petsc function KSPConvergedReasonView(petsclib::$UnionPetscLib, ksp::PetscKSP, viewer::PetscViewer ) + + @chk ccall( + (:KSPConvergedReasonView, $petsc_library), + PetscErrorCode, + (CKSP, PetscViewer), + ksp, viewer, + ) + + + return nothing +end + +""" + KSPConvergedReasonViewSet(petsclib::PetscLibType,ksp::PetscKSP, f::KSPConvergedReasonViewFn, vctx::Cvoid, reasonviewdestroy::PetscCtxDestroyFn) +Sets an ADDITIONAL function that is to be used at the +end of the linear solver to display the convergence reason of the linear solver. + +Logically Collective + +Input Parameters: +- `ksp` - the `KSP` context +- `f` - the `ksp` converged reason view function, see `KSPConvergedReasonViewFn` +- `vctx` - [optional] user-defined context for private data for the +`KSPConvergedReason` view routine (use `NULL` if no context is desired) +- `reasonviewdestroy` - [optional] routine that frees `vctx` (may be `NULL`), see `PetscCtxDestroyFn` for the calling sequence + +Options Database Keys: +- `-ksp_converged_reason` - sets a default `KSPConvergedReasonView()` +- `-ksp_converged_reason_view_cancel` - cancels all converged reason viewers that have been hardwired into a code by +calls to `KSPConvergedReasonViewSet()`, but does not cancel those set via the options database. + +Level: intermediate + +-seealso: [](ch_ksp), `KSPConvergedReasonView()`, `KSPConvergedReasonViewFn`, `KSPConvergedReasonViewCancel()`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("KSP/KSPConvergedReasonViewSet")) +""" +function KSPConvergedReasonViewSet(petsclib::PetscLibType, ksp::PetscKSP, f::KSPConvergedReasonViewFn, vctx::Cvoid, reasonviewdestroy::PetscCtxDestroyFn) end + +@for_petsc function KSPConvergedReasonViewSet(petsclib::$UnionPetscLib, ksp::PetscKSP, f::KSPConvergedReasonViewFn, vctx::Cvoid, reasonviewdestroy::PetscCtxDestroyFn ) + + @chk ccall( + (:KSPConvergedReasonViewSet, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPConvergedReasonViewFn}, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + ksp, f, vctx, reasonviewdestroy, + ) + + + return nothing +end + +""" + KSPConvergedReasonViewCancel(petsclib::PetscLibType,ksp::PetscKSP) +Clears all the `KSPConvergedReason` view functions for a `KSP` object set with `KSPConvergedReasonViewSet()` +as well as the default viewer. + +Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPDestroy()`, `KSPReset()`, `KSPConvergedReasonViewSet()` + +# External Links +$(_doc_external("KSP/KSPConvergedReasonViewCancel")) +""" +function KSPConvergedReasonViewCancel(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPConvergedReasonViewCancel(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPConvergedReasonViewCancel, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPConvergedReasonViewFromOptions(petsclib::PetscLibType,ksp::PetscKSP) +Processes command line options to determine if/how a `KSPReason` is to be viewed. + +Collective + +Input Parameter: +- `ksp` - the `KSP` object + +Level: intermediate + +-seealso: [](ch_ksp), `KSPConvergedReasonView()`, `KSPConvergedReasonViewSet()` + +# External Links +$(_doc_external("KSP/KSPConvergedReasonViewFromOptions")) +""" +function KSPConvergedReasonViewFromOptions(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPConvergedReasonViewFromOptions(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPConvergedReasonViewFromOptions, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPConvergedRateView(petsclib::PetscLibType,ksp::PetscKSP, viewer::PetscViewer) +Displays the convergence rate of `KSPSolve()` to a viewer + +Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `viewer` - the `PetscViewer` to display the reason + +Options Database Key: +- `-ksp_converged_rate` - print reason for convergence or divergence and the convergence rate (or 0.0 for divergence) + +Level: intermediate + +-seealso: [](ch_ksp), `KSPConvergedReasonView()`, `KSPGetConvergedRate()`, `KSPSetTolerances()`, `KSPConvergedDefault()` + +# External Links +$(_doc_external("KSP/KSPConvergedRateView")) +""" +function KSPConvergedRateView(petsclib::PetscLibType, ksp::PetscKSP, viewer::PetscViewer) end + +@for_petsc function KSPConvergedRateView(petsclib::$UnionPetscLib, ksp::PetscKSP, viewer::PetscViewer ) + + @chk ccall( + (:KSPConvergedRateView, $petsc_library), + PetscErrorCode, + (CKSP, PetscViewer), + ksp, viewer, + ) + + + return nothing +end + +""" + KSPSolve(petsclib::PetscLibType,ksp::PetscKSP, b::PetscVec, x::PetscVec) +Solves a linear system associated with `KSP` object + +Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `b` - the right-hand side vector +- `x` - the solution (this may be the same vector as `b`, then `b` will be overwritten with the answer) + +Options Database Keys: +- `-ksp_view_eigenvalues` - compute preconditioned operators eigenvalues +- `-ksp_view_eigenvalues_explicit` - compute the eigenvalues by forming the dense operator and using LAPACK +- `-ksp_view_mat binary` - save matrix to the default binary viewer +- `-ksp_view_pmat binary` - save matrix used to build preconditioner to the default binary viewer +- `-ksp_view_rhs binary` - save right-hand side vector to the default binary viewer +- `-ksp_view_solution binary` - save computed solution vector to the default binary viewer +(can be read later with src/ksp/tutorials/ex10.c for testing solvers) +- `-ksp_view_mat_explicit` - for matrix-free operators, computes the matrix entries and views them +- `-ksp_view_preconditioned_operator_explicit` - computes the product of the preconditioner and matrix as an explicit matrix and views it +- `-ksp_converged_reason` - print reason for converged or diverged, also prints number of iterations +- `-ksp_view_final_residual` - print 2-norm of true linear system residual at the end of the solution process +- `-ksp_error_if_not_converged` - stop the program as soon as an error is detected in a `KSPSolve()` +- `-ksp_view_pre` - print the ksp data structure before the system solution +- `-ksp_view` - print the ksp data structure at the end of the system solution + +Level: beginner + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSetUp()`, `KSPDestroy()`, `KSPSetTolerances()`, `KSPConvergedDefault()`, +`KSPSolveTranspose()`, `KSPGetIterationNumber()`, `MatNullSpaceCreate()`, `MatSetNullSpace()`, `MatSetTransposeNullSpace()`, `KSP`, +`KSPConvergedReasonView()`, `KSPCheckSolve()`, `KSPSetErrorIfNotConverged()` + +# External Links +$(_doc_external("KSP/KSPSolve")) +""" +function KSPSolve(petsclib::PetscLibType, ksp::PetscKSP, b::Union{PetscVec,Ptr}, x::Union{PetscVec,Ptr}) end + +@for_petsc function KSPSolve(petsclib::$UnionPetscLib, ksp::PetscKSP, b::Union{PetscVec,Ptr}, x::Union{PetscVec,Ptr} ) + + @chk ccall( + (:KSPSolve, $petsc_library), + PetscErrorCode, + (CKSP, CVec, CVec), + ksp, b, x, + ) + + + return nothing +end + +""" + KSPSolveTranspose(petsclib::PetscLibType,ksp::PetscKSP, b::PetscVec, x::PetscVec) +Solves a linear system with the transpose of the matrix associated with the `KSP` object, A^T x = b. + +Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `b` - right-hand side vector +- `x` - solution vector + +Level: developer + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSetUp()`, `KSPDestroy()`, `KSPSetTolerances()`, `KSPConvergedDefault()`, +`KSPSolve()`, `KSP`, `KSPSetOperators()` + +# External Links +$(_doc_external("KSP/KSPSolveTranspose")) +""" +function KSPSolveTranspose(petsclib::PetscLibType, ksp::PetscKSP, b::PetscVec, x::PetscVec) end + +@for_petsc function KSPSolveTranspose(petsclib::$UnionPetscLib, ksp::PetscKSP, b::PetscVec, x::PetscVec ) + + @chk ccall( + (:KSPSolveTranspose, $petsc_library), + PetscErrorCode, + (CKSP, CVec, CVec), + ksp, b, x, + ) + + + return nothing +end + +""" + KSPMatSolve(petsclib::PetscLibType,ksp::PetscKSP, B::PetscMat, X::PetscMat) +Solves a linear system with multiple right + +Input Parameters: +- `ksp` - iterative solver +- `B` - block of right-hand sides + +Output Parameter: +- `X` - block of solutions + +Level: intermediate + +-seealso: [](ch_ksp), `KSPSolve()`, `MatMatSolve()`, `KSPMatSolveTranspose()`, `MATDENSE`, `KSPHPDDM`, `PCBJACOBI`, `PCASM`, `KSPSetMatSolveBatchSize()` + +# External Links +$(_doc_external("KSP/KSPMatSolve")) +""" +function KSPMatSolve(petsclib::PetscLibType, ksp::PetscKSP, B::PetscMat, X::PetscMat) end + +@for_petsc function KSPMatSolve(petsclib::$UnionPetscLib, ksp::PetscKSP, B::PetscMat, X::PetscMat ) + + @chk ccall( + (:KSPMatSolve, $petsc_library), + PetscErrorCode, + (CKSP, CMat, CMat), + ksp, B, X, + ) + + + return nothing +end + +""" + KSPMatSolveTranspose(petsclib::PetscLibType,ksp::PetscKSP, B::PetscMat, X::PetscMat) +Solves a linear system with the transposed matrix with multiple right + +Input Parameters: +- `ksp` - iterative solver +- `B` - block of right-hand sides + +Output Parameter: +- `X` - block of solutions + +Level: intermediate + +-seealso: [](ch_ksp), `KSPSolveTranspose()`, `MatMatTransposeSolve()`, `KSPMatSolve()`, `MATDENSE`, `KSPHPDDM`, `PCBJACOBI`, `PCASM` + +# External Links +$(_doc_external("KSP/KSPMatSolveTranspose")) +""" +function KSPMatSolveTranspose(petsclib::PetscLibType, ksp::PetscKSP, B::PetscMat, X::PetscMat) end + +@for_petsc function KSPMatSolveTranspose(petsclib::$UnionPetscLib, ksp::PetscKSP, B::PetscMat, X::PetscMat ) + + @chk ccall( + (:KSPMatSolveTranspose, $petsc_library), + PetscErrorCode, + (CKSP, CMat, CMat), + ksp, B, X, + ) + + + return nothing +end + +""" + KSPSetMatSolveBatchSize(petsclib::PetscLibType,ksp::PetscKSP, bs::PetscInt) +Sets the maximum number of columns treated simultaneously in `KSPMatSolve()`. + +Logically Collective + +Input Parameters: +- `ksp` - the `KSP` iterative solver +- `bs` - batch size + +Level: advanced + +-seealso: [](ch_ksp), `KSPMatSolve()`, `KSPGetMatSolveBatchSize()`, `-mat_mumps_icntl_27`, `-matmatmult_Bbn` + +# External Links +$(_doc_external("KSP/KSPSetMatSolveBatchSize")) +""" +function KSPSetMatSolveBatchSize(petsclib::PetscLibType, ksp::PetscKSP, bs::PetscInt) end + +@for_petsc function KSPSetMatSolveBatchSize(petsclib::$UnionPetscLib, ksp::PetscKSP, bs::$PetscInt ) + + @chk ccall( + (:KSPSetMatSolveBatchSize, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, bs, + ) + + + return nothing +end + +""" + bs::PetscInt = KSPGetMatSolveBatchSize(petsclib::PetscLibType,ksp::PetscKSP) +Gets the maximum number of columns treated simultaneously in `KSPMatSolve()`. + +Input Parameter: +- `ksp` - iterative solver context + +Output Parameter: +- `bs` - batch size + +Level: advanced + +-seealso: [](ch_ksp), `KSPMatSolve()`, `KSPSetMatSolveBatchSize()`, `-mat_mumps_icntl_27`, `-matmatmult_Bbn` + +# External Links +$(_doc_external("KSP/KSPGetMatSolveBatchSize")) +""" +function KSPGetMatSolveBatchSize(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetMatSolveBatchSize(petsclib::$UnionPetscLib, ksp::PetscKSP ) + bs_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPGetMatSolveBatchSize, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, bs_, + ) + + bs = bs_[] + + return bs +end + +""" + KSPResetViewers(petsclib::PetscLibType,ksp::PetscKSP) +Resets all the viewers set from the options database during `KSPSetFromOptions()` + +Collective + +Input Parameter: +- `ksp` - the `KSP` iterative solver context obtained from `KSPCreate()` + +Level: beginner + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSetUp()`, `KSPSolve()`, `KSPSetFromOptions()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPResetViewers")) +""" +function KSPResetViewers(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPResetViewers(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPResetViewers, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPReset(petsclib::PetscLibType,ksp::PetscKSP) +Removes any allocated `Vec` and `Mat` from the `KSP` data structures. + +Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSetUp()`, `KSPSolve()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPReset")) +""" +function KSPReset(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPReset(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPReset, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPDestroy(petsclib::PetscLibType,ksp::PetscKSP) +Destroys a `KSP` context. + +Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Level: beginner + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSetUp()`, `KSPSolve()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPDestroy")) +""" +function KSPDestroy(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPDestroy(petsclib::$UnionPetscLib, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:KSPDestroy, $petsc_library), + PetscErrorCode, + (Ptr{CKSP},), + ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + KSPSetPCSide(petsclib::PetscLibType,ksp::PetscKSP, side::PCSide) +Sets the preconditioning side. + +Logically Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `side` - the preconditioning side, where side is one of +-seealso: [](ch_ksp), `KSPGetPCSide()`, `KSPSetNormType()`, `KSPGetNormType()`, `KSP`, `KSPSetPreSolve()`, `KSPSetPostSolve()` + +# External Links +$(_doc_external("KSP/KSPSetPCSide")) +""" +function KSPSetPCSide(petsclib::PetscLibType, ksp::PetscKSP, side::PCSide) end + +@for_petsc function KSPSetPCSide(petsclib::$UnionPetscLib, ksp::PetscKSP, side::PCSide ) + + @chk ccall( + (:KSPSetPCSide, $petsc_library), + PetscErrorCode, + (CKSP, PCSide), + ksp, side, + ) + + + return nothing +end + +""" + KSPGetPCSide(petsclib::PetscLibType,ksp::PetscKSP, side::PCSide) +Gets the preconditioning side. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `side` - the preconditioning side, where side is one of +-seealso: [](ch_ksp), `KSPSetPCSide()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetPCSide")) +""" +function KSPGetPCSide(petsclib::PetscLibType, ksp::PetscKSP, side::PCSide) end + +@for_petsc function KSPGetPCSide(petsclib::$UnionPetscLib, ksp::PetscKSP, side::PCSide ) + + @chk ccall( + (:KSPGetPCSide, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PCSide}), + ksp, side, + ) + + + return nothing +end + +""" + rtol::PetscReal,abstol::PetscReal,dtol::PetscReal,maxits::PetscInt = KSPGetTolerances(petsclib::PetscLibType,ksp::PetscKSP) +Gets the relative, absolute, divergence, and maximum +iteration tolerances used by the default `KSP` convergence tests. + +Not Collective + +Input Parameter: +- `ksp` - the Krylov subspace context + +Output Parameters: +- `rtol` - the relative convergence tolerance +- `abstol` - the absolute convergence tolerance +- `dtol` - the divergence tolerance +- `maxits` - maximum number of iterations + +Level: intermediate + +-seealso: [](ch_ksp), `KSPSetTolerances()`, `KSP`, `KSPSetMinimumIterations()`, `KSPGetMinimumIterations()` + +# External Links +$(_doc_external("KSP/KSPGetTolerances")) +""" +function KSPGetTolerances(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetTolerances(petsclib::$UnionPetscLib, ksp::PetscKSP ) + rtol_ = Ref{$PetscReal}() + abstol_ = Ref{$PetscReal}() + dtol_ = Ref{$PetscReal}() + maxits_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPGetTolerances, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscInt}), + ksp, rtol_, abstol_, dtol_, maxits_, + ) + + rtol = rtol_[] + abstol = abstol_[] + dtol = dtol_[] + maxits = maxits_[] + + return rtol,abstol,dtol,maxits +end + +""" + KSPSetTolerances(petsclib::PetscLibType,ksp::PetscKSP, rtol::PetscReal, abstol::PetscReal, dtol::PetscReal, maxits::PetscInt) +Sets the relative, absolute, divergence, and maximum +iteration tolerances used by the default `KSP` convergence testers. + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov subspace context +- `rtol` - the relative convergence tolerance, relative decrease in the (possibly preconditioned) residual norm +- `abstol` - the absolute convergence tolerance absolute size of the (possibly preconditioned) residual norm +- `dtol` - the divergence tolerance, amount (possibly preconditioned) residual norm can increase before `KSPConvergedDefault()` concludes that the method is diverging +- `maxits` - maximum number of iterations to use + +Options Database Keys: +- `-ksp_atol ` - Sets `abstol` +- `-ksp_rtol ` - Sets `rtol` +- `-ksp_divtol ` - Sets `dtol` +- `-ksp_max_it ` - Sets `maxits` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGetTolerances()`, `KSPConvergedDefault()`, `KSPSetConvergenceTest()`, `KSP`, `KSPSetMinimumIterations()` + +# External Links +$(_doc_external("KSP/KSPSetTolerances")) +""" +function KSPSetTolerances(petsclib::PetscLibType, ksp::PetscKSP, rtol::PetscReal, abstol::PetscReal, dtol::PetscReal, maxits::PetscInt) end + +@for_petsc function KSPSetTolerances(petsclib::$UnionPetscLib, ksp::PetscKSP, rtol::$PetscReal, abstol::$PetscReal, dtol::$PetscReal, maxits::$PetscInt ) + + @chk ccall( + (:KSPSetTolerances, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal, $PetscReal, $PetscReal, $PetscInt), + ksp, rtol, abstol, dtol, maxits, + ) + + + return nothing +end + +""" + KSPSetMinimumIterations(petsclib::PetscLibType,ksp::PetscKSP, minit::PetscInt) +Sets the minimum number of iterations to use, regardless of the tolerances + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov subspace context +- `minit` - minimum number of iterations to use + +Options Database Key: +- `-ksp_min_it ` - Sets `minit` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGetTolerances()`, `KSPConvergedDefault()`, `KSPSetConvergenceTest()`, `KSP`, `KSPSetTolerances()`, `KSPGetMinimumIterations()` + +# External Links +$(_doc_external("KSP/KSPSetMinimumIterations")) +""" +function KSPSetMinimumIterations(petsclib::PetscLibType, ksp::PetscKSP, minit::PetscInt) end + +@for_petsc function KSPSetMinimumIterations(petsclib::$UnionPetscLib, ksp::PetscKSP, minit::$PetscInt ) + + @chk ccall( + (:KSPSetMinimumIterations, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, minit, + ) + + + return nothing +end + +""" + minit::PetscInt = KSPGetMinimumIterations(petsclib::PetscLibType,ksp::PetscKSP) +Gets the minimum number of iterations to use, regardless of the tolerances, that was set with `KSPSetMinimumIterations()` or ` + +Not Collective + +Input Parameter: +- `ksp` - the Krylov subspace context + +Output Parameter: +- `minit` - minimum number of iterations to use + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGetTolerances()`, `KSPConvergedDefault()`, `KSPSetConvergenceTest()`, `KSP`, `KSPSetTolerances()`, `KSPSetMinimumIterations()` + +# External Links +$(_doc_external("KSP/KSPGetMinimumIterations")) +""" +function KSPGetMinimumIterations(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetMinimumIterations(petsclib::$UnionPetscLib, ksp::PetscKSP ) + minit_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPGetMinimumIterations, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, minit_, + ) + + minit = minit_[] + + return minit +end + +""" + KSPSetInitialGuessNonzero(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Tells the iterative solver that the +initial guess is nonzero; otherwise `KSP` assumes the initial guess +is to be zero (and thus zeros it out before solving). + +Logically Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `flg` - `PETSC_TRUE` indicates the guess is non-zero, `PETSC_FALSE` indicates the guess is zero + +Options Database Key: +- `-ksp_initial_guess_nonzero ` - use nonzero initial guess + +Level: beginner + +-seealso: [](ch_ksp), `KSPGetInitialGuessNonzero()`, `KSPGuessSetType()`, `KSPGuessType`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetInitialGuessNonzero")) +""" +function KSPSetInitialGuessNonzero(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPSetInitialGuessNonzero(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPSetInitialGuessNonzero, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + flag::PetscBool = KSPGetInitialGuessNonzero(petsclib::PetscLibType,ksp::PetscKSP) +Determines whether the `KSP` solver is using +a zero initial guess. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `flag` - `PETSC_TRUE` if guess is nonzero, else `PETSC_FALSE` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPSetInitialGuessNonzero()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetInitialGuessNonzero")) +""" +function KSPGetInitialGuessNonzero(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetInitialGuessNonzero(petsclib::$UnionPetscLib, ksp::PetscKSP ) + flag_ = Ref{PetscBool}() + + @chk ccall( + (:KSPGetInitialGuessNonzero, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, flag_, + ) + + flag = flag_[] + + return flag +end + +""" + KSPSetErrorIfNotConverged(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Causes `KSPSolve()` to generate an error if the solver has not converged as soon as the error is detected. + +Logically Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `flg` - `PETSC_TRUE` indicates you want the error generated + +Options Database Key: +- `-ksp_error_if_not_converged ` - generate an error and stop the program + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGetErrorIfNotConverged()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetErrorIfNotConverged")) +""" +function KSPSetErrorIfNotConverged(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPSetErrorIfNotConverged(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPSetErrorIfNotConverged, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + flag::PetscBool = KSPGetErrorIfNotConverged(petsclib::PetscLibType,ksp::PetscKSP) +Will `KSPSolve()` generate an error if the solver does not converge? + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from KSPCreate() + +Output Parameter: +- `flag` - `PETSC_TRUE` if it will generate an error, else `PETSC_FALSE` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPSetErrorIfNotConverged()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetErrorIfNotConverged")) +""" +function KSPGetErrorIfNotConverged(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetErrorIfNotConverged(petsclib::$UnionPetscLib, ksp::PetscKSP ) + flag_ = Ref{PetscBool}() + + @chk ccall( + (:KSPGetErrorIfNotConverged, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, flag_, + ) + + flag = flag_[] + + return flag +end + +""" + KSPSetInitialGuessKnoll(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Tells the iterative solver to use `PCApply()` on the right hand side vector to compute the initial guess (The Knoll trick) + +Logically Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `flg` - `PETSC_TRUE` or `PETSC_FALSE` + +Level: advanced + +-seealso: [](ch_ksp), `KSPGetInitialGuessKnoll()`, `KSPGuess`, `KSPSetInitialGuessNonzero()`, `KSPGetInitialGuessNonzero()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetInitialGuessKnoll")) +""" +function KSPSetInitialGuessKnoll(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPSetInitialGuessKnoll(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPSetInitialGuessKnoll, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + flag::PetscBool = KSPGetInitialGuessKnoll(petsclib::PetscLibType,ksp::PetscKSP) +Determines whether the `KSP` solver is using the Knoll trick (using PCApply(pc,b,...) to compute +the initial guess + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `flag` - `PETSC_TRUE` if using Knoll trick, else `PETSC_FALSE` + +Level: advanced + +-seealso: [](ch_ksp), `KSPSetInitialGuessKnoll()`, `KSPSetInitialGuessNonzero()`, `KSPGetInitialGuessNonzero()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetInitialGuessKnoll")) +""" +function KSPGetInitialGuessKnoll(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetInitialGuessKnoll(petsclib::$UnionPetscLib, ksp::PetscKSP ) + flag_ = Ref{PetscBool}() + + @chk ccall( + (:KSPGetInitialGuessKnoll, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, flag_, + ) + + flag = flag_[] + + return flag +end + +""" + flg::PetscBool = KSPGetComputeSingularValues(petsclib::PetscLibType,ksp::PetscKSP) +Gets the flag indicating whether the extreme singular +values will be calculated via a Lanczos or Arnoldi process as the linear +system is solved. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `flg` - `PETSC_TRUE` or `PETSC_FALSE` + +Options Database Key: +- `-ksp_monitor_singular_value` - Activates `KSPSetComputeSingularValues()` + +Level: advanced + +-seealso: [](ch_ksp), `KSPComputeExtremeSingularValues()`, `KSPMonitorSingularValue()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetComputeSingularValues")) +""" +function KSPGetComputeSingularValues(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetComputeSingularValues(petsclib::$UnionPetscLib, ksp::PetscKSP ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:KSPGetComputeSingularValues, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + KSPSetComputeSingularValues(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Sets a flag so that the extreme singular +values will be calculated via a Lanczos or Arnoldi process as the linear +system is solved. + +Logically Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `flg` - `PETSC_TRUE` or `PETSC_FALSE` + +Options Database Key: +- `-ksp_monitor_singular_value` - Activates `KSPSetComputeSingularValues()` + +Level: advanced + +-seealso: [](ch_ksp), `KSPComputeExtremeSingularValues()`, `KSPMonitorSingularValue()`, `KSP`, `KSPSetComputeRitz()` + +# External Links +$(_doc_external("KSP/KSPSetComputeSingularValues")) +""" +function KSPSetComputeSingularValues(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPSetComputeSingularValues(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPSetComputeSingularValues, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = KSPGetComputeEigenvalues(petsclib::PetscLibType,ksp::PetscKSP) +Gets the flag indicating that the extreme eigenvalues +values will be calculated via a Lanczos or Arnoldi process as the linear +system is solved. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `flg` - `PETSC_TRUE` or `PETSC_FALSE` + +Level: advanced + +-seealso: [](ch_ksp), `KSPComputeEigenvalues()`, `KSPComputeEigenvaluesExplicitly()`, `KSP`, `KSPSetComputeRitz()` + +# External Links +$(_doc_external("KSP/KSPGetComputeEigenvalues")) +""" +function KSPGetComputeEigenvalues(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetComputeEigenvalues(petsclib::$UnionPetscLib, ksp::PetscKSP ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:KSPGetComputeEigenvalues, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + KSPSetComputeEigenvalues(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Sets a flag so that the extreme eigenvalues +values will be calculated via a Lanczos or Arnoldi process as the linear +system is solved. + +Logically Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `flg` - `PETSC_TRUE` or `PETSC_FALSE` + +Level: advanced + +-seealso: [](ch_ksp), `KSPComputeEigenvalues()`, `KSPComputeEigenvaluesExplicitly()`, `KSP`, `KSPSetComputeRitz()` + +# External Links +$(_doc_external("KSP/KSPSetComputeEigenvalues")) +""" +function KSPSetComputeEigenvalues(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPSetComputeEigenvalues(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPSetComputeEigenvalues, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + KSPSetComputeRitz(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Sets a flag so that the Ritz or harmonic Ritz pairs +will be calculated via a Lanczos or Arnoldi process as the linear +system is solved. + +Logically Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `flg` - `PETSC_TRUE` or `PETSC_FALSE` + +Level: advanced + +-seealso: [](ch_ksp), `KSPComputeRitz()`, `KSP`, `KSPComputeEigenvalues()`, `KSPComputeExtremeSingularValues()` + +# External Links +$(_doc_external("KSP/KSPSetComputeRitz")) +""" +function KSPSetComputeRitz(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPSetComputeRitz(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPSetComputeRitz, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + r::PetscVec = KSPGetRhs(petsclib::PetscLibType,ksp::PetscKSP) +Gets the right +be solved. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `r` - right-hand-side vector + +Level: developer + +-seealso: [](ch_ksp), `KSPGetSolution()`, `KSPSolve()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetRhs")) +""" +function KSPGetRhs(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetRhs(petsclib::$UnionPetscLib, ksp::PetscKSP) + r_ = Ref{CVec}() + + @chk ccall( + (:KSPGetRhs, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{CVec}), + ksp, r_, + ) + + return PetscVec(r_[], petsclib) +end + +""" + v::PetscVec = KSPGetSolution(petsclib::PetscLibType,ksp::PetscKSP) +Gets the location of the solution for the linear system to be solved. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Return Value: +- `v` - solution vector + +Level: developer + +-seealso: [](ch_ksp), `KSPGetRhs()`, `KSPBuildSolution()`, `KSPSolve()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetSolution")) +""" +function KSPGetSolution(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetSolution(petsclib::$UnionPetscLib, ksp::PetscKSP ) + v_ = Ref{CVec}() + + @chk ccall( + (:KSPGetSolution, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{CVec}), + ksp, v_, + ) + + v = PetscVec(v_[], petsclib) + return v +end + +""" + KSPSetPC(petsclib::PetscLibType,ksp::PetscKSP, pc::PC) +Sets the preconditioner to be used to calculate the +application of the preconditioner on a vector into a `KSP`. + +Collective + +Input Parameters: +- `ksp` - the `KSP` iterative solver obtained from `KSPCreate()` +- `pc` - the preconditioner object (if `NULL` it returns the `PC` currently held by the `KSP`) + +Level: developer + +-seealso: [](ch_ksp), `KSPGetPC()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetPC")) +""" +function KSPSetPC(petsclib::PetscLibType, ksp::PetscKSP, pc::PC) end + +@for_petsc function KSPSetPC(petsclib::$UnionPetscLib, ksp::PetscKSP, pc::PC ) + + @chk ccall( + (:KSPSetPC, $petsc_library), + PetscErrorCode, + (CKSP, PC), + ksp, pc, + ) + + + return nothing +end + +""" + KSPGetPC(petsclib::PetscLibType,ksp::PetscKSP, pc::PC) +Returns a pointer to the preconditioner context with the `KSP` + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `pc` - preconditioner context + +Level: beginner + +-seealso: [](ch_ksp), `KSPSetPC()`, `KSP`, `PC` + +# External Links +$(_doc_external("KSP/KSPGetPC")) +""" +function KSPGetPC(petsclib::PetscLibType, ksp::PetscKSP, pc::PC) end + +@for_petsc function KSPGetPC(petsclib::$UnionPetscLib, ksp::PetscKSP, pc::PC ) + + @chk ccall( + (:KSPGetPC, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PC}), + ksp, pc, + ) + + + return nothing +end + +""" + KSPMonitor(petsclib::PetscLibType,ksp::PetscKSP, it::PetscInt, rnorm::PetscReal) +runs the user provided monitor routines, if they exist + +Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `it` - iteration number +- `rnorm` - relative norm of the residual + +Level: developer + +-seealso: [](ch_ksp), `KSPMonitorSet()` + +# External Links +$(_doc_external("KSP/KSPMonitor")) +""" +function KSPMonitor(petsclib::PetscLibType, ksp::PetscKSP, it::PetscInt, rnorm::PetscReal) end + +@for_petsc function KSPMonitor(petsclib::$UnionPetscLib, ksp::PetscKSP, it::$PetscInt, rnorm::$PetscReal ) + + @chk ccall( + (:KSPMonitor, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal), + ksp, it, rnorm, + ) + + + return nothing +end + +""" + KSPMonitorSet(petsclib::PetscLibType,ksp::PetscKSP, monitor::KSPMonitorFn, ctx::Cvoid, monitordestroy::PetscCtxDestroyFn) +Sets an ADDITIONAL function to be called at every iteration to monitor, i.e. display in some way, perhaps by printing in the terminal, +the residual norm computed in a `KSPSolve()` + +Logically Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `monitor` - pointer to function (if this is `NULL`, it turns off monitoring, see `KSPMonitorFn` +- `ctx` - [optional] context for private data for the monitor routine (use `NULL` if no context is needed) +- `monitordestroy` - [optional] routine that frees monitor context (may be `NULL`), see `PetscCtxDestroyFn` for the calling sequence + +Options Database Keys: +- `-ksp_monitor` - sets `KSPMonitorResidual()` +- `-ksp_monitor hdf5:filename` - sets `KSPMonitorResidualView()` and saves residual +- `-ksp_monitor draw` - sets `KSPMonitorResidualView()` and plots residual +- `-ksp_monitor draw::draw_lg` - sets `KSPMonitorResidualDrawLG()` and plots residual +- `-ksp_monitor_pause_final` - Pauses any graphics when the solve finishes (only works for internal monitors) +- `-ksp_monitor_true_residual` - sets `KSPMonitorTrueResidual()` +- `-ksp_monitor_true_residual draw::draw_lg` - sets `KSPMonitorTrueResidualDrawLG()` and plots residual +- `-ksp_monitor_max` - sets `KSPMonitorTrueResidualMax()` +- `-ksp_monitor_singular_value` - sets `KSPMonitorSingularValue()` +- `-ksp_monitor_cancel` - cancels all monitors that have been hardwired into a code by calls to `KSPMonitorSet()`, but +does not cancel those set via the options database. + +Level: beginner + +-seealso: [](ch_ksp), `KSPMonitorResidual()`, `KSPMonitorRegister()`, `KSPMonitorCancel()`, `KSP`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("KSP/KSPMonitorSet")) +""" +function KSPMonitorSet(petsclib::PetscLibType, ksp::PetscKSP, monitor::KSPMonitorFn, ctx::Cvoid, monitordestroy::PetscCtxDestroyFn) end + +@for_petsc function KSPMonitorSet(petsclib::$UnionPetscLib, ksp::PetscKSP, monitor::KSPMonitorFn, ctx::Cvoid, monitordestroy::PetscCtxDestroyFn ) + + @chk ccall( + (:KSPMonitorSet, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPMonitorFn}, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + ksp, monitor, ctx, monitordestroy, + ) + + + return nothing +end + +""" + KSPMonitorCancel(petsclib::PetscLibType,ksp::PetscKSP) +Clears all monitors for a `KSP` object. + +Logically Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Options Database Key: +- `-ksp_monitor_cancel` - Cancels all monitors that have been hardwired into a code by calls to `KSPMonitorSet()`, but does not cancel those set via the options database. + +Level: intermediate + +-seealso: [](ch_ksp), `KSPMonitorResidual()`, `KSPMonitorSet()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPMonitorCancel")) +""" +function KSPMonitorCancel(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPMonitorCancel(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPMonitorCancel, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPGetMonitorContext(petsclib::PetscLibType,ksp::PetscKSP, ctx::Cvoid) +Gets the monitoring context, as set by `KSPMonitorSet()` for the FIRST monitor only. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `ctx` - monitoring context + +Level: intermediate + +-seealso: [](ch_ksp), `KSPMonitorResidual()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetMonitorContext")) +""" +function KSPGetMonitorContext(petsclib::PetscLibType, ksp::PetscKSP, ctx::Cvoid) end + +@for_petsc function KSPGetMonitorContext(petsclib::$UnionPetscLib, ksp::PetscKSP, ctx::Cvoid ) + + @chk ccall( + (:KSPGetMonitorContext, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Cvoid}), + ksp, ctx, + ) + + + return nothing +end + +""" + KSPSetResidualHistory(petsclib::PetscLibType,ksp::PetscKSP, a::Vector{PetscReal}, na::PetscCount, reset::PetscBool) +Sets the array used to hold the residual history. +If set, this array will contain the residual norms computed at each +iteration of the solver. + +Not Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `a` - array to hold history +- `na` - size of `a` +- `reset` - `PETSC_TRUE` indicates the history counter is reset to zero +for each new linear solve + +Level: advanced + +-seealso: [](ch_ksp), `KSPGetResidualHistory()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetResidualHistory")) +""" +function KSPSetResidualHistory(petsclib::PetscLibType, ksp::PetscKSP, a::Vector{PetscReal}, na::PetscCount, reset::PetscBool) end + +@for_petsc function KSPSetResidualHistory(petsclib::$UnionPetscLib, ksp::PetscKSP, a::Vector{$PetscReal}, na::PetscCount, reset::PetscBool ) + + @chk ccall( + (:KSPSetResidualHistory, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}, PetscCount, PetscBool), + ksp, a, na, reset, + ) + + + return nothing +end + +""" + a::Vector{PetscReal},na::PetscInt = KSPGetResidualHistory(petsclib::PetscLibType,ksp::PetscKSP) +Gets the array used to hold the residual history and the number of residuals it contains. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameters: +- `a` - pointer to array to hold history (or `NULL`) +- `na` - number of used entries in a (or `NULL`). Note this has different meanings depending on the `reset` argument to `KSPSetResidualHistory()` + +Level: advanced + +-seealso: [](ch_ksp), `KSPSetResidualHistory()`, `KSP`, `KSPGetIterationNumber()`, `KSPSTCG`, `KSPBCGSL` + +# External Links +$(_doc_external("KSP/KSPGetResidualHistory")) +""" +function KSPGetResidualHistory(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetResidualHistory(petsclib::$UnionPetscLib, ksp::PetscKSP ) + a_ = Ref{Ptr{$PetscReal}}() + na_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPGetResidualHistory, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Ptr{$PetscReal}}, Ptr{$PetscInt}), + ksp, a_, na_, + ) + + a = unsafe_wrap(Array, a_[], VecGetLocalSize(petsclib, x); own = false) + na = na_[] + + return a,na +end + +""" + KSPSetErrorHistory(petsclib::PetscLibType,ksp::PetscKSP, a::Vector{PetscReal}, na::PetscCount, reset::PetscBool) +Sets the array used to hold the error history. If set, this array will contain the error norms computed at each iteration of the solver. + +Not Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `a` - array to hold history +- `na` - size of `a` +- `reset` - `PETSC_TRUE` indicates the history counter is reset to zero for each new linear solve + +Level: advanced + +-seealso: [](ch_ksp), `KSPGetErrorHistory()`, `KSPSetResidualHistory()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetErrorHistory")) +""" +function KSPSetErrorHistory(petsclib::PetscLibType, ksp::PetscKSP, a::Vector{PetscReal}, na::PetscCount, reset::PetscBool) end + +@for_petsc function KSPSetErrorHistory(petsclib::$UnionPetscLib, ksp::PetscKSP, a::Vector{$PetscReal}, na::PetscCount, reset::PetscBool ) + + @chk ccall( + (:KSPSetErrorHistory, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}, PetscCount, PetscBool), + ksp, a, na, reset, + ) + + + return nothing +end + +""" + a::Vector{PetscReal},na::PetscInt = KSPGetErrorHistory(petsclib::PetscLibType,ksp::PetscKSP) +Gets the array used to hold the error history and the number of residuals it contains. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameters: +- `a` - pointer to array to hold history (or `NULL`) +- `na` - number of used entries in a (or `NULL`) + +Level: advanced + +-seealso: [](ch_ksp), `KSPSetErrorHistory()`, `KSPGetResidualHistory()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetErrorHistory")) +""" +function KSPGetErrorHistory(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetErrorHistory(petsclib::$UnionPetscLib, ksp::PetscKSP ) + a_ = Ref{Ptr{$PetscReal}}() + na_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPGetErrorHistory, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Ptr{$PetscReal}}, Ptr{$PetscInt}), + ksp, a_, na_, + ) + + a = unsafe_wrap(Array, a_[], VecGetLocalSize(petsclib, x); own = false) + na = na_[] + + return a,na +end + +""" + cr::PetscReal,rRsq::PetscReal,ce::PetscReal,eRsq::PetscReal = KSPComputeConvergenceRate(petsclib::PetscLibType,ksp::PetscKSP) +Compute the convergence rate for the iteration + +Not Collective + +Input Parameter: +- `ksp` - The `KSP` + +Output Parameters: +- `cr` - The residual contraction rate +- `rRsq` - The coefficient of determination, R^2, indicating the linearity of the data +- `ce` - The error contraction rate +- `eRsq` - The coefficient of determination, R^2, indicating the linearity of the data + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPConvergedRateView()` + +# External Links +$(_doc_external("KSP/KSPComputeConvergenceRate")) +""" +function KSPComputeConvergenceRate(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPComputeConvergenceRate(petsclib::$UnionPetscLib, ksp::PetscKSP ) + cr_ = Ref{$PetscReal}() + rRsq_ = Ref{$PetscReal}() + ce_ = Ref{$PetscReal}() + eRsq_ = Ref{$PetscReal}() + + @chk ccall( + (:KSPComputeConvergenceRate, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + ksp, cr_, rRsq_, ce_, eRsq_, + ) + + cr = cr_[] + rRsq = rRsq_[] + ce = ce_[] + eRsq = eRsq_[] + + return cr,rRsq,ce,eRsq +end + +""" + KSPSetConvergenceTest(petsclib::PetscLibType,ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) +Sets the function to be used to determine convergence of `KSPSolve()` + +Logically Collective + +Input Parameters: +- `ksp` - iterative solver obtained from `KSPCreate()` +- `converge` - pointer to the function, see `KSPConvergenceTestFn` +- `ctx` - context for private data for the convergence routine (may be `NULL`) +- `destroy` - a routine for destroying the context (may be `NULL`) + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPConvergenceTestFn`, `KSPConvergedDefault()`, `KSPGetConvergenceContext()`, `KSPSetTolerances()`, `KSPGetConvergenceTest()`, `KSPGetAndClearConvergenceTest()` + +# External Links +$(_doc_external("KSP/KSPSetConvergenceTest")) +""" +function KSPSetConvergenceTest(petsclib::PetscLibType, ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) end + +@for_petsc function KSPSetConvergenceTest(petsclib::$UnionPetscLib, ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn ) + + @chk ccall( + (:KSPSetConvergenceTest, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPConvergenceTestFn}, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + ksp, converge, ctx, destroy, + ) + + + return nothing +end + +""" + KSPGetConvergenceTest(petsclib::PetscLibType,ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) +Gets the function to be used to determine convergence. + +Logically Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameters: +- `converge` - pointer to convergence test function, see `KSPConvergenceTestFn` +- `ctx` - context for private data for the convergence routine (may be `NULL`) +- `destroy` - a routine for destroying the context (may be `NULL`) + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPConvergedDefault()`, `KSPGetConvergenceContext()`, `KSPSetTolerances()`, `KSPSetConvergenceTest()`, `KSPGetAndClearConvergenceTest()` + +# External Links +$(_doc_external("KSP/KSPGetConvergenceTest")) +""" +function KSPGetConvergenceTest(petsclib::PetscLibType, ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) end + +@for_petsc function KSPGetConvergenceTest(petsclib::$UnionPetscLib, ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn ) + + @chk ccall( + (:KSPGetConvergenceTest, $petsc_library), + PetscErrorCode, + (CKSP, KSPConvergenceTestFn, Cvoid, PetscCtxDestroyFn), + ksp, converge, ctx, destroy, + ) + + + return nothing +end + +""" + KSPGetAndClearConvergenceTest(petsclib::PetscLibType,ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) +Gets the function to be used to determine convergence. Removes the current test without calling destroy on the test context + +Logically Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameters: +- `converge` - pointer to convergence test function, see `KSPConvergenceTestFn` +- `ctx` - context for private data for the convergence routine +- `destroy` - a routine for destroying the context + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPConvergedDefault()`, `KSPGetConvergenceContext()`, `KSPSetTolerances()`, `KSPSetConvergenceTest()`, `KSPGetConvergenceTest()` + +# External Links +$(_doc_external("KSP/KSPGetAndClearConvergenceTest")) +""" +function KSPGetAndClearConvergenceTest(petsclib::PetscLibType, ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) end + +@for_petsc function KSPGetAndClearConvergenceTest(petsclib::$UnionPetscLib, ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn ) + + @chk ccall( + (:KSPGetAndClearConvergenceTest, $petsc_library), + PetscErrorCode, + (CKSP, KSPConvergenceTestFn, Cvoid, PetscCtxDestroyFn), + ksp, converge, ctx, destroy, + ) + + + return nothing +end + +""" + KSPGetConvergenceContext(petsclib::PetscLibType,ksp::PetscKSP, ctx::Cvoid) +Gets the convergence context set with `KSPSetConvergenceTest()`. + +Not Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +- `ctx` - monitoring context + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPConvergedDefault()`, `KSPSetConvergenceTest()`, `KSPGetConvergenceTest()` + +# External Links +$(_doc_external("KSP/KSPGetConvergenceContext")) +""" +function KSPGetConvergenceContext(petsclib::PetscLibType, ksp::PetscKSP, ctx::Cvoid) end + +@for_petsc function KSPGetConvergenceContext(petsclib::$UnionPetscLib, ksp::PetscKSP, ctx::Cvoid ) + + @chk ccall( + (:KSPGetConvergenceContext, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Cvoid}), + ksp, ctx, + ) + + + return nothing +end + +""" + KSPBuildSolution(petsclib::PetscLibType,ksp::PetscKSP, v::PetscVec, V::PetscVec) +Builds the approximate solution in a vector provided. + +Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameter: +Provide exactly one of +- `v` - location to stash solution, optional, otherwise pass `NULL` +- `V` - the solution is returned in this location. This vector is created internally. This vector should NOT be destroyed by the user with `VecDestroy()`. + +Level: developer + +-seealso: [](ch_ksp), `KSPGetSolution()`, `KSPBuildResidual()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPBuildSolution")) +""" +function KSPBuildSolution(petsclib::PetscLibType, ksp::PetscKSP, v::PetscVec, V::PetscVec) end + +@for_petsc function KSPBuildSolution(petsclib::$UnionPetscLib, ksp::PetscKSP, v::PetscVec, V::PetscVec ) + V_ = Ref(V.ptr) + + @chk ccall( + (:KSPBuildSolution, $petsc_library), + PetscErrorCode, + (CKSP, CVec, Ptr{CVec}), + ksp, v, V_, + ) + + V.ptr = C_NULL + + return nothing +end + +""" + KSPBuildResidual(petsclib::PetscLibType,ksp::PetscKSP, t::PetscVec, v::PetscVec, V::PetscVec) +Builds the residual in a vector provided. + +Collective + +Input Parameter: +- `ksp` - iterative solver obtained from `KSPCreate()` + +Output Parameters: +- `t` - work vector. If not provided then one is generated. +- `v` - optional location to stash residual. If `v` is not provided, then a location is generated. +- `V` - the residual + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPBuildSolution()` + +# External Links +$(_doc_external("KSP/KSPBuildResidual")) +""" +function KSPBuildResidual(petsclib::PetscLibType, ksp::PetscKSP, t::PetscVec, v::PetscVec, V::PetscVec) end + +@for_petsc function KSPBuildResidual(petsclib::$UnionPetscLib, ksp::PetscKSP, t::PetscVec, v::PetscVec, V::PetscVec ) + V_ = Ref(V.ptr) + + @chk ccall( + (:KSPBuildResidual, $petsc_library), + PetscErrorCode, + (CKSP, CVec, CVec, Ptr{CVec}), + ksp, t, v, V_, + ) + + V.ptr = C_NULL + + return nothing +end + +""" + KSPSetDiagonalScale(petsclib::PetscLibType,ksp::PetscKSP, scale::PetscBool) +Tells `KSP` to symmetrically diagonally scale the system +before solving. This actually CHANGES the matrix (and right-hand side). + +Logically Collective + +Input Parameters: +- `ksp` - the `KSP` context +- `scale` - `PETSC_TRUE` or `PETSC_FALSE` + +Options Database Keys: +- `-ksp_diagonal_scale` - perform a diagonal scaling before the solve +- `-ksp_diagonal_scale_fix` - scale the matrix back AFTER the solve + +Level: advanced + +-seealso: [](ch_ksp), `KSPGetDiagonalScale()`, `KSPSetDiagonalScaleFix()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetDiagonalScale")) +""" +function KSPSetDiagonalScale(petsclib::PetscLibType, ksp::PetscKSP, scale::PetscBool) end + +@for_petsc function KSPSetDiagonalScale(petsclib::$UnionPetscLib, ksp::PetscKSP, scale::PetscBool ) + + @chk ccall( + (:KSPSetDiagonalScale, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, scale, + ) + + + return nothing +end + +""" + scale::PetscBool = KSPGetDiagonalScale(petsclib::PetscLibType,ksp::PetscKSP) +Checks if `KSP` solver scales the matrix and right + +Not Collective + +Input Parameter: +- `ksp` - the `KSP` context + +Output Parameter: +- `scale` - `PETSC_TRUE` or `PETSC_FALSE` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPSetDiagonalScale()`, `KSPSetDiagonalScaleFix()` + +# External Links +$(_doc_external("KSP/KSPGetDiagonalScale")) +""" +function KSPGetDiagonalScale(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetDiagonalScale(petsclib::$UnionPetscLib, ksp::PetscKSP ) + scale_ = Ref{PetscBool}() + + @chk ccall( + (:KSPGetDiagonalScale, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, scale_, + ) + + scale = scale_[] + + return scale +end + +""" + KSPSetDiagonalScaleFix(petsclib::PetscLibType,ksp::PetscKSP, fix::PetscBool) +Tells `KSP` to diagonally scale the system back after solving. + +Logically Collective + +Input Parameters: +- `ksp` - the `KSP` context +- `fix` - `PETSC_TRUE` to scale back after the system solve, `PETSC_FALSE` to not +rescale (default) + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGetDiagonalScale()`, `KSPSetDiagonalScale()`, `KSPGetDiagonalScaleFix()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetDiagonalScaleFix")) +""" +function KSPSetDiagonalScaleFix(petsclib::PetscLibType, ksp::PetscKSP, fix::PetscBool) end + +@for_petsc function KSPSetDiagonalScaleFix(petsclib::$UnionPetscLib, ksp::PetscKSP, fix::PetscBool ) + + @chk ccall( + (:KSPSetDiagonalScaleFix, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, fix, + ) + + + return nothing +end + +""" + fix::PetscBool = KSPGetDiagonalScaleFix(petsclib::PetscLibType,ksp::PetscKSP) +Determines if `KSP` diagonally scales the system back after solving. That is `KSPSetDiagonalScaleFix()` has been called + +Not Collective + +Input Parameter: +- `ksp` - the `KSP` context + +Output Parameter: +- `fix` - `PETSC_TRUE` to scale back after the system solve, `PETSC_FALSE` to not +rescale (default) + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGetDiagonalScale()`, `KSPSetDiagonalScale()`, `KSPSetDiagonalScaleFix()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPGetDiagonalScaleFix")) +""" +function KSPGetDiagonalScaleFix(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetDiagonalScaleFix(petsclib::$UnionPetscLib, ksp::PetscKSP ) + fix_ = Ref{PetscBool}() + + @chk ccall( + (:KSPGetDiagonalScaleFix, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, fix_, + ) + + fix = fix_[] + + return fix +end + +""" + KSPSetComputeOperators(petsclib::PetscLibType,ksp::PetscKSP, func::Union{KSPComputeOperatorsFn, Ptr}, ctx::Union{Cvoid, Ptr}) +set routine to compute the linear operators + +Logically Collective + +Input Parameters: +- `ksp` - the `KSP` context +- `func` - function to compute the operators, see `KSPComputeOperatorsFn` for the calling sequence +- `ctx` - optional context + +Level: beginner + +-seealso: [](ch_ksp), `KSP`, `KSPSetOperators()`, `KSPSetComputeRHS()`, `DMKSPSetComputeOperators()`, `KSPSetComputeInitialGuess()`, `KSPComputeOperatorsFn` + +# External Links +$(_doc_external("KSP/KSPSetComputeOperators")) +""" +function KSPSetComputeOperators(petsclib::PetscLibType, ksp::PetscKSP, func::Union{KSPComputeOperatorsFn, Ptr}, ctx::Union{Cvoid, Ptr}) end + +@for_petsc function KSPSetComputeOperators(petsclib::$UnionPetscLib, ksp::PetscKSP, func::Union{KSPComputeOperatorsFn, Ptr}, ctx::Union{Cvoid, Ptr}) + + @chk ccall( + (:KSPSetComputeOperators, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPComputeOperatorsFn}, Ptr{Cvoid}), + ksp, func, ctx, + ) + + + return nothing +end + +""" + KSPSetComputeRHS(petsclib::PetscLibType,ksp::PetscKSP, func::Union{KSPComputeRHSFn,Ptr}, ctx::Union{Cvoid, Ptr}) +set routine to compute the right + +Logically Collective + +Input Parameters: +- `ksp` - the `KSP` context +- `func` - function to compute the right-hand side, see `KSPComputeRHSFn` for the calling sequence +- `ctx` - optional context + +Level: beginner + +-seealso: [](ch_ksp), `KSP`, `KSPSolve()`, `DMKSPSetComputeRHS()`, `KSPSetComputeOperators()`, `KSPSetOperators()`, `KSPComputeRHSFn` + +# External Links +$(_doc_external("KSP/KSPSetComputeRHS")) +""" +function KSPSetComputeRHS(petsclib::PetscLibType, ksp::PetscKSP, func::Union{KSPComputeRHSFn,Ptr}, ctx::Union{Cvoid, Ptr}) end + +@for_petsc function KSPSetComputeRHS(petsclib::$UnionPetscLib, ksp::PetscKSP, func::Union{KSPComputeRHSFn,Ptr}, ctx::Union{Cvoid, Ptr} ) + + @chk ccall( + (:KSPSetComputeRHS, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPComputeRHSFn}, Ptr{Cvoid}), + ksp, func, ctx, + ) + + + return nothing +end + +""" + KSPSetComputeInitialGuess(petsclib::PetscLibType,ksp::PetscKSP, func::Union{KSPComputeInitialGuessFn, Ptr}, ctx::Union{Cvoid, Ptr}) +set routine to compute the initial guess of the linear system + +Logically Collective + +Input Parameters: +- `ksp` - the `KSP` context +- `func` - function to compute the initial guess, see `KSPComputeInitialGuessFn` for calling sequence +- `ctx` - optional context + +Level: beginner + +-seealso: [](ch_ksp), `KSP`, `KSPSolve()`, `KSPSetComputeRHS()`, `KSPSetComputeOperators()`, `DMKSPSetComputeInitialGuess()`, `KSPSetInitialGuessNonzero()`, +`KSPComputeInitialGuessFn` + +# External Links +$(_doc_external("KSP/KSPSetComputeInitialGuess")) +""" +function KSPSetComputeInitialGuess(petsclib::PetscLibType, ksp::PetscKSP, func::Union{KSPComputeInitialGuessFn, Ptr}, ctx::Union{Cvoid, Ptr}) end + +@for_petsc function KSPSetComputeInitialGuess(petsclib::$UnionPetscLib, ksp::PetscKSP, func::Union{KSPComputeInitialGuessFn, Ptr}, ctx::Union{Cvoid, Ptr}) + + @chk ccall( + (:KSPSetComputeInitialGuess, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPComputeInitialGuessFn}, Ptr{Cvoid}), + ksp, func, ctx, + ) + + + return nothing +end + +""" + flg::PetscBool = KSPSetUseExplicitTranspose(petsclib::PetscLibType,ksp::PetscKSP) +Determines the explicit transpose of the operator is formed in `KSPSolveTranspose()`. In some configurations (like GPUs) it may +be explicitly formed since the solve is much more efficient. + +Logically Collective + +Input Parameter: +- `ksp` - the `KSP` context + +Output Parameter: +- `flg` - `PETSC_TRUE` to transpose the system in `KSPSolveTranspose()`, `PETSC_FALSE` to not transpose (default) + +Level: advanced + +-seealso: [](ch_ksp), `KSPSolveTranspose()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetUseExplicitTranspose")) +""" +function KSPSetUseExplicitTranspose(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPSetUseExplicitTranspose(petsclib::$UnionPetscLib, ksp::PetscKSP ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:KSPSetUseExplicitTranspose, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + rnorm::PetscReal = KSPGetResidualNorm(petsclib::PetscLibType,ksp::PetscKSP) +Gets the last (possibly approximate and/or preconditioned) residual norm that has been computed. + +Not Collective + +Input Parameter: +- `ksp` - the iterative context + +Output Parameter: +- `rnorm` - residual norm + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPSetNormType()`, `KSPBuildResidual()`, `KSPNormType` + +# External Links +$(_doc_external("KSP/KSPGetResidualNorm")) +""" +function KSPGetResidualNorm(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetResidualNorm(petsclib::$UnionPetscLib, ksp::PetscKSP ) + rnorm_ = Ref{$PetscReal}() + + @chk ccall( + (:KSPGetResidualNorm, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}), + ksp, rnorm_, + ) + + rnorm = rnorm_[] + + return rnorm +end + +""" + its::PetscInt = KSPGetIterationNumber(petsclib::PetscLibType,ksp::PetscKSP) +Gets the current iteration number; if the `KSPSolve()` is complete, returns the number of iterations used. + +Not Collective + +Input Parameter: +- `ksp` - the iterative context + +Output Parameter: +- `its` - number of iterations + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPGetResidualNorm()`, `KSPBuildResidual()`, `KSPGetTotalIterations()` + +# External Links +$(_doc_external("KSP/KSPGetIterationNumber")) +""" +function KSPGetIterationNumber(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetIterationNumber(petsclib::$UnionPetscLib, ksp::PetscKSP ) + its_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPGetIterationNumber, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, its_, + ) + + its = its_[] + + return its +end + + +""" + its::PetscInt = KSPGetTotalIterations(petsclib::PetscLibType,ksp::PetscKSP) +Gets the total number of iterations this `KSP` object has performed since was created, counted over all linear solves + +Not Collective + +Input Parameter: +- `ksp` - the iterative context + +Output Parameter: +- `its` - total number of iterations + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPBuildResidual()`, `KSPGetResidualNorm()`, `KSPGetIterationNumber()` + +# External Links +$(_doc_external("KSP/KSPGetTotalIterations")) +""" +function KSPGetTotalIterations(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetTotalIterations(petsclib::$UnionPetscLib, ksp::PetscKSP ) + its_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPGetTotalIterations, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, its_, + ) + + its = its_[] + + return its +end + +""" + KSPMonitorResidual(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Print the (possibly preconditioned, possibly approximate) residual norm at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - (preconditioned) residual norm value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor` - Activates `KSPMonitorResidual()` to print the norm value at each iteration + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPMonitorResidualView()`, `KSPMonitorResidualDrawLG()`, +`KSPMonitorResidualRange()`, `KSPMonitorTrueResidualDraw()`, `KSPMonitorTrueResidualDrawLG()`, `KSPMonitorTrueResidualMax()`, +`KSPMonitorSingularValue()`, `KSPMonitorSolutionDrawLG()`, `KSPMonitorSolutionDraw()`, `KSPMonitorSolution()`, +`KSPMonitorErrorDrawLG()`, `KSPMonitorErrorDraw()`, `KSPMonitorError()` + +# External Links +$(_doc_external("KSP/KSPMonitorResidual")) +""" +function KSPMonitorResidual(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorResidual(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorResidual, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorResidualView(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Plots the (possibly preconditioned) residual at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor viewertype` - Activates `KSPMonitorResidualView()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPMonitorResidual()`, `KSPMonitorResidualDrawLG()` + +# External Links +$(_doc_external("KSP/KSPMonitorResidualView")) +""" +function KSPMonitorResidualView(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorResidualView(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorResidualView, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorResidualDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Plots the (possibly preconditioned) residual norm at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor draw::draw_lg` - Activates `KSPMonitorResidualDrawLG()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `PETSCVIEWERDRAW`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPMonitorResidualView()`, `KSPMonitorResidual()` + +# External Links +$(_doc_external("KSP/KSPMonitorResidualDrawLG")) +""" +function KSPMonitorResidualDrawLG(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorResidualDrawLG(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorResidualDrawLG, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + vf::PetscViewerAndFormat = KSPMonitorResidualDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) +Creates the context for the (possibly preconditioned) residual norm monitor `KSPMonitorResidualDrawLG()` + +Collective + +Input Parameters: +- `viewer` - The `PetscViewer` of type `PETSCVIEWERDRAW` +- `format` - The viewer format +- `ctx` - An optional user context + +Output Parameter: +- `vf` - The viewer context + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `PETSCVIEWERDRAW`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPMonitorResidualDrawLG()`, +`PetscViewerFormat`, `PetscViewer`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("KSP/KSPMonitorResidualDrawLGCreate")) +""" +function KSPMonitorResidualDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) end + +@for_petsc function KSPMonitorResidualDrawLGCreate(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid ) + vf_ = Ref{PetscViewerAndFormat}() + + @chk ccall( + (:KSPMonitorResidualDrawLGCreate, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerFormat, Ptr{Cvoid}, PetscViewerAndFormat), + viewer, format, ctx, vf_, + ) + + vf = vf_[] + + return vf +end + +""" + KSPMonitorResidualShort(petsclib::PetscLibType,ksp::PetscKSP, its::PetscInt, fnorm::PetscReal, vf::PetscViewerAndFormat) + +# External Links +$(_doc_external("KSP/KSPMonitorResidualShort")) +""" +function KSPMonitorResidualShort(petsclib::PetscLibType, ksp::PetscKSP, its::PetscInt, fnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorResidualShort(petsclib::$UnionPetscLib, ksp::PetscKSP, its::$PetscInt, fnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorResidualShort, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, its, fnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorResidualRange(petsclib::PetscLibType,ksp::PetscKSP, it::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Prints the percentage of residual elements that are more than 10 percent of the maximum value. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `it` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_range` - Activates `KSPMonitorResidualRange()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorResidual()` + +# External Links +$(_doc_external("KSP/KSPMonitorResidualRange")) +""" +function KSPMonitorResidualRange(petsclib::PetscLibType, ksp::PetscKSP, it::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorResidualRange(petsclib::$UnionPetscLib, ksp::PetscKSP, it::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorResidualRange, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, it, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorTrueResidual(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Prints the true residual norm, as well as the (possibly preconditioned, possibly approximate) residual norm, +at each iteration of a `KSPSolve()` iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_true_residual` - Activates `KSPMonitorTrueResidual()` to print both norm values at each iteration + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorResidual()`, `KSPMonitorTrueResidualMaxNorm()`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("KSP/KSPMonitorTrueResidual")) +""" +function KSPMonitorTrueResidual(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorTrueResidual(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorTrueResidual, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorTrueResidualView(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Plots the true residual at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context of type `PETSCVIEWERDRAW` + +Options Database Key: +- `-ksp_monitor_true_residual viewertype` - Activates `KSPMonitorTrueResidualView()` + +Level: intermediate + +-seealso: [](ch_ksp), `PETSCVIEWERDRAW`, `KSP`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPMonitorResidual()`, +`KSPMonitorTrueResidualDrawLG()`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("KSP/KSPMonitorTrueResidualView")) +""" +function KSPMonitorTrueResidualView(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorTrueResidualView(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorTrueResidualView, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorTrueResidualDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Plots the true residual norm at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_true_residual draw::draw_lg` - Activates `KSPMonitorTrueResidualDrawLG()` + +Level: intermediate + +-seealso: [](ch_ksp), `PETSCVIEWERDRAW`, `KSP`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPMonitorTrueResidualDraw()`, `KSPMonitorResidual`, +`KSPMonitorTrueResidualDrawLGCreate()` + +# External Links +$(_doc_external("KSP/KSPMonitorTrueResidualDrawLG")) +""" +function KSPMonitorTrueResidualDrawLG(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorTrueResidualDrawLG(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorTrueResidualDrawLG, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + vf::PetscViewerAndFormat = KSPMonitorTrueResidualDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) +Creates the context for the true residual monitor `KSPMonitorTrueResidualDrawLG()` + +Collective + +Input Parameters: +- `viewer` - The `PetscViewer` of type `PETSCVIEWERDRAW` +- `format` - The viewer format +- `ctx` - An optional user context + +Output Parameter: +- `vf` - The viewer context + +Level: intermediate + +-seealso: [](ch_ksp), `PETSCVIEWERDRAW`, `KSP`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("KSP/KSPMonitorTrueResidualDrawLGCreate")) +""" +function KSPMonitorTrueResidualDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) end + +@for_petsc function KSPMonitorTrueResidualDrawLGCreate(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid ) + vf_ = Ref{PetscViewerAndFormat}() + + @chk ccall( + (:KSPMonitorTrueResidualDrawLGCreate, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerFormat, Ptr{Cvoid}, PetscViewerAndFormat), + viewer, format, ctx, vf_, + ) + + vf = vf_[] + + return vf +end + +""" + KSPMonitorTrueResidualMax(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Prints the true residual max norm at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_true_residual_max` - Activates `KSPMonitorTrueResidualMax()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorResidual()`, `KSPMonitorTrueResidualMaxNorm()` + +# External Links +$(_doc_external("KSP/KSPMonitorTrueResidualMax")) +""" +function KSPMonitorTrueResidualMax(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorTrueResidualMax(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorTrueResidualMax, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorError(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Prints the error norm, as well as the (possibly preconditioned) residual norm, at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_error` - Activates `KSPMonitorError()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorResidual()`, `KSPMonitorTrueResidualMaxNorm()` + +# External Links +$(_doc_external("KSP/KSPMonitorError")) +""" +function KSPMonitorError(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorError(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorError, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorErrorDraw(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Plots the error at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_error draw` - Activates `KSPMonitorErrorDraw()` + +Level: intermediate + +-seealso: [](ch_ksp), `PETSCVIEWERDRAW`, `KSP`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPMonitorErrorDrawLG()` + +# External Links +$(_doc_external("KSP/KSPMonitorErrorDraw")) +""" +function KSPMonitorErrorDraw(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorErrorDraw(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorErrorDraw, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorErrorDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Plots the error and residual norm at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_error draw::draw_lg` - Activates `KSPMonitorTrueResidualDrawLG()` + +Level: intermediate + +-seealso: [](ch_ksp), `PETSCVIEWERDRAW`, `KSP`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPMonitorErrorDraw()` + +# External Links +$(_doc_external("KSP/KSPMonitorErrorDrawLG")) +""" +function KSPMonitorErrorDrawLG(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorErrorDrawLG(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorErrorDrawLG, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + vf::PetscViewerAndFormat = KSPMonitorErrorDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) +Creates the context for the error and preconditioned residual plotter `KSPMonitorErrorDrawLG()` + +Collective + +Input Parameters: +- `viewer` - The `PetscViewer` +- `format` - The viewer format +- `ctx` - An optional user context + +Output Parameter: +- `vf` - The viewer context + +Level: intermediate + +-seealso: [](ch_ksp), `PETSCVIEWERDRAW`, `KSP`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPMonitorErrorDrawLG()` + +# External Links +$(_doc_external("KSP/KSPMonitorErrorDrawLGCreate")) +""" +function KSPMonitorErrorDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) end + +@for_petsc function KSPMonitorErrorDrawLGCreate(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid ) + vf_ = Ref{PetscViewerAndFormat}() + + @chk ccall( + (:KSPMonitorErrorDrawLGCreate, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerFormat, Ptr{Cvoid}, PetscViewerAndFormat), + viewer, format, ctx, vf_, + ) + + vf = vf_[] + + return vf +end + +""" + KSPMonitorSolution(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Print the solution norm at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_solution` - Activates `KSPMonitorSolution()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPMonitorSet()`, `KSPMonitorTrueResidual()` + +# External Links +$(_doc_external("KSP/KSPMonitorSolution")) +""" +function KSPMonitorSolution(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorSolution(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorSolution, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorSolutionDraw(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Plots the solution at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_solution draw` - Activates `KSPMonitorSolutionDraw()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPMonitorSet()`, `KSPMonitorTrueResidual()` + +# External Links +$(_doc_external("KSP/KSPMonitorSolutionDraw")) +""" +function KSPMonitorSolutionDraw(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorSolutionDraw(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorSolutionDraw, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorSolutionDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Plots the solution norm at each iteration of an iterative solver. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_solution draw::draw_lg` - Activates `KSPMonitorSolutionDrawLG()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPMonitorSolutionDrawLGCreate()` + +# External Links +$(_doc_external("KSP/KSPMonitorSolutionDrawLG")) +""" +function KSPMonitorSolutionDrawLG(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorSolutionDrawLG(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorSolutionDrawLG, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + vf::PetscViewerAndFormat = KSPMonitorSolutionDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) +Creates the context for the `KSP` monitor `KSPMonitorSolutionDrawLG()` + +Collective + +Input Parameters: +- `viewer` - The `PetscViewer` +- `format` - The viewer format +- `ctx` - An optional user context + +Output Parameter: +- `vf` - The viewer context + +Level: intermediate + +-seealso: [](ch_ksp), `KSPMonitorSet()`, `KSPMonitorTrueResidual()` + +# External Links +$(_doc_external("KSP/KSPMonitorSolutionDrawLGCreate")) +""" +function KSPMonitorSolutionDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) end + +@for_petsc function KSPMonitorSolutionDrawLGCreate(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid ) + vf_ = Ref{PetscViewerAndFormat}() + + @chk ccall( + (:KSPMonitorSolutionDrawLGCreate, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerFormat, Ptr{Cvoid}, PetscViewerAndFormat), + viewer, format, ctx, vf_, + ) + + vf = vf_[] + + return vf +end + +""" + KSPMonitorSingularValue(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Prints the two norm of the true residual and estimation of the extreme singular values of the preconditioned problem at each iteration. + +Logically Collective + +Input Parameters: +- `ksp` - the iterative context +- `n` - the iteration +- `rnorm` - the two norm of the residual +- `vf` - The viewer context + +Options Database Key: +- `-ksp_monitor_singular_value` - Activates `KSPMonitorSingularValue()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPComputeExtremeSingularValues()`, `KSPMonitorSingularValueCreate()` + +# External Links +$(_doc_external("KSP/KSPMonitorSingularValue")) +""" +function KSPMonitorSingularValue(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorSingularValue(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorSingularValue, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + vf::PetscViewerAndFormat = KSPMonitorSingularValueCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) +Creates the singular value monitor context needed by `KSPMonitorSingularValue()` + +Collective + +Input Parameters: +- `viewer` - The PetscViewer +- `format` - The viewer format +- `ctx` - An optional user context + +Output Parameter: +- `vf` - The viewer context + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorSingularValue()`, `PetscViewer` + +# External Links +$(_doc_external("KSP/KSPMonitorSingularValueCreate")) +""" +function KSPMonitorSingularValueCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) end + +@for_petsc function KSPMonitorSingularValueCreate(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid ) + vf_ = Ref{PetscViewerAndFormat}() + + @chk ccall( + (:KSPMonitorSingularValueCreate, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerFormat, Ptr{Cvoid}, PetscViewerAndFormat), + viewer, format, ctx, vf_, + ) + + vf = vf_[] + + return vf +end + +""" + ctx::Cvoid = KSPMonitorDynamicToleranceCreate(petsclib::PetscLibType) +Creates the context used by `KSPMonitorDynamicTolerance()` + +Logically Collective + +Output Parameter: +- `ctx` - a void pointer + +Options Database Key: +- `-sub_ksp_dynamic_tolerance ` - coefficient of dynamic tolerance for inner solver, default is 1.0 + +Level: advanced + +-seealso: [](sec_flexibleksp), `KSP`, `KSPMonitorDynamicTolerance()`, `KSPMonitorDynamicToleranceDestroy()`, `KSPMonitorDynamicToleranceSetCoefficient()` + +# External Links +$(_doc_external("KSP/KSPMonitorDynamicToleranceCreate")) +""" +function KSPMonitorDynamicToleranceCreate(petsclib::PetscLibType) end + +@for_petsc function KSPMonitorDynamicToleranceCreate(petsclib::$UnionPetscLib) + ctx_ = Ref{Cvoid}() + + @chk ccall( + (:KSPMonitorDynamicToleranceCreate, $petsc_library), + PetscErrorCode, + (Ptr{Cvoid},), + ctx_, + ) + + ctx = ctx_[] + + return ctx +end + +""" + coeff::PetscReal = KSPMonitorDynamicToleranceSetCoefficient(petsclib::PetscLibType,ctx::Cvoid) +Sets the coefficient in the context used by `KSPMonitorDynamicTolerance()` + +Logically Collective + +Output Parameters: +- `ctx` - the context for `KSPMonitorDynamicTolerance()` +- `coeff` - the coefficient, default is 1.0 + +Options Database Key: +- `-sub_ksp_dynamic_tolerance ` - coefficient of dynamic tolerance for inner solver, default is 1.0 + +Level: advanced + +-seealso: [](sec_flexibleksp), `KSP`, `KSPMonitorDynamicTolerance()`, `KSPMonitorDynamicToleranceDestroy()`, `KSPMonitorDynamicToleranceCreate()` + +# External Links +$(_doc_external("KSP/KSPMonitorDynamicToleranceSetCoefficient")) +""" +function KSPMonitorDynamicToleranceSetCoefficient(petsclib::PetscLibType, ctx::Cvoid) end + +@for_petsc function KSPMonitorDynamicToleranceSetCoefficient(petsclib::$UnionPetscLib, ctx::Cvoid ) + coeff_ = Ref{$PetscReal}() + + @chk ccall( + (:KSPMonitorDynamicToleranceSetCoefficient, $petsc_library), + PetscErrorCode, + (Ptr{Cvoid}, $PetscReal), + ctx, coeff_, + ) + + coeff = coeff_[] + + return coeff +end + +""" + KSPMonitorDynamicTolerance(petsclib::PetscLibType,ksp::PetscKSP, its::PetscInt, fnorm::PetscReal, ctx::Cvoid) +A monitor that changes the inner tolerance of nested preconditioners in every outer iteration in an adaptive way. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `its` - iteration number (not used) +- `fnorm` - the current residual norm +- `ctx` - context used by monitor + +Options Database Key: +- `-sub_ksp_dynamic_tolerance ` - coefficient of dynamic tolerance for inner solver, default is 1.0 + +Level: advanced + +-seealso: [](sec_flexibleksp), `KSP`, `KSPMonitorDynamicToleranceCreate()`, `KSPMonitorDynamicToleranceDestroy()`, `KSPMonitorDynamicToleranceSetCoefficient()` + +# External Links +$(_doc_external("KSP/KSPMonitorDynamicTolerance")) +""" +function KSPMonitorDynamicTolerance(petsclib::PetscLibType, ksp::PetscKSP, its::PetscInt, fnorm::PetscReal, ctx::Cvoid) end + +@for_petsc function KSPMonitorDynamicTolerance(petsclib::$UnionPetscLib, ksp::PetscKSP, its::$PetscInt, fnorm::$PetscReal, ctx::Cvoid ) + + @chk ccall( + (:KSPMonitorDynamicTolerance, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{Cvoid}), + ksp, its, fnorm, ctx, + ) + + + return nothing +end + +""" + KSPMonitorDynamicToleranceDestroy(petsclib::PetscLibType,ctx::Cvoid) +Destroy the monitor context used in `KSPMonitorDynamicTolerance()` + +Input Parameter: +- `ctx` - the monitor context + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorDynamicTolerance()`, `KSPMonitorSet()`, `KSPMonitorDynamicToleranceCreate()` + +# External Links +$(_doc_external("KSP/KSPMonitorDynamicToleranceDestroy")) +""" +function KSPMonitorDynamicToleranceDestroy(petsclib::PetscLibType, ctx::Cvoid) end + +@for_petsc function KSPMonitorDynamicToleranceDestroy(petsclib::$UnionPetscLib, ctx::Cvoid ) + + @chk ccall( + (:KSPMonitorDynamicToleranceDestroy, $petsc_library), + PetscErrorCode, + (Cvoid,), + ctx, + ) + + + return nothing +end + +""" + KSPConvergedSkip(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, reason::KSPConvergedReason, dtx::Cvoid) +Convergence test that do not return as converged +until the maximum number of iterations is reached. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm residual value (may be estimated) +- `dtx` - unused convergence context + +Output Parameter: +- `reason` - `KSP_CONVERGED_ITERATING` or `KSP_CONVERGED_ITS` + +Options Database Key: +- `-ksp_convergence_test skip` - skips the test + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPCG`, `KSPBCGS`, `KSPConvergenceTestFn`, `KSPSetConvergenceTest()`, `KSPSetTolerances()`, `KSPSetNormType()`, [](sec_flexibleksp), +`KSPConvergedReason` + +# External Links +$(_doc_external("KSP/KSPConvergedSkip")) +""" +function KSPConvergedSkip(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, reason::KSPConvergedReason, dtx::Cvoid) end + +@for_petsc function KSPConvergedSkip(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, reason::KSPConvergedReason, dtx::Cvoid ) + + @chk ccall( + (:KSPConvergedSkip, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{KSPConvergedReason}, Ptr{Cvoid}), + ksp, n, rnorm, reason, dtx, + ) + + + return nothing +end + +""" + KSPSetConvergedNegativeCurvature(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Allows to declare convergence and return `KSP_CONVERGED_NEG_CURVE` when negative curvature is detected + +Collective + +Input Parameters: +- `ksp` - iterative context +- `flg` - the Boolean value + +Options Database Key: +- `-ksp_converged_neg_curve ` - Declare convergence if negative curvature is detected + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPConvergedReason`, `KSPGetConvergedNegativeCurvature()` + +# External Links +$(_doc_external("KSP/KSPSetConvergedNegativeCurvature")) +""" +function KSPSetConvergedNegativeCurvature(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPSetConvergedNegativeCurvature(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPSetConvergedNegativeCurvature, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = KSPGetConvergedNegativeCurvature(petsclib::PetscLibType,ksp::PetscKSP) +Get the flag to declare convergence if negative curvature is detected + +Collective + +Input Parameter: +- `ksp` - iterative context + +Output Parameter: +- `flg` - the Boolean value + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPConvergedReason`, `KSPSetConvergedNegativeCurvature()` + +# External Links +$(_doc_external("KSP/KSPGetConvergedNegativeCurvature")) +""" +function KSPGetConvergedNegativeCurvature(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetConvergedNegativeCurvature(petsclib::$UnionPetscLib, ksp::PetscKSP ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:KSPGetConvergedNegativeCurvature, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + ctx::Cvoid = KSPConvergedDefaultCreate(petsclib::PetscLibType) +Creates and initializes the context used by the `KSPConvergedDefault()` function + +Not Collective + +Output Parameter: +- `ctx` - convergence context + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPConvergedDefault()`, `KSPConvergedDefaultDestroy()`, `KSPSetConvergenceTest()`, `KSPSetTolerances()`, +`KSPConvergedSkip()`, `KSPConvergedReason`, `KSPGetConvergedReason()`, `KSPConvergedDefaultSetUIRNorm()`, `KSPConvergedDefaultSetUMIRNorm()`, +`KSPConvergedDefaultSetConvergedMaxits()` + +# External Links +$(_doc_external("KSP/KSPConvergedDefaultCreate")) +""" +function KSPConvergedDefaultCreate(petsclib::PetscLibType) end + +@for_petsc function KSPConvergedDefaultCreate(petsclib::$UnionPetscLib) + ctx_ = Ref{Cvoid}() + + @chk ccall( + (:KSPConvergedDefaultCreate, $petsc_library), + PetscErrorCode, + (Cvoid,), + ctx_, + ) + + ctx = ctx_[] + + return ctx +end + +""" + KSPConvergedDefaultSetUIRNorm(petsclib::PetscLibType,ksp::PetscKSP) +makes the default convergence test use || B*(b +instead of || B*b ||. In the case of right preconditioner or if `KSPSetNormType`(ksp,`KSP_NORM_UNPRECONDITIONED`) +is used there is no B in the above formula. + +Collective + +Input Parameters: +- `ksp` - iterative context + +Options Database Key: +- `-ksp_converged_use_initial_residual_norm ` - Use initial residual norm for computing relative convergence + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPSetConvergenceTest()`, `KSPSetTolerances()`, `KSPConvergedSkip()`, `KSPConvergedReason`, `KSPGetConvergedReason()`, `KSPConvergedDefaultSetUMIRNorm()`, `KSPConvergedDefaultSetConvergedMaxits()` + +# External Links +$(_doc_external("KSP/KSPConvergedDefaultSetUIRNorm")) +""" +function KSPConvergedDefaultSetUIRNorm(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPConvergedDefaultSetUIRNorm(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPConvergedDefaultSetUIRNorm, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPConvergedDefaultSetUMIRNorm(petsclib::PetscLibType,ksp::PetscKSP) +makes the default convergence test use min(|| B*(b +In the case of right preconditioner or if `KSPSetNormType`(ksp,`KSP_NORM_UNPRECONDITIONED`) +is used there is no B in the above formula. + +Collective + +Input Parameters: +- `ksp` - iterative context + +Options Database Key: +- `-ksp_converged_use_min_initial_residual_norm ` - Use minimum of initial residual norm and b for computing relative convergence + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPSetConvergenceTest()`, `KSPSetTolerances()`, `KSPConvergedSkip()`, `KSPConvergedReason`, `KSPGetConvergedReason()`, `KSPConvergedDefaultSetUIRNorm()`, `KSPConvergedDefaultSetConvergedMaxits()` + +# External Links +$(_doc_external("KSP/KSPConvergedDefaultSetUMIRNorm")) +""" +function KSPConvergedDefaultSetUMIRNorm(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPConvergedDefaultSetUMIRNorm(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPConvergedDefaultSetUMIRNorm, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPConvergedDefaultSetConvergedMaxits(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +allows the default convergence test to declare convergence and return `KSP_CONVERGED_ITS` if the maximum number of iterations is reached + +Collective + +Input Parameters: +- `ksp` - iterative context +- `flg` - boolean flag + +Options Database Key: +- `-ksp_converged_maxits ` - Declare convergence if the maximum number of iterations is reached + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPSetConvergenceTest()`, `KSPSetTolerances()`, `KSPConvergedSkip()`, `KSPConvergedReason`, `KSPGetConvergedReason()`, `KSPConvergedDefaultSetUMIRNorm()`, `KSPConvergedDefaultSetUIRNorm()` + +# External Links +$(_doc_external("KSP/KSPConvergedDefaultSetConvergedMaxits")) +""" +function KSPConvergedDefaultSetConvergedMaxits(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPConvergedDefaultSetConvergedMaxits(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPConvergedDefaultSetConvergedMaxits, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + KSPConvergedDefault(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, reason::KSPConvergedReason, ctx::Cvoid) +Default code to determine convergence of the linear iterative solvers + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - residual norm (may be estimated, depending on the method may be the preconditioned residual norm) +- `ctx` - convergence context which must be created by `KSPConvergedDefaultCreate()` + +Output Parameter: +- `reason` - the convergence reason; it is positive if the iteration has converged, +negative if the iteration has diverged, and `KSP_CONVERGED_ITERATING` otherwise + +Options Database Keys: +- `-ksp_max_it` - maximum number of linear iterations +- `-ksp_min_it` - minimum number of linear iterations, defaults to 0 +- `-ksp_rtol rtol` - relative tolerance used in default determination of convergence, i.e. if residual norm decreases by this factor than convergence is declared +- `-ksp_atol abstol` - absolute tolerance used in default convergence test, i.e. if residual norm is less than this then convergence is declared +- `-ksp_divtol tol` - if residual norm increases by this factor than divergence is declared +- `-ksp_converged_use_initial_residual_norm` - see `KSPConvergedDefaultSetUIRNorm()` +- `-ksp_converged_use_min_initial_residual_norm` - see `KSPConvergedDefaultSetUMIRNorm()` +- `-ksp_converged_maxits` - see `KSPConvergedDefaultSetConvergedMaxits()` + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPSetConvergenceTest()`, `KSPSetTolerances()`, `KSPConvergedSkip()`, `KSPConvergedReason`, `KSPGetConvergedReason()`, +`KSPSetMinimumIterations()`, `KSPConvergenceTestFn`, +`KSPConvergedDefaultSetUIRNorm()`, `KSPConvergedDefaultSetUMIRNorm()`, `KSPConvergedDefaultSetConvergedMaxits()`, `KSPConvergedDefaultCreate()`, `KSPConvergedDefaultDestroy()` + +# External Links +$(_doc_external("KSP/KSPConvergedDefault")) +""" +function KSPConvergedDefault(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, reason::KSPConvergedReason, ctx::Cvoid) end + +@for_petsc function KSPConvergedDefault(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, reason::KSPConvergedReason, ctx::Cvoid ) + + @chk ccall( + (:KSPConvergedDefault, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{KSPConvergedReason}, Ptr{Cvoid}), + ksp, n, rnorm, reason, ctx, + ) + + + return nothing +end + +""" + KSPConvergedDefaultDestroy(petsclib::PetscLibType,ctx::Cvoid) +Frees the space used by the `KSPConvergedDefault()` function context + +Not Collective + +Input Parameter: +- `ctx` - convergence context + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPConvergedDefault()`, `KSPConvergedDefaultCreate()`, `KSPSetConvergenceTest()`, `KSPSetTolerances()`, `KSPConvergedSkip()`, +`KSPConvergedReason`, `KSPGetConvergedReason()`, `KSPConvergedDefaultSetUIRNorm()`, `KSPConvergedDefaultSetUMIRNorm()` + +# External Links +$(_doc_external("KSP/KSPConvergedDefaultDestroy")) +""" +function KSPConvergedDefaultDestroy(petsclib::PetscLibType, ctx::Cvoid) end + +@for_petsc function KSPConvergedDefaultDestroy(petsclib::$UnionPetscLib, ctx::Cvoid ) + + @chk ccall( + (:KSPConvergedDefaultDestroy, $petsc_library), + PetscErrorCode, + (Cvoid,), + ctx, + ) + + + return nothing +end + +""" + KSPBuildSolutionDefault(petsclib::PetscLibType,ksp::PetscKSP, v::PetscVec, V::PetscVec) + +# External Links +$(_doc_external("KSP/KSPBuildSolutionDefault")) +""" +function KSPBuildSolutionDefault(petsclib::PetscLibType, ksp::PetscKSP, v::PetscVec, V::PetscVec) end + +@for_petsc function KSPBuildSolutionDefault(petsclib::$UnionPetscLib, ksp::PetscKSP, v::PetscVec, V::PetscVec ) + V_ = Ref(V.ptr) + + @chk ccall( + (:KSPBuildSolutionDefault, $petsc_library), + PetscErrorCode, + (CKSP, CVec, Ptr{CVec}), + ksp, v, V_, + ) + + V.ptr = C_NULL + + return nothing +end + +""" + KSPBuildResidualDefault(petsclib::PetscLibType,ksp::PetscKSP, t::PetscVec, v::PetscVec, V::PetscVec) +Default code to compute the residual. + +Collecive on ksp + +Input Parameters: +- `ksp` - iterative context +- `t` - pointer to temporary vector +- `v` - pointer to user vector + +Output Parameter: +- `V` - pointer to a vector containing the residual + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPBuildSolutionDefault()` + +# External Links +$(_doc_external("KSP/KSPBuildResidualDefault")) +""" +function KSPBuildResidualDefault(petsclib::PetscLibType, ksp::PetscKSP, t::PetscVec, v::PetscVec, V::PetscVec) end + +@for_petsc function KSPBuildResidualDefault(petsclib::$UnionPetscLib, ksp::PetscKSP, t::PetscVec, v::PetscVec, V::PetscVec ) + V_ = Ref(V.ptr) + + @chk ccall( + (:KSPBuildResidualDefault, $petsc_library), + PetscErrorCode, + (CKSP, CVec, CVec, Ptr{CVec}), + ksp, t, v, V_, + ) + + V.ptr = C_NULL + + return nothing +end + +""" + right::Vector{PetscVec},left::Vector{PetscVec} = KSPCreateVecs(petsclib::PetscLibType,ksp::PetscKSP, rightn::PetscInt, leftn::PetscInt) +Gets a number of work vectors suitably sized for the operator in the `KSP` + +Collective + +Input Parameters: +- `ksp` - iterative context +- `rightn` - number of right work vectors to allocate +- `leftn` - number of left work vectors to allocate + +Output Parameters: +- `right` - the array of vectors created +- `left` - the array of left vectors + +Level: advanced + +-seealso: [](ch_ksp), `MatCreateVecs()`, `VecDestroyVecs()`, `KSPSetWorkVecs()` + +# External Links +$(_doc_external("KSP/KSPCreateVecs")) +""" +function KSPCreateVecs(petsclib::PetscLibType, ksp::PetscKSP, rightn::PetscInt, leftn::PetscInt) end + +@for_petsc function KSPCreateVecs(petsclib::$UnionPetscLib, ksp::PetscKSP, rightn::$PetscInt, leftn::$PetscInt ) + right_ = Ref{Ptr{CVec}}() + left_ = Ref{Ptr{CVec}}() + + @chk ccall( + (:KSPCreateVecs, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, Ptr{Ptr{CVec}}, $PetscInt, Ptr{Ptr{CVec}}), + ksp, rightn, right_, leftn, left_, + ) + + a_v = unsafe_wrap(Array, right_[], rightn; own = false) + if rightn != 0 + v = PetscVec(a_v[1], petsclib) + right = ntuple(i -> similar(v), rightn) + else + right = nothing + end + + + a_v = unsafe_wrap(Array, left_[], leftn; own = false) + if leftn != 0 + v = PetscVec(a_v[1], petsclib) + left = ntuple(i -> similar(v), leftn) + else + left = nothing + end + + return right,left +end + +""" + KSPSetWorkVecs(petsclib::PetscLibType,ksp::PetscKSP, nw::PetscInt) +Sets a number of work vectors into a `KSP` object + +Collective + +Input Parameters: +- `ksp` - iterative context +- `nw` - number of work vectors to allocate + +Level: developer + +-seealso: [](ch_ksp), `KSP`, `KSPCreateVecs()` + +# External Links +$(_doc_external("KSP/KSPSetWorkVecs")) +""" +function KSPSetWorkVecs(petsclib::PetscLibType, ksp::PetscKSP, nw::PetscInt) end + +@for_petsc function KSPSetWorkVecs(petsclib::$UnionPetscLib, ksp::PetscKSP, nw::$PetscInt ) + + @chk ccall( + (:KSPSetWorkVecs, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, nw, + ) + + + return nothing +end + +""" + KSPDestroyDefault(petsclib::PetscLibType,ksp::PetscKSP) + +# External Links +$(_doc_external("KSP/KSPDestroyDefault")) +""" +function KSPDestroyDefault(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPDestroyDefault(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPDestroyDefault, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + reason::KSPConvergedReason = KSPGetConvergedReason(petsclib::PetscLibType,ksp::PetscKSP) +Gets the reason the `KSP` iteration was stopped. + +Not Collective + +Input Parameter: +- `ksp` - the `KSP` context + +Output Parameter: +- `reason` - negative value indicates diverged, positive value converged, see `KSPConvergedReason` for the possible values + +Options Database Key: +- `-ksp_converged_reason` - prints the reason to standard out when the solve ends + +Level: intermediate + +-seealso: [](ch_ksp), `KSPConvergedReason`, `KSP`, `KSPSetConvergenceTest()`, `KSPConvergedDefault()`, `KSPSetTolerances()`, +`KSPConvergedReasonView()`, `KSPGetConvergedReasonString()` + +# External Links +$(_doc_external("KSP/KSPGetConvergedReason")) +""" +function KSPGetConvergedReason(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetConvergedReason(petsclib::$UnionPetscLib, ksp::PetscKSP) + reason = Ref{KSPConvergedReason}() + @chk ccall( + (:KSPGetConvergedReason, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPConvergedReason}), + ksp, reason, + ) + + + return reason[] +end + +""" + KSPGetConvergedReasonString(petsclib::PetscLibType,ksp::PetscKSP, strreason::String) +Return a human readable string for a `KSPConvergedReason` + +Not Collective + +Input Parameter: +- `ksp` - the `KSP` context + +Output Parameter: +- `strreason` - a human readable string that describes ksp converged reason + +Level: beginner + +-seealso: [](ch_ksp), `KSP`, `KSPGetConvergedReason()` + +# External Links +$(_doc_external("KSP/KSPGetConvergedReasonString")) +""" +function KSPGetConvergedReasonString(petsclib::PetscLibType, ksp::PetscKSP, strreason::String) end + +@for_petsc function KSPGetConvergedReasonString(petsclib::$UnionPetscLib, ksp::PetscKSP, strreason::String ) + strreason_ = Ref(pointer(strreason)) + + @chk ccall( + (:KSPGetConvergedReasonString, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Ptr{Cchar}}), + ksp, strreason_, + ) + + + return nothing +end + +""" + KSPSetDM(petsclib::PetscLibType,ksp::PetscKSP, dm::PetscDM) +Sets the `DM` that may be used by some preconditioners and that may be used to construct the linear system + +Logically Collective + +Input Parameters: +- `ksp` - the `KSP` +- `dm` - the `DM`, cannot be `NULL` to remove a previously set `DM` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `DM`, `KSPGetDM()`, `KSPSetDMActive()`, `KSPSetComputeOperators()`, `KSPSetComputeRHS()`, `KSPSetComputeInitialGuess()`, `DMKSPSetComputeOperators()`, `DMKSPSetComputeRHS()`, `DMKSPSetComputeInitialGuess()` + +# External Links +$(_doc_external("KSP/KSPSetDM")) +""" +function KSPSetDM(petsclib::PetscLibType, ksp::PetscKSP, dm::PetscDM) end + +@for_petsc function KSPSetDM(petsclib::$UnionPetscLib, ksp::PetscKSP, dm::PetscDM ) + + @chk ccall( + (:KSPSetDM, $petsc_library), + PetscErrorCode, + (CKSP, CDM), + ksp, dm, + ) + + + return nothing +end + +""" + KSPSetDMActive(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Indicates the `DM` should be used to generate the linear system matrix and right + +Logically Collective + +Input Parameters: +- `ksp` - the `KSP` +- `flg` - use the `DM` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `DM`, `KSPGetDM()`, `KSPSetDM()`, `SNESSetDM()`, `KSPSetComputeOperators()`, `KSPSetComputeRHS()`, `KSPSetComputeInitialGuess()` + +# External Links +$(_doc_external("KSP/KSPSetDMActive")) +""" +function KSPSetDMActive(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPSetDMActive(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPSetDMActive, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + dm::PetscDM = KSPGetDM(petsclib::PetscLibType,ksp::PetscKSP) +Gets the `DM` that may be used by some preconditioners and that may be used to construct the linear system + +Not Collective + +Input Parameter: +- `ksp` - the `KSP` + +Output Parameter: +- `dm` - the `DM` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `DM`, `KSPSetDM()`, `KSPSetDMActive()` + +# External Links +$(_doc_external("KSP/KSPGetDM")) +""" +function KSPGetDM(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetDM(petsclib::$UnionPetscLib, ksp::PetscKSP) + dm_ = Ref{CDM}() + + @chk ccall( + (:KSPGetDM, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{CDM}), + ksp, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + KSPSetApplicationContext(petsclib::PetscLibType,ksp::PetscKSP, ctx::Cvoid) +Sets the optional user + +Logically Collective + +Input Parameters: +- `ksp` - the `KSP` context +- `ctx` - user context + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPGetApplicationContext()` + +# External Links +$(_doc_external("KSP/KSPSetApplicationContext")) +""" +function KSPSetApplicationContext(petsclib::PetscLibType, ksp::PetscKSP, ctx::Cvoid) end + +@for_petsc function KSPSetApplicationContext(petsclib::$UnionPetscLib, ksp::PetscKSP, ctx::Cvoid ) + + @chk ccall( + (:KSPSetApplicationContext, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Cvoid}), + ksp, ctx, + ) + + + return nothing +end + +""" + KSPGetApplicationContext(petsclib::PetscLibType,ksp::PetscKSP, ctx::PeCtx) +Gets the user + +Not Collective + +Input Parameter: +- `ksp` - `KSP` context + +Output Parameter: +- `ctx` - a pointer to the user context + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPSetApplicationContext()` + +# External Links +$(_doc_external("KSP/KSPGetApplicationContext")) +""" +function KSPGetApplicationContext(petsclib::PetscLibType, ksp::PetscKSP, ctx::PeCtx) end + +@for_petsc function KSPGetApplicationContext(petsclib::$UnionPetscLib, ksp::PetscKSP, ctx::PeCtx ) + + @chk ccall( + (:KSPGetApplicationContext, $petsc_library), + PetscErrorCode, + (CKSP, PeCtx), + ksp, ctx, + ) + + + return nothing +end + +""" + KSPCheckSolve(petsclib::PetscLibType,ksp::PetscKSP, pc::PC, vec::PetscVec) +Checks if the `PCSetUp()` or `KSPSolve()` failed and set the error flag for the outer `PC`. A `KSP_DIVERGED_ITS` is +not considered a failure in this context + +Collective + +Input Parameters: +- `ksp` - the linear solver `KSP` context. +- `pc` - the preconditioner context +- `vec` - a vector that will be initialized with Inf to indicate lack of convergence + +Level: developer + +-seealso: [](ch_ksp), `KSP`, `KSPCreate()`, `KSPSetType()`, `KSPCheckNorm()`, `KSPCheckDot()` + +# External Links +$(_doc_external("KSP/KSPCheckSolve")) +""" +function KSPCheckSolve(petsclib::PetscLibType, ksp::PetscKSP, pc::PC, vec::PetscVec) end + +@for_petsc function KSPCheckSolve(petsclib::$UnionPetscLib, ksp::PetscKSP, pc::PC, vec::PetscVec ) + + @chk ccall( + (:KSPCheckSolve, $petsc_library), + PetscErrorCode, + (CKSP, PC, CVec), + ksp, pc, vec, + ) + + + return nothing +end + +""" + KSPInitialResidual(petsclib::PetscLibType,ksp::PetscKSP, vsoln::PetscVec, vt1::PetscVec, vt2::PetscVec, vres::PetscVec, vb::PetscVec) +Computes the residual. Either b +preconditioning or C*(b - A*x) with left preconditioning; the latter +residual is often called the "preconditioned residual". + +Collective + +Input Parameters: +- `ksp` - the `KSP` solver object +- `vsoln` - solution to use in computing residual +- `vt1` - temporary work vector +- `vt2` - temporary work vector +- `vb` - right-hand-side vector + +Output Parameter: +- `vres` - calculated residual + +Level: developer + +-seealso: [](ch_ksp), `KSP`, `KSPSolve()`, `KSPMonitor()` + +# External Links +$(_doc_external("KSP/KSPInitialResidual")) +""" +function KSPInitialResidual(petsclib::PetscLibType, ksp::PetscKSP, vsoln::PetscVec, vt1::PetscVec, vt2::PetscVec, vres::PetscVec, vb::PetscVec) end + +@for_petsc function KSPInitialResidual(petsclib::$UnionPetscLib, ksp::PetscKSP, vsoln::PetscVec, vt1::PetscVec, vt2::PetscVec, vres::PetscVec, vb::PetscVec ) + + @chk ccall( + (:KSPInitialResidual, $petsc_library), + PetscErrorCode, + (CKSP, CVec, CVec, CVec, CVec, CVec), + ksp, vsoln, vt1, vt2, vres, vb, + ) + + + return nothing +end + +""" + KSPUnwindPreconditioner(petsclib::PetscLibType,ksp::PetscKSP, vsoln::PetscVec, vt1::PetscVec) +Unwinds the preconditioning in the solution. That is, +takes solution to the preconditioned problem and gets the solution to the +original problem from it. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `vsoln` - solution vector +- `vt1` - temporary work vector + +Output Parameter: +- `vsoln` - contains solution on output + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPSetPCSide()` + +# External Links +$(_doc_external("KSP/KSPUnwindPreconditioner")) +""" +function KSPUnwindPreconditioner(petsclib::PetscLibType, ksp::PetscKSP, vsoln::PetscVec, vt1::PetscVec) end + +@for_petsc function KSPUnwindPreconditioner(petsclib::$UnionPetscLib, ksp::PetscKSP, vsoln::PetscVec, vt1::PetscVec ) + + @chk ccall( + (:KSPUnwindPreconditioner, $petsc_library), + PetscErrorCode, + (CKSP, CVec, CVec), + ksp, vsoln, vt1, + ) + + + return nothing +end + +""" + KSPLoad(petsclib::PetscLibType,newdm::PetscKSP, viewer::PetscViewer) +Loads a `KSP` that has been stored in a `PETSCVIEWERBINARY` with `KSPView()`. + +Collective + +Input Parameters: +- `newdm` - the newly loaded `KSP`, this needs to have been created with `KSPCreate()` or +some related function before a call to `KSPLoad()`. +- `viewer` - binary file viewer, obtained from `PetscViewerBinaryOpen()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `PetscViewerBinaryOpen()`, `KSPView()`, `MatLoad()`, `VecLoad()` + +# External Links +$(_doc_external("KSP/KSPLoad")) +""" +function KSPLoad(petsclib::PetscLibType, newdm::PetscKSP, viewer::PetscViewer) end + +@for_petsc function KSPLoad(petsclib::$UnionPetscLib, newdm::PetscKSP, viewer::PetscViewer ) + + @chk ccall( + (:KSPLoad, $petsc_library), + PetscErrorCode, + (CKSP, PetscViewer), + newdm, viewer, + ) + + + return nothing +end + +""" + KSPView(petsclib::PetscLibType,ksp::PetscKSP, viewer::PetscViewer) +Prints the various parameters currently set in the `KSP` object. For example, the convergence tolerances and `KSPType`. +Also views the `PC` and `Mat` contained by the `KSP` with `PCView()` and `MatView()`. + +Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `viewer` - visualization context + +Options Database Key: +- `-ksp_view` - print the `KSP` data structure at the end of each `KSPSolve()` call + +Level: beginner + +-seealso: [](ch_ksp), `KSP`, `PetscViewer`, `PCView()`, `PetscViewerASCIIOpen()`, `KSPViewFromOptions()` + +# External Links +$(_doc_external("KSP/KSPView")) +""" +function KSPView(petsclib::PetscLibType, ksp::PetscKSP, viewer::PetscViewer) end + +@for_petsc function KSPView(petsclib::$UnionPetscLib, ksp::PetscKSP, viewer::PetscViewer ) + + @chk ccall( + (:KSPView, $petsc_library), + PetscErrorCode, + (CKSP, PetscViewer), + ksp, viewer, + ) + + + return nothing +end + +""" + KSPViewFromOptions(petsclib::PetscLibType,A::PetscKSP, obj::PetscObject, name::String) +View (print) a `KSP` object based on values in the options database. Also views the `PC` and `Mat` contained by the `KSP` +with `PCView()` and `MatView()`. + +Collective + +Input Parameters: +- `A` - Krylov solver context +- `obj` - Optional object that provides the options prefix used to query the options database +- `name` - command line option + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPView()`, `PetscObjectViewFromOptions()`, `KSPCreate()` + +# External Links +$(_doc_external("KSP/KSPViewFromOptions")) +""" +function KSPViewFromOptions(petsclib::PetscLibType, A::PetscKSP, obj::PetscObject, name::String) end + +@for_petsc function KSPViewFromOptions(petsclib::$UnionPetscLib, A::PetscKSP, obj::PetscObject, name::String ) + + @chk ccall( + (:KSPViewFromOptions, $petsc_library), + PetscErrorCode, + (CKSP, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + KSPSetNormType(petsclib::PetscLibType,ksp::PetscKSP, normtype::KSPNormType) +Sets the type of residual norm that is used for convergence testing in `KSPSolve()` for the given `KSP` context + +Logically Collective + +Input Parameters: +- `ksp` - Krylov solver context +- `normtype` - one of +-seealso: [](ch_ksp), `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSPConvergedSkip()`, `KSPSetCheckNormIteration()`, `KSPSetPCSide()`, `KSPGetPCSide()`, `KSPNormType` + +# External Links +$(_doc_external("KSP/KSPSetNormType")) +""" +function KSPSetNormType(petsclib::PetscLibType, ksp::PetscKSP, normtype::KSPNormType) end + +@for_petsc function KSPSetNormType(petsclib::$UnionPetscLib, ksp::PetscKSP, normtype::KSPNormType ) + + @chk ccall( + (:KSPSetNormType, $petsc_library), + PetscErrorCode, + (CKSP, KSPNormType), + ksp, normtype, + ) + + + return nothing +end + +""" + KSPSetCheckNormIteration(petsclib::PetscLibType,ksp::PetscKSP, it::PetscInt) +Sets the first iteration at which the norm of the residual will be +computed and used in the convergence test of `KSPSolve()` for the given `KSP` context + +Logically Collective + +Input Parameters: +- `ksp` - Krylov solver context +- `it` - use -1 to check at all iterations + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSPConvergedSkip()`, `KSPSetNormType()`, `KSPSetLagNorm()` + +# External Links +$(_doc_external("KSP/KSPSetCheckNormIteration")) +""" +function KSPSetCheckNormIteration(petsclib::PetscLibType, ksp::PetscKSP, it::PetscInt) end + +@for_petsc function KSPSetCheckNormIteration(petsclib::$UnionPetscLib, ksp::PetscKSP, it::$PetscInt ) + + @chk ccall( + (:KSPSetCheckNormIteration, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, it, + ) + + + return nothing +end + +""" + KSPSetLagNorm(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Lags the residual norm calculation so that it is computed as part of the `MPI_Allreduce()` used for +computing the inner products needed for the next iteration. + +Logically Collective + +Input Parameters: +- `ksp` - Krylov solver context +- `flg` - `PETSC_TRUE` or `PETSC_FALSE` + +Options Database Key: +- `-ksp_lag_norm` - lag the calculated residual norm + +Level: advanced + +-seealso: [](ch_ksp), `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSPConvergedSkip()`, `KSPSetNormType()`, `KSPSetCheckNormIteration()` + +# External Links +$(_doc_external("KSP/KSPSetLagNorm")) +""" +function KSPSetLagNorm(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPSetLagNorm(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPSetLagNorm, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + KSPSetSupportedNorm(petsclib::PetscLibType,ksp::PetscKSP, normtype::KSPNormType, pcside::PCSide, priority::PetscInt) +Sets a norm and preconditioner side supported by a `KSPType` + +Logically Collective + +Input Parameters: +- `ksp` - Krylov method +- `normtype` - supported norm type of the type `KSPNormType` +- `pcside` - preconditioner side, of the type `PCSide` that can be used with this `KSPNormType` +- `priority` - positive integer preference for this combination; larger values have higher priority + +Level: developer + +-seealso: [](ch_ksp), `KSP`, `KSPNormType`, `PCSide`, `KSPSetNormType()`, `KSPSetPCSide()` + +# External Links +$(_doc_external("KSP/KSPSetSupportedNorm")) +""" +function KSPSetSupportedNorm(petsclib::PetscLibType, ksp::PetscKSP, normtype::KSPNormType, pcside::PCSide, priority::PetscInt) end + +@for_petsc function KSPSetSupportedNorm(petsclib::$UnionPetscLib, ksp::PetscKSP, normtype::KSPNormType, pcside::PCSide, priority::$PetscInt ) + + @chk ccall( + (:KSPSetSupportedNorm, $petsc_library), + PetscErrorCode, + (CKSP, KSPNormType, PCSide, $PetscInt), + ksp, normtype, pcside, priority, + ) + + + return nothing +end + +""" + normtype::KSPNormType = KSPGetNormType(petsclib::PetscLibType,ksp::PetscKSP) +Gets the `KSPNormType` that is used for convergence testing during `KSPSolve()` for this `KSP` context + +Not Collective + +Input Parameter: +- `ksp` - Krylov solver context + +Output Parameter: +- `normtype` - the `KSPNormType` that is used for convergence testing + +Level: advanced + +-seealso: [](ch_ksp), `KSPNormType`, `KSPSetNormType()`, `KSPConvergedSkip()` + +# External Links +$(_doc_external("KSP/KSPGetNormType")) +""" +function KSPGetNormType(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetNormType(petsclib::$UnionPetscLib, ksp::PetscKSP ) + normtype_ = Ref{KSPNormType}() + + @chk ccall( + (:KSPGetNormType, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPNormType}), + ksp, normtype_, + ) + + normtype = unsafe_string(normtype_[]) + + return normtype +end + +""" + KSPSetOperators(petsclib::PetscLibType,ksp::PetscKSP, Amat::PetscMat, Pmat::PetscMat) +Sets the matrix associated with the linear system +and a (possibly) different one from which the preconditioner will be built into the `KSP` context. The matrix will then be used during `KSPSolve()` + +Collective + +Input Parameters: +- `ksp` - the `KSP` context +- `Amat` - the matrix that defines the linear system +- `Pmat` - the matrix to be used in constructing the preconditioner, usually the same as `Amat`. + +Level: beginner + +-seealso: [](ch_ksp), `KSP`, `Mat`, `KSPSolve()`, `KSPGetPC()`, `PCGetOperators()`, `PCSetOperators()`, `KSPGetOperators()`, `KSPSetComputeOperators()`, `KSPSetComputeInitialGuess()`, `KSPSetComputeRHS()` + +# External Links +$(_doc_external("KSP/KSPSetOperators")) +""" +function KSPSetOperators(petsclib::PetscLibType, ksp::AbstractPetscKSP, Amat::AbstractPetscMat, Pmat::AbstractPetscMat) end + +@for_petsc function KSPSetOperators(petsclib::$UnionPetscLib, ksp::AbstractPetscKSP, Amat::AbstractPetscMat, Pmat::AbstractPetscMat ) + + @chk ccall( + (:KSPSetOperators, $petsc_library), + PetscErrorCode, + (CKSP, CMat, CMat), + ksp, Amat, Pmat, + ) + + + return nothing +end + +""" + Amat, PMat = KSPGetOperators(petsclib::PetscLibType,ksp::PetscKSP) +Gets the matrix associated with the linear system +and a (possibly) different one used to construct the preconditioner from the `KSP` context + +Collective + +Input Parameter: +- `ksp` - the `KSP` context + +Output Parameters: +- `Amat` - the matrix that defines the linear system +- `Pmat` - the matrix to be used in constructing the preconditioner, usually the same as `Amat`. + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPSolve()`, `KSPGetPC()`, `PCSetOperators()`, `KSPSetOperators()`, `KSPGetOperatorsSet()` + +# External Links +$(_doc_external("KSP/KSPGetOperators")) +""" +function KSPGetOperators(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetOperators(petsclib::$UnionPetscLib, ksp::PetscKSP) + Amat_ = Ref{CVec}() + Pmat_ = Ref{CVec}() + + @chk ccall( + (:KSPGetOperators, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{CMat}, Ptr{CMat}), + ksp, Amat_, Pmat_, + ) + + Amat = PetscMat(Amat_[], petsclib) + Pmat = PetscMat(Pmat_[], petsclib) + + return Amat, Pmat +end + +""" + mat::PetscBool,pmat::PetscBool = KSPGetOperatorsSet(petsclib::PetscLibType,ksp::PetscKSP) +Determines if the matrix associated with the linear system and +possibly a different one from which the preconditioner will be built have been set in the `KSP` with `KSPSetOperators()` + +Not Collective, though the results on all processes will be the same + +Input Parameter: +- `ksp` - the `KSP` context + +Output Parameters: +- `mat` - the matrix associated with the linear system was set +- `pmat` - matrix from which the preconditioner will be built, usually the same as `mat` was set + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `PCSetOperators()`, `KSPGetOperators()`, `KSPSetOperators()`, `PCGetOperators()`, `PCGetOperatorsSet()` + +# External Links +$(_doc_external("KSP/KSPGetOperatorsSet")) +""" +function KSPGetOperatorsSet(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetOperatorsSet(petsclib::$UnionPetscLib, ksp::PetscKSP ) + mat_ = Ref{PetscBool}() + pmat_ = Ref{PetscBool}() + + @chk ccall( + (:KSPGetOperatorsSet, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}, Ptr{PetscBool}), + ksp, mat_, pmat_, + ) + + mat = mat_[] + pmat = pmat_[] + + return mat,pmat +end + +""" + KSPSetPreSolve(petsclib::PetscLibType,ksp::PetscKSP, presolve::KSPPSolveFn, ctx::Cvoid) +Sets a function that is called at the beginning of each `KSPSolve()`. Used in conjunction with `KSPSetPostSolve()`. + +Logically Collective + +Input Parameters: +- `ksp` - the solver object +- `presolve` - the function to call before the solve, see` KSPPSolveFn` +- `ctx` - an optional context needed by the function + +Level: developer + +-seealso: [](ch_ksp), `KSPPSolveFn`, `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSP`, `KSPSetPostSolve()`, `PCEISENSTAT`, `PCPreSolve()`, `PCPostSolve()` + +# External Links +$(_doc_external("KSP/KSPSetPreSolve")) +""" +function KSPSetPreSolve(petsclib::PetscLibType, ksp::PetscKSP, presolve::KSPPSolveFn, ctx::Cvoid) end + +@for_petsc function KSPSetPreSolve(petsclib::$UnionPetscLib, ksp::PetscKSP, presolve::KSPPSolveFn, ctx::Cvoid ) + + @chk ccall( + (:KSPSetPreSolve, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPPSolveFn}, Ptr{Cvoid}), + ksp, presolve, ctx, + ) + + + return nothing +end + +""" + KSPSetPostSolve(petsclib::PetscLibType,ksp::PetscKSP, postsolve::KSPPSolveFn, ctx::Cvoid) +Sets a function that is called at the end of each `KSPSolve()` (whether it converges or not). Used in conjunction with `KSPSetPreSolve()`. + +Logically Collective + +Input Parameters: +- `ksp` - the solver object +- `postsolve` - the function to call after the solve, see` KSPPSolveFn` +- `ctx` - an optional context needed by the function + +Level: developer + +-seealso: [](ch_ksp), `KSPPSolveFn`, `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSP`, `KSPSetPreSolve()`, `PCEISENSTAT` + +# External Links +$(_doc_external("KSP/KSPSetPostSolve")) +""" +function KSPSetPostSolve(petsclib::PetscLibType, ksp::PetscKSP, postsolve::KSPPSolveFn, ctx::Cvoid) end + +@for_petsc function KSPSetPostSolve(petsclib::$UnionPetscLib, ksp::PetscKSP, postsolve::KSPPSolveFn, ctx::Cvoid ) + + @chk ccall( + (:KSPSetPostSolve, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPPSolveFn}, Ptr{Cvoid}), + ksp, postsolve, ctx, + ) + + + return nothing +end + +""" + KSPSetNestLevel(petsclib::PetscLibType,ksp::PetscKSP, level::PetscInt) +sets the amount of nesting the `KSP` has. That is the number of levels of `KSP` above this `KSP` in a linear solve. + +Collective + +Input Parameters: +- `ksp` - the `KSP` +- `level` - the nest level + +Level: developer + +-seealso: [](ch_ksp), `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSP`, `KSPGMRES`, `KSPType`, `KSPGetNestLevel()`, `PCSetKSPNestLevel()`, `PCGetKSPNestLevel()` + +# External Links +$(_doc_external("KSP/KSPSetNestLevel")) +""" +function KSPSetNestLevel(petsclib::PetscLibType, ksp::PetscKSP, level::PetscInt) end + +@for_petsc function KSPSetNestLevel(petsclib::$UnionPetscLib, ksp::PetscKSP, level::$PetscInt ) + + @chk ccall( + (:KSPSetNestLevel, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, level, + ) + + + return nothing +end + +""" + level::PetscInt = KSPGetNestLevel(petsclib::PetscLibType,ksp::PetscKSP) +gets the amount of nesting the `KSP` has + +Not Collective + +Input Parameter: +- `ksp` - the `KSP` + +Output Parameter: +- `level` - the nest level + +Level: developer + +-seealso: [](ch_ksp), `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSP`, `KSPGMRES`, `KSPType`, `KSPSetNestLevel()`, `PCSetKSPNestLevel()`, `PCGetKSPNestLevel()` + +# External Links +$(_doc_external("KSP/KSPGetNestLevel")) +""" +function KSPGetNestLevel(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetNestLevel(petsclib::$UnionPetscLib, ksp::PetscKSP ) + level_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPGetNestLevel, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, level_, + ) + + level = level_[] + + return level +end + +""" + inksp::PetscKSP = KSPCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates the `KSP` context. This `KSP` context is used in PETSc to solve linear systems with `KSPSolve()` + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `inksp` - location to put the `KSP` context + +Level: beginner + +-seealso: [](ch_ksp), `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSP`, `KSPGMRES`, `KSPType`, `KSPSetType()` + +# External Links +$(_doc_external("KSP/KSPCreate")) +""" +function KSPCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function KSPCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + inksp_ = Ref{CKSP}() + + @chk ccall( + (:KSPCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CKSP}), + comm, inksp_, + ) + + inksp = PetscKSP(inksp_[], petsclib) + + return inksp +end + +""" + KSPSetType(petsclib::PetscLibType,ksp::PetscKSP, type::KSPType) +Sets the algorithm/method to be used to solve the linear system with the given `KSP` + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `type` - a known method + +Options Database Key: +- `-ksp_type ` - Sets the method; see `KSPGType` or use `-help` for a list of available methods (for instance, cg or gmres) + +Level: intermediate + +-seealso: [](ch_ksp), `PCSetType()`, `KSPType`, `KSPRegister()`, `KSPCreate()`, `KSP` + +# External Links +$(_doc_external("KSP/KSPSetType")) +""" +function KSPSetType(petsclib::PetscLibType, ksp::PetscKSP, type::KSPType) end + +@for_petsc function KSPSetType(petsclib::$UnionPetscLib, ksp::PetscKSP, type::KSPType ) + + @chk ccall( + (:KSPSetType, $petsc_library), + PetscErrorCode, + (CKSP, KSPType), + ksp, type, + ) + + + return nothing +end + +""" + type::KSPType = KSPGetType(petsclib::PetscLibType,ksp::PetscKSP) +Gets the `KSP` type as a string from the `KSP` object. + +Not Collective + +Input Parameter: +- `ksp` - Krylov context + +Output Parameter: +- `type` - name of the `KSP` method + +Level: intermediate + +-seealso: [](ch_ksp), `KSPType`, `KSP`, `KSPSetType()` + +# External Links +$(_doc_external("KSP/KSPGetType")) +""" +function KSPGetType(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetType(petsclib::$UnionPetscLib, ksp::PetscKSP ) + type_ = Ref{KSPType}() + + @chk ccall( + (:KSPGetType, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPType}), + ksp, type_, + ) + + if type_[] == C_NULL + type = "" + else + type = unsafe_string(type_[]) + end + + return type +end + +""" + KSPRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a method, `KSPType`, to the Krylov subspace solver package. + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined solver +- `function` - routine to create method + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPType`, `KSPSetType`, `KSPRegisterAll()` + +# External Links +$(_doc_external("KSP/KSPRegister")) +""" +function KSPRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function KSPRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:KSPRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + KSPMonitorRegister(petsclib::PetscLibType,name::String, vtype::PetscViewerType, format::PetscViewerFormat, monitor::KSPMonitorRegisterFn, create::KSPMonitorRegisterCreateFn, destroy::KSPMonitorRegisterDestroyFn) +Registers a Krylov subspace solver monitor routine that may be accessed with `KSPMonitorSetFromOptions()` + +Not Collective + +Input Parameters: +- `name` - name of a new monitor type +- `vtype` - A `PetscViewerType` for the output +- `format` - A `PetscViewerFormat` for the output +- `monitor` - Monitor routine, see `KSPMonitorRegisterFn` +- `create` - Creation routine, or `NULL` +- `destroy` - Destruction routine, or `NULL` + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorRegisterAll()`, `KSPMonitorSetFromOptions()` + +# External Links +$(_doc_external("KSP/KSPMonitorRegister")) +""" +function KSPMonitorRegister(petsclib::PetscLibType, name::String, vtype::PetscViewerType, format::PetscViewerFormat, monitor::KSPMonitorRegisterFn, create::KSPMonitorRegisterCreateFn, destroy::KSPMonitorRegisterDestroyFn) end + +@for_petsc function KSPMonitorRegister(petsclib::$UnionPetscLib, name::String, vtype::PetscViewerType, format::PetscViewerFormat, monitor::KSPMonitorRegisterFn, create::KSPMonitorRegisterCreateFn, destroy::KSPMonitorRegisterDestroyFn ) + + @chk ccall( + (:KSPMonitorRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, PetscViewerType, PetscViewerFormat, Ptr{KSPMonitorRegisterFn}, Ptr{KSPMonitorRegisterCreateFn}, Ptr{KSPMonitorRegisterDestroyFn}), + name, vtype, format, monitor, create, destroy, + ) + + + return nothing +end + +""" + KSPSetOptionsPrefix(petsclib::PetscLibType,ksp::PetscKSP, prefix::String) +Sets the prefix used for searching for all +`KSP` options in the database. + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov context +- `prefix` - the prefix string to prepend to all `KSP` option requests + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPAppendOptionsPrefix()`, `KSPGetOptionsPrefix()`, `KSPSetFromOptions()` + +# External Links +$(_doc_external("KSP/KSPSetOptionsPrefix")) +""" +function KSPSetOptionsPrefix(petsclib::PetscLibType, ksp::PetscKSP, prefix::String) end + +@for_petsc function KSPSetOptionsPrefix(petsclib::$UnionPetscLib, ksp::PetscKSP, prefix::String ) + + @chk ccall( + (:KSPSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Cchar}), + ksp, prefix, + ) + + + return nothing +end + +""" + KSPAppendOptionsPrefix(petsclib::PetscLibType,ksp::PetscKSP, prefix::String) +Appends to the prefix used for searching for all +`KSP` options in the database. + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov context +- `prefix` - the prefix string to prepend to all `KSP` option requests + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPSetOptionsPrefix()`, `KSPGetOptionsPrefix()`, `KSPSetFromOptions()` + +# External Links +$(_doc_external("KSP/KSPAppendOptionsPrefix")) +""" +function KSPAppendOptionsPrefix(petsclib::PetscLibType, ksp::PetscKSP, prefix::String) end + +@for_petsc function KSPAppendOptionsPrefix(petsclib::$UnionPetscLib, ksp::PetscKSP, prefix::String ) + + @chk ccall( + (:KSPAppendOptionsPrefix, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Cchar}), + ksp, prefix, + ) + + + return nothing +end + +""" + KSPSetUseFischerGuess(petsclib::PetscLibType,ksp::PetscKSP, model::PetscInt, size::PetscInt) +Use the Paul Fischer algorithm or its variants to compute initial guesses for a set of solves with related right + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov context +- `model` - use model 1, model 2, model 3, or any other number to turn it off +- `size` - size of subspace used to generate initial guess + +Options Database Key: +- `-ksp_fischer_guess ` - uses the Fischer initial guess generator for repeated linear solves + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPSetOptionsPrefix()`, `KSPAppendOptionsPrefix()`, `KSPSetGuess()`, `KSPGetGuess()`, `KSPGuess` + +# External Links +$(_doc_external("KSP/KSPSetUseFischerGuess")) +""" +function KSPSetUseFischerGuess(petsclib::PetscLibType, ksp::PetscKSP, model::PetscInt, size::PetscInt) end + +@for_petsc function KSPSetUseFischerGuess(petsclib::$UnionPetscLib, ksp::PetscKSP, model::$PetscInt, size::$PetscInt ) + + @chk ccall( + (:KSPSetUseFischerGuess, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscInt), + ksp, model, size, + ) + + + return nothing +end + +""" + KSPSetGuess(petsclib::PetscLibType,ksp::PetscKSP, guess::KSPGuess) +Set the initial guess object `KSPGuess` to be used by the `KSP` object to generate initial guesses + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov context +- `guess` - the object created with `KSPGuessCreate()` + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPGuess`, `KSPSetOptionsPrefix()`, `KSPAppendOptionsPrefix()`, `KSPSetUseFischerGuess()`, `KSPGetGuess()` + +# External Links +$(_doc_external("KSP/KSPSetGuess")) +""" +function KSPSetGuess(petsclib::PetscLibType, ksp::PetscKSP, guess::KSPGuess) end + +@for_petsc function KSPSetGuess(petsclib::$UnionPetscLib, ksp::PetscKSP, guess::KSPGuess ) + + @chk ccall( + (:KSPSetGuess, $petsc_library), + PetscErrorCode, + (CKSP, KSPGuess), + ksp, guess, + ) + + + return nothing +end + +""" + KSPGetGuess(petsclib::PetscLibType,ksp::PetscKSP, guess::KSPGuess) +Gets the initial guess generator for the `KSP`. + +Not Collective + +Input Parameter: +- `ksp` - the Krylov context + +Output Parameter: +- `guess` - the object + +Level: developer + +-seealso: [](ch_ksp), `KSPGuess`, `KSP`, `KSPSetOptionsPrefix()`, `KSPAppendOptionsPrefix()`, `KSPSetUseFischerGuess()`, `KSPSetGuess()` + +# External Links +$(_doc_external("KSP/KSPGetGuess")) +""" +function KSPGetGuess(petsclib::PetscLibType, ksp::PetscKSP, guess::KSPGuess) end + +@for_petsc function KSPGetGuess(petsclib::$UnionPetscLib, ksp::PetscKSP, guess::KSPGuess ) + + @chk ccall( + (:KSPGetGuess, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPGuess}), + ksp, guess, + ) + + + return nothing +end + +""" + prefix::String = KSPGetOptionsPrefix(petsclib::PetscLibType,ksp::PetscKSP) +Gets the prefix used for searching for all `KSP` options in the database. + +Not Collective + +Input Parameter: +- `ksp` - the Krylov context + +Output Parameter: +- `prefix` - pointer to the prefix string used is returned + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPSetFromOptions()`, `KSPSetOptionsPrefix()`, `KSPAppendOptionsPrefix()` + +# External Links +$(_doc_external("KSP/KSPGetOptionsPrefix")) +""" +function KSPGetOptionsPrefix(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGetOptionsPrefix(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + prefix_ = Ref{Ptr{Int8}}() + + @chk ccall( + (:KSPGetOptionsPrefix, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Ptr{Cchar}}), + ksp, prefix_, + ) + + if prefix_[] == C_NULL + prefix = "" + else + prefix = unsafe_string(prefix_[]) + end + + return prefix +end + +""" + KSPMonitorSetFromOptions(petsclib::PetscLibType,ksp::PetscKSP, opt::String, name::String, ctx::Cvoid) +Sets a monitor function and viewer appropriate for the type indicated by the user in the options database + +Collective + +Input Parameters: +- `ksp` - `KSP` object you wish to monitor +- `opt` - the command line option for this monitor +- `name` - the monitor type one is seeking +- `ctx` - An optional user context for the monitor, or `NULL` + +Level: developer + +-seealso: [](ch_ksp), `KSPMonitorRegister()`, `KSPMonitorSet()`, `PetscOptionsCreateViewer()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, +`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` +`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("KSP/KSPMonitorSetFromOptions")) +""" +function KSPMonitorSetFromOptions(petsclib::PetscLibType, ksp::PetscKSP, opt::String, name::String, ctx::Cvoid) end + +@for_petsc function KSPMonitorSetFromOptions(petsclib::$UnionPetscLib, ksp::PetscKSP, opt::String, name::String, ctx::Cvoid ) + + @chk ccall( + (:KSPMonitorSetFromOptions, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cvoid}), + ksp, opt, name, ctx, + ) + + + return nothing +end + +""" + KSPSetFromOptions(petsclib::PetscLibType,ksp::PetscKSP) +Sets `KSP` options from the options database. +This routine must be called before `KSPSetUp()` if the user is to be +allowed to set the Krylov type. + +Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Options Database Keys: +- `-ksp_rtol rtol` - relative tolerance used in default determination of convergence, i.e. +if residual norm decreases by this factor than convergence is declared +- `-ksp_atol abstol` - absolute tolerance used in default convergence test, i.e. if residual +norm is less than this then convergence is declared +- `-ksp_divtol tol` - if residual norm increases by this factor than divergence is declared +- `-ksp_max_it` - maximum number of linear iterations +- `-ksp_min_it` - minimum number of linear iterations to use, defaults to zero + +- `-ksp_reuse_preconditioner ` - reuse the previously computed preconditioner + +- `-ksp_converged_use_initial_residual_norm` - see `KSPConvergedDefaultSetUIRNorm()` +- `-ksp_converged_use_min_initial_residual_norm` - see `KSPConvergedDefaultSetUMIRNorm()` +- `-ksp_converged_maxits` - see `KSPConvergedDefaultSetConvergedMaxits()` +- `-ksp_norm_type ` - see `KSPSetNormType()` +- `-ksp_check_norm_iteration it` - do not compute residual norm until iteration number it (does compute at 0th iteration) +works only for `KSPBCGS`, `KSPIBCGS`, and `KSPCG` +- `-ksp_lag_norm` - compute the norm of the residual for the ith iteration on the i+1 iteration; +this means that one can use the norm of the residual for convergence test WITHOUT +an extra `MPI_Allreduce()` limiting global synchronizations. +This will require 1 more iteration of the solver than usual. +- `-ksp_guess_type` - Type of initial guess generator for repeated linear solves +- `-ksp_fischer_guess ` - uses the Fischer initial guess generator for repeated linear solves +- `-ksp_constant_null_space` - assume the operator (matrix) has the constant vector in its null space +- `-ksp_test_null_space` - tests the null space set with `MatSetNullSpace()` to see if it truly is a null space +- `-ksp_knoll` - compute initial guess by applying the preconditioner to the right-hand side +- `-ksp_monitor_cancel` - cancel all previous convergene monitor routines set +- `-ksp_monitor` - print residual norm at each iteration +- `-ksp_monitor draw::draw_lg` - plot residual norm at each iteration, see `KSPMonitorResidual()` +- `-ksp_monitor_true_residual` - print the true l2 residual norm at each iteration, see `KSPMonitorTrueResidual()` +- `-all_ksp_monitor ` - print residual norm at each iteration for ALL KSP solves, regardless of their prefix. This is +useful for `PCFIELDSPLIT`, `PCMG`, etc that have inner solvers and +you wish to track the convergence of all the solvers +- `-ksp_monitor_solution [ascii binary or draw][:filename][:format option]` - plot solution at each iteration +- `-ksp_monitor_singular_value` - monitor extreme singular values at each iteration +- `-ksp_converged_reason` - view the convergence state at the end of the solve +- `-ksp_use_explicittranspose` - transpose the system explicitly in `KSPSolveTranspose()` +- `-ksp_error_if_not_converged` - stop the program as soon as an error is detected in a `KSPSolve()`, `KSP_DIVERGED_ITS` +is not treated as an error on inner solves +- `-ksp_converged_rate` - view the convergence rate at the end of the solve + +Level: beginner + +-seealso: [](ch_ksp), `KSP`, `KSPSetOptionsPrefix()`, `KSPResetFromOptions()`, `KSPSetUseFischerGuess()` + +# External Links +$(_doc_external("KSP/KSPSetFromOptions")) +""" +function KSPSetFromOptions(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPSetFromOptions(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPSetFromOptions, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPResetFromOptions(petsclib::PetscLibType,ksp::PetscKSP) +Sets `KSP` parameters from user options ONLY if the `KSP` was previously set from options + +Collective + +Input Parameter: +- `ksp` - the `KSP` context + +Level: advanced + +-seealso: [](ch_ksp), `KSPSetFromOptions()`, `KSPSetOptionsPrefix()` + +# External Links +$(_doc_external("KSP/KSPResetFromOptions")) +""" +function KSPResetFromOptions(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPResetFromOptions(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPResetFromOptions, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the `KSP` package. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: [](ch_ksp), `PetscFinalize()`, `KSPInitializePackage()` + +# External Links +$(_doc_external("KSP/KSPFinalizePackage")) +""" +function KSPFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function KSPFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:KSPFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + KSPInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `KSP` package. It is called +from `PetscDLLibraryRegister_petscksp()` when using dynamic libraries, and on the first call to `KSPCreate()` +when using shared or static libraries. + +Level: developer + +-seealso: [](ch_ksp), `PetscInitialize()`, `KSPFinalizePackage()` + +# External Links +$(_doc_external("KSP/KSPInitializePackage")) +""" +function KSPInitializePackage(petsclib::PetscLibType) end + +@for_petsc function KSPInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:KSPInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + ctx::Cvoid = KSPMonitorSAWsCreate(petsclib::PetscLibType,ksp::PetscKSP) +create an SAWs monitor context for `KSP` + +Collective + +Input Parameter: +- `ksp` - `KSP` to monitor + +Output Parameter: +- `ctx` - context for monitor + +Level: developer + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorSAWs()`, `KSPMonitorSAWsDestroy()` + +# External Links +$(_doc_external("KSP/KSPMonitorSAWsCreate")) +""" +function KSPMonitorSAWsCreate(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPMonitorSAWsCreate(petsclib::$UnionPetscLib, ksp::PetscKSP ) + ctx_ = Ref{Cvoid}() + + @chk ccall( + (:KSPMonitorSAWsCreate, $petsc_library), + PetscErrorCode, + (CKSP, Cvoid), + ksp, ctx_, + ) + + ctx = ctx_[] + + return ctx +end + +""" + KSPMonitorSAWsDestroy(petsclib::PetscLibType,ctx::Cvoid) +destroy a monitor context created with `KSPMonitorSAWsCreate()` + +Collective + +Input Parameter: +- `ctx` - monitor context + +Level: developer + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorSAWsCreate()` + +# External Links +$(_doc_external("KSP/KSPMonitorSAWsDestroy")) +""" +function KSPMonitorSAWsDestroy(petsclib::PetscLibType, ctx::Cvoid) end + +@for_petsc function KSPMonitorSAWsDestroy(petsclib::$UnionPetscLib, ctx::Cvoid ) + + @chk ccall( + (:KSPMonitorSAWsDestroy, $petsc_library), + PetscErrorCode, + (Cvoid,), + ctx, + ) + + + return nothing +end + +""" + KSPMonitorSAWs(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, ctx::Cvoid) +monitor `KSP` solution using SAWs + +Logically Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `ctx` - created with `KSPMonitorSAWsCreate()` + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPMonitorSet()`, `KSPMonitorSAWsCreate()`, `KSPMonitorSAWsDestroy()`, `KSPMonitorSingularValue()`, `KSPComputeExtremeSingularValues()`, `PetscViewerSAWsOpen()` + +# External Links +$(_doc_external("KSP/KSPMonitorSAWs")) +""" +function KSPMonitorSAWs(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, ctx::Cvoid) end + +@for_petsc function KSPMonitorSAWs(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, ctx::Cvoid ) + + @chk ccall( + (:KSPMonitorSAWs, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{Cvoid}), + ksp, n, rnorm, ctx, + ) + + + return nothing +end + +""" + KSPGMRESSetPreAllocateVectors(petsclib::PetscLibType,ksp::PetscKSP) +Causes `KSPGMRES` and `KSPFGMRES` to preallocate all its +needed work vectors at initial setup rather than the default, which +is to allocate several at a time when needed. + +Logically Collective + +Input Parameter: +- `ksp` - iterative context obtained from `KSPCreate()` + +Options Database Key: +- `-ksp_gmres_preallocate` - Activates `KSPGmresSetPreAllocateVectors()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGMRESSetRestart()`, `KSPGMRESSetOrthogonalization()`, `KSPGMRESGetOrthogonalization()`, +`VecMDot()`, `VecMAXPY()` + +# External Links +$(_doc_external("KSP/KSPGMRESSetPreAllocateVectors")) +""" +function KSPGMRESSetPreAllocateVectors(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGMRESSetPreAllocateVectors(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPGMRESSetPreAllocateVectors, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPGMRESClassicalGramSchmidtOrthogonalization(petsclib::PetscLibType,ksp::PetscKSP, it::PetscInt) +This is the basic orthogonalization routine +using classical Gram-Schmidt with possible iterative refinement to improve the stability + +Collective, No Fortran Support + +Input Parameters: +- `ksp` - `KSP` object, must be associated with `KSPGMRES`, `KSPFGMRES`, or `KSPLGMRES` Krylov method +- `it` - one less than the current GMRES restart iteration, i.e. the size of the Krylov space + +Options Database Keys: +- `-ksp_gmres_classicalgramschmidt` - Activates `KSPGMRESClassicalGramSchmidtOrthogonalization()` +- `-ksp_gmres_cgs_refinement_type ` - determine if iterative refinement is +used to increase the stability of the classical Gram-Schmidt orthogonalization. + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGMRESCGSRefinementType`, `KSPGMRESSetOrthogonalization()`, `KSPGMRESSetCGSRefinementType()`, +`KSPGMRESGetCGSRefinementType()`, `KSPGMRESGetOrthogonalization()`, `KSPGMRESModifiedGramSchmidtOrthogonalization()` + +# External Links +$(_doc_external("KSP/KSPGMRESClassicalGramSchmidtOrthogonalization")) +""" +function KSPGMRESClassicalGramSchmidtOrthogonalization(petsclib::PetscLibType, ksp::PetscKSP, it::PetscInt) end + +@for_petsc function KSPGMRESClassicalGramSchmidtOrthogonalization(petsclib::$UnionPetscLib, ksp::PetscKSP, it::$PetscInt ) + + @chk ccall( + (:KSPGMRESClassicalGramSchmidtOrthogonalization, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, it, + ) + + + return nothing +end + +""" + KSPGMRESSetOrthogonalization(petsclib::PetscLibType,ksp::PetscKSP, fcn::external) +Sets the orthogonalization routine used by `KSPGMRES` and `KSPFGMRES`. + +Logically Collective + +Input Parameters: +- `ksp` - iterative context obtained from `KSPCreate()` +- `fcn` - orthogonalization function + +Calling sequence of `fcn`: +- `ksp` - the solver context +- `it` - the current iteration + +Options Database Keys: +- `-ksp_gmres_classicalgramschmidt` - Activates KSPGMRESClassicalGramSchmidtOrthogonalization() (default) +- `-ksp_gmres_modifiedgramschmidt` - Activates KSPGMRESModifiedGramSchmidtOrthogonalization() + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGMRESSetRestart()`, `KSPGMRESSetPreAllocateVectors()`, +`KSPGMRESSetCGSRefinementType()`, `KSPGMRESModifiedGramSchmidtOrthogonalization()`, +`KSPGMRESClassicalGramSchmidtOrthogonalization()`, `KSPGMRESGetCGSRefinementType()` + +# External Links +$(_doc_external("KSP/KSPGMRESSetOrthogonalization")) +""" +function KSPGMRESSetOrthogonalization(petsclib::PetscLibType, ksp::PetscKSP, fcn::external) end + +@for_petsc function KSPGMRESSetOrthogonalization(petsclib::$UnionPetscLib, ksp::PetscKSP, fcn::external ) + + @chk ccall( + (:KSPGMRESSetOrthogonalization, $petsc_library), + PetscErrorCode, + (CKSP, external), + ksp, fcn, + ) + + + return nothing +end + +""" + KSPGMRESMonitorKrylov(petsclib::PetscLibType,ksp::PetscKSP, its::PetscInt, fgnorm::PetscReal, dummy::Cvoid) +Calls `VecView()` to monitor each new direction in the `KSPGMRES` accumulated Krylov space. + +Collective + +Input Parameters: +- `ksp` - the `KSP` context +- `its` - iteration number +- `fgnorm` - 2-norm of residual (or gradient) +- `dummy` - a collection of viewers created with `PetscViewersCreate()` + +Options Database Key: +- `-ksp_gmres_krylov_monitor ` - Plot the Krylov directions + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGMRES`, `KSPMonitorSet()`, `KSPMonitorResidual()`, `VecView()`, `PetscViewersCreate()`, `PetscViewersDestroy()` + +# External Links +$(_doc_external("KSP/KSPGMRESMonitorKrylov")) +""" +function KSPGMRESMonitorKrylov(petsclib::PetscLibType, ksp::PetscKSP, its::PetscInt, fgnorm::PetscReal, dummy::Cvoid) end + +@for_petsc function KSPGMRESMonitorKrylov(petsclib::$UnionPetscLib, ksp::PetscKSP, its::$PetscInt, fgnorm::$PetscReal, dummy::Cvoid ) + + @chk ccall( + (:KSPGMRESMonitorKrylov, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{Cvoid}), + ksp, its, fgnorm, dummy, + ) + + + return nothing +end + +""" + KSPGMRESSetCGSRefinementType(petsclib::PetscLibType,ksp::PetscKSP, type::KSPGMRESCGSRefinementType) +Sets the type of iterative refinement to use +in the classical Gram-Schmidt orthogonalization used by `KSPGMRES` and other PETSc GMRES implementations. + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space solver context +- `type` - the type of refinement +-seealso: [](ch_ksp), `KSPGMRES`, `KSPGMRESSetOrthogonalization()`, `KSPGMRESCGSRefinementType`, `KSPGMRESClassicalGramSchmidtOrthogonalization()`, `KSPGMRESGetCGSRefinementType()`, +`KSPGMRESGetOrthogonalization()` + +# External Links +$(_doc_external("KSP/KSPGMRESSetCGSRefinementType")) +""" +function KSPGMRESSetCGSRefinementType(petsclib::PetscLibType, ksp::PetscKSP, type::KSPGMRESCGSRefinementType) end + +@for_petsc function KSPGMRESSetCGSRefinementType(petsclib::$UnionPetscLib, ksp::PetscKSP, type::KSPGMRESCGSRefinementType ) + + @chk ccall( + (:KSPGMRESSetCGSRefinementType, $petsc_library), + PetscErrorCode, + (CKSP, KSPGMRESCGSRefinementType), + ksp, type, + ) + + + return nothing +end + +""" + type::KSPGMRESCGSRefinementType = KSPGMRESGetCGSRefinementType(petsclib::PetscLibType,ksp::PetscKSP) +Gets the type of iterative refinement to use +in the classical Gram-Schmidt orthogonalization used by `KSPGMRES` and other PETSc GMRES implementations. + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space solver context + +Output Parameter: +- `type` - the type of refinement + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGMRES`, `KSPGMRESSetOrthogonalization()`, `KSPGMRESCGSRefinementType`, `KSPGMRESClassicalGramSchmidtOrthogonalization()`, `KSPGMRESSetCGSRefinementType()`, +`KSPGMRESGetOrthogonalization()` + +# External Links +$(_doc_external("KSP/KSPGMRESGetCGSRefinementType")) +""" +function KSPGMRESGetCGSRefinementType(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGMRESGetCGSRefinementType(petsclib::$UnionPetscLib, ksp::PetscKSP ) + type_ = Ref{KSPGMRESCGSRefinementType}() + + @chk ccall( + (:KSPGMRESGetCGSRefinementType, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPGMRESCGSRefinementType}), + ksp, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + KSPGMRESSetRestart(petsclib::PetscLibType,ksp::PetscKSP, restart::PetscInt) +Sets number of iterations at which GMRES (`KSPGMRES`, `KSPFGMRES`, `KSPPGMRES`, `KSPAGMRES`, `KSPDGMRES`, `KSPPIPEFGMRES`, +and `KSPLGMRES`) restarts. + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space solver context +- `restart` - integer restart value, this corresponds to the number of iterations of GMRES to perform before restarting + +Options Database Key: +- `-ksp_gmres_restart ` - integer restart value + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGMRES`, `KSPSetTolerances()`, `KSPGMRESSetOrthogonalization()`, `KSPGMRESSetPreAllocateVectors()`, `KSPGMRESGetRestart()`, +`KSPFGMRES`, `KSPLGMRES`, `KSPPGMRES`, `KSPAGMRES`, `KSPDGMRES`, `KSPPIPEFGMRES` + +# External Links +$(_doc_external("KSP/KSPGMRESSetRestart")) +""" +function KSPGMRESSetRestart(petsclib::PetscLibType, ksp::PetscKSP, restart::PetscInt) end + +@for_petsc function KSPGMRESSetRestart(petsclib::$UnionPetscLib, ksp::PetscKSP, restart::$PetscInt ) + + @chk ccall( + (:KSPGMRESSetRestart, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, restart, + ) + + + return nothing +end + +""" + restart::PetscInt = KSPGMRESGetRestart(petsclib::PetscLibType,ksp::PetscKSP) +Gets number of iterations at which GMRES (`KSPGMRES`, `KSPFGMRES`, `KSPPGMRES`, `KSPAGMRES`, `KSPDGMRES`, `KSPPIPEFGMRES`, +and `KSPLGMRES`) restarts. + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space solver context + +Output Parameter: +- `restart` - integer restart value + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGMRES`, `KSPSetTolerances()`, `KSPGMRESSetOrthogonalization()`, `KSPGMRESSetPreAllocateVectors()`, `KSPGMRESSetRestart()`, +`KSPFGMRES`, `KSPLGMRES`, `KSPPGMRES`, `KSPAGMRES`, `KSPDGMRES`, `KSPPIPEFGMRES` + +# External Links +$(_doc_external("KSP/KSPGMRESGetRestart")) +""" +function KSPGMRESGetRestart(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGMRESGetRestart(petsclib::$UnionPetscLib, ksp::PetscKSP ) + restart_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPGMRESGetRestart, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, restart_, + ) + + restart = restart_[] + + return restart +end + +""" + KSPGMRESSetHapTol(petsclib::PetscLibType,ksp::PetscKSP, tol::PetscReal) +Sets the tolerance for detecting a happy ending in GMRES (`KSPGMRES`, `KSPFGMRES` and `KSPLGMRES` and others) + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space solver context +- `tol` - the tolerance for detecting a happy ending + +Options Database Key: +- `-ksp_gmres_haptol ` - set tolerance for determining happy breakdown + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGMRES`, `KSPSetTolerances()` + +# External Links +$(_doc_external("KSP/KSPGMRESSetHapTol")) +""" +function KSPGMRESSetHapTol(petsclib::PetscLibType, ksp::PetscKSP, tol::PetscReal) end + +@for_petsc function KSPGMRESSetHapTol(petsclib::$UnionPetscLib, ksp::PetscKSP, tol::$PetscReal ) + + @chk ccall( + (:KSPGMRESSetHapTol, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal), + ksp, tol, + ) + + + return nothing +end + +""" + KSPGMRESSetBreakdownTolerance(petsclib::PetscLibType,ksp::PetscKSP, tol::PetscReal) +Sets the tolerance for determining divergence breakdown in `KSPGMRES` at restart. + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space solver context +- `tol` - the tolerance + +Options Database Key: +- `-ksp_gmres_breakdown_tolerance ` - set tolerance for determining divergence breakdown + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGMRES`, `KSPSetTolerances()`, `KSPGMRESSetHapTol()`, `KSPConvergedReason` + +# External Links +$(_doc_external("KSP/KSPGMRESSetBreakdownTolerance")) +""" +function KSPGMRESSetBreakdownTolerance(petsclib::PetscLibType, ksp::PetscKSP, tol::PetscReal) end + +@for_petsc function KSPGMRESSetBreakdownTolerance(petsclib::$UnionPetscLib, ksp::PetscKSP, tol::$PetscReal ) + + @chk ccall( + (:KSPGMRESSetBreakdownTolerance, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal), + ksp, tol, + ) + + + return nothing +end + +""" + KSPGMRESModifiedGramSchmidtOrthogonalization(petsclib::PetscLibType,ksp::PetscKSP, it::PetscInt) +This is the basic orthogonalization routine +using modified Gram-Schmidt. + +Collective, No Fortran Support + +Input Parameters: +- `ksp` - `KSP` object, must be associated with `KSPGMRES`, `KSPFGMRES`, or `KSPLGMRES` Krylov method +- `it` - one less than the current GMRES restart iteration, i.e. the size of the Krylov space + +Options Database Key: +- `-ksp_gmres_modifiedgramschmidt` - Activates `KSPGMRESModifiedGramSchmidtOrthogonalization()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGMRESSetOrthogonalization()`, `KSPGMRESClassicalGramSchmidtOrthogonalization()`, `KSPGMRESGetOrthogonalization()` + +# External Links +$(_doc_external("KSP/KSPGMRESModifiedGramSchmidtOrthogonalization")) +""" +function KSPGMRESModifiedGramSchmidtOrthogonalization(petsclib::PetscLibType, ksp::PetscKSP, it::PetscInt) end + +@for_petsc function KSPGMRESModifiedGramSchmidtOrthogonalization(petsclib::$UnionPetscLib, ksp::PetscKSP, it::$PetscInt ) + + @chk ccall( + (:KSPGMRESModifiedGramSchmidtOrthogonalization, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, it, + ) + + + return nothing +end + +""" + KSPPIPEFGMRESSetShift(petsclib::PetscLibType,ksp::PetscKSP, shift::PetscScalar) +Set the shift parameter for the flexible, pipelined `KSPPIPEFGMRES` solver. + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `shift` - the shift + +Options Database Key: +- `-ksp_pipefgmres_shift ` - set the shift parameter + +Level: intermediate + +-seealso: [](ch_ksp), `KSPPIPEFGMRES`, `KSPComputeEigenvalues()` + +# External Links +$(_doc_external("KSP/KSPPIPEFGMRESSetShift")) +""" +function KSPPIPEFGMRESSetShift(petsclib::PetscLibType, ksp::PetscKSP, shift::PetscScalar) end + +@for_petsc function KSPPIPEFGMRESSetShift(petsclib::$UnionPetscLib, ksp::PetscKSP, shift::$PetscScalar ) + + @chk ccall( + (:KSPPIPEFGMRESSetShift, $petsc_library), + PetscErrorCode, + (CKSP, $PetscScalar), + ksp, shift, + ) + + + return nothing +end + +""" + KSPFGMRESSetModifyPC(petsclib::PetscLibType,ksp::PetscKSP, fcn::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) +Sets the routine used by `KSPFGMRES` to modify the preconditioner. [](sec_flexibleksp) + +Logically Collective + +Input Parameters: +- `ksp` - iterative context obtained from `KSPCreate()` +- `fcn` - function to modify the `PC`, see `KSPFlexibleModifyPCFn` +- `ctx` - optional context +- `destroy` - optional context destroy routine + +Options Database Keys: +- `-ksp_fgmres_modifypcnochange` - do not change the `PC` +- `-ksp_fgmres_modifypcksp` - changes the inner KSP solver tolerances + +Level: intermediate + +-seealso: [](ch_ksp), [](sec_flexibleksp), `KSPFGMRES`, `KSPFlexibleModifyPCFn`, `KSPFlexibleSetModifyPC()`, `KSPFGMRESModifyPCNoChange()`, `KSPFGMRESModifyPCKSP()` + +# External Links +$(_doc_external("KSP/KSPFGMRESSetModifyPC")) +""" +function KSPFGMRESSetModifyPC(petsclib::PetscLibType, ksp::PetscKSP, fcn::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) end + +@for_petsc function KSPFGMRESSetModifyPC(petsclib::$UnionPetscLib, ksp::PetscKSP, fcn::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn ) + + @chk ccall( + (:KSPFGMRESSetModifyPC, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPFlexibleModifyPCFn}, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + ksp, fcn, ctx, destroy, + ) + + + return nothing +end + +""" + KSPFlexibleSetModifyPC(petsclib::PetscLibType,ksp::PetscKSP, fcn::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) +Sets the routine used by flexible `KSP` methods to modify the preconditioner. [](sec_flexibleksp) + +Logically Collective + +Input Parameters: +- `ksp` - iterative context obtained from `KSPCreate()` +- `fcn` - function to modify the `PC`, see `KSPFlexibleModifyPCFn` +- `ctx` - optional context +- `destroy` - optional context destroy routine + +Level: intermediate + +-seealso: [](ch_ksp), [](sec_flexibleksp), `KSPFGMRES`, `KSPFGMRESModifyPCNoChange()`, `KSPFGMRESModifyPCKSP()` + +# External Links +$(_doc_external("KSP/KSPFlexibleSetModifyPC")) +""" +function KSPFlexibleSetModifyPC(petsclib::PetscLibType, ksp::PetscKSP, fcn::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) end + +@for_petsc function KSPFlexibleSetModifyPC(petsclib::$UnionPetscLib, ksp::PetscKSP, fcn::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn ) + + @chk ccall( + (:KSPFlexibleSetModifyPC, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPFlexibleModifyPCFn}, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + ksp, fcn, ctx, destroy, + ) + + + return nothing +end + +""" + KSPFGMRESModifyPCNoChange(petsclib::PetscLibType,ksp::PetscKSP, total_its::PetscInt, loc_its::PetscInt, res_norm::PetscReal, ctx::Cvoid) +this is the default used by `KSPFMGMRES` + +Input Parameters: +- `ksp` - the ksp context being used. +- `total_its` - the total number of `KSPFGMRES` iterations that have occurred. +- `loc_its` - the number of `KSPFGMRES` iterations since last restart. +- `res_norm` - the current residual norm. +- `ctx` - context variable, unused in this routine + +Level: intermediate + +-seealso: [](ch_ksp), [](sec_flexibleksp), `KSPFGMRES`, `KSPFlexibleModifyPCFn`, `KSPFGMRESSetModifyPC()`, `KSPFGMRESModifyPCKSP()` + +# External Links +$(_doc_external("KSP/KSPFGMRESModifyPCNoChange")) +""" +function KSPFGMRESModifyPCNoChange(petsclib::PetscLibType, ksp::PetscKSP, total_its::PetscInt, loc_its::PetscInt, res_norm::PetscReal, ctx::Cvoid) end + +@for_petsc function KSPFGMRESModifyPCNoChange(petsclib::$UnionPetscLib, ksp::PetscKSP, total_its::$PetscInt, loc_its::$PetscInt, res_norm::$PetscReal, ctx::Cvoid ) + + @chk ccall( + (:KSPFGMRESModifyPCNoChange, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscInt, $PetscReal, Ptr{Cvoid}), + ksp, total_its, loc_its, res_norm, ctx, + ) + + + return nothing +end + +""" + KSPFGMRESModifyPCKSP(petsclib::PetscLibType,ksp::PetscKSP, total_its::PetscInt, loc_its::PetscInt, res_norm::PetscReal, ctx::Cvoid) +modifies the attributes of the `KSPFGMRES` preconditioner, see [](sec_flexibleksp). + +Input Parameters: +- `ksp` - the ksp context being used. +- `total_its` - the total number of `KSPFGMRES` iterations that have occurred. +- `loc_its` - the number of `KSPFGMRES` iterations since last restart. +- `res_norm` - the current residual norm. +- `ctx` - context, not used in this routine + +Level: intermediate + +-seealso: [](ch_ksp), [](sec_flexibleksp), `KSPFGMRES`, `KSPFlexibleModifyPCFn`, `KSPFGMRESSetModifyPC()` + +# External Links +$(_doc_external("KSP/KSPFGMRESModifyPCKSP")) +""" +function KSPFGMRESModifyPCKSP(petsclib::PetscLibType, ksp::PetscKSP, total_its::PetscInt, loc_its::PetscInt, res_norm::PetscReal, ctx::Cvoid) end + +@for_petsc function KSPFGMRESModifyPCKSP(petsclib::$UnionPetscLib, ksp::PetscKSP, total_its::$PetscInt, loc_its::$PetscInt, res_norm::$PetscReal, ctx::Cvoid ) + + @chk ccall( + (:KSPFGMRESModifyPCKSP, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscInt, $PetscReal, Ptr{Cvoid}), + ksp, total_its, loc_its, res_norm, ctx, + ) + + + return nothing +end + +""" + KSPLGMRESSetAugDim(petsclib::PetscLibType,ksp::PetscKSP, dim::PetscInt) +Set the number of error approximations to include in the approximation space (default is 2) for `KSPLGMRES` + +Collective + +Input Parameters: +- `ksp` - the `KSP` context +- `dim` - the number of vectors to use + +Options Database Key: +- `-ksp_lgmres_augment dim` - the number of error approximations to include + +Level: intermediate + +-seealso: [](ch_ksp), `KSPLGMRES`, `KSPLGMRESSetConstant()` + +# External Links +$(_doc_external("KSP/KSPLGMRESSetAugDim")) +""" +function KSPLGMRESSetAugDim(petsclib::PetscLibType, ksp::PetscKSP, dim::PetscInt) end + +@for_petsc function KSPLGMRESSetAugDim(petsclib::$UnionPetscLib, ksp::PetscKSP, dim::$PetscInt ) + + @chk ccall( + (:KSPLGMRESSetAugDim, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, dim, + ) + + + return nothing +end + +""" + KSPLGMRESSetConstant(petsclib::PetscLibType,ksp::PetscKSP) +keep the error approximation space a constant size for every restart cycle + +Collective + +Input Parameters: +- `ksp` - the `KSP` context + +Options Database Key: +- `-ksp_lgmres_constant` - set the size to be constant + +Level: intermediate + +-seealso: [](ch_ksp), `KSPLGMRES`, `KSPLGMRESSetAugDim()` + +# External Links +$(_doc_external("KSP/KSPLGMRESSetConstant")) +""" +function KSPLGMRESSetConstant(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPLGMRESSetConstant(petsclib::$UnionPetscLib, ksp::PetscKSP ) + + @chk ccall( + (:KSPLGMRESSetConstant, $petsc_library), + PetscErrorCode, + (CKSP,), + ksp, + ) + + + return nothing +end + +""" + KSPChebyshevSetEigenvalues(petsclib::PetscLibType,ksp::PetscKSP, emax::PetscReal, emin::PetscReal) +Sets estimates for the extreme eigenvalues of the preconditioned problem. + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `emax` - the eigenvalue maximum estimate +- `emin` - the eigenvalue minimum estimate + +Options Database Key: +- `-ksp_chebyshev_eigenvalues emin,emax` - extreme eigenvalues + +Level: intermediate + +-seealso: [](ch_ksp), `KSPCHEBYSHEV`, `KSPChebyshevEstEigSet()`, + +# External Links +$(_doc_external("KSP/KSPChebyshevSetEigenvalues")) +""" +function KSPChebyshevSetEigenvalues(petsclib::PetscLibType, ksp::PetscKSP, emax::PetscReal, emin::PetscReal) end + +@for_petsc function KSPChebyshevSetEigenvalues(petsclib::$UnionPetscLib, ksp::PetscKSP, emax::$PetscReal, emin::$PetscReal ) + + @chk ccall( + (:KSPChebyshevSetEigenvalues, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal, $PetscReal), + ksp, emax, emin, + ) + + + return nothing +end + +""" + KSPChebyshevEstEigSet(petsclib::PetscLibType,ksp::PetscKSP, a::PetscReal, b::PetscReal, c::PetscReal, d::PetscReal) +Automatically estimate the eigenvalues to use for Chebyshev + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `a` - multiple of min eigenvalue estimate to use for min Chebyshev bound (or `PETSC_DECIDE`) +- `b` - multiple of max eigenvalue estimate to use for min Chebyshev bound (or `PETSC_DECIDE`) +- `c` - multiple of min eigenvalue estimate to use for max Chebyshev bound (or `PETSC_DECIDE`) +- `d` - multiple of max eigenvalue estimate to use for max Chebyshev bound (or `PETSC_DECIDE`) + +Options Database Key: +- `-ksp_chebyshev_esteig a,b,c,d` - estimate eigenvalues using a Krylov method, then use this transform for Chebyshev eigenvalue bounds + +-seealso: [](ch_ksp), `KSPCHEBYSHEV`, `KSPChebyshevEstEigSetUseNoisy()`, `KSPChebyshevEstEigGetKSP()` + +# External Links +$(_doc_external("KSP/KSPChebyshevEstEigSet")) +""" +function KSPChebyshevEstEigSet(petsclib::PetscLibType, ksp::PetscKSP, a::PetscReal, b::PetscReal, c::PetscReal, d::PetscReal) end + +@for_petsc function KSPChebyshevEstEigSet(petsclib::$UnionPetscLib, ksp::PetscKSP, a::$PetscReal, b::$PetscReal, c::$PetscReal, d::$PetscReal ) + + @chk ccall( + (:KSPChebyshevEstEigSet, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + ksp, a, b, c, d, + ) + + + return nothing +end + +""" + KSPChebyshevEstEigSetUseNoisy(petsclib::PetscLibType,ksp::PetscKSP, use::PetscBool) +use a noisy random number generated right + +Logically Collective + +Input Parameters: +- `ksp` - linear solver context +- `use` - `PETSC_TRUE` to use noisy + +Options Database Key: +- `-ksp_chebyshev_esteig_noisy ` - Use noisy right-hand side for estimate + +Level: intermediate + +-seealso: [](ch_ksp), `KSPCHEBYSHEV`, `KSPChebyshevEstEigSet()`, `KSPChebyshevEstEigGetKSP()` + +# External Links +$(_doc_external("KSP/KSPChebyshevEstEigSetUseNoisy")) +""" +function KSPChebyshevEstEigSetUseNoisy(petsclib::PetscLibType, ksp::PetscKSP, use::PetscBool) end + +@for_petsc function KSPChebyshevEstEigSetUseNoisy(petsclib::$UnionPetscLib, ksp::PetscKSP, use::PetscBool ) + + @chk ccall( + (:KSPChebyshevEstEigSetUseNoisy, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, use, + ) + + + return nothing +end + +""" + KSPChebyshevEstEigGetKSP(petsclib::PetscLibType,ksp::PetscKSP, kspest::PetscKSP) +Get the Krylov method context used to estimate the eigenvalues for the Chebyshev method. + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `kspest` - the eigenvalue estimation Krylov space context + +Level: advanced + +-seealso: [](ch_ksp), `KSPCHEBYSHEV`, `KSPChebyshevEstEigSet()` + +# External Links +$(_doc_external("KSP/KSPChebyshevEstEigGetKSP")) +""" +function KSPChebyshevEstEigGetKSP(petsclib::PetscLibType, ksp::PetscKSP, kspest::PetscKSP) end + +@for_petsc function KSPChebyshevEstEigGetKSP(petsclib::$UnionPetscLib, ksp::PetscKSP, kspest::PetscKSP ) + kspest_ = Ref(kspest.ptr) + + @chk ccall( + (:KSPChebyshevEstEigGetKSP, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{CKSP}), + ksp, kspest_, + ) + + kspest.ptr = C_NULL + + return nothing +end + +""" + KSPChebyshevSetKind(petsclib::PetscLibType,ksp::PetscKSP, kind::KSPChebyshevKind) +set the kind of Chebyshev polynomial to use + +Logically Collective + +Input Parameters: +- `ksp` - Linear solver context +- `kind` - The kind of Chebyshev polynomial to use, see `KSPChebyshevKind`, one of `KSP_CHEBYSHEV_FIRST`, `KSP_CHEBYSHEV_FOURTH`, or `KSP_CHEBYSHEV_OPT_FOURTH` + +Options Database Key: +- `-ksp_chebyshev_kind ` - which kind of Chebyshev polynomial to use + +Level: intermediate + +-seealso: [](ch_ksp), `KSPCHEBYSHEV`, `KSPChebyshevKind`, `KSPChebyshevGetKind()`, `KSP_CHEBYSHEV_FIRST`, `KSP_CHEBYSHEV_FOURTH`, `KSP_CHEBYSHEV_OPT_FOURTH` + +# External Links +$(_doc_external("KSP/KSPChebyshevSetKind")) +""" +function KSPChebyshevSetKind(petsclib::PetscLibType, ksp::PetscKSP, kind::KSPChebyshevKind) end + +@for_petsc function KSPChebyshevSetKind(petsclib::$UnionPetscLib, ksp::PetscKSP, kind::KSPChebyshevKind ) + + @chk ccall( + (:KSPChebyshevSetKind, $petsc_library), + PetscErrorCode, + (CKSP, KSPChebyshevKind), + ksp, kind, + ) + + + return nothing +end + +""" + KSPChebyshevGetKind(petsclib::PetscLibType,ksp::PetscKSP, kind::KSPChebyshevKind) +get the kind of Chebyshev polynomial to use + +Logically Collective + +Input Parameters: +- `ksp` - Linear solver context +- `kind` - The kind of Chebyshev polynomial used + +Level: intermediate + +-seealso: [](ch_ksp), `KSPCHEBYSHEV`, `KSPChebyshevKind`, `KSPChebyshevSetKind()`, `KSP_CHEBYSHEV_FIRST`, `KSP_CHEBYSHEV_FOURTH`, `KSP_CHEBYSHEV_OPT_FOURTH` + +# External Links +$(_doc_external("KSP/KSPChebyshevGetKind")) +""" +function KSPChebyshevGetKind(petsclib::PetscLibType, ksp::PetscKSP, kind::KSPChebyshevKind) end + +@for_petsc function KSPChebyshevGetKind(petsclib::$UnionPetscLib, ksp::PetscKSP, kind::KSPChebyshevKind ) + + @chk ccall( + (:KSPChebyshevGetKind, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPChebyshevKind}), + ksp, kind, + ) + + + return nothing +end + +""" + KSPFCGSetMmax(petsclib::PetscLibType,ksp::PetscKSP, mmax::PetscInt) +set the maximum number of previous directions `KSPFCG` will store for orthogonalization + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `mmax` - the maximum number of previous directions to orthogonalize against + +Options Database Key: +- `-ksp_fcg_mmax ` - maximum number of search directions + +Level: intermediate + +-seealso: [](ch_ksp), `KSPFCG`, `KSPFCGGetTruncationType()`, `KSPFCGGetNprealloc()`, `KSPFCGetMmax()` + +# External Links +$(_doc_external("KSP/KSPFCGSetMmax")) +""" +function KSPFCGSetMmax(petsclib::PetscLibType, ksp::PetscKSP, mmax::PetscInt) end + +@for_petsc function KSPFCGSetMmax(petsclib::$UnionPetscLib, ksp::PetscKSP, mmax::$PetscInt ) + + @chk ccall( + (:KSPFCGSetMmax, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, mmax, + ) + + + return nothing +end + +""" + mmax::PetscInt = KSPFCGGetMmax(petsclib::PetscLibType,ksp::PetscKSP) +get the maximum number of previous directions `KSPFCG` will store + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `mmax` - the maximum number of previous directions allowed for orthogonalization + +Level: intermediate + +-seealso: [](ch_ksp), `KSPFCG`, `KSPFCGGetTruncationType()`, `KSPFCGGetNprealloc()`, `KSPFCGSetMmax()` + +# External Links +$(_doc_external("KSP/KSPFCGGetMmax")) +""" +function KSPFCGGetMmax(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPFCGGetMmax(petsclib::$UnionPetscLib, ksp::PetscKSP ) + mmax_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPFCGGetMmax, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, mmax_, + ) + + mmax = mmax_[] + + return mmax +end + +""" + KSPFCGSetNprealloc(petsclib::PetscLibType,ksp::PetscKSP, nprealloc::PetscInt) +set the number of directions to preallocate with `KSPFCG` + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `nprealloc` - the number of vectors to preallocate + +Options Database Key: +- `-ksp_fcg_nprealloc ` - number of directions to preallocate + +Level: advanced + +-seealso: [](ch_ksp), `KSPFCG`, `KSPFCGGetTruncationType()`, `KSPFCGGetNprealloc()`, `KSPFCGSetMmax()`, `KSPFCGGetMmax()` + +# External Links +$(_doc_external("KSP/KSPFCGSetNprealloc")) +""" +function KSPFCGSetNprealloc(petsclib::PetscLibType, ksp::PetscKSP, nprealloc::PetscInt) end + +@for_petsc function KSPFCGSetNprealloc(petsclib::$UnionPetscLib, ksp::PetscKSP, nprealloc::$PetscInt ) + + @chk ccall( + (:KSPFCGSetNprealloc, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, nprealloc, + ) + + + return nothing +end + +""" + nprealloc::PetscInt = KSPFCGGetNprealloc(petsclib::PetscLibType,ksp::PetscKSP) +get the number of directions preallocate by `KSPFCG` + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `nprealloc` - the number of directions preallocated + +Level: advanced + +-seealso: [](ch_ksp), `KSPFCG`, `KSPFCGGetTruncationType()`, `KSPFCGSetNprealloc()`, `KSPFCGSetMmax()`, `KSPFCGGetMmax()` + +# External Links +$(_doc_external("KSP/KSPFCGGetNprealloc")) +""" +function KSPFCGGetNprealloc(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPFCGGetNprealloc(petsclib::$UnionPetscLib, ksp::PetscKSP ) + nprealloc_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPFCGGetNprealloc, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, nprealloc_, + ) + + nprealloc = nprealloc_[] + + return nprealloc +end + +""" + KSPFCGSetTruncationType(petsclib::PetscLibType,ksp::PetscKSP, truncstrat::KSPFCDTruncationType) +specify how many of its stored previous directions `KSPFCG` uses during orthoganalization + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `truncstrat` - the choice of strategy +-seealso: [](ch_ksp), `KSPFCDTruncationType`, `KSPFCGGetTruncationType()`, `KSPFCGSetNprealloc()`, `KSPFCGSetMmax()`, `KSPFCGGetMmax()`, +`KSP_FCD_TRUNC_TYPE_STANDARD`, `KSP_FCD_TRUNC_TYPE_NOTAY` + +# External Links +$(_doc_external("KSP/KSPFCGSetTruncationType")) +""" +function KSPFCGSetTruncationType(petsclib::PetscLibType, ksp::PetscKSP, truncstrat::KSPFCDTruncationType) end + +@for_petsc function KSPFCGSetTruncationType(petsclib::$UnionPetscLib, ksp::PetscKSP, truncstrat::KSPFCDTruncationType ) + + @chk ccall( + (:KSPFCGSetTruncationType, $petsc_library), + PetscErrorCode, + (CKSP, KSPFCDTruncationType), + ksp, truncstrat, + ) + + + return nothing +end + +""" + truncstrat::KSPFCDTruncationType = KSPFCGGetTruncationType(petsclib::PetscLibType,ksp::PetscKSP) +get the truncation strategy employed by `KSPFCG` + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `truncstrat` - the strategy type + +Level: intermediate + +-seealso: [](ch_ksp), `KSPFCG`, `KSPFCGSetTruncationType()`, `KSPFCDTruncationType`, `KSP_FCD_TRUNC_TYPE_STANDARD`, `KSP_FCD_TRUNC_TYPE_NOTAY` + +# External Links +$(_doc_external("KSP/KSPFCGGetTruncationType")) +""" +function KSPFCGGetTruncationType(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPFCGGetTruncationType(petsclib::$UnionPetscLib, ksp::PetscKSP ) + truncstrat_ = Ref{KSPFCDTruncationType}() + + @chk ccall( + (:KSPFCGGetTruncationType, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPFCDTruncationType}), + ksp, truncstrat_, + ) + + truncstrat = unsafe_string(truncstrat_[]) + + return truncstrat +end + +""" + KSPPIPEFCGSetMmax(petsclib::PetscLibType,ksp::PetscKSP, mmax::PetscInt) +set the maximum number of previous directions `KSPPIPEFCG` will store for orthogonalization + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `mmax` - the maximum number of previous directions to orthogonalize against + +Options Database Key: +- `-ksp_pipefcg_mmax ` - maximum number of previous directions + +Level: intermediate + +-seealso: [](ch_ksp), `KSPPIPEFCG`, `KSPPIPEFCGSetTruncationType()`, `KSPPIPEFCGSetNprealloc()`, `KSPFCGSetMmax()`, `KSPFCGGetMmax()` + +# External Links +$(_doc_external("KSP/KSPPIPEFCGSetMmax")) +""" +function KSPPIPEFCGSetMmax(petsclib::PetscLibType, ksp::PetscKSP, mmax::PetscInt) end + +@for_petsc function KSPPIPEFCGSetMmax(petsclib::$UnionPetscLib, ksp::PetscKSP, mmax::$PetscInt ) + + @chk ccall( + (:KSPPIPEFCGSetMmax, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, mmax, + ) + + + return nothing +end + +""" + mmax::PetscInt = KSPPIPEFCGGetMmax(petsclib::PetscLibType,ksp::PetscKSP) +get the maximum number of previous directions `KSPPIPEFCG` will store + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `mmax` - the maximum number of previous directions allowed for orthogonalization + +Level: intermediate + +-seealso: [](ch_ksp), `KSPPIPEFCG`, `KSPPIPEFCGGetTruncationType()`, `KSPPIPEFCGGetNprealloc()`, `KSPPIPEFCGSetMmax()`, `KSPFCGGetMmax()`, `KSPFCGSetMmax()` + +# External Links +$(_doc_external("KSP/KSPPIPEFCGGetMmax")) +""" +function KSPPIPEFCGGetMmax(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPPIPEFCGGetMmax(petsclib::$UnionPetscLib, ksp::PetscKSP ) + mmax_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPPIPEFCGGetMmax, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, mmax_, + ) + + mmax = mmax_[] + + return mmax +end + +""" + KSPPIPEFCGSetNprealloc(petsclib::PetscLibType,ksp::PetscKSP, nprealloc::PetscInt) +set the number of directions to preallocate with `KSPPIPEFCG` + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `nprealloc` - the number of vectors to preallocate + +Options Database Key: +- `-ksp_pipefcg_nprealloc ` - the number of vectors to preallocate + +Level: advanced + +-seealso: [](ch_ksp), `KSPPIPEFCG`, `KSPPIPEFCGSetTruncationType()`, `KSPPIPEFCGGetNprealloc()`, `KSPPIPEFCGSetMmax()`, `KSPPIPEFCGGetMmax()` + +# External Links +$(_doc_external("KSP/KSPPIPEFCGSetNprealloc")) +""" +function KSPPIPEFCGSetNprealloc(petsclib::PetscLibType, ksp::PetscKSP, nprealloc::PetscInt) end + +@for_petsc function KSPPIPEFCGSetNprealloc(petsclib::$UnionPetscLib, ksp::PetscKSP, nprealloc::$PetscInt ) + + @chk ccall( + (:KSPPIPEFCGSetNprealloc, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, nprealloc, + ) + + + return nothing +end + +""" + nprealloc::PetscInt = KSPPIPEFCGGetNprealloc(petsclib::PetscLibType,ksp::PetscKSP) +get the number of directions to preallocate by `KSPPIPEFCG` + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `nprealloc` - the number of directions preallocated + +Level: advanced + +-seealso: [](ch_ksp), `KSPPIPEFCG`, `KSPPIPEFCGGetTruncationType()`, `KSPPIPEFCGSetNprealloc()`, `KSPPIPEFCGSetMmax()`, `KSPPIPEFCGGetMmax()` + +# External Links +$(_doc_external("KSP/KSPPIPEFCGGetNprealloc")) +""" +function KSPPIPEFCGGetNprealloc(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPPIPEFCGGetNprealloc(petsclib::$UnionPetscLib, ksp::PetscKSP ) + nprealloc_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPPIPEFCGGetNprealloc, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, nprealloc_, + ) + + nprealloc = nprealloc_[] + + return nprealloc +end + +""" + KSPPIPEFCGSetTruncationType(petsclib::PetscLibType,ksp::PetscKSP, truncstrat::KSPFCDTruncationType) +specify how many of its stored previous directions `KSPPIPEFCG` uses during orthoganalization + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `truncstrat` - the choice of strategy +-seealso: [](ch_ksp), `KSPPIPEFCG`, `KSPPIPEFCGGetTruncationType`, `KSPFCDTruncationType`, `KSP_FCD_TRUNC_TYPE_STANDARD`, `KSP_FCD_TRUNC_TYPE_NOTAY` + +# External Links +$(_doc_external("KSP/KSPPIPEFCGSetTruncationType")) +""" +function KSPPIPEFCGSetTruncationType(petsclib::PetscLibType, ksp::PetscKSP, truncstrat::KSPFCDTruncationType) end + +@for_petsc function KSPPIPEFCGSetTruncationType(petsclib::$UnionPetscLib, ksp::PetscKSP, truncstrat::KSPFCDTruncationType ) + + @chk ccall( + (:KSPPIPEFCGSetTruncationType, $petsc_library), + PetscErrorCode, + (CKSP, KSPFCDTruncationType), + ksp, truncstrat, + ) + + + return nothing +end + +""" + truncstrat::KSPFCDTruncationType = KSPPIPEFCGGetTruncationType(petsclib::PetscLibType,ksp::PetscKSP) +get the truncation strategy employed by `KSPPIPEFCG` + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `truncstrat` - the strategy type + +Level: intermediate + +-seealso: [](ch_ksp), `KSPPIPEFCG`, `KSPPIPEFCGSetTruncationType`, `KSPFCDTruncationType`, `KSP_FCD_TRUNC_TYPE_STANDARD`, `KSP_FCD_TRUNC_TYPE_NOTAY` + +# External Links +$(_doc_external("KSP/KSPPIPEFCGGetTruncationType")) +""" +function KSPPIPEFCGGetTruncationType(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPPIPEFCGGetTruncationType(petsclib::$UnionPetscLib, ksp::PetscKSP ) + truncstrat_ = Ref{KSPFCDTruncationType}() + + @chk ccall( + (:KSPPIPEFCGGetTruncationType, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPFCDTruncationType}), + ksp, truncstrat_, + ) + + truncstrat = unsafe_string(truncstrat_[]) + + return truncstrat +end + +""" + KSPPythonSetType(petsclib::PetscLibType,ksp::PetscKSP, pyname::String) +Initialize a `KSP` object to a type implemented in Python. + +Collective + +Input Parameters: +- `ksp` - the linear solver `KSP` context. +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Options Database Key: +- `-ksp_python_type ` - python class + +Level: intermediate + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSetType()`, `KSPPYTHON`, `PetscPythonInitialize()` + +# External Links +$(_doc_external("KSP/KSPPythonSetType")) +""" +function KSPPythonSetType(petsclib::PetscLibType, ksp::PetscKSP, pyname::String) end + +@for_petsc function KSPPythonSetType(petsclib::$UnionPetscLib, ksp::PetscKSP, pyname::String ) + + @chk ccall( + (:KSPPythonSetType, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Cchar}), + ksp, pyname, + ) + + + return nothing +end + +""" + pyname::String = KSPPythonGetType(petsclib::PetscLibType,ksp::PetscKSP) +Get the type of a `KSP` object implemented in Python. + +Not Collective + +Input Parameter: +- `ksp` - the linear solver `KSP` context. + +Output Parameter: +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Level: intermediate + +-seealso: [](ch_ksp), `KSPCreate()`, `KSPSetType()`, `KSPPYTHON`, `PetscPythonInitialize()`, `KSPPythonSetType()` + +# External Links +$(_doc_external("KSP/KSPPythonGetType")) +""" +function KSPPythonGetType(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPPythonGetType(petsclib::$UnionPetscLib, ksp::PetscKSP ) + pyname_ = Ref{Ptr{Cchar}}() + + @chk ccall( + (:KSPPythonGetType, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{Ptr{Cchar}}), + ksp, pyname_, + ) + + pyname = unsafe_wrap(Array, pyname_[], VecGetLocalSize(petsclib, x); own = false) + + return pyname +end + +""" + KSPCGSetType(petsclib::PetscLibType,ksp::PetscKSP, type::KSPCGType) +Sets the variant of the conjugate gradient method to +use for solving a linear system with a complex coefficient matrix. +This option is irrelevant when solving a real system. + +Logically Collective + +Input Parameters: +- `ksp` - the iterative context +- `type` - the variant of CG to use, one of +-seealso: [](ch_ksp), `KSP`, `KSPCG` + +# External Links +$(_doc_external("KSP/KSPCGSetType")) +""" +function KSPCGSetType(petsclib::PetscLibType, ksp::PetscKSP, type::KSPCGType) end + +@for_petsc function KSPCGSetType(petsclib::$UnionPetscLib, ksp::PetscKSP, type::KSPCGType ) + + @chk ccall( + (:KSPCGSetType, $petsc_library), + PetscErrorCode, + (CKSP, KSPCGType), + ksp, type, + ) + + + return nothing +end + +""" + KSPCGUseSingleReduction(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Merge the two inner products needed in `KSPCG` into a single `MPI_Allreduce()` call. + +Logically Collective + +Input Parameters: +- `ksp` - the iterative context +- `flg` - turn on or off the single reduction + +Options Database Key: +- `-ksp_cg_single_reduction ` - Merge inner products into single `MPI_Allreduce()` + +Level: intermediate + +-seealso: [](ch_ksp), [](sec_pipelineksp), `KSP`, `KSPCG`, `KSPGMRES`, `KSPPIPECG`, `KSPPIPECR`, `and KSPGROPPCG` + +# External Links +$(_doc_external("KSP/KSPCGUseSingleReduction")) +""" +function KSPCGUseSingleReduction(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPCGUseSingleReduction(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPCGUseSingleReduction, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + KSPCGSetRadius(petsclib::PetscLibType,ksp::PetscKSP, radius::PetscReal) +Sets the radius of the trust region used by the `KSPCG` when the solver is used inside `SNESNEWTONTR` + +Logically Collective + +Input Parameters: +- `ksp` - the iterative context +- `radius` - the trust region radius (0 is the default that disable the use of the radius) + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPCG`, `KSPNASH`, `KSPSTCG`, `KSPGLTR`, `SNESNEWTONTR` + +# External Links +$(_doc_external("KSP/KSPCGSetRadius")) +""" +function KSPCGSetRadius(petsclib::PetscLibType, ksp::PetscKSP, radius::PetscReal) end + +@for_petsc function KSPCGSetRadius(petsclib::$UnionPetscLib, ksp::PetscKSP, radius::$PetscReal ) + + @chk ccall( + (:KSPCGSetRadius, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal), + ksp, radius, + ) + + + return nothing +end + +""" + KSPCGSetObjectiveTarget(petsclib::PetscLibType,ksp::PetscKSP, obj::PetscReal) +Sets the target value for the CG quadratic model + +Logically Collective + +Input Parameters: +- `ksp` - the iterative context +- `obj` - the objective value (0 is the default) + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPCG`, `KSPNASH`, `KSPSTCG`, `KSPGLTR`, `SNESNEWTONTR` + +# External Links +$(_doc_external("KSP/KSPCGSetObjectiveTarget")) +""" +function KSPCGSetObjectiveTarget(petsclib::PetscLibType, ksp::PetscKSP, obj::PetscReal) end + +@for_petsc function KSPCGSetObjectiveTarget(petsclib::$UnionPetscLib, ksp::PetscKSP, obj::$PetscReal ) + + @chk ccall( + (:KSPCGSetObjectiveTarget, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal), + ksp, obj, + ) + + + return nothing +end + +""" + KSPCGGetNormD(petsclib::PetscLibType,ksp::PetscKSP, norm_d::PetscReal) +Get norm of the direction when the solver is used inside `SNESNEWTONTR` + +Not collective + +Input Parameters: +- `ksp` - the iterative context +- `norm_d` - the norm of the direction + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPCG`, `KSPNASH`, `KSPSTCG`, `KSPGLTR`, `SNESNEWTONTR` + +# External Links +$(_doc_external("KSP/KSPCGGetNormD")) +""" +function KSPCGGetNormD(petsclib::PetscLibType, ksp::PetscKSP, norm_d::PetscReal) end + +@for_petsc function KSPCGGetNormD(petsclib::$UnionPetscLib, ksp::PetscKSP, norm_d::$PetscReal ) + + @chk ccall( + (:KSPCGGetNormD, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}), + ksp, norm_d, + ) + + + return nothing +end + +""" + KSPCGGetObjFcn(petsclib::PetscLibType,ksp::PetscKSP, o_fcn::PetscReal) +Get the conjugate gradient objective function value + +Not collective + +Input Parameters: +- `ksp` - the iterative context +- `o_fcn` - the objective function value + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPCG`, `KSPNASH`, `KSPSTCG`, `KSPGLTR`, `KSPMonitorSet` + +# External Links +$(_doc_external("KSP/KSPCGGetObjFcn")) +""" +function KSPCGGetObjFcn(petsclib::PetscLibType, ksp::PetscKSP, o_fcn::PetscReal) end + +@for_petsc function KSPCGGetObjFcn(petsclib::$UnionPetscLib, ksp::PetscKSP, o_fcn::$PetscReal ) + + @chk ccall( + (:KSPCGGetObjFcn, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}), + ksp, o_fcn, + ) + + + return nothing +end + +""" + e_min::PetscReal = KSPGLTRGetMinEig(petsclib::PetscLibType,ksp::PetscKSP) +Get minimum eigenvalue computed by `KSPGLTR` + +Collective + +Input Parameter: +- `ksp` - the iterative context + +Output Parameter: +- `e_min` - the minimum eigenvalue + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPGLTR`, `KSPGLTRGetLambda()` + +# External Links +$(_doc_external("KSP/KSPGLTRGetMinEig")) +""" +function KSPGLTRGetMinEig(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGLTRGetMinEig(petsclib::$UnionPetscLib, ksp::PetscKSP ) + e_min_ = Ref{$PetscReal}() + + @chk ccall( + (:KSPGLTRGetMinEig, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}), + ksp, e_min_, + ) + + e_min = e_min_[] + + return e_min +end + +""" + lambda::PetscReal = KSPGLTRGetLambda(petsclib::PetscLibType,ksp::PetscKSP) +Get the multiplier on the trust + +Not Collective + +Input Parameter: +- `ksp` - the iterative context + +Output Parameter: +- `lambda` - the multiplier + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `KSPGLTR`, `KSPGLTRGetMinEig()` + +# External Links +$(_doc_external("KSP/KSPGLTRGetLambda")) +""" +function KSPGLTRGetLambda(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGLTRGetLambda(petsclib::$UnionPetscLib, ksp::PetscKSP ) + lambda_ = Ref{$PetscReal}() + + @chk ccall( + (:KSPGLTRGetLambda, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}), + ksp, lambda_, + ) + + lambda = lambda_[] + + return lambda +end + +""" + KSPHPDDMSetDeflationMat(petsclib::PetscLibType,ksp::PetscKSP, U::PetscMat) + +# External Links +$(_doc_external("KSP/KSPHPDDMSetDeflationMat")) +""" +function KSPHPDDMSetDeflationMat(petsclib::PetscLibType, ksp::PetscKSP, U::PetscMat) end + +@for_petsc function KSPHPDDMSetDeflationMat(petsclib::$UnionPetscLib, ksp::PetscKSP, U::PetscMat ) + + @chk ccall( + (:KSPHPDDMSetDeflationMat, $petsc_library), + PetscErrorCode, + (CKSP, CMat), + ksp, U, + ) + + + return nothing +end + +""" + KSPHPDDMGetDeflationMat(petsclib::PetscLibType,ksp::PetscKSP, U::PetscMat) + +# External Links +$(_doc_external("KSP/KSPHPDDMGetDeflationMat")) +""" +function KSPHPDDMGetDeflationMat(petsclib::PetscLibType, ksp::PetscKSP, U::PetscMat) end + +@for_petsc function KSPHPDDMGetDeflationMat(petsclib::$UnionPetscLib, ksp::PetscKSP, U::PetscMat ) + U_ = Ref(U.ptr) + + @chk ccall( + (:KSPHPDDMGetDeflationMat, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{CMat}), + ksp, U_, + ) + + U.ptr = C_NULL + + return nothing +end + +""" + KSPHPDDMSetType(petsclib::PetscLibType,ksp::PetscKSP, type::KSPHPDDMType) + +# External Links +$(_doc_external("KSP/KSPHPDDMSetType")) +""" +function KSPHPDDMSetType(petsclib::PetscLibType, ksp::PetscKSP, type::KSPHPDDMType) end + +@for_petsc function KSPHPDDMSetType(petsclib::$UnionPetscLib, ksp::PetscKSP, type::KSPHPDDMType ) + + @chk ccall( + (:KSPHPDDMSetType, $petsc_library), + PetscErrorCode, + (CKSP, KSPHPDDMType), + ksp, type, + ) + + + return nothing +end + +""" + type::KSPHPDDMType = KSPHPDDMGetType(petsclib::PetscLibType,ksp::PetscKSP) + +# External Links +$(_doc_external("KSP/KSPHPDDMGetType")) +""" +function KSPHPDDMGetType(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPHPDDMGetType(petsclib::$UnionPetscLib, ksp::PetscKSP ) + type_ = Ref{KSPHPDDMType}() + + @chk ccall( + (:KSPHPDDMGetType, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPHPDDMType}), + ksp, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + KSPRichardsonSetScale(petsclib::PetscLibType,ksp::PetscKSP, scale::PetscReal) +Set the damping factor; if this routine is not called, the factor defaults to 1.0. + +Logically Collective + +Input Parameters: +- `ksp` - the iterative context +- `scale` - the damping factor + +Options Database Key: +- `-ksp_richardson_scale ` - Set the scale factor + +Level: intermediate + +-seealso: [](ch_ksp), `KSPRICHARDSON`, `KSPRichardsonSetSelfScale()` + +# External Links +$(_doc_external("KSP/KSPRichardsonSetScale")) +""" +function KSPRichardsonSetScale(petsclib::PetscLibType, ksp::PetscKSP, scale::PetscReal) end + +@for_petsc function KSPRichardsonSetScale(petsclib::$UnionPetscLib, ksp::PetscKSP, scale::$PetscReal ) + + @chk ccall( + (:KSPRichardsonSetScale, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal), + ksp, scale, + ) + + + return nothing +end + +""" + KSPRichardsonSetSelfScale(petsclib::PetscLibType,ksp::PetscKSP, scale::PetscBool) +Sets Richardson to automatically determine optimal scaling at each iteration to minimize the 2 +preconditioned residual + +Logically Collective + +Input Parameters: +- `ksp` - the iterative context +- `scale` - `PETSC_TRUE` or the default of `PETSC_FALSE` + +Options Database Key: +- `-ksp_richardson_self_scale` - Use self-scaling + +Level: intermediate + +-seealso: [](ch_ksp), `KSPRICHARDSON`, `KSPRichardsonSetScale()` + +# External Links +$(_doc_external("KSP/KSPRichardsonSetSelfScale")) +""" +function KSPRichardsonSetSelfScale(petsclib::PetscLibType, ksp::PetscKSP, scale::PetscBool) end + +@for_petsc function KSPRichardsonSetSelfScale(petsclib::$UnionPetscLib, ksp::PetscKSP, scale::PetscBool ) + + @chk ccall( + (:KSPRichardsonSetSelfScale, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, scale, + ) + + + return nothing +end + +""" + KSPFETIDPSetPressureOperator(petsclib::PetscLibType,ksp::PetscKSP, P::PetscMat) +Sets the operator used to set up the pressure preconditioner for the saddle point `KSPFETIDP` solver, + +Collective + +Input Parameters: +- `ksp` - the `KSPFETIDP` solver +- `P` - the linear operator to be preconditioned, usually the mass matrix. + +Level: advanced + +-seealso: [](ch_ksp), `KSPFETIDP`, `MATIS`, `PCBDDC`, `KSPFETIDPGetInnerBDDC()`, `KSPFETIDPGetInnerKSP()`, `KSPSetOperators()` + +# External Links +$(_doc_external("KSP/KSPFETIDPSetPressureOperator")) +""" +function KSPFETIDPSetPressureOperator(petsclib::PetscLibType, ksp::PetscKSP, P::PetscMat) end + +@for_petsc function KSPFETIDPSetPressureOperator(petsclib::$UnionPetscLib, ksp::PetscKSP, P::PetscMat ) + + @chk ccall( + (:KSPFETIDPSetPressureOperator, $petsc_library), + PetscErrorCode, + (CKSP, CMat), + ksp, P, + ) + + + return nothing +end + +""" + KSPFETIDPGetInnerKSP(petsclib::PetscLibType,ksp::PetscKSP, innerksp::PetscKSP) +Gets the `KSP` object for the Lagrange multipliers from inside a `KSPFETIDP` + +Input Parameter: +- `ksp` - the `KSPFETIDP` + +Output Parameter: +- `innerksp` - the `KSP` for the multipliers + +Level: advanced + +-seealso: [](ch_ksp), `KSPFETIDP`, `MATIS`, `PCBDDC`, `KSPFETIDPSetInnerBDDC()`, `KSPFETIDPGetInnerBDDC()` + +# External Links +$(_doc_external("KSP/KSPFETIDPGetInnerKSP")) +""" +function KSPFETIDPGetInnerKSP(petsclib::PetscLibType, ksp::PetscKSP, innerksp::PetscKSP) end + +@for_petsc function KSPFETIDPGetInnerKSP(petsclib::$UnionPetscLib, ksp::PetscKSP, innerksp::PetscKSP ) + innerksp_ = Ref(innerksp.ptr) + + @chk ccall( + (:KSPFETIDPGetInnerKSP, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{CKSP}), + ksp, innerksp_, + ) + + innerksp.ptr = C_NULL + + return nothing +end + +""" + KSPFETIDPGetInnerBDDC(petsclib::PetscLibType,ksp::PetscKSP, pc::PC) +Gets the `PCBDDC` preconditioner used to set up the `KSPFETIDP` matrix for the Lagrange multipliers + +Input Parameter: +- `ksp` - the `KSPFETIDP` Krylov solver + +Output Parameter: +- `pc` - the `PCBDDC` preconditioner + +Level: advanced + +-seealso: [](ch_ksp), `MATIS`, `PCBDDC`, `KSPFETIDP`, `KSPFETIDPSetInnerBDDC()`, `KSPFETIDPGetInnerKSP()` + +# External Links +$(_doc_external("KSP/KSPFETIDPGetInnerBDDC")) +""" +function KSPFETIDPGetInnerBDDC(petsclib::PetscLibType, ksp::PetscKSP, pc::PC) end + +@for_petsc function KSPFETIDPGetInnerBDDC(petsclib::$UnionPetscLib, ksp::PetscKSP, pc::PC ) + + @chk ccall( + (:KSPFETIDPGetInnerBDDC, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PC}), + ksp, pc, + ) + + + return nothing +end + +""" + KSPFETIDPSetInnerBDDC(petsclib::PetscLibType,ksp::PetscKSP, pc::PC) +Provides the `PCBDDC` preconditioner used to set up the `KSPFETIDP` matrix for the Lagrange multipliers + +Collective + +Input Parameters: +- `ksp` - the `KSPFETIDP` Krylov solver +- `pc` - the `PCBDDC` preconditioner + +Level: advanced + +-seealso: [](ch_ksp), `MATIS`, `PCBDDC`, `KSPFETIDPGetInnerBDDC()`, `KSPFETIDPGetInnerKSP()` + +# External Links +$(_doc_external("KSP/KSPFETIDPSetInnerBDDC")) +""" +function KSPFETIDPSetInnerBDDC(petsclib::PetscLibType, ksp::PetscKSP, pc::PC) end + +@for_petsc function KSPFETIDPSetInnerBDDC(petsclib::$UnionPetscLib, ksp::PetscKSP, pc::PC ) + + @chk ccall( + (:KSPFETIDPSetInnerBDDC, $petsc_library), + PetscErrorCode, + (CKSP, PC), + ksp, pc, + ) + + + return nothing +end + +""" + KSPBCGSLSetXRes(petsclib::PetscLibType,ksp::PetscKSP, delta::PetscReal) +Sets the parameter governing when +exact residuals will be used instead of computed residuals for `KSPCBGSL`. + +Logically Collective + +Input Parameters: +- `ksp` - iterative context of type `KSPBCGSL` +- `delta` - computed residuals are used alone when delta is not positive + +Options Database Key: +- `-ksp_bcgsl_xres delta` - Threshold used to decide when to refresh computed residuals + +Level: intermediate + +-seealso: [](ch_ksp), `KSPBCGSLSetEll()`, `KSPBCGSLSetPol()`, `KSP`, `KSPCBGSL`, `KSPBCGSLSetUsePseudoinverse()` + +# External Links +$(_doc_external("KSP/KSPBCGSLSetXRes")) +""" +function KSPBCGSLSetXRes(petsclib::PetscLibType, ksp::PetscKSP, delta::PetscReal) end + +@for_petsc function KSPBCGSLSetXRes(petsclib::$UnionPetscLib, ksp::PetscKSP, delta::$PetscReal ) + + @chk ccall( + (:KSPBCGSLSetXRes, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal), + ksp, delta, + ) + + + return nothing +end + +""" + KSPBCGSLSetUsePseudoinverse(petsclib::PetscLibType,ksp::PetscKSP, use_pinv::PetscBool) +Use pseudoinverse (via SVD) to solve polynomial part of the update in `KSPCBGSL` solver + +Logically Collective + +Input Parameters: +- `ksp` - iterative context of type `KSPCBGSL` +- `use_pinv` - set to `PETSC_TRUE` when using pseudoinverse + +Options Database Key: +- `-ksp_bcgsl_pinv ` - use pseudoinverse + +Level: intermediate + +-seealso: [](ch_ksp), `KSPBCGSLSetEll()`, `KSP`, `KSPCBGSL`, `KSPBCGSLSetPol()`, `KSPBCGSLSetXRes()` + +# External Links +$(_doc_external("KSP/KSPBCGSLSetUsePseudoinverse")) +""" +function KSPBCGSLSetUsePseudoinverse(petsclib::PetscLibType, ksp::PetscKSP, use_pinv::PetscBool) end + +@for_petsc function KSPBCGSLSetUsePseudoinverse(petsclib::$UnionPetscLib, ksp::PetscKSP, use_pinv::PetscBool ) + + @chk ccall( + (:KSPBCGSLSetUsePseudoinverse, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, use_pinv, + ) + + + return nothing +end + +""" + KSPBCGSLSetPol(petsclib::PetscLibType,ksp::PetscKSP, uMROR::PetscBool) +Sets the type of polynomial part that will +be used in the `KSPCBGSL` `KSPSolve()` + +Logically Collective + +Input Parameters: +- `ksp` - iterative context of type `KSPCBGSL` +- `uMROR` - set to `PETSC_TRUE` when the polynomial is a convex combination of an MR and an OR step. + +Options Database Keys: +- `-ksp_bcgsl_cxpoly` - use enhanced polynomial +- `-ksp_bcgsl_mrpoly` - use standard polynomial + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPBCGSL`, `KSPCreate()`, `KSPSetType()`, `KSPCBGSL`, `KSPBCGSLSetUsePseudoinverse()`, `KSPBCGSLSetEll()`, `KSPBCGSLSetXRes()` + +# External Links +$(_doc_external("KSP/KSPBCGSLSetPol")) +""" +function KSPBCGSLSetPol(petsclib::PetscLibType, ksp::PetscKSP, uMROR::PetscBool) end + +@for_petsc function KSPBCGSLSetPol(petsclib::$UnionPetscLib, ksp::PetscKSP, uMROR::PetscBool ) + + @chk ccall( + (:KSPBCGSLSetPol, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, uMROR, + ) + + + return nothing +end + +""" + KSPBCGSLSetEll(petsclib::PetscLibType,ksp::PetscKSP, ell::PetscInt) +Sets the number of search directions to use in the `KSPBCGSL` Krylov solver + +Logically Collective + +Input Parameters: +- `ksp` - iterative context, `KSP`, of type `KSPBCGSL` +- `ell` - number of search directions to use + +Options Database Key: +- `-ksp_bcgsl_ell ell` - Number of Krylov search directions + +Level: intermediate + +-seealso: [](ch_ksp), `KSPBCGSLSetUsePseudoinverse()`, `KSP`, `KSPBCGSL`, `KSPBCGSLSetPol()`, `KSPBCGSLSetXRes()` + +# External Links +$(_doc_external("KSP/KSPBCGSLSetEll")) +""" +function KSPBCGSLSetEll(petsclib::PetscLibType, ksp::PetscKSP, ell::PetscInt) end + +@for_petsc function KSPBCGSLSetEll(petsclib::$UnionPetscLib, ksp::PetscKSP, ell::$PetscInt ) + + @chk ccall( + (:KSPBCGSLSetEll, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, ell, + ) + + + return nothing +end + +""" + KSPQCGSetTrustRegionRadius(petsclib::PetscLibType,ksp::PetscKSP, delta::PetscReal) +Sets the radius of the trust region for `KSPQCG` + +Logically Collective + +Input Parameters: +- `ksp` - the iterative context +- `delta` - the trust region radius (Infinity is the default) + +Options Database Key: +- `-ksp_qcg_trustregionradius ` - trust region radius + +Level: advanced + +-seealso: [](ch_ksp), `KSPQCG`, `KSPQCGGetTrialStepNorm()` + +# External Links +$(_doc_external("KSP/KSPQCGSetTrustRegionRadius")) +""" +function KSPQCGSetTrustRegionRadius(petsclib::PetscLibType, ksp::PetscKSP, delta::PetscReal) end + +@for_petsc function KSPQCGSetTrustRegionRadius(petsclib::$UnionPetscLib, ksp::PetscKSP, delta::$PetscReal ) + + @chk ccall( + (:KSPQCGSetTrustRegionRadius, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal), + ksp, delta, + ) + + + return nothing +end + +""" + tsnorm::PetscReal = KSPQCGGetTrialStepNorm(petsclib::PetscLibType,ksp::PetscKSP) +Gets the norm of a trial step vector in `KSPQCG`. The WCG step may be +constrained, so this is not necessarily the length of the ultimate step taken in `KSPQCG`. + +Not Collective + +Input Parameter: +- `ksp` - the iterative context + +Output Parameter: +- `tsnorm` - the norm + +Level: advanced + +-seealso: [](ch_ksp), `KSPQCG`, `KSPQCGSetTrustRegionRadius()` + +# External Links +$(_doc_external("KSP/KSPQCGGetTrialStepNorm")) +""" +function KSPQCGGetTrialStepNorm(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPQCGGetTrialStepNorm(petsclib::$UnionPetscLib, ksp::PetscKSP ) + tsnorm_ = Ref{$PetscReal}() + + @chk ccall( + (:KSPQCGGetTrialStepNorm, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}), + ksp, tsnorm_, + ) + + tsnorm = tsnorm_[] + + return tsnorm +end + +""" + quadratic::PetscReal = KSPQCGGetQuadratic(petsclib::PetscLibType,ksp::PetscKSP) +Gets the value of the quadratic function, evaluated at the new iterate + +Collective + +Input Parameter: +- `ksp` - the iterative context + +Output Parameter: +- `quadratic` - the quadratic function evaluated at the new iterate + +Level: advanced + +-seealso: [](ch_ksp), `KSPQCG` + +# External Links +$(_doc_external("KSP/KSPQCGGetQuadratic")) +""" +function KSPQCGGetQuadratic(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPQCGGetQuadratic(petsclib::$UnionPetscLib, ksp::PetscKSP ) + quadratic_ = Ref{$PetscReal}() + + @chk ccall( + (:KSPQCGGetQuadratic, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}), + ksp, quadratic_, + ) + + quadratic = quadratic_[] + + return quadratic +end + +""" + KSPGCRSetModifyPC(petsclib::PetscLibType,ksp::PetscKSP, fnc::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) +Sets the routine used by `KSPGCR` to modify the preconditioner for each iteration + +Logically Collective + +Input Parameters: +- `ksp` - iterative context obtained from `KSPCreate()` +- `function` - user defined function to modify the preconditioner, see `KSPFlexibleModifyPCFn` +- `ctx` - user provided context for the modify preconditioner function +- `destroy` - the function to use to destroy the user provided application context. + +Level: intermediate + +-seealso: [](ch_ksp), `KSP`, `KSPGCR`, `KSPFlexibleModifyPCFn`, `KSPFGMRESModifyPCFn`, [](sec_flexibleksp) + +# External Links +$(_doc_external("KSP/KSPGCRSetModifyPC")) +""" +function KSPGCRSetModifyPC(petsclib::PetscLibType, ksp::PetscKSP, fnc::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) end + +@for_petsc function KSPGCRSetModifyPC(petsclib::$UnionPetscLib, ksp::PetscKSP, fnc::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn ) + + @chk ccall( + (:KSPGCRSetModifyPC, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPFlexibleModifyPCFn}, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + ksp, fnc, ctx, destroy, + ) + + + return nothing +end + +""" + KSPGCRSetRestart(petsclib::PetscLibType,ksp::PetscKSP, restart::PetscInt) +Sets number of iterations at which `KSPGCR` restarts. + +Not Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `restart` - integer restart value + +Options Database Key: +- `-ksp_gcr_restart ` - the number of stored vectors to orthogonalize against + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGCR`, `KSPSetTolerances()`, `KSPGCRGetRestart()`, `KSPGMRESSetRestart()` + +# External Links +$(_doc_external("KSP/KSPGCRSetRestart")) +""" +function KSPGCRSetRestart(petsclib::PetscLibType, ksp::PetscKSP, restart::PetscInt) end + +@for_petsc function KSPGCRSetRestart(petsclib::$UnionPetscLib, ksp::PetscKSP, restart::$PetscInt ) + + @chk ccall( + (:KSPGCRSetRestart, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, restart, + ) + + + return nothing +end + +""" + restart::PetscInt = KSPGCRGetRestart(petsclib::PetscLibType,ksp::PetscKSP) +Gets number of iterations at which `KSPGCR` restarts. + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `restart` - integer restart value + +Level: intermediate + +-seealso: [](ch_ksp), `KSPGCR`, `KSPSetTolerances()`, `KSPGCRSetRestart()`, `KSPGMRESGetRestart()` + +# External Links +$(_doc_external("KSP/KSPGCRGetRestart")) +""" +function KSPGCRGetRestart(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPGCRGetRestart(petsclib::$UnionPetscLib, ksp::PetscKSP ) + restart_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPGCRGetRestart, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, restart_, + ) + + restart = restart_[] + + return restart +end + +""" + KSPPIPEGCRSetUnrollW(petsclib::PetscLibType,ksp::PetscKSP, unroll_w::PetscBool) +Set to `PETSC_TRUE` to use `KSPPIPEGCR` with unrolling of the w vector + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `unroll_w` - use unrolling + +Level: intermediate + +Options Database Key: +- `-ksp_pipegcr_unroll_w ` - use unrolling + +-seealso: [](ch_ksp), `KSPPIPEGCR`, `KSPPIPEGCRSetTruncationType()`, `KSPPIPEGCRSetNprealloc()`, `KSPPIPEGCRGetUnrollW()` + +# External Links +$(_doc_external("KSP/KSPPIPEGCRSetUnrollW")) +""" +function KSPPIPEGCRSetUnrollW(petsclib::PetscLibType, ksp::PetscKSP, unroll_w::PetscBool) end + +@for_petsc function KSPPIPEGCRSetUnrollW(petsclib::$UnionPetscLib, ksp::PetscKSP, unroll_w::PetscBool ) + + @chk ccall( + (:KSPPIPEGCRSetUnrollW, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, unroll_w, + ) + + + return nothing +end + +""" + unroll_w::PetscBool = KSPPIPEGCRGetUnrollW(petsclib::PetscLibType,ksp::PetscKSP) +Get information on `KSPPIPEGCR` if it uses unrolling the w vector + +Logically Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `unroll_w` - `KSPPIPEGCR` uses unrolling (bool) + +Level: intermediate + +-seealso: [](ch_ksp), `KSPPIPEGCR`, `KSPPIPEGCRGetTruncationType()`, `KSPPIPEGCRGetNprealloc()`, `KSPPIPEGCRSetUnrollW()` + +# External Links +$(_doc_external("KSP/KSPPIPEGCRGetUnrollW")) +""" +function KSPPIPEGCRGetUnrollW(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPPIPEGCRGetUnrollW(petsclib::$UnionPetscLib, ksp::PetscKSP ) + unroll_w_ = Ref{PetscBool}() + + @chk ccall( + (:KSPPIPEGCRGetUnrollW, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, unroll_w_, + ) + + unroll_w = unroll_w_[] + + return unroll_w +end + +""" + KSPPIPEGCRSetMmax(petsclib::PetscLibType,ksp::PetscKSP, mmax::PetscInt) +set the maximum number of previous directions `KSPPIPEGCR` will store for orthogonalization + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `mmax` - the maximum number of previous directions to orthogonalize against + +Options Database Key: +- `-ksp_pipegcr_mmax ` - maximum number of previous directions + +Level: intermediate + +-seealso: [](ch_ksp), `KSPPIPEGCR`, `KSPPIPEGCRSetTruncationType()`, `KSPPIPEGCRSetNprealloc()` + +# External Links +$(_doc_external("KSP/KSPPIPEGCRSetMmax")) +""" +function KSPPIPEGCRSetMmax(petsclib::PetscLibType, ksp::PetscKSP, mmax::PetscInt) end + +@for_petsc function KSPPIPEGCRSetMmax(petsclib::$UnionPetscLib, ksp::PetscKSP, mmax::$PetscInt ) + + @chk ccall( + (:KSPPIPEGCRSetMmax, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, mmax, + ) + + + return nothing +end + +""" + mmax::PetscInt = KSPPIPEGCRGetMmax(petsclib::PetscLibType,ksp::PetscKSP) +get the maximum number of previous directions `KSPPIPEGCR` will store + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `mmax` - the maximum number of previous directions allowed for orthogonalization + +Level: intermediate + +-seealso: [](ch_ksp), `KSPPIPEGCR`, `KSPPIPEGCRGetTruncationType()`, `KSPPIPEGCRGetNprealloc()`, `KSPPIPEGCRSetMmax()` + +# External Links +$(_doc_external("KSP/KSPPIPEGCRGetMmax")) +""" +function KSPPIPEGCRGetMmax(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPPIPEGCRGetMmax(petsclib::$UnionPetscLib, ksp::PetscKSP ) + mmax_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPPIPEGCRGetMmax, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, mmax_, + ) + + mmax = mmax_[] + + return mmax +end + +""" + KSPPIPEGCRSetNprealloc(petsclib::PetscLibType,ksp::PetscKSP, nprealloc::PetscInt) +set the number of directions to preallocate with `KSPPIPEGCR` + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `nprealloc` - the number of vectors to preallocate + +Level: advanced + +Options Database Key: +- `-ksp_pipegcr_nprealloc ` - number of vectors to preallocate + +-seealso: [](ch_ksp), `KSPPIPEGCR`, `KSPPIPEGCRGetTruncationType()`, `KSPPIPEGCRGetNprealloc()` + +# External Links +$(_doc_external("KSP/KSPPIPEGCRSetNprealloc")) +""" +function KSPPIPEGCRSetNprealloc(petsclib::PetscLibType, ksp::PetscKSP, nprealloc::PetscInt) end + +@for_petsc function KSPPIPEGCRSetNprealloc(petsclib::$UnionPetscLib, ksp::PetscKSP, nprealloc::$PetscInt ) + + @chk ccall( + (:KSPPIPEGCRSetNprealloc, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt), + ksp, nprealloc, + ) + + + return nothing +end + +""" + nprealloc::PetscInt = KSPPIPEGCRGetNprealloc(petsclib::PetscLibType,ksp::PetscKSP) +get the number of directions preallocate by `KSPPIPEGCR` + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `nprealloc` - the number of directions preallocated + +Level: advanced + +-seealso: [](ch_ksp), `KSPPIPEGCR`, `KSPPIPEGCRGetTruncationType()`, `KSPPIPEGCRSetNprealloc()` + +# External Links +$(_doc_external("KSP/KSPPIPEGCRGetNprealloc")) +""" +function KSPPIPEGCRGetNprealloc(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPPIPEGCRGetNprealloc(petsclib::$UnionPetscLib, ksp::PetscKSP ) + nprealloc_ = Ref{$PetscInt}() + + @chk ccall( + (:KSPPIPEGCRGetNprealloc, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscInt}), + ksp, nprealloc_, + ) + + nprealloc = nprealloc_[] + + return nprealloc +end + +""" + KSPPIPEGCRSetTruncationType(petsclib::PetscLibType,ksp::PetscKSP, truncstrat::KSPFCDTruncationType) +specify how many of its stored previous directions `KSPPIPEGCR` uses during orthogonalization + +Logically Collective + +Input Parameters: +- `ksp` - the Krylov space context +- `truncstrat` - the choice of strategy +-seealso: [](ch_ksp), `KSPPIPEGCR`, `KSPPIPEGCRTruncationType`, `KSPFCDTruncationType`, `KSP_FCD_TRUNC_TYPE_STANDARD`, `KSP_FCD_TRUNC_TYPE_NOTAY` + +# External Links +$(_doc_external("KSP/KSPPIPEGCRSetTruncationType")) +""" +function KSPPIPEGCRSetTruncationType(petsclib::PetscLibType, ksp::PetscKSP, truncstrat::KSPFCDTruncationType) end + +@for_petsc function KSPPIPEGCRSetTruncationType(petsclib::$UnionPetscLib, ksp::PetscKSP, truncstrat::KSPFCDTruncationType ) + + @chk ccall( + (:KSPPIPEGCRSetTruncationType, $petsc_library), + PetscErrorCode, + (CKSP, KSPFCDTruncationType), + ksp, truncstrat, + ) + + + return nothing +end + +""" + truncstrat::KSPFCDTruncationType = KSPPIPEGCRGetTruncationType(petsclib::PetscLibType,ksp::PetscKSP) +get the truncation strategy employed by `KSPPIPEGCR` + +Not Collective + +Input Parameter: +- `ksp` - the Krylov space context + +Output Parameter: +- `truncstrat` - the strategy type +-seealso: [](ch_ksp), `KSPPIPEGCR`, `KSPPIPEGCRSetTruncationType`, `KSPPIPEGCRTruncationType`, `KSPFCDTruncationType`, `KSP_FCD_TRUNC_TYPE_STANDARD`, `KSP_FCD_TRUNC_TYPE_NOTAY` + +# External Links +$(_doc_external("KSP/KSPPIPEGCRGetTruncationType")) +""" +function KSPPIPEGCRGetTruncationType(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPPIPEGCRGetTruncationType(petsclib::$UnionPetscLib, ksp::PetscKSP ) + truncstrat_ = Ref{KSPFCDTruncationType}() + + @chk ccall( + (:KSPPIPEGCRGetTruncationType, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPFCDTruncationType}), + ksp, truncstrat_, + ) + + truncstrat = unsafe_string(truncstrat_[]) + + return truncstrat +end + +""" + KSPPIPEGCRSetModifyPC(petsclib::PetscLibType,ksp::PetscKSP, fnc::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) +Sets the routine used by `KSPPIPEGCR` to modify the preconditioner at each iteration + +Logically Collective + +Input Parameters: +- `ksp` - iterative context obtained from `KSPCreate()` +- `function` - user defined function to modify the preconditioner, see `KSPFlexibleModifyPCFn` +- `ctx` - user provided context for the modify preconditioner function +- `destroy` - the function to use to destroy the user provided application context. + +Level: intermediate + +-seealso: [](ch_ksp), `KSPFlexibleSetModifyPC()`, `KSPFlexibleModifyPCFn`, `KSPPIPEGCR` + +# External Links +$(_doc_external("KSP/KSPPIPEGCRSetModifyPC")) +""" +function KSPPIPEGCRSetModifyPC(petsclib::PetscLibType, ksp::PetscKSP, fnc::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn) end + +@for_petsc function KSPPIPEGCRSetModifyPC(petsclib::$UnionPetscLib, ksp::PetscKSP, fnc::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn ) + + @chk ccall( + (:KSPPIPEGCRSetModifyPC, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{KSPFlexibleModifyPCFn}, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + ksp, fnc, ctx, destroy, + ) + + + return nothing +end + +""" + KSPMINRESSetUseQLP(petsclib::PetscLibType,ksp::PetscKSP, qlp::PetscBool) +Use the QLP variant of `KSPMINRES` + +Logically Collective + +Input Parameters: +- `ksp` - the iterative context +- `qlp` - a Boolean indicating if the QLP variant should be used + +Level: beginner + +-seealso: [](ch_ksp), `KSP`, `KSPMINRES`, `KSPMINRESGetUseQLP()` + +# External Links +$(_doc_external("KSP/KSPMINRESSetUseQLP")) +""" +function KSPMINRESSetUseQLP(petsclib::PetscLibType, ksp::PetscKSP, qlp::PetscBool) end + +@for_petsc function KSPMINRESSetUseQLP(petsclib::$UnionPetscLib, ksp::PetscKSP, qlp::PetscBool ) + + @chk ccall( + (:KSPMINRESSetUseQLP, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, qlp, + ) + + + return nothing +end + +""" + KSPMINRESSetRadius(petsclib::PetscLibType,ksp::PetscKSP, radius::PetscReal) +Set the maximum solution norm allowed for use with trust region methods + +Logically Collective + +Input Parameters: +- `ksp` - the iterative context +- `radius` - the value + +Level: beginner + +Options Database Key: +- `-ksp_minres_radius ` - maximum allowed solution norm + +-seealso: [](ch_ksp), `KSP`, `KSPMINRES`, `KSPMINRESSetUseQLP()` + +# External Links +$(_doc_external("KSP/KSPMINRESSetRadius")) +""" +function KSPMINRESSetRadius(petsclib::PetscLibType, ksp::PetscKSP, radius::PetscReal) end + +@for_petsc function KSPMINRESSetRadius(petsclib::$UnionPetscLib, ksp::PetscKSP, radius::$PetscReal ) + + @chk ccall( + (:KSPMINRESSetRadius, $petsc_library), + PetscErrorCode, + (CKSP, $PetscReal), + ksp, radius, + ) + + + return nothing +end + +""" + qlp::PetscBool = KSPMINRESGetUseQLP(petsclib::PetscLibType,ksp::PetscKSP) +Get the flag that indicates if the QLP variant is being used + +Logically Collective + +Input Parameter: +- `ksp` - the iterative context + +Output Parameter: +- `qlp` - a Boolean indicating if the QLP variant is used + +Level: beginner + +-seealso: [](ch_ksp), `KSP`, `KSPMINRES`, `KSPMINRESSetUseQLP()` + +# External Links +$(_doc_external("KSP/KSPMINRESGetUseQLP")) +""" +function KSPMINRESGetUseQLP(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPMINRESGetUseQLP(petsclib::$UnionPetscLib, ksp::PetscKSP ) + qlp_ = Ref{PetscBool}() + + @chk ccall( + (:KSPMINRESGetUseQLP, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{PetscBool}), + ksp, qlp_, + ) + + qlp = qlp_[] + + return qlp +end + +""" + KSPLSQRSetComputeStandardErrorVec(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Compute a vector of standard error estimates during `KSPSolve()` for `KSPLSQR`. + +Logically Collective + +Input Parameters: +- `ksp` - iterative context +- `flg` - compute the vector of standard estimates or not + +Level: intermediate + +-seealso: [](ch_ksp), `KSPSolve()`, `KSPLSQR`, `KSPLSQRGetStandardErrorVec()` + +# External Links +$(_doc_external("KSP/KSPLSQRSetComputeStandardErrorVec")) +""" +function KSPLSQRSetComputeStandardErrorVec(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPLSQRSetComputeStandardErrorVec(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPLSQRSetComputeStandardErrorVec, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + KSPLSQRSetExactMatNorm(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool) +Compute exact matrix norm instead of iteratively refined estimate. + +Not Collective + +Input Parameters: +- `ksp` - iterative context +- `flg` - compute exact matrix norm or not + +Level: intermediate + +-seealso: [](ch_ksp), `KSPSolve()`, `KSPLSQR`, `KSPLSQRGetNorms()`, `KSPLSQRConvergedDefault()` + +# External Links +$(_doc_external("KSP/KSPLSQRSetExactMatNorm")) +""" +function KSPLSQRSetExactMatNorm(petsclib::PetscLibType, ksp::PetscKSP, flg::PetscBool) end + +@for_petsc function KSPLSQRSetExactMatNorm(petsclib::$UnionPetscLib, ksp::PetscKSP, flg::PetscBool ) + + @chk ccall( + (:KSPLSQRSetExactMatNorm, $petsc_library), + PetscErrorCode, + (CKSP, PetscBool), + ksp, flg, + ) + + + return nothing +end + +""" + KSPLSQRGetStandardErrorVec(petsclib::PetscLibType,ksp::PetscKSP, se::PetscVec) +Get vector of standard error estimates. +Only available if -ksp_lsqr_set_standard_error was set to true +or `KSPLSQRSetComputeStandardErrorVec`(ksp, `PETSC_TRUE`) was called. +Otherwise returns `NULL`. + +Not Collective + +Input Parameter: +- `ksp` - iterative context + +Output Parameter: +- `se` - vector of standard estimates + +Level: intermediate + +-seealso: [](ch_ksp), `KSPSolve()`, `KSPLSQR`, `KSPLSQRSetComputeStandardErrorVec()` + +# External Links +$(_doc_external("KSP/KSPLSQRGetStandardErrorVec")) +""" +function KSPLSQRGetStandardErrorVec(petsclib::PetscLibType, ksp::PetscKSP, se::PetscVec) end + +@for_petsc function KSPLSQRGetStandardErrorVec(petsclib::$UnionPetscLib, ksp::PetscKSP, se::PetscVec ) + se_ = Ref(se.ptr) + + @chk ccall( + (:KSPLSQRGetStandardErrorVec, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{CVec}), + ksp, se_, + ) + + se.ptr = C_NULL + + return nothing +end + +""" + arnorm::PetscReal,anorm::PetscReal = KSPLSQRGetNorms(petsclib::PetscLibType,ksp::PetscKSP) +Get the norm estimates that `KSPLSQR` computes internally during `KSPSolve()`. + +Not Collective + +Input Parameter: +- `ksp` - iterative context + +Output Parameters: +- `arnorm` - good estimate of (A*Pmat^{-T})*r, where r = A x - b, used in specific stopping criterion +- `anorm` - poor estimate of A*Pmat^{-T}_{frobenius} used in specific stopping criterion + +Level: intermediate + +-seealso: [](ch_ksp), `KSPSolve()`, `KSPLSQR`, `KSPLSQRSetExactMatNorm()` + +# External Links +$(_doc_external("KSP/KSPLSQRGetNorms")) +""" +function KSPLSQRGetNorms(petsclib::PetscLibType, ksp::PetscKSP) end + +@for_petsc function KSPLSQRGetNorms(petsclib::$UnionPetscLib, ksp::PetscKSP ) + arnorm_ = Ref{$PetscReal}() + anorm_ = Ref{$PetscReal}() + + @chk ccall( + (:KSPLSQRGetNorms, $petsc_library), + PetscErrorCode, + (CKSP, Ptr{$PetscReal}, Ptr{$PetscReal}), + ksp, arnorm_, anorm_, + ) + + arnorm = arnorm_[] + anorm = anorm_[] + + return arnorm,anorm +end + +""" + KSPLSQRMonitorResidual(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Prints the residual norm, as well as the normal equation residual norm, at each iteration of an iterative solver for the `KSPLSQR` solver + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_lsqr_monitor` - Activates `KSPLSQRMonitorResidual()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPLSQR`, `KSPMonitorSet()`, `KSPMonitorResidual()`, `KSPMonitorTrueResidualMaxNorm()`, `KSPLSQRMonitorResidualDrawLG()` + +# External Links +$(_doc_external("KSP/KSPLSQRMonitorResidual")) +""" +function KSPLSQRMonitorResidual(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPLSQRMonitorResidual(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPLSQRMonitorResidual, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPLSQRMonitorResidualDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Plots the true residual norm at each iteration of an iterative solver for the `KSPLSQR` solver + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-ksp_lsqr_monitor draw::draw_lg` - Activates `KSPMonitorTrueResidualDrawLG()` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPLSQR`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `KSPLSQRMonitorResidual()`, `KSPLSQRMonitorResidualDrawLGCreate()` + +# External Links +$(_doc_external("KSP/KSPLSQRMonitorResidualDrawLG")) +""" +function KSPLSQRMonitorResidualDrawLG(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPLSQRMonitorResidualDrawLG(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPLSQRMonitorResidualDrawLG, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + vf::PetscViewerAndFormat = KSPLSQRMonitorResidualDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) +Creates the line graph object for the `KSPLSQR` residual and normal equation residual norm + +Collective + +Input Parameters: +- `viewer` - The `PetscViewer` +- `format` - The viewer format +- `ctx` - An optional user context + +Output Parameter: +- `vf` - The `PetscViewerAndFormat` + +Level: intermediate + +-seealso: [](ch_ksp), `KSPLSQR`, `KSPMonitorSet()`, `KSPLSQRMonitorResidual()`, `KSPLSQRMonitorResidualDrawLG()` + +# External Links +$(_doc_external("KSP/KSPLSQRMonitorResidualDrawLGCreate")) +""" +function KSPLSQRMonitorResidualDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) end + +@for_petsc function KSPLSQRMonitorResidualDrawLGCreate(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid ) + vf_ = Ref{PetscViewerAndFormat}() + + @chk ccall( + (:KSPLSQRMonitorResidualDrawLGCreate, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerFormat, Ptr{Cvoid}, PetscViewerAndFormat), + viewer, format, ctx, vf_, + ) + + vf = vf_[] + + return vf +end + +""" + KSPLSQRConvergedDefault(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, reason::KSPConvergedReason, ctx::Cvoid) +Determines convergence of the `KSPLSQR` Krylov method, including a check on the residual norm of the normal equations. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm residual value (may be estimated) +- `ctx` - convergence context which must have been created by `KSPConvergedDefaultCreate()` + +Output Parameter: +- `reason` - the convergence reason + +Level: advanced + +-seealso: [](ch_ksp), `KSPLSQR`, `KSPSetConvergenceTest()`, `KSPSetTolerances()`, `KSPConvergedSkip()`, `KSPConvergedReason`, `KSPGetConvergedReason()`, +`KSPConvergedDefaultSetUIRNorm()`, `KSPConvergedDefaultSetUMIRNorm()`, `KSPConvergedDefaultCreate()`, `KSPConvergedDefaultDestroy()`, +`KSPConvergedDefault()`, `KSPLSQRGetNorms()`, `KSPLSQRSetExactMatNorm()` + +# External Links +$(_doc_external("KSP/KSPLSQRConvergedDefault")) +""" +function KSPLSQRConvergedDefault(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, reason::KSPConvergedReason, ctx::Cvoid) end + +@for_petsc function KSPLSQRConvergedDefault(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, reason::KSPConvergedReason, ctx::Cvoid ) + + @chk ccall( + (:KSPLSQRConvergedDefault, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{KSPConvergedReason}, Ptr{Cvoid}), + ksp, n, rnorm, reason, ctx, + ) + + + return nothing +end + +""" + KSPMonitorSNESResidual(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Prints the `SNES` residual norm, as well as the `KSP` residual norm, at each iteration of a `KSPSolve()` called within a `SNESSolve()`. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context + +Options Database Key: +- `-snes_monitor_ksp` - Activates `KSPMonitorSNESResidual()` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `KSPMonitorSet()`, `KSPMonitorResidual()`, `KSPMonitorTrueResidualMaxNorm()`, `KSPMonitor()`, `SNESMonitor()`, `PetscViewerAndFormat()` + +# External Links +$(_doc_external("Snes/KSPMonitorSNESResidual")) +""" +function KSPMonitorSNESResidual(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorSNESResidual(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorSNESResidual, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + KSPMonitorSNESResidualDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Plots the linear `KSP` residual norm and the `SNES` residual norm of a `KSPSolve()` called within a `SNESSolve()`. + +Collective + +Input Parameters: +- `ksp` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - The viewer context, created with `KSPMonitorSNESResidualDrawLGCreate()` + +Options Database Key: +- `-snes_monitor_ksp draw::draw_lg` - Activates `KSPMonitorSNESResidualDrawLG()` + +Level: intermediate + +-seealso: [](ch_snes), `KSPMonitorSet()`, `KSPMonitorTrueResidual()`, `SNESMonitor()`, `KSPMonitor()`, `KSPMonitorSNESResidualDrawLGCreate()` + +# External Links +$(_doc_external("Snes/KSPMonitorSNESResidualDrawLG")) +""" +function KSPMonitorSNESResidualDrawLG(petsclib::PetscLibType, ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function KSPMonitorSNESResidualDrawLG(petsclib::$UnionPetscLib, ksp::PetscKSP, n::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:KSPMonitorSNESResidualDrawLG, $petsc_library), + PetscErrorCode, + (CKSP, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + ksp, n, rnorm, vf, + ) + + + return nothing +end + +""" + vf::PetscViewerAndFormat = KSPMonitorSNESResidualDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) +Creates the `PetscViewer` used by `KSPMonitorSNESResidualDrawLG()` + +Collective + +Input Parameters: +- `viewer` - The `PetscViewer` +- `format` - The viewer format +- `ctx` - An optional user context + +Output Parameter: +- `vf` - The viewer context + +Level: intermediate + +-seealso: [](ch_snes), `KSP`, `SNES`, `PetscViewerFormat`, `PetscViewerAndFormat`, `KSPMonitorSet()`, `KSPMonitorTrueResidual()` + +# External Links +$(_doc_external("Snes/KSPMonitorSNESResidualDrawLGCreate")) +""" +function KSPMonitorSNESResidualDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid) end + +@for_petsc function KSPMonitorSNESResidualDrawLGCreate(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid ) + vf_ = Ref{PetscViewerAndFormat}() + + @chk ccall( + (:KSPMonitorSNESResidualDrawLGCreate, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerFormat, Ptr{Cvoid}, PetscViewerAndFormat), + viewer, format, ctx, vf_, + ) + + vf = vf_[] + + return vf +end + diff --git a/src/autowrapped/Mat_wrappers.jl b/src/autowrapped/Mat_wrappers.jl new file mode 100644 index 00000000..2709a80c --- /dev/null +++ b/src/autowrapped/Mat_wrappers.jl @@ -0,0 +1,23210 @@ +# autodefined type arguments for class Mat ------ +mutable struct _n_MatNullSpace end +const MatNullSpace = Ptr{_n_MatNullSpace} + +mutable struct _n_MatTransposeColoring end +const MatTransposeColoring = Ptr{_n_MatTransposeColoring} + +mutable struct _n_hypre_ParCSRMatrix end +const hypre_ParCSRMatrix = Ptr{_n_hypre_ParCSRMatrix} + +mutable struct _n_PetscFunctionList end +const PetscFunctionList = Ptr{_n_PetscFunctionList} + +mutable struct MatHtoolKernelFn end + +# ------------------------------------------------------- +""" + MatSetType(petsclib::PetscLibType,mat::PetscMat, matype::MatType) +Builds matrix object for a particular matrix type + +Collective + +Input Parameters: +- `mat` - the matrix object +- `matype` - matrix type + +Options Database Key: +- `-mat_type ` - Sets the type; see `MatType` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `PCSetType()`, `VecSetType()`, `MatCreate()`, `MatType` + +# External Links +$(_doc_external("Mat/MatSetType")) +""" +function MatSetType(petsclib::PetscLibType, mat::PetscMat, matype::MatType) end + +@for_petsc function MatSetType(petsclib::$UnionPetscLib, mat::PetscMat, matype::MatType ) + + @chk ccall( + (:MatSetType, $petsc_library), + PetscErrorCode, + (CMat, MatType), + mat, matype, + ) + + + return nothing +end + +""" + type::MatType = MatGetType(petsclib::PetscLibType,mat::PetscMat) +Gets the matrix type as a string from the matrix object. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `type` - name of matrix type + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatType`, `MatSetType()` + +# External Links +$(_doc_external("Mat/MatGetType")) +""" +function MatGetType(petsclib::PetscLibType, mat::AbstractPetscMat) end + +@for_petsc function MatGetType(petsclib::$UnionPetscLib, mat::AbstractPetscMat ) + type_ = Ref{MatType}() + + @chk ccall( + (:MatGetType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatType}), + mat, type_, + ) + + # Handle NULL type (matrix not yet set up) + if type_[] == C_NULL + return "(not set)" + end + type = unsafe_string(type_[]) + + return type +end + +""" + vtype::VecType = MatGetVecType(petsclib::PetscLibType,mat::PetscMat) +Gets the vector type the matrix will return with `MatCreateVecs()` + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `vtype` - name of vector type + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatType`, `MatSetVecType()`, `VecType` + +# External Links +$(_doc_external("Mat/MatGetVecType")) +""" +function MatGetVecType(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetVecType(petsclib::$UnionPetscLib, mat::PetscMat ) + vtype_ = Ref{VecType}() + + @chk ccall( + (:MatGetVecType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{VecType}), + mat, vtype_, + ) + + vtype = unsafe_string(vtype_[]) + + return vtype +end + +""" + MatSetVecType(petsclib::PetscLibType,mat::PetscMat, vtype::VecType) +Set the vector type the matrix will return with `MatCreateVecs()` + +Collective + +Input Parameters: +- `mat` - the matrix object +- `vtype` - vector type + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `VecType`, `VecSetType()`, `MatGetVecType()` + +# External Links +$(_doc_external("Mat/MatSetVecType")) +""" +function MatSetVecType(petsclib::PetscLibType, mat::PetscMat, vtype::VecType) end + +@for_petsc function MatSetVecType(petsclib::$UnionPetscLib, mat::PetscMat, vtype::VecType ) + + @chk ccall( + (:MatSetVecType, $petsc_library), + PetscErrorCode, + (CMat, VecType), + mat, vtype, + ) + + + return nothing +end + +""" + MatRegister(petsclib::PetscLibType,sname::Vector{Cchar}, fnc::external) +Adds a new matrix type implementation that is usable as a `Mat` in PETSc + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined matrix type +- `function` - routine to create method context + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatType`, `MatSetType()`, `MatRegisterAll()` + +# External Links +$(_doc_external("Mat/MatRegister")) +""" +function MatRegister(petsclib::PetscLibType, sname::Vector{Cchar}, fnc::external) end + +@for_petsc function MatRegister(petsclib::$UnionPetscLib, sname::Vector{Cchar}, fnc::external ) + + @chk ccall( + (:MatRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + MatRegisterRootName(petsclib::PetscLibType,rname::Vector{Cchar}, sname::Vector{Cchar}, mname::Vector{Cchar}) +Registers a name that can be used for either a sequential or its corresponding parallel matrix type. + +Input Parameters: +- `rname` - the rootname, for example, `MATAIJ` +- `sname` - the name of the sequential matrix type, for example, `MATSEQAIJ` +- `mname` - the name of the parallel matrix type, for example, `MATMPIAIJ` + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatType`, `PetscObjectBaseTypeCompare()` + +# External Links +$(_doc_external("Mat/MatRegisterRootName")) +""" +function MatRegisterRootName(petsclib::PetscLibType, rname::Vector{Cchar}, sname::Vector{Cchar}, mname::Vector{Cchar}) end + +@for_petsc function MatRegisterRootName(petsclib::$UnionPetscLib, rname::Vector{Cchar}, sname::Vector{Cchar}, mname::Vector{Cchar} ) + + @chk ccall( + (:MatRegisterRootName, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}), + rname, sname, mname, + ) + + + return nothing +end + +""" + MatProductReplaceMats(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, D::PetscMat) +Replace the input matrices for the matrix + +Collective + +Input Parameters: +- `A` - the matrix or `NULL` if not being replaced +- `B` - the matrix or `NULL` if not being replaced +- `C` - the matrix or `NULL` if not being replaced +- `D` - the matrix whose values are computed via a matrix-matrix product operation + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductCreate()`, `MatProductSetFromOptions()`, `MatProductSymbolic()`, `MatProductClear()` + +# External Links +$(_doc_external("Mat/MatProductReplaceMats")) +""" +function MatProductReplaceMats(petsclib::PetscLibType, A::Union{Ptr,PetscMat}, B::Union{Ptr,PetscMat}, C::Union{Ptr,PetscMat}, D::Union{Ptr,PetscMat}) end + +@for_petsc function MatProductReplaceMats(petsclib::$UnionPetscLib, A::Union{Ptr,PetscMat}, B::Union{Ptr,PetscMat}, C::Union{Ptr,PetscMat}, D::Union{Ptr,PetscMat}) + + @chk ccall( + (:MatProductReplaceMats, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, CMat), + A, B, C, D, + ) + + + return nothing +end + +""" + MatProductSetFromOptions(petsclib::PetscLibType,mat::PetscMat) +Sets the options for the computation of a matrix +the algorithm etc are determined from the options database. + +Logically Collective + +Input Parameter: +- `mat` - the matrix whose values are computed via a matrix-matrix product operation + +Options Database Keys: +- `-mat_product_clear` - Clear intermediate data structures after `MatProductNumeric()` has been called +- `-mat_product_algorithm ` - Sets the algorithm, see `MatProductAlgorithm` for possible values +- `-mat_product_algorithm_backend_cpu` - Use the CPU to perform the computation even if the matrix is a GPU matrix + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatSetFromOptions()`, `MatProductCreate()`, `MatProductCreateWithMat()`, `MatProductNumeric()`, +`MatProductSetType()`, `MatProductSetAlgorithm()`, `MatProductAlgorithm` + +# External Links +$(_doc_external("Mat/MatProductSetFromOptions")) +""" +function MatProductSetFromOptions(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatProductSetFromOptions(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatProductSetFromOptions, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + MatProductView(petsclib::PetscLibType,mat::PetscMat, viewer::PetscViewer) +View the private matrix + +Logically Collective + +Input Parameters: +- `mat` - the matrix obtained with `MatProductCreate()` or `MatProductCreateWithMat()` +- `viewer` - where the information on the matrix-matrix algorithm of `mat` should be reviewed + +Level: intermediate + +-seealso: [](ch_matrices), `MatProductType`, `Mat`, `MatProductSetFromOptions()`, `MatView()`, `MatProductCreate()`, `MatProductCreateWithMat()` + +# External Links +$(_doc_external("Mat/MatProductView")) +""" +function MatProductView(petsclib::PetscLibType, mat::PetscMat, viewer::PetscViewer) end + +@for_petsc function MatProductView(petsclib::$UnionPetscLib, mat::PetscMat, viewer::PetscViewer ) + + @chk ccall( + (:MatProductView, $petsc_library), + PetscErrorCode, + (CMat, PetscViewer), + mat, viewer, + ) + + + return nothing +end + +""" + MatProductNumeric(petsclib::PetscLibType,mat::PetscMat) +Compute a matrix + +Collective + +Input/Output Parameter: +- `mat` - the matrix whose values are computed via a matrix-matrix product operation + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductSetAlgorithm()`, `MatProductSetType()`, `MatProductCreate()`, `MatSetType()`, `MatProductSymbolic()` + +# External Links +$(_doc_external("Mat/MatProductNumeric")) +""" +function MatProductNumeric(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatProductNumeric(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatProductNumeric, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + MatProductSymbolic(petsclib::PetscLibType,mat::PetscMat) +Perform the symbolic portion of a matrix +product to be done with `MatProductNumeric()` + +Collective + +Input/Output Parameter: +- `mat` - the matrix whose values are to be computed via a matrix-matrix product operation + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductCreate()`, `MatProductCreateWithMat()`, `MatProductSetFromOptions()`, `MatProductNumeric()`, `MatProductSetType()`, `MatProductSetAlgorithm()` + +# External Links +$(_doc_external("Mat/MatProductSymbolic")) +""" +function MatProductSymbolic(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatProductSymbolic(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatProductSymbolic, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + MatProductSetFill(petsclib::PetscLibType,mat::PetscMat, fill::PetscReal) +Set an expected fill of the matrix whose values are computed via a matrix + +Collective + +Input Parameters: +- `mat` - the matrix whose values are to be computed via a matrix-matrix product operation +- `fill` - expected fill as ratio of nnz(mat)/(nnz(A) + nnz(B) + nnz(C)); use `PETSC_DETERMINE` or `PETSC_CURRENT` if you do not have a good estimate. +If the product is a dense matrix, this value is not used. + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `PETSC_DETERMINE`, `Mat`, `MatProductSetFromOptions()`, `MatProductSetType()`, `MatProductSetAlgorithm()`, `MatProductCreate()` + +# External Links +$(_doc_external("Mat/MatProductSetFill")) +""" +function MatProductSetFill(petsclib::PetscLibType, mat::PetscMat, fill::PetscReal) end + +@for_petsc function MatProductSetFill(petsclib::$UnionPetscLib, mat::PetscMat, fill::$PetscReal ) + + @chk ccall( + (:MatProductSetFill, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal), + mat, fill, + ) + + + return nothing +end + +""" + MatProductSetAlgorithm(petsclib::PetscLibType,mat::PetscMat, alg::MatProductAlgorithm) +Requests a particular algorithm for a matrix + +Collective + +Input Parameters: +- `mat` - the matrix whose values are computed via a matrix-matrix product operation +- `alg` - particular implementation algorithm of the matrix product, e.g., `MATPRODUCTALGORITHMDEFAULT`. + +Options Database Key: +- `-mat_product_algorithm ` - Sets the algorithm, see `MatProductAlgorithm` + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductClear()`, `MatProductSetType()`, `MatProductSetFill()`, `MatProductCreate()`, `MatProductAlgorithm`, `MatProductType`, `MatProductGetAlgorithm()` + +# External Links +$(_doc_external("Mat/MatProductSetAlgorithm")) +""" +function MatProductSetAlgorithm(petsclib::PetscLibType, mat::PetscMat, alg::MatProductAlgorithm) end + +@for_petsc function MatProductSetAlgorithm(petsclib::$UnionPetscLib, mat::PetscMat, alg::MatProductAlgorithm ) + + @chk ccall( + (:MatProductSetAlgorithm, $petsc_library), + PetscErrorCode, + (CMat, MatProductAlgorithm), + mat, alg, + ) + + + return nothing +end + +""" + MatProductGetAlgorithm(petsclib::PetscLibType,mat::PetscMat, alg::MatProductAlgorithm) +Returns the selected algorithm for a matrix + +Not Collective + +Input Parameter: +- `mat` - the matrix whose values are computed via a matrix-matrix product operation + +Output Parameter: +- `alg` - the selected algorithm of the matrix product, e.g., `MATPRODUCTALGORITHMDEFAULT`. + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductSetAlgorithm()` + +# External Links +$(_doc_external("Mat/MatProductGetAlgorithm")) +""" +function MatProductGetAlgorithm(petsclib::PetscLibType, mat::PetscMat, alg::MatProductAlgorithm) end + +@for_petsc function MatProductGetAlgorithm(petsclib::$UnionPetscLib, mat::PetscMat, alg::MatProductAlgorithm ) + + @chk ccall( + (:MatProductGetAlgorithm, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatProductAlgorithm}), + mat, alg, + ) + + + return nothing +end + +""" + MatProductSetType(petsclib::PetscLibType,mat::PetscMat, productype::MatProductType) +Sets a particular matrix + +Collective + +Input Parameters: +- `mat` - the matrix whose values are computed via a matrix-matrix product operation +- `productype` - matrix product type, e.g., `MATPRODUCT_AB`,`MATPRODUCT_AtB`,`MATPRODUCT_ABt`,`MATPRODUCT_PtAP`,`MATPRODUCT_RARt`,`MATPRODUCT_ABC`, +see `MatProductType` + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductCreate()`, `MatProductType`, +`MATPRODUCT_AB`, `MATPRODUCT_AtB`, `MATPRODUCT_ABt`, `MATPRODUCT_PtAP`, `MATPRODUCT_RARt`, `MATPRODUCT_ABC` + +# External Links +$(_doc_external("Mat/MatProductSetType")) +""" +function MatProductSetType(petsclib::PetscLibType, mat::PetscMat, productype::MatProductType) end + +@for_petsc function MatProductSetType(petsclib::$UnionPetscLib, mat::PetscMat, productype::MatProductType ) + + @chk ccall( + (:MatProductSetType, $petsc_library), + PetscErrorCode, + (CMat, MatProductType), + mat, productype, + ) + + + return nothing +end + +""" + MatProductClear(petsclib::PetscLibType,mat::PetscMat) +Clears from the matrix any internal data structures related to the computation of the values of the matrix from matrix + +Collective + +Input Parameter: +- `mat` - the matrix whose values are to be computed via a matrix-matrix product operation + +Options Database Key: +- `-mat_product_clear` - Clear intermediate data structures after `MatProductNumeric()` has been called + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductCreate()` + +# External Links +$(_doc_external("Mat/MatProductClear")) +""" +function MatProductClear(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatProductClear(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatProductClear, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + MatProductCreateWithMat(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, D::PetscMat) +Set a given matrix to have its values computed via matrix + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `C` - the third matrix (optional, use `NULL` if not needed) +- `D` - the matrix whose values are to be computed via a matrix-matrix product operation + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductType`, `MatProductSetType()`, `MatProductAlgorithm`, +`MatProductSetAlgorithm`, `MatProductCreate()`, `MatProductClear()` + +# External Links +$(_doc_external("Mat/MatProductCreateWithMat")) +""" +function MatProductCreateWithMat(petsclib::PetscLibType, A::PetscMat, B::PetscMat, C::Union{Ptr,PetscMat}, D::PetscMat) end + +@for_petsc function MatProductCreateWithMat(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, C::Union{Ptr,PetscMat}, D::PetscMat ) + + @chk ccall( + (:MatProductCreateWithMat, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, CMat), + A, B, C, D, + ) + + + return nothing +end + +""" + D::PetscMat = MatProductCreate(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat) +create a matrix to hold the result of a matrix + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `C` - the third matrix (or `NULL`) + +Output Parameter: +- `D` - the matrix whose values are to be computed via a matrix-matrix product operation + +Level: intermediate + +Example: +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductCreateWithMat()`, `MatProductSetType()`, `MatProductSetAlgorithm()`, `MatProductClear()` + +# External Links +$(_doc_external("Mat/MatProductCreate")) +""" +function MatProductCreate(petsclib::PetscLibType, A::PetscMat, B::PetscMat, C::Union{Ptr,PetscMat}) end + +@for_petsc function MatProductCreate(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, C::Union{Ptr,PetscMat}) + D_ = Ref{CMat}() + + @chk ccall( + (:MatProductCreate, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, Ptr{CMat}), + A, B, C, D_, + ) + + D = PetscMat(D_[], petsclib) + + return D +end + +""" + mtype::MatProductType = MatProductGetType(petsclib::PetscLibType,mat::PetscMat) +Returns the type of matrix + +Not Collective + +Input Parameter: +- `mat` - the matrix whose values are to be computed via a matrix-matrix product operation + +Output Parameter: +- `mtype` - the `MatProductType` + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductCreateWithMat()`, `MatProductSetType()`, `MatProductCreate()`, `MatProductType`, `MatProductAlgorithm` + +# External Links +$(_doc_external("Mat/MatProductGetType")) +""" +function MatProductGetType(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatProductGetType(petsclib::$UnionPetscLib, mat::PetscMat ) + mtype_ = Ref{MatProductType}() + + @chk ccall( + (:MatProductGetType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatProductType}), + mat, mtype_, + ) + + mtype = unsafe_string(mtype_[]) + + return mtype +end + +""" + MatProductGetMats(petsclib::PetscLibType,mat::PetscMat, A::PetscMat, B::PetscMat, C::PetscMat) +Returns the matrices associated with the matrix + +Not Collective + +Input Parameter: +- `mat` - the matrix whose values are to be computed via a matrix-matrix product operation + +Output Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `C` - the third matrix (may be `NULL` for some `MatProductType`) + +Level: intermediate + +-seealso: [](ch_matrices), `MatProduct`, `Mat`, `MatProductCreateWithMat()`, `MatProductSetType()`, `MatProductSetAlgorithm()`, `MatProductCreate()` + +# External Links +$(_doc_external("Mat/MatProductGetMats")) +""" +function MatProductGetMats(petsclib::PetscLibType, mat::PetscMat, A::PetscMat, B::PetscMat, C::Union{Ptr,PetscMat}) end + +@for_petsc function MatProductGetMats(petsclib::$UnionPetscLib, mat::PetscMat, A::PetscMat, B::PetscMat, C::Union{Ptr,PetscMat}) + A_ = Ref(A.ptr) + B_ = Ref(B.ptr) + C_ = Ref(C.ptr) + + @chk ccall( + (:MatProductGetMats, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}, Ptr{CMat}, Ptr{CMat}), + mat, A_, B_, C_, + ) + + A.ptr = C_NULL + B.ptr = C_NULL + C.ptr = C_NULL + + return nothing +end + +""" + MatFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the PETSc interface to the `Mat` +package. It is called from `PetscFinalize()`. + +Level: developer + +-seealso: `Mat`, `PetscFinalize()`, `MatInitializePackage()` + +# External Links +$(_doc_external("Mat/MatFinalizePackage")) +""" +function MatFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function MatFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:MatFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + MatInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `Mat` package. It is called +from `PetscDLLibraryRegister_petscmat()` when using dynamic libraries, and on the first call to `MatCreate()` +when using shared or static libraries. + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `PetscInitialize()`, `MatFinalizePackage()` + +# External Links +$(_doc_external("Mat/MatInitializePackage")) +""" +function MatInitializePackage(petsclib::PetscLibType) end + +@for_petsc function MatInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:MatInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + MatSetRandom(petsclib::PetscLibType,x::PetscMat, rctx::PetscRandom) +Sets all components of a matrix to random numbers. + +Logically Collective + +Input Parameters: +- `x` - the matrix +- `rctx` - the `PetscRandom` object, formed by `PetscRandomCreate()`, or `NULL` and +it will create one internally. + +Example: +-seealso: [](ch_matrices), `Mat`, `PetscRandom`, `PetscRandomCreate()`, `MatZeroEntries()`, `MatSetValues()`, `PetscRandomDestroy()` + +# External Links +$(_doc_external("Mat/MatSetRandom")) +""" +function MatSetRandom(petsclib::PetscLibType, x::PetscMat, rctx::Union{Ptr,PetscRandom}) end + +@for_petsc function MatSetRandom(petsclib::$UnionPetscLib, x::PetscMat, rctx::Union{Ptr,PetscRandom}) + + @chk ccall( + (:MatSetRandom, $petsc_library), + PetscErrorCode, + (CMat, PetscRandom), + x, rctx, + ) + + + return nothing +end + +""" + MatCopyHashToXAIJ(petsclib::PetscLibType,A::PetscMat, B::PetscMat) +copy hash table entries into an XAIJ matrix type + +Logically Collective + +Input Parameter: +- `A` - A matrix in unassembled, hash table form + +Output Parameter: +- `B` - The XAIJ matrix. This can either be `A` or some matrix of equivalent size, e.g. obtained from `A` via `MatDuplicate()` + +Example: +-seealso: [](ch_matrices), `Mat`, `MAT_USE_HASH_TABLE` + +# External Links +$(_doc_external("Mat/MatCopyHashToXAIJ")) +""" +function MatCopyHashToXAIJ(petsclib::PetscLibType, A::PetscMat, B::PetscMat) end + +@for_petsc function MatCopyHashToXAIJ(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat ) + + @chk ccall( + (:MatCopyHashToXAIJ, $petsc_library), + PetscErrorCode, + (CMat, CMat), + A, B, + ) + + + return nothing +end + +""" + pivot::PetscReal,row::PetscInt = MatFactorGetErrorZeroPivot(petsclib::PetscLibType,mat::PetscMat) +returns the pivot value that was determined to be zero and the row it occurred in + +Logically Collective + +Input Parameter: +- `mat` - the factored matrix + +Output Parameters: +- `pivot` - the pivot value computed +- `row` - the row that the zero pivot occurred. This row value must be interpreted carefully due to row reorderings and which processes +the share the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatZeroEntries()`, `MatFactor()`, `MatGetFactor()`, +`MatLUFactorSymbolic()`, `MatCholeskyFactorSymbolic()`, `MatFactorClearError()`, +`MAT_FACTOR_NUMERIC_ZEROPIVOT` + +# External Links +$(_doc_external("Mat/MatFactorGetErrorZeroPivot")) +""" +function MatFactorGetErrorZeroPivot(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatFactorGetErrorZeroPivot(petsclib::$UnionPetscLib, mat::PetscMat ) + pivot_ = Ref{$PetscReal}() + row_ = Ref{$PetscInt}() + + @chk ccall( + (:MatFactorGetErrorZeroPivot, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}, Ptr{$PetscInt}), + mat, pivot_, row_, + ) + + pivot = pivot_[] + row = row_[] + + return pivot,row +end + +""" + MatFactorGetError(petsclib::PetscLibType,mat::PetscMat, err::MatFactorError) +gets the error code from a factorization + +Logically Collective + +Input Parameter: +- `mat` - the factored matrix + +Output Parameter: +- `err` - the error code + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatZeroEntries()`, `MatFactor()`, `MatGetFactor()`, `MatLUFactorSymbolic()`, `MatCholeskyFactorSymbolic()`, +`MatFactorClearError()`, `MatFactorGetErrorZeroPivot()`, `MatFactorError` + +# External Links +$(_doc_external("Mat/MatFactorGetError")) +""" +function MatFactorGetError(petsclib::PetscLibType, mat::PetscMat, err::MatFactorError) end + +@for_petsc function MatFactorGetError(petsclib::$UnionPetscLib, mat::PetscMat, err::MatFactorError ) + + @chk ccall( + (:MatFactorGetError, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatFactorError}), + mat, err, + ) + + + return nothing +end + +""" + MatFactorClearError(petsclib::PetscLibType,mat::PetscMat) +clears the error code in a factorization + +Logically Collective + +Input Parameter: +- `mat` - the factored matrix + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatZeroEntries()`, `MatFactor()`, `MatGetFactor()`, `MatLUFactorSymbolic()`, `MatCholeskyFactorSymbolic()`, `MatFactorGetError()`, `MatFactorGetErrorZeroPivot()`, +`MatGetErrorCode()`, `MatFactorError` + +# External Links +$(_doc_external("Mat/MatFactorClearError")) +""" +function MatFactorClearError(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatFactorClearError(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatFactorClearError, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + MatFindNonzeroRows(petsclib::PetscLibType,mat::PetscMat, keptrows::IS) +Locate all rows that are not completely zero in the matrix + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `keptrows` - the rows that are not completely zero + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatFindZeroRows()` + +# External Links +$(_doc_external("Mat/MatFindNonzeroRows")) +""" +function MatFindNonzeroRows(petsclib::PetscLibType, mat::PetscMat, keptrows::IS) end + +@for_petsc function MatFindNonzeroRows(petsclib::$UnionPetscLib, mat::PetscMat, keptrows::IS ) + + @chk ccall( + (:MatFindNonzeroRows, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CIS}), + mat, keptrows, + ) + + + return nothing +end + +""" + MatFindZeroRows(petsclib::PetscLibType,mat::PetscMat, zerorows::IS) +Locate all rows that are completely zero in the matrix + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `zerorows` - the rows that are completely zero + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatFindNonzeroRows()` + +# External Links +$(_doc_external("Mat/MatFindZeroRows")) +""" +function MatFindZeroRows(petsclib::PetscLibType, mat::PetscMat, zerorows::IS) end + +@for_petsc function MatFindZeroRows(petsclib::$UnionPetscLib, mat::PetscMat, zerorows::IS ) + + @chk ccall( + (:MatFindZeroRows, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CIS}), + mat, zerorows, + ) + + + return nothing +end + +""" + MatGetDiagonalBlock(petsclib::PetscLibType,A::PetscMat, a::PetscMat) +Returns the part of the matrix associated with the on + +Not Collective + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `a` - the diagonal part (which is a SEQUENTIAL matrix) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateAIJ()`, `MATAIJ`, `MATBAIJ`, `MATSBAIJ` + +# External Links +$(_doc_external("Mat/MatGetDiagonalBlock")) +""" +function MatGetDiagonalBlock(petsclib::PetscLibType, A::PetscMat, a::PetscMat) end + +@for_petsc function MatGetDiagonalBlock(petsclib::$UnionPetscLib, A::PetscMat, a::PetscMat ) + a_ = Ref(a.ptr) + + @chk ccall( + (:MatGetDiagonalBlock, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, a_, + ) + + a.ptr = C_NULL + + return nothing +end + +""" + trace::PetscScalar = MatGetTrace(petsclib::PetscLibType,mat::PetscMat) +Gets the trace of a matrix. The sum of the diagonal entries. + +Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `trace` - the sum of the diagonal entries + +Level: advanced + +-seealso: [](ch_matrices), `Mat` + +# External Links +$(_doc_external("Mat/MatGetTrace")) +""" +function MatGetTrace(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetTrace(petsclib::$UnionPetscLib, mat::PetscMat ) + trace_ = Ref{$PetscScalar}() + + @chk ccall( + (:MatGetTrace, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + mat, trace_, + ) + + trace = trace_[] + + return trace +end + +""" + MatRealPart(petsclib::PetscLibType,mat::PetscMat) +Zeros out the imaginary part of the matrix + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatImaginaryPart()` + +# External Links +$(_doc_external("Mat/MatRealPart")) +""" +function MatRealPart(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatRealPart(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatRealPart, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + nghosts::PetscInt,ghosts::Vector{PetscInt} = MatGetGhosts(petsclib::PetscLibType,mat::PetscMat) +Get the global indices of all ghost nodes defined by the sparse matrix + +Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `nghosts` - number of ghosts (for `MATBAIJ` and `MATSBAIJ` matrices there is one ghost for each matrix block) +- `ghosts` - the global indices of the ghost points + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `VecCreateGhost()`, `VecCreateGhostBlock()` + +# External Links +$(_doc_external("Mat/MatGetGhosts")) +""" +function MatGetGhosts(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetGhosts(petsclib::$UnionPetscLib, mat::PetscMat ) + nghosts_ = Ref{$PetscInt}() + ghosts_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:MatGetGhosts, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + mat, nghosts_, ghosts_, + ) + + nghosts = nghosts_[] + ghosts = unsafe_wrap(Array, ghosts_[], VecGetLocalSize(petsclib, x); own = false) + + return nghosts,ghosts +end + +""" + MatImaginaryPart(petsclib::PetscLibType,mat::PetscMat) +Moves the imaginary part of the matrix to the real part and zeros the imaginary part + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatRealPart()` + +# External Links +$(_doc_external("Mat/MatImaginaryPart")) +""" +function MatImaginaryPart(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatImaginaryPart(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatImaginaryPart, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + missing::PetscBool,dd::PetscInt = MatMissingDiagonal(petsclib::PetscLibType,mat::PetscMat) +Determine if sparse matrix is missing a diagonal entry (or block entry for `MATBAIJ` and `MATSBAIJ` matrices) in the nonzero structure + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `missing` - is any diagonal entry missing +- `dd` - first diagonal entry that is missing (optional) on this process + +Level: advanced + +-seealso: [](ch_matrices), `Mat` + +# External Links +$(_doc_external("Mat/MatMissingDiagonal")) +""" +function MatMissingDiagonal(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatMissingDiagonal(petsclib::$UnionPetscLib, mat::PetscMat ) + missing_ = Ref{PetscBool}() + dd_ = Ref{$PetscInt}() + + @chk ccall( + (:MatMissingDiagonal, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}, Ptr{$PetscInt}), + mat, missing_, dd_, + ) + + missing = missing_[] + dd = dd_[] + + return missing,dd +end + +""" + ncols::PetscInt,cols::Vector{PetscInt},vals::Vector{PetscScalar} = MatGetRow(petsclib::PetscLibType,mat::PetscMat, row::PetscInt) +Gets a row of a matrix. You MUST call `MatRestoreRow()` +for each row that you get to ensure that your application does +not bleed memory. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `row` - the row to get + +Output Parameters: +- `ncols` - if not `NULL`, the number of nonzeros in `row` +- `cols` - if not `NULL`, the column numbers +- `vals` - if not `NULL`, the numerical values + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatRestoreRow()`, `MatSetValues()`, `MatGetValues()`, `MatCreateSubMatrices()`, `MatGetDiagonal()`, `MatGetRowIJ()`, `MatRestoreRowIJ()` + +# External Links +$(_doc_external("Mat/MatGetRow")) +""" +function MatGetRow(petsclib::PetscLibType, mat::PetscMat, row::PetscInt) end + +@for_petsc function MatGetRow(petsclib::$UnionPetscLib, mat::PetscMat, row::$PetscInt ) + ncols_ = Ref{$PetscInt}() + cols_ = Ref{Ptr{$PetscInt}}() + vals_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatGetRow, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscScalar}}), + mat, row, ncols_, cols_, vals_, + ) + + ncols = ncols_[] + cols = unsafe_wrap(Array, cols_[], VecGetLocalSize(petsclib, x); own = false) + vals = unsafe_wrap(Array, vals_[], VecGetLocalSize(petsclib, x); own = false) + + return ncols,cols,vals +end + +""" + MatConjugate(petsclib::PetscLibType,mat::PetscMat) +replaces the matrix values with their complex conjugates + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatRealPart()`, `MatImaginaryPart()`, `VecConjugate()`, `MatTranspose()` + +# External Links +$(_doc_external("Mat/MatConjugate")) +""" +function MatConjugate(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatConjugate(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatConjugate, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + ncols::PetscInt,cols::Vector{PetscInt},vals::Vector{PetscScalar} = MatRestoreRow(petsclib::PetscLibType,mat::PetscMat, row::PetscInt) +Frees any temporary space allocated by `MatGetRow()`. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `row` - the row to get +- `ncols` - the number of nonzeros +- `cols` - the columns of the nonzeros +- `vals` - if nonzero the column values + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetRow()` + +# External Links +$(_doc_external("Mat/MatRestoreRow")) +""" +function MatRestoreRow(petsclib::PetscLibType, mat::PetscMat, row::PetscInt) end + +@for_petsc function MatRestoreRow(petsclib::$UnionPetscLib, mat::PetscMat, row::$PetscInt ) + ncols_ = Ref{$PetscInt}() + cols_ = Ref{Ptr{$PetscInt}}() + vals_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatRestoreRow, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscScalar}}), + mat, row, ncols_, cols_, vals_, + ) + + ncols = ncols_[] + cols = unsafe_wrap(Array, cols_[], VecGetLocalSize(petsclib, x); own = false) + vals = unsafe_wrap(Array, vals_[], VecGetLocalSize(petsclib, x); own = false) + + return ncols,cols,vals +end + +""" + MatGetRowUpperTriangular(petsclib::PetscLibType,mat::PetscMat) +Sets a flag to enable calls to `MatGetRow()` for matrix in `MATSBAIJ` format. +You should call `MatRestoreRowUpperTriangular()` after calling` MatGetRow()` and `MatRestoreRow()` to disable the flag. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSBAIJ`, `MatRestoreRowUpperTriangular()` + +# External Links +$(_doc_external("Mat/MatGetRowUpperTriangular")) +""" +function MatGetRowUpperTriangular(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetRowUpperTriangular(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatGetRowUpperTriangular, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + MatRestoreRowUpperTriangular(petsclib::PetscLibType,mat::PetscMat) +Disable calls to `MatGetRow()` for matrix in `MATSBAIJ` format. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSBAIJ`, `MatGetRowUpperTriangular()` + +# External Links +$(_doc_external("Mat/MatRestoreRowUpperTriangular")) +""" +function MatRestoreRowUpperTriangular(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatRestoreRowUpperTriangular(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatRestoreRowUpperTriangular, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + MatSetOptionsPrefix(petsclib::PetscLibType,A::PetscMat, prefix::Vector{Cchar}) +Sets the prefix used for searching for all +`Mat` options in the database. + +Logically Collective + +Input Parameters: +- `A` - the matrix +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatSetFromOptions()`, `MatSetOptionsPrefixFactor()` + +# External Links +$(_doc_external("Mat/MatSetOptionsPrefix")) +""" +function MatSetOptionsPrefix(petsclib::PetscLibType, A::PetscMat, prefix::Vector{Cchar}) end + +@for_petsc function MatSetOptionsPrefix(petsclib::$UnionPetscLib, A::PetscMat, prefix::Vector{Cchar} ) + + @chk ccall( + (:MatSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Cchar}), + A, prefix, + ) + + + return nothing +end + +""" + MatSetOptionsPrefixFactor(petsclib::PetscLibType,A::PetscMat, prefix::Vector{Cchar}) +Sets the prefix used for searching for all matrix factor options in the database for +for matrices created with `MatGetFactor()` + +Logically Collective + +Input Parameters: +- `A` - the matrix +- `prefix` - the prefix to prepend to all option names for the factored matrix + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `MatSetFromOptions()`, `MatSetOptionsPrefix()`, `MatAppendOptionsPrefixFactor()` + +# External Links +$(_doc_external("Mat/MatSetOptionsPrefixFactor")) +""" +function MatSetOptionsPrefixFactor(petsclib::PetscLibType, A::PetscMat, prefix::Vector{Cchar}) end + +@for_petsc function MatSetOptionsPrefixFactor(petsclib::$UnionPetscLib, A::PetscMat, prefix::Vector{Cchar} ) + + @chk ccall( + (:MatSetOptionsPrefixFactor, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Cchar}), + A, prefix, + ) + + + return nothing +end + +""" + MatAppendOptionsPrefixFactor(petsclib::PetscLibType,A::PetscMat, prefix::Vector{Cchar}) +Appends to the prefix used for searching for all matrix factor options in the database for +for matrices created with `MatGetFactor()` + +Logically Collective + +Input Parameters: +- `A` - the matrix +- `prefix` - the prefix to prepend to all option names for the factored matrix + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `PetscOptionsCreate()`, `PetscOptionsDestroy()`, `PetscObjectSetOptionsPrefix()`, `PetscObjectPrependOptionsPrefix()`, +`PetscObjectGetOptionsPrefix()`, `TSAppendOptionsPrefix()`, `SNESAppendOptionsPrefix()`, `KSPAppendOptionsPrefix()`, `MatSetOptionsPrefixFactor()`, +`MatSetOptionsPrefix()` + +# External Links +$(_doc_external("Mat/MatAppendOptionsPrefixFactor")) +""" +function MatAppendOptionsPrefixFactor(petsclib::PetscLibType, A::PetscMat, prefix::Vector{Cchar}) end + +@for_petsc function MatAppendOptionsPrefixFactor(petsclib::$UnionPetscLib, A::PetscMat, prefix::Vector{Cchar} ) + + @chk ccall( + (:MatAppendOptionsPrefixFactor, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Cchar}), + A, prefix, + ) + + + return nothing +end + +""" + MatAppendOptionsPrefix(petsclib::PetscLibType,A::PetscMat, prefix::Vector{Cchar}) +Appends to the prefix used for searching for all +matrix options in the database. + +Logically Collective + +Input Parameters: +- `A` - the matrix +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetOptionsPrefix()`, `MatAppendOptionsPrefixFactor()`, `MatSetOptionsPrefix()` + +# External Links +$(_doc_external("Mat/MatAppendOptionsPrefix")) +""" +function MatAppendOptionsPrefix(petsclib::PetscLibType, A::PetscMat, prefix::Vector{Cchar}) end + +@for_petsc function MatAppendOptionsPrefix(petsclib::$UnionPetscLib, A::PetscMat, prefix::Vector{Cchar} ) + + @chk ccall( + (:MatAppendOptionsPrefix, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Cchar}), + A, prefix, + ) + + + return nothing +end + +""" + MatGetOptionsPrefix(petsclib::PetscLibType,A::PetscMat, prefix::Vector{Cchar}) +Gets the prefix used for searching for all +matrix options in the database. + +Not Collective + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `prefix` - pointer to the prefix string used + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatAppendOptionsPrefix()`, `MatSetOptionsPrefix()`, `MatAppendOptionsPrefixFactor()`, `MatSetOptionsPrefixFactor()` + +# External Links +$(_doc_external("Mat/MatGetOptionsPrefix")) +""" +function MatGetOptionsPrefix(petsclib::PetscLibType, A::PetscMat, prefix::Vector{Cchar}) end + +@for_petsc function MatGetOptionsPrefix(petsclib::$UnionPetscLib, A::PetscMat, prefix::Vector{Cchar} ) + prefix_ = Ref(pointer(prefix)) + + @chk ccall( + (:MatGetOptionsPrefix, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{Cchar}}), + A, prefix_, + ) + + + return nothing +end + +""" + MatGetState(petsclib::PetscLibType,A::PetscMat, state::PetscObjectState) +Gets the state of a `Mat`. Same value as returned by `PetscObjectStateGet()` + +Not Collective + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `state` - the object state + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `PetscObjectStateGet()`, `MatGetNonzeroState()` + +# External Links +$(_doc_external("Mat/MatGetState")) +""" +function MatGetState(petsclib::PetscLibType, A::PetscMat, state::PetscObjectState) end + +@for_petsc function MatGetState(petsclib::$UnionPetscLib, A::PetscMat, state::PetscObjectState ) + + @chk ccall( + (:MatGetState, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscObjectState}), + A, state, + ) + + + return nothing +end + +""" + MatResetPreallocation(petsclib::PetscLibType,A::PetscMat) +Reset matrix to use the original preallocation values provided by the user, for example with `MatXAIJSetPreallocation()` + +Collective + +Input Parameter: +- `A` - the matrix + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJSetPreallocation()`, `MatMPIAIJSetPreallocation()`, `MatXAIJSetPreallocation()` + +# External Links +$(_doc_external("Mat/MatResetPreallocation")) +""" +function MatResetPreallocation(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatResetPreallocation(petsclib::$UnionPetscLib, A::PetscMat ) + + @chk ccall( + (:MatResetPreallocation, $petsc_library), + PetscErrorCode, + (CMat,), + A, + ) + + + return nothing +end + +""" + MatResetHash(petsclib::PetscLibType,A::PetscMat) +Reset the matrix so that it will use a hash table for the next round of `MatSetValues()` and `MatAssemblyBegin()`/`MatAssemblyEnd()`. + +Collective + +Input Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatResetPreallocation()` + +# External Links +$(_doc_external("Mat/MatResetHash")) +""" +function MatResetHash(petsclib::PetscLibType, A::AbstractPetscMat) end + +@for_petsc function MatResetHash(petsclib::$UnionPetscLib, A::AbstractPetscMat ) + + @chk ccall( + (:MatResetHash, $petsc_library), + PetscErrorCode, + (CMat,), + A, + ) + + + return nothing +end + +""" + MatSetUp(petsclib::PetscLibType,A::PetscMat) +Sets up the internal matrix data structures for later use by the matrix + +Collective + +Input Parameter: +- `A` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatMult()`, `MatCreate()`, `MatDestroy()`, `MatXAIJSetPreallocation()` + +# External Links +$(_doc_external("Mat/MatSetUp")) +""" +function MatSetUp(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSetUp(petsclib::$UnionPetscLib, A::PetscMat ) + + @chk ccall( + (:MatSetUp, $petsc_library), + PetscErrorCode, + (CMat,), + A, + ) + + + return nothing +end + +""" + MatViewFromOptions(petsclib::PetscLibType,A::PetscMat, obj::PetscObject, name::Vector{Cchar}) +View properties of the matrix based on options set in the options database + +Collective + +Input Parameters: +- `A` - the matrix +- `obj` - optional additional object that provides the options prefix to use +- `name` - command line option + +Options Database Key: +- `-mat_view [viewertype]:...` - the viewer and its options + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatView()`, `PetscObjectViewFromOptions()`, `MatCreate()` + +# External Links +$(_doc_external("Mat/MatViewFromOptions")) +""" +function MatViewFromOptions(petsclib::PetscLibType, A::PetscMat, obj::PetscObject, name::Vector{Cchar}) end + +@for_petsc function MatViewFromOptions(petsclib::$UnionPetscLib, A::PetscMat, obj::PetscObject, name::Vector{Cchar} ) + + @chk ccall( + (:MatViewFromOptions, $petsc_library), + PetscErrorCode, + (CMat, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + MatView(petsclib::PetscLibType,mat::PetscMat, viewer::PetscViewer) +display information about a matrix in a variety ways + +Collective on viewer + +Input Parameters: +- `mat` - the matrix +- `viewer` - visualization context + +Options Database Keys: +- `-mat_view ::ascii_info` - Prints info on matrix at conclusion of `MatAssemblyEnd()` +- `-mat_view ::ascii_info_detail` - Prints more detailed info +- `-mat_view` - Prints matrix in ASCII format +- `-mat_view ::ascii_matlab` - Prints matrix in MATLAB format +- `-mat_view draw` - PetscDraws nonzero structure of matrix, using `MatView()` and `PetscDrawOpenX()`. +- `-display ` - Sets display name (default is host) +- `-draw_pause ` - Sets number of seconds to pause after display +- `-mat_view socket` - Sends matrix to socket, can be accessed from MATLAB (see Users-Manual: ch_matlab for details) +- `-viewer_socket_machine ` - - +- `-viewer_socket_port ` - - +- `-mat_view binary` - save matrix to file in binary format +- `-viewer_binary_filename ` - - + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `PetscViewerPushFormat()`, `PetscViewerASCIIOpen()`, `PetscViewerDrawOpen()`, `PetscViewer`, +`PetscViewerSocketOpen()`, `PetscViewerBinaryOpen()`, `MatLoad()`, `MatViewFromOptions()` + +# External Links +$(_doc_external("Mat/MatView")) +""" +function MatView(petsclib::PetscLibType, mat::PetscMat, viewer::PetscViewer) end + +@for_petsc function MatView(petsclib::$UnionPetscLib, mat::PetscMat, viewer::PetscViewer ) + + @chk ccall( + (:MatView, $petsc_library), + PetscErrorCode, + (CMat, PetscViewer), + mat, viewer, + ) + + + return nothing +end + +""" + MatLoad(petsclib::PetscLibType,mat::PetscMat, viewer::PetscViewer) +Loads a matrix that has been stored in binary/HDF5 format +with `MatView()`. The matrix format is determined from the options database. +Generates a parallel MPI matrix if the communicator has more than one +processor. The default matrix type is `MATAIJ`. + +Collective + +Input Parameters: +- `mat` - the newly loaded matrix, this needs to have been created with `MatCreate()` +or some related function before a call to `MatLoad()` +- `viewer` - `PETSCVIEWERBINARY`/`PETSCVIEWERHDF5` file viewer + +Options Database Key: +- `-matload_block_size ` - set block size + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `PetscViewerBinaryOpen()`, `PetscViewerSetType()`, `MatView()`, `VecLoad()` + +# External Links +$(_doc_external("Mat/MatLoad")) +""" +function MatLoad(petsclib::PetscLibType, mat::PetscMat, viewer::PetscViewer) end + +@for_petsc function MatLoad(petsclib::$UnionPetscLib, mat::PetscMat, viewer::PetscViewer ) + + @chk ccall( + (:MatLoad, $petsc_library), + PetscErrorCode, + (CMat, PetscViewer), + mat, viewer, + ) + + + return nothing +end + +""" + MatDestroy(petsclib::PetscLibType,A::AbstractPetscMat) +Frees space taken by a matrix. + +Collective + +Input Parameter: +- `A` - the matrix + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatCreate()` + +# External Links +$(_doc_external("Mat/MatDestroy")) +""" +function MatDestroy(petsclib::PetscLibType, A::AbstractPetscMat) end + +@for_petsc function MatDestroy(petsclib::$UnionPetscLib, A::AbstractPetscMat ) + A_ = Ref(A.ptr) + + @chk ccall( + (:MatDestroy, $petsc_library), + PetscErrorCode, + (Ptr{CMat},), + A_, + ) + + A.ptr = C_NULL + + return nothing +end + +""" + MatSetValues(petsclib::PetscLibType,mat::AbstractPetscMat, m::PetscInt, idxm::Vector{PetscInt}, n::PetscInt, idxn::Vector{PetscInt}, v::Vector{PetscScalar}, addv::InsertMode) +Inserts or adds a block of values into a matrix. +These values may be cached, so `MatAssemblyBegin()` and `MatAssemblyEnd()` +MUST be called after all calls to `MatSetValues()` have been completed. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `m` - the number of rows +- `idxm` - the global indices of the rows +- `n` - the number of columns +- `idxn` - the global indices of the columns +- `v` - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order. +See `MAT_ROW_ORIENTED` in `MatSetOption()` for how to use column-major order. +- `addv` - either `ADD_VALUES` to add values to any existing entries, or `INSERT_VALUES` to replace existing entries with new values + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatSetOption()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValuesBlocked()`, `MatSetValuesLocal()`, +`InsertMode`, `INSERT_VALUES`, `ADD_VALUES` + +# External Links +$(_doc_external("Mat/MatSetValues")) +""" +function MatSetValues(petsclib::PetscLibType, mat::AbstractPetscMat, m::PetscInt, idxm::Vector{PetscInt}, n::PetscInt, idxn::Vector{PetscInt}, v::Vector{PetscScalar}, addv::InsertMode) end + +@for_petsc function MatSetValues(petsclib::$UnionPetscLib, mat::AbstractPetscMat, m::$PetscInt, idxm::Vector{$PetscInt}, n::$PetscInt, idxn::Vector{$PetscInt}, v::Vector{$PetscScalar}, addv::InsertMode ) + + @chk ccall( + (:MatSetValues, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscScalar}, InsertMode), + mat, m, idxm, n, idxn, v, addv, + ) + + + return nothing +end + +""" + MatSetValuesIS(petsclib::PetscLibType,mat::PetscMat, ism::IS, isn::IS, v::Vector{PetscScalar}, addv::InsertMode) +Inserts or adds a block of values into a matrix using an `IS` to indicate the rows and columns +These values may be cached, so `MatAssemblyBegin()` and `MatAssemblyEnd()` +MUST be called after all calls to `MatSetValues()` have been completed. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `ism` - the rows to provide +- `isn` - the columns to provide +- `v` - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order. +See `MAT_ROW_ORIENTED` in `MatSetOption()` for how to use column-major order. +- `addv` - either `ADD_VALUES` to add values to any existing entries, or `INSERT_VALUES` to replace existing entries with new values + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatSetOption()`, `MatSetValues()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValuesBlocked()`, `MatSetValuesLocal()`, +`InsertMode`, `INSERT_VALUES`, `ADD_VALUES` + +# External Links +$(_doc_external("Mat/MatSetValuesIS")) +""" +function MatSetValuesIS(petsclib::PetscLibType, mat::PetscMat, ism::IS, isn::IS, v::Vector{PetscScalar}, addv::InsertMode) end + +@for_petsc function MatSetValuesIS(petsclib::$UnionPetscLib, mat::PetscMat, ism::IS, isn::IS, v::Vector{$PetscScalar}, addv::InsertMode ) + + @chk ccall( + (:MatSetValuesIS, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, Ptr{$PetscScalar}, InsertMode), + mat, ism, isn, v, addv, + ) + + + return nothing +end + +""" + MatSetValuesRowLocal(petsclib::PetscLibType,mat::PetscMat, row::PetscInt, v::Vector{PetscScalar}) +Inserts a row (block row for `MATBAIJ` matrices) of nonzero +values into a matrix + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `row` - the (block) row to set +- `v` - a one-dimensional array that contains the values. For `MATBAIJ` they are implicitly stored as a two-dimensional array, by default in row-major order. +See `MAT_ROW_ORIENTED` in `MatSetOption()` for how to use column-major order. + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSetOption()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValuesBlocked()`, `MatSetValuesLocal()`, +`InsertMode`, `INSERT_VALUES`, `ADD_VALUES`, `MatSetValues()`, `MatSetValuesRow()`, `MatSetLocalToGlobalMapping()` + +# External Links +$(_doc_external("Mat/MatSetValuesRowLocal")) +""" +function MatSetValuesRowLocal(petsclib::PetscLibType, mat::PetscMat, row::PetscInt, v::Vector{PetscScalar}) end + +@for_petsc function MatSetValuesRowLocal(petsclib::$UnionPetscLib, mat::PetscMat, row::$PetscInt, v::Vector{$PetscScalar} ) + + @chk ccall( + (:MatSetValuesRowLocal, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscScalar}), + mat, row, v, + ) + + + return nothing +end + +""" + MatSetValuesRow(petsclib::PetscLibType,mat::PetscMat, row::PetscInt, v::Vector{PetscScalar}) +Inserts a row (block row for `MATBAIJ` matrices) of nonzero +values into a matrix + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `row` - the (block) row to set +- `v` - a logically two-dimensional (column major) array of values for block matrices with blocksize larger than one, otherwise a one dimensional array of values + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatSetValues()`, `MatSetOption()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValuesBlocked()`, `MatSetValuesLocal()`, +`InsertMode`, `INSERT_VALUES`, `ADD_VALUES` + +# External Links +$(_doc_external("Mat/MatSetValuesRow")) +""" +function MatSetValuesRow(petsclib::PetscLibType, mat::PetscMat, row::PetscInt, v::Vector{PetscScalar}) end + +@for_petsc function MatSetValuesRow(petsclib::$UnionPetscLib, mat::PetscMat, row::$PetscInt, v::Vector{$PetscScalar} ) + + @chk ccall( + (:MatSetValuesRow, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscScalar}), + mat, row, v, + ) + + + return nothing +end + +""" + MatSetValuesStencil(petsclib::PetscLibType,mat::PetscMat, m::PetscInt, idxm::Vector{MatStencil}, n::PetscInt, idxn::Vector{MatStencil}, v::Vector{PetscScalar}, addv::InsertMode) +Inserts or adds a block of values into a matrix. +Using structured grid indexing + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `m` - number of rows being entered +- `idxm` - grid coordinates (and component number when dof > 1) for matrix rows being entered +- `n` - number of columns being entered +- `idxn` - grid coordinates (and component number when dof > 1) for matrix columns being entered +- `v` - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order. +See `MAT_ROW_ORIENTED` in `MatSetOption()` for how to use column-major order. +- `addv` - either `ADD_VALUES` to add to existing entries at that location or `INSERT_VALUES` to replace existing entries with new values + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `DMDA`, `MatSetOption()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValuesBlocked()`, `MatSetValuesLocal()` +`MatSetValues()`, `MatSetValuesBlockedStencil()`, `MatSetStencil()`, `DMCreateMatrix()`, `DMDAVecGetArray()`, `MatStencil` + +# External Links +$(_doc_external("Mat/MatSetValuesStencil")) +""" +function MatSetValuesStencil(petsclib::PetscLibType, mat::PetscMat, m::PetscInt, idxm::Vector{MatStencil}, n::PetscInt, idxn::Vector{MatStencil}, v::Vector{PetscScalar}, addv::InsertMode) end + +@for_petsc function MatSetValuesStencil(petsclib::$UnionPetscLib, mat::PetscMat, m::$PetscInt, idxm::Vector{MatStencil}, n::$PetscInt, idxn::Vector{MatStencil}, v::Vector{$PetscScalar}, addv::InsertMode ) + + @chk ccall( + (:MatSetValuesStencil, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{MatStencil}, $PetscInt, Ptr{MatStencil}, Ptr{$PetscScalar}, InsertMode), + mat, m, idxm, n, idxn, v, addv, + ) + + + return nothing +end + +""" + MatSetValuesBlockedStencil(petsclib::PetscLibType,mat::PetscMat, m::PetscInt, idxm::Vector{MatStencil}, n::PetscInt, idxn::Vector{MatStencil}, v::Vector{PetscScalar}, addv::InsertMode) +Inserts or adds a block of values into a matrix. +Using structured grid indexing + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `m` - number of rows being entered +- `idxm` - grid coordinates for matrix rows being entered +- `n` - number of columns being entered +- `idxn` - grid coordinates for matrix columns being entered +- `v` - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order. +See `MAT_ROW_ORIENTED` in `MatSetOption()` for how to use column-major order. +- `addv` - either `ADD_VALUES` to add to existing entries or `INSERT_VALUES` to replace existing entries with new values + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `DMDA`, `MatSetOption()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValuesBlocked()`, `MatSetValuesLocal()` +`MatSetValues()`, `MatSetValuesStencil()`, `MatSetStencil()`, `DMCreateMatrix()`, `DMDAVecGetArray()`, `MatStencil`, +`MatSetBlockSize()`, `MatSetLocalToGlobalMapping()` + +# External Links +$(_doc_external("Mat/MatSetValuesBlockedStencil")) +""" +function MatSetValuesBlockedStencil(petsclib::PetscLibType, mat::PetscMat, m::PetscInt, idxm::Vector{MatStencil}, n::PetscInt, idxn::Vector{MatStencil}, v::Vector{PetscScalar}, addv::InsertMode) end + +@for_petsc function MatSetValuesBlockedStencil(petsclib::$UnionPetscLib, mat::PetscMat, m::$PetscInt, idxm::Vector{MatStencil}, n::$PetscInt, idxn::Vector{MatStencil}, v::Vector{$PetscScalar}, addv::InsertMode ) + + @chk ccall( + (:MatSetValuesBlockedStencil, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{MatStencil}, $PetscInt, Ptr{MatStencil}, Ptr{$PetscScalar}, InsertMode), + mat, m, idxm, n, idxn, v, addv, + ) + + + return nothing +end + +""" + MatSetStencil(petsclib::PetscLibType,mat::PetscMat, dim::PetscInt, dims::Vector{PetscInt}, starts::Vector{PetscInt}, dof::PetscInt) +Sets the grid information for setting values into a matrix via +`MatSetValuesStencil()` + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `dim` - dimension of the grid 1, 2, or 3 +- `dims` - number of grid points in x, y, and z direction, including ghost points on your processor +- `starts` - starting point of ghost nodes on your processor in x, y, and z direction +- `dof` - number of degrees of freedom per node + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatStencil`, `MatSetOption()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValuesBlocked()`, `MatSetValuesLocal()` +`MatSetValues()`, `MatSetValuesBlockedStencil()`, `MatSetValuesStencil()` + +# External Links +$(_doc_external("Mat/MatSetStencil")) +""" +function MatSetStencil(petsclib::PetscLibType, mat::PetscMat, dim::PetscInt, dims::Vector{PetscInt}, starts::Vector{PetscInt}, dof::PetscInt) end + +@for_petsc function MatSetStencil(petsclib::$UnionPetscLib, mat::PetscMat, dim::$PetscInt, dims::Vector{$PetscInt}, starts::Vector{$PetscInt}, dof::$PetscInt ) + + @chk ccall( + (:MatSetStencil, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt), + mat, dim, dims, starts, dof, + ) + + + return nothing +end + +""" + MatSetValuesBlocked(petsclib::PetscLibType,mat::PetscMat, m::PetscInt, idxm::Vector{PetscInt}, n::PetscInt, idxn::Vector{PetscInt}, v::Vector{PetscScalar}, addv::InsertMode) +Inserts or adds a block of values into a matrix. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `m` - the number of block rows +- `idxm` - the global block indices +- `n` - the number of block columns +- `idxn` - the global block indices +- `v` - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order. +See `MAT_ROW_ORIENTED` in `MatSetOption()` for how to use column-major order. +- `addv` - either `ADD_VALUES` to add values to any existing entries, or `INSERT_VALUES` replaces existing entries with new values + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSetBlockSize()`, `MatSetOption()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValues()`, `MatSetValuesBlockedLocal()` + +# External Links +$(_doc_external("Mat/MatSetValuesBlocked")) +""" +function MatSetValuesBlocked(petsclib::PetscLibType, mat::PetscMat, m::PetscInt, idxm::Vector{PetscInt}, n::PetscInt, idxn::Vector{PetscInt}, v::Vector{PetscScalar}, addv::InsertMode) end + +@for_petsc function MatSetValuesBlocked(petsclib::$UnionPetscLib, mat::PetscMat, m::$PetscInt, idxm::Vector{$PetscInt}, n::$PetscInt, idxn::Vector{$PetscInt}, v::Vector{$PetscScalar}, addv::InsertMode ) + + @chk ccall( + (:MatSetValuesBlocked, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscScalar}, InsertMode), + mat, m, idxm, n, idxn, v, addv, + ) + + + return nothing +end + +""" + MatGetValues(petsclib::PetscLibType,mat::PetscMat, m::PetscInt, idxm::Vector{PetscInt}, n::PetscInt, idxn::Vector{PetscInt}, v::Vector{PetscScalar}) +Gets a block of local values from a matrix. + +Not Collective; can only return values that are owned by the give process + +Input Parameters: +- `mat` - the matrix +- `v` - a logically two-dimensional array for storing the values +- `m` - the number of rows +- `idxm` - the global indices of the rows +- `n` - the number of columns +- `idxn` - the global indices of the columns + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetRow()`, `MatCreateSubMatrices()`, `MatSetValues()`, `MatGetOwnershipRange()`, `MatGetValuesLocal()`, `MatGetValue()` + +# External Links +$(_doc_external("Mat/MatGetValues")) +""" +function MatGetValues(petsclib::PetscLibType, mat::PetscMat, m::PetscInt, idxm::Vector{PetscInt}, n::PetscInt, idxn::Vector{PetscInt}, v::Vector{PetscScalar}) end + +@for_petsc function MatGetValues(petsclib::$UnionPetscLib, mat::PetscMat, m::$PetscInt, idxm::Vector{$PetscInt}, n::$PetscInt, idxn::Vector{$PetscInt}, v::Vector{$PetscScalar} ) + + @chk ccall( + (:MatGetValues, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscScalar}), + mat, m, idxm, n, idxn, v, + ) + + + return nothing +end + +""" + MatGetValuesLocal(petsclib::PetscLibType,mat::PetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, y::Vector{PetscScalar}) +retrieves values from certain locations in a matrix using the local numbering of the indices +defined previously by `MatSetLocalToGlobalMapping()` + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `nrow` - number of rows +- `irow` - the row local indices +- `ncol` - number of columns +- `icol` - the column local indices + +Output Parameter: +- `y` - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order. +See `MAT_ROW_ORIENTED` in `MatSetOption()` for how to use column-major order. + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValues()`, `MatSetLocalToGlobalMapping()`, +`MatSetValuesLocal()`, `MatGetValues()` + +# External Links +$(_doc_external("Mat/MatGetValuesLocal")) +""" +function MatGetValuesLocal(petsclib::PetscLibType, mat::PetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, y::Vector{PetscScalar}) end + +@for_petsc function MatGetValuesLocal(petsclib::$UnionPetscLib, mat::PetscMat, nrow::$PetscInt, irow::Vector{$PetscInt}, ncol::$PetscInt, icol::Vector{$PetscInt}, y::Vector{$PetscScalar} ) + + @chk ccall( + (:MatGetValuesLocal, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscScalar}), + mat, nrow, irow, ncol, icol, y, + ) + + + return nothing +end + +""" + MatSetValuesBatch(petsclib::PetscLibType,mat::PetscMat, nb::PetscInt, bs::PetscInt, rows::Vector{PetscInt}, v::Vector{PetscScalar}) +Adds (`ADD_VALUES`) many blocks of values into a matrix at once. The blocks must all be square and +the same size. Currently, this can only be called once and creates the given matrix. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `nb` - the number of blocks +- `bs` - the number of rows (and columns) in each block +- `rows` - a concatenation of the rows for each block +- `v` - a concatenation of logically two-dimensional arrays of values + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatSetOption()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValuesBlocked()`, `MatSetValuesLocal()`, +`InsertMode`, `INSERT_VALUES`, `ADD_VALUES`, `MatSetValues()`, `MatSetPreallocationCOO()`, `MatSetValuesCOO()` + +# External Links +$(_doc_external("Mat/MatSetValuesBatch")) +""" +function MatSetValuesBatch(petsclib::PetscLibType, mat::PetscMat, nb::PetscInt, bs::PetscInt, rows::Vector{PetscInt}, v::Vector{PetscScalar}) end + +@for_petsc function MatSetValuesBatch(petsclib::$UnionPetscLib, mat::PetscMat, nb::$PetscInt, bs::$PetscInt, rows::Vector{$PetscInt}, v::Vector{$PetscScalar} ) + + @chk ccall( + (:MatSetValuesBatch, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscScalar}), + mat, nb, bs, rows, v, + ) + + + return nothing +end + +""" + MatSetLocalToGlobalMapping(petsclib::PetscLibType,x::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping) +Sets a local +the routine `MatSetValuesLocal()` to allow users to insert matrix entries +using a local (per-processor) numbering. + +Not Collective + +Input Parameters: +- `x` - the matrix +- `rmapping` - row mapping created with `ISLocalToGlobalMappingCreate()` or `ISLocalToGlobalMappingCreateIS()` +- `cmapping` - column mapping + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `DM`, `DMCreateMatrix()`, `MatGetLocalToGlobalMapping()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValues()`, `MatSetValuesLocal()`, `MatGetValuesLocal()` + +# External Links +$(_doc_external("Mat/MatSetLocalToGlobalMapping")) +""" +function MatSetLocalToGlobalMapping(petsclib::PetscLibType, x::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping) end + +@for_petsc function MatSetLocalToGlobalMapping(petsclib::$UnionPetscLib, x::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping ) + + @chk ccall( + (:MatSetLocalToGlobalMapping, $petsc_library), + PetscErrorCode, + (CMat, ISLocalToGlobalMapping, ISLocalToGlobalMapping), + x, rmapping, cmapping, + ) + + + return nothing +end + +""" + MatGetLocalToGlobalMapping(petsclib::PetscLibType,A::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping) +Gets the local + +Not Collective + +Input Parameter: +- `A` - the matrix + +Output Parameters: +- `rmapping` - row mapping +- `cmapping` - column mapping + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatSetLocalToGlobalMapping()`, `MatSetValuesLocal()` + +# External Links +$(_doc_external("Mat/MatGetLocalToGlobalMapping")) +""" +function MatGetLocalToGlobalMapping(petsclib::PetscLibType, A::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping) end + +@for_petsc function MatGetLocalToGlobalMapping(petsclib::$UnionPetscLib, A::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping ) + + @chk ccall( + (:MatGetLocalToGlobalMapping, $petsc_library), + PetscErrorCode, + (CMat, Ptr{ISLocalToGlobalMapping}, Ptr{ISLocalToGlobalMapping}), + A, rmapping, cmapping, + ) + + + return nothing +end + +""" + MatSetLayouts(petsclib::PetscLibType,A::PetscMat, rmap::PetscLayout, cmap::PetscLayout) +Sets the `PetscLayout` objects for rows and columns of a matrix + +Logically Collective + +Input Parameters: +- `A` - the matrix +- `rmap` - row layout +- `cmap` - column layout + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `PetscLayout`, `MatCreateVecs()`, `MatGetLocalToGlobalMapping()`, `MatGetLayouts()` + +# External Links +$(_doc_external("Mat/MatSetLayouts")) +""" +function MatSetLayouts(petsclib::PetscLibType, A::PetscMat, rmap::PetscLayout, cmap::PetscLayout) end + +@for_petsc function MatSetLayouts(petsclib::$UnionPetscLib, A::PetscMat, rmap::PetscLayout, cmap::PetscLayout ) + + @chk ccall( + (:MatSetLayouts, $petsc_library), + PetscErrorCode, + (CMat, PetscLayout, PetscLayout), + A, rmap, cmap, + ) + + + return nothing +end + +""" + MatGetLayouts(petsclib::PetscLibType,A::PetscMat, rmap::PetscLayout, cmap::PetscLayout) +Gets the `PetscLayout` objects for rows and columns + +Not Collective + +Input Parameter: +- `A` - the matrix + +Output Parameters: +- `rmap` - row layout +- `cmap` - column layout + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, [Matrix Layouts](sec_matlayout), `PetscLayout`, `MatCreateVecs()`, `MatGetLocalToGlobalMapping()`, `MatSetLayouts()` + +# External Links +$(_doc_external("Mat/MatGetLayouts")) +""" +function MatGetLayouts(petsclib::PetscLibType, A::PetscMat, rmap::PetscLayout, cmap::PetscLayout) end + +@for_petsc function MatGetLayouts(petsclib::$UnionPetscLib, A::PetscMat, rmap::PetscLayout, cmap::PetscLayout ) + + @chk ccall( + (:MatGetLayouts, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscLayout}, Ptr{PetscLayout}), + A, rmap, cmap, + ) + + + return nothing +end + +""" + MatSetValuesLocal(petsclib::PetscLibType,mat::PetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, y::Vector{PetscScalar}, addv::InsertMode) +Inserts or adds values into certain locations of a matrix, +using a local numbering of the rows and columns. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `nrow` - number of rows +- `irow` - the row local indices +- `ncol` - number of columns +- `icol` - the column local indices +- `y` - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order. +See `MAT_ROW_ORIENTED` in `MatSetOption()` for how to use column-major order. +- `addv` - either `ADD_VALUES` to add values to any existing entries, or `INSERT_VALUES` to replace existing entries with new values + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValues()`, `MatSetLocalToGlobalMapping()`, +`MatGetValuesLocal()` + +# External Links +$(_doc_external("Mat/MatSetValuesLocal")) +""" +function MatSetValuesLocal(petsclib::PetscLibType, mat::PetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, y::Vector{PetscScalar}, addv::InsertMode) end + +@for_petsc function MatSetValuesLocal(petsclib::$UnionPetscLib, mat::PetscMat, nrow::$PetscInt, irow::Vector{$PetscInt}, ncol::$PetscInt, icol::Vector{$PetscInt}, y::Vector{$PetscScalar}, addv::InsertMode ) + + @chk ccall( + (:MatSetValuesLocal, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscScalar}, InsertMode), + mat, nrow, irow, ncol, icol, y, addv, + ) + + + return nothing +end + +""" + MatSetValuesBlockedLocal(petsclib::PetscLibType,mat::PetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, y::Vector{PetscScalar}, addv::InsertMode) +Inserts or adds values into certain locations of a matrix, +using a local ordering of the nodes a block at a time. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `nrow` - number of rows +- `irow` - the row local indices +- `ncol` - number of columns +- `icol` - the column local indices +- `y` - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order. +See `MAT_ROW_ORIENTED` in `MatSetOption()` for how to use column-major order. +- `addv` - either `ADD_VALUES` to add values to any existing entries, or `INSERT_VALUES` to replace existing entries with new values + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSetBlockSize()`, `MatSetLocalToGlobalMapping()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, +`MatSetValuesLocal()`, `MatSetValuesBlocked()` + +# External Links +$(_doc_external("Mat/MatSetValuesBlockedLocal")) +""" +function MatSetValuesBlockedLocal(petsclib::PetscLibType, mat::PetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, y::Vector{PetscScalar}, addv::InsertMode) end + +@for_petsc function MatSetValuesBlockedLocal(petsclib::$UnionPetscLib, mat::PetscMat, nrow::$PetscInt, irow::Vector{$PetscInt}, ncol::$PetscInt, icol::Vector{$PetscInt}, y::Vector{$PetscScalar}, addv::InsertMode ) + + @chk ccall( + (:MatSetValuesBlockedLocal, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscScalar}, InsertMode), + mat, nrow, irow, ncol, icol, y, addv, + ) + + + return nothing +end + +""" + MatMultDiagonalBlock(petsclib::PetscLibType,mat::PetscMat, x::PetscVec, y::PetscVec) +Computes the matrix + +Collective + +Input Parameters: +- `mat` - the matrix +- `x` - the vector to be multiplied + +Output Parameter: +- `y` - the result + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatMult()`, `MatMultTranspose()`, `MatMultAdd()`, `MatMultTransposeAdd()` + +# External Links +$(_doc_external("Mat/MatMultDiagonalBlock")) +""" +function MatMultDiagonalBlock(petsclib::PetscLibType, mat::PetscMat, x::PetscVec, y::PetscVec) end + +@for_petsc function MatMultDiagonalBlock(petsclib::$UnionPetscLib, mat::PetscMat, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:MatMultDiagonalBlock, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + mat, x, y, + ) + + + return nothing +end + +""" + MatMult(petsclib::PetscLibType,mat::PetscMat, x::PetscVec, y::PetscVec) +Computes the matrix + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the matrix +- `x` - the vector to be multiplied + +Output Parameter: +- `y` - the result + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatMultTranspose()`, `MatMultAdd()`, `MatMultTransposeAdd()` + +# External Links +$(_doc_external("Mat/MatMult")) +""" +function MatMult(petsclib::PetscLibType, mat::AbstractPetscMat, x::PetscVec, y::PetscVec) end + +@for_petsc function MatMult(petsclib::$UnionPetscLib, mat::AbstractPetscMat, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:MatMult, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + mat, x, y, + ) + + + return nothing +end + +""" + MatMultTranspose(petsclib::PetscLibType,mat::PetscMat, x::PetscVec, y::PetscVec) +Computes matrix transpose times a vector y = A^T * x. + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the matrix +- `x` - the vector to be multiplied + +Output Parameter: +- `y` - the result + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatMult()`, `MatMultAdd()`, `MatMultTransposeAdd()`, `MatMultHermitianTranspose()`, `MatTranspose()` + +# External Links +$(_doc_external("Mat/MatMultTranspose")) +""" +function MatMultTranspose(petsclib::PetscLibType, mat::PetscMat, x::PetscVec, y::PetscVec) end + +@for_petsc function MatMultTranspose(petsclib::$UnionPetscLib, mat::PetscMat, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:MatMultTranspose, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + mat, x, y, + ) + + + return nothing +end + +""" + MatMultHermitianTranspose(petsclib::PetscLibType,mat::PetscMat, x::PetscVec, y::PetscVec) +Computes matrix Hermitian + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the matrix +- `x` - the vector to be multiplied + +Output Parameter: +- `y` - the result + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatMult()`, `MatMultAdd()`, `MatMultHermitianTransposeAdd()`, `MatMultTranspose()` + +# External Links +$(_doc_external("Mat/MatMultHermitianTranspose")) +""" +function MatMultHermitianTranspose(petsclib::PetscLibType, mat::PetscMat, x::PetscVec, y::PetscVec) end + +@for_petsc function MatMultHermitianTranspose(petsclib::$UnionPetscLib, mat::PetscMat, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:MatMultHermitianTranspose, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + mat, x, y, + ) + + + return nothing +end + +""" + MatMultAdd(petsclib::PetscLibType,mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec) +Computes v3 = v2 + A * v1. + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the matrix +- `v1` - the vector to be multiplied by `mat` +- `v2` - the vector to be added to the result + +Output Parameter: +- `v3` - the result + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatMultTranspose()`, `MatMult()`, `MatMultTransposeAdd()` + +# External Links +$(_doc_external("Mat/MatMultAdd")) +""" +function MatMultAdd(petsclib::PetscLibType, mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec) end + +@for_petsc function MatMultAdd(petsclib::$UnionPetscLib, mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec ) + + @chk ccall( + (:MatMultAdd, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec), + mat, v1, v2, v3, + ) + + + return nothing +end + +""" + MatMultTransposeAdd(petsclib::PetscLibType,mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec) +Computes v3 = v2 + A^T * v1. + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the matrix +- `v1` - the vector to be multiplied by the transpose of the matrix +- `v2` - the vector to be added to the result + +Output Parameter: +- `v3` - the result + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatMultTranspose()`, `MatMultAdd()`, `MatMult()` + +# External Links +$(_doc_external("Mat/MatMultTransposeAdd")) +""" +function MatMultTransposeAdd(petsclib::PetscLibType, mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec) end + +@for_petsc function MatMultTransposeAdd(petsclib::$UnionPetscLib, mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec ) + + @chk ccall( + (:MatMultTransposeAdd, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec), + mat, v1, v2, v3, + ) + + + return nothing +end + +""" + MatMultHermitianTransposeAdd(petsclib::PetscLibType,mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec) +Computes v3 = v2 + A^H * v1. + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the matrix +- `v1` - the vector to be multiplied by the Hermitian transpose +- `v2` - the vector to be added to the result + +Output Parameter: +- `v3` - the result + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatMultHermitianTranspose()`, `MatMultTranspose()`, `MatMultAdd()`, `MatMult()` + +# External Links +$(_doc_external("Mat/MatMultHermitianTransposeAdd")) +""" +function MatMultHermitianTransposeAdd(petsclib::PetscLibType, mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec) end + +@for_petsc function MatMultHermitianTransposeAdd(petsclib::$UnionPetscLib, mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec ) + + @chk ccall( + (:MatMultHermitianTransposeAdd, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec), + mat, v1, v2, v3, + ) + + + return nothing +end + +""" + t::MatFactorType = MatGetFactorType(petsclib::PetscLibType,mat::PetscMat) +gets the type of factorization a matrix is + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `t` - the type, one of `MAT_FACTOR_NONE`, `MAT_FACTOR_LU`, `MAT_FACTOR_CHOLESKY`, `MAT_FACTOR_ILU`, `MAT_FACTOR_ICC,MAT_FACTOR_ILUDT`, `MAT_FACTOR_QR` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatFactorType`, `MatGetFactor()`, `MatSetFactorType()`, `MAT_FACTOR_NONE`, `MAT_FACTOR_LU`, `MAT_FACTOR_CHOLESKY`, `MAT_FACTOR_ILU`, +`MAT_FACTOR_ICC`,`MAT_FACTOR_ILUDT`, `MAT_FACTOR_QR` + +# External Links +$(_doc_external("Mat/MatGetFactorType")) +""" +function MatGetFactorType(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetFactorType(petsclib::$UnionPetscLib, mat::PetscMat ) + t_ = Ref{MatFactorType}() + + @chk ccall( + (:MatGetFactorType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatFactorType}), + mat, t_, + ) + + t = unsafe_string(t_[]) + + return t +end + +""" + MatSetFactorType(petsclib::PetscLibType,mat::PetscMat, t::MatFactorType) +sets the type of factorization a matrix is + +Logically Collective + +Input Parameters: +- `mat` - the matrix +- `t` - the type, one of `MAT_FACTOR_NONE`, `MAT_FACTOR_LU`, `MAT_FACTOR_CHOLESKY`, `MAT_FACTOR_ILU`, `MAT_FACTOR_ICC,MAT_FACTOR_ILUDT`, `MAT_FACTOR_QR` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatFactorType`, `MatGetFactor()`, `MatGetFactorType()`, `MAT_FACTOR_NONE`, `MAT_FACTOR_LU`, `MAT_FACTOR_CHOLESKY`, `MAT_FACTOR_ILU`, +`MAT_FACTOR_ICC`,`MAT_FACTOR_ILUDT`, `MAT_FACTOR_QR` + +# External Links +$(_doc_external("Mat/MatSetFactorType")) +""" +function MatSetFactorType(petsclib::PetscLibType, mat::PetscMat, t::MatFactorType) end + +@for_petsc function MatSetFactorType(petsclib::$UnionPetscLib, mat::PetscMat, t::MatFactorType ) + + @chk ccall( + (:MatSetFactorType, $petsc_library), + PetscErrorCode, + (CMat, MatFactorType), + mat, t, + ) + + + return nothing +end + +""" + MatGetInfo(petsclib::PetscLibType,mat::PetscMat, flag::MatInfoType, info::MatInfo) +Returns information about matrix storage (number of +nonzeros, memory, etc.). + +Collective if `MAT_GLOBAL_MAX` or `MAT_GLOBAL_SUM` is used as the flag + +Input Parameters: +- `mat` - the matrix +- `flag` - flag indicating the type of parameters to be returned (`MAT_LOCAL` - local matrix, `MAT_GLOBAL_MAX` - maximum over all processors, `MAT_GLOBAL_SUM` - sum over all processors) + +Output Parameter: +- `info` - matrix information context + +Options Database Key: +- `-mat_view ::ascii_info` - print matrix info to `PETSC_STDOUT` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatInfo`, `MatStashGetInfo()` + +# External Links +$(_doc_external("Mat/MatGetInfo")) +""" +function MatGetInfo(petsclib::PetscLibType, mat::PetscMat, flag::MatInfoType, info::MatInfo) end + +@for_petsc function MatGetInfo(petsclib::$UnionPetscLib, mat::PetscMat, flag::MatInfoType, info::MatInfo ) + + @chk ccall( + (:MatGetInfo, $petsc_library), + PetscErrorCode, + (CMat, MatInfoType, Ptr{MatInfo}), + mat, flag, info, + ) + + + return nothing +end + +""" + MatLUFactor(petsclib::PetscLibType,mat::PetscMat, row::IS, col::IS, info::MatFactorInfo) +Performs in + +Collective + +Input Parameters: +- `mat` - the matrix +- `row` - row permutation +- `col` - column permutation +- `info` - options for factorization, includes +-seealso: [](ch_matrices), [Matrix Factorization](sec_matfactor), `Mat`, `MatFactorType`, `MatLUFactorSymbolic()`, `MatLUFactorNumeric()`, `MatCholeskyFactor()`, +`MatGetOrdering()`, `MatSetUnfactored()`, `MatFactorInfo`, `MatGetFactor()` + +# External Links +$(_doc_external("Mat/MatLUFactor")) +""" +function MatLUFactor(petsclib::PetscLibType, mat::PetscMat, row::IS, col::IS, info::MatFactorInfo) end + +@for_petsc function MatLUFactor(petsclib::$UnionPetscLib, mat::PetscMat, row::IS, col::IS, info::MatFactorInfo ) + + @chk ccall( + (:MatLUFactor, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, Ptr{MatFactorInfo}), + mat, row, col, info, + ) + + + return nothing +end + +""" + MatILUFactor(petsclib::PetscLibType,mat::PetscMat, row::IS, col::IS, info::MatFactorInfo) +Performs in + +Collective + +Input Parameters: +- `mat` - the matrix +- `row` - row permutation +- `col` - column permutation +- `info` - structure containing +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatILUFactorSymbolic()`, `MatLUFactorNumeric()`, `MatCholeskyFactor()`, `MatFactorInfo` + +# External Links +$(_doc_external("Mat/MatILUFactor")) +""" +function MatILUFactor(petsclib::PetscLibType, mat::PetscMat, row::IS, col::IS, info::MatFactorInfo) end + +@for_petsc function MatILUFactor(petsclib::$UnionPetscLib, mat::PetscMat, row::IS, col::IS, info::MatFactorInfo ) + + @chk ccall( + (:MatILUFactor, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, Ptr{MatFactorInfo}), + mat, row, col, info, + ) + + + return nothing +end + +""" + MatLUFactorSymbolic(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, row::IS, col::IS, info::MatFactorInfo) +Performs symbolic LU factorization of matrix. +Call this routine before calling `MatLUFactorNumeric()` and after `MatGetFactor()`. + +Collective + +Input Parameters: +- `fact` - the factor matrix obtained with `MatGetFactor()` +- `mat` - the matrix +- `row` - the row permutation +- `col` - the column permutation +- `info` - options for factorization, includes +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `MatLUFactor()`, `MatLUFactorNumeric()`, `MatCholeskyFactor()`, `MatFactorInfo`, `MatFactorInfoInitialize()` + +# External Links +$(_doc_external("Mat/MatLUFactorSymbolic")) +""" +function MatLUFactorSymbolic(petsclib::PetscLibType, fact::PetscMat, mat::PetscMat, row::IS, col::IS, info::MatFactorInfo) end + +@for_petsc function MatLUFactorSymbolic(petsclib::$UnionPetscLib, fact::PetscMat, mat::PetscMat, row::IS, col::IS, info::MatFactorInfo ) + + @chk ccall( + (:MatLUFactorSymbolic, $petsc_library), + PetscErrorCode, + (CMat, CMat, CIS, CIS, Ptr{MatFactorInfo}), + fact, mat, row, col, info, + ) + + + return nothing +end + +""" + MatLUFactorNumeric(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, info::MatFactorInfo) +Performs numeric LU factorization of a matrix. +Call this routine after first calling `MatLUFactorSymbolic()` and `MatGetFactor()`. + +Collective + +Input Parameters: +- `fact` - the factor matrix obtained with `MatGetFactor()` +- `mat` - the matrix +- `info` - options for factorization + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `MatFactorInfo`, `MatLUFactorSymbolic()`, `MatLUFactor()`, `MatCholeskyFactor()` + +# External Links +$(_doc_external("Mat/MatLUFactorNumeric")) +""" +function MatLUFactorNumeric(petsclib::PetscLibType, fact::PetscMat, mat::PetscMat, info::MatFactorInfo) end + +@for_petsc function MatLUFactorNumeric(petsclib::$UnionPetscLib, fact::PetscMat, mat::PetscMat, info::MatFactorInfo ) + + @chk ccall( + (:MatLUFactorNumeric, $petsc_library), + PetscErrorCode, + (CMat, CMat, Ptr{MatFactorInfo}), + fact, mat, info, + ) + + + return nothing +end + +""" + MatCholeskyFactor(petsclib::PetscLibType,mat::PetscMat, perm::IS, info::MatFactorInfo) +Performs in +symmetric matrix. + +Collective + +Input Parameters: +- `mat` - the matrix +- `perm` - row and column permutations +- `info` - expected fill as ratio of original fill + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `MatFactorInfo`, `MatLUFactor()`, `MatCholeskyFactorSymbolic()`, `MatCholeskyFactorNumeric()` +`MatGetOrdering()` + +# External Links +$(_doc_external("Mat/MatCholeskyFactor")) +""" +function MatCholeskyFactor(petsclib::PetscLibType, mat::PetscMat, perm::IS, info::MatFactorInfo) end + +@for_petsc function MatCholeskyFactor(petsclib::$UnionPetscLib, mat::PetscMat, perm::IS, info::MatFactorInfo ) + + @chk ccall( + (:MatCholeskyFactor, $petsc_library), + PetscErrorCode, + (CMat, CIS, Ptr{MatFactorInfo}), + mat, perm, info, + ) + + + return nothing +end + +""" + MatCholeskyFactorSymbolic(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, perm::IS, info::MatFactorInfo) +Performs symbolic Cholesky factorization +of a symmetric matrix. + +Collective + +Input Parameters: +- `fact` - the factor matrix obtained with `MatGetFactor()` +- `mat` - the matrix +- `perm` - row and column permutations +- `info` - options for factorization, includes +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatFactorInfo`, `MatGetFactor()`, `MatLUFactorSymbolic()`, `MatCholeskyFactor()`, `MatCholeskyFactorNumeric()` +`MatGetOrdering()` + +# External Links +$(_doc_external("Mat/MatCholeskyFactorSymbolic")) +""" +function MatCholeskyFactorSymbolic(petsclib::PetscLibType, fact::PetscMat, mat::PetscMat, perm::IS, info::MatFactorInfo) end + +@for_petsc function MatCholeskyFactorSymbolic(petsclib::$UnionPetscLib, fact::PetscMat, mat::PetscMat, perm::IS, info::MatFactorInfo ) + + @chk ccall( + (:MatCholeskyFactorSymbolic, $petsc_library), + PetscErrorCode, + (CMat, CMat, CIS, Ptr{MatFactorInfo}), + fact, mat, perm, info, + ) + + + return nothing +end + +""" + MatCholeskyFactorNumeric(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, info::MatFactorInfo) +Performs numeric Cholesky factorization +of a symmetric matrix. Call this routine after first calling `MatGetFactor()` and +`MatCholeskyFactorSymbolic()`. + +Collective + +Input Parameters: +- `fact` - the factor matrix obtained with `MatGetFactor()`, where the factored values are stored +- `mat` - the initial matrix that is to be factored +- `info` - options for factorization + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatFactorInfo`, `MatGetFactor()`, `MatCholeskyFactorSymbolic()`, `MatCholeskyFactor()`, `MatLUFactorNumeric()` + +# External Links +$(_doc_external("Mat/MatCholeskyFactorNumeric")) +""" +function MatCholeskyFactorNumeric(petsclib::PetscLibType, fact::PetscMat, mat::PetscMat, info::MatFactorInfo) end + +@for_petsc function MatCholeskyFactorNumeric(petsclib::$UnionPetscLib, fact::PetscMat, mat::PetscMat, info::MatFactorInfo ) + + @chk ccall( + (:MatCholeskyFactorNumeric, $petsc_library), + PetscErrorCode, + (CMat, CMat, Ptr{MatFactorInfo}), + fact, mat, info, + ) + + + return nothing +end + +""" + MatQRFactor(petsclib::PetscLibType,mat::PetscMat, col::IS, info::MatFactorInfo) +Performs in + +Collective + +Input Parameters: +- `mat` - the matrix +- `col` - column permutation +- `info` - options for factorization, includes +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatFactorInfo`, `MatGetFactor()`, `MatQRFactorSymbolic()`, `MatQRFactorNumeric()`, `MatLUFactor()`, +`MatSetUnfactored()` + +# External Links +$(_doc_external("Mat/MatQRFactor")) +""" +function MatQRFactor(petsclib::PetscLibType, mat::PetscMat, col::IS, info::MatFactorInfo) end + +@for_petsc function MatQRFactor(petsclib::$UnionPetscLib, mat::PetscMat, col::IS, info::MatFactorInfo ) + + @chk ccall( + (:MatQRFactor, $petsc_library), + PetscErrorCode, + (CMat, CIS, Ptr{MatFactorInfo}), + mat, col, info, + ) + + + return nothing +end + +""" + MatQRFactorSymbolic(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, col::IS, info::MatFactorInfo) +Performs symbolic QR factorization of matrix. +Call this routine after `MatGetFactor()` but before calling `MatQRFactorNumeric()`. + +Collective + +Input Parameters: +- `fact` - the factor matrix obtained with `MatGetFactor()` +- `mat` - the matrix +- `col` - column permutation +- `info` - options for factorization, includes +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `MatFactorInfo`, `MatQRFactor()`, `MatQRFactorNumeric()`, `MatLUFactor()`, `MatFactorInfoInitialize()` + +# External Links +$(_doc_external("Mat/MatQRFactorSymbolic")) +""" +function MatQRFactorSymbolic(petsclib::PetscLibType, fact::PetscMat, mat::PetscMat, col::IS, info::MatFactorInfo) end + +@for_petsc function MatQRFactorSymbolic(petsclib::$UnionPetscLib, fact::PetscMat, mat::PetscMat, col::IS, info::MatFactorInfo ) + + @chk ccall( + (:MatQRFactorSymbolic, $petsc_library), + PetscErrorCode, + (CMat, CMat, CIS, Ptr{MatFactorInfo}), + fact, mat, col, info, + ) + + + return nothing +end + +""" + MatQRFactorNumeric(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, info::MatFactorInfo) +Performs numeric QR factorization of a matrix. +Call this routine after first calling `MatGetFactor()`, and `MatQRFactorSymbolic()`. + +Collective + +Input Parameters: +- `fact` - the factor matrix obtained with `MatGetFactor()` +- `mat` - the matrix +- `info` - options for factorization + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatFactorInfo`, `MatGetFactor()`, `MatQRFactor()`, `MatQRFactorSymbolic()`, `MatLUFactor()` + +# External Links +$(_doc_external("Mat/MatQRFactorNumeric")) +""" +function MatQRFactorNumeric(petsclib::PetscLibType, fact::PetscMat, mat::PetscMat, info::MatFactorInfo) end + +@for_petsc function MatQRFactorNumeric(petsclib::$UnionPetscLib, fact::PetscMat, mat::PetscMat, info::MatFactorInfo ) + + @chk ccall( + (:MatQRFactorNumeric, $petsc_library), + PetscErrorCode, + (CMat, CMat, Ptr{MatFactorInfo}), + fact, mat, info, + ) + + + return nothing +end + +""" + MatSolve(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec) +Solves A x = b, given a factored matrix. + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the factored matrix +- `b` - the right-hand-side vector + +Output Parameter: +- `x` - the result vector + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `MatLUFactor()`, `MatSolveAdd()`, `MatSolveTranspose()`, `MatSolveTransposeAdd()` + +# External Links +$(_doc_external("Mat/MatSolve")) +""" +function MatSolve(petsclib::PetscLibType, mat::PetscMat, b::PetscVec, x::PetscVec) end + +@for_petsc function MatSolve(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscVec, x::PetscVec ) + + @chk ccall( + (:MatSolve, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + mat, b, x, + ) + + + return nothing +end + +""" + MatMatSolve(petsclib::PetscLibType,A::PetscMat, B::PetscMat, X::PetscMat) +Solves A X = B, given a factored matrix. + +Neighbor-wise Collective + +Input Parameters: +- `A` - the factored matrix +- `B` - the right-hand-side matrix `MATDENSE` (or sparse `MATAIJ`-- when using MUMPS) + +Output Parameter: +- `X` - the result matrix (dense matrix) + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `MatSolve()`, `MatMatSolveTranspose()`, `MatLUFactor()`, `MatCholeskyFactor()` + +# External Links +$(_doc_external("Mat/MatMatSolve")) +""" +function MatMatSolve(petsclib::PetscLibType, A::PetscMat, B::PetscMat, X::PetscMat) end + +@for_petsc function MatMatSolve(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, X::PetscMat ) + + @chk ccall( + (:MatMatSolve, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat), + A, B, X, + ) + + + return nothing +end + +""" + MatMatSolveTranspose(petsclib::PetscLibType,A::PetscMat, B::PetscMat, X::PetscMat) +Solves A^T X = B , given a factored matrix. + +Neighbor-wise Collective + +Input Parameters: +- `A` - the factored matrix +- `B` - the right-hand-side matrix (`MATDENSE` matrix) + +Output Parameter: +- `X` - the result matrix (dense matrix) + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `MatSolveTranspose()`, `MatMatSolve()`, `MatLUFactor()`, `MatCholeskyFactor()` + +# External Links +$(_doc_external("Mat/MatMatSolveTranspose")) +""" +function MatMatSolveTranspose(petsclib::PetscLibType, A::PetscMat, B::PetscMat, X::PetscMat) end + +@for_petsc function MatMatSolveTranspose(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, X::PetscMat ) + + @chk ccall( + (:MatMatSolveTranspose, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat), + A, B, X, + ) + + + return nothing +end + +""" + MatMatTransposeSolve(petsclib::PetscLibType,A::PetscMat, Bt::PetscMat, X::PetscMat) +Solves A X = B^T, given a factored matrix. + +Neighbor-wise Collective + +Input Parameters: +- `A` - the factored matrix +- `Bt` - the transpose of right-hand-side matrix as a `MATDENSE` + +Output Parameter: +- `X` - the result matrix (dense matrix) + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatMatSolve()`, `MatMatSolveTranspose()`, `MatLUFactor()`, `MatCholeskyFactor()` + +# External Links +$(_doc_external("Mat/MatMatTransposeSolve")) +""" +function MatMatTransposeSolve(petsclib::PetscLibType, A::PetscMat, Bt::PetscMat, X::PetscMat) end + +@for_petsc function MatMatTransposeSolve(petsclib::$UnionPetscLib, A::PetscMat, Bt::PetscMat, X::PetscMat ) + + @chk ccall( + (:MatMatTransposeSolve, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat), + A, Bt, X, + ) + + + return nothing +end + +""" + MatForwardSolve(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec) +Solves L x = b , given a factored matrix, A = LU , or +U^T*D^(1/2) x = b, given a factored symmetric matrix, A = U^T*D*U, + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the factored matrix +- `b` - the right-hand-side vector + +Output Parameter: +- `x` - the result vector + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatBackwardSolve()`, `MatGetFactor()`, `MatSolve()` + +# External Links +$(_doc_external("Mat/MatForwardSolve")) +""" +function MatForwardSolve(petsclib::PetscLibType, mat::PetscMat, b::PetscVec, x::PetscVec) end + +@for_petsc function MatForwardSolve(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscVec, x::PetscVec ) + + @chk ccall( + (:MatForwardSolve, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + mat, b, x, + ) + + + return nothing +end + +""" + MatBackwardSolve(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec) +Solves U x = b, given a factored matrix, A = LU. +D^(1/2) U x = b, given a factored symmetric matrix, A = U^T*D*U, + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the factored matrix +- `b` - the right-hand-side vector + +Output Parameter: +- `x` - the result vector + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatForwardSolve()`, `MatGetFactor()`, `MatSolve()` + +# External Links +$(_doc_external("Mat/MatBackwardSolve")) +""" +function MatBackwardSolve(petsclib::PetscLibType, mat::PetscMat, b::PetscVec, x::PetscVec) end + +@for_petsc function MatBackwardSolve(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscVec, x::PetscVec ) + + @chk ccall( + (:MatBackwardSolve, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + mat, b, x, + ) + + + return nothing +end + +""" + MatSolveAdd(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, y::PetscVec, x::PetscVec) +Computes x = y + A^{ + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the factored matrix +- `b` - the right-hand-side vector +- `y` - the vector to be added to + +Output Parameter: +- `x` - the result vector + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatSolve()`, `MatGetFactor()`, `MatSolveTranspose()`, `MatSolveTransposeAdd()` + +# External Links +$(_doc_external("Mat/MatSolveAdd")) +""" +function MatSolveAdd(petsclib::PetscLibType, mat::PetscMat, b::PetscVec, y::PetscVec, x::PetscVec) end + +@for_petsc function MatSolveAdd(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscVec, y::PetscVec, x::PetscVec ) + + @chk ccall( + (:MatSolveAdd, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec), + mat, b, y, x, + ) + + + return nothing +end + +""" + MatSolveTranspose(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec) +Solves A^T x = b, given a factored matrix. + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the factored matrix +- `b` - the right-hand-side vector + +Output Parameter: +- `x` - the result vector + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `KSP`, `MatSolve()`, `MatSolveAdd()`, `MatSolveTransposeAdd()` + +# External Links +$(_doc_external("Mat/MatSolveTranspose")) +""" +function MatSolveTranspose(petsclib::PetscLibType, mat::PetscMat, b::PetscVec, x::PetscVec) end + +@for_petsc function MatSolveTranspose(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscVec, x::PetscVec ) + + @chk ccall( + (:MatSolveTranspose, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + mat, b, x, + ) + + + return nothing +end + +""" + MatSolveTransposeAdd(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, y::PetscVec, x::PetscVec) +Computes x = y + A^{ +factored matrix. + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the factored matrix +- `b` - the right-hand-side vector +- `y` - the vector to be added to + +Output Parameter: +- `x` - the result vector + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSolve()`, `MatSolveAdd()`, `MatSolveTranspose()` + +# External Links +$(_doc_external("Mat/MatSolveTransposeAdd")) +""" +function MatSolveTransposeAdd(petsclib::PetscLibType, mat::PetscMat, b::PetscVec, y::PetscVec, x::PetscVec) end + +@for_petsc function MatSolveTransposeAdd(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscVec, y::PetscVec, x::PetscVec ) + + @chk ccall( + (:MatSolveTransposeAdd, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec), + mat, b, y, x, + ) + + + return nothing +end + +""" + MatSOR(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, omega::PetscReal, flag::MatSORType, shift::PetscReal, its::PetscInt, lits::PetscInt, x::PetscVec) +Computes relaxation (SOR, Gauss + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the matrix +- `b` - the right-hand side +- `omega` - the relaxation factor +- `flag` - flag indicating the type of SOR (see below) +- `shift` - diagonal shift +- `its` - the number of iterations +- `lits` - the number of local iterations + +Output Parameter: +- `x` - the solution (can contain an initial guess, use option `SOR_ZERO_INITIAL_GUESS` to indicate no guess) + +SOR Flags: +- `SOR_FORWARD_SWEEP` - forward SOR +- `SOR_BACKWARD_SWEEP` - backward SOR +- `SOR_SYMMETRIC_SWEEP` - SSOR (symmetric SOR) +- `SOR_LOCAL_FORWARD_SWEEP` - local forward SOR +- `SOR_LOCAL_BACKWARD_SWEEP` - local forward SOR +- `SOR_LOCAL_SYMMETRIC_SWEEP` - local SSOR +- `SOR_EISENSTAT` - SOR with Eisenstat trick +- `SOR_APPLY_UPPER`, `SOR_APPLY_LOWER` - applies +upper/lower triangular part of matrix to +vector (with omega) +- `SOR_ZERO_INITIAL_GUESS` - zero initial guess + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatMult()`, `KSP`, `PC`, `MatGetFactor()` + +# External Links +$(_doc_external("Mat/MatSOR")) +""" +function MatSOR(petsclib::PetscLibType, mat::PetscMat, b::PetscVec, omega::PetscReal, flag::MatSORType, shift::PetscReal, its::PetscInt, lits::PetscInt, x::PetscVec) end + +@for_petsc function MatSOR(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscVec, omega::$PetscReal, flag::MatSORType, shift::$PetscReal, its::$PetscInt, lits::$PetscInt, x::PetscVec ) + + @chk ccall( + (:MatSOR, $petsc_library), + PetscErrorCode, + (CMat, CVec, $PetscReal, MatSORType, $PetscReal, $PetscInt, $PetscInt, CVec), + mat, b, omega, flag, shift, its, lits, x, + ) + + + return nothing +end + +""" + MatCopy(petsclib::PetscLibType,A::PetscMat, B::PetscMat, str::MatStructure) +Copies a matrix to another matrix. + +Collective + +Input Parameters: +- `A` - the matrix +- `str` - `SAME_NONZERO_PATTERN` or `DIFFERENT_NONZERO_PATTERN` + +Output Parameter: +- `B` - where the copy is put + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatConvert()`, `MatDuplicate()` + +# External Links +$(_doc_external("Mat/MatCopy")) +""" +function MatCopy(petsclib::PetscLibType, A::PetscMat, B::PetscMat, str::MatStructure) end + +@for_petsc function MatCopy(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, str::MatStructure ) + + @chk ccall( + (:MatCopy, $petsc_library), + PetscErrorCode, + (CMat, CMat, MatStructure), + A, B, str, + ) + + + return nothing +end + +""" + MatConvert(petsclib::PetscLibType,mat::PetscMat, newtype::MatType, reuse::MatReuse, M::PetscMat) +Converts a matrix to another matrix, either of the same +or different type. + +Collective + +Input Parameters: +- `mat` - the matrix +- `newtype` - new matrix type. Use `MATSAME` to create a new matrix of the +same type as the original matrix. +- `reuse` - denotes if the destination matrix is to be created or reused. +Use `MAT_INPLACE_MATRIX` for inplace conversion (that is when you want the input `Mat` to be changed to contain the matrix in the new format), otherwise use +`MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` (can only be used after the first call was made with `MAT_INITIAL_MATRIX`, causes the matrix space in M to be reused). + +Output Parameter: +- `M` - pointer to place new matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCopy()`, `MatDuplicate()`, `MAT_INITIAL_MATRIX`, `MAT_REUSE_MATRIX`, `MAT_INPLACE_MATRIX` + +# External Links +$(_doc_external("Mat/MatConvert")) +""" +function MatConvert(petsclib::PetscLibType, mat::PetscMat, newtype::MatType, reuse::MatReuse, M::PetscMat) end + +@for_petsc function MatConvert(petsclib::$UnionPetscLib, mat::PetscMat, newtype::MatType, reuse::MatReuse, M::PetscMat ) + M_ = Ref(M.ptr) + + @chk ccall( + (:MatConvert, $petsc_library), + PetscErrorCode, + (CMat, MatType, MatReuse, Ptr{CMat}), + mat, newtype, reuse, M_, + ) + + M.ptr = C_NULL + + return nothing +end + +""" + type::MatSolverType = MatFactorGetSolverType(petsclib::PetscLibType,mat::PetscMat) +Returns name of the package providing the factorization routines + +Not Collective + +Input Parameter: +- `mat` - the matrix, must be a factored matrix + +Output Parameter: +- `type` - the string name of the package (do not free this string) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `MatSolverType`, `MatCopy()`, `MatDuplicate()`, `MatGetFactorAvailable()` + +# External Links +$(_doc_external("Mat/MatFactorGetSolverType")) +""" +function MatFactorGetSolverType(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatFactorGetSolverType(petsclib::$UnionPetscLib, mat::PetscMat ) + type_ = Ref{MatSolverType}() + + @chk ccall( + (:MatFactorGetSolverType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatSolverType}), + mat, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + MatSolverTypeRegister(petsclib::PetscLibType,package::MatSolverType, mtype::MatType, ftype::MatFactorType, createfactor::external) +Registers a `MatSolverType` that works for a particular matrix type + +Logically Collective, No Fortran Support + +Input Parameters: +- `package` - name of the package, for example `petsc` or `superlu` +- `mtype` - the matrix type that works with this package +- `ftype` - the type of factorization supported by the package +- `createfactor` - routine that will create the factored matrix ready to be used + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatFactorGetSolverType()`, `MatCopy()`, `MatDuplicate()`, `MatGetFactorAvailable()`, +`MatGetFactor()` + +# External Links +$(_doc_external("Mat/MatSolverTypeRegister")) +""" +function MatSolverTypeRegister(petsclib::PetscLibType, package::MatSolverType, mtype::MatType, ftype::MatFactorType, createfactor::external) end + +@for_petsc function MatSolverTypeRegister(petsclib::$UnionPetscLib, package::MatSolverType, mtype::MatType, ftype::MatFactorType, createfactor::external ) + + @chk ccall( + (:MatSolverTypeRegister, $petsc_library), + PetscErrorCode, + (MatSolverType, MatType, MatFactorType, external), + package, mtype, ftype, createfactor, + ) + + + return nothing +end + +""" + flg::PetscBool = MatFactorGetCanUseOrdering(petsclib::PetscLibType,mat::PetscMat) +Indicates if the factorization can use the ordering provided in `MatLUFactorSymbolic()`, `MatCholeskyFactorSymbolic()` + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `flg` - `PETSC_TRUE` if uses the ordering + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatCopy()`, `MatDuplicate()`, `MatGetFactorAvailable()`, `MatGetFactor()`, `MatLUFactorSymbolic()`, `MatCholeskyFactorSymbolic()` + +# External Links +$(_doc_external("Mat/MatFactorGetCanUseOrdering")) +""" +function MatFactorGetCanUseOrdering(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatFactorGetCanUseOrdering(petsclib::$UnionPetscLib, mat::PetscMat ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatFactorGetCanUseOrdering, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + mat, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatFactorGetPreferredOrdering(petsclib::PetscLibType,mat::PetscMat, ftype::MatFactorType, otype::MatOrderingType) +The preferred ordering for a particular matrix factor object + +Logically Collective + +Input Parameters: +- `mat` - the matrix obtained with `MatGetFactor()` +- `ftype` - the factorization type to be used + +Output Parameter: +- `otype` - the preferred ordering type + +Level: developer + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatFactorType`, `MatOrderingType`, `MatCopy()`, `MatDuplicate()`, `MatGetFactorAvailable()`, `MatGetFactor()`, `MatLUFactorSymbolic()`, `MatCholeskyFactorSymbolic()` + +# External Links +$(_doc_external("Mat/MatFactorGetPreferredOrdering")) +""" +function MatFactorGetPreferredOrdering(petsclib::PetscLibType, mat::PetscMat, ftype::MatFactorType, otype::MatOrderingType) end + +@for_petsc function MatFactorGetPreferredOrdering(petsclib::$UnionPetscLib, mat::PetscMat, ftype::MatFactorType, otype::MatOrderingType ) + + @chk ccall( + (:MatFactorGetPreferredOrdering, $petsc_library), + PetscErrorCode, + (CMat, MatFactorType, Ptr{MatOrderingType}), + mat, ftype, otype, + ) + + + return nothing +end + +""" + MatGetFactor(petsclib::PetscLibType,mat::PetscMat, type::MatSolverType, ftype::MatFactorType, f::PetscMat) +Returns a matrix suitable to calls to MatXXFactorSymbolic,Numeric() + +Collective + +Input Parameters: +- `mat` - the matrix +- `type` - name of solver type, for example, `superlu`, `petsc` (to use PETSc's solver if it is available), if this is 'NULL', then the first result that satisfies +the other criteria is returned +- `ftype` - factor type, `MAT_FACTOR_LU`, `MAT_FACTOR_CHOLESKY`, `MAT_FACTOR_ICC`, `MAT_FACTOR_ILU`, `MAT_FACTOR_QR` + +Output Parameter: +- `f` - the factor matrix used with MatXXFactorSymbolic,Numeric() calls. Can be `NULL` in some cases, see notes below. + +Options Database Keys: +- `-pc_factor_mat_solver_type ` - choose the type at run time. When using `KSP` solvers +- `-pc_factor_mat_factor_on_host ` - do mat factorization on host (with device matrices). Default is doing it on device +- `-pc_factor_mat_solve_on_host ` - do mat solve on host (with device matrices). Default is doing it on device + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `KSP`, `MatSolverType`, `MatFactorType`, `MatCopy()`, `MatDuplicate()`, +`MatGetFactorAvailable()`, `MatFactorGetCanUseOrdering()`, `MatSolverTypeRegister()`, `MatSolverTypeGet()` +`MAT_FACTOR_LU`, `MAT_FACTOR_CHOLESKY`, `MAT_FACTOR_ICC`, `MAT_FACTOR_ILU`, `MAT_FACTOR_QR`, `MatInitializePackage()` + +# External Links +$(_doc_external("Mat/MatGetFactor")) +""" +function MatGetFactor(petsclib::PetscLibType, mat::PetscMat, type::MatSolverType, ftype::MatFactorType, f::PetscMat) end + +@for_petsc function MatGetFactor(petsclib::$UnionPetscLib, mat::PetscMat, type::MatSolverType, ftype::MatFactorType, f::PetscMat ) + f_ = Ref(f.ptr) + + @chk ccall( + (:MatGetFactor, $petsc_library), + PetscErrorCode, + (CMat, MatSolverType, MatFactorType, Ptr{CMat}), + mat, type, ftype, f_, + ) + + f.ptr = C_NULL + + return nothing +end + +""" + flg::PetscBool = MatGetFactorAvailable(petsclib::PetscLibType,mat::PetscMat, type::MatSolverType, ftype::MatFactorType) +Returns a flag if matrix supports particular type and factor type + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `type` - name of solver type, for example, `superlu`, `petsc` (to use PETSc's default) +- `ftype` - factor type, `MAT_FACTOR_LU`, `MAT_FACTOR_CHOLESKY`, `MAT_FACTOR_ICC`, `MAT_FACTOR_ILU`, `MAT_FACTOR_QR` + +Output Parameter: +- `flg` - PETSC_TRUE if the factorization is available + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatSolverType`, `MatFactorType`, `MatGetFactor()`, `MatCopy()`, `MatDuplicate()`, `MatSolverTypeRegister()`, +`MAT_FACTOR_LU`, `MAT_FACTOR_CHOLESKY`, `MAT_FACTOR_ICC`, `MAT_FACTOR_ILU`, `MAT_FACTOR_QR`, `MatSolverTypeGet()` + +# External Links +$(_doc_external("Mat/MatGetFactorAvailable")) +""" +function MatGetFactorAvailable(petsclib::PetscLibType, mat::PetscMat, type::MatSolverType, ftype::MatFactorType) end + +@for_petsc function MatGetFactorAvailable(petsclib::$UnionPetscLib, mat::PetscMat, type::MatSolverType, ftype::MatFactorType ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatGetFactorAvailable, $petsc_library), + PetscErrorCode, + (CMat, MatSolverType, MatFactorType, Ptr{PetscBool}), + mat, type, ftype, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatDuplicate(petsclib::PetscLibType,mat::PetscMat, op::MatDuplicateOption, M::PetscMat) +Duplicates a matrix including the non + +Collective + +Input Parameters: +- `mat` - the matrix +- `op` - One of `MAT_DO_NOT_COPY_VALUES`, `MAT_COPY_VALUES`, or `MAT_SHARE_NONZERO_PATTERN`. +See the manual page for `MatDuplicateOption()` for an explanation of these options. + +Output Parameter: +- `M` - pointer to place new matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCopy()`, `MatConvert()`, `MatDuplicateOption` + +# External Links +$(_doc_external("Mat/MatDuplicate")) +""" +function MatDuplicate(petsclib::PetscLibType, mat::PetscMat, op::MatDuplicateOption, M::PetscMat) end + +@for_petsc function MatDuplicate(petsclib::$UnionPetscLib, mat::PetscMat, op::MatDuplicateOption, M::PetscMat ) + M_ = Ref(M.ptr) + + @chk ccall( + (:MatDuplicate, $petsc_library), + PetscErrorCode, + (CMat, MatDuplicateOption, Ptr{CMat}), + mat, op, M_, + ) + + M.ptr = C_NULL + + return nothing +end + +""" + MatGetDiagonal(petsclib::PetscLibType,mat::PetscMat, v::PetscVec) +Gets the diagonal of a matrix as a `Vec` + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `v` - the diagonal of the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `Vec`, `MatGetRow()`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRowMaxAbs()` + +# External Links +$(_doc_external("Mat/MatGetDiagonal")) +""" +function MatGetDiagonal(petsclib::PetscLibType, mat::PetscMat, v::PetscVec) end + +@for_petsc function MatGetDiagonal(petsclib::$UnionPetscLib, mat::PetscMat, v::PetscVec ) + + @chk ccall( + (:MatGetDiagonal, $petsc_library), + PetscErrorCode, + (CMat, CVec), + mat, v, + ) + + + return nothing +end + +""" + MatGetRowMin(petsclib::PetscLibType,mat::PetscMat, v::PetscVec, idx::Vector{PetscInt}) +Gets the minimum value (of the real part) of each +row of the matrix + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `v` - the vector for storing the maximums +- `idx` - the indices of the column found for each row (optional, pass `NULL` if not needed) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatGetDiagonal()`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRowMaxAbs()`, `MatGetRowMinAbs()`, +`MatGetRowMax()` + +# External Links +$(_doc_external("Mat/MatGetRowMin")) +""" +function MatGetRowMin(petsclib::PetscLibType, mat::PetscMat, v::PetscVec, idx::Vector{PetscInt}) end + +@for_petsc function MatGetRowMin(petsclib::$UnionPetscLib, mat::PetscMat, v::PetscVec, idx::Vector{$PetscInt} ) + + @chk ccall( + (:MatGetRowMin, $petsc_library), + PetscErrorCode, + (CMat, CVec, Ptr{$PetscInt}), + mat, v, idx, + ) + + + return nothing +end + +""" + MatGetRowMinAbs(petsclib::PetscLibType,mat::PetscMat, v::PetscVec, idx::Vector{PetscInt}) +Gets the minimum value (in absolute value) of each +row of the matrix + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `v` - the vector for storing the minimums +- `idx` - the indices of the column found for each row (or `NULL` if not needed) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatGetDiagonal()`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRowMax()`, `MatGetRowMaxAbs()`, `MatGetRowMin()` + +# External Links +$(_doc_external("Mat/MatGetRowMinAbs")) +""" +function MatGetRowMinAbs(petsclib::PetscLibType, mat::PetscMat, v::PetscVec, idx::Vector{PetscInt}) end + +@for_petsc function MatGetRowMinAbs(petsclib::$UnionPetscLib, mat::PetscMat, v::PetscVec, idx::Vector{$PetscInt} ) + + @chk ccall( + (:MatGetRowMinAbs, $petsc_library), + PetscErrorCode, + (CMat, CVec, Ptr{$PetscInt}), + mat, v, idx, + ) + + + return nothing +end + +""" + MatGetRowMax(petsclib::PetscLibType,mat::PetscMat, v::PetscVec, idx::Vector{PetscInt}) +Gets the maximum value (of the real part) of each +row of the matrix + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `v` - the vector for storing the maximums +- `idx` - the indices of the column found for each row (optional, otherwise pass `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatGetDiagonal()`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRowMaxAbs()`, `MatGetRowMin()`, `MatGetRowMinAbs()` + +# External Links +$(_doc_external("Mat/MatGetRowMax")) +""" +function MatGetRowMax(petsclib::PetscLibType, mat::PetscMat, v::PetscVec, idx::Vector{PetscInt}) end + +@for_petsc function MatGetRowMax(petsclib::$UnionPetscLib, mat::PetscMat, v::PetscVec, idx::Vector{$PetscInt} ) + + @chk ccall( + (:MatGetRowMax, $petsc_library), + PetscErrorCode, + (CMat, CVec, Ptr{$PetscInt}), + mat, v, idx, + ) + + + return nothing +end + +""" + MatGetRowMaxAbs(petsclib::PetscLibType,mat::PetscMat, v::PetscVec, idx::Vector{PetscInt}) +Gets the maximum value (in absolute value) of each +row of the matrix + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `v` - the vector for storing the maximums +- `idx` - the indices of the column found for each row (or `NULL` if not needed) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatGetDiagonal()`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRowSum()`, `MatGetRowMin()`, `MatGetRowMinAbs()` + +# External Links +$(_doc_external("Mat/MatGetRowMaxAbs")) +""" +function MatGetRowMaxAbs(petsclib::PetscLibType, mat::PetscMat, v::PetscVec, idx::Vector{PetscInt}) end + +@for_petsc function MatGetRowMaxAbs(petsclib::$UnionPetscLib, mat::PetscMat, v::PetscVec, idx::Vector{$PetscInt} ) + + @chk ccall( + (:MatGetRowMaxAbs, $petsc_library), + PetscErrorCode, + (CMat, CVec, Ptr{$PetscInt}), + mat, v, idx, + ) + + + return nothing +end + +""" + MatGetRowSumAbs(petsclib::PetscLibType,mat::PetscMat, v::PetscVec) +Gets the sum value (in absolute value) of each row of the matrix + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `v` - the vector for storing the sum + +Level: intermediate + +This code is only implemented for a couple of matrix formats. + +-seealso: [](ch_matrices), `Mat`, `MatGetDiagonal()`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRowMax()`, `MatGetRowMin()`, `MatGetRowMinAbs()` + +# External Links +$(_doc_external("Mat/MatGetRowSumAbs")) +""" +function MatGetRowSumAbs(petsclib::PetscLibType, mat::PetscMat, v::PetscVec) end + +@for_petsc function MatGetRowSumAbs(petsclib::$UnionPetscLib, mat::PetscMat, v::PetscVec ) + + @chk ccall( + (:MatGetRowSumAbs, $petsc_library), + PetscErrorCode, + (CMat, CVec), + mat, v, + ) + + + return nothing +end + +""" + MatGetRowSum(petsclib::PetscLibType,mat::PetscMat, v::PetscVec) +Gets the sum of each row of the matrix + +Logically or Neighborhood Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `v` - the vector for storing the sum of rows + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatGetDiagonal()`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRowMax()`, `MatGetRowMin()`, `MatGetRowMaxAbs()`, `MatGetRowMinAbs()`, `MatGetRowSumAbs()` + +# External Links +$(_doc_external("Mat/MatGetRowSum")) +""" +function MatGetRowSum(petsclib::PetscLibType, mat::PetscMat, v::PetscVec) end + +@for_petsc function MatGetRowSum(petsclib::$UnionPetscLib, mat::PetscMat, v::PetscVec ) + + @chk ccall( + (:MatGetRowSum, $petsc_library), + PetscErrorCode, + (CMat, CVec), + mat, v, + ) + + + return nothing +end + +""" + MatTransposeSetPrecursor(petsclib::PetscLibType,mat::PetscMat, B::PetscMat) +Set the matrix from which the second matrix will receive numerical transpose data with a call to `MatTranspose`(A,`MAT_REUSE_MATRIX`,&B) +when B was not obtained with `MatTranspose`(A,`MAT_INITIAL_MATRIX`,&B) + +Collective + +Input Parameter: +- `mat` - the matrix to provide the transpose + +Output Parameter: +- `B` - the matrix to contain the transpose; it MUST have the nonzero structure of the transpose of A or the code will crash or generate incorrect results + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatTransposeSymbolic()`, `MatTranspose()`, `MatMultTranspose()`, `MatMultTransposeAdd()`, `MatIsTranspose()`, `MatReuse`, `MAT_INITIAL_MATRIX`, `MAT_REUSE_MATRIX`, `MAT_INPLACE_MATRIX` + +# External Links +$(_doc_external("Mat/MatTransposeSetPrecursor")) +""" +function MatTransposeSetPrecursor(petsclib::PetscLibType, mat::PetscMat, B::PetscMat) end + +@for_petsc function MatTransposeSetPrecursor(petsclib::$UnionPetscLib, mat::PetscMat, B::PetscMat ) + + @chk ccall( + (:MatTransposeSetPrecursor, $petsc_library), + PetscErrorCode, + (CMat, CMat), + mat, B, + ) + + + return nothing +end + +""" + MatTranspose(petsclib::PetscLibType,mat::PetscMat, reuse::MatReuse, B::PetscMat) +Computes the transpose of a matrix, either in + +Collective + +Input Parameters: +- `mat` - the matrix to transpose +- `reuse` - either `MAT_INITIAL_MATRIX`, `MAT_REUSE_MATRIX`, or `MAT_INPLACE_MATRIX` + +Output Parameter: +- `B` - the transpose of the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatTransposeSetPrecursor()`, `MatMultTranspose()`, `MatMultTransposeAdd()`, `MatIsTranspose()`, `MatReuse`, `MAT_INITIAL_MATRIX`, `MAT_REUSE_MATRIX`, `MAT_INPLACE_MATRIX`, +`MatTransposeSymbolic()`, `MatCreateTranspose()` + +# External Links +$(_doc_external("Mat/MatTranspose")) +""" +function MatTranspose(petsclib::PetscLibType, mat::PetscMat, reuse::MatReuse, B::PetscMat) end + +@for_petsc function MatTranspose(petsclib::$UnionPetscLib, mat::PetscMat, reuse::MatReuse, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:MatTranspose, $petsc_library), + PetscErrorCode, + (CMat, MatReuse, Ptr{CMat}), + mat, reuse, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + MatTransposeSymbolic(petsclib::PetscLibType,A::PetscMat, B::PetscMat) +Computes the symbolic part of the transpose of a matrix. + +Collective + +Input Parameter: +- `A` - the matrix to transpose + +Output Parameter: +- `B` - the transpose. This is a complete matrix but the numerical portion is invalid. One can call `MatTranspose`(A,`MAT_REUSE_MATRIX`,&B) to compute the +numerical portion. + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatTransposeSetPrecursor()`, `MatTranspose()`, `MatMultTranspose()`, `MatMultTransposeAdd()`, `MatIsTranspose()`, `MatReuse`, `MAT_INITIAL_MATRIX`, `MAT_REUSE_MATRIX`, `MAT_INPLACE_MATRIX` + +# External Links +$(_doc_external("Mat/MatTransposeSymbolic")) +""" +function MatTransposeSymbolic(petsclib::PetscLibType, A::PetscMat, B::PetscMat) end + +@for_petsc function MatTransposeSymbolic(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:MatTransposeSymbolic, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + flg::PetscBool = MatIsTranspose(petsclib::PetscLibType,A::PetscMat, B::PetscMat, tol::PetscReal) +Test whether a matrix is another one's transpose, +or its own, in which case it tests symmetry. + +Collective + +Input Parameters: +- `A` - the matrix to test +- `B` - the matrix to test against, this can equal the first parameter +- `tol` - tolerance, differences between entries smaller than this are counted as zero + +Output Parameter: +- `flg` - the result + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatTranspose()`, `MatIsSymmetric()`, `MatIsHermitian()` + +# External Links +$(_doc_external("Mat/MatIsTranspose")) +""" +function MatIsTranspose(petsclib::PetscLibType, A::PetscMat, B::PetscMat, tol::PetscReal) end + +@for_petsc function MatIsTranspose(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, tol::$PetscReal ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsTranspose, $petsc_library), + PetscErrorCode, + (CMat, CMat, $PetscReal, Ptr{PetscBool}), + A, B, tol, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatHermitianTranspose(petsclib::PetscLibType,mat::PetscMat, reuse::MatReuse, B::PetscMat) +Computes an in + +Collective + +Input Parameters: +- `mat` - the matrix to transpose and complex conjugate +- `reuse` - either `MAT_INITIAL_MATRIX`, `MAT_REUSE_MATRIX`, or `MAT_INPLACE_MATRIX` + +Output Parameter: +- `B` - the Hermitian transpose + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatTranspose()`, `MatMultTranspose()`, `MatMultTransposeAdd()`, `MatIsTranspose()`, `MatReuse` + +# External Links +$(_doc_external("Mat/MatHermitianTranspose")) +""" +function MatHermitianTranspose(petsclib::PetscLibType, mat::PetscMat, reuse::MatReuse, B::PetscMat) end + +@for_petsc function MatHermitianTranspose(petsclib::$UnionPetscLib, mat::PetscMat, reuse::MatReuse, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:MatHermitianTranspose, $petsc_library), + PetscErrorCode, + (CMat, MatReuse, Ptr{CMat}), + mat, reuse, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + flg::PetscBool = MatIsHermitianTranspose(petsclib::PetscLibType,A::PetscMat, B::PetscMat, tol::PetscReal) +Test whether a matrix is another one's Hermitian transpose, + +Collective + +Input Parameters: +- `A` - the matrix to test +- `B` - the matrix to test against, this can equal the first parameter +- `tol` - tolerance, differences between entries smaller than this are counted as zero + +Output Parameter: +- `flg` - the result + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatTranspose()`, `MatIsSymmetric()`, `MatIsHermitian()`, `MatIsTranspose()` + +# External Links +$(_doc_external("Mat/MatIsHermitianTranspose")) +""" +function MatIsHermitianTranspose(petsclib::PetscLibType, A::PetscMat, B::PetscMat, tol::PetscReal) end + +@for_petsc function MatIsHermitianTranspose(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, tol::$PetscReal ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsHermitianTranspose, $petsc_library), + PetscErrorCode, + (CMat, CMat, $PetscReal, Ptr{PetscBool}), + A, B, tol, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatPermute(petsclib::PetscLibType,mat::PetscMat, row::IS, col::IS, B::PetscMat) +Creates a new matrix with rows and columns permuted from the +original. + +Collective + +Input Parameters: +- `mat` - the matrix to permute +- `row` - row permutation, each processor supplies only the permutation for its rows +- `col` - column permutation, each processor supplies only the permutation for its columns + +Output Parameter: +- `B` - the permuted matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetOrdering()`, `ISAllGather()`, `MatCreateSubMatrix()` + +# External Links +$(_doc_external("Mat/MatPermute")) +""" +function MatPermute(petsclib::PetscLibType, mat::PetscMat, row::IS, col::IS, B::PetscMat) end + +@for_petsc function MatPermute(petsclib::$UnionPetscLib, mat::PetscMat, row::IS, col::IS, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:MatPermute, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, Ptr{CMat}), + mat, row, col, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + flg::PetscBool = MatEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat) +Compares two matrices. + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix + +Output Parameter: +- `flg` - `PETSC_TRUE` if the matrices are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatMultEqual()` + +# External Links +$(_doc_external("Mat/MatEqual")) +""" +function MatEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat) end + +@for_petsc function MatEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, Ptr{PetscBool}), + A, B, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatDiagonalScale(petsclib::PetscLibType,mat::PetscMat, l::PetscVec, r::PetscVec) +Scales a matrix on the left and right by diagonal +matrices that are stored as vectors. Either of the two scaling +matrices can be `NULL`. + +Collective + +Input Parameters: +- `mat` - the matrix to be scaled +- `l` - the left scaling vector (or `NULL`) +- `r` - the right scaling vector (or `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatScale()`, `MatShift()`, `MatDiagonalSet()` + +# External Links +$(_doc_external("Mat/MatDiagonalScale")) +""" +function MatDiagonalScale(petsclib::PetscLibType, mat::PetscMat, l::Union{Ptr,PetscVec}, r::Union{Ptr,PetscVec}) end + +@for_petsc function MatDiagonalScale(petsclib::$UnionPetscLib, mat::PetscMat, l::Union{Ptr,PetscVec}, r::Union{Ptr,PetscVec}) + + @chk ccall( + (:MatDiagonalScale, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + mat, l, r, + ) + + + return nothing +end + +""" + MatScale(petsclib::PetscLibType,mat::PetscMat, a::PetscScalar) +Scales all elements of a matrix by a given number. + +Logically Collective + +Input Parameters: +- `mat` - the matrix to be scaled +- `a` - the scaling value + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatDiagonalScale()` + +# External Links +$(_doc_external("Mat/MatScale")) +""" +function MatScale(petsclib::PetscLibType, mat::PetscMat, a::PetscScalar) end + +@for_petsc function MatScale(petsclib::$UnionPetscLib, mat::PetscMat, a::$PetscScalar ) + + @chk ccall( + (:MatScale, $petsc_library), + PetscErrorCode, + (CMat, $PetscScalar), + mat, a, + ) + + + return nothing +end + +""" + nrm::PetscReal = MatNorm(petsclib::PetscLibType,mat::PetscMat, type::NormType) +Calculates various norms of a matrix. + +Collective + +Input Parameters: +- `mat` - the matrix +- `type` - the type of norm, `NORM_1`, `NORM_FROBENIUS`, `NORM_INFINITY` + +Output Parameter: +- `nrm` - the resulting norm + +Level: intermediate + +-seealso: [](ch_matrices), `Mat` + +# External Links +$(_doc_external("Mat/MatNorm")) +""" +function MatNorm(petsclib::PetscLibType, mat::PetscMat, type::NormType) end + +@for_petsc function MatNorm(petsclib::$UnionPetscLib, mat::PetscMat, type::NormType ) + nrm_ = Ref{$PetscReal}() + + @chk ccall( + (:MatNorm, $petsc_library), + PetscErrorCode, + (CMat, NormType, Ptr{$PetscReal}), + mat, type, nrm_, + ) + + nrm = nrm_[] + + return nrm +end + +""" + MatAssemblyBegin(petsclib::PetscLibType,mat::PetscMat, type::MatAssemblyType) +Begins assembling the matrix. This routine should +be called after completing all calls to `MatSetValues()`. + +Collective + +Input Parameters: +- `mat` - the matrix +- `type` - type of assembly, either `MAT_FLUSH_ASSEMBLY` or `MAT_FINAL_ASSEMBLY` + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatAssemblyEnd()`, `MatSetValues()`, `MatAssembled()` + +# External Links +$(_doc_external("Mat/MatAssemblyBegin")) +""" +function MatAssemblyBegin(petsclib::PetscLibType, mat::AbstractPetscMat, type::MatAssemblyType) end + +@for_petsc function MatAssemblyBegin(petsclib::$UnionPetscLib, mat::AbstractPetscMat, type::MatAssemblyType ) + + @chk ccall( + (:MatAssemblyBegin, $petsc_library), + PetscErrorCode, + (CMat, MatAssemblyType), + mat, type, + ) + + + return nothing +end + +""" + assembled::PetscBool = MatAssembled(petsclib::PetscLibType,mat::PetscMat) +Indicates if a matrix has been assembled and is ready for +use; for example, in matrix-vector product. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `assembled` - `PETSC_TRUE` or `PETSC_FALSE` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatAssemblyEnd()`, `MatSetValues()`, `MatAssemblyBegin()` + +# External Links +$(_doc_external("Mat/MatAssembled")) +""" +function MatAssembled(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatAssembled(petsclib::$UnionPetscLib, mat::PetscMat ) + assembled_ = Ref{PetscBool}() + + @chk ccall( + (:MatAssembled, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + mat, assembled_, + ) + + assembled = assembled_[] + + return assembled +end + +""" + MatAssemblyEnd(petsclib::PetscLibType,mat::PetscMat, type::MatAssemblyType) +Completes assembling the matrix. This routine should +be called after `MatAssemblyBegin()`. + +Collective + +Input Parameters: +- `mat` - the matrix +- `type` - type of assembly, either `MAT_FLUSH_ASSEMBLY` or `MAT_FINAL_ASSEMBLY` + +Options Database Keys: +- `-mat_view ::ascii_info` - Prints info on matrix at conclusion of `MatAssemblyEnd()` +- `-mat_view ::ascii_info_detail` - Prints more detailed info +- `-mat_view` - Prints matrix in ASCII format +- `-mat_view ::ascii_matlab` - Prints matrix in MATLAB format +- `-mat_view draw` - draws nonzero structure of matrix, using `MatView()` and `PetscDrawOpenX()`. +- `-display ` - Sets display name (default is host) +- `-draw_pause ` - Sets number of seconds to pause after display +- `-mat_view socket` - Sends matrix to socket, can be accessed from MATLAB (See [Using MATLAB with PETSc](ch_matlab)) +- `-viewer_socket_machine ` - Machine to use for socket +- `-viewer_socket_port ` - Port number to use for socket +- `-mat_view binary:filename[:append]` - Save matrix to file in binary format + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatAssemblyBegin()`, `MatSetValues()`, `PetscDrawOpenX()`, `PetscDrawCreate()`, `MatView()`, `MatAssembled()`, `PetscViewerSocketOpen()` + +# External Links +$(_doc_external("Mat/MatAssemblyEnd")) +""" +function MatAssemblyEnd(petsclib::PetscLibType, mat::AbstractPetscMat, type::MatAssemblyType) end + +@for_petsc function MatAssemblyEnd(petsclib::$UnionPetscLib, mat::AbstractPetscMat, type::MatAssemblyType ) + + @chk ccall( + (:MatAssemblyEnd, $petsc_library), + PetscErrorCode, + (CMat, MatAssemblyType), + mat, type, + ) + + + return nothing +end + +""" + MatSetOption(petsclib::PetscLibType,mat::PetscMat, op::MatOption, flg::PetscBool) +Sets a parameter option for a matrix. Some options +may be specific to certain storage formats. Some options +determine how values will be inserted (or added). Sorted, +row-oriented input will generally assemble the fastest. The default +is row-oriented. + +Logically Collective for certain operations, such as `MAT_SPD`, not collective for `MAT_ROW_ORIENTED`, see `MatOption` + +Input Parameters: +- `mat` - the matrix +- `op` - the option, one of those listed below (and possibly others), +- `flg` - turn the option on (`PETSC_TRUE`) or off (`PETSC_FALSE`) + +Options Describing Matrix Structure: +- `MAT_SPD` - symmetric positive definite +- `MAT_SYMMETRIC` - symmetric in terms of both structure and value +- `MAT_HERMITIAN` - transpose is the complex conjugation +- `MAT_STRUCTURALLY_SYMMETRIC` - symmetric nonzero structure +- `MAT_SYMMETRY_ETERNAL` - indicates the symmetry (or Hermitian structure) or its absence will persist through any changes to the matrix +- `MAT_STRUCTURAL_SYMMETRY_ETERNAL` - indicates the structural symmetry or its absence will persist through any changes to the matrix +- `MAT_SPD_ETERNAL` - indicates the value of `MAT_SPD` (true or false) will persist through any changes to the matrix + +These are not really options of the matrix, they are knowledge about the structure of the matrix that users may provide so that they +do not need to be computed (usually at a high cost) + +Options For Use with `MatSetValues()`: +Insert a logically dense subblock, which can be +- `MAT_ROW_ORIENTED` - row-oriented (default) + +These options reflect the data you pass in with `MatSetValues()`; it has +nothing to do with how the data is stored internally in the matrix +data structure. + +When (re)assembling a matrix, we can restrict the input for +efficiency/debugging purposes. These options include +- `MAT_NEW_NONZERO_LOCATIONS` - additional insertions will be allowed if they generate a new nonzero (slow) +- `MAT_FORCE_DIAGONAL_ENTRIES` - forces diagonal entries to be allocated +- `MAT_IGNORE_OFF_PROC_ENTRIES` - drops off-processor entries +- `MAT_NEW_NONZERO_LOCATION_ERR` - generates an error for new matrix entry +- `MAT_USE_HASH_TABLE` - uses a hash table to speed up matrix assembly +- `MAT_NO_OFF_PROC_ENTRIES` - you know each process will only set values for its own rows, will generate an error if +any process sets values for another process. This avoids all reductions in the MatAssembly routines and thus improves +performance for very large process counts. +- `MAT_SUBSET_OFF_PROC_ENTRIES` - you know that the first assembly after setting this flag will set a superset +of the off-process entries required for all subsequent assemblies. This avoids a rendezvous step in the MatAssembly +functions, instead sending only neighbor messages. + +Level: intermediate + +-seealso: [](ch_matrices), `MatOption`, `Mat`, `MatGetOption()` + +# External Links +$(_doc_external("Mat/MatSetOption")) +""" +function MatSetOption(petsclib::PetscLibType, mat::PetscMat, op::MatOption, flg::PetscBool) end + +@for_petsc function MatSetOption(petsclib::$UnionPetscLib, mat::PetscMat, op::MatOption, flg::PetscBool ) + + @chk ccall( + (:MatSetOption, $petsc_library), + PetscErrorCode, + (CMat, MatOption, PetscBool), + mat, op, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = MatGetOption(petsclib::PetscLibType,mat::PetscMat, op::MatOption) +Gets a parameter option that has been set for a matrix. + +Logically Collective + +Input Parameters: +- `mat` - the matrix +- `op` - the option, this only responds to certain options, check the code for which ones + +Output Parameter: +- `flg` - turn the option on (`PETSC_TRUE`) or off (`PETSC_FALSE`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatOption`, `MatSetOption()`, `MatIsSymmetric()`, `MatIsHermitian()`, `MatIsStructurallySymmetric()`, +`MatIsSymmetricKnown()`, `MatIsHermitianKnown()`, `MatIsStructurallySymmetricKnown()` + +# External Links +$(_doc_external("Mat/MatGetOption")) +""" +function MatGetOption(petsclib::PetscLibType, mat::PetscMat, op::MatOption) end + +@for_petsc function MatGetOption(petsclib::$UnionPetscLib, mat::PetscMat, op::MatOption ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatGetOption, $petsc_library), + PetscErrorCode, + (CMat, MatOption, Ptr{PetscBool}), + mat, op, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatZeroEntries(petsclib::PetscLibType,mat::PetscMat) +Zeros all entries of a matrix. For sparse matrices +this routine retains the old nonzero structure. + +Logically Collective + +Input Parameter: +- `mat` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatZeroRows()`, `MatZeroRowsColumns()` + +# External Links +$(_doc_external("Mat/MatZeroEntries")) +""" +function MatZeroEntries(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatZeroEntries(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatZeroEntries, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + MatZeroRowsColumns(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec) +Zeros all entries (except possibly the main diagonal) +of a set of rows and columns of a matrix. + +Collective + +Input Parameters: +- `mat` - the matrix +- `numRows` - the number of rows/columns to zero +- `rows` - the global row indices +- `diag` - value put in the diagonal of the eliminated rows +- `x` - optional vector of the solution for zeroed rows (other entries in vector are not used), these must be set before this call +- `b` - optional vector of the right-hand side, that will be adjusted by provided solution entries + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatZeroRowsIS()`, `MatZeroRows()`, `MatZeroRowsLocalIS()`, `MatZeroRowsStencil()`, `MatZeroEntries()`, `MatZeroRowsLocal()`, `MatSetOption()`, +`MatZeroRowsColumnsLocal()`, `MatZeroRowsColumnsLocalIS()`, `MatZeroRowsColumnsIS()`, `MatZeroRowsColumnsStencil()` + +# External Links +$(_doc_external("Mat/MatZeroRowsColumns")) +""" +function MatZeroRowsColumns(petsclib::PetscLibType, mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec) end + +@for_petsc function MatZeroRowsColumns(petsclib::$UnionPetscLib, mat::PetscMat, numRows::$PetscInt, rows::Vector{$PetscInt}, diag::$PetscScalar, x::PetscVec, b::PetscVec ) + + @chk ccall( + (:MatZeroRowsColumns, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscScalar, CVec, CVec), + mat, numRows, rows, diag, x, b, + ) + + + return nothing +end + +""" + MatZeroRowsColumnsIS(petsclib::PetscLibType,mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec) +Zeros all entries (except possibly the main diagonal) +of a set of rows and columns of a matrix. + +Collective + +Input Parameters: +- `mat` - the matrix +- `is` - the rows to zero +- `diag` - value put in all diagonals of eliminated rows (0.0 will even eliminate diagonal entry) +- `x` - optional vector of solutions for zeroed rows (other entries in vector are not used) +- `b` - optional vector of right-hand side, that will be adjusted by provided solution + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatZeroRowsIS()`, `MatZeroRowsColumns()`, `MatZeroRowsLocalIS()`, `MatZeroRowsStencil()`, `MatZeroEntries()`, `MatZeroRowsLocal()`, `MatSetOption()`, +`MatZeroRowsColumnsLocal()`, `MatZeroRowsColumnsLocalIS()`, `MatZeroRows()`, `MatZeroRowsColumnsStencil()` + +# External Links +$(_doc_external("Mat/MatZeroRowsColumnsIS")) +""" +function MatZeroRowsColumnsIS(petsclib::PetscLibType, mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec) end + +@for_petsc function MatZeroRowsColumnsIS(petsclib::$UnionPetscLib, mat::PetscMat, is::IS, diag::$PetscScalar, x::PetscVec, b::PetscVec ) + + @chk ccall( + (:MatZeroRowsColumnsIS, $petsc_library), + PetscErrorCode, + (CMat, CIS, $PetscScalar, CVec, CVec), + mat, is, diag, x, b, + ) + + + return nothing +end + +""" + MatZeroRows(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec) +Zeros all entries (except possibly the main diagonal) +of a set of rows of a matrix. + +Collective + +Input Parameters: +- `mat` - the matrix +- `numRows` - the number of rows to zero +- `rows` - the global row indices +- `diag` - value put in the diagonal of the zeroed rows +- `x` - optional vector of solutions for zeroed rows (other entries in vector are not used), these must be set before this call +- `b` - optional vector of right-hand side, that will be adjusted by provided solution entries + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatZeroRowsIS()`, `MatZeroRowsColumns()`, `MatZeroRowsLocalIS()`, `MatZeroRowsStencil()`, `MatZeroEntries()`, `MatZeroRowsLocal()`, `MatSetOption()`, +`MatZeroRowsColumnsLocal()`, `MatZeroRowsColumnsLocalIS()`, `MatZeroRowsColumnsIS()`, `MatZeroRowsColumnsStencil()`, `PCREDISTRIBUTE`, `MAT_KEEP_NONZERO_PATTERN` + +# External Links +$(_doc_external("Mat/MatZeroRows")) +""" +function MatZeroRows(petsclib::PetscLibType, mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec) end + +@for_petsc function MatZeroRows(petsclib::$UnionPetscLib, mat::PetscMat, numRows::$PetscInt, rows::Vector{$PetscInt}, diag::$PetscScalar, x::PetscVec, b::PetscVec ) + + @chk ccall( + (:MatZeroRows, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscScalar, CVec, CVec), + mat, numRows, rows, diag, x, b, + ) + + + return nothing +end + +""" + MatZeroRowsIS(petsclib::PetscLibType,mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec) +Zeros all entries (except possibly the main diagonal) +of a set of rows of a matrix indicated by an `IS` + +Collective + +Input Parameters: +- `mat` - the matrix +- `is` - index set, `IS`, of rows to remove (if `NULL` then no row is removed) +- `diag` - value put in all diagonals of eliminated rows +- `x` - optional vector of solutions for zeroed rows (other entries in vector are not used) +- `b` - optional vector of right-hand side, that will be adjusted by provided solution + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatZeroRows()`, `MatZeroRowsColumns()`, `MatZeroRowsLocalIS()`, `MatZeroRowsStencil()`, `MatZeroEntries()`, `MatZeroRowsLocal()`, `MatSetOption()`, +`MatZeroRowsColumnsLocal()`, `MatZeroRowsColumnsLocalIS()`, `MatZeroRowsColumnsIS()`, `MatZeroRowsColumnsStencil()`, `IS` + +# External Links +$(_doc_external("Mat/MatZeroRowsIS")) +""" +function MatZeroRowsIS(petsclib::PetscLibType, mat::PetscMat, is::Union{Ptr,IS}, diag::PetscScalar, x::PetscVec, b::PetscVec) end + +@for_petsc function MatZeroRowsIS(petsclib::$UnionPetscLib, mat::PetscMat, is::Union{Ptr,IS}, diag::$PetscScalar, x::PetscVec, b::PetscVec ) + + @chk ccall( + (:MatZeroRowsIS, $petsc_library), + PetscErrorCode, + (CMat, CIS, $PetscScalar, CVec, CVec), + mat, is, diag, x, b, + ) + + + return nothing +end + +""" + MatZeroRowsStencil(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{MatStencil}, diag::PetscScalar, x::PetscVec, b::PetscVec) +Zeros all entries (except possibly the main diagonal) +of a set of rows of a matrix indicated by a `MatStencil`. These rows must be local to the process. + +Collective + +Input Parameters: +- `mat` - the matrix +- `numRows` - the number of rows to remove +- `rows` - the grid coordinates (and component number when dof > 1) for matrix rows indicated by an array of `MatStencil` +- `diag` - value put in all diagonals of eliminated rows (0.0 will even eliminate diagonal entry) +- `x` - optional vector of solutions for zeroed rows (other entries in vector are not used) +- `b` - optional vector of right-hand side, that will be adjusted by provided solution + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatStencil`, `MatZeroRowsIS()`, `MatZeroRowsColumns()`, `MatZeroRowsLocalIS()`, `MatZeroRows()`, `MatZeroEntries()`, `MatZeroRowsLocal()`, `MatSetOption()`, +`MatZeroRowsColumnsLocal()`, `MatZeroRowsColumnsLocalIS()`, `MatZeroRowsColumnsIS()`, `MatZeroRowsColumnsStencil()` + +# External Links +$(_doc_external("Mat/MatZeroRowsStencil")) +""" +function MatZeroRowsStencil(petsclib::PetscLibType, mat::PetscMat, numRows::PetscInt, rows::Vector{MatStencil}, diag::PetscScalar, x::PetscVec, b::PetscVec) end + +@for_petsc function MatZeroRowsStencil(petsclib::$UnionPetscLib, mat::PetscMat, numRows::$PetscInt, rows::Vector{MatStencil}, diag::$PetscScalar, x::PetscVec, b::PetscVec ) + + @chk ccall( + (:MatZeroRowsStencil, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{MatStencil}, $PetscScalar, CVec, CVec), + mat, numRows, rows, diag, x, b, + ) + + + return nothing +end + +""" + MatZeroRowsColumnsStencil(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{MatStencil}, diag::PetscScalar, x::PetscVec, b::PetscVec) +Zeros all row and column entries (except possibly the main diagonal) +of a set of rows and columns of a matrix. + +Collective + +Input Parameters: +- `mat` - the matrix +- `numRows` - the number of rows/columns to remove +- `rows` - the grid coordinates (and component number when dof > 1) for matrix rows +- `diag` - value put in all diagonals of eliminated rows (0.0 will even eliminate diagonal entry) +- `x` - optional vector of solutions for zeroed rows (other entries in vector are not used) +- `b` - optional vector of right-hand side, that will be adjusted by provided solution + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatZeroRowsIS()`, `MatZeroRowsColumns()`, `MatZeroRowsLocalIS()`, `MatZeroRowsStencil()`, `MatZeroEntries()`, `MatZeroRowsLocal()`, `MatSetOption()`, +`MatZeroRowsColumnsLocal()`, `MatZeroRowsColumnsLocalIS()`, `MatZeroRowsColumnsIS()`, `MatZeroRows()` + +# External Links +$(_doc_external("Mat/MatZeroRowsColumnsStencil")) +""" +function MatZeroRowsColumnsStencil(petsclib::PetscLibType, mat::PetscMat, numRows::PetscInt, rows::Vector{MatStencil}, diag::PetscScalar, x::PetscVec, b::PetscVec) end + +@for_petsc function MatZeroRowsColumnsStencil(petsclib::$UnionPetscLib, mat::PetscMat, numRows::$PetscInt, rows::Vector{MatStencil}, diag::$PetscScalar, x::PetscVec, b::PetscVec ) + + @chk ccall( + (:MatZeroRowsColumnsStencil, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{MatStencil}, $PetscScalar, CVec, CVec), + mat, numRows, rows, diag, x, b, + ) + + + return nothing +end + +""" + MatZeroRowsLocal(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec) +Zeros all entries (except possibly the main diagonal) +of a set of rows of a matrix; using local numbering of rows. + +Collective + +Input Parameters: +- `mat` - the matrix +- `numRows` - the number of rows to remove +- `rows` - the local row indices +- `diag` - value put in all diagonals of eliminated rows +- `x` - optional vector of solutions for zeroed rows (other entries in vector are not used) +- `b` - optional vector of right-hand side, that will be adjusted by provided solution + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatZeroRowsIS()`, `MatZeroRowsColumns()`, `MatZeroRowsLocalIS()`, `MatZeroRowsStencil()`, `MatZeroEntries()`, `MatZeroRows()`, `MatSetOption()`, +`MatZeroRowsColumnsLocal()`, `MatZeroRowsColumnsLocalIS()`, `MatZeroRowsColumnsIS()`, `MatZeroRowsColumnsStencil()` + +# External Links +$(_doc_external("Mat/MatZeroRowsLocal")) +""" +function MatZeroRowsLocal(petsclib::PetscLibType, mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec) end + +@for_petsc function MatZeroRowsLocal(petsclib::$UnionPetscLib, mat::PetscMat, numRows::$PetscInt, rows::Vector{$PetscInt}, diag::$PetscScalar, x::PetscVec, b::PetscVec ) + + @chk ccall( + (:MatZeroRowsLocal, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscScalar, CVec, CVec), + mat, numRows, rows, diag, x, b, + ) + + + return nothing +end + +""" + MatZeroRowsLocalIS(petsclib::PetscLibType,mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec) +Zeros all entries (except possibly the main diagonal) +of a set of rows of a matrix; using local numbering of rows. + +Collective + +Input Parameters: +- `mat` - the matrix +- `is` - index set of rows to remove +- `diag` - value put in all diagonals of eliminated rows +- `x` - optional vector of solutions for zeroed rows (other entries in vector are not used) +- `b` - optional vector of right-hand side, that will be adjusted by provided solution + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatZeroRowsIS()`, `MatZeroRowsColumns()`, `MatZeroRows()`, `MatZeroRowsStencil()`, `MatZeroEntries()`, `MatZeroRowsLocal()`, `MatSetOption()`, +`MatZeroRowsColumnsLocal()`, `MatZeroRowsColumnsLocalIS()`, `MatZeroRowsColumnsIS()`, `MatZeroRowsColumnsStencil()` + +# External Links +$(_doc_external("Mat/MatZeroRowsLocalIS")) +""" +function MatZeroRowsLocalIS(petsclib::PetscLibType, mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec) end + +@for_petsc function MatZeroRowsLocalIS(petsclib::$UnionPetscLib, mat::PetscMat, is::IS, diag::$PetscScalar, x::PetscVec, b::PetscVec ) + + @chk ccall( + (:MatZeroRowsLocalIS, $petsc_library), + PetscErrorCode, + (CMat, CIS, $PetscScalar, CVec, CVec), + mat, is, diag, x, b, + ) + + + return nothing +end + +""" + MatZeroRowsColumnsLocal(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec) +Zeros all entries (except possibly the main diagonal) +of a set of rows and columns of a matrix; using local numbering of rows. + +Collective + +Input Parameters: +- `mat` - the matrix +- `numRows` - the number of rows to remove +- `rows` - the global row indices +- `diag` - value put in all diagonals of eliminated rows +- `x` - optional vector of solutions for zeroed rows (other entries in vector are not used) +- `b` - optional vector of right-hand side, that will be adjusted by provided solution + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatZeroRowsIS()`, `MatZeroRowsColumns()`, `MatZeroRowsLocalIS()`, `MatZeroRowsStencil()`, `MatZeroEntries()`, `MatZeroRowsLocal()`, `MatSetOption()`, +`MatZeroRows()`, `MatZeroRowsColumnsLocalIS()`, `MatZeroRowsColumnsIS()`, `MatZeroRowsColumnsStencil()` + +# External Links +$(_doc_external("Mat/MatZeroRowsColumnsLocal")) +""" +function MatZeroRowsColumnsLocal(petsclib::PetscLibType, mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec) end + +@for_petsc function MatZeroRowsColumnsLocal(petsclib::$UnionPetscLib, mat::PetscMat, numRows::$PetscInt, rows::Vector{$PetscInt}, diag::$PetscScalar, x::PetscVec, b::PetscVec ) + + @chk ccall( + (:MatZeroRowsColumnsLocal, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscScalar, CVec, CVec), + mat, numRows, rows, diag, x, b, + ) + + + return nothing +end + +""" + MatZeroRowsColumnsLocalIS(petsclib::PetscLibType,mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec) +Zeros all entries (except possibly the main diagonal) +of a set of rows and columns of a matrix; using local numbering of rows. + +Collective + +Input Parameters: +- `mat` - the matrix +- `is` - index set of rows to remove +- `diag` - value put in all diagonals of eliminated rows +- `x` - optional vector of solutions for zeroed rows (other entries in vector are not used) +- `b` - optional vector of right-hand side, that will be adjusted by provided solution + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatZeroRowsIS()`, `MatZeroRowsColumns()`, `MatZeroRowsLocalIS()`, `MatZeroRowsStencil()`, `MatZeroEntries()`, `MatZeroRowsLocal()`, `MatSetOption()`, +`MatZeroRowsColumnsLocal()`, `MatZeroRows()`, `MatZeroRowsColumnsIS()`, `MatZeroRowsColumnsStencil()` + +# External Links +$(_doc_external("Mat/MatZeroRowsColumnsLocalIS")) +""" +function MatZeroRowsColumnsLocalIS(petsclib::PetscLibType, mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec) end + +@for_petsc function MatZeroRowsColumnsLocalIS(petsclib::$UnionPetscLib, mat::PetscMat, is::IS, diag::$PetscScalar, x::PetscVec, b::PetscVec ) + + @chk ccall( + (:MatZeroRowsColumnsLocalIS, $petsc_library), + PetscErrorCode, + (CMat, CIS, $PetscScalar, CVec, CVec), + mat, is, diag, x, b, + ) + + + return nothing +end + +""" + m::PetscInt,n::PetscInt = MatGetSize(petsclib::PetscLibType,mat::PetscMat) +Returns the numbers of rows and columns in a matrix. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `m` - the number of global rows +- `n` - the number of global columns + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatSetSizes()`, `MatGetLocalSize()` + +# External Links +$(_doc_external("Mat/MatGetSize")) +""" +function MatGetSize(petsclib::PetscLibType, mat::AbstractPetscMat) end + +@for_petsc function MatGetSize(petsclib::$UnionPetscLib, mat::AbstractPetscMat ) + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + + @chk ccall( + (:MatGetSize, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}), + mat, m_, n_, + ) + + m = m_[] + n = n_[] + + return m,n +end + +""" + m::PetscInt,n::PetscInt = MatGetLocalSize(petsclib::PetscLibType,mat::PetscMat) +For most matrix formats, excluding `MATELEMENTAL` and `MATSCALAPACK`, Returns the number of local rows and local columns +of a matrix. For all matrices this is the local size of the left and right vectors as returned by `MatCreateVecs()`. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `m` - the number of local rows, use `NULL` to not obtain this value +- `n` - the number of local columns, use `NULL` to not obtain this value + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatSetSizes()`, `MatGetSize()` + +# External Links +$(_doc_external("Mat/MatGetLocalSize")) +""" +function MatGetLocalSize(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetLocalSize(petsclib::$UnionPetscLib, mat::PetscMat ) + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + + @chk ccall( + (:MatGetLocalSize, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}), + mat, m_, n_, + ) + + m = m_[] + n = n_[] + + return m,n +end + +""" + m::PetscInt,n::PetscInt = MatGetOwnershipRangeColumn(petsclib::PetscLibType,mat::PetscMat) +Returns the range of matrix columns associated with rows of a +vector one multiplies this matrix by that are owned by this processor. + +Not Collective, unless matrix has not been allocated, then collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `m` - the global index of the first local column, use `NULL` to not obtain this value +- `n` - one more than the global index of the last local column, use `NULL` to not obtain this value + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatGetOwnershipRange()`, `MatGetOwnershipRanges()`, `MatGetOwnershipRangesColumn()`, `PetscLayout`, +`MatSetSizes()`, `MatCreateAIJ()`, `DMDAGetGhostCorners()`, `DM` + +# External Links +$(_doc_external("Mat/MatGetOwnershipRangeColumn")) +""" +function MatGetOwnershipRangeColumn(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetOwnershipRangeColumn(petsclib::$UnionPetscLib, mat::PetscMat ) + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + + @chk ccall( + (:MatGetOwnershipRangeColumn, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}), + mat, m_, n_, + ) + + m = m_[] + n = n_[] + + return m,n +end + +""" + m::PetscInt,n::PetscInt = MatGetOwnershipRange(petsclib::PetscLibType,mat::PetscMat) +For matrices that own values by row, excludes `MATELEMENTAL` and `MATSCALAPACK`, returns the range of matrix rows owned by +this MPI process. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `m` - the global index of the first local row, use `NULL` to not obtain this value +- `n` - one more than the global index of the last local row, use `NULL` to not obtain this value + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatGetOwnershipRanges()`, `MatGetOwnershipRangeColumn()`, `MatGetOwnershipRangesColumn()`, `PetscSplitOwnership()`, +`PetscSplitOwnershipBlock()`, `PetscLayout`, `MatSetSizes()`, `MatCreateAIJ()`, `DMDAGetGhostCorners()`, `DM` + +# External Links +$(_doc_external("Mat/MatGetOwnershipRange")) +""" +function MatGetOwnershipRange(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetOwnershipRange(petsclib::$UnionPetscLib, mat::PetscMat ) + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + + @chk ccall( + (:MatGetOwnershipRange, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}), + mat, m_, n_, + ) + + m = m_[] + n = n_[] + + return m,n +end + +""" + ranges::Vector{PetscInt} = MatGetOwnershipRanges(petsclib::PetscLibType,mat::PetscMat) +For matrices that own values by row, excludes `MATELEMENTAL` and +`MATSCALAPACK`, returns the range of matrix rows owned by each process. + +Not Collective, unless matrix has not been allocated + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `ranges` - start of each processors portion plus one more than the total length at the end, of length `size` + 1 +where `size` is the number of MPI processes used by `mat` + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatGetOwnershipRange()`, `MatGetOwnershipRangeColumn()`, `MatGetOwnershipRangesColumn()`, `PetscLayout`, +`PetscSplitOwnership()`, `PetscSplitOwnershipBlock()`, `MatSetSizes()`, `MatCreateAIJ()`, +`DMDAGetGhostCorners()`, `DM` + +# External Links +$(_doc_external("Mat/MatGetOwnershipRanges")) +""" +function MatGetOwnershipRanges(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetOwnershipRanges(petsclib::$UnionPetscLib, mat::PetscMat ) + ranges_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:MatGetOwnershipRanges, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscInt}}), + mat, ranges_, + ) + + ranges = unsafe_wrap(Array, ranges_[], VecGetLocalSize(petsclib, x); own = false) + + return ranges +end + +""" + ranges::Vector{PetscInt} = MatGetOwnershipRangesColumn(petsclib::PetscLibType,mat::PetscMat) +Returns the ranges of matrix columns associated with rows of a +vector one multiplies this vector by that are owned by each processor. + +Not Collective, unless matrix has not been allocated + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `ranges` - start of each processors portion plus one more than the total length at the end + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatGetOwnershipRange()`, `MatGetOwnershipRangeColumn()`, `MatGetOwnershipRanges()`, +`PetscSplitOwnership()`, `PetscSplitOwnershipBlock()`, `PetscLayout`, `MatSetSizes()`, `MatCreateAIJ()`, +`DMDAGetGhostCorners()`, `DM` + +# External Links +$(_doc_external("Mat/MatGetOwnershipRangesColumn")) +""" +function MatGetOwnershipRangesColumn(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetOwnershipRangesColumn(petsclib::$UnionPetscLib, mat::PetscMat ) + ranges_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:MatGetOwnershipRangesColumn, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscInt}}), + mat, ranges_, + ) + + ranges = unsafe_wrap(Array, ranges_[], VecGetLocalSize(petsclib, x); own = false) + + return ranges +end + +""" + MatGetOwnershipIS(petsclib::PetscLibType,A::PetscMat, rows::IS, cols::IS) +Get row and column ownership of a matrices' values as index sets. + +Not Collective + +Input Parameter: +- `A` - matrix + +Output Parameters: +- `rows` - rows in which this process owns elements, , use `NULL` to not obtain this value +- `cols` - columns in which this process owns elements, use `NULL` to not obtain this value + +Level: intermediate + +-seealso: [](ch_matrices), `IS`, `Mat`, `MatGetOwnershipRanges()`, `MatSetValues()`, `MATELEMENTAL`, `MATSCALAPACK` + +# External Links +$(_doc_external("Mat/MatGetOwnershipIS")) +""" +function MatGetOwnershipIS(petsclib::PetscLibType, A::PetscMat, rows::IS, cols::IS) end + +@for_petsc function MatGetOwnershipIS(petsclib::$UnionPetscLib, A::PetscMat, rows::IS, cols::IS ) + + @chk ccall( + (:MatGetOwnershipIS, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CIS}, Ptr{CIS}), + A, rows, cols, + ) + + + return nothing +end + +""" + MatILUFactorSymbolic(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, row::IS, col::IS, info::MatFactorInfo) +Performs symbolic ILU factorization of a matrix obtained with `MatGetFactor()` +Uses levels of fill only, not drop tolerance. Use `MatLUFactorNumeric()` +to complete the factorization. + +Collective + +Input Parameters: +- `fact` - the factorized matrix obtained with `MatGetFactor()` +- `mat` - the matrix +- `row` - row permutation +- `col` - column permutation +- `info` - structure containing +-seealso: [](ch_matrices), `Mat`, [Matrix Factorization](sec_matfactor), `MatGetFactor()`, `MatLUFactorSymbolic()`, `MatLUFactorNumeric()`, `MatCholeskyFactor()` +`MatGetOrdering()`, `MatFactorInfo` + +# External Links +$(_doc_external("Mat/MatILUFactorSymbolic")) +""" +function MatILUFactorSymbolic(petsclib::PetscLibType, fact::PetscMat, mat::PetscMat, row::IS, col::IS, info::MatFactorInfo) end + +@for_petsc function MatILUFactorSymbolic(petsclib::$UnionPetscLib, fact::PetscMat, mat::PetscMat, row::IS, col::IS, info::MatFactorInfo ) + + @chk ccall( + (:MatILUFactorSymbolic, $petsc_library), + PetscErrorCode, + (CMat, CMat, CIS, CIS, Ptr{MatFactorInfo}), + fact, mat, row, col, info, + ) + + + return nothing +end + +""" + MatICCFactorSymbolic(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, perm::IS, info::MatFactorInfo) +Performs symbolic incomplete +Cholesky factorization for a symmetric matrix. Use +`MatCholeskyFactorNumeric()` to complete the factorization. + +Collective + +Input Parameters: +- `fact` - the factorized matrix obtained with `MatGetFactor()` +- `mat` - the matrix to be factored +- `perm` - row and column permutation +- `info` - structure containing +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatCholeskyFactorNumeric()`, `MatCholeskyFactor()`, `MatFactorInfo` + +# External Links +$(_doc_external("Mat/MatICCFactorSymbolic")) +""" +function MatICCFactorSymbolic(petsclib::PetscLibType, fact::PetscMat, mat::PetscMat, perm::IS, info::MatFactorInfo) end + +@for_petsc function MatICCFactorSymbolic(petsclib::$UnionPetscLib, fact::PetscMat, mat::PetscMat, perm::IS, info::MatFactorInfo ) + + @chk ccall( + (:MatICCFactorSymbolic, $petsc_library), + PetscErrorCode, + (CMat, CMat, CIS, Ptr{MatFactorInfo}), + fact, mat, perm, info, + ) + + + return nothing +end + +""" + submat::Vector{PetscMat} = MatCreateSubMatrices(petsclib::PetscLibType,mat::PetscMat, n::PetscInt, irow::Vector{IS}, icol::Vector{IS}, scall::MatReuse) +Extracts several submatrices from a matrix. If submat +points to an array of valid matrices, they may be reused to store the new +submatrices. + +Collective + +Input Parameters: +- `mat` - the matrix +- `n` - the number of submatrixes to be extracted (on this processor, may be zero) +- `irow` - index set of rows to extract +- `icol` - index set of columns to extract +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameter: +- `submat` - the array of submatrices + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatDestroySubMatrices()`, `MatCreateSubMatrix()`, `MatGetRow()`, `MatGetDiagonal()`, `MatReuse` + +# External Links +$(_doc_external("Mat/MatCreateSubMatrices")) +""" +function MatCreateSubMatrices(petsclib::PetscLibType, mat::PetscMat, n::PetscInt, irow::Vector{IS}, icol::Vector{IS}, scall::MatReuse) end + +@for_petsc function MatCreateSubMatrices(petsclib::$UnionPetscLib, mat::PetscMat, n::$PetscInt, irow::Vector{IS}, icol::Vector{IS}, scall::MatReuse ) + submat_ = Ref{Ptr{PetscMat}}() + + @chk ccall( + (:MatCreateSubMatrices, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CIS}, Ptr{CIS}, MatReuse, Ptr{Ptr{CMat}}), + mat, n, irow, icol, scall, submat_, + ) + + submat = unsafe_wrap(Array, submat_[], VecGetLocalSize(petsclib, x); own = false) + + return submat +end + +""" + submat::Vector{PetscMat} = MatCreateSubMatricesMPI(petsclib::PetscLibType,mat::PetscMat, n::PetscInt, irow::Vector{IS}, icol::Vector{IS}, scall::MatReuse) +Extracts MPI submatrices across a sub communicator of `mat` (by pairs of `IS` that may live on subcomms). + +Collective + +Input Parameters: +- `mat` - the matrix +- `n` - the number of submatrixes to be extracted +- `irow` - index set of rows to extract +- `icol` - index set of columns to extract +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameter: +- `submat` - the array of submatrices + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `PCGASM`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRow()`, `MatGetDiagonal()`, `MatReuse` + +# External Links +$(_doc_external("Mat/MatCreateSubMatricesMPI")) +""" +function MatCreateSubMatricesMPI(petsclib::PetscLibType, mat::PetscMat, n::PetscInt, irow::Vector{IS}, icol::Vector{IS}, scall::MatReuse) end + +@for_petsc function MatCreateSubMatricesMPI(petsclib::$UnionPetscLib, mat::PetscMat, n::$PetscInt, irow::Vector{IS}, icol::Vector{IS}, scall::MatReuse ) + submat_ = Ref{Ptr{PetscMat}}() + + @chk ccall( + (:MatCreateSubMatricesMPI, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CIS}, Ptr{CIS}, MatReuse, Ptr{Ptr{CMat}}), + mat, n, irow, icol, scall, submat_, + ) + + submat = unsafe_wrap(Array, submat_[], VecGetLocalSize(petsclib, x); own = false) + + return submat +end + +""" + MatDestroyMatrices(petsclib::PetscLibType,n::PetscInt, mat::Vector{PetscMat}) +Destroys an array of matrices + +Collective + +Input Parameters: +- `n` - the number of local matrices +- `mat` - the matrices (this is a pointer to the array of matrices) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateSubMatrices()`, `MatDestroySubMatrices()` + +# External Links +$(_doc_external("Mat/MatDestroyMatrices")) +""" +function MatDestroyMatrices(petsclib::PetscLibType, n::PetscInt, mat::Vector{PetscMat}) end + +@for_petsc function MatDestroyMatrices(petsclib::$UnionPetscLib, n::$PetscInt, mat::Vector{PetscMat} ) + mat_ = Ref(pointer(mat)) + + @chk ccall( + (:MatDestroyMatrices, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Ptr{CMat}}), + n, mat_, + ) + + + return nothing +end + +""" + MatDestroySubMatrices(petsclib::PetscLibType,n::PetscInt, mat::Vector{PetscMat}) +Destroys a set of matrices obtained with `MatCreateSubMatrices()`. + +Collective + +Input Parameters: +- `n` - the number of local matrices +- `mat` - the matrices (this is a pointer to the array of matrices, to match the calling sequence of `MatCreateSubMatrices()`) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateSubMatrices()`, `MatDestroyMatrices()` + +# External Links +$(_doc_external("Mat/MatDestroySubMatrices")) +""" +function MatDestroySubMatrices(petsclib::PetscLibType, n::PetscInt, mat::Vector{PetscMat}) end + +@for_petsc function MatDestroySubMatrices(petsclib::$UnionPetscLib, n::$PetscInt, mat::Vector{PetscMat} ) + mat_ = Ref(pointer(mat)) + + @chk ccall( + (:MatDestroySubMatrices, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Ptr{CMat}}), + n, mat_, + ) + + + return nothing +end + +""" + MatGetSeqNonzeroStructure(petsclib::PetscLibType,mat::PetscMat, matstruct::PetscMat) +Extracts the nonzero structure from a matrix and stores it, in its entirety, on each process + +Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `matstruct` - the sequential matrix with the nonzero structure of `mat` + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatDestroySeqNonzeroStructure()`, `MatCreateSubMatrices()`, `MatDestroyMatrices()` + +# External Links +$(_doc_external("Mat/MatGetSeqNonzeroStructure")) +""" +function MatGetSeqNonzeroStructure(petsclib::PetscLibType, mat::PetscMat, matstruct::PetscMat) end + +@for_petsc function MatGetSeqNonzeroStructure(petsclib::$UnionPetscLib, mat::PetscMat, matstruct::PetscMat ) + matstruct_ = Ref(matstruct.ptr) + + @chk ccall( + (:MatGetSeqNonzeroStructure, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + mat, matstruct_, + ) + + matstruct.ptr = C_NULL + + return nothing +end + +""" + MatDestroySeqNonzeroStructure(petsclib::PetscLibType,mat::PetscMat) +Destroys matrix obtained with `MatGetSeqNonzeroStructure()`. + +Collective + +Input Parameter: +- `mat` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetSeqNonzeroStructure()` + +# External Links +$(_doc_external("Mat/MatDestroySeqNonzeroStructure")) +""" +function MatDestroySeqNonzeroStructure(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatDestroySeqNonzeroStructure(petsclib::$UnionPetscLib, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:MatDestroySeqNonzeroStructure, $petsc_library), + PetscErrorCode, + (Ptr{CMat},), + mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + MatIncreaseOverlap(petsclib::PetscLibType,mat::PetscMat, n::PetscInt, is::Vector{IS}, ov::PetscInt) +Given a set of submatrices indicated by index sets, +replaces the index sets by larger ones that represent submatrices with +additional overlap. + +Collective + +Input Parameters: +- `mat` - the matrix +- `n` - the number of index sets +- `is` - the array of index sets (these index sets will changed during the call) +- `ov` - the additional overlap requested + +Options Database Key: +- `-mat_increase_overlap_scalable` - use a scalable algorithm to compute the overlap (supported by MPIAIJ matrix) + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `PCASM`, `MatSetBlockSize()`, `MatIncreaseOverlapSplit()`, `MatCreateSubMatrices()` + +# External Links +$(_doc_external("Mat/MatIncreaseOverlap")) +""" +function MatIncreaseOverlap(petsclib::PetscLibType, mat::PetscMat, n::PetscInt, is::Vector{IS}, ov::PetscInt) end + +@for_petsc function MatIncreaseOverlap(petsclib::$UnionPetscLib, mat::PetscMat, n::$PetscInt, is::Vector{IS}, ov::$PetscInt ) + + @chk ccall( + (:MatIncreaseOverlap, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CIS}, $PetscInt), + mat, n, is, ov, + ) + + + return nothing +end + +""" + MatIncreaseOverlapSplit(petsclib::PetscLibType,mat::PetscMat, n::PetscInt, is::Vector{IS}, ov::PetscInt) +Given a set of submatrices indicated by index sets across +a sub communicator, replaces the index sets by larger ones that represent submatrices with +additional overlap. + +Collective + +Input Parameters: +- `mat` - the matrix +- `n` - the number of index sets +- `is` - the array of index sets (these index sets will changed during the call) +- `ov` - the additional overlap requested + +` Options Database Key: +- `-mat_increase_overlap_scalable` - use a scalable algorithm to compute the overlap (supported by MPIAIJ matrix) + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatCreateSubMatrices()`, `MatIncreaseOverlap()` + +# External Links +$(_doc_external("Mat/MatIncreaseOverlapSplit")) +""" +function MatIncreaseOverlapSplit(petsclib::PetscLibType, mat::PetscMat, n::PetscInt, is::Vector{IS}, ov::PetscInt) end + +@for_petsc function MatIncreaseOverlapSplit(petsclib::$UnionPetscLib, mat::PetscMat, n::$PetscInt, is::Vector{IS}, ov::$PetscInt ) + + @chk ccall( + (:MatIncreaseOverlapSplit, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CIS}, $PetscInt), + mat, n, is, ov, + ) + + + return nothing +end + +""" + bs::PetscInt = MatGetBlockSize(petsclib::PetscLibType,mat::PetscMat) +Returns the matrix block size. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `bs` - block size + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATBAIJ`, `MATSBAIJ`, `MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, `MatGetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatGetBlockSize")) +""" +function MatGetBlockSize(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetBlockSize(petsclib::$UnionPetscLib, mat::PetscMat ) + bs_ = Ref{$PetscInt}() + + @chk ccall( + (:MatGetBlockSize, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + mat, bs_, + ) + + bs = bs_[] + + return bs +end + +""" + rbs::PetscInt,cbs::PetscInt = MatGetBlockSizes(petsclib::PetscLibType,mat::PetscMat) +Returns the matrix block row and column sizes. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `rbs` - row block size +- `cbs` - column block size + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATBAIJ`, `MATSBAIJ`, `MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, `MatGetBlockSize()`, `MatSetBlockSize()`, `MatSetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatGetBlockSizes")) +""" +function MatGetBlockSizes(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetBlockSizes(petsclib::$UnionPetscLib, mat::PetscMat ) + rbs_ = Ref{$PetscInt}() + cbs_ = Ref{$PetscInt}() + + @chk ccall( + (:MatGetBlockSizes, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}), + mat, rbs_, cbs_, + ) + + rbs = rbs_[] + cbs = cbs_[] + + return rbs,cbs +end + +""" + MatSetBlockSize(petsclib::PetscLibType,mat::PetscMat, bs::PetscInt) +Sets the matrix block size. + +Logically Collective + +Input Parameters: +- `mat` - the matrix +- `bs` - block size + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATBAIJ`, `MATSBAIJ`, `MATAIJ`, `MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, `MatGetBlockSize()`, `MatSetBlockSizes()`, `MatGetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatSetBlockSize")) +""" +function MatSetBlockSize(petsclib::PetscLibType, mat::PetscMat, bs::PetscInt) end + +@for_petsc function MatSetBlockSize(petsclib::$UnionPetscLib, mat::PetscMat, bs::$PetscInt ) + + @chk ccall( + (:MatSetBlockSize, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + mat, bs, + ) + + + return nothing +end + +""" + MatComputeVariableBlockEnvelope(petsclib::PetscLibType,mat::PetscMat) +Given a matrix whose nonzeros are in blocks along the diagonal this computes and stores +the sizes of these blocks in the matrix. An individual block may lie over several processes. + +Collective + +Input Parameter: +- `mat` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatInvertVariableBlockEnvelope()`, `MatSetVariableBlockSizes()` + +# External Links +$(_doc_external("Mat/MatComputeVariableBlockEnvelope")) +""" +function MatComputeVariableBlockEnvelope(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatComputeVariableBlockEnvelope(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatComputeVariableBlockEnvelope, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + MatInvertVariableBlockEnvelope(petsclib::PetscLibType,A::PetscMat, reuse::MatReuse, C::PetscMat) +set matrix C to be the inverted block diagonal of matrix A + +Collective + +Input Parameters: +- `A` - the matrix +- `reuse` - indicates if the `C` matrix was obtained from a previous call to this routine + +Output Parameter: +- `C` - matrix with inverted block diagonal of `A` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatInvertBlockDiagonal()`, `MatComputeBlockDiagonal()` + +# External Links +$(_doc_external("Mat/MatInvertVariableBlockEnvelope")) +""" +function MatInvertVariableBlockEnvelope(petsclib::PetscLibType, A::PetscMat, reuse::MatReuse, C::PetscMat) end + +@for_petsc function MatInvertVariableBlockEnvelope(petsclib::$UnionPetscLib, A::PetscMat, reuse::MatReuse, C::PetscMat ) + C_ = Ref(C.ptr) + + @chk ccall( + (:MatInvertVariableBlockEnvelope, $petsc_library), + PetscErrorCode, + (CMat, MatReuse, Ptr{CMat}), + A, reuse, C_, + ) + + C.ptr = C_NULL + + return nothing +end + +""" + MatSetVariableBlockSizes(petsclib::PetscLibType,mat::PetscMat, nblocks::PetscInt, bsizes::Vector{PetscInt}) +Sets diagonal point + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `nblocks` - the number of blocks on this process, each block can only exist on a single process +- `bsizes` - the block sizes + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, `MatGetBlockSize()`, `MatSetBlockSizes()`, `MatGetBlockSizes()`, `MatGetVariableBlockSizes()`, +`MatComputeVariableBlockEnvelope()`, `PCVPBJACOBI` + +# External Links +$(_doc_external("Mat/MatSetVariableBlockSizes")) +""" +function MatSetVariableBlockSizes(petsclib::PetscLibType, mat::PetscMat, nblocks::PetscInt, bsizes::Vector{PetscInt}) end + +@for_petsc function MatSetVariableBlockSizes(petsclib::$UnionPetscLib, mat::PetscMat, nblocks::$PetscInt, bsizes::Vector{$PetscInt} ) + + @chk ccall( + (:MatSetVariableBlockSizes, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}), + mat, nblocks, bsizes, + ) + + + return nothing +end + +""" + nblocks::PetscInt,bsizes::Vector{PetscInt} = MatGetVariableBlockSizes(petsclib::PetscLibType,mat::PetscMat) +Gets a diagonal blocks of the matrix that need not be of the same size + +Not Collective; No Fortran Support + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `nblocks` - the number of blocks on this process +- `bsizes` - the block sizes + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, `MatGetBlockSize()`, `MatSetBlockSizes()`, `MatGetBlockSizes()`, `MatSetVariableBlockSizes()`, `MatComputeVariableBlockEnvelope()` + +# External Links +$(_doc_external("Mat/MatGetVariableBlockSizes")) +""" +function MatGetVariableBlockSizes(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetVariableBlockSizes(petsclib::$UnionPetscLib, mat::PetscMat ) + nblocks_ = Ref{$PetscInt}() + bsizes_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:MatGetVariableBlockSizes, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + mat, nblocks_, bsizes_, + ) + + nblocks = nblocks_[] + bsizes = unsafe_wrap(Array, bsizes_[], VecGetLocalSize(petsclib, x); own = false) + + return nblocks,bsizes +end + +""" + MatSelectVariableBlockSizes(petsclib::PetscLibType,subA::PetscMat, A::PetscMat, isrow::IS) +When creating a submatrix, pass on the variable block sizes + +Not Collective + +Input Parameter: +- `subA` - the submatrix +- `A` - the original matrix +- `isrow` - The `IS` of selected rows for the submatrix, must be sorted + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatSetVariableBlockSizes()`, `MatComputeVariableBlockEnvelope()` + +# External Links +$(_doc_external("Mat/MatSelectVariableBlockSizes")) +""" +function MatSelectVariableBlockSizes(petsclib::PetscLibType, subA::PetscMat, A::PetscMat, isrow::IS) end + +@for_petsc function MatSelectVariableBlockSizes(petsclib::$UnionPetscLib, subA::PetscMat, A::PetscMat, isrow::IS ) + + @chk ccall( + (:MatSelectVariableBlockSizes, $petsc_library), + PetscErrorCode, + (CMat, CMat, CIS), + subA, A, isrow, + ) + + + return nothing +end + +""" + MatSetBlockSizes(petsclib::PetscLibType,mat::PetscMat, rbs::PetscInt, cbs::PetscInt) +Sets the matrix block row and column sizes. + +Logically Collective + +Input Parameters: +- `mat` - the matrix +- `rbs` - row block size +- `cbs` - column block size + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, `MatGetBlockSize()`, `MatSetBlockSize()`, `MatGetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatSetBlockSizes")) +""" +function MatSetBlockSizes(petsclib::PetscLibType, mat::PetscMat, rbs::PetscInt, cbs::PetscInt) end + +@for_petsc function MatSetBlockSizes(petsclib::$UnionPetscLib, mat::PetscMat, rbs::$PetscInt, cbs::$PetscInt ) + + @chk ccall( + (:MatSetBlockSizes, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt), + mat, rbs, cbs, + ) + + + return nothing +end + +""" + MatSetBlockSizesFromMats(petsclib::PetscLibType,mat::PetscMat, fromRow::PetscMat, fromCol::PetscMat) +Sets the matrix block row and column sizes to match a pair of matrices + +Logically Collective + +Input Parameters: +- `mat` - the matrix +- `fromRow` - matrix from which to copy row block size +- `fromCol` - matrix from which to copy column block size (can be same as fromRow) + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, `MatGetBlockSize()`, `MatSetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatSetBlockSizesFromMats")) +""" +function MatSetBlockSizesFromMats(petsclib::PetscLibType, mat::PetscMat, fromRow::PetscMat, fromCol::PetscMat) end + +@for_petsc function MatSetBlockSizesFromMats(petsclib::$UnionPetscLib, mat::PetscMat, fromRow::PetscMat, fromCol::PetscMat ) + + @chk ccall( + (:MatSetBlockSizesFromMats, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat), + mat, fromRow, fromCol, + ) + + + return nothing +end + +""" + MatResidual(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec, r::PetscVec) +Default routine to calculate the residual r = b + +Collective + +Input Parameters: +- `mat` - the matrix +- `b` - the right-hand-side +- `x` - the approximate solution + +Output Parameter: +- `r` - location to store the residual + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatMult()`, `MatMultAdd()`, `PCMGSetResidual()` + +# External Links +$(_doc_external("Mat/MatResidual")) +""" +function MatResidual(petsclib::PetscLibType, mat::PetscMat, b::PetscVec, x::PetscVec, r::PetscVec) end + +@for_petsc function MatResidual(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscVec, x::PetscVec, r::PetscVec ) + + @chk ccall( + (:MatResidual, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec), + mat, b, x, r, + ) + + + return nothing +end + +""" + n::PetscInt,ia::Vector{PetscInt},ja::Vector{PetscInt},done::PetscBool = MatGetRowIJ(petsclib::PetscLibType,mat::PetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool) +Returns the compressed row storage i and j indices for the local rows of a sparse matrix + +Collective + +Input Parameters: +- `mat` - the matrix +- `shift` - 0 or 1 indicating we want the indices starting at 0 or 1 +- `symmetric` - `PETSC_TRUE` or `PETSC_FALSE` indicating the matrix data structure should be symmetrized +- `inodecompressed` - `PETSC_TRUE` or `PETSC_FALSE` indicating if the nonzero structure of the +inodes or the nonzero elements is wanted. For `MATBAIJ` matrices the compressed version is +always used. + +Output Parameters: +- `n` - number of local rows in the (possibly compressed) matrix, use `NULL` if not needed +- `ia` - the row pointers; that is ia[0] = 0, ia[row] = ia[row-1] + number of elements in that row of the matrix, use `NULL` if not needed +- `ja` - the column indices, use `NULL` if not needed +- `done` - indicates if the routine actually worked and returned appropriate ia[] and ja[] arrays; callers +are responsible for handling the case when done == `PETSC_FALSE` and ia and ja are not set + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATAIJ`, `MatGetColumnIJ()`, `MatRestoreRowIJ()`, `MatSeqAIJGetArray()` + +# External Links +$(_doc_external("Mat/MatGetRowIJ")) +""" +function MatGetRowIJ(petsclib::PetscLibType, mat::PetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool) end + +@for_petsc function MatGetRowIJ(petsclib::$UnionPetscLib, mat::PetscMat, shift::$PetscInt, symmetric::PetscBool, inodecompressed::PetscBool ) + n_ = Ref{$PetscInt}() + ia_ = Ref{Ptr{$PetscInt}}() + ja_ = Ref{Ptr{$PetscInt}}() + done_ = Ref{PetscBool}() + + @chk ccall( + (:MatGetRowIJ, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, PetscBool, PetscBool, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{PetscBool}), + mat, shift, symmetric, inodecompressed, n_, ia_, ja_, done_, + ) + + n = n_[] + ia = unsafe_wrap(Array, ia_[], VecGetLocalSize(petsclib, x); own = false) + ja = unsafe_wrap(Array, ja_[], VecGetLocalSize(petsclib, x); own = false) + done = done_[] + + return n,ia,ja,done +end + +""" + n::PetscInt,ia::Vector{PetscInt},ja::Vector{PetscInt},done::PetscBool = MatGetColumnIJ(petsclib::PetscLibType,mat::PetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool) +Returns the compressed column storage i and j indices for sequential matrices. + +Collective + +Input Parameters: +- `mat` - the matrix +- `shift` - 1 or zero indicating we want the indices starting at 0 or 1 +- `symmetric` - `PETSC_TRUE` or `PETSC_FALSE` indicating the matrix data structure should be +symmetrized +- `inodecompressed` - `PETSC_TRUE` or `PETSC_FALSE` indicating if the nonzero structure of the +inodes or the nonzero elements is wanted. For `MATBAIJ` matrices the compressed version is +always used. + +Output Parameters: +- `n` - number of columns in the (possibly compressed) matrix +- `ia` - the column pointers; that is ia[0] = 0, ia[col] = i[col-1] + number of elements in that col of the matrix +- `ja` - the row indices +- `done` - `PETSC_TRUE` or `PETSC_FALSE`, indicating whether the values have been returned + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatGetRowIJ()`, `MatRestoreColumnIJ()` + +# External Links +$(_doc_external("Mat/MatGetColumnIJ")) +""" +function MatGetColumnIJ(petsclib::PetscLibType, mat::PetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool) end + +@for_petsc function MatGetColumnIJ(petsclib::$UnionPetscLib, mat::PetscMat, shift::$PetscInt, symmetric::PetscBool, inodecompressed::PetscBool ) + n_ = Ref{$PetscInt}() + ia_ = Ref{Ptr{$PetscInt}}() + ja_ = Ref{Ptr{$PetscInt}}() + done_ = Ref{PetscBool}() + + @chk ccall( + (:MatGetColumnIJ, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, PetscBool, PetscBool, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{PetscBool}), + mat, shift, symmetric, inodecompressed, n_, ia_, ja_, done_, + ) + + n = n_[] + ia = unsafe_wrap(Array, ia_[], VecGetLocalSize(petsclib, x); own = false) + ja = unsafe_wrap(Array, ja_[], VecGetLocalSize(petsclib, x); own = false) + done = done_[] + + return n,ia,ja,done +end + +""" + n::PetscInt,ia::Vector{PetscInt},ja::Vector{PetscInt},done::PetscBool = MatRestoreRowIJ(petsclib::PetscLibType,mat::PetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool) +Call after you are completed with the ia,ja indices obtained with `MatGetRowIJ()`. + +Collective + +Input Parameters: +- `mat` - the matrix +- `shift` - 1 or zero indicating we want the indices starting at 0 or 1 +- `symmetric` - `PETSC_TRUE` or `PETSC_FALSE` indicating the matrix data structure should be symmetrized +- `inodecompressed` - `PETSC_TRUE` or `PETSC_FALSE` indicating if the nonzero structure of the +inodes or the nonzero elements is wanted. For `MATBAIJ` matrices the compressed version is +always used. +- `n` - size of (possibly compressed) matrix +- `ia` - the row pointers +- `ja` - the column indices + +Output Parameter: +- `done` - `PETSC_TRUE` or `PETSC_FALSE` indicated that the values have been returned + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatGetRowIJ()`, `MatRestoreColumnIJ()` + +# External Links +$(_doc_external("Mat/MatRestoreRowIJ")) +""" +function MatRestoreRowIJ(petsclib::PetscLibType, mat::PetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool) end + +@for_petsc function MatRestoreRowIJ(petsclib::$UnionPetscLib, mat::PetscMat, shift::$PetscInt, symmetric::PetscBool, inodecompressed::PetscBool ) + n_ = Ref{$PetscInt}() + ia_ = Ref{Ptr{$PetscInt}}() + ja_ = Ref{Ptr{$PetscInt}}() + done_ = Ref{PetscBool}() + + @chk ccall( + (:MatRestoreRowIJ, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, PetscBool, PetscBool, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{PetscBool}), + mat, shift, symmetric, inodecompressed, n_, ia_, ja_, done_, + ) + + n = n_[] + ia = unsafe_wrap(Array, ia_[], VecGetLocalSize(petsclib, x); own = false) + ja = unsafe_wrap(Array, ja_[], VecGetLocalSize(petsclib, x); own = false) + done = done_[] + + return n,ia,ja,done +end + +""" + n::PetscInt,ia::Vector{PetscInt},ja::Vector{PetscInt},done::PetscBool = MatRestoreColumnIJ(petsclib::PetscLibType,mat::PetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool) +Call after you are completed with the ia,ja indices obtained with `MatGetColumnIJ()`. + +Collective + +Input Parameters: +- `mat` - the matrix +- `shift` - 1 or zero indicating we want the indices starting at 0 or 1 +- `symmetric` - `PETSC_TRUE` or `PETSC_FALSE` indicating the matrix data structure should be symmetrized +- `inodecompressed` - `PETSC_TRUE` or `PETSC_FALSE` indicating if the nonzero structure of the +inodes or the nonzero elements is wanted. For `MATBAIJ` matrices the compressed version is +always used. + +Output Parameters: +- `n` - size of (possibly compressed) matrix +- `ia` - the column pointers +- `ja` - the row indices +- `done` - `PETSC_TRUE` or `PETSC_FALSE` indicated that the values have been returned + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatGetColumnIJ()`, `MatRestoreRowIJ()` + +# External Links +$(_doc_external("Mat/MatRestoreColumnIJ")) +""" +function MatRestoreColumnIJ(petsclib::PetscLibType, mat::PetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool) end + +@for_petsc function MatRestoreColumnIJ(petsclib::$UnionPetscLib, mat::PetscMat, shift::$PetscInt, symmetric::PetscBool, inodecompressed::PetscBool ) + n_ = Ref{$PetscInt}() + ia_ = Ref{Ptr{$PetscInt}}() + ja_ = Ref{Ptr{$PetscInt}}() + done_ = Ref{PetscBool}() + + @chk ccall( + (:MatRestoreColumnIJ, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, PetscBool, PetscBool, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{PetscBool}), + mat, shift, symmetric, inodecompressed, n_, ia_, ja_, done_, + ) + + n = n_[] + ia = unsafe_wrap(Array, ia_[], VecGetLocalSize(petsclib, x); own = false) + ja = unsafe_wrap(Array, ja_[], VecGetLocalSize(petsclib, x); own = false) + done = done_[] + + return n,ia,ja,done +end + +""" + MatSetUnfactored(petsclib::PetscLibType,mat::PetscMat) +Resets a factored matrix to be treated as unfactored. + +Logically Collective + +Input Parameter: +- `mat` - the factored matrix to be reset + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `PCFactorSetUseInPlace()`, `PCFactorGetUseInPlace()` + +# External Links +$(_doc_external("Mat/MatSetUnfactored")) +""" +function MatSetUnfactored(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatSetUnfactored(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatSetUnfactored, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + newmat::PetscMat = MatCreateSubMatrix(petsclib::PetscLibType,mat::PetscMat, isrow::IS, iscol::IS, cll::MatReuse) +Gets a single submatrix on the same number of processors +as the original matrix. + +Collective + +Input Parameters: +- `mat` - the original matrix +- `isrow` - parallel `IS` containing the rows this processor should obtain +- `iscol` - parallel `IS` containing all columns you wish to keep. Each process should list the columns that will be in IT's "diagonal part" in the new matrix. +- `cll` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameter: +- `newmat` - the new submatrix, of the same type as the original matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateSubMatrices()`, `MatCreateSubMatricesMPI()`, `MatCreateSubMatrixVirtual()`, `MatSubMatrixVirtualUpdate()` + +# External Links +$(_doc_external("Mat/MatCreateSubMatrix")) +""" +function MatCreateSubMatrix(petsclib::PetscLibType, mat::PetscMat, isrow::IS, iscol::IS, cll::MatReuse) end + +@for_petsc function MatCreateSubMatrix(petsclib::$UnionPetscLib, mat::PetscMat, isrow::IS, iscol::IS, cll::MatReuse ) + newmat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSubMatrix, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, MatReuse, Ptr{CMat}), + mat, isrow, iscol, cll, newmat_, + ) + + newmat = PetscMat(newmat_[], petsclib) + + return newmat +end + +""" + MatPropagateSymmetryOptions(petsclib::PetscLibType,A::PetscMat, B::PetscMat) +Propagates symmetry options set on a matrix to another matrix + +Not Collective + +Input Parameters: +- `A` - the matrix we wish to propagate options from +- `B` - the matrix we wish to propagate options to + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatSetOption()`, `MatIsSymmetricKnown()`, `MatIsSPDKnown()`, `MatIsHermitianKnown()`, `MatIsStructurallySymmetricKnown()` + +# External Links +$(_doc_external("Mat/MatPropagateSymmetryOptions")) +""" +function MatPropagateSymmetryOptions(petsclib::PetscLibType, A::PetscMat, B::PetscMat) end + +@for_petsc function MatPropagateSymmetryOptions(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat ) + + @chk ccall( + (:MatPropagateSymmetryOptions, $petsc_library), + PetscErrorCode, + (CMat, CMat), + A, B, + ) + + + return nothing +end + +""" + MatStashSetInitialSize(petsclib::PetscLibType,mat::PetscMat, size::PetscInt, bsize::PetscInt) +sets the sizes of the matrix stash, that is +used during the assembly process to store values that belong to +other processors. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `size` - the initial size of the stash. +- `bsize` - the initial size of the block-stash(if used). + +Options Database Keys: +- `-matstash_initial_size or ` - set initial size +- `-matstash_block_initial_size or ` - set initial block size + +Level: intermediate + +-seealso: [](ch_matrices), `MatAssemblyBegin()`, `MatAssemblyEnd()`, `Mat`, `MatStashGetInfo()` + +# External Links +$(_doc_external("Mat/MatStashSetInitialSize")) +""" +function MatStashSetInitialSize(petsclib::PetscLibType, mat::PetscMat, size::PetscInt, bsize::PetscInt) end + +@for_petsc function MatStashSetInitialSize(petsclib::$UnionPetscLib, mat::PetscMat, size::$PetscInt, bsize::$PetscInt ) + + @chk ccall( + (:MatStashSetInitialSize, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt), + mat, size, bsize, + ) + + + return nothing +end + +""" + MatInterpolateAdd(petsclib::PetscLibType,A::PetscMat, x::PetscVec, y::PetscVec, w::PetscVec) +w = y + A*x or A^T*x depending on the shape of +the matrix + +Neighbor-wise Collective + +Input Parameters: +- `A` - the matrix +- `x` - the vector to be multiplied by the interpolation operator +- `y` - the vector to be added to the result + +Output Parameter: +- `w` - the resulting vector + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatMultAdd()`, `MatMultTransposeAdd()`, `MatRestrict()`, `PCMG` + +# External Links +$(_doc_external("Mat/MatInterpolateAdd")) +""" +function MatInterpolateAdd(petsclib::PetscLibType, A::PetscMat, x::PetscVec, y::PetscVec, w::PetscVec) end + +@for_petsc function MatInterpolateAdd(petsclib::$UnionPetscLib, A::PetscMat, x::PetscVec, y::PetscVec, w::PetscVec ) + + @chk ccall( + (:MatInterpolateAdd, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec), + A, x, y, w, + ) + + + return nothing +end + +""" + MatInterpolate(petsclib::PetscLibType,A::PetscMat, x::PetscVec, y::PetscVec) +y = A*x or A^T*x depending on the shape of +the matrix + +Neighbor-wise Collective + +Input Parameters: +- `A` - the matrix +- `x` - the vector to be interpolated + +Output Parameter: +- `y` - the resulting vector + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatMultAdd()`, `MatMultTransposeAdd()`, `MatRestrict()`, `PCMG` + +# External Links +$(_doc_external("Mat/MatInterpolate")) +""" +function MatInterpolate(petsclib::PetscLibType, A::PetscMat, x::PetscVec, y::PetscVec) end + +@for_petsc function MatInterpolate(petsclib::$UnionPetscLib, A::PetscMat, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:MatInterpolate, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + A, x, y, + ) + + + return nothing +end + +""" + MatRestrict(petsclib::PetscLibType,A::PetscMat, x::PetscVec, y::PetscVec) +y = A*x or A^T*x + +Neighbor-wise Collective + +Input Parameters: +- `A` - the matrix +- `x` - the vector to be restricted + +Output Parameter: +- `y` - the resulting vector + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatMultAdd()`, `MatMultTransposeAdd()`, `MatInterpolate()`, `PCMG` + +# External Links +$(_doc_external("Mat/MatRestrict")) +""" +function MatRestrict(petsclib::PetscLibType, A::PetscMat, x::PetscVec, y::PetscVec) end + +@for_petsc function MatRestrict(petsclib::$UnionPetscLib, A::PetscMat, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:MatRestrict, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + A, x, y, + ) + + + return nothing +end + +""" + MatMatInterpolateAdd(petsclib::PetscLibType,A::PetscMat, x::PetscMat, w::PetscMat, y::PetscMat) +Y = W + A*X or W + A^T*X depending on the shape of `A` + +Neighbor-wise Collective + +Input Parameters: +- `A` - the matrix +- `x` - the input dense matrix to be multiplied +- `w` - the input dense matrix to be added to the result + +Output Parameter: +- `y` - the output dense matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatInterpolateAdd()`, `MatMatInterpolate()`, `MatMatRestrict()`, `PCMG` + +# External Links +$(_doc_external("Mat/MatMatInterpolateAdd")) +""" +function MatMatInterpolateAdd(petsclib::PetscLibType, A::PetscMat, x::PetscMat, w::PetscMat, y::PetscMat) end + +@for_petsc function MatMatInterpolateAdd(petsclib::$UnionPetscLib, A::PetscMat, x::PetscMat, w::PetscMat, y::PetscMat ) + y_ = Ref(y.ptr) + + @chk ccall( + (:MatMatInterpolateAdd, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, Ptr{CMat}), + A, x, w, y_, + ) + + y.ptr = C_NULL + + return nothing +end + +""" + MatMatInterpolate(petsclib::PetscLibType,A::PetscMat, x::PetscMat, y::PetscMat) +Y = A*X or A^T*X depending on the shape of `A` + +Neighbor-wise Collective + +Input Parameters: +- `A` - the matrix +- `x` - the input dense matrix + +Output Parameter: +- `y` - the output dense matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatInterpolate()`, `MatRestrict()`, `MatMatRestrict()`, `PCMG` + +# External Links +$(_doc_external("Mat/MatMatInterpolate")) +""" +function MatMatInterpolate(petsclib::PetscLibType, A::PetscMat, x::PetscMat, y::PetscMat) end + +@for_petsc function MatMatInterpolate(petsclib::$UnionPetscLib, A::PetscMat, x::PetscMat, y::PetscMat ) + y_ = Ref(y.ptr) + + @chk ccall( + (:MatMatInterpolate, $petsc_library), + PetscErrorCode, + (CMat, CMat, Ptr{CMat}), + A, x, y_, + ) + + y.ptr = C_NULL + + return nothing +end + +""" + MatMatRestrict(petsclib::PetscLibType,A::PetscMat, x::PetscMat, y::PetscMat) +Y = A*X or A^T*X depending on the shape of `A` + +Neighbor-wise Collective + +Input Parameters: +- `A` - the matrix +- `x` - the input dense matrix + +Output Parameter: +- `y` - the output dense matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatRestrict()`, `MatInterpolate()`, `MatMatInterpolate()`, `PCMG` + +# External Links +$(_doc_external("Mat/MatMatRestrict")) +""" +function MatMatRestrict(petsclib::PetscLibType, A::PetscMat, x::PetscMat, y::PetscMat) end + +@for_petsc function MatMatRestrict(petsclib::$UnionPetscLib, A::PetscMat, x::PetscMat, y::PetscMat ) + y_ = Ref(y.ptr) + + @chk ccall( + (:MatMatRestrict, $petsc_library), + PetscErrorCode, + (CMat, CMat, Ptr{CMat}), + A, x, y_, + ) + + y.ptr = C_NULL + + return nothing +end + +""" + MatGetNullSpace(petsclib::PetscLibType,mat::PetscMat, nullsp::MatNullSpace) +retrieves the null space of a matrix. + +Logically Collective + +Input Parameters: +- `mat` - the matrix +- `nullsp` - the null space object + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatNullSpaceCreate()`, `MatSetNearNullSpace()`, `MatSetNullSpace()`, `MatNullSpace` + +# External Links +$(_doc_external("Mat/MatGetNullSpace")) +""" +function MatGetNullSpace(petsclib::PetscLibType, mat::PetscMat, nullsp::MatNullSpace) end + +@for_petsc function MatGetNullSpace(petsclib::$UnionPetscLib, mat::PetscMat, nullsp::MatNullSpace ) + + @chk ccall( + (:MatGetNullSpace, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatNullSpace}), + mat, nullsp, + ) + + + return nothing +end + +""" + MatGetNullSpaces(petsclib::PetscLibType,n::PetscInt, mat::Vector{PetscMat}, nullsp::Vector{MatNullSpace}) +gets the null spaces, transpose null spaces, and near null spaces from an array of matrices + +Logically Collective + +Input Parameters: +- `n` - the number of matrices +- `mat` - the array of matrices + +Output Parameters: +- `nullsp` - an array of null spaces, `NULL` for each matrix that does not have a null space, length 3 * `n` + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatNullSpaceCreate()`, `MatSetNearNullSpace()`, `MatGetNullSpace()`, `MatSetTransposeNullSpace()`, `MatGetTransposeNullSpace()`, +`MatNullSpaceRemove()`, `MatRestoreNullSpaces()` + +# External Links +$(_doc_external("Mat/MatGetNullSpaces")) +""" +function MatGetNullSpaces(petsclib::PetscLibType, n::PetscInt, mat::Vector{PetscMat}, nullsp::Vector{MatNullSpace}) end + +@for_petsc function MatGetNullSpaces(petsclib::$UnionPetscLib, n::$PetscInt, mat::Vector{PetscMat}, nullsp::Vector{MatNullSpace} ) + nullsp_ = Ref(pointer(nullsp)) + + @chk ccall( + (:MatGetNullSpaces, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{CMat}, Ptr{Ptr{MatNullSpace}}), + n, mat, nullsp_, + ) + + + return nothing +end + +""" + MatRestoreNullSpaces(petsclib::PetscLibType,n::PetscInt, mat::Vector{PetscMat}, nullsp::Vector{MatNullSpace}) +sets the null spaces, transpose null spaces, and near null spaces obtained with `MatGetNullSpaces()` for an array of matrices + +Logically Collective + +Input Parameters: +- `n` - the number of matrices +- `mat` - the array of matrices +- `nullsp` - an array of null spaces + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatNullSpaceCreate()`, `MatSetNearNullSpace()`, `MatGetNullSpace()`, `MatSetTransposeNullSpace()`, `MatGetTransposeNullSpace()`, +`MatNullSpaceRemove()`, `MatGetNullSpaces()` + +# External Links +$(_doc_external("Mat/MatRestoreNullSpaces")) +""" +function MatRestoreNullSpaces(petsclib::PetscLibType, n::PetscInt, mat::Vector{PetscMat}, nullsp::Vector{MatNullSpace}) end + +@for_petsc function MatRestoreNullSpaces(petsclib::$UnionPetscLib, n::$PetscInt, mat::Vector{PetscMat}, nullsp::Vector{MatNullSpace} ) + nullsp_ = Ref(pointer(nullsp)) + + @chk ccall( + (:MatRestoreNullSpaces, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{CMat}, Ptr{Ptr{MatNullSpace}}), + n, mat, nullsp_, + ) + + + return nothing +end + +""" + MatSetNullSpace(petsclib::PetscLibType,mat::PetscMat, nullsp::MatNullSpace) +attaches a null space to a matrix. + +Logically Collective + +Input Parameters: +- `mat` - the matrix +- `nullsp` - the null space object + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatNullSpaceCreate()`, `MatSetNearNullSpace()`, `MatGetNullSpace()`, `MatSetTransposeNullSpace()`, `MatGetTransposeNullSpace()`, `MatNullSpaceRemove()`, +`KSPSetPCSide()` + +# External Links +$(_doc_external("Mat/MatSetNullSpace")) +""" +function MatSetNullSpace(petsclib::PetscLibType, mat::PetscMat, nullsp::MatNullSpace) end + +@for_petsc function MatSetNullSpace(petsclib::$UnionPetscLib, mat::PetscMat, nullsp::MatNullSpace ) + + @chk ccall( + (:MatSetNullSpace, $petsc_library), + PetscErrorCode, + (CMat, MatNullSpace), + mat, nullsp, + ) + + + return nothing +end + +""" + MatGetTransposeNullSpace(petsclib::PetscLibType,mat::PetscMat, nullsp::MatNullSpace) +retrieves the null space of the transpose of a matrix. + +Logically Collective + +Input Parameters: +- `mat` - the matrix +- `nullsp` - the null space object + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatCreate()`, `MatNullSpaceCreate()`, `MatSetNearNullSpace()`, `MatSetTransposeNullSpace()`, `MatSetNullSpace()`, `MatGetNullSpace()` + +# External Links +$(_doc_external("Mat/MatGetTransposeNullSpace")) +""" +function MatGetTransposeNullSpace(petsclib::PetscLibType, mat::PetscMat, nullsp::MatNullSpace) end + +@for_petsc function MatGetTransposeNullSpace(petsclib::$UnionPetscLib, mat::PetscMat, nullsp::MatNullSpace ) + + @chk ccall( + (:MatGetTransposeNullSpace, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatNullSpace}), + mat, nullsp, + ) + + + return nothing +end + +""" + MatSetTransposeNullSpace(petsclib::PetscLibType,mat::PetscMat, nullsp::MatNullSpace) +attaches the null space of a transpose of a matrix to the matrix + +Logically Collective + +Input Parameters: +- `mat` - the matrix +- `nullsp` - the null space object + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatCreate()`, `MatNullSpaceCreate()`, `MatSetNearNullSpace()`, `MatGetNullSpace()`, `MatSetNullSpace()`, `MatGetTransposeNullSpace()`, `MatNullSpaceRemove()`, `KSPSetPCSide()` + +# External Links +$(_doc_external("Mat/MatSetTransposeNullSpace")) +""" +function MatSetTransposeNullSpace(petsclib::PetscLibType, mat::PetscMat, nullsp::MatNullSpace) end + +@for_petsc function MatSetTransposeNullSpace(petsclib::$UnionPetscLib, mat::PetscMat, nullsp::MatNullSpace ) + + @chk ccall( + (:MatSetTransposeNullSpace, $petsc_library), + PetscErrorCode, + (CMat, MatNullSpace), + mat, nullsp, + ) + + + return nothing +end + +""" + MatSetNearNullSpace(petsclib::PetscLibType,mat::PetscMat, nullsp::MatNullSpace) +attaches a null space to a matrix, which is often the null space (rigid body modes) of the operator without boundary conditions +This null space will be used to provide near null space vectors to a multigrid preconditioner built from this matrix. + +Logically Collective + +Input Parameters: +- `mat` - the matrix +- `nullsp` - the null space object + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatCreate()`, `MatNullSpaceCreate()`, `MatSetNullSpace()`, `MatNullSpaceCreateRigidBody()`, `MatGetNearNullSpace()` + +# External Links +$(_doc_external("Mat/MatSetNearNullSpace")) +""" +function MatSetNearNullSpace(petsclib::PetscLibType, mat::PetscMat, nullsp::MatNullSpace) end + +@for_petsc function MatSetNearNullSpace(petsclib::$UnionPetscLib, mat::PetscMat, nullsp::MatNullSpace ) + + @chk ccall( + (:MatSetNearNullSpace, $petsc_library), + PetscErrorCode, + (CMat, MatNullSpace), + mat, nullsp, + ) + + + return nothing +end + +""" + MatGetNearNullSpace(petsclib::PetscLibType,mat::PetscMat, nullsp::MatNullSpace) +Get null space attached with `MatSetNearNullSpace()` + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `nullsp` - the null space object, `NULL` if not set + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatSetNearNullSpace()`, `MatGetNullSpace()`, `MatNullSpaceCreate()` + +# External Links +$(_doc_external("Mat/MatGetNearNullSpace")) +""" +function MatGetNearNullSpace(petsclib::PetscLibType, mat::PetscMat, nullsp::MatNullSpace) end + +@for_petsc function MatGetNearNullSpace(petsclib::$UnionPetscLib, mat::PetscMat, nullsp::MatNullSpace ) + + @chk ccall( + (:MatGetNearNullSpace, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatNullSpace}), + mat, nullsp, + ) + + + return nothing +end + +""" + MatICCFactor(petsclib::PetscLibType,mat::PetscMat, row::IS, info::MatFactorInfo) +Performs in + +Collective + +Input Parameters: +- `mat` - the matrix +- `row` - row/column permutation +- `info` - information on desired factorization process + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatFactorInfo`, `MatGetFactor()`, `MatICCFactorSymbolic()`, `MatLUFactorNumeric()`, `MatCholeskyFactor()` + +# External Links +$(_doc_external("Mat/MatICCFactor")) +""" +function MatICCFactor(petsclib::PetscLibType, mat::PetscMat, row::IS, info::MatFactorInfo) end + +@for_petsc function MatICCFactor(petsclib::$UnionPetscLib, mat::PetscMat, row::IS, info::MatFactorInfo ) + + @chk ccall( + (:MatICCFactor, $petsc_library), + PetscErrorCode, + (CMat, CIS, Ptr{MatFactorInfo}), + mat, row, info, + ) + + + return nothing +end + +""" + MatDiagonalScaleLocal(petsclib::PetscLibType,mat::PetscMat, diag::PetscVec) +Scales columns of a matrix given the scaling values including the +ghosted ones. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `diag` - the diagonal values, including ghost ones + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatDiagonalScale()` + +# External Links +$(_doc_external("Mat/MatDiagonalScaleLocal")) +""" +function MatDiagonalScaleLocal(petsclib::PetscLibType, mat::PetscMat, diag::PetscVec) end + +@for_petsc function MatDiagonalScaleLocal(petsclib::$UnionPetscLib, mat::PetscMat, diag::PetscVec ) + + @chk ccall( + (:MatDiagonalScaleLocal, $petsc_library), + PetscErrorCode, + (CMat, CVec), + mat, diag, + ) + + + return nothing +end + +""" + nneg::PetscInt,nzero::PetscInt,npos::PetscInt = MatGetInertia(petsclib::PetscLibType,mat::PetscMat) +Gets the inertia from a factored matrix + +Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `nneg` - number of negative eigenvalues +- `nzero` - number of zero eigenvalues +- `npos` - number of positive eigenvalues + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatCholeskyFactor()` + +# External Links +$(_doc_external("Mat/MatGetInertia")) +""" +function MatGetInertia(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatGetInertia(petsclib::$UnionPetscLib, mat::PetscMat ) + nneg_ = Ref{$PetscInt}() + nzero_ = Ref{$PetscInt}() + npos_ = Ref{$PetscInt}() + + @chk ccall( + (:MatGetInertia, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + mat, nneg_, nzero_, npos_, + ) + + nneg = nneg_[] + nzero = nzero_[] + npos = npos_[] + + return nneg,nzero,npos +end + +""" + MatSolves(petsclib::PetscLibType,mat::PetscMat, b::Vecs, x::Vecs) +Solves A x = b, given a factored matrix, for a collection of vectors + +Neighbor-wise Collective + +Input Parameters: +- `mat` - the factored matrix obtained with `MatGetFactor()` +- `b` - the right-hand-side vectors + +Output Parameter: +- `x` - the result vectors + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `Vecs`, `MatSolveAdd()`, `MatSolveTranspose()`, `MatSolveTransposeAdd()`, `MatSolve()` + +# External Links +$(_doc_external("Mat/MatSolves")) +""" +function MatSolves(petsclib::PetscLibType, mat::PetscMat, b::Vecs, x::Vecs) end + +@for_petsc function MatSolves(petsclib::$UnionPetscLib, mat::PetscMat, b::Vecs, x::Vecs ) + + @chk ccall( + (:MatSolves, $petsc_library), + PetscErrorCode, + (CMat, Vecs, Vecs), + mat, b, x, + ) + + + return nothing +end + +""" + flg::PetscBool = MatIsSymmetric(petsclib::PetscLibType,A::PetscMat, tol::PetscReal) +Test whether a matrix is symmetric + +Collective + +Input Parameters: +- `A` - the matrix to test +- `tol` - difference between value and its transpose less than this amount counts as equal (use 0.0 for exact transpose) + +Output Parameter: +- `flg` - the result + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatTranspose()`, `MatIsTranspose()`, `MatIsHermitian()`, `MatIsStructurallySymmetric()`, `MatSetOption()`, `MatIsSymmetricKnown()`, +`MAT_SYMMETRIC`, `MAT_SYMMETRY_ETERNAL` + +# External Links +$(_doc_external("Mat/MatIsSymmetric")) +""" +function MatIsSymmetric(petsclib::PetscLibType, A::PetscMat, tol::PetscReal) end + +@for_petsc function MatIsSymmetric(petsclib::$UnionPetscLib, A::PetscMat, tol::$PetscReal ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsSymmetric, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal, Ptr{PetscBool}), + A, tol, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatIsHermitian(petsclib::PetscLibType,A::PetscMat, tol::PetscReal) +Test whether a matrix is Hermitian + +Collective + +Input Parameters: +- `A` - the matrix to test +- `tol` - difference between value and its transpose less than this amount counts as equal (use 0.0 for exact Hermitian) + +Output Parameter: +- `flg` - the result + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatTranspose()`, `MatIsTranspose()`, `MatIsHermitianKnown()`, `MatIsStructurallySymmetric()`, `MatSetOption()`, +`MatIsSymmetricKnown()`, `MatIsSymmetric()`, `MAT_HERMITIAN`, `MAT_SYMMETRY_ETERNAL` + +# External Links +$(_doc_external("Mat/MatIsHermitian")) +""" +function MatIsHermitian(petsclib::PetscLibType, A::PetscMat, tol::PetscReal) end + +@for_petsc function MatIsHermitian(petsclib::$UnionPetscLib, A::PetscMat, tol::$PetscScalar ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsHermitian, $petsc_library), + PetscErrorCode, + (CMat, $PetscScalar, Ptr{PetscBool}), + A, tol, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + set::PetscBool,flg::PetscBool = MatIsSymmetricKnown(petsclib::PetscLibType,A::PetscMat) +Checks if a matrix knows if it is symmetric or not and its symmetric state + +Not Collective + +Input Parameter: +- `A` - the matrix to check + +Output Parameters: +- `set` - `PETSC_TRUE` if the matrix knows its symmetry state (this tells you if the next flag is valid) +- `flg` - the result (only valid if set is `PETSC_TRUE`) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MAT_SYMMETRY_ETERNAL`, `MatTranspose()`, `MatIsTranspose()`, `MatIsHermitian()`, `MatIsStructurallySymmetric()`, `MatSetOption()`, `MatIsSymmetric()`, `MatIsHermitianKnown()` + +# External Links +$(_doc_external("Mat/MatIsSymmetricKnown")) +""" +function MatIsSymmetricKnown(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatIsSymmetricKnown(petsclib::$UnionPetscLib, A::PetscMat ) + set_ = Ref{PetscBool}() + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsSymmetricKnown, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}, Ptr{PetscBool}), + A, set_, flg_, + ) + + set = set_[] + flg = flg_[] + + return set,flg +end + +""" + set::PetscBool,flg::PetscBool = MatIsSPDKnown(petsclib::PetscLibType,A::PetscMat) +Checks if a matrix knows if it is symmetric positive definite or not and its symmetric positive definite state + +Not Collective + +Input Parameter: +- `A` - the matrix to check + +Output Parameters: +- `set` - `PETSC_TRUE` if the matrix knows its symmetric positive definite state (this tells you if the next flag is valid) +- `flg` - the result (only valid if set is `PETSC_TRUE`) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MAT_SPD_ETERNAL`, `MAT_SPD`, `MatTranspose()`, `MatIsTranspose()`, `MatIsHermitian()`, `MatIsStructurallySymmetric()`, `MatSetOption()`, `MatIsSymmetric()`, `MatIsHermitianKnown()` + +# External Links +$(_doc_external("Mat/MatIsSPDKnown")) +""" +function MatIsSPDKnown(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatIsSPDKnown(petsclib::$UnionPetscLib, A::PetscMat ) + set_ = Ref{PetscBool}() + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsSPDKnown, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}, Ptr{PetscBool}), + A, set_, flg_, + ) + + set = set_[] + flg = flg_[] + + return set,flg +end + +""" + set::PetscBool,flg::PetscBool = MatIsHermitianKnown(petsclib::PetscLibType,A::PetscMat) +Checks if a matrix knows if it is Hermitian or not and its Hermitian state + +Not Collective + +Input Parameter: +- `A` - the matrix to check + +Output Parameters: +- `set` - `PETSC_TRUE` if the matrix knows its Hermitian state (this tells you if the next flag is valid) +- `flg` - the result (only valid if set is `PETSC_TRUE`) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MAT_SYMMETRY_ETERNAL`, `MAT_HERMITIAN`, `MatTranspose()`, `MatIsTranspose()`, `MatIsHermitian()`, `MatIsStructurallySymmetric()`, `MatSetOption()`, `MatIsSymmetric()` + +# External Links +$(_doc_external("Mat/MatIsHermitianKnown")) +""" +function MatIsHermitianKnown(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatIsHermitianKnown(petsclib::$UnionPetscLib, A::PetscMat ) + set_ = Ref{PetscBool}() + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsHermitianKnown, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}, Ptr{PetscBool}), + A, set_, flg_, + ) + + set = set_[] + flg = flg_[] + + return set,flg +end + +""" + flg::PetscBool = MatIsStructurallySymmetric(petsclib::PetscLibType,A::PetscMat) +Test whether a matrix is structurally symmetric + +Collective + +Input Parameter: +- `A` - the matrix to test + +Output Parameter: +- `flg` - the result + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MAT_STRUCTURALLY_SYMMETRIC`, `MAT_STRUCTURAL_SYMMETRY_ETERNAL`, `MatTranspose()`, `MatIsTranspose()`, `MatIsHermitian()`, `MatIsSymmetric()`, `MatSetOption()`, `MatIsStructurallySymmetricKnown()` + +# External Links +$(_doc_external("Mat/MatIsStructurallySymmetric")) +""" +function MatIsStructurallySymmetric(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatIsStructurallySymmetric(petsclib::$UnionPetscLib, A::PetscMat ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsStructurallySymmetric, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + A, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + set::PetscBool,flg::PetscBool = MatIsStructurallySymmetricKnown(petsclib::PetscLibType,A::PetscMat) +Checks if a matrix knows if it is structurally symmetric or not and its structurally symmetric state + +Not Collective + +Input Parameter: +- `A` - the matrix to check + +Output Parameters: +- `set` - PETSC_TRUE if the matrix knows its structurally symmetric state (this tells you if the next flag is valid) +- `flg` - the result (only valid if set is PETSC_TRUE) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MAT_STRUCTURALLY_SYMMETRIC`, `MatTranspose()`, `MatIsTranspose()`, `MatIsHermitian()`, `MatIsStructurallySymmetric()`, `MatSetOption()`, `MatIsSymmetric()`, `MatIsHermitianKnown()` + +# External Links +$(_doc_external("Mat/MatIsStructurallySymmetricKnown")) +""" +function MatIsStructurallySymmetricKnown(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatIsStructurallySymmetricKnown(petsclib::$UnionPetscLib, A::PetscMat ) + set_ = Ref{PetscBool}() + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsStructurallySymmetricKnown, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}, Ptr{PetscBool}), + A, set_, flg_, + ) + + set = set_[] + flg = flg_[] + + return set,flg +end + +""" + nstash::PetscInt,reallocs::PetscInt,bnstash::PetscInt,breallocs::PetscInt = MatStashGetInfo(petsclib::PetscLibType,mat::PetscMat) +Gets how many values are currently in the matrix stash, i.e. need +to be communicated to other processors during the `MatAssemblyBegin()`/`MatAssemblyEnd()` process + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `nstash` - the size of the stash +- `reallocs` - the number of additional mallocs incurred. +- `bnstash` - the size of the block stash +- `breallocs` - the number of additional mallocs incurred.in the block stash + +Level: advanced + +-seealso: [](ch_matrices), `MatAssemblyBegin()`, `MatAssemblyEnd()`, `Mat`, `MatStashSetInitialSize()` + +# External Links +$(_doc_external("Mat/MatStashGetInfo")) +""" +function MatStashGetInfo(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatStashGetInfo(petsclib::$UnionPetscLib, mat::PetscMat ) + nstash_ = Ref{$PetscInt}() + reallocs_ = Ref{$PetscInt}() + bnstash_ = Ref{$PetscInt}() + breallocs_ = Ref{$PetscInt}() + + @chk ccall( + (:MatStashGetInfo, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + mat, nstash_, reallocs_, bnstash_, breallocs_, + ) + + nstash = nstash_[] + reallocs = reallocs_[] + bnstash = bnstash_[] + breallocs = breallocs_[] + + return nstash,reallocs,bnstash,breallocs +end + +""" + right::PetscVec,left::PetscVec = MatCreateVecs(petsclib::PetscLibType,mat::PetscMat) +Get vector(s) compatible with the matrix, i.e. with the same +parallel layout, `PetscLayout` for rows and columns + +Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameters: +- `right` - (optional) vector that the matrix can be multiplied against +- `left` - (optional) vector that the matrix vector product can be stored in + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `Vec`, `VecCreate()`, `VecDestroy()`, `DMCreateGlobalVector()` + +# External Links +$(_doc_external("Mat/MatCreateVecs")) +""" +function MatCreateVecs(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatCreateVecs(petsclib::$UnionPetscLib, mat::PetscMat ) + right_ = Ref{CVec}() + left_ = Ref{CVec}() + + @chk ccall( + (:MatCreateVecs, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CVec}, Ptr{CVec}), + mat, right_, left_, + ) + + right = PetscVec(right_[], petsclib) + left = PetscVec(left_[], petsclib) + + return right,left +end + +""" + MatFactorInfoInitialize(petsclib::PetscLibType,info::MatFactorInfo) +Initializes a `MatFactorInfo` data structure +with default values. + +Not Collective + +Input Parameter: +- `info` - the `MatFactorInfo` data structure + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatFactorInfo` + +# External Links +$(_doc_external("Mat/MatFactorInfoInitialize")) +""" +function MatFactorInfoInitialize(petsclib::PetscLibType, info::MatFactorInfo) end + +@for_petsc function MatFactorInfoInitialize(petsclib::$UnionPetscLib, info::MatFactorInfo ) + + @chk ccall( + (:MatFactorInfoInitialize, $petsc_library), + PetscErrorCode, + (Ptr{MatFactorInfo},), + info, + ) + + + return nothing +end + +""" + MatFactorSetSchurIS(petsclib::PetscLibType,mat::PetscMat, is::IS) +Set indices corresponding to the Schur complement you wish to have computed + +Collective + +Input Parameters: +- `mat` - the factored matrix +- `is` - the index set defining the Schur indices (0-based) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatFactorGetSchurComplement()`, `MatFactorRestoreSchurComplement()`, `MatFactorCreateSchurComplement()`, `MatFactorSolveSchurComplement()`, +`MatFactorSolveSchurComplementTranspose()`, `MATSOLVERMUMPS`, `MATSOLVERMKL_PARDISO` + +# External Links +$(_doc_external("Mat/MatFactorSetSchurIS")) +""" +function MatFactorSetSchurIS(petsclib::PetscLibType, mat::PetscMat, is::IS) end + +@for_petsc function MatFactorSetSchurIS(petsclib::$UnionPetscLib, mat::PetscMat, is::IS ) + + @chk ccall( + (:MatFactorSetSchurIS, $petsc_library), + PetscErrorCode, + (CMat, CIS), + mat, is, + ) + + + return nothing +end + +""" + S::PetscMat,status::MatFactorSchurStatus = MatFactorCreateSchurComplement(petsclib::PetscLibType,F::PetscMat) +Create a Schur complement matrix object using Schur data computed during the factorization step + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` +- `S` - location where to return the Schur complement, can be `NULL` +- `status` - the status of the Schur complement matrix, can be `NULL` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatFactorSetSchurIS()`, `MatFactorGetSchurComplement()`, `MatFactorSchurStatus`, `MATSOLVERMUMPS`, `MATSOLVERMKL_PARDISO` + +# External Links +$(_doc_external("Mat/MatFactorCreateSchurComplement")) +""" +function MatFactorCreateSchurComplement(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatFactorCreateSchurComplement(petsclib::$UnionPetscLib, F::PetscMat ) + S_ = Ref{CMat}() + status_ = Ref{MatFactorSchurStatus}() + + @chk ccall( + (:MatFactorCreateSchurComplement, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}, Ptr{MatFactorSchurStatus}), + F, S_, status_, + ) + + S = PetscMat(S_[], petsclib) + status = status_[] + + return S,status +end + +""" + MatFactorGetSchurComplement(petsclib::PetscLibType,F::PetscMat, S::PetscMat, status::MatFactorSchurStatus) +Gets access to a Schur complement matrix using the current Schur data within a factored matrix + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` +- `S` - location where to return the Schur complement, can be `NULL` +- `status` - the status of the Schur complement matrix, can be `NULL` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatFactorSetSchurIS()`, `MatFactorRestoreSchurComplement()`, `MatFactorCreateSchurComplement()`, `MatFactorSchurStatus` + +# External Links +$(_doc_external("Mat/MatFactorGetSchurComplement")) +""" +function MatFactorGetSchurComplement(petsclib::PetscLibType, F::PetscMat, S::Union{Ptr,PetscMat}, status::Union{Ptr,MatFactorSchurStatus}) end + +@for_petsc function MatFactorGetSchurComplement(petsclib::$UnionPetscLib, F::PetscMat, S::Union{Ptr,PetscMat}, status::Union{Ptr,MatFactorSchurStatus}) + S_ = Ref(S.ptr) + + @chk ccall( + (:MatFactorGetSchurComplement, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}, Ptr{MatFactorSchurStatus}), + F, S_, status, + ) + + S.ptr = C_NULL + + return nothing +end + +""" + MatFactorRestoreSchurComplement(petsclib::PetscLibType,F::PetscMat, S::PetscMat, status::MatFactorSchurStatus) +Restore the Schur complement matrix object obtained from a call to `MatFactorGetSchurComplement()` + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` +- `S` - location where the Schur complement is stored +- `status` - the status of the Schur complement matrix (see `MatFactorSchurStatus`) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatFactorSetSchurIS()`, `MatFactorCreateSchurComplement()`, `MatFactorSchurStatus` + +# External Links +$(_doc_external("Mat/MatFactorRestoreSchurComplement")) +""" +function MatFactorRestoreSchurComplement(petsclib::PetscLibType, F::PetscMat, S::PetscMat, status::MatFactorSchurStatus) end + +@for_petsc function MatFactorRestoreSchurComplement(petsclib::$UnionPetscLib, F::PetscMat, S::PetscMat, status::MatFactorSchurStatus ) + S_ = Ref(S.ptr) + + @chk ccall( + (:MatFactorRestoreSchurComplement, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}, MatFactorSchurStatus), + F, S_, status, + ) + + S.ptr = C_NULL + + return nothing +end + +""" + MatFactorSolveSchurComplementTranspose(petsclib::PetscLibType,F::PetscMat, rhs::PetscVec, sol::PetscVec) +Solve the transpose of the Schur complement system computed during the factorization step + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` +- `rhs` - location where the right-hand side of the Schur complement system is stored +- `sol` - location where the solution of the Schur complement system has to be returned + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatFactorSetSchurIS()`, `MatFactorSolveSchurComplement()` + +# External Links +$(_doc_external("Mat/MatFactorSolveSchurComplementTranspose")) +""" +function MatFactorSolveSchurComplementTranspose(petsclib::PetscLibType, F::PetscMat, rhs::PetscVec, sol::PetscVec) end + +@for_petsc function MatFactorSolveSchurComplementTranspose(petsclib::$UnionPetscLib, F::PetscMat, rhs::PetscVec, sol::PetscVec ) + + @chk ccall( + (:MatFactorSolveSchurComplementTranspose, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + F, rhs, sol, + ) + + + return nothing +end + +""" + MatFactorSolveSchurComplement(petsclib::PetscLibType,F::PetscMat, rhs::PetscVec, sol::PetscVec) +Solve the Schur complement system computed during the factorization step + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` +- `rhs` - location where the right-hand side of the Schur complement system is stored +- `sol` - location where the solution of the Schur complement system has to be returned + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatFactorSetSchurIS()`, `MatFactorSolveSchurComplementTranspose()` + +# External Links +$(_doc_external("Mat/MatFactorSolveSchurComplement")) +""" +function MatFactorSolveSchurComplement(petsclib::PetscLibType, F::PetscMat, rhs::PetscVec, sol::PetscVec) end + +@for_petsc function MatFactorSolveSchurComplement(petsclib::$UnionPetscLib, F::PetscMat, rhs::PetscVec, sol::PetscVec ) + + @chk ccall( + (:MatFactorSolveSchurComplement, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + F, rhs, sol, + ) + + + return nothing +end + +""" + MatFactorInvertSchurComplement(petsclib::PetscLibType,F::PetscMat) +Invert the Schur complement matrix computed during the factorization step + +Logically Collective + +Input Parameter: +- `F` - the factored matrix obtained by calling `MatGetFactor()` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatFactorSetSchurIS()`, `MatFactorGetSchurComplement()`, `MatFactorCreateSchurComplement()` + +# External Links +$(_doc_external("Mat/MatFactorInvertSchurComplement")) +""" +function MatFactorInvertSchurComplement(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatFactorInvertSchurComplement(petsclib::$UnionPetscLib, F::PetscMat ) + + @chk ccall( + (:MatFactorInvertSchurComplement, $petsc_library), + PetscErrorCode, + (CMat,), + F, + ) + + + return nothing +end + +""" + MatFactorFactorizeSchurComplement(petsclib::PetscLibType,F::PetscMat) +Factorize the Schur complement matrix computed during the factorization step + +Logically Collective + +Input Parameter: +- `F` - the factored matrix obtained by calling `MatGetFactor()` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatFactorSetSchurIS()`, `MatFactorInvertSchurComplement()` + +# External Links +$(_doc_external("Mat/MatFactorFactorizeSchurComplement")) +""" +function MatFactorFactorizeSchurComplement(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatFactorFactorizeSchurComplement(petsclib::$UnionPetscLib, F::PetscMat ) + + @chk ccall( + (:MatFactorFactorizeSchurComplement, $petsc_library), + PetscErrorCode, + (CMat,), + F, + ) + + + return nothing +end + +""" + MatPtAP(petsclib::PetscLibType,A::PetscMat, P::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat) +Creates the matrix product C = P^T * A * P + +Neighbor-wise Collective + +Input Parameters: +- `A` - the matrix +- `P` - the projection matrix +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` +- `fill` - expected fill as ratio of nnz(C)/(nnz(A) + nnz(P)), use `PETSC_DETERMINE` or `PETSC_CURRENT` if you do not have a good estimate +if the result is a dense matrix this is irrelevant + +Output Parameter: +- `C` - the product matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatProductCreate()`, `MatMatMult()`, `MatRARt()` + +# External Links +$(_doc_external("Mat/MatPtAP")) +""" +function MatPtAP(petsclib::PetscLibType, A::PetscMat, P::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat) end + +@for_petsc function MatPtAP(petsclib::$UnionPetscLib, A::PetscMat, P::PetscMat, scall::MatReuse, fill::$PetscReal, C::PetscMat ) + C_ = Ref(C.ptr) + + @chk ccall( + (:MatPtAP, $petsc_library), + PetscErrorCode, + (CMat, CMat, MatReuse, $PetscReal, Ptr{CMat}), + A, P, scall, fill, C_, + ) + + C.ptr = C_NULL + + return nothing +end + +""" + MatRARt(petsclib::PetscLibType,A::PetscMat, R::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat) +Creates the matrix product C = R * A * R^T + +Neighbor-wise Collective + +Input Parameters: +- `A` - the matrix +- `R` - the projection matrix +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` +- `fill` - expected fill as ratio of nnz(C)/nnz(A), use `PETSC_DETERMINE` or `PETSC_CURRENT` if you do not have a good estimate +if the result is a dense matrix this is irrelevant + +Output Parameter: +- `C` - the product matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatProductCreate()`, `MatMatMult()`, `MatPtAP()` + +# External Links +$(_doc_external("Mat/MatRARt")) +""" +function MatRARt(petsclib::PetscLibType, A::PetscMat, R::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat) end + +@for_petsc function MatRARt(petsclib::$UnionPetscLib, A::PetscMat, R::PetscMat, scall::MatReuse, fill::$PetscReal, C::PetscMat ) + C_ = Ref(C.ptr) + + @chk ccall( + (:MatRARt, $petsc_library), + PetscErrorCode, + (CMat, CMat, MatReuse, $PetscReal, Ptr{CMat}), + A, R, scall, fill, C_, + ) + + C.ptr = C_NULL + + return nothing +end + +""" + MatMatMult(petsclib::PetscLibType,A::PetscMat, B::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat) +Performs matrix + +Neighbor-wise Collective + +Input Parameters: +- `A` - the left matrix +- `B` - the right matrix +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` +- `fill` - expected fill as ratio of nnz(C)/(nnz(A) + nnz(B)), use `PETSC_DETERMINE` or `PETSC_CURRENT` if you do not have a good estimate +if the result is a dense matrix this is irrelevant + +Output Parameter: +- `C` - the product matrix + +-seealso: [](ch_matrices), `Mat`, `MatProductType`, `MATPRODUCT_AB`, `MatTransposeMatMult()`, `MatMatTransposeMult()`, `MatPtAP()`, `MatProductCreate()`, `MatProductSymbolic()`, `MatProductReplaceMats()`, `MatProductNumeric()` + +# External Links +$(_doc_external("Mat/MatMatMult")) +""" +function MatMatMult(petsclib::PetscLibType, A::PetscMat, B::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat) end + +@for_petsc function MatMatMult(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, scall::MatReuse, fill::$PetscReal, C::PetscMat ) + C_ = Ref(C.ptr) + + @chk ccall( + (:MatMatMult, $petsc_library), + PetscErrorCode, + (CMat, CMat, MatReuse, $PetscReal, Ptr{CMat}), + A, B, scall, fill, C_, + ) + + C.ptr = C_NULL + + return nothing +end + +""" + MatMatTransposeMult(petsclib::PetscLibType,A::PetscMat, B::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat) +Performs matrix + +Neighbor-wise Collective + +Input Parameters: +- `A` - the left matrix +- `B` - the right matrix +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` +- `fill` - expected fill as ratio of nnz(C)/(nnz(A) + nnz(B)), use `PETSC_DETERMINE` or `PETSC_CURRENT` if not known + +Output Parameter: +- `C` - the product matrix + +Options Database Key: +- `-matmattransmult_mpidense_mpidense_via {allgatherv,cyclic}` - Choose between algorithms for `MATMPIDENSE` matrices: the +first redundantly copies the transposed `B` matrix on each process and requires O(log P) communication complexity; +the second never stores more than one portion of the `B` matrix at a time but requires O(P) communication complexity. + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatProductCreate()`, `MATPRODUCT_ABt`, `MatMatMult()`, `MatTransposeMatMult()` `MatPtAP()`, `MatProductAlgorithm`, `MatProductType` + +# External Links +$(_doc_external("Mat/MatMatTransposeMult")) +""" +function MatMatTransposeMult(petsclib::PetscLibType, A::PetscMat, B::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat) end + +@for_petsc function MatMatTransposeMult(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, scall::MatReuse, fill::$PetscReal, C::PetscMat ) + C_ = Ref(C.ptr) + + @chk ccall( + (:MatMatTransposeMult, $petsc_library), + PetscErrorCode, + (CMat, CMat, MatReuse, $PetscReal, Ptr{CMat}), + A, B, scall, fill, C_, + ) + + C.ptr = C_NULL + + return nothing +end + +""" + MatTransposeMatMult(petsclib::PetscLibType,A::PetscMat, B::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat) +Performs matrix + +Neighbor-wise Collective + +Input Parameters: +- `A` - the left matrix +- `B` - the right matrix +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` +- `fill` - expected fill as ratio of nnz(C)/(nnz(A) + nnz(B)), use `PETSC_DETERMINE` or `PETSC_CURRENT` if not known + +Output Parameter: +- `C` - the product matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatProductCreate()`, `MATPRODUCT_AtB`, `MatMatMult()`, `MatMatTransposeMult()`, `MatPtAP()` + +# External Links +$(_doc_external("Mat/MatTransposeMatMult")) +""" +function MatTransposeMatMult(petsclib::PetscLibType, A::PetscMat, B::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat) end + +@for_petsc function MatTransposeMatMult(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, scall::MatReuse, fill::$PetscReal, C::PetscMat ) + C_ = Ref(C.ptr) + + @chk ccall( + (:MatTransposeMatMult, $petsc_library), + PetscErrorCode, + (CMat, CMat, MatReuse, $PetscReal, Ptr{CMat}), + A, B, scall, fill, C_, + ) + + C.ptr = C_NULL + + return nothing +end + +""" + MatMatMatMult(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, scall::MatReuse, fill::PetscReal, D::PetscMat) +Performs matrix + +Neighbor-wise Collective + +Input Parameters: +- `A` - the left matrix +- `B` - the middle matrix +- `C` - the right matrix +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` +- `fill` - expected fill as ratio of nnz(D)/(nnz(A) + nnz(B)+nnz(C)), use `PETSC_DETERMINE` or `PETSC_CURRENT` if you do not have a good estimate +if the result is a dense matrix this is irrelevant + +Output Parameter: +- `D` - the product matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatProductCreate()`, `MATPRODUCT_ABC`, `MatMatMult`, `MatPtAP()`, `MatMatTransposeMult()`, `MatTransposeMatMult()` + +# External Links +$(_doc_external("Mat/MatMatMatMult")) +""" +function MatMatMatMult(petsclib::PetscLibType, A::PetscMat, B::PetscMat, C::PetscMat, scall::MatReuse, fill::PetscReal, D::PetscMat) end + +@for_petsc function MatMatMatMult(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, C::PetscMat, scall::MatReuse, fill::$PetscReal, D::PetscMat ) + D_ = Ref(D.ptr) + + @chk ccall( + (:MatMatMatMult, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, MatReuse, $PetscReal, Ptr{CMat}), + A, B, C, scall, fill, D_, + ) + + D.ptr = C_NULL + + return nothing +end + +""" + matredundant::PetscMat = MatCreateRedundantMatrix(petsclib::PetscLibType,mat::PetscMat, nsubcomm::PetscInt, subcomm::MPI_Comm, reuse::MatReuse) +Create redundant matrices and put them into processors of subcommunicators. + +Collective + +Input Parameters: +- `mat` - the matrix +- `nsubcomm` - the number of subcommunicators (= number of redundant parallel or sequential matrices) +- `subcomm` - MPI communicator split from the communicator where mat resides in (or `MPI_COMM_NULL` if nsubcomm is used) +- `reuse` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameter: +- `matredundant` - redundant matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatDestroy()`, `PetscSubcommCreate()`, `PetscSubcomm` + +# External Links +$(_doc_external("Mat/MatCreateRedundantMatrix")) +""" +function MatCreateRedundantMatrix(petsclib::PetscLibType, mat::PetscMat, nsubcomm::PetscInt, subcomm::MPI_Comm, reuse::MatReuse) end + +@for_petsc function MatCreateRedundantMatrix(petsclib::$UnionPetscLib, mat::PetscMat, nsubcomm::$PetscInt, subcomm::MPI_Comm, reuse::MatReuse ) + matredundant_ = Ref{CMat}() + + @chk ccall( + (:MatCreateRedundantMatrix, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, MPI_Comm, MatReuse, Ptr{CMat}), + mat, nsubcomm, subcomm, reuse, matredundant_, + ) + + matredundant = PetscMat(matredundant_[], petsclib) + + return matredundant +end + +""" + MatGetMultiProcBlock(petsclib::PetscLibType,mat::PetscMat, subComm::MPI_Comm, scall::MatReuse, subMat::PetscMat) +Create multiple 'parallel submatrices' from +a given `Mat`. Each submatrix can span multiple procs. + +Collective + +Input Parameters: +- `mat` - the matrix +- `subComm` - the sub communicator obtained as if by `MPI_Comm_split(PetscObjectComm((PetscObject)mat))` +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameter: +- `subMat` - parallel sub-matrices each spanning a given `subcomm` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateRedundantMatrix()`, `MatCreateSubMatrices()`, `PCBJACOBI` + +# External Links +$(_doc_external("Mat/MatGetMultiProcBlock")) +""" +function MatGetMultiProcBlock(petsclib::PetscLibType, mat::PetscMat, subComm::MPI_Comm, scall::MatReuse, subMat::PetscMat) end + +@for_petsc function MatGetMultiProcBlock(petsclib::$UnionPetscLib, mat::PetscMat, subComm::MPI_Comm, scall::MatReuse, subMat::PetscMat ) + subMat_ = Ref(subMat.ptr) + + @chk ccall( + (:MatGetMultiProcBlock, $petsc_library), + PetscErrorCode, + (CMat, MPI_Comm, MatReuse, Ptr{CMat}), + mat, subComm, scall, subMat_, + ) + + subMat.ptr = C_NULL + + return nothing +end + +""" + MatGetLocalSubMatrix(petsclib::PetscLibType,mat::PetscMat, isrow::IS, iscol::IS, submat::PetscMat) +Gets a reference to a submatrix specified in local numbering + +Not Collective + +Input Parameters: +- `mat` - matrix to extract local submatrix from +- `isrow` - local row indices for submatrix +- `iscol` - local column indices for submatrix + +Output Parameter: +- `submat` - the submatrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatRestoreLocalSubMatrix()`, `MatCreateLocalRef()`, `MatSetLocalToGlobalMapping()` + +# External Links +$(_doc_external("Mat/MatGetLocalSubMatrix")) +""" +function MatGetLocalSubMatrix(petsclib::PetscLibType, mat::PetscMat, isrow::IS, iscol::IS, submat::PetscMat) end + +@for_petsc function MatGetLocalSubMatrix(petsclib::$UnionPetscLib, mat::PetscMat, isrow::IS, iscol::IS, submat::PetscMat ) + submat_ = Ref(submat.ptr) + + @chk ccall( + (:MatGetLocalSubMatrix, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, Ptr{CMat}), + mat, isrow, iscol, submat_, + ) + + submat.ptr = C_NULL + + return nothing +end + +""" + MatRestoreLocalSubMatrix(petsclib::PetscLibType,mat::PetscMat, isrow::IS, iscol::IS, submat::PetscMat) +Restores a reference to a submatrix specified in local numbering obtained with `MatGetLocalSubMatrix()` + +Not Collective + +Input Parameters: +- `mat` - matrix to extract local submatrix from +- `isrow` - local row indices for submatrix +- `iscol` - local column indices for submatrix +- `submat` - the submatrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatGetLocalSubMatrix()` + +# External Links +$(_doc_external("Mat/MatRestoreLocalSubMatrix")) +""" +function MatRestoreLocalSubMatrix(petsclib::PetscLibType, mat::PetscMat, isrow::IS, iscol::IS, submat::PetscMat) end + +@for_petsc function MatRestoreLocalSubMatrix(petsclib::$UnionPetscLib, mat::PetscMat, isrow::IS, iscol::IS, submat::PetscMat ) + submat_ = Ref(submat.ptr) + + @chk ccall( + (:MatRestoreLocalSubMatrix, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, Ptr{CMat}), + mat, isrow, iscol, submat_, + ) + + submat.ptr = C_NULL + + return nothing +end + +""" + MatFindZeroDiagonals(petsclib::PetscLibType,mat::PetscMat, is::IS) +Finds all the rows of a matrix that have zero or no diagonal entry in the matrix + +Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `is` - if any rows have zero diagonals this contains the list of them + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatMultTranspose()`, `MatMultAdd()`, `MatMultTransposeAdd()` + +# External Links +$(_doc_external("Mat/MatFindZeroDiagonals")) +""" +function MatFindZeroDiagonals(petsclib::PetscLibType, mat::PetscMat, is::IS) end + +@for_petsc function MatFindZeroDiagonals(petsclib::$UnionPetscLib, mat::PetscMat, is::IS ) + + @chk ccall( + (:MatFindZeroDiagonals, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CIS}), + mat, is, + ) + + + return nothing +end + +""" + MatFindOffBlockDiagonalEntries(petsclib::PetscLibType,mat::PetscMat, is::IS) +Finds all the rows of a matrix that have entries outside of the main diagonal block (defined by the matrix block size) + +Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `is` - contains the list of rows with off block diagonal entries + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatMultTranspose()`, `MatMultAdd()`, `MatMultTransposeAdd()` + +# External Links +$(_doc_external("Mat/MatFindOffBlockDiagonalEntries")) +""" +function MatFindOffBlockDiagonalEntries(petsclib::PetscLibType, mat::PetscMat, is::IS) end + +@for_petsc function MatFindOffBlockDiagonalEntries(petsclib::$UnionPetscLib, mat::PetscMat, is::IS ) + + @chk ccall( + (:MatFindOffBlockDiagonalEntries, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CIS}), + mat, is, + ) + + + return nothing +end + +""" + values::Vector{PetscScalar} = MatInvertBlockDiagonal(petsclib::PetscLibType,mat::PetscMat) +Inverts the block diagonal entries. + +Collective; No Fortran Support + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `values` - the block inverses in column major order (FORTRAN-like) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatInvertVariableBlockEnvelope()`, `MatInvertBlockDiagonalMat()` + +# External Links +$(_doc_external("Mat/MatInvertBlockDiagonal")) +""" +function MatInvertBlockDiagonal(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatInvertBlockDiagonal(petsclib::$UnionPetscLib, mat::PetscMat ) + values_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatInvertBlockDiagonal, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + mat, values_, + ) + + values = unsafe_wrap(Array, values_[], VecGetLocalSize(petsclib, x); own = false) + + return values +end + +""" + MatInvertVariableBlockDiagonal(petsclib::PetscLibType,mat::PetscMat, nblocks::PetscInt, bsizes::Vector{PetscInt}, values::Vector{PetscScalar}) +Inverts the point block diagonal entries. + +Collective; No Fortran Support + +Input Parameters: +- `mat` - the matrix +- `nblocks` - the number of blocks on the process, set with `MatSetVariableBlockSizes()` +- `bsizes` - the size of each block on the process, set with `MatSetVariableBlockSizes()` + +Output Parameter: +- `values` - the block inverses in column major order (FORTRAN-like) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatInvertBlockDiagonal()`, `MatSetVariableBlockSizes()`, `MatInvertVariableBlockEnvelope()` + +# External Links +$(_doc_external("Mat/MatInvertVariableBlockDiagonal")) +""" +function MatInvertVariableBlockDiagonal(petsclib::PetscLibType, mat::PetscMat, nblocks::PetscInt, bsizes::Vector{PetscInt}, values::Vector{PetscScalar}) end + +@for_petsc function MatInvertVariableBlockDiagonal(petsclib::$UnionPetscLib, mat::PetscMat, nblocks::$PetscInt, bsizes::Vector{$PetscInt}, values::Vector{$PetscScalar} ) + + @chk ccall( + (:MatInvertVariableBlockDiagonal, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscScalar}), + mat, nblocks, bsizes, values, + ) + + + return nothing +end + +""" + MatInvertBlockDiagonalMat(petsclib::PetscLibType,A::PetscMat, C::PetscMat) +set the values of matrix C to be the inverted block diagonal of matrix A + +Collective + +Input Parameters: +- `A` - the matrix +- `C` - matrix with inverted block diagonal of `A`. This matrix should be created and may have its type set. + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatInvertBlockDiagonal()` + +# External Links +$(_doc_external("Mat/MatInvertBlockDiagonalMat")) +""" +function MatInvertBlockDiagonalMat(petsclib::PetscLibType, A::PetscMat, C::PetscMat) end + +@for_petsc function MatInvertBlockDiagonalMat(petsclib::$UnionPetscLib, A::PetscMat, C::PetscMat ) + + @chk ccall( + (:MatInvertBlockDiagonalMat, $petsc_library), + PetscErrorCode, + (CMat, CMat), + A, C, + ) + + + return nothing +end + +""" + MatTransColoringApplySpToDen(petsclib::PetscLibType,coloring::MatTransposeColoring, B::PetscMat, Btdense::PetscMat) +Given a symbolic matrix product C = A*B^T for which +a `MatTransposeColoring` context has been created, computes a dense B^T by applying +`MatTransposeColoring` to sparse `B`. + +Collective + +Input Parameters: +- `coloring` - coloring context created with `MatTransposeColoringCreate()` +- `B` - sparse matrix + +Output Parameter: +- `Btdense` - dense matrix B^T + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatTransposeColoringCreate()`, `MatTransposeColoringDestroy()`, `MatTransColoringApplyDenToSp()` + +# External Links +$(_doc_external("Mat/MatTransColoringApplySpToDen")) +""" +function MatTransColoringApplySpToDen(petsclib::PetscLibType, coloring::MatTransposeColoring, B::PetscMat, Btdense::PetscMat) end + +@for_petsc function MatTransColoringApplySpToDen(petsclib::$UnionPetscLib, coloring::MatTransposeColoring, B::PetscMat, Btdense::PetscMat ) + + @chk ccall( + (:MatTransColoringApplySpToDen, $petsc_library), + PetscErrorCode, + (MatTransposeColoring, CMat, CMat), + coloring, B, Btdense, + ) + + + return nothing +end + +""" + MatTransColoringApplyDenToSp(petsclib::PetscLibType,matcoloring::MatTransposeColoring, Cden::PetscMat, Csp::PetscMat) +Given a symbolic matrix product C_{sp} = A*B^T for which +a `MatTransposeColoring` context has been created and a dense matrix C_{den} = A*B^T_{dense} +in which `B^T_{dens}` is obtained from `MatTransColoringApplySpToDen()`, recover sparse matrix +C_{sp} from C_{den}. + +Collective + +Input Parameters: +- `matcoloring` - coloring context created with `MatTransposeColoringCreate()` +- `Cden` - matrix product of a sparse matrix and a dense matrix Btdense + +Output Parameter: +- `Csp` - sparse matrix + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatTransposeColoringCreate()`, `MatTransposeColoringDestroy()`, `MatTransColoringApplySpToDen()` + +# External Links +$(_doc_external("Mat/MatTransColoringApplyDenToSp")) +""" +function MatTransColoringApplyDenToSp(petsclib::PetscLibType, matcoloring::MatTransposeColoring, Cden::PetscMat, Csp::PetscMat) end + +@for_petsc function MatTransColoringApplyDenToSp(petsclib::$UnionPetscLib, matcoloring::MatTransposeColoring, Cden::PetscMat, Csp::PetscMat ) + + @chk ccall( + (:MatTransColoringApplyDenToSp, $petsc_library), + PetscErrorCode, + (MatTransposeColoring, CMat, CMat), + matcoloring, Cden, Csp, + ) + + + return nothing +end + +""" + MatGetNonzeroState(petsclib::PetscLibType,mat::PetscMat, state::PetscObjectState) +Returns a 64 +matrix has had new nonzero locations added to (or removed from) the matrix since the previous call, the value will be larger. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `state` - the current state + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `PetscObjectStateGet()`, `PetscObjectGetId()` + +# External Links +$(_doc_external("Mat/MatGetNonzeroState")) +""" +function MatGetNonzeroState(petsclib::PetscLibType, mat::PetscMat, state::PetscObjectState) end + +@for_petsc function MatGetNonzeroState(petsclib::$UnionPetscLib, mat::PetscMat, state::PetscObjectState ) + + @chk ccall( + (:MatGetNonzeroState, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscObjectState}), + mat, state, + ) + + + return nothing +end + +""" + mpimat::PetscMat = MatCreateMPIMatConcatenateSeqMat(petsclib::PetscLibType,comm::MPI_Comm, seqmat::PetscMat, n::PetscInt, reuse::MatReuse) +Creates a single large PETSc matrix by concatenating sequential +matrices from each processor + +Collective + +Input Parameters: +- `comm` - the communicators the parallel matrix will live on +- `seqmat` - the input sequential matrices +- `n` - number of local columns (or `PETSC_DECIDE`) +- `reuse` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameter: +- `mpimat` - the parallel matrix generated + +Level: developer + +-seealso: [](ch_matrices), `Mat` + +# External Links +$(_doc_external("Mat/MatCreateMPIMatConcatenateSeqMat")) +""" +function MatCreateMPIMatConcatenateSeqMat(petsclib::PetscLibType, comm::MPI_Comm, seqmat::PetscMat, n::PetscInt, reuse::MatReuse) end + +@for_petsc function MatCreateMPIMatConcatenateSeqMat(petsclib::$UnionPetscLib, comm::MPI_Comm, seqmat::PetscMat, n::$PetscInt, reuse::MatReuse ) + mpimat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIMatConcatenateSeqMat, $petsc_library), + PetscErrorCode, + (MPI_Comm, CMat, $PetscInt, MatReuse, Ptr{CMat}), + comm, seqmat, n, reuse, mpimat_, + ) + + mpimat = PetscMat(mpimat_[], petsclib) + + return mpimat +end + +""" + n::PetscInt,iss::Vector{IS} = MatSubdomainsCreateCoalesce(petsclib::PetscLibType,A::PetscMat, N::PetscInt) +Creates index subdomains by coalescing adjacent MPI processes' ownership ranges. + +Collective + +Input Parameters: +- `A` - the matrix to create subdomains from +- `N` - requested number of subdomains + +Output Parameters: +- `n` - number of subdomains resulting on this MPI process +- `iss` - `IS` list with indices of subdomains on this MPI process + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `IS` + +# External Links +$(_doc_external("Mat/MatSubdomainsCreateCoalesce")) +""" +function MatSubdomainsCreateCoalesce(petsclib::PetscLibType, A::PetscMat, N::PetscInt) end + +@for_petsc function MatSubdomainsCreateCoalesce(petsclib::$UnionPetscLib, A::PetscMat, N::$PetscInt ) + n_ = Ref{$PetscInt}() + iss_ = Ref{Ptr{CIS}}() + + @chk ccall( + (:MatSubdomainsCreateCoalesce, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{CIS}}), + A, N, n_, iss_, + ) + + n = n_[] + iss = unsafe_wrap(Array, iss_[], VecGetLocalSize(petsclib, x); own = false) + + return n,iss +end + +""" + MatGalerkin(petsclib::PetscLibType,restrct::PetscMat, dA::PetscMat, interpolate::PetscMat, reuse::MatReuse, fill::PetscReal, A::PetscMat) +Constructs the coarse grid problem matrix via Galerkin projection. + +If the interpolation and restriction operators are the same, uses `MatPtAP()`. +If they are not the same, uses `MatMatMatMult()`. + +Once the coarse grid problem is constructed, correct for interpolation operators +that are not of full rank, which can legitimately happen in the case of non-nested +geometric multigrid. + +Input Parameters: +- `restrct` - restriction operator +- `dA` - fine grid matrix +- `interpolate` - interpolation operator +- `reuse` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` +- `fill` - expected fill, use `PETSC_DETERMINE` or `PETSC_DETERMINE` if you do not have a good estimate + +Output Parameter: +- `A` - the Galerkin coarse matrix + +Options Database Key: +- `-pc_mg_galerkin ` - for what matrices the Galerkin process should be used + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatPtAP()`, `MatMatMatMult()` + +# External Links +$(_doc_external("Mat/MatGalerkin")) +""" +function MatGalerkin(petsclib::PetscLibType, restrct::PetscMat, dA::PetscMat, interpolate::PetscMat, reuse::MatReuse, fill::PetscReal, A::PetscMat) end + +@for_petsc function MatGalerkin(petsclib::$UnionPetscLib, restrct::PetscMat, dA::PetscMat, interpolate::PetscMat, reuse::MatReuse, fill::$PetscReal, A::PetscMat ) + A_ = Ref(A.ptr) + + @chk ccall( + (:MatGalerkin, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, MatReuse, $PetscReal, Ptr{CMat}), + restrct, dA, interpolate, reuse, fill, A_, + ) + + A.ptr = C_NULL + + return nothing +end + +""" + has::PetscBool = MatHasOperation(petsclib::PetscLibType,mat::PetscMat, op::MatOperation) +Determines whether the given matrix supports the particular operation. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `op` - the operation, for example, `MATOP_GET_DIAGONAL` + +Output Parameter: +- `has` - either `PETSC_TRUE` or `PETSC_FALSE` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateShell()`, `MatGetOperation()`, `MatSetOperation()` + +# External Links +$(_doc_external("Mat/MatHasOperation")) +""" +function MatHasOperation(petsclib::PetscLibType, mat::PetscMat, op::MatOperation) end + +@for_petsc function MatHasOperation(petsclib::$UnionPetscLib, mat::PetscMat, op::MatOperation ) + has_ = Ref{PetscBool}() + + @chk ccall( + (:MatHasOperation, $petsc_library), + PetscErrorCode, + (CMat, MatOperation, Ptr{PetscBool}), + mat, op, has_, + ) + + has = has_[] + + return has +end + +""" + cong::PetscBool = MatHasCongruentLayouts(petsclib::PetscLibType,mat::PetscMat) +Determines whether the rows and columns layouts of the matrix are congruent + +Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `cong` - either `PETSC_TRUE` or `PETSC_FALSE` + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatSetSizes()`, `PetscLayout` + +# External Links +$(_doc_external("Mat/MatHasCongruentLayouts")) +""" +function MatHasCongruentLayouts(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatHasCongruentLayouts(petsclib::$UnionPetscLib, mat::PetscMat ) + cong_ = Ref{PetscBool}() + + @chk ccall( + (:MatHasCongruentLayouts, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + mat, cong_, + ) + + cong = cong_[] + + return cong +end + +""" + MatSetInf(petsclib::PetscLibType,A::PetscMat) + +# External Links +$(_doc_external("Mat/MatSetInf")) +""" +function MatSetInf(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSetInf(petsclib::$UnionPetscLib, A::PetscMat ) + + @chk ccall( + (:MatSetInf, $petsc_library), + PetscErrorCode, + (CMat,), + A, + ) + + + return nothing +end + +""" + graph::PetscMat = MatCreateGraph(petsclib::PetscLibType,A::PetscMat, sym::PetscBool, scale::PetscBool, filter::PetscReal, num_idx::PetscInt, index::Vector{PetscInt}) +create a scalar matrix (that is a matrix with one vertex for each block vertex in the original matrix), for use in graph algorithms +and possibly removes small values from the graph structure. + +Collective + +Input Parameters: +- `A` - the matrix +- `sym` - `PETSC_TRUE` indicates that the graph should be symmetrized +- `scale` - `PETSC_TRUE` indicates that the graph edge weights should be symmetrically scaled with the diagonal entry +- `filter` - filter value - < 0: does nothing; == 0: removes only 0.0 entries; otherwise: removes entries with abs(entries) <= value +- `num_idx` - size of 'index' array +- `index` - array of block indices to use for graph strength of connection weight + +Output Parameter: +- `graph` - the resulting graph + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `PCGAMG` + +# External Links +$(_doc_external("Mat/MatCreateGraph")) +""" +function MatCreateGraph(petsclib::PetscLibType, A::PetscMat, sym::PetscBool, scale::PetscBool, filter::PetscReal, num_idx::PetscInt, index::Vector{PetscInt}) end + +@for_petsc function MatCreateGraph(petsclib::$UnionPetscLib, A::PetscMat, sym::PetscBool, scale::PetscBool, filter::$PetscReal, num_idx::$PetscInt, index::Vector{$PetscInt} ) + graph_ = Ref{CMat}() + + @chk ccall( + (:MatCreateGraph, $petsc_library), + PetscErrorCode, + (CMat, PetscBool, PetscBool, $PetscReal, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + A, sym, scale, filter, num_idx, index, graph_, + ) + + graph = PetscMat(graph_[], petsclib) + + return graph +end + +""" + MatEliminateZeros(petsclib::PetscLibType,A::PetscMat, keep::PetscBool) +eliminate the nondiagonal zero entries in place from the nonzero structure of a sparse `Mat` in place, +meaning the same memory is used for the matrix, and no new memory is allocated. + +Collective + +Input Parameters: +- `A` - the matrix +- `keep` - if for a given row of `A`, the diagonal coefficient is zero, indicates whether it should be left in the structure or eliminated as well + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateGraph()`, `MatFilter()` + +# External Links +$(_doc_external("Mat/MatEliminateZeros")) +""" +function MatEliminateZeros(petsclib::PetscLibType, A::PetscMat, keep::PetscBool) end + +@for_petsc function MatEliminateZeros(petsclib::$UnionPetscLib, A::PetscMat, keep::PetscBool ) + + @chk ccall( + (:MatEliminateZeros, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + A, keep, + ) + + + return nothing +end + +""" + m::PetscMemType = MatGetCurrentMemType(petsclib::PetscLibType,A::PetscMat) +Get the memory location of the matrix + +Not Collective, but the result will be the same on all MPI processes + +Input Parameter: +- `A` - the matrix whose memory type we are checking + +Output Parameter: +- `m` - the memory type + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatBoundToCPU()`, `PetscMemType` + +# External Links +$(_doc_external("Mat/MatGetCurrentMemType")) +""" +function MatGetCurrentMemType(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatGetCurrentMemType(petsclib::$UnionPetscLib, A::PetscMat ) + m_ = Ref{PetscMemType}() + + @chk ccall( + (:MatGetCurrentMemType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscMemType}), + A, m_, + ) + + m = unsafe_string(m_[]) + + return m +end + +""" + MatScaLAPACKSetBlockSizes(petsclib::PetscLibType,A::PetscMat, mb::PetscInt, nb::PetscInt) +Sets the block sizes to be used for the distribution of +the `MATSCALAPACK` matrix + +Logically Collective + +Input Parameters: +- `A` - a `MATSCALAPACK` matrix +- `mb` - the row block size +- `nb` - the column block size + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATSCALAPACK`, `MatCreateScaLAPACK()`, `MatScaLAPACKGetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatScaLAPACKSetBlockSizes")) +""" +function MatScaLAPACKSetBlockSizes(petsclib::PetscLibType, A::PetscMat, mb::PetscInt, nb::PetscInt) end + +@for_petsc function MatScaLAPACKSetBlockSizes(petsclib::$UnionPetscLib, A::PetscMat, mb::$PetscInt, nb::$PetscInt ) + + @chk ccall( + (:MatScaLAPACKSetBlockSizes, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt), + A, mb, nb, + ) + + + return nothing +end + +""" + mb::PetscInt,nb::PetscInt = MatScaLAPACKGetBlockSizes(petsclib::PetscLibType,A::PetscMat) +Gets the block sizes used in the distribution of +the `MATSCALAPACK` matrix + +Not Collective + +Input Parameter: +- `A` - a `MATSCALAPACK` matrix + +Output Parameters: +- `mb` - the row block size +- `nb` - the column block size + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATSCALAPACK`, `MatCreateScaLAPACK()`, `MatScaLAPACKSetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatScaLAPACKGetBlockSizes")) +""" +function MatScaLAPACKGetBlockSizes(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatScaLAPACKGetBlockSizes(petsclib::$UnionPetscLib, A::PetscMat ) + mb_ = Ref{$PetscInt}() + nb_ = Ref{$PetscInt}() + + @chk ccall( + (:MatScaLAPACKGetBlockSizes, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}), + A, mb_, nb_, + ) + + mb = mb_[] + nb = nb_[] + + return mb,nb +end + +""" + A::PetscMat = MatCreateScaLAPACK(petsclib::PetscLibType,comm::MPI_Comm, mb::PetscInt, nb::PetscInt, M::PetscInt, N::PetscInt, rsrc::PetscInt, csrc::PetscInt) +Creates a dense parallel matrix in ScaLAPACK format +(2D block cyclic distribution) for a `MATSCALAPACK` matrix + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `mb` - row block size (or `PETSC_DECIDE` to have it set) +- `nb` - column block size (or `PETSC_DECIDE` to have it set) +- `M` - number of global rows +- `N` - number of global columns +- `rsrc` - coordinate of process that owns the first row of the distributed matrix +- `csrc` - coordinate of process that owns the first column of the distributed matrix + +Output Parameter: +- `A` - the matrix + +Options Database Key: +- `-mat_scalapack_block_sizes` - size of the blocks to use (one or two integers separated by comma) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATSCALAPACK`, `MATDENSE`, `MATELEMENTAL`, `MatCreate()`, `MatCreateDense()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatCreateScaLAPACK")) +""" +function MatCreateScaLAPACK(petsclib::PetscLibType, comm::MPI_Comm, mb::PetscInt, nb::PetscInt, M::PetscInt, N::PetscInt, rsrc::PetscInt, csrc::PetscInt) end + +@for_petsc function MatCreateScaLAPACK(petsclib::$UnionPetscLib, comm::MPI_Comm, mb::$PetscInt, nb::$PetscInt, M::$PetscInt, N::$PetscInt, rsrc::$PetscInt, csrc::$PetscInt ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateScaLAPACK, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{CMat}), + comm, mb, nb, M, N, rsrc, csrc, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatMPISELLSetPreallocation(petsclib::PetscLibType,B::PetscMat, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +Preallocates memory for a `MATMPISELL` sparse parallel matrix in sell format. +For good matrix assembly performance the user should preallocate the matrix storage by +setting the parameters `d_nz` (or `d_nnz`) and `o_nz` (or `o_nnz`). + +Collective + +Input Parameters: +- `B` - the matrix +- `d_nz` - number of nonzeros per row in DIAGONAL portion of local submatrix +(same value is used for all local rows) +- `d_nnz` - array containing the number of nonzeros in the various rows of the +DIAGONAL portion of the local submatrix (possibly different for each row) +or NULL (`PETSC_NULL_INTEGER` in Fortran), if `d_nz` is used to specify the nonzero structure. +The size of this array is equal to the number of local rows, i.e 'm'. +For matrices that will be factored, you must leave room for (and set) +the diagonal entry even if it is zero. +- `o_nz` - number of nonzeros per row in the OFF-DIAGONAL portion of local +submatrix (same value is used for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various rows of the +OFF-DIAGONAL portion of the local submatrix (possibly different for +each row) or NULL (`PETSC_NULL_INTEGER` in Fortran), if `o_nz` is used to specify the nonzero +structure. The size of this array is equal to the number +of local rows, i.e 'm'. + +Example usage: +Consider the following 8x8 matrix with 34 non-zero values, that is +assembled across 3 processors. Lets assume that proc0 owns 3 rows, +proc1 owns 3 rows, proc2 owns 2 rows. This division can be shown +as follows + +-seealso: `Mat`, `MatCreate()`, `MatCreateSeqSELL()`, `MatSetValues()`, `MatCreateSELL()`, +`MATMPISELL`, `MatGetInfo()`, `PetscSplitOwnership()`, `MATSELL` + +# External Links +$(_doc_external("Mat/MatMPISELLSetPreallocation")) +""" +function MatMPISELLSetPreallocation(petsclib::PetscLibType, B::PetscMat, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) end + +@for_petsc function MatMPISELLSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, d_nz::$PetscInt, d_nnz::Vector{$PetscInt}, o_nz::$PetscInt, o_nnz::Vector{$PetscInt} ) + + @chk ccall( + (:MatMPISELLSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}), + B, d_nz, d_nnz, o_nz, o_nnz, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreateSELL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_rlenmax::PetscInt, d_rlen::Vector{PetscInt}, o_rlenmax::PetscInt, o_rlen::Vector{PetscInt}) +Creates a sparse parallel matrix in `MATSELL` format. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if M is given). This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax. +- `n` - This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax. (or `PETSC_DECIDE` to have calculated if `N` is given) For square matrices n is almost always `m`. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) +- `d_rlenmax` - max number of nonzeros per row in DIAGONAL portion of local submatrix (same value is used for all local rows) +- `d_rlen` - array containing the number of nonzeros in the various rows of the DIAGONAL portion of the local submatrix (possibly different for each row) or `NULL`, if d_rlenmax is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e `m`. +- `o_rlenmax` - max number of nonzeros per row in the OFF-DIAGONAL portion of local submatrix (same value is used for all local rows). +- `o_rlen` - array containing the number of nonzeros in the various rows of the OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or `NULL`, if `o_rlenmax` is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e `m`. + +Output Parameter: +- `A` - the matrix + +Options Database Key: +- `-mat_sell_oneindex` - Internally use indexing starting at 1 +rather than 0. When calling `MatSetValues()`, +the user still MUST index entries starting at 0! + +Example: +Consider the following 8x8 matrix with 34 non-zero values, that is +assembled across 3 processors. Lets assume that proc0 owns 3 rows, +proc1 owns 3 rows, proc2 owns 2 rows. This division can be shown +as follows + +-seealso: `Mat`, `MATSELL`, `MatCreate()`, `MatCreateSeqSELL()`, `MatSetValues()`, `MatMPISELLSetPreallocation()`, `MATMPISELL` + +# External Links +$(_doc_external("Mat/MatCreateSELL")) +""" +function MatCreateSELL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_rlenmax::PetscInt, d_rlen::Union{Ptr,Vector{PetscInt}}, o_rlenmax::PetscInt, o_rlen::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateSELL(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, d_rlenmax::$PetscInt, d_rlen::Union{Ptr,Vector{$PetscInt}}, o_rlenmax::$PetscInt, o_rlen::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSELL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, M, N, d_rlenmax, d_rlen, o_rlenmax, o_rlen, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + colmap::Vector{PetscInt} = MatMPISELLGetSeqSELL(petsclib::PetscLibType,A::PetscMat, Ad::PetscMat, Ao::PetscMat) +Returns the local pieces of this distributed matrix + +Not Collective + +Input Parameter: +- `A` - the `MATMPISELL` matrix + +Output Parameters: +- `Ad` - The diagonal portion of `A` +- `Ao` - The off-diagonal portion of `A` +- `colmap` - An array mapping local column numbers of `Ao` to global column numbers of the parallel matrix + +Level: advanced + +-seealso: `Mat`, `MATSEQSELL`, `MATMPISELL` + +# External Links +$(_doc_external("Mat/MatMPISELLGetSeqSELL")) +""" +function MatMPISELLGetSeqSELL(petsclib::PetscLibType, A::PetscMat, Ad::PetscMat, Ao::PetscMat) end + +@for_petsc function MatMPISELLGetSeqSELL(petsclib::$UnionPetscLib, A::PetscMat, Ad::PetscMat, Ao::PetscMat ) + Ad_ = Ref(Ad.ptr) + Ao_ = Ref(Ao.ptr) + colmap_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:MatMPISELLGetSeqSELL, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}, Ptr{CMat}, Ptr{Ptr{$PetscInt}}), + A, Ad_, Ao_, colmap_, + ) + + Ad.ptr = C_NULL + Ao.ptr = C_NULL + colmap = unsafe_wrap(Array, colmap_[], VecGetLocalSize(petsclib, x); own = false) + + return colmap +end + +""" + MatMPISELLGetLocalMatCondensed(petsclib::PetscLibType,A::PetscMat, scall::MatReuse, row::IS, col::IS, A_loc::PetscMat) +Creates a `MATSEQSELL` matrix from an `MATMPISELL` matrix by +taking all its local rows and NON-ZERO columns + +Not Collective + +Input Parameters: +- `A` - the matrix +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` +- `row` - index sets of rows to extract (or `NULL`) +- `col` - index sets of columns to extract (or `NULL`) + +Output Parameter: +- `A_loc` - the local sequential matrix generated + +Level: advanced + +-seealso: `Mat`, `MATSEQSELL`, `MATMPISELL`, `MatGetOwnershipRange()`, `MatMPISELLGetLocalMat()` + +# External Links +$(_doc_external("Mat/MatMPISELLGetLocalMatCondensed")) +""" +function MatMPISELLGetLocalMatCondensed(petsclib::PetscLibType, A::PetscMat, scall::MatReuse, row::Union{Ptr,IS}, col::Union{Ptr,IS}, A_loc::PetscMat) end + +@for_petsc function MatMPISELLGetLocalMatCondensed(petsclib::$UnionPetscLib, A::PetscMat, scall::MatReuse, row::Union{Ptr,IS}, col::Union{Ptr,IS}, A_loc::PetscMat ) + A_loc_ = Ref(A_loc.ptr) + + @chk ccall( + (:MatMPISELLGetLocalMatCondensed, $petsc_library), + PetscErrorCode, + (CMat, MatReuse, Ptr{CIS}, Ptr{CIS}, Ptr{CMat}), + A, scall, row, col, A_loc_, + ) + + A_loc.ptr = C_NULL + + return nothing +end + +""" + MatSeqSELLSetPreallocation(petsclib::PetscLibType,B::PetscMat, rlenmax::PetscInt, rlen::Vector{PetscInt}) +For good matrix assembly performance +the user should preallocate the matrix storage by setting the parameter `nz` +(or the array `nnz`). + +Collective + +Input Parameters: +- `B` - The `MATSEQSELL` matrix +- `rlenmax` - number of nonzeros per row (same for all rows), ignored if `rlen` is provided +- `rlen` - array containing the number of nonzeros in the various rows (possibly different for each row) or `NULL` + +Level: intermediate + +-seealso: `Mat`, `MATSEQSELL`, `MATSELL`, `MatCreate()`, `MatCreateSELL()`, `MatSetValues()`, `MatGetInfo()` + +# External Links +$(_doc_external("Mat/MatSeqSELLSetPreallocation")) +""" +function MatSeqSELLSetPreallocation(petsclib::PetscLibType, B::PetscMat, rlenmax::PetscInt, rlen::Vector{PetscInt}) end + +@for_petsc function MatSeqSELLSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, rlenmax::$PetscInt, rlen::Vector{$PetscInt} ) + + @chk ccall( + (:MatSeqSELLSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}), + B, rlenmax, rlen, + ) + + + return nothing +end + +""" + ratio::PetscReal = MatSeqSELLGetFillRatio(petsclib::PetscLibType,A::PetscMat) +returns a ratio that indicates the irregularity of the matrix. + +Not Collective + +Input Parameter: +- `A` - a MATSEQSELL matrix + +Output Parameter: +- `ratio` - ratio of number of padded zeros to number of allocated elements + +Level: intermediate + +-seealso: `MATSEQSELL`, `MatSeqSELLGetAvgSliceWidth()` + +# External Links +$(_doc_external("Mat/MatSeqSELLGetFillRatio")) +""" +function MatSeqSELLGetFillRatio(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqSELLGetFillRatio(petsclib::$UnionPetscLib, A::PetscMat ) + ratio_ = Ref{$PetscReal}() + + @chk ccall( + (:MatSeqSELLGetFillRatio, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + A, ratio_, + ) + + ratio = ratio_[] + + return ratio +end + +""" + slicewidth::PetscInt = MatSeqSELLGetMaxSliceWidth(petsclib::PetscLibType,A::PetscMat) +returns the maximum slice width. + +Not Collective + +Input Parameter: +- `A` - a MATSEQSELL matrix + +Output Parameter: +- `slicewidth` - maximum slice width + +Level: intermediate + +-seealso: `MATSEQSELL`, `MatSeqSELLGetAvgSliceWidth()` + +# External Links +$(_doc_external("Mat/MatSeqSELLGetMaxSliceWidth")) +""" +function MatSeqSELLGetMaxSliceWidth(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqSELLGetMaxSliceWidth(petsclib::$UnionPetscLib, A::PetscMat ) + slicewidth_ = Ref{$PetscInt}() + + @chk ccall( + (:MatSeqSELLGetMaxSliceWidth, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + A, slicewidth_, + ) + + slicewidth = slicewidth_[] + + return slicewidth +end + +""" + slicewidth::PetscReal = MatSeqSELLGetAvgSliceWidth(petsclib::PetscLibType,A::PetscMat) +returns the average slice width. + +Not Collective + +Input Parameter: +- `A` - a MATSEQSELL matrix + +Output Parameter: +- `slicewidth` - average slice width + +Level: intermediate + +-seealso: `MATSEQSELL`, `MatSeqSELLGetMaxSliceWidth()` + +# External Links +$(_doc_external("Mat/MatSeqSELLGetAvgSliceWidth")) +""" +function MatSeqSELLGetAvgSliceWidth(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqSELLGetAvgSliceWidth(petsclib::$UnionPetscLib, A::PetscMat ) + slicewidth_ = Ref{$PetscReal}() + + @chk ccall( + (:MatSeqSELLGetAvgSliceWidth, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + A, slicewidth_, + ) + + slicewidth = slicewidth_[] + + return slicewidth +end + +""" + MatSeqSELLSetSliceHeight(petsclib::PetscLibType,A::PetscMat, sliceheight::PetscInt) +sets the slice height. + +Not Collective + +Input Parameters: +- `A` - a MATSEQSELL matrix +- `sliceheight` - slice height + +-seealso: `MATSEQSELL`, `MatSeqSELLGetVarSliceSize()` + +# External Links +$(_doc_external("Mat/MatSeqSELLSetSliceHeight")) +""" +function MatSeqSELLSetSliceHeight(petsclib::PetscLibType, A::PetscMat, sliceheight::PetscInt) end + +@for_petsc function MatSeqSELLSetSliceHeight(petsclib::$UnionPetscLib, A::PetscMat, sliceheight::$PetscInt ) + + @chk ccall( + (:MatSeqSELLSetSliceHeight, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + A, sliceheight, + ) + + + return nothing +end + +""" + variance::PetscReal = MatSeqSELLGetVarSliceSize(petsclib::PetscLibType,A::PetscMat) +returns the variance of the slice size. + +Not Collective + +Input Parameter: +- `A` - a MATSEQSELL matrix + +Output Parameter: +- `variance` - variance of the slice size + +Level: intermediate + +-seealso: `MATSEQSELL`, `MatSeqSELLSetSliceHeight()` + +# External Links +$(_doc_external("Mat/MatSeqSELLGetVarSliceSize")) +""" +function MatSeqSELLGetVarSliceSize(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqSELLGetVarSliceSize(petsclib::$UnionPetscLib, A::PetscMat ) + variance_ = Ref{$PetscReal}() + + @chk ccall( + (:MatSeqSELLGetVarSliceSize, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + A, variance_, + ) + + variance = variance_[] + + return variance +end + +""" + A::PetscMat = MatCreateSeqSELL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, rlenmax::PetscInt, rlen::Union{Ptr,Vector{PetscInt}}) +Creates a sparse matrix in `MATSEQSELL` format. + +Collective + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `m` - number of rows +- `n` - number of columns +- `rlenmax` - maximum number of nonzeros in a row, ignored if `rlen` is provided +- `rlen` - array containing the number of nonzeros in the various rows (possibly different for each row) or NULL + +Output Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: `Mat`, `MATSEQSELL`, `MatCreate()`, `MatCreateSELL()`, `MatSetValues()`, `MatSeqSELLSetPreallocation()`, `MATSELL`, `MATMPISELL` + +# External Links +$(_doc_external("Mat/MatCreateSeqSELL")) +""" +function MatCreateSeqSELL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, rlenmax::PetscInt, rlen::Union{Ptr, Vector{PetscInt}}) end + +@for_petsc function MatCreateSeqSELL(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, rlenmax::$PetscInt, rlen::Union{Ptr, Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqSELL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, rlenmax, rlen, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatPreallocatorPreallocate(petsclib::PetscLibType,mat::PetscMat, fill::PetscBool, A::PetscMat) +Preallocates the A matrix, using information from a `MATPREALLOCATOR` mat, optionally filling A with zeros + +Input Parameters: +- `mat` - the `MATPREALLOCATOR` preallocator matrix +- `fill` - fill the matrix with zeros +- `A` - the matrix to be preallocated + +-seealso: `MATPREALLOCATOR`, `MatXAIJSetPreallocation()` + +# External Links +$(_doc_external("Mat/MatPreallocatorPreallocate")) +""" +function MatPreallocatorPreallocate(petsclib::PetscLibType, mat::PetscMat, fill::PetscBool, A::PetscMat) end + +@for_petsc function MatPreallocatorPreallocate(petsclib::$UnionPetscLib, mat::PetscMat, fill::PetscBool, A::PetscMat ) + + @chk ccall( + (:MatPreallocatorPreallocate, $petsc_library), + PetscErrorCode, + (CMat, PetscBool, CMat), + mat, fill, A, + ) + + + return nothing +end + +""" + J::PetscMat = MatCreateConstantDiagonal(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, diag::PetscScalar) +Creates a matrix with a uniform value along the diagonal + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given). This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax. +- `n` - This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax. (or `PETSC_DECIDE` to have calculated if `N` is given) For square matrices n is almost always `m`. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if m is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if n is given) +- `diag` - the diagonal value + +Output Parameter: +- `J` - the diagonal matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatDestroy()`, `MATCONSTANTDIAGONAL`, `MatScale()`, `MatShift()`, `MatMult()`, `MatGetDiagonal()`, `MatGetFactor()`, `MatSolve()` + +# External Links +$(_doc_external("Mat/MatCreateConstantDiagonal")) +""" +function MatCreateConstantDiagonal(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, diag::PetscScalar) end + +@for_petsc function MatCreateConstantDiagonal(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, diag::$PetscScalar ) + J_ = Ref{CMat}() + + @chk ccall( + (:MatCreateConstantDiagonal, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscScalar, Ptr{CMat}), + comm, m, n, M, N, diag, J_, + ) + + J = PetscMat(J_[], petsclib) + + return J +end + +""" + value::PetscScalar = MatConstantDiagonalGetConstant(petsclib::PetscLibType,mat::PetscMat) +Get the scalar constant of a constant diagonal matrix + +Not collective + +Input Parameter: +- `mat` - a `MATCONSTANTDIAGONAL` + +Output Parameter: +- `value` - the scalar value + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatDestroy()`, `MATCONSTANTDIAGONAL` + +# External Links +$(_doc_external("Mat/MatConstantDiagonalGetConstant")) +""" +function MatConstantDiagonalGetConstant(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatConstantDiagonalGetConstant(petsclib::$UnionPetscLib, mat::PetscMat ) + value_ = Ref{$PetscScalar}() + + @chk ccall( + (:MatConstantDiagonalGetConstant, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + mat, value_, + ) + + value = value_[] + + return value +end + +""" + MatMPIBAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar}) +Creates a sparse parallel matrix in `MATBAIJ` format using the given nonzero structure and (optional) numerical values + +Collective + +Input Parameters: +- `B` - the matrix +- `bs` - the block size +- `i` - the indices into `j` for the start of each local row (starts with zero) +- `j` - the column indices for each local row (starts with zero) these must be sorted for each row +- `v` - optional values in the matrix, use `NULL` if not provided + +Level: advanced + +-seealso: `Mat`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIBAIJSetPreallocation()`, `MatCreateAIJ()`, `MATMPIAIJ`, `MatCreateMPIBAIJWithArrays()`, `MATMPIBAIJ` + +# External Links +$(_doc_external("Mat/MatMPIBAIJSetPreallocationCSR")) +""" +function MatMPIBAIJSetPreallocationCSR(petsclib::PetscLibType, B::PetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Union{Ptr,Vector{PetscScalar}}) end + +@for_petsc function MatMPIBAIJSetPreallocationCSR(petsclib::$UnionPetscLib, B::PetscMat, bs::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, v::Union{Ptr,Vector{$PetscScalar}}) + + @chk ccall( + (:MatMPIBAIJSetPreallocationCSR, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}), + B, bs, i, j, v, + ) + + + return nothing +end + +""" + MatMPIBAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +Allocates memory for a sparse parallel matrix in `MATMPIBAIJ` format +(block compressed row). + +Collective + +Input Parameters: +- `B` - the matrix +- `bs` - size of block, the blocks are ALWAYS square. One can use `MatSetBlockSizes()` to set a different row and column blocksize but the row +blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with `MatCreateVecs()` +- `d_nz` - number of block nonzeros per block row in diagonal portion of local +submatrix (same for all local rows) +- `d_nnz` - array containing the number of block nonzeros in the various block rows +of the in diagonal portion of the local (possibly different for each block +row) or `NULL`. If you plan to factor the matrix you must leave room for the diagonal entry and +set it even if it is zero. +- `o_nz` - number of block nonzeros per block row in the off-diagonal portion of local +submatrix (same for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various block rows of the +off-diagonal portion of the local submatrix (possibly different for +each block row) or `NULL`. + +If the *_nnz parameter is given then the *_nz parameter is ignored + +Options Database Keys: +- `-mat_block_size` - size of the blocks to use +- `-mat_use_hash_table ` - set hash table factor + +Level: intermediate + +-seealso: `Mat`, `MATMPIBAIJ`, `MatCreate()`, `MatCreateSeqBAIJ()`, `MatSetValues()`, `MatCreateBAIJ()`, `MatMPIBAIJSetPreallocationCSR()`, `PetscSplitOwnership()` + +# External Links +$(_doc_external("Mat/MatMPIBAIJSetPreallocation")) +""" +function MatMPIBAIJSetPreallocation(petsclib::PetscLibType, B::PetscMat, bs::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr,Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatMPIBAIJSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, bs::$PetscInt, d_nz::$PetscInt, d_nnz::Union{Ptr,Vector{$PetscInt}}, o_nz::$PetscInt, o_nnz::Union{Ptr,Vector{$PetscInt}}) + + @chk ccall( + (:MatMPIBAIJSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}), + B, bs, d_nz, d_nnz, o_nz, o_nnz, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreateBAIJ(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr,Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr,Vector{PetscInt}}) +Creates a sparse parallel matrix in `MATBAIJ` format +(block compressed row). + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bs` - size of block, the blocks are ALWAYS square. One can use `MatSetBlockSizes()` to set a different row and column blocksize but the row blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with `MatCreateVecs()` +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if M is given). This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax. +- `n` - number of local columns (or `PETSC_DECIDE` to have calculated if N is given). This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if m is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if n is given) +- `d_nz` - number of nonzero blocks per block row in diagonal portion of local submatrix (same for all local rows) +- `d_nnz` - array containing the number of nonzero blocks in the various block rows of the in diagonal portion of the local (possibly different for each block row) or NULL. If you plan to factor the matrix you must leave room for the diagonal entry and set it even if it is zero. +- `o_nz` - number of nonzero blocks per block row in the off-diagonal portion of local submatrix (same for all local rows). +- `o_nnz` - array containing the number of nonzero blocks in the various block rows of the off-diagonal portion of the local submatrix (possibly different for each block row) or NULL. + +Output Parameter: +- `A` - the matrix + +Options Database Keys: +- `-mat_block_size` - size of the blocks to use +- `-mat_use_hash_table ` - set hash table factor + +Level: intermediate + +-seealso: `Mat`, `MatCreate()`, `MatCreateSeqBAIJ()`, `MatSetValues()`, `MatMPIBAIJSetPreallocation()`, `MatMPIBAIJSetPreallocationCSR()`, +`MatGetOwnershipRange()`, `MatGetOwnershipRanges()`, `MatGetOwnershipRangeColumn()`, `MatGetOwnershipRangesColumn()`, `PetscLayout` + +# External Links +$(_doc_external("Mat/MatCreateBAIJ")) +""" +function MatCreateBAIJ(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr,Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateBAIJ(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, d_nz::$PetscInt, d_nnz::Union{Ptr,Vector{$PetscInt}}, o_nz::$PetscInt, o_nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateBAIJ, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, bs, m, n, M, N, d_nz, d_nnz, o_nz, o_nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatMPIBAIJSetHashTableFactor(petsclib::PetscLibType,mat::PetscMat, fact::PetscReal) +Sets the factor required to compute the size of the matrices hash table + +Input Parameters: +- `mat` - the matrix +- `fact` - factor + +Options Database Key: +- `-mat_use_hash_table ` - provide the factor + +Level: advanced + +-seealso: `Mat`, `MATMPIBAIJ`, `MatSetOption()` + +# External Links +$(_doc_external("Mat/MatMPIBAIJSetHashTableFactor")) +""" +function MatMPIBAIJSetHashTableFactor(petsclib::PetscLibType, mat::PetscMat, fact::PetscReal) end + +@for_petsc function MatMPIBAIJSetHashTableFactor(petsclib::$UnionPetscLib, mat::PetscMat, fact::$PetscReal ) + + @chk ccall( + (:MatMPIBAIJSetHashTableFactor, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal), + mat, fact, + ) + + + return nothing +end + +""" + colmap::Vector{PetscInt} = MatMPIBAIJGetSeqBAIJ(petsclib::PetscLibType,A::PetscMat, Ad::PetscMat, Ao::PetscMat) + +# External Links +$(_doc_external("Mat/MatMPIBAIJGetSeqBAIJ")) +""" +function MatMPIBAIJGetSeqBAIJ(petsclib::PetscLibType, A::PetscMat, Ad::PetscMat, Ao::PetscMat) end + +@for_petsc function MatMPIBAIJGetSeqBAIJ(petsclib::$UnionPetscLib, A::PetscMat, Ad::PetscMat, Ao::PetscMat ) + Ad_ = Ref(Ad.ptr) + Ao_ = Ref(Ao.ptr) + colmap_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:MatMPIBAIJGetSeqBAIJ, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}, Ptr{CMat}, Ptr{Ptr{$PetscInt}}), + A, Ad_, Ao_, colmap_, + ) + + Ad.ptr = C_NULL + Ao.ptr = C_NULL + colmap = unsafe_wrap(Array, colmap_[], VecGetLocalSize(petsclib, x); own = false) + + return colmap +end + +""" + mat::PetscMat = MatCreateMPIBAIJWithArrays(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) +creates a `MATMPIBAIJ` matrix using arrays that contain in standard block CSR format for the local rows. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bs` - the block size, only a block size of 1 is supported +- `m` - number of local rows (Cannot be `PETSC_DECIDE`) +- `n` - This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax . (or `PETSC_DECIDE` to have calculated if `N` is given) For square matrices `n` is almost always `m`. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) +- `i` - row indices; that is i[0] = 0, i[row] = i[row-1] + number of block elements in that rowth block row of the matrix +- `j` - column indices +- `a` - matrix values + +Output Parameter: +- `mat` - the matrix + +Level: intermediate + +-seealso: `Mat`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIAIJSetPreallocation()`, `MatMPIAIJSetPreallocationCSR()`, +`MATMPIAIJ`, `MatCreateAIJ()`, `MatCreateMPIAIJWithSplitArrays()` + +# External Links +$(_doc_external("Mat/MatCreateMPIBAIJWithArrays")) +""" +function MatCreateMPIBAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) end + +@for_petsc function MatCreateMPIBAIJWithArrays(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, a::Vector{$PetscScalar} ) + mat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIBAIJWithArrays, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}, Ptr{CMat}), + comm, bs, m, n, M, N, i, j, a, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + A::PetscMat = MatCreateBAIJMKL(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +Creates a sparse parallel matrix in `MATBAIJMKL` format (block compressed row). + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bs` - size of block, the blocks are ALWAYS square. One can use `MatSetBlockSizes()` to set a different row and column blocksize but the row blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with `MatCreateVecs()` +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given) This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax. +- `n` - number of local columns (or `PETSC_DECIDE` to have calculated if `N` is given) This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) +- `d_nz` - number of nonzero blocks per block row in diagonal portion of local submatrix (same for all local rows) +- `d_nnz` - array containing the number of nonzero blocks in the various block rows of the in diagonal portion of the local (possibly different for each block row) or `NULL`. If you plan to factor the matrix you must leave room for the diagonal entry and set it even if it is zero. +- `o_nz` - number of nonzero blocks per block row in the off-diagonal portion of local submatrix (same for all local rows). +- `o_nnz` - array containing the number of nonzero blocks in the various block rows of the off-diagonal portion of the local submatrix (possibly different for each block row) or `NULL`. + +Output Parameter: +- `A` - the matrix + +Options Database Keys: +- `-mat_block_size` - size of the blocks to use +- `-mat_use_hash_table ` - set hash table factor + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATBAIJMKL`, `MATBAIJ`, `MatCreate()`, `MatCreateSeqBAIJMKL()`, `MatSetValues()`, `MatMPIBAIJSetPreallocation()`, `MatMPIBAIJSetPreallocationCSR()` + +# External Links +$(_doc_external("Mat/MatCreateBAIJMKL")) +""" +function MatCreateBAIJMKL(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr,Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateBAIJMKL(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, d_nz::$PetscInt, d_nnz::Union{Ptr,Vector{$PetscInt}}, o_nz::$PetscInt, o_nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateBAIJMKL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, bs, m, n, M, N, d_nz, d_nnz, o_nz, o_nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + indices::PetscInt = MatSeqBAIJSetColumnIndices(petsclib::PetscLibType,mat::PetscMat) +Set the column indices for all the block rows in the matrix. + +Input Parameters: +- `mat` - the `MATSEQBAIJ` matrix +- `indices` - the block column indices + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSEQBAIJ`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatSeqBAIJSetColumnIndices")) +""" +function MatSeqBAIJSetColumnIndices(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatSeqBAIJSetColumnIndices(petsclib::$UnionPetscLib, mat::PetscMat ) + indices_ = Ref{$PetscInt}() + + @chk ccall( + (:MatSeqBAIJSetColumnIndices, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + mat, indices_, + ) + + indices = indices_[] + + return indices +end + +""" + array::Vector{PetscScalar} = MatSeqBAIJGetArray(petsclib::PetscLibType,A::PetscMat) +gives read/write access to the array where the data for a `MATSEQBAIJ` matrix is stored + +Not Collective + +Input Parameter: +- `A` - a `MATSEQBAIJ` matrix + +Output Parameter: +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATSEQBAIJ`, `MatSeqBAIJRestoreArray()`, `MatSeqAIJGetArray()`, `MatSeqAIJRestoreArray()` + +# External Links +$(_doc_external("Mat/MatSeqBAIJGetArray")) +""" +function MatSeqBAIJGetArray(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqBAIJGetArray(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatSeqBAIJGetArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatSeqBAIJRestoreArray(petsclib::PetscLibType,A::PetscMat) +returns access to the array where the data for a `MATSEQBAIJ` matrix is stored obtained by `MatSeqBAIJGetArray()` + +Not Collective + +Input Parameters: +- `A` - a `MATSEQBAIJ` matrix +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSeqBAIJGetArray()`, `MatSeqAIJGetArray()`, `MatSeqAIJRestoreArray()` + +# External Links +$(_doc_external("Mat/MatSeqBAIJRestoreArray")) +""" +function MatSeqBAIJRestoreArray(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqBAIJRestoreArray(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatSeqBAIJRestoreArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + A::PetscMat = MatCreateSeqBAIJ(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) +Creates a sparse matrix in `MATSEQAIJ` (block +compressed row) format. For good matrix assembly performance the +user should preallocate the matrix storage by setting the parameter `nz` +(or the array `nnz`). + +Collective + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `bs` - size of block, the blocks are ALWAYS square. One can use `MatSetBlockSizes()` to set a different row and column blocksize but the row +blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with `MatCreateVecs()` +- `m` - number of rows +- `n` - number of columns +- `nz` - number of nonzero blocks per block row (same for all rows) +- `nnz` - array containing the number of nonzero blocks in the various block rows +(possibly different for each block row) or `NULL` + +Output Parameter: +- `A` - the matrix + +Options Database Keys: +- `-mat_no_unroll` - uses code that does not unroll the loops in the block calculations (much slower) +- `-mat_block_size` - size of the blocks to use + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrices](sec_matsparse), `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatCreateBAIJ()` + +# External Links +$(_doc_external("Mat/MatCreateSeqBAIJ")) +""" +function MatCreateSeqBAIJ(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateSeqBAIJ(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqBAIJ, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, bs, m, n, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatSeqBAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) +Sets the block size and expected nonzeros +per row in the matrix. For good matrix assembly performance the +user should preallocate the matrix storage by setting the parameter `nz` +(or the array `nnz`). + +Collective + +Input Parameters: +- `B` - the matrix +- `bs` - size of block, the blocks are ALWAYS square. One can use `MatSetBlockSizes()` to set a different row and column blocksize but the row +blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with `MatCreateVecs()` +- `nz` - number of block nonzeros per block row (same for all rows) +- `nnz` - array containing the number of block nonzeros in the various block rows +(possibly different for each block row) or `NULL` + +Options Database Keys: +- `-mat_no_unroll` - uses code that does not unroll the loops in the block calculations (much slower) +- `-mat_block_size` - size of the blocks to use + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrices](sec_matsparse), `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatCreateBAIJ()`, `MatGetInfo()` + +# External Links +$(_doc_external("Mat/MatSeqBAIJSetPreallocation")) +""" +function MatSeqBAIJSetPreallocation(petsclib::PetscLibType, B::PetscMat, bs::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatSeqBAIJSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, bs::$PetscInt, nz::$PetscInt, nnz::Union{Ptr,Vector{$PetscInt}}) + + @chk ccall( + (:MatSeqBAIJSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{$PetscInt}), + B, bs, nz, nnz, + ) + + + return nothing +end + +""" + MatSeqBAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar}) +Creates a sparse sequential matrix in `MATSEQBAIJ` format using the given nonzero structure and (optional) numerical values + +Collective + +Input Parameters: +- `B` - the matrix +- `bs` - the blocksize +- `i` - the indices into `j` for the start of each local row (indices start with zero) +- `j` - the column indices for each local row (indices start with zero) these must be sorted for each row +- `v` - optional values in the matrix, use `NULL` if not provided + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateSeqBAIJ()`, `MatSetValues()`, `MatSeqBAIJSetPreallocation()`, `MATSEQBAIJ` + +# External Links +$(_doc_external("Mat/MatSeqBAIJSetPreallocationCSR")) +""" +function MatSeqBAIJSetPreallocationCSR(petsclib::PetscLibType, B::PetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Union{Ptr,Vector{PetscScalar}}) end + +@for_petsc function MatSeqBAIJSetPreallocationCSR(petsclib::$UnionPetscLib, B::PetscMat, bs::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, v::Union{Ptr,Vector{$PetscScalar}}) + + @chk ccall( + (:MatSeqBAIJSetPreallocationCSR, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}), + B, bs, i, j, v, + ) + + + return nothing +end + +""" + mat::PetscMat = MatCreateSeqBAIJWithArrays(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) +Creates a `MATSEQBAIJ` matrix using matrix elements provided by the user. + +Collective + +Input Parameters: +- `comm` - must be an MPI communicator of size 1 +- `bs` - size of block +- `m` - number of rows +- `n` - number of columns +- `i` - row indices; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row block row of the matrix +- `j` - column indices +- `a` - matrix values + +Output Parameter: +- `mat` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateBAIJ()`, `MatCreateSeqBAIJ()` + +# External Links +$(_doc_external("Mat/MatCreateSeqBAIJWithArrays")) +""" +function MatCreateSeqBAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) end + +@for_petsc function MatCreateSeqBAIJWithArrays(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, a::Vector{$PetscScalar} ) + mat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqBAIJWithArrays, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}, Ptr{CMat}), + comm, bs, m, n, i, j, a, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + A::PetscMat = MatCreateSeqBAIJMKL(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) +Creates a sparse matrix of type `MATSEQBAIJMKL`. +This type inherits from `MATSEQBAIJ` and is largely identical, but uses sparse BLAS +routines from Intel MKL whenever possible. + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `bs` - size of block, the blocks are ALWAYS square. One can use `MatSetBlockSizes()` to set a different row and column blocksize but the row blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with `MatCreateVecs()` +- `m` - number of rows +- `n` - number of columns +- `nz` - number of nonzero blocks per block row (same for all rows) +- `nnz` - array containing the number of nonzero blocks in the various block rows (possibly different for each block row) or `NULL` + +Output Parameter: +- `A` - the matrix + +It is recommended that one use the `MatCreate()`, `MatSetType()` and/or `MatSetFromOptions()`, +MatXXXXSetPreallocation() paradigm instead of this routine directly. +[MatXXXXSetPreallocation() is, for example, `MatSeqBAIJSetPreallocation()`] + +Options Database Keys: +- `-mat_no_unroll` - uses code that does not unroll the loops in the block calculations (much slower) +- `-mat_block_size` - size of the blocks to use + +Level: intermediate + +-seealso: [Sparse Matrices](sec_matsparse), `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatCreateBAIJ()` + +# External Links +$(_doc_external("Mat/MatCreateSeqBAIJMKL")) +""" +function MatCreateSeqBAIJMKL(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateSeqBAIJMKL(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqBAIJMKL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, bs, m, n, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatPythonSetType(petsclib::PetscLibType,mat::PetscMat, pyname::Vector{Cchar}) +Initialize a `Mat` object implemented in Python. + +Collective + +Input Parameters: +- `mat` - the matrix object. +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Options Database Key: +- `-mat_python_type ` - python class + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatType`, `MatCreate()`, `MatSetType()`, `MATPYTHON`, `PetscPythonInitialize()` + +# External Links +$(_doc_external("Mat/MatPythonSetType")) +""" +function MatPythonSetType(petsclib::PetscLibType, mat::PetscMat, pyname::Vector{Cchar}) end + +@for_petsc function MatPythonSetType(petsclib::$UnionPetscLib, mat::PetscMat, pyname::Vector{Cchar} ) + + @chk ccall( + (:MatPythonSetType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Cchar}), + mat, pyname, + ) + + + return nothing +end + +""" + pyname::Vector{Cchar} = MatPythonGetType(petsclib::PetscLibType,mat::PetscMat) +Get the Python name of a `Mat` object implemented in Python. + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatType`, `MatCreate()`, `MatSetType()`, `MATPYTHON`, `PetscPythonInitialize()`, `MatPythonSetType()` + +# External Links +$(_doc_external("Mat/MatPythonGetType")) +""" +function MatPythonGetType(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatPythonGetType(petsclib::$UnionPetscLib, mat::PetscMat ) + pyname_ = Ref{Ptr{Cchar}}() + + @chk ccall( + (:MatPythonGetType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{Cchar}}), + mat, pyname_, + ) + + pyname = unsafe_wrap(Array, pyname_[], VecGetLocalSize(petsclib, x); own = false) + + return pyname +end + +""" + A::PetscMat = MatPythonCreate(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, pyname::Vector{Cchar}) +Create a `Mat` object implemented in Python. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given) +- `n` - number of local columns (or `PETSC_DECIDE` to have calculated if `N` is given) +- `M` - number of global rows (or `PETSC_DECIDE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DECIDE` to have calculated if `n` is given) +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Output Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatType`, `MATPYTHON`, `MatPythonSetType()`, `PetscPythonInitialize()` + +# External Links +$(_doc_external("Mat/MatPythonCreate")) +""" +function MatPythonCreate(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, pyname::Vector{Cchar}) end + +@for_petsc function MatPythonCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, pyname::Vector{Cchar} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatPythonCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{Cchar}, Ptr{CMat}), + comm, m, n, M, N, pyname, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + newmat::PetscMat = MatCreateLocalRef(petsclib::PetscLibType,A::PetscMat, isrow::IS, iscol::IS) +Gets a logical reference to a local submatrix, for use in assembly, that is to set values into the matrix + +Not Collective + +Input Parameters: +- `A` - full matrix, generally parallel +- `isrow` - Local index set for the rows +- `iscol` - Local index set for the columns + +Output Parameter: +- `newmat` - new serial `Mat` + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATSUBMATRIX`, `MatCreateSubMatrixVirtual()`, `MatSetValuesLocal()`, `MatSetValuesBlockedLocal()`, `MatGetLocalSubMatrix()`, `MatCreateSubMatrix()` + +# External Links +$(_doc_external("Mat/MatCreateLocalRef")) +""" +function MatCreateLocalRef(petsclib::PetscLibType, A::PetscMat, isrow::IS, iscol::IS) end + +@for_petsc function MatCreateLocalRef(petsclib::$UnionPetscLib, A::PetscMat, isrow::IS, iscol::IS ) + newmat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLocalRef, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, Ptr{CMat}), + A, isrow, iscol, newmat_, + ) + + newmat = PetscMat(newmat_[], petsclib) + + return newmat +end + +""" + MatShellGetContext(petsclib::PetscLibType,mat::PetscMat, ctx::Cvoid) +Returns the user + +Not Collective + +Input Parameter: +- `mat` - the matrix, should have been created with `MatCreateShell()` + +Output Parameter: +- `ctx` - the user provided context + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellSetOperation()`, `MatShellSetContext()` + +# External Links +$(_doc_external("Mat/MatShellGetContext")) +""" +function MatShellGetContext(petsclib::PetscLibType, mat::AbstractPetscMat, ctx::Union{Cvoid,Ptr}) end + +@for_petsc function MatShellGetContext(petsclib::$UnionPetscLib, mat::Union{AbstractPetscMat,Ptr}, ctx::Union{Cvoid,Ptr,Ref}) + + @chk ccall( + (:MatShellGetContext, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Cvoid}), + mat, ctx, + ) + + return nothing +end + +""" + MatShellSetMatProductOperation(petsclib::PetscLibType,A::PetscMat, ptype::MatProductType, symbolic::external, numeric::external, destroy::external, Btype::MatType, Ctype::MatType) +Allows user to set a matrix matrix operation for a `MATSHELL` shell matrix. + +Logically Collective; No Fortran Support + +Input Parameters: +- `A` - the `MATSHELL` shell matrix +- `ptype` - the product type +- `symbolic` - the function for the symbolic phase (can be `NULL`) +- `numeric` - the function for the numerical phase +- `destroy` - the function for the destruction of the needed data generated during the symbolic phase (can be `NULL`) +- `Btype` - the matrix type for the matrix to be multiplied against +- `Ctype` - the matrix type for the result (can be `NULL`) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellGetContext()`, `MatShellGetOperation()`, `MatShellSetContext()`, `MatSetOperation()`, `MatProductType`, `MatType`, `MatSetUp()` + +# External Links +$(_doc_external("Mat/MatShellSetMatProductOperation")) +""" +function MatShellSetMatProductOperation(petsclib::PetscLibType, A::PetscMat, ptype::MatProductType, symbolic::Union{Ptr,external}, numeric::Union{Ptr,external}, destroy::Union{Ptr,external}, Btype::MatType, Ctype::Union{Ptr,MatType}) end + +@for_petsc function MatShellSetMatProductOperation(petsclib::$UnionPetscLib, A::PetscMat, ptype::MatProductType, symbolic::Union{Ptr,external}, numeric::external, destroy::Union{Ptr,external}, Btype::MatType, Ctype::Union{Ptr,MatType}) + + @chk ccall( + (:MatShellSetMatProductOperation, $petsc_library), + PetscErrorCode, + (CMat, MatProductType, external, external, external, MatType, MatType), + A, ptype, symbolic, numeric, destroy, Btype, Ctype, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreateShell(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, ctx::Ptr) +Creates a new matrix of `MatType` `MATSHELL` for use with a user +private matrix data storage format. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given) +- `n` - number of local columns (or `PETSC_DECIDE` to have calculated if `N` is given) +- `M` - number of global rows (may be `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (may be `PETSC_DETERMINE` to have calculated if `n` is given) +- `ctx` - pointer to data needed by the shell matrix routines + +Output Parameter: +- `A` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSHELL`, `MatShellSetOperation()`, `MatHasOperation()`, `MatShellGetContext()`, `MatShellSetContext()`, `MatShellSetManageScalingShifts()`, `MatShellSetMatProductOperation()` + +# External Links +$(_doc_external("Mat/MatCreateShell")) +""" +function MatCreateShell(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateShell(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, ctx::Ptr ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateShell, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{Cvoid}, Ptr{CMat}), + comm, m, n, M, N, ctx, A_, + ) + + #A = PetscMat(A_[], petsclib) + #A = MatShell{$PetscLib, OType}(A_, ctx) + + + return A +end + +""" + MatShellSetContext(petsclib::PetscLibType,mat::PetscMat, ctx::Cvoid) +sets the context for a `MATSHELL` shell matrix + +Logically Collective + +Input Parameters: +- `mat` - the `MATSHELL` shell matrix +- `ctx` - the context + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellGetContext()`, `MatShellGetOperation()` + +# External Links +$(_doc_external("Mat/MatShellSetContext")) +""" +function MatShellSetContext(petsclib::PetscLibType, mat::PetscMat, ctx::Cvoid) end + +@for_petsc function MatShellSetContext(petsclib::$UnionPetscLib, mat::PetscMat, ctx::Cvoid ) + + @chk ccall( + (:MatShellSetContext, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Cvoid}), + mat, ctx, + ) + + + return nothing +end + +""" + MatShellSetContextDestroy(petsclib::PetscLibType,mat::PetscMat, f::PetscCtxDestroyFn) +sets the destroy function for a `MATSHELL` shell matrix context + +Logically Collective + +Input Parameters: +- `mat` - the shell matrix +- `f` - the context destroy function, see `PetscCtxDestroyFn` for calling sequence + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellSetContext()`, +`PetscCtxDestroyFn` + +# External Links +$(_doc_external("Mat/MatShellSetContextDestroy")) +""" +function MatShellSetContextDestroy(petsclib::PetscLibType, mat::PetscMat, f::PetscCtxDestroyFn) end + +@for_petsc function MatShellSetContextDestroy(petsclib::$UnionPetscLib, mat::PetscMat, f::PetscCtxDestroyFn ) + + @chk ccall( + (:MatShellSetContextDestroy, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscCtxDestroyFn}), + mat, f, + ) + + + return nothing +end + +""" + MatShellSetVecType(petsclib::PetscLibType,mat::PetscMat, vtype::VecType) +Sets the `VecType` of `Vec` returned by `MatCreateVecs()` + +Logically Collective + +Input Parameters: +- `mat` - the `MATSHELL` shell matrix +- `vtype` - type to use for creating vectors + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSHELL`, `MatCreateVecs()` + +# External Links +$(_doc_external("Mat/MatShellSetVecType")) +""" +function MatShellSetVecType(petsclib::PetscLibType, mat::PetscMat, vtype::VecType) end + +@for_petsc function MatShellSetVecType(petsclib::$UnionPetscLib, mat::PetscMat, vtype::VecType ) + + @chk ccall( + (:MatShellSetVecType, $petsc_library), + PetscErrorCode, + (CMat, VecType), + mat, vtype, + ) + + + return nothing +end + +""" + MatShellSetManageScalingShifts(petsclib::PetscLibType,A::PetscMat) +Allows the user to control the scaling and shift operations of the `MATSHELL`. Must be called immediately +after `MatCreateShell()` + +Logically Collective + +Input Parameter: +- `A` - the `MATSHELL` shell matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellGetContext()`, `MatShellGetOperation()`, `MatShellSetContext()`, `MatShellSetOperation()` + +# External Links +$(_doc_external("Mat/MatShellSetManageScalingShifts")) +""" +function MatShellSetManageScalingShifts(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatShellSetManageScalingShifts(petsclib::$UnionPetscLib, A::PetscMat ) + + @chk ccall( + (:MatShellSetManageScalingShifts, $petsc_library), + PetscErrorCode, + (CMat,), + A, + ) + + + return nothing +end + +""" + flg::PetscBool = MatShellTestMult(petsclib::PetscLibType,mat::PetscMat, f::external, base::PetscVec, ctx::Cvoid) +Compares the multiply routine provided to the `MATSHELL` with differencing on a given function. + +Logically Collective; No Fortran Support + +Input Parameters: +- `mat` - the `MATSHELL` shell matrix +- `f` - the function +- `base` - differences are computed around this vector, see `MatMFFDSetBase()`, for Jacobians this is the point at which the Jacobian is being evaluated +- `ctx` - an optional context for the function + +Output Parameter: +- `flg` - `PETSC_TRUE` if the multiply is likely correct + +Options Database Key: +- `-mat_shell_test_mult_view` - print if any differences are detected between the products and print the difference + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellGetContext()`, `MatShellGetOperation()`, `MatShellTestMultTranspose()` + +# External Links +$(_doc_external("Mat/MatShellTestMult")) +""" +function MatShellTestMult(petsclib::PetscLibType, mat::PetscMat, f::external, base::PetscVec, ctx::Cvoid) end + +@for_petsc function MatShellTestMult(petsclib::$UnionPetscLib, mat::PetscMat, f::external, base::PetscVec, ctx::Cvoid ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatShellTestMult, $petsc_library), + PetscErrorCode, + (CMat, external, CVec, Ptr{Cvoid}, Ptr{PetscBool}), + mat, f, base, ctx, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatShellTestMultTranspose(petsclib::PetscLibType,mat::PetscMat, f::external, base::PetscVec, ctx::Cvoid) +Compares the multiply transpose routine provided to the `MATSHELL` with differencing on a given function. + +Logically Collective; No Fortran Support + +Input Parameters: +- `mat` - the `MATSHELL` shell matrix +- `f` - the function +- `base` - differences are computed around this vector, see `MatMFFDSetBase()`, for Jacobians this is the point at which the Jacobian is being evaluated +- `ctx` - an optional context for the function + +Output Parameter: +- `flg` - `PETSC_TRUE` if the multiply is likely correct + +Options Database Key: +- `-mat_shell_test_mult_view` - print if any differences are detected between the products and print the difference + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellGetContext()`, `MatShellGetOperation()`, `MatShellTestMult()` + +# External Links +$(_doc_external("Mat/MatShellTestMultTranspose")) +""" +function MatShellTestMultTranspose(petsclib::PetscLibType, mat::PetscMat, f::external, base::PetscVec, ctx::Cvoid) end + +@for_petsc function MatShellTestMultTranspose(petsclib::$UnionPetscLib, mat::PetscMat, f::external, base::PetscVec, ctx::Cvoid ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatShellTestMultTranspose, $petsc_library), + PetscErrorCode, + (CMat, external, CVec, Ptr{Cvoid}, Ptr{PetscBool}), + mat, f, base, ctx, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatIsShell(petsclib::PetscLibType,mat::PetscMat) +Inquires if a matrix is derived from `MATSHELL` + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `flg` - the Boolean value + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATSHELL`, `MATMFFD`, `MatCreateShell()`, `MATTRANSPOSEVIRTUAL`, `MATSCHURCOMPLEMENT` + +# External Links +$(_doc_external("Mat/MatIsShell")) +""" +function MatIsShell(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatIsShell(petsclib::$UnionPetscLib, mat::PetscMat ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsShell, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + mat, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatMAIJGetAIJ(petsclib::PetscLibType,A::PetscMat, B::PetscMat) +Get the `MATAIJ` matrix describing the blockwise action of the `MATMAIJ` matrix + +Not Collective, but if the `MATMAIJ` matrix is parallel, the `MATAIJ` matrix is also parallel + +Input Parameter: +- `A` - the `MATMAIJ` matrix + +Output Parameter: +- `B` - the `MATAIJ` matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMAIJ`, `MATAIJ`, `MatCreateMAIJ()` + +# External Links +$(_doc_external("Mat/MatMAIJGetAIJ")) +""" +function MatMAIJGetAIJ(petsclib::PetscLibType, A::PetscMat, B::PetscMat) end + +@for_petsc function MatMAIJGetAIJ(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:MatMAIJGetAIJ, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + MatMAIJRedimension(petsclib::PetscLibType,A::PetscMat, dof::PetscInt, B::PetscMat) +Get a new `MATMAIJ` matrix with the same action, but for a different block size + +Logically Collective + +Input Parameters: +- `A` - the `MATMAIJ` matrix +- `dof` - the block size for the new matrix + +Output Parameter: +- `B` - the new `MATMAIJ` matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMAIJ`, `MatCreateMAIJ()` + +# External Links +$(_doc_external("Mat/MatMAIJRedimension")) +""" +function MatMAIJRedimension(petsclib::PetscLibType, A::PetscMat, dof::PetscInt, B::PetscMat) end + +@for_petsc function MatMAIJRedimension(petsclib::$UnionPetscLib, A::PetscMat, dof::$PetscInt, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:MatMAIJRedimension, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CMat}), + A, dof, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + maij::PetscMat = MatCreateMAIJ(petsclib::PetscLibType,A::PetscMat, dof::PetscInt) +Creates a matrix type providing restriction and interpolation +operations for multicomponent problems. It interpolates each component the same +way independently. The matrix type is based on `MATSEQAIJ` for sequential matrices, +and `MATMPIAIJ` for distributed matrices. + +Collective + +Input Parameters: +- `A` - the `MATAIJ` matrix describing the action on blocks +- `dof` - the block size (number of components per node) + +Output Parameter: +- `maij` - the new `MATMAIJ` matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATAIJ`, `MATMAIJ`, `MatMAIJGetAIJ()`, `MatMAIJRedimension()` + +# External Links +$(_doc_external("Mat/MatCreateMAIJ")) +""" +function MatCreateMAIJ(petsclib::PetscLibType, A::PetscMat, dof::PetscInt) end + +@for_petsc function MatCreateMAIJ(petsclib::$UnionPetscLib, A::PetscMat, dof::$PetscInt ) + maij_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMAIJ, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CMat}), + A, dof, maij_, + ) + + maij = PetscMat(maij_[], petsclib) + + return maij +end + +""" + flg::PetscBool = MatISGetAllowRepeated(petsclib::PetscLibType,A::PetscMat) +Get the flag to allow repeated entries in the local to global map + +Not Collective + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `flg` - the boolean flag + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateIS()`, `MatSetLocalToGlobalMapping()`, `MatISSetAllowRepeated()` + +# External Links +$(_doc_external("Mat/MatISGetAllowRepeated")) +""" +function MatISGetAllowRepeated(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatISGetAllowRepeated(petsclib::$UnionPetscLib, A::PetscMat ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatISGetAllowRepeated, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + A, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatISSetAllowRepeated(petsclib::PetscLibType,A::PetscMat, flg::PetscBool) +Set the flag to allow repeated entries in the local to global map + +Logically Collective + +Input Parameters: +- `A` - the matrix +- `flg` - the boolean flag + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateIS()`, `MatSetLocalToGlobalMapping()`, `MatISGetAllowRepeated()` + +# External Links +$(_doc_external("Mat/MatISSetAllowRepeated")) +""" +function MatISSetAllowRepeated(petsclib::PetscLibType, A::PetscMat, flg::PetscBool) end + +@for_petsc function MatISSetAllowRepeated(petsclib::$UnionPetscLib, A::PetscMat, flg::PetscBool ) + + @chk ccall( + (:MatISSetAllowRepeated, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + A, flg, + ) + + + return nothing +end + +""" + MatISStoreL2L(petsclib::PetscLibType,A::PetscMat, store::PetscBool) +Store local + +Logically Collective + +Input Parameters: +- `A` - the matrix +- `store` - the boolean flag + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateIS()`, `MatISSetPreallocation()`, `MatPtAP()` + +# External Links +$(_doc_external("Mat/MatISStoreL2L")) +""" +function MatISStoreL2L(petsclib::PetscLibType, A::PetscMat, store::PetscBool) end + +@for_petsc function MatISStoreL2L(petsclib::$UnionPetscLib, A::PetscMat, store::PetscBool ) + + @chk ccall( + (:MatISStoreL2L, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + A, store, + ) + + + return nothing +end + +""" + MatISFixLocalEmpty(petsclib::PetscLibType,A::PetscMat, fix::PetscBool) +Compress out zero local rows from the local matrices + +Logically Collective + +Input Parameters: +- `A` - the matrix +- `fix` - the boolean flag + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATIS`, `MatCreate()`, `MatCreateIS()`, `MatISSetPreallocation()`, `MatAssemblyEnd()`, `MAT_FINAL_ASSEMBLY` + +# External Links +$(_doc_external("Mat/MatISFixLocalEmpty")) +""" +function MatISFixLocalEmpty(petsclib::PetscLibType, A::PetscMat, fix::PetscBool) end + +@for_petsc function MatISFixLocalEmpty(petsclib::$UnionPetscLib, A::PetscMat, fix::PetscBool ) + + @chk ccall( + (:MatISFixLocalEmpty, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + A, fix, + ) + + + return nothing +end + +""" + MatISSetPreallocation(petsclib::PetscLibType,B::PetscMat, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +Preallocates memory for a `MATIS` parallel matrix. + +Collective + +Input Parameters: +- `B` - the matrix +- `d_nz` - number of nonzeros per row in DIAGONAL portion of local submatrix +(same value is used for all local rows) +- `d_nnz` - array containing the number of nonzeros in the various rows of the +DIAGONAL portion of the local submatrix (possibly different for each row) +or `NULL`, if `d_nz` is used to specify the nonzero structure. +The size of this array is equal to the number of local rows, i.e `m`. +For matrices that will be factored, you must leave room for (and set) +the diagonal entry even if it is zero. +- `o_nz` - number of nonzeros per row in the OFF-DIAGONAL portion of local +submatrix (same value is used for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various rows of the +OFF-DIAGONAL portion of the local submatrix (possibly different for +each row) or `NULL`, if `o_nz` is used to specify the nonzero +structure. The size of this array is equal to the number +of local rows, i.e `m`. + +If the *_nnz parameter is given then the *_nz parameter is ignored + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateIS()`, `MatMPIAIJSetPreallocation()`, `MatISGetLocalMat()`, `MATIS` + +# External Links +$(_doc_external("Mat/MatISSetPreallocation")) +""" +function MatISSetPreallocation(petsclib::PetscLibType, B::PetscMat, d_nz::PetscInt, d_nnz::Union{Ptr,Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatISSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, d_nz::$PetscInt, d_nnz::Union{Ptr,Vector{$PetscInt}}, o_nz::$PetscInt, o_nnz::Union{Ptr,Vector{$PetscInt}}) + + @chk ccall( + (:MatISSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}), + B, d_nz, d_nnz, o_nz, o_nnz, + ) + + + return nothing +end + +""" + MatISGetLocalMat(petsclib::PetscLibType,mat::PetscMat, loc::PetscMat) +Gets the local matrix stored inside a `MATIS` matrix. + +Not Collective. + +Input Parameter: +- `mat` - the matrix + +Output Parameter: +- `local` - the local matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATIS`, `MatISRestoreLocalMat()` + +# External Links +$(_doc_external("Mat/MatISGetLocalMat")) +""" +function MatISGetLocalMat(petsclib::PetscLibType, mat::PetscMat, loc::PetscMat) end + +@for_petsc function MatISGetLocalMat(petsclib::$UnionPetscLib, mat::PetscMat, loc::PetscMat ) + loc_ = Ref(loc.ptr) + + @chk ccall( + (:MatISGetLocalMat, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + mat, loc_, + ) + + loc.ptr = C_NULL + + return nothing +end + +""" + MatISRestoreLocalMat(petsclib::PetscLibType,mat::PetscMat, loc::PetscMat) +Restores the local matrix obtained with `MatISGetLocalMat()` + +Not Collective. + +Input Parameters: +- `mat` - the matrix +- `local` - the local matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATIS`, `MatISGetLocalMat()` + +# External Links +$(_doc_external("Mat/MatISRestoreLocalMat")) +""" +function MatISRestoreLocalMat(petsclib::PetscLibType, mat::PetscMat, loc::PetscMat) end + +@for_petsc function MatISRestoreLocalMat(petsclib::$UnionPetscLib, mat::PetscMat, loc::PetscMat ) + loc_ = Ref(loc.ptr) + + @chk ccall( + (:MatISRestoreLocalMat, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + mat, loc_, + ) + + loc.ptr = C_NULL + + return nothing +end + +""" + MatISSetLocalMatType(petsclib::PetscLibType,mat::PetscMat, mtype::MatType) +Specifies the type of local matrix inside the `MATIS` + +Logically Collective. + +Input Parameters: +- `mat` - the matrix +- `mtype` - the local matrix type + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATIS`, `MatSetType()`, `MatType` + +# External Links +$(_doc_external("Mat/MatISSetLocalMatType")) +""" +function MatISSetLocalMatType(petsclib::PetscLibType, mat::PetscMat, mtype::MatType) end + +@for_petsc function MatISSetLocalMatType(petsclib::$UnionPetscLib, mat::PetscMat, mtype::MatType ) + + @chk ccall( + (:MatISSetLocalMatType, $petsc_library), + PetscErrorCode, + (CMat, MatType), + mat, mtype, + ) + + + return nothing +end + +""" + MatISSetLocalMat(petsclib::PetscLibType,mat::PetscMat, loc::PetscMat) +Replace the local matrix stored inside a `MATIS` object. + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `local` - the local matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATIS`, `MatISSetLocalMatType`, `MatISGetLocalMat()` + +# External Links +$(_doc_external("Mat/MatISSetLocalMat")) +""" +function MatISSetLocalMat(petsclib::PetscLibType, mat::PetscMat, loc::PetscMat) end + +@for_petsc function MatISSetLocalMat(petsclib::$UnionPetscLib, mat::PetscMat, loc::PetscMat ) + + @chk ccall( + (:MatISSetLocalMat, $petsc_library), + PetscErrorCode, + (CMat, CMat), + mat, loc, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreateIS(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, rmap::ISLocalToGlobalMapping, cmap::ISLocalToGlobalMapping) +Creates a "process" unassembled matrix. + +Collective. + +Input Parameters: +- `comm` - MPI communicator that will share the matrix +- `bs` - block size of the matrix +- `m` - local size of left vector used in matrix vector products +- `n` - local size of right vector used in matrix vector products +- `M` - global size of left vector used in matrix vector products +- `N` - global size of right vector used in matrix vector products +- `rmap` - local to global map for rows +- `cmap` - local to global map for cols + +Output Parameter: +- `A` - the resulting matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATIS`, `MatSetLocalToGlobalMapping()` + +# External Links +$(_doc_external("Mat/MatCreateIS")) +""" +function MatCreateIS(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, rmap::ISLocalToGlobalMapping, cmap::ISLocalToGlobalMapping) end + +@for_petsc function MatCreateIS(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, rmap::ISLocalToGlobalMapping, cmap::ISLocalToGlobalMapping ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateIS, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, ISLocalToGlobalMapping, ISLocalToGlobalMapping, Ptr{CMat}), + comm, bs, m, n, M, N, rmap, cmap, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatISGetLocalToGlobalMapping(petsclib::PetscLibType,A::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping) +Gets the local + +Not Collective + +Input Parameter: +- `A` - the matrix + +Output Parameters: +- `rmapping` - row mapping +- `cmapping` - column mapping + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATIS`, `MatSetLocalToGlobalMapping()` + +# External Links +$(_doc_external("Mat/MatISGetLocalToGlobalMapping")) +""" +function MatISGetLocalToGlobalMapping(petsclib::PetscLibType, A::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping) end + +@for_petsc function MatISGetLocalToGlobalMapping(petsclib::$UnionPetscLib, A::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping ) + + @chk ccall( + (:MatISGetLocalToGlobalMapping, $petsc_library), + PetscErrorCode, + (CMat, Ptr{ISLocalToGlobalMapping}, Ptr{ISLocalToGlobalMapping}), + A, rmapping, cmapping, + ) + + + return nothing +end + +""" + MatHermitianTransposeGetMat(petsclib::PetscLibType,A::PetscMat, M::PetscMat) +Gets the `Mat` object stored inside a `MATHERMITIANTRANSPOSEVIRTUAL` + +Logically Collective + +Input Parameter: +- `A` - the `MATHERMITIANTRANSPOSEVIRTUAL` matrix + +Output Parameter: +- `M` - the matrix object stored inside A + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATHERMITIANTRANSPOSEVIRTUAL`, `MatCreateHermitianTranspose()` + +# External Links +$(_doc_external("Mat/MatHermitianTransposeGetMat")) +""" +function MatHermitianTransposeGetMat(petsclib::PetscLibType, A::PetscMat, M::PetscMat) end + +@for_petsc function MatHermitianTransposeGetMat(petsclib::$UnionPetscLib, A::PetscMat, M::PetscMat ) + M_ = Ref(M.ptr) + + @chk ccall( + (:MatHermitianTransposeGetMat, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, M_, + ) + + M.ptr = C_NULL + + return nothing +end + +""" + N::PetscMat = MatCreateHermitianTranspose(petsclib::PetscLibType,A::PetscMat) +Creates a new matrix object of `MatType` `MATHERMITIANTRANSPOSEVIRTUAL` that behaves like A'* + +Collective + +Input Parameter: +- `A` - the (possibly rectangular) matrix + +Output Parameter: +- `N` - the matrix that represents A'* + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreateNormal()`, `MatMult()`, `MatMultHermitianTranspose()`, `MatCreate()`, +`MATTRANSPOSEVIRTUAL`, `MatCreateTranspose()`, `MatHermitianTransposeGetMat()`, `MATNORMAL`, `MATNORMALHERMITIAN` + +# External Links +$(_doc_external("Mat/MatCreateHermitianTranspose")) +""" +function MatCreateHermitianTranspose(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatCreateHermitianTranspose(petsclib::$UnionPetscLib, A::PetscMat ) + N_ = Ref{CMat}() + + @chk ccall( + (:MatCreateHermitianTranspose, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, N_, + ) + + N = PetscMat(N_[], petsclib) + + return N +end + +""" + MatTransposeGetMat(petsclib::PetscLibType,A::PetscMat, M::PetscMat) +Gets the `Mat` object stored inside a `MATTRANSPOSEVIRTUAL` + +Logically Collective + +Input Parameter: +- `A` - the `MATTRANSPOSEVIRTUAL` matrix + +Output Parameter: +- `M` - the matrix object stored inside `A` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATTRANSPOSEVIRTUAL`, `MatCreateTranspose()` + +# External Links +$(_doc_external("Mat/MatTransposeGetMat")) +""" +function MatTransposeGetMat(petsclib::PetscLibType, A::PetscMat, M::PetscMat) end + +@for_petsc function MatTransposeGetMat(petsclib::$UnionPetscLib, A::PetscMat, M::PetscMat ) + M_ = Ref(M.ptr) + + @chk ccall( + (:MatTransposeGetMat, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, M_, + ) + + M.ptr = C_NULL + + return nothing +end + +""" + N::PetscMat = MatCreateTranspose(petsclib::PetscLibType,A::PetscMat) +Creates a new matrix `MATTRANSPOSEVIRTUAL` object that behaves like A' + +Collective + +Input Parameter: +- `A` - the (possibly rectangular) matrix + +Output Parameter: +- `N` - the matrix that represents A' + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATTRANSPOSEVIRTUAL`, `MatCreateNormal()`, `MatMult()`, `MatMultTranspose()`, `MatCreate()`, +`MATNORMALHERMITIAN` + +# External Links +$(_doc_external("Mat/MatCreateTranspose")) +""" +function MatCreateTranspose(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatCreateTranspose(petsclib::$UnionPetscLib, A::PetscMat ) + N_ = Ref{CMat}() + + @chk ccall( + (:MatCreateTranspose, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, N_, + ) + + N = PetscMat(N_[], petsclib) + + return N +end + +""" + MatDenseGetLocalMatrix(petsclib::PetscLibType,A::PetscMat, B::PetscMat) +For a `MATMPIDENSE` or `MATSEQDENSE` matrix returns the sequential +matrix that represents the operator. For sequential matrices it returns itself. + +Input Parameter: +- `A` - the sequential or MPI `MATDENSE` matrix + +Output Parameter: +- `B` - the inner matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATMPIDENSE`, `MATSEQDENSE` + +# External Links +$(_doc_external("Mat/MatDenseGetLocalMatrix")) +""" +function MatDenseGetLocalMatrix(petsclib::PetscLibType, A::PetscMat, B::PetscMat) end + +@for_petsc function MatDenseGetLocalMatrix(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:MatDenseGetLocalMatrix, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + MatMPIDenseSetPreallocation(petsclib::PetscLibType,B::PetscMat, data::PetscScalar) +Sets the array used to store the matrix entries + +Collective + +Input Parameters: +- `B` - the matrix +- `data` - optional location of matrix data. Set to `NULL` for PETSc +to control all matrix memory allocation. + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATMPIDENSE`, `MatCreate()`, `MatCreateSeqDense()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatMPIDenseSetPreallocation")) +""" +function MatMPIDenseSetPreallocation(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatMPIDenseSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, data::Union{Ptr,$PetscScalar} ) + + @chk ccall( + (:MatMPIDenseSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscScalar), + B, data, + ) + + return nothing +end + +""" + array::PetscScalar = MatDensePlaceArray(petsclib::PetscLibType,mat::PetscMat) +Allows one to replace the array in a `MATDENSE` matrix with an +array provided by the user. This is useful to avoid copying an array +into a matrix + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `array` - the array in column major order + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseGetArray()`, `MatDenseResetArray()`, `VecPlaceArray()`, `VecGetArray()`, `VecRestoreArray()`, `VecReplaceArray()`, `VecResetArray()`, +`MatDenseReplaceArray()` + +# External Links +$(_doc_external("Mat/MatDensePlaceArray")) +""" +function MatDensePlaceArray(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatDensePlaceArray(petsclib::$UnionPetscLib, mat::PetscMat ) + array_ = Ref{$PetscScalar}() + + @chk ccall( + (:MatDensePlaceArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + mat, array_, + ) + + array = array_[] + + return array +end + +""" + MatDenseResetArray(petsclib::PetscLibType,mat::PetscMat) +Resets the matrix array to that it previously had before the call to `MatDensePlaceArray()` + +Not Collective + +Input Parameter: +- `mat` - the matrix + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseGetArray()`, `MatDensePlaceArray()`, `VecPlaceArray()`, `VecGetArray()`, `VecRestoreArray()`, `VecReplaceArray()`, `VecResetArray()` + +# External Links +$(_doc_external("Mat/MatDenseResetArray")) +""" +function MatDenseResetArray(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatDenseResetArray(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatDenseResetArray, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + array::PetscScalar = MatDenseReplaceArray(petsclib::PetscLibType,mat::PetscMat) +Allows one to replace the array in a dense matrix with an +array provided by the user. This is useful to avoid copying an array +into a matrix + +Not Collective + +Input Parameters: +- `mat` - the matrix +- `array` - the array in column major order + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatDensePlaceArray()`, `MatDenseGetArray()`, `VecReplaceArray()` + +# External Links +$(_doc_external("Mat/MatDenseReplaceArray")) +""" +function MatDenseReplaceArray(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatDenseReplaceArray(petsclib::$UnionPetscLib, mat::PetscMat ) + array_ = Ref{$PetscScalar}() + + @chk ccall( + (:MatDenseReplaceArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + mat, array_, + ) + + array = array_[] + + return array +end + +""" + A::PetscMat = MatCreateDense(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, data::Union{Ptr,Vector{PetscScalar}}) +Creates a matrix in `MATDENSE` format. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given) +- `n` - number of local columns (or `PETSC_DECIDE` to have calculated if `N` is given) +- `M` - number of global rows (or `PETSC_DECIDE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DECIDE` to have calculated if `n` is given) +- `data` - optional location of matrix data. Set data to `NULL` (`PETSC_NULL_SCALAR_ARRAY` for Fortran users) for PETSc to control all matrix memory allocation. + +Output Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatCreate()`, `MatCreateSeqDense()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatCreateDense")) +""" +function MatCreateDense(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, data::Union{Ptr,Vector{PetscScalar}}) end + +@for_petsc function MatCreateDense(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, data::Union{Ptr,Vector{$PetscScalar}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateDense, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{CMat}), + comm, m, n, M, N, data, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + lda::PetscInt = MatDenseGetLDA(petsclib::PetscLibType,A::PetscMat) +gets the leading dimension of the array returned from `MatDenseGetArray()` + +Not Collective + +Input Parameter: +- `A` - a `MATDENSE` or `MATDENSECUDA` matrix + +Output Parameter: +- `lda` - the leading dimension + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATDENSECUDA`, `MatDenseGetArray()`, `MatDenseRestoreArray()`, `MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()`, `MatDenseSetLDA()` + +# External Links +$(_doc_external("Mat/MatDenseGetLDA")) +""" +function MatDenseGetLDA(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseGetLDA(petsclib::$UnionPetscLib, A::PetscMat ) + lda_ = Ref{$PetscInt}() + + @chk ccall( + (:MatDenseGetLDA, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + A, lda_, + ) + + lda = lda_[] + + return lda +end + +""" + MatDenseSetLDA(petsclib::PetscLibType,A::PetscMat, lda::PetscInt) +Sets the leading dimension of the array used by the `MATDENSE` matrix + +Collective if the matrix layouts have not yet been setup + +Input Parameters: +- `A` - a `MATDENSE` or `MATDENSECUDA` matrix +- `lda` - the leading dimension + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATDENSECUDA`, `MatDenseGetArray()`, `MatDenseRestoreArray()`, `MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()`, `MatDenseGetLDA()` + +# External Links +$(_doc_external("Mat/MatDenseSetLDA")) +""" +function MatDenseSetLDA(petsclib::PetscLibType, A::PetscMat, lda::PetscInt) end + +@for_petsc function MatDenseSetLDA(petsclib::$UnionPetscLib, A::PetscMat, lda::$PetscInt ) + + @chk ccall( + (:MatDenseSetLDA, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + A, lda, + ) + + + return nothing +end + +""" + array::Vector{PetscScalar} = MatDenseGetArray(petsclib::PetscLibType,A::PetscMat) +gives read + +Logically Collective + +Input Parameter: +- `A` - a dense matrix + +Output Parameter: +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseRestoreArray()`, `MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()` + +# External Links +$(_doc_external("Mat/MatDenseGetArray")) +""" +function MatDenseGetArray(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseGetArray(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseGetArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatDenseRestoreArray(petsclib::PetscLibType,A::PetscMat) +returns access to the array where the data for a `MATDENSE` matrix is stored obtained by `MatDenseGetArray()` + +Logically Collective + +Input Parameters: +- `A` - a dense matrix +- `array` - pointer to the data (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseGetArray()`, `MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreArray")) +""" +function MatDenseRestoreArray(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseRestoreArray(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseRestoreArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatDenseGetArrayRead(petsclib::PetscLibType,A::PetscMat) +gives read + +Not Collective + +Input Parameter: +- `A` - a dense matrix + +Output Parameter: +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseRestoreArrayRead()`, `MatDenseGetArray()`, `MatDenseRestoreArray()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()` + +# External Links +$(_doc_external("Mat/MatDenseGetArrayRead")) +""" +function MatDenseGetArrayRead(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseGetArrayRead(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseGetArrayRead, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatDenseRestoreArrayRead(petsclib::PetscLibType,A::PetscMat) +returns access to the array where the data for a `MATDENSE` matrix is stored obtained by `MatDenseGetArrayRead()` + +Not Collective + +Input Parameters: +- `A` - a dense matrix +- `array` - pointer to the data (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseGetArrayRead()`, `MatDenseGetArray()`, `MatDenseRestoreArray()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreArrayRead")) +""" +function MatDenseRestoreArrayRead(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseRestoreArrayRead(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseRestoreArrayRead, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatDenseGetArrayWrite(petsclib::PetscLibType,A::PetscMat) +gives write + +Not Collective + +Input Parameter: +- `A` - a dense matrix + +Output Parameter: +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseRestoreArrayWrite()`, `MatDenseGetArray()`, `MatDenseRestoreArray()`, `MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()` + +# External Links +$(_doc_external("Mat/MatDenseGetArrayWrite")) +""" +function MatDenseGetArrayWrite(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseGetArrayWrite(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseGetArrayWrite, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatDenseRestoreArrayWrite(petsclib::PetscLibType,A::PetscMat) +returns access to the array where the data for a `MATDENSE` matrix is stored obtained by `MatDenseGetArrayWrite()` + +Not Collective + +Input Parameters: +- `A` - a dense matrix +- `array` - pointer to the data (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseGetArrayWrite()`, `MatDenseGetArray()`, `MatDenseRestoreArray()`, `MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreArrayWrite")) +""" +function MatDenseRestoreArrayWrite(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseRestoreArrayWrite(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseRestoreArrayWrite, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar},mtype::PetscMemType = MatDenseGetArrayAndMemType(petsclib::PetscLibType,A::PetscMat) +gives read + +Logically Collective + +Input Parameter: +- `A` - a dense matrix + +Output Parameters: +- `array` - pointer to the data +- `mtype` - memory type of the returned pointer + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseRestoreArrayAndMemType()`, `MatDenseGetArrayReadAndMemType()`, `MatDenseGetArrayWriteAndMemType()`, `MatDenseGetArrayRead()`, +`MatDenseRestoreArrayRead()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()`, `MatSeqAIJGetCSRAndMemType()` + +# External Links +$(_doc_external("Mat/MatDenseGetArrayAndMemType")) +""" +function MatDenseGetArrayAndMemType(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseGetArrayAndMemType(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + mtype_ = Ref{PetscMemType}() + + @chk ccall( + (:MatDenseGetArrayAndMemType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}, Ptr{PetscMemType}), + A, array_, mtype_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + mtype = unsafe_string(mtype_[]) + + return array,mtype +end + +""" + array::Vector{PetscScalar} = MatDenseRestoreArrayAndMemType(petsclib::PetscLibType,A::PetscMat) +returns access to the array that is obtained by `MatDenseGetArrayAndMemType()` + +Logically Collective + +Input Parameters: +- `A` - a dense matrix +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseGetArrayAndMemType()`, `MatDenseGetArray()`, `MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreArrayAndMemType")) +""" +function MatDenseRestoreArrayAndMemType(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseRestoreArrayAndMemType(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseRestoreArrayAndMemType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar},mtype::PetscMemType = MatDenseGetArrayReadAndMemType(petsclib::PetscLibType,A::PetscMat) +gives read + +Logically Collective + +Input Parameter: +- `A` - a dense matrix + +Output Parameters: +- `array` - pointer to the data +- `mtype` - memory type of the returned pointer + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseRestoreArrayReadAndMemType()`, `MatDenseGetArrayWriteAndMemType()`, +`MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()`, `MatSeqAIJGetCSRAndMemType()` + +# External Links +$(_doc_external("Mat/MatDenseGetArrayReadAndMemType")) +""" +function MatDenseGetArrayReadAndMemType(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseGetArrayReadAndMemType(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + mtype_ = Ref{PetscMemType}() + + @chk ccall( + (:MatDenseGetArrayReadAndMemType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}, Ptr{PetscMemType}), + A, array_, mtype_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + mtype = unsafe_string(mtype_[]) + + return array,mtype +end + +""" + array::Vector{PetscScalar} = MatDenseRestoreArrayReadAndMemType(petsclib::PetscLibType,A::PetscMat) +returns access to the array that is obtained by `MatDenseGetArrayReadAndMemType()` + +Logically Collective + +Input Parameters: +- `A` - a dense matrix +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseGetArrayReadAndMemType()`, `MatDenseGetArray()`, `MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreArrayReadAndMemType")) +""" +function MatDenseRestoreArrayReadAndMemType(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseRestoreArrayReadAndMemType(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseRestoreArrayReadAndMemType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar},mtype::PetscMemType = MatDenseGetArrayWriteAndMemType(petsclib::PetscLibType,A::PetscMat) +gives write + +Logically Collective + +Input Parameter: +- `A` - a dense matrix + +Output Parameters: +- `array` - pointer to the data +- `mtype` - memory type of the returned pointer + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseRestoreArrayWriteAndMemType()`, `MatDenseGetArrayReadAndMemType()`, `MatDenseGetArrayRead()`, +`MatDenseRestoreArrayRead()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()`, `MatSeqAIJGetCSRAndMemType()` + +# External Links +$(_doc_external("Mat/MatDenseGetArrayWriteAndMemType")) +""" +function MatDenseGetArrayWriteAndMemType(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseGetArrayWriteAndMemType(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + mtype_ = Ref{PetscMemType}() + + @chk ccall( + (:MatDenseGetArrayWriteAndMemType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}, Ptr{PetscMemType}), + A, array_, mtype_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + mtype = unsafe_string(mtype_[]) + + return array,mtype +end + +""" + array::Vector{PetscScalar} = MatDenseRestoreArrayWriteAndMemType(petsclib::PetscLibType,A::PetscMat) +returns access to the array that is obtained by `MatDenseGetArrayReadAndMemType()` + +Logically Collective + +Input Parameters: +- `A` - a dense matrix +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseGetArrayWriteAndMemType()`, `MatDenseGetArray()`, `MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreArrayWriteAndMemType")) +""" +function MatDenseRestoreArrayWriteAndMemType(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseRestoreArrayWriteAndMemType(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseRestoreArrayWriteAndMemType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + A::PetscMat = MatCreateSeqDense(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, data::Vector{PetscScalar}) +Creates a `MATSEQDENSE` that +is stored in column major order (the usual Fortran format). + +Collective + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `m` - number of rows +- `n` - number of columns +- `data` - optional location of matrix data in column major order. Use `NULL` for PETSc to control all matrix memory allocation. + +Output Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATSEQDENSE`, `MatCreate()`, `MatCreateDense()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatCreateSeqDense")) +""" +function MatCreateSeqDense(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, data::Union{Ptr,Vector{PetscScalar}}) end + +@for_petsc function MatCreateSeqDense(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, data::Union{Ptr,Vector{$PetscScalar}}) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqDense, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{CMat}), + comm, m, n, data, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatSeqDenseSetPreallocation(petsclib::PetscLibType,B::PetscMat, data::Vector{PetscScalar}) +Sets the array used for storing the matrix elements of a `MATSEQDENSE` matrix + +Collective + +Input Parameters: +- `B` - the matrix +- `data` - the array (or `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATSEQDENSE`, `MatCreate()`, `MatCreateDense()`, `MatSetValues()`, `MatDenseSetLDA()` + +# External Links +$(_doc_external("Mat/MatSeqDenseSetPreallocation")) +""" +function MatSeqDenseSetPreallocation(petsclib::PetscLibType, B::PetscMat, data::Vector{PetscScalar}) end + +@for_petsc function MatSeqDenseSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, data::Vector{$PetscScalar} ) + + @chk ccall( + (:MatSeqDenseSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + B, data, + ) + + + return nothing +end + +""" + vals::Vector{PetscScalar} = MatDenseGetColumn(petsclib::PetscLibType,A::PetscMat, col::PetscInt) +gives access to a column of a dense matrix. This is only the local part of the column. You MUST call `MatDenseRestoreColumn()` to avoid memory bleeding. + +Not Collective + +Input Parameters: +- `A` - a `MATSEQDENSE` or `MATMPIDENSE` matrix +- `col` - column index + +Output Parameter: +- `vals` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseRestoreColumn()`, `MatDenseGetColumnVec()` + +# External Links +$(_doc_external("Mat/MatDenseGetColumn")) +""" +function MatDenseGetColumn(petsclib::PetscLibType, A::PetscMat, col::PetscInt) end + +@for_petsc function MatDenseGetColumn(petsclib::$UnionPetscLib, A::PetscMat, col::$PetscInt ) + vals_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseGetColumn, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{Ptr{$PetscScalar}}), + A, col, vals_, + ) + + vals = unsafe_wrap(Array, vals_[], VecGetLocalSize(petsclib, x); own = false) + + return vals +end + +""" + vals::Vector{PetscScalar} = MatDenseRestoreColumn(petsclib::PetscLibType,A::PetscMat) +returns access to a column of a `MATDENSE` matrix which is returned by `MatDenseGetColumn()`. + +Not Collective + +Input Parameters: +- `A` - a `MATSEQDENSE` or `MATMPIDENSE` matrix +- `vals` - pointer to the data (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseGetColumn()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreColumn")) +""" +function MatDenseRestoreColumn(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatDenseRestoreColumn(petsclib::$UnionPetscLib, A::PetscMat ) + vals_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatDenseRestoreColumn, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, vals_, + ) + + vals = unsafe_wrap(Array, vals_[], VecGetLocalSize(petsclib, x); own = false) + + return vals +end + +""" + MatDenseGetColumnVec(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec) +Gives read + +Collective + +Input Parameters: +- `A` - the `Mat` object +- `col` - the column index + +Output Parameter: +- `v` - the vector + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATDENSECUDA`, `MATDENSEHIP`, `MatDenseGetColumnVecRead()`, `MatDenseGetColumnVecWrite()`, `MatDenseRestoreColumnVec()`, `MatDenseRestoreColumnVecRead()`, `MatDenseRestoreColumnVecWrite()`, `MatDenseGetColumn()` + +# External Links +$(_doc_external("Mat/MatDenseGetColumnVec")) +""" +function MatDenseGetColumnVec(petsclib::PetscLibType, A::PetscMat, col::PetscInt, v::PetscVec) end + +@for_petsc function MatDenseGetColumnVec(petsclib::$UnionPetscLib, A::PetscMat, col::$PetscInt, v::PetscVec ) + v_ = Ref(v.ptr) + + @chk ccall( + (:MatDenseGetColumnVec, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CVec}), + A, col, v_, + ) + + v.ptr = C_NULL + + return nothing +end + +""" + MatDenseRestoreColumnVec(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec) +Returns access to a column of a dense matrix obtained from `MatDenseGetColumnVec()`. + +Collective + +Input Parameters: +- `A` - the `Mat` object +- `col` - the column index +- `v` - the `Vec` object (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATDENSECUDA`, `MATDENSEHIP`, `MatDenseGetColumnVec()`, `MatDenseGetColumnVecRead()`, `MatDenseGetColumnVecWrite()`, `MatDenseRestoreColumnVecRead()`, `MatDenseRestoreColumnVecWrite()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreColumnVec")) +""" +function MatDenseRestoreColumnVec(petsclib::PetscLibType, A::PetscMat, col::PetscInt, v::PetscVec) end + +@for_petsc function MatDenseRestoreColumnVec(petsclib::$UnionPetscLib, A::PetscMat, col::$PetscInt, v::PetscVec ) + v_ = Ref(v.ptr) + + @chk ccall( + (:MatDenseRestoreColumnVec, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CVec}), + A, col, v_, + ) + + v.ptr = C_NULL + + return nothing +end + +""" + MatDenseGetColumnVecRead(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec) +Gives read + +Collective + +Input Parameters: +- `A` - the `Mat` object +- `col` - the column index + +Output Parameter: +- `v` - the vector + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATDENSECUDA`, `MATDENSEHIP`, `MatDenseGetColumnVec()`, `MatDenseGetColumnVecWrite()`, `MatDenseRestoreColumnVec()`, `MatDenseRestoreColumnVecRead()`, `MatDenseRestoreColumnVecWrite()` + +# External Links +$(_doc_external("Mat/MatDenseGetColumnVecRead")) +""" +function MatDenseGetColumnVecRead(petsclib::PetscLibType, A::PetscMat, col::PetscInt, v::PetscVec) end + +@for_petsc function MatDenseGetColumnVecRead(petsclib::$UnionPetscLib, A::PetscMat, col::$PetscInt, v::PetscVec ) + v_ = Ref(v.ptr) + + @chk ccall( + (:MatDenseGetColumnVecRead, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CVec}), + A, col, v_, + ) + + v.ptr = C_NULL + + return nothing +end + +""" + MatDenseRestoreColumnVecRead(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec) +Returns access to a column of a dense matrix obtained from `MatDenseGetColumnVecRead()`. + +Collective + +Input Parameters: +- `A` - the `Mat` object +- `col` - the column index +- `v` - the `Vec` object (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATDENSECUDA`, `MATDENSEHIP`, `MatDenseGetColumnVec()`, `MatDenseGetColumnVecRead()`, `MatDenseGetColumnVecWrite()`, `MatDenseRestoreColumnVec()`, `MatDenseRestoreColumnVecWrite()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreColumnVecRead")) +""" +function MatDenseRestoreColumnVecRead(petsclib::PetscLibType, A::PetscMat, col::PetscInt, v::PetscVec) end + +@for_petsc function MatDenseRestoreColumnVecRead(petsclib::$UnionPetscLib, A::PetscMat, col::$PetscInt, v::PetscVec ) + v_ = Ref(v.ptr) + + @chk ccall( + (:MatDenseRestoreColumnVecRead, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CVec}), + A, col, v_, + ) + + v.ptr = C_NULL + + return nothing +end + +""" + MatDenseGetColumnVecWrite(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec) +Gives write + +Collective + +Input Parameters: +- `A` - the `Mat` object +- `col` - the column index + +Output Parameter: +- `v` - the vector + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATDENSECUDA`, `MATDENSEHIP`, `MatDenseGetColumnVec()`, `MatDenseGetColumnVecRead()`, `MatDenseRestoreColumnVec()`, `MatDenseRestoreColumnVecRead()`, `MatDenseRestoreColumnVecWrite()` + +# External Links +$(_doc_external("Mat/MatDenseGetColumnVecWrite")) +""" +function MatDenseGetColumnVecWrite(petsclib::PetscLibType, A::PetscMat, col::PetscInt, v::PetscVec) end + +@for_petsc function MatDenseGetColumnVecWrite(petsclib::$UnionPetscLib, A::PetscMat, col::$PetscInt, v::PetscVec ) + v_ = Ref(v.ptr) + + @chk ccall( + (:MatDenseGetColumnVecWrite, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CVec}), + A, col, v_, + ) + + v.ptr = C_NULL + + return nothing +end + +""" + MatDenseRestoreColumnVecWrite(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec) +Returns access to a column of a dense matrix obtained from `MatDenseGetColumnVecWrite()`. + +Collective + +Input Parameters: +- `A` - the `Mat` object +- `col` - the column index +- `v` - the `Vec` object (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATDENSECUDA`, `MATDENSEHIP`, `MatDenseGetColumnVec()`, `MatDenseGetColumnVecRead()`, `MatDenseGetColumnVecWrite()`, `MatDenseRestoreColumnVec()`, `MatDenseRestoreColumnVecRead()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreColumnVecWrite")) +""" +function MatDenseRestoreColumnVecWrite(petsclib::PetscLibType, A::PetscMat, col::PetscInt, v::PetscVec) end + +@for_petsc function MatDenseRestoreColumnVecWrite(petsclib::$UnionPetscLib, A::PetscMat, col::$PetscInt, v::PetscVec ) + v_ = Ref(v.ptr) + + @chk ccall( + (:MatDenseRestoreColumnVecWrite, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CVec}), + A, col, v_, + ) + + v.ptr = C_NULL + + return nothing +end + +""" + MatDenseGetSubMatrix(petsclib::PetscLibType,A::PetscMat, rbegin::PetscInt, rend::PetscInt, cbegin::PetscInt, cend::PetscInt, v::PetscMat) +Gives access to a block of rows and columns of a dense matrix, represented as a `Mat`. + +Collective + +Input Parameters: +- `A` - the `Mat` object +- `rbegin` - the first global row index in the block (if `PETSC_DECIDE`, is 0) +- `rend` - the global row index past the last one in the block (if `PETSC_DECIDE`, is `M`) +- `cbegin` - the first global column index in the block (if `PETSC_DECIDE`, is 0) +- `cend` - the global column index past the last one in the block (if `PETSC_DECIDE`, is `N`) + +Output Parameter: +- `v` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATDENSECUDA`, `MATDENSEHIP`, `MatDenseGetColumnVec()`, `MatDenseRestoreColumnVec()`, `MatDenseRestoreSubMatrix()` + +# External Links +$(_doc_external("Mat/MatDenseGetSubMatrix")) +""" +function MatDenseGetSubMatrix(petsclib::PetscLibType, A::PetscMat, rbegin::PetscInt, rend::PetscInt, cbegin::PetscInt, cend::PetscInt, v::PetscMat) end + +@for_petsc function MatDenseGetSubMatrix(petsclib::$UnionPetscLib, A::PetscMat, rbegin::$PetscInt, rend::$PetscInt, cbegin::$PetscInt, cend::$PetscInt, v::PetscMat ) + v_ = Ref(v.ptr) + + @chk ccall( + (:MatDenseGetSubMatrix, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{CMat}), + A, rbegin, rend, cbegin, cend, v_, + ) + + v.ptr = C_NULL + + return nothing +end + +""" + MatDenseRestoreSubMatrix(petsclib::PetscLibType,A::PetscMat, v::PetscMat) +Returns access to a block of columns of a dense matrix obtained from `MatDenseGetSubMatrix()`. + +Collective + +Input Parameters: +- `A` - the `Mat` object +- `v` - the `Mat` object (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATDENSE`, `MATDENSECUDA`, `MATDENSEHIP`, `MatDenseGetColumnVec()`, `MatDenseRestoreColumnVec()`, `MatDenseGetSubMatrix()` + +# External Links +$(_doc_external("Mat/MatDenseRestoreSubMatrix")) +""" +function MatDenseRestoreSubMatrix(petsclib::PetscLibType, A::PetscMat, v::PetscMat) end + +@for_petsc function MatDenseRestoreSubMatrix(petsclib::$UnionPetscLib, A::PetscMat, v::PetscMat ) + v_ = Ref(v.ptr) + + @chk ccall( + (:MatDenseRestoreSubMatrix, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, v_, + ) + + v.ptr = C_NULL + + return nothing +end + +""" + MatSeqDenseInvert(petsclib::PetscLibType,A::PetscMat) + +# External Links +$(_doc_external("Mat/MatSeqDenseInvert")) +""" +function MatSeqDenseInvert(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqDenseInvert(petsclib::$UnionPetscLib, A::PetscMat ) + + @chk ccall( + (:MatSeqDenseInvert, $petsc_library), + PetscErrorCode, + (CMat,), + A, + ) + + + return nothing +end + +""" + mats::PetscMat,mat::PetscMat = MatCreateComposite(petsclib::PetscLibType,comm::MPI_Comm, nmat::PetscInt) +Creates a matrix as the sum or product of one or more matrices + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `nmat` - number of matrices to put in +- `mats` - the matrices + +Output Parameter: +- `mat` - the matrix + +Options Database Keys: +- `-mat_composite_merge` - merge in `MatAssemblyEnd()` +- `-mat_composite_merge_mvctx` - merge Mvctx of component matrices to optimize communication in `MatMult()` for ADDITIVE matrices +- `-mat_composite_merge_type` - set merge direction + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatDestroy()`, `MatMult()`, `MatCompositeAddMat()`, `MatCompositeGetMat()`, `MatCompositeMerge()`, `MatCompositeSetType()`, +`MATCOMPOSITE`, `MatCompositeType` + +# External Links +$(_doc_external("Mat/MatCreateComposite")) +""" +function MatCreateComposite(petsclib::PetscLibType, comm::MPI_Comm, nmat::PetscInt) end + +@for_petsc function MatCreateComposite(petsclib::$UnionPetscLib, comm::MPI_Comm, nmat::$PetscInt ) + mats_ = Ref{CMat}() + mat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateComposite, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{CMat}, Ptr{CMat}), + comm, nmat, mats_, mat_, + ) + + mats = PetscMat(mats_[], petsclib) + mat = PetscMat(mat_[], petsclib) + + return mats,mat +end + +""" + MatCompositeAddMat(petsclib::PetscLibType,mat::PetscMat, smat::PetscMat) +Add another matrix to a composite matrix. + +Collective + +Input Parameters: +- `mat` - the composite matrix +- `smat` - the partial matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateComposite()`, `MatCompositeGetMat()`, `MATCOMPOSITE` + +# External Links +$(_doc_external("Mat/MatCompositeAddMat")) +""" +function MatCompositeAddMat(petsclib::PetscLibType, mat::PetscMat, smat::PetscMat) end + +@for_petsc function MatCompositeAddMat(petsclib::$UnionPetscLib, mat::PetscMat, smat::PetscMat ) + + @chk ccall( + (:MatCompositeAddMat, $petsc_library), + PetscErrorCode, + (CMat, CMat), + mat, smat, + ) + + + return nothing +end + +""" + MatCompositeSetType(petsclib::PetscLibType,mat::PetscMat, type::MatCompositeType) +Indicates if the matrix is defined as the sum of a set of matrices or the product. + +Logically Collective + +Input Parameters: +- `mat` - the composite matrix +- `type` - the `MatCompositeType` to use for the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatDestroy()`, `MatMult()`, `MatCompositeAddMat()`, `MatCreateComposite()`, `MatCompositeGetType()`, `MATCOMPOSITE`, +`MatCompositeType` + +# External Links +$(_doc_external("Mat/MatCompositeSetType")) +""" +function MatCompositeSetType(petsclib::PetscLibType, mat::PetscMat, type::MatCompositeType) end + +@for_petsc function MatCompositeSetType(petsclib::$UnionPetscLib, mat::PetscMat, type::MatCompositeType ) + + @chk ccall( + (:MatCompositeSetType, $petsc_library), + PetscErrorCode, + (CMat, MatCompositeType), + mat, type, + ) + + + return nothing +end + +""" + type::MatCompositeType = MatCompositeGetType(petsclib::PetscLibType,mat::PetscMat) +Returns type of composite. + +Not Collective + +Input Parameter: +- `mat` - the composite matrix + +Output Parameter: +- `type` - type of composite + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateComposite()`, `MatCompositeSetType()`, `MATCOMPOSITE`, `MatCompositeType` + +# External Links +$(_doc_external("Mat/MatCompositeGetType")) +""" +function MatCompositeGetType(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatCompositeGetType(petsclib::$UnionPetscLib, mat::PetscMat ) + type_ = Ref{MatCompositeType}() + + @chk ccall( + (:MatCompositeGetType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatCompositeType}), + mat, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + MatCompositeSetMatStructure(petsclib::PetscLibType,mat::PetscMat, str::MatStructure) +Indicates structure of matrices in the composite matrix. + +Not Collective + +Input Parameters: +- `mat` - the composite matrix +- `str` - either `SAME_NONZERO_PATTERN`, `DIFFERENT_NONZERO_PATTERN` (default) or `SUBSET_NONZERO_PATTERN` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatAXPY()`, `MatCreateComposite()`, `MatCompositeMerge()` `MatCompositeGetMatStructure()`, `MATCOMPOSITE` + +# External Links +$(_doc_external("Mat/MatCompositeSetMatStructure")) +""" +function MatCompositeSetMatStructure(petsclib::PetscLibType, mat::PetscMat, str::MatStructure) end + +@for_petsc function MatCompositeSetMatStructure(petsclib::$UnionPetscLib, mat::PetscMat, str::MatStructure ) + + @chk ccall( + (:MatCompositeSetMatStructure, $petsc_library), + PetscErrorCode, + (CMat, MatStructure), + mat, str, + ) + + + return nothing +end + +""" + MatCompositeGetMatStructure(petsclib::PetscLibType,mat::PetscMat, str::MatStructure) +Returns the structure of matrices in the composite matrix. + +Not Collective + +Input Parameter: +- `mat` - the composite matrix + +Output Parameter: +- `str` - structure of the matrices + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateComposite()`, `MatCompositeSetMatStructure()`, `MATCOMPOSITE` + +# External Links +$(_doc_external("Mat/MatCompositeGetMatStructure")) +""" +function MatCompositeGetMatStructure(petsclib::PetscLibType, mat::PetscMat, str::MatStructure) end + +@for_petsc function MatCompositeGetMatStructure(petsclib::$UnionPetscLib, mat::PetscMat, str::MatStructure ) + + @chk ccall( + (:MatCompositeGetMatStructure, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatStructure}), + mat, str, + ) + + + return nothing +end + +""" + MatCompositeSetMergeType(petsclib::PetscLibType,mat::PetscMat, type::MatCompositeMergeType) +Sets order of `MatCompositeMerge()`. + +Logically Collective + +Input Parameters: +- `mat` - the composite matrix +- `type` - `MAT_COMPOSITE_MERGE RIGHT` (default) to start merge from right with the first added matrix (mat[0]), +`MAT_COMPOSITE_MERGE_LEFT` to start merge from left with the last added matrix (mat[nmat-1]) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateComposite()`, `MatCompositeMerge()`, `MATCOMPOSITE` + +# External Links +$(_doc_external("Mat/MatCompositeSetMergeType")) +""" +function MatCompositeSetMergeType(petsclib::PetscLibType, mat::PetscMat, type::MatCompositeMergeType) end + +@for_petsc function MatCompositeSetMergeType(petsclib::$UnionPetscLib, mat::PetscMat, type::MatCompositeMergeType ) + + @chk ccall( + (:MatCompositeSetMergeType, $petsc_library), + PetscErrorCode, + (CMat, MatCompositeMergeType), + mat, type, + ) + + + return nothing +end + +""" + MatCompositeMerge(petsclib::PetscLibType,mat::PetscMat) +Given a composite matrix, replaces it with a "regular" matrix +by summing or computing the product of all the matrices inside the composite matrix. + +Collective + +Input Parameter: +- `mat` - the composite matrix + +Options Database Keys: +- `-mat_composite_merge` - merge in `MatAssemblyEnd()` +- `-mat_composite_merge_type` - set merge direction + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatDestroy()`, `MatMult()`, `MatCompositeAddMat()`, `MatCreateComposite()`, `MatCompositeSetMatStructure()`, `MatCompositeSetMergeType()`, `MATCOMPOSITE` + +# External Links +$(_doc_external("Mat/MatCompositeMerge")) +""" +function MatCompositeMerge(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatCompositeMerge(petsclib::$UnionPetscLib, mat::PetscMat ) + + @chk ccall( + (:MatCompositeMerge, $petsc_library), + PetscErrorCode, + (CMat,), + mat, + ) + + + return nothing +end + +""" + nmat::PetscInt = MatCompositeGetNumberMat(petsclib::PetscLibType,mat::PetscMat) +Returns the number of matrices in the composite matrix. + +Not Collective + +Input Parameter: +- `mat` - the composite matrix + +Output Parameter: +- `nmat` - number of matrices in the composite matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateComposite()`, `MatCompositeGetMat()`, `MATCOMPOSITE` + +# External Links +$(_doc_external("Mat/MatCompositeGetNumberMat")) +""" +function MatCompositeGetNumberMat(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatCompositeGetNumberMat(petsclib::$UnionPetscLib, mat::PetscMat ) + nmat_ = Ref{$PetscInt}() + + @chk ccall( + (:MatCompositeGetNumberMat, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + mat, nmat_, + ) + + nmat = nmat_[] + + return nmat +end + +""" + MatCompositeGetMat(petsclib::PetscLibType,mat::PetscMat, i::PetscInt, Ai::PetscMat) +Returns the ith matrix from the composite matrix. + +Logically Collective + +Input Parameters: +- `mat` - the composite matrix +- `i` - the number of requested matrix + +Output Parameter: +- `Ai` - ith matrix in composite + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateComposite()`, `MatCompositeGetNumberMat()`, `MatCompositeAddMat()`, `MATCOMPOSITE` + +# External Links +$(_doc_external("Mat/MatCompositeGetMat")) +""" +function MatCompositeGetMat(petsclib::PetscLibType, mat::PetscMat, i::PetscInt, Ai::PetscMat) end + +@for_petsc function MatCompositeGetMat(petsclib::$UnionPetscLib, mat::PetscMat, i::$PetscInt, Ai::PetscMat ) + Ai_ = Ref(Ai.ptr) + + @chk ccall( + (:MatCompositeGetMat, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CMat}), + mat, i, Ai_, + ) + + Ai.ptr = C_NULL + + return nothing +end + +""" + scalings::PetscScalar = MatCompositeSetScalings(petsclib::PetscLibType,mat::PetscMat) +Sets separate scaling factors for component matrices. + +Logically Collective + +Input Parameters: +- `mat` - the composite matrix +- `scalings` - array of scaling factors with scalings[i] being factor of i-th matrix, for i in [0, nmat) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatScale()`, `MatDiagonalScale()`, `MATCOMPOSITE` + +# External Links +$(_doc_external("Mat/MatCompositeSetScalings")) +""" +function MatCompositeSetScalings(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatCompositeSetScalings(petsclib::$UnionPetscLib, mat::PetscMat ) + scalings_ = Ref{$PetscScalar}() + + @chk ccall( + (:MatCompositeSetScalings, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + mat, scalings_, + ) + + scalings = scalings_[] + + return scalings +end + +""" + MatLRCGetMats(petsclib::PetscLibType,N::PetscMat, A::PetscMat, U::PetscMat, c::PetscVec, V::PetscMat) +Returns the constituents of an LRC matrix + +Not collective + +Input Parameter: +- `N` - matrix of type `MATLRC` + +Output Parameters: +- `A` - the (sparse) matrix +- `U` - first dense rectangular (tall and skinny) matrix +- `c` - a sequential vector containing the diagonal of C +- `V` - second dense rectangular (tall and skinny) matrix + +Level: intermediate + +-seealso: [](ch_matrices), `MatLRCSetMats()`, `Mat`, `MATLRC`, `MatCreateLRC()` + +# External Links +$(_doc_external("Mat/MatLRCGetMats")) +""" +function MatLRCGetMats(petsclib::PetscLibType, N::PetscMat, A::PetscMat, U::PetscMat, c::PetscVec, V::PetscMat) end + +@for_petsc function MatLRCGetMats(petsclib::$UnionPetscLib, N::PetscMat, A::PetscMat, U::PetscMat, c::PetscVec, V::PetscMat ) + A_ = Ref(A.ptr) + U_ = Ref(U.ptr) + c_ = Ref(c.ptr) + V_ = Ref(V.ptr) + + @chk ccall( + (:MatLRCGetMats, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}, Ptr{CMat}, Ptr{CVec}, Ptr{CMat}), + N, A_, U_, c_, V_, + ) + + A.ptr = C_NULL + U.ptr = C_NULL + c.ptr = C_NULL + V.ptr = C_NULL + + return nothing +end + +""" + MatLRCSetMats(petsclib::PetscLibType,N::PetscMat, A::PetscMat, U::PetscMat, c::PetscVec, V::PetscMat) +Sets the constituents of an LRC matrix + +Logically collective + +Input Parameters: +- `N` - matrix of type `MATLRC` +- `A` - the (sparse) matrix +- `U` - first dense rectangular (tall and skinny) matrix +- `c` - a sequential vector containing the diagonal of C +- `V` - second dense rectangular (tall and skinny) matrix + +Level: intermediate + +-seealso: [](ch_matrices), `MatLRCGetMats()`, `Mat`, `MATLRC`, `MatCreateLRC()` + +# External Links +$(_doc_external("Mat/MatLRCSetMats")) +""" +function MatLRCSetMats(petsclib::PetscLibType, N::PetscMat, A::PetscMat, U::PetscMat, c::PetscVec, V::PetscMat) end + +@for_petsc function MatLRCSetMats(petsclib::$UnionPetscLib, N::PetscMat, A::PetscMat, U::PetscMat, c::PetscVec, V::PetscMat ) + + @chk ccall( + (:MatLRCSetMats, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, CVec, CMat), + N, A, U, c, V, + ) + + + return nothing +end + +""" + N::PetscMat = MatCreateLRC(petsclib::PetscLibType,A::PetscMat, U::PetscMat, c::PetscVec, V::PetscMat) +Creates a new matrix object that behaves like A + U*C*V' of type `MATLRC` + +Collective + +Input Parameters: +- `A` - the (sparse) matrix (can be `NULL`) +- `U` - dense rectangular (tall and skinny) matrix +- `V` - dense rectangular (tall and skinny) matrix +- `c` - a vector containing the diagonal of C (can be `NULL`) + +Output Parameter: +- `N` - the matrix that represents A + U*C*V' + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATLRC`, `MatLRCGetMats()` + +# External Links +$(_doc_external("Mat/MatCreateLRC")) +""" +function MatCreateLRC(petsclib::PetscLibType, A::PetscMat, U::PetscMat, c::Union{Ptr,PetscVec}, V::PetscMat) end + +@for_petsc function MatCreateLRC(petsclib::$UnionPetscLib, A::PetscMat, U::PetscMat, c::Union{Ptr,PetscVec}, V::PetscMat ) + N_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLRC, $petsc_library), + PetscErrorCode, + (CMat, CMat, CVec, CMat, Ptr{CMat}), + A, U, c, V, N_, + ) + + N = PetscMat(N_[], petsclib) + + return N +end + +""" + J::PetscMat = MatCreateMFFD(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt) +Creates a matrix +approximately multiply a vector by the matrix (Jacobian) . See also `MatCreateSNESMF()` + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given). This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax. +- `n` - This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax. (or `PETSC_DECIDE` to have calculated if `N` is given) For square matrices `n` is almost always `m`. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) + +Output Parameter: +- `J` - the matrix-free matrix + +Options Database Keys: +- `-mat_mffd_type` - wp or ds (see `MATMFFD_WP` or `MATMFFD_DS`) +- `-mat_mffd_err` - square root of estimated relative error in function evaluation +- `-mat_mffd_period` - how often h is recomputed, defaults to 1, every time +- `-mat_mffd_check_positivity` - possibly decrease `h` until U + h*a has only positive values +- `-mat_mffd_umin ` - Sets umin (for default PETSc routine that computes h only) +- `-mat_mffd_complex` - use the Lyness trick with complex numbers to compute the matrix-vector product instead of differencing (requires real valued functions but that PETSc be configured for complex numbers) +- `-snes_mf` - use the finite difference based matrix-free matrix with `SNESSolve()` and no preconditioner +- `-snes_mf_operator` - use the finite difference based matrix-free matrix with `SNESSolve()` but construct a preconditioner +using the matrix passed as `pmat` to `SNESSetJacobian()`. + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatDestroy()`, `MatMFFDSetFunctionError()`, `MatMFFDDSSetUmin()`, `MatMFFDSetFunction()` +`MatMFFDSetHHistory()`, `MatMFFDResetHHistory()`, `MatCreateSNESMF()`, `MatCreateShell()`, `MATSHELL`, +`MatMFFDGetH()`, `MatMFFDRegister()`, `MatMFFDComputeJacobian()` + +# External Links +$(_doc_external("Mat/MatCreateMFFD")) +""" +function MatCreateMFFD(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateMFFD(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt ) + J_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMFFD, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{CMat}), + comm, m, n, M, N, J_, + ) + + J = PetscMat(J_[], petsclib) + + return J +end + +""" + MatMPISBAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +For good matrix assembly performance +the user should preallocate the matrix storage by setting the parameters +d_nz (or d_nnz) and o_nz (or o_nnz). By setting these parameters accurately, +performance can be increased by more than a factor of 50. + +Collective + +Input Parameters: +- `B` - the matrix +- `bs` - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row +blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() +- `d_nz` - number of block nonzeros per block row in diagonal portion of local +submatrix (same for all local rows) +- `d_nnz` - array containing the number of block nonzeros in the various block rows +in the upper triangular and diagonal part of the in diagonal portion of the local +(possibly different for each block row) or `NULL`. If you plan to factor the matrix you must leave room +for the diagonal entry and set a value even if it is zero. +- `o_nz` - number of block nonzeros per block row in the off-diagonal portion of local +submatrix (same for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various block rows of the +off-diagonal portion of the local submatrix that is right of the diagonal +(possibly different for each block row) or `NULL`. + +Options Database Keys: +- `-mat_no_unroll` - uses code that does not unroll the loops in the +block calculations (much slower) +- `-mat_block_size` - size of the blocks to use + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATMPISBAIJ`, `MATSBAIJ`, `MatCreate()`, `MatCreateSeqSBAIJ()`, `MatSetValues()`, `MatCreateBAIJ()`, `PetscSplitOwnership()` + +# External Links +$(_doc_external("Mat/MatMPISBAIJSetPreallocation")) +""" +function MatMPISBAIJSetPreallocation(petsclib::PetscLibType, B::PetscMat, bs::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) end + +@for_petsc function MatMPISBAIJSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, bs::$PetscInt, d_nz::$PetscInt, d_nnz::Vector{$PetscInt}, o_nz::$PetscInt, o_nnz::Vector{$PetscInt} ) + + @chk ccall( + (:MatMPISBAIJSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}), + B, bs, d_nz, d_nnz, o_nz, o_nnz, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreateSBAIJ(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +Creates a sparse parallel matrix in symmetric block AIJ format, `MATSBAIJ`, +(block compressed row). For good matrix assembly performance +the user should preallocate the matrix storage by setting the parameters +`d_nz` (or `d_nnz`) and `o_nz` (or `o_nnz`). + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bs` - size of block, the blocks are ALWAYS square. One can use `MatSetBlockSizes()` to set a different row and column blocksize but the row blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with `MatCreateVecs()` +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given) This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax. +- `n` - number of local columns (or `PETSC_DECIDE` to have calculated if `N` is given) This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) +- `d_nz` - number of block nonzeros per block row in diagonal portion of local submatrix (same for all local rows) +- `d_nnz` - array containing the number of block nonzeros in the various block rows in the upper triangular portion of the in diagonal portion of the local (possibly different for each block block row) or `NULL`. If you plan to factor the matrix you must leave room for the diagonal entry and set its value even if it is zero. +- `o_nz` - number of block nonzeros per block row in the off-diagonal portion of local submatrix (same for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various block rows of the off-diagonal portion of the local submatrix (possibly different for each block row) or `NULL`. + +Output Parameter: +- `A` - the matrix + +Options Database Keys: +- `-mat_no_unroll` - uses code that does not unroll the loops in the block calculations (much slower) +- `-mat_block_size` - size of the blocks to use +- `-mat_mpi` - use the parallel matrix data structures even on one processor (defaults to using SeqBAIJ format on one processor) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATSBAIJ`, `MatCreate()`, `MatCreateSeqSBAIJ()`, `MatSetValues()`, `MatCreateBAIJ()`, +`MatGetOwnershipRange()`, `MatGetOwnershipRanges()`, `MatGetOwnershipRangeColumn()`, `MatGetOwnershipRangesColumn()`, `PetscLayout` + +# External Links +$(_doc_external("Mat/MatCreateSBAIJ")) +""" +function MatCreateSBAIJ(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr,Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateSBAIJ(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, d_nz::$PetscInt, d_nnz::Union{Ptr,Vector{$PetscInt}}, o_nz::$PetscInt, o_nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSBAIJ, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, bs, m, n, M, N, d_nz, d_nnz, o_nz, o_nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + mat::PetscMat = MatCreateMPISBAIJWithArrays(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) +creates a `MATMPISBAIJ` matrix using arrays that contain in standard CSR format for the local rows. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `bs` - the block size, only a block size of 1 is supported +- `m` - number of local rows (Cannot be `PETSC_DECIDE`) +- `n` - This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax . (or `PETSC_DECIDE` to have calculated if `N` is given) For square matrices `n` is almost always `m`. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) +- `i` - row indices; that is i[0] = 0, i[row] = i[row-1] + number of block elements in that row block row of the matrix +- `j` - column indices +- `a` - matrix values + +Output Parameter: +- `mat` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATMPISBAIJ`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIAIJSetPreallocation()`, `MatMPIAIJSetPreallocationCSR()`, +`MATMPIAIJ`, `MatCreateAIJ()`, `MatCreateMPIAIJWithSplitArrays()`, `MatMPISBAIJSetPreallocationCSR()` + +# External Links +$(_doc_external("Mat/MatCreateMPISBAIJWithArrays")) +""" +function MatCreateMPISBAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) end + +@for_petsc function MatCreateMPISBAIJWithArrays(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, a::Vector{$PetscScalar} ) + mat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPISBAIJWithArrays, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}, Ptr{CMat}), + comm, bs, m, n, M, N, i, j, a, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + MatMPISBAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar}) +Creates a sparse parallel matrix in `MATMPISBAIJ` format using the given nonzero structure and (optional) numerical values + +Collective + +Input Parameters: +- `B` - the matrix +- `bs` - the block size +- `i` - the indices into `j` for the start of each local row (indices start with zero) +- `j` - the column indices for each local row (indices start with zero) these must be sorted for each row +- `v` - optional values in the matrix, pass `NULL` if not provided + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMPISBAIJ`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIBAIJSetPreallocation()`, `MatCreateAIJ()`, `MATMPIAIJ`, +`MatCreateMPISBAIJWithArrays()` + +# External Links +$(_doc_external("Mat/MatMPISBAIJSetPreallocationCSR")) +""" +function MatMPISBAIJSetPreallocationCSR(petsclib::PetscLibType, B::PetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar}) end + +@for_petsc function MatMPISBAIJSetPreallocationCSR(petsclib::$UnionPetscLib, B::PetscMat, bs::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, v::Vector{$PetscScalar} ) + + @chk ccall( + (:MatMPISBAIJSetPreallocationCSR, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}), + B, bs, i, j, v, + ) + + + return nothing +end + +""" + indices::PetscInt = MatSeqSBAIJSetColumnIndices(petsclib::PetscLibType,mat::PetscMat) +Set the column indices for all the rows +in a `MATSEQSBAIJ` matrix. + +Input Parameters: +- `mat` - the `MATSEQSBAIJ` matrix +- `indices` - the column indices + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSEQSBAIJ`, `MatCreateSeqSBAIJ` + +# External Links +$(_doc_external("Mat/MatSeqSBAIJSetColumnIndices")) +""" +function MatSeqSBAIJSetColumnIndices(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatSeqSBAIJSetColumnIndices(petsclib::$UnionPetscLib, mat::PetscMat ) + indices_ = Ref{$PetscInt}() + + @chk ccall( + (:MatSeqSBAIJSetColumnIndices, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + mat, indices_, + ) + + indices = indices_[] + + return indices +end + +""" + array::Vector{PetscScalar} = MatSeqSBAIJGetArray(petsclib::PetscLibType,A::PetscMat) +gives access to the array where the numerical data for a `MATSEQSBAIJ` matrix is stored + +Not Collective + +Input Parameter: +- `A` - a `MATSEQSBAIJ` matrix + +Output Parameter: +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATSEQSBAIJ`, `MatSeqSBAIJRestoreArray()`, `MatSeqAIJGetArray()`, `MatSeqAIJRestoreArray()` + +# External Links +$(_doc_external("Mat/MatSeqSBAIJGetArray")) +""" +function MatSeqSBAIJGetArray(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqSBAIJGetArray(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatSeqSBAIJGetArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatSeqSBAIJRestoreArray(petsclib::PetscLibType,A::PetscMat) +returns access to the array where the numerical data for a `MATSEQSBAIJ` matrix is stored obtained by `MatSeqSBAIJGetArray()` + +Not Collective + +Input Parameters: +- `A` - a `MATSEQSBAIJ` matrix +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATSEQSBAIJ`, `MatSeqSBAIJGetArray()`, `MatSeqAIJGetArray()`, `MatSeqAIJRestoreArray()` + +# External Links +$(_doc_external("Mat/MatSeqSBAIJRestoreArray")) +""" +function MatSeqSBAIJRestoreArray(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqSBAIJRestoreArray(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatSeqSBAIJRestoreArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + MatSeqSBAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) +Creates a sparse symmetric matrix in block AIJ (block +compressed row) `MATSEQSBAIJ` format. For good matrix assembly performance the +user should preallocate the matrix storage by setting the parameter `nz` +(or the array `nnz`). + +Collective + +Input Parameters: +- `B` - the symmetric matrix +- `bs` - size of block, the blocks are ALWAYS square. One can use `MatSetBlockSizes()` to set a different row and column blocksize but the row +blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with `MatCreateVecs()` +- `nz` - number of block nonzeros per block row (same for all rows) +- `nnz` - array containing the number of block nonzeros in the upper triangular plus +diagonal portion of each block (possibly different for each block row) or `NULL` + +Options Database Keys: +- `-mat_no_unroll` - uses code that does not unroll the loops in the block calculations (much slower) +- `-mat_block_size` - size of the blocks to use (only works if a negative bs is passed in + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrices](sec_matsparse), `MATSEQSBAIJ`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatCreateSBAIJ()` + +# External Links +$(_doc_external("Mat/MatSeqSBAIJSetPreallocation")) +""" +function MatSeqSBAIJSetPreallocation(petsclib::PetscLibType, B::PetscMat, bs::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) end + +@for_petsc function MatSeqSBAIJSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, bs::$PetscInt, nz::$PetscInt, nnz::Vector{$PetscInt} ) + + @chk ccall( + (:MatSeqSBAIJSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{$PetscInt}), + B, bs, nz, nnz, + ) + + + return nothing +end + +""" + MatSeqSBAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar}) +Creates a sparse parallel matrix in `MATSEQSBAIJ` format using the given nonzero structure and (optional) numerical values + +Input Parameters: +- `B` - the matrix +- `bs` - size of block, the blocks are ALWAYS square. +- `i` - the indices into `j` for the start of each local row (indices start with zero) +- `j` - the column indices for each local row (indices start with zero) these must be sorted for each row +- `v` - optional values in the matrix, use `NULL` if not provided + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSEQSBAIJ`, `MatCreate()`, `MatCreateSeqSBAIJ()`, `MatSetValuesBlocked()`, `MatSeqSBAIJSetPreallocation()` + +# External Links +$(_doc_external("Mat/MatSeqSBAIJSetPreallocationCSR")) +""" +function MatSeqSBAIJSetPreallocationCSR(petsclib::PetscLibType, B::PetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar}) end + +@for_petsc function MatSeqSBAIJSetPreallocationCSR(petsclib::$UnionPetscLib, B::PetscMat, bs::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, v::Vector{$PetscScalar} ) + + @chk ccall( + (:MatSeqSBAIJSetPreallocationCSR, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}), + B, bs, i, j, v, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreateSeqSBAIJ(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) +Creates a sparse symmetric matrix in (block +compressed row) `MATSEQSBAIJ` format. For good matrix assembly performance the +user should preallocate the matrix storage by setting the parameter `nz` +(or the array `nnz`). + +Collective + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `bs` - size of block, the blocks are ALWAYS square. One can use `MatSetBlockSizes()` to set a different row and column blocksize but the row blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() +- `m` - number of rows +- `n` - number of columns +- `nz` - number of block nonzeros per block row (same for all rows) +- `nnz` - array containing the number of block nonzeros in the upper triangular plus diagonal portion of each block (possibly different for each block row) or `NULL` + +Output Parameter: +- `A` - the symmetric matrix + +Options Database Keys: +- `-mat_no_unroll` - uses code that does not unroll the loops in the block calculations (much slower) +- `-mat_block_size` - size of the blocks to use + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrices](sec_matsparse), `MATSEQSBAIJ`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatCreateSBAIJ()` + +# External Links +$(_doc_external("Mat/MatCreateSeqSBAIJ")) +""" +function MatCreateSeqSBAIJ(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateSeqSBAIJ(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqSBAIJ, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, bs, m, n, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + mat::PetscMat = MatCreateSeqSBAIJWithArrays(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) +Creates an sequential `MATSEQSBAIJ` matrix using matrix elements +(upper triangular entries in CSR format) provided by the user. + +Collective + +Input Parameters: +- `comm` - must be an MPI communicator of size 1 +- `bs` - size of block +- `m` - number of rows +- `n` - number of columns +- `i` - row indices; that is i[0] = 0, i[row] = i[row-1] + number of block elements in that row block row of the matrix +- `j` - column indices +- `a` - matrix values + +Output Parameter: +- `mat` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSEQSBAIJ`, `MatCreate()`, `MatCreateSBAIJ()`, `MatCreateSeqSBAIJ()` + +# External Links +$(_doc_external("Mat/MatCreateSeqSBAIJWithArrays")) +""" +function MatCreateSeqSBAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) end + +@for_petsc function MatCreateSeqSBAIJWithArrays(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, m::$PetscInt, n::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, a::Vector{$PetscScalar} ) + mat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqSBAIJWithArrays, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}, Ptr{CMat}), + comm, bs, m, n, i, j, a, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + MatReorderingSeqSBAIJ(petsclib::PetscLibType,A::PetscMat, perm::IS) + +# External Links +$(_doc_external("Mat/MatReorderingSeqSBAIJ")) +""" +function MatReorderingSeqSBAIJ(petsclib::PetscLibType, A::PetscMat, perm::IS) end + +@for_petsc function MatReorderingSeqSBAIJ(petsclib::$UnionPetscLib, A::PetscMat, perm::IS ) + + @chk ccall( + (:MatReorderingSeqSBAIJ, $petsc_library), + PetscErrorCode, + (CMat, CIS), + A, perm, + ) + + + return nothing +end + +""" + MatKAIJGetAIJ(petsclib::PetscLibType,A::PetscMat, B::PetscMat) +Get the `MATAIJ` matrix describing the blockwise action of the `MATKAIJ` matrix + +Not Collective, but if the `MATKAIJ` matrix is parallel, the `MATAIJ` matrix is also parallel + +Input Parameter: +- `A` - the `MATKAIJ` matrix + +Output Parameter: +- `B` - the `MATAIJ` matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateKAIJ()`, `MATKAIJ`, `MATAIJ` + +# External Links +$(_doc_external("Mat/MatKAIJGetAIJ")) +""" +function MatKAIJGetAIJ(petsclib::PetscLibType, A::PetscMat, B::PetscMat) end + +@for_petsc function MatKAIJGetAIJ(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:MatKAIJGetAIJ, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + m::PetscInt,n::PetscInt,S::Vector{PetscScalar} = MatKAIJGetS(petsclib::PetscLibType,A::PetscMat) +Get the `S` matrix describing the shift action of the `MATKAIJ` matrix + +Not Collective; the entire `S` is stored and returned independently on all processes. + +Input Parameter: +- `A` - the `MATKAIJ` matrix + +Output Parameters: +- `m` - the number of rows in `S` +- `n` - the number of columns in `S` +- `S` - the S matrix, in form of a scalar array in column-major format + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatCreateKAIJ()`, `MatGetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatKAIJGetS")) +""" +function MatKAIJGetS(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatKAIJGetS(petsclib::$UnionPetscLib, A::PetscMat ) + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + S_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatKAIJGetS, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + A, m_, n_, S_, + ) + + m = m_[] + n = n_[] + S = unsafe_wrap(Array, S_[], VecGetLocalSize(petsclib, x); own = false) + + return m,n,S +end + +""" + m::PetscInt,n::PetscInt,S::Vector{PetscScalar} = MatKAIJGetSRead(petsclib::PetscLibType,A::PetscMat) +Get a read + +Not Collective; the entire `S` is stored and returned independently on all processes. + +Input Parameter: +- `A` - the `MATKAIJ` matrix + +Output Parameters: +- `m` - the number of rows in `S` +- `n` - the number of columns in `S` +- `S` - the S matrix, in form of a scalar array in column-major format + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatCreateKAIJ()`, `MatGetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatKAIJGetSRead")) +""" +function MatKAIJGetSRead(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatKAIJGetSRead(petsclib::$UnionPetscLib, A::PetscMat ) + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + S_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatKAIJGetSRead, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + A, m_, n_, S_, + ) + + m = m_[] + n = n_[] + S = unsafe_wrap(Array, S_[], VecGetLocalSize(petsclib, x); own = false) + + return m,n,S +end + +""" + S::Vector{PetscScalar} = MatKAIJRestoreS(petsclib::PetscLibType,A::PetscMat) +Restore array obtained with `MatKAIJGetS()` + +Not Collective + +Input Parameters: +- `A` - the `MATKAIJ` matrix +- `S` - location of pointer to array obtained with `MatKAIJGetS()` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatKAIJGetS()`, `MatKAIJGetSRead()`, `MatKAIJRestoreSRead()` + +# External Links +$(_doc_external("Mat/MatKAIJRestoreS")) +""" +function MatKAIJRestoreS(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatKAIJRestoreS(petsclib::$UnionPetscLib, A::PetscMat ) + S_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatKAIJRestoreS, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, S_, + ) + + S = unsafe_wrap(Array, S_[], VecGetLocalSize(petsclib, x); own = false) + + return S +end + +""" + S::Vector{PetscScalar} = MatKAIJRestoreSRead(petsclib::PetscLibType,A::PetscMat) +Restore array obtained with `MatKAIJGetSRead()` + +Not Collective + +Input Parameters: +- `A` - the `MATKAIJ` matrix +- `S` - location of pointer to array obtained with `MatKAIJGetS()` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatKAIJGetS()`, `MatKAIJGetSRead()` + +# External Links +$(_doc_external("Mat/MatKAIJRestoreSRead")) +""" +function MatKAIJRestoreSRead(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatKAIJRestoreSRead(petsclib::$UnionPetscLib, A::PetscMat ) + S_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatKAIJRestoreSRead, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, S_, + ) + + S = unsafe_wrap(Array, S_[], VecGetLocalSize(petsclib, x); own = false) + + return S +end + +""" + m::PetscInt,n::PetscInt,T::Vector{PetscScalar} = MatKAIJGetT(petsclib::PetscLibType,A::PetscMat) +Get the transformation matrix `T` associated with the `MATKAIJ` matrix + +Not Collective; the entire `T` is stored and returned independently on all processes + +Input Parameter: +- `A` - the `MATKAIJ` matrix + +Output Parameters: +- `m` - the number of rows in `T` +- `n` - the number of columns in `T` +- `T` - the T matrix, in form of a scalar array in column-major format + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatCreateKAIJ()`, `MatGetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatKAIJGetT")) +""" +function MatKAIJGetT(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatKAIJGetT(petsclib::$UnionPetscLib, A::PetscMat ) + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + T_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatKAIJGetT, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + A, m_, n_, T_, + ) + + m = m_[] + n = n_[] + T = unsafe_wrap(Array, T_[], VecGetLocalSize(petsclib, x); own = false) + + return m,n,T +end + +""" + m::PetscInt,n::PetscInt,T::Vector{PetscScalar} = MatKAIJGetTRead(petsclib::PetscLibType,A::PetscMat) +Get a read + +Not Collective; the entire `T` is stored and returned independently on all processes + +Input Parameter: +- `A` - the `MATKAIJ` matrix + +Output Parameters: +- `m` - the number of rows in `T` +- `n` - the number of columns in `T` +- `T` - the T matrix, in form of a scalar array in column-major format + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatCreateKAIJ()`, `MatGetBlockSizes()` + +# External Links +$(_doc_external("Mat/MatKAIJGetTRead")) +""" +function MatKAIJGetTRead(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatKAIJGetTRead(petsclib::$UnionPetscLib, A::PetscMat ) + m_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + T_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatKAIJGetTRead, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + A, m_, n_, T_, + ) + + m = m_[] + n = n_[] + T = unsafe_wrap(Array, T_[], VecGetLocalSize(petsclib, x); own = false) + + return m,n,T +end + +""" + T::Vector{PetscScalar} = MatKAIJRestoreT(petsclib::PetscLibType,A::PetscMat) +Restore array obtained with `MatKAIJGetT()` + +Not Collective + +Input Parameters: +- `A` - the `MATKAIJ` matrix +- `T` - location of pointer to array obtained with `MatKAIJGetS()` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatKAIJGetT()`, `MatKAIJGetTRead()`, `MatKAIJRestoreTRead()` + +# External Links +$(_doc_external("Mat/MatKAIJRestoreT")) +""" +function MatKAIJRestoreT(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatKAIJRestoreT(petsclib::$UnionPetscLib, A::PetscMat ) + T_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatKAIJRestoreT, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, T_, + ) + + T = unsafe_wrap(Array, T_[], VecGetLocalSize(petsclib, x); own = false) + + return T +end + +""" + T::Vector{PetscScalar} = MatKAIJRestoreTRead(petsclib::PetscLibType,A::PetscMat) +Restore array obtained with `MatKAIJGetTRead()` + +Not Collective + +Input Parameters: +- `A` - the `MATKAIJ` matrix +- `T` - location of pointer to array obtained with `MatKAIJGetS()` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatKAIJGetT()`, `MatKAIJGetTRead()` + +# External Links +$(_doc_external("Mat/MatKAIJRestoreTRead")) +""" +function MatKAIJRestoreTRead(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatKAIJRestoreTRead(petsclib::$UnionPetscLib, A::PetscMat ) + T_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatKAIJRestoreTRead, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, T_, + ) + + T = unsafe_wrap(Array, T_[], VecGetLocalSize(petsclib, x); own = false) + + return T +end + +""" + MatKAIJSetAIJ(petsclib::PetscLibType,A::PetscMat, B::PetscMat) +Set the `MATAIJ` matrix describing the blockwise action of the `MATKAIJ` matrix + +Logically Collective; if the `MATAIJ` matrix is parallel, the `MATKAIJ` matrix is also parallel + +Input Parameters: +- `A` - the `MATKAIJ` matrix +- `B` - the `MATAIJ` matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatKAIJGetAIJ()`, `MatKAIJSetS()`, `MatKAIJSetT()` + +# External Links +$(_doc_external("Mat/MatKAIJSetAIJ")) +""" +function MatKAIJSetAIJ(petsclib::PetscLibType, A::PetscMat, B::PetscMat) end + +@for_petsc function MatKAIJSetAIJ(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat ) + + @chk ccall( + (:MatKAIJSetAIJ, $petsc_library), + PetscErrorCode, + (CMat, CMat), + A, B, + ) + + + return nothing +end + +""" + MatKAIJSetS(petsclib::PetscLibType,A::PetscMat, p::PetscInt, q::PetscInt, S::Vector{PetscScalar}) +Set the `S` matrix describing the shift action of the `MATKAIJ` matrix + +Logically Collective; the entire `S` is stored independently on all processes. + +Input Parameters: +- `A` - the `MATKAIJ` matrix +- `p` - the number of rows in `S` +- `q` - the number of columns in `S` +- `S` - the S matrix, in form of a scalar array in column-major format + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatKAIJGetS()`, `MatKAIJSetT()`, `MatKAIJSetAIJ()` + +# External Links +$(_doc_external("Mat/MatKAIJSetS")) +""" +function MatKAIJSetS(petsclib::PetscLibType, A::PetscMat, p::PetscInt, q::PetscInt, S::Vector{PetscScalar}) end + +@for_petsc function MatKAIJSetS(petsclib::$UnionPetscLib, A::PetscMat, p::$PetscInt, q::$PetscInt, S::Vector{$PetscScalar} ) + + @chk ccall( + (:MatKAIJSetS, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + A, p, q, S, + ) + + + return nothing +end + +""" + identity::PetscBool = MatKAIJGetScaledIdentity(petsclib::PetscLibType,A::PetscMat) +Check if both `S` and `T` are scaled identities. + +Logically Collective. + +Input Parameter: +- `A` - the `MATKAIJ` matrix + +Output Parameter: +- `identity` - the Boolean value + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatKAIJGetS()`, `MatKAIJGetT()` + +# External Links +$(_doc_external("Mat/MatKAIJGetScaledIdentity")) +""" +function MatKAIJGetScaledIdentity(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatKAIJGetScaledIdentity(petsclib::$UnionPetscLib, A::PetscMat ) + identity_ = Ref{PetscBool}() + + @chk ccall( + (:MatKAIJGetScaledIdentity, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + A, identity_, + ) + + identity = identity_[] + + return identity +end + +""" + MatKAIJSetT(petsclib::PetscLibType,A::PetscMat, p::PetscInt, q::PetscInt, T::Vector{PetscScalar}) +Set the transformation matrix `T` associated with the `MATKAIJ` matrix + +Logically Collective; the entire `T` is stored independently on all processes. + +Input Parameters: +- `A` - the `MATKAIJ` matrix +- `p` - the number of rows in `S` +- `q` - the number of columns in `S` +- `T` - the `T` matrix, in form of a scalar array in column-major format + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATKAIJ`, `MatKAIJGetT()`, `MatKAIJSetS()`, `MatKAIJSetAIJ()` + +# External Links +$(_doc_external("Mat/MatKAIJSetT")) +""" +function MatKAIJSetT(petsclib::PetscLibType, A::PetscMat, p::PetscInt, q::PetscInt, T::Vector{PetscScalar}) end + +@for_petsc function MatKAIJSetT(petsclib::$UnionPetscLib, A::PetscMat, p::$PetscInt, q::$PetscInt, T::Vector{$PetscScalar} ) + + @chk ccall( + (:MatKAIJSetT, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + A, p, q, T, + ) + + + return nothing +end + +""" + kaij::PetscMat = MatCreateKAIJ(petsclib::PetscLibType,A::PetscMat, p::PetscInt, q::PetscInt, S::Vector{PetscScalar}, T::Vector{PetscScalar}) +Creates a matrix of type `MATKAIJ`. + +Collective + +Input Parameters: +- `A` - the `MATAIJ` matrix +- `p` - number of rows in `S` and `T` +- `q` - number of columns in `S` and `T` +- `S` - the `S` matrix (can be `NULL`), stored as a `PetscScalar` array (column-major) +- `T` - the `T` matrix (can be `NULL`), stored as a `PetscScalar` array (column-major) + +Output Parameter: +- `kaij` - the new `MATKAIJ` matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatKAIJSetAIJ()`, `MatKAIJSetS()`, `MatKAIJSetT()`, `MatKAIJGetAIJ()`, `MatKAIJGetS()`, `MatKAIJGetT()`, `MATKAIJ` + +# External Links +$(_doc_external("Mat/MatCreateKAIJ")) +""" +function MatCreateKAIJ(petsclib::PetscLibType, A::PetscMat, p::PetscInt, q::PetscInt, S::Union{Ptr,Vector{PetscScalar}}, T::Union{Ptr,Vector{PetscScalar}}) end + +@for_petsc function MatCreateKAIJ(petsclib::$UnionPetscLib, A::PetscMat, p::$PetscInt, q::$PetscInt, S::Union{Ptr,Vector{$PetscScalar}}, T::Union{Ptr,Vector{$PetscScalar}} ) + kaij_ = Ref{CMat}() + + @chk ccall( + (:MatCreateKAIJ, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{$PetscScalar}, Ptr{CMat}), + A, p, q, S, T, kaij_, + ) + + kaij = PetscMat(kaij_[], petsclib) + + return kaij +end + +""" + B::PetscMat = MatMPIAdjCreateNonemptySubcommMat(petsclib::PetscLibType,A::PetscMat) +create the same `MATMPIADJ` matrix on a subcommunicator containing only processes owning a positive number of rows + +Collective + +Input Parameter: +- `A` - original `MATMPIADJ` matrix + +Output Parameter: +- `B` - matrix on subcommunicator, `NULL` on MPI processes that own zero rows of `A` + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATMPIADJ`, `MatCreateMPIAdj()` + +# External Links +$(_doc_external("Mat/MatMPIAdjCreateNonemptySubcommMat")) +""" +function MatMPIAdjCreateNonemptySubcommMat(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatMPIAdjCreateNonemptySubcommMat(petsclib::$UnionPetscLib, A::PetscMat ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatMPIAdjCreateNonemptySubcommMat, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + MatMPIAdjToSeq(petsclib::PetscLibType,A::PetscMat, B::PetscMat) +Converts an parallel `MATMPIADJ` matrix to complete `MATMPIADJ` on each process (needed by sequential partitioners) + +Logically Collective + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `B` - the same matrix on all processes + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATMPIADJ`, `MatCreate()`, `MatCreateMPIAdj()`, `MatSetValues()`, `MatMPIAdjToSeqRankZero()` + +# External Links +$(_doc_external("Mat/MatMPIAdjToSeq")) +""" +function MatMPIAdjToSeq(petsclib::PetscLibType, A::PetscMat, B::PetscMat) end + +@for_petsc function MatMPIAdjToSeq(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:MatMPIAdjToSeq, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + MatMPIAdjToSeqRankZero(petsclib::PetscLibType,A::PetscMat, B::PetscMat) +Converts an parallel `MATMPIADJ` matrix to complete `MATMPIADJ` on rank zero (needed by sequential partitioners) + +Logically Collective + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `B` - the same matrix on rank zero, not set on other ranks + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATMPIADJ`, `MatCreate()`, `MatCreateMPIAdj()`, `MatSetValues()`, `MatMPIAdjToSeq()` + +# External Links +$(_doc_external("Mat/MatMPIAdjToSeqRankZero")) +""" +function MatMPIAdjToSeqRankZero(petsclib::PetscLibType, A::PetscMat, B::PetscMat) end + +@for_petsc function MatMPIAdjToSeqRankZero(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:MatMPIAdjToSeqRankZero, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + i::PetscInt,j::PetscInt,values::PetscInt = MatMPIAdjSetPreallocation(petsclib::PetscLibType,B::PetscMat) +Sets the array used for storing the matrix elements + +Logically Collective + +Input Parameters: +- `B` - the matrix +- `i` - the indices into `j` for the start of each row +- `j` - the column indices for each row (sorted for each row). +The indices in `i` and `j` start with zero (NOT with one). +- `values` - [use `NULL` if not provided] edge weights + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateMPIAdj()`, `MatSetValues()`, `MATMPIADJ` + +# External Links +$(_doc_external("Mat/MatMPIAdjSetPreallocation")) +""" +function MatMPIAdjSetPreallocation(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatMPIAdjSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat ) + i_ = Ref{$PetscInt}() + j_ = Ref{$PetscInt}() + values_ = Ref{$PetscInt}() + + @chk ccall( + (:MatMPIAdjSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + B, i_, j_, values_, + ) + + i = i_[] + j = j_[] + values = values_[] + + return i,j,values +end + +""" + A::PetscMat = MatCreateMPIAdj(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, values::Vector{PetscInt}) +Creates a sparse matrix representing an adjacency list. +The matrix need not have numerical values associated with it, it is +intended for ordering (to reduce bandwidth etc) and partitioning. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows +- `N` - number of global columns +- `i` - the indices into `j` for the start of each row +- `j` - the column indices for each row (sorted for each row). +- `values` - the values, optional, use `NULL` if not provided + +Output Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatConvert()`, `MatGetOrdering()`, `MATMPIADJ`, `MatMPIAdjSetPreallocation()` + +# External Links +$(_doc_external("Mat/MatCreateMPIAdj")) +""" +function MatCreateMPIAdj(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, values::Union{Ptr, Vector{PetscInt}}) end + +@for_petsc function MatCreateMPIAdj(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, N::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, values::Union{Ptr, Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIAdj, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, N, i, j, values, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatScatterGetVecScatter(petsclib::PetscLibType,mat::PetscMat, scatter::VecScatter) +Returns the user + +Logically Collective + +Input Parameter: +- `mat` - the matrix, should have been created with MatCreateScatter() or have type `MATSCATTER` + +Output Parameter: +- `scatter` - the scatter context + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATSCATTER`, `MatCreateScatter()`, `MatScatterSetVecScatter()` + +# External Links +$(_doc_external("Mat/MatScatterGetVecScatter")) +""" +function MatScatterGetVecScatter(petsclib::PetscLibType, mat::PetscMat, scatter::VecScatter) end + +@for_petsc function MatScatterGetVecScatter(petsclib::$UnionPetscLib, mat::PetscMat, scatter::VecScatter ) + + @chk ccall( + (:MatScatterGetVecScatter, $petsc_library), + PetscErrorCode, + (CMat, Ptr{VecScatter}), + mat, scatter, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreateScatter(petsclib::PetscLibType,comm::MPI_Comm, scatter::VecScatter) +Creates a new matrix of `MatType` `MATSCATTER`, based on a VecScatter + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `scatter` - a `VecScatter` + +Output Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatScatterSetVecScatter()`, `MatScatterGetVecScatter()`, `MATSCATTER` + +# External Links +$(_doc_external("Mat/MatCreateScatter")) +""" +function MatCreateScatter(petsclib::PetscLibType, comm::MPI_Comm, scatter::VecScatter) end + +@for_petsc function MatCreateScatter(petsclib::$UnionPetscLib, comm::MPI_Comm, scatter::VecScatter ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateScatter, $petsc_library), + PetscErrorCode, + (MPI_Comm, VecScatter, Ptr{CMat}), + comm, scatter, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatScatterSetVecScatter(petsclib::PetscLibType,mat::PetscMat, scatter::VecScatter) +sets the scatter that the matrix is to apply as its linear operator in a `MATSCATTER` + +Logically Collective + +Input Parameters: +- `mat` - the `MATSCATTER` matrix +- `scatter` - the scatter context create with `VecScatterCreate()` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATSCATTER`, `MatCreateScatter()` + +# External Links +$(_doc_external("Mat/MatScatterSetVecScatter")) +""" +function MatScatterSetVecScatter(petsclib::PetscLibType, mat::PetscMat, scatter::VecScatter) end + +@for_petsc function MatScatterSetVecScatter(petsclib::$UnionPetscLib, mat::PetscMat, scatter::VecScatter ) + + @chk ccall( + (:MatScatterSetVecScatter, $petsc_library), + PetscErrorCode, + (CMat, VecScatter), + mat, scatter, + ) + + + return nothing +end + +""" + C::PetscMat = MatCreateCentering(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a new matrix object that implements the (symmetric and idempotent) centering matrix, I + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows (or `PETSC_DECIDE` to have calculated if `N` is given) This value should be the same as the local size used in creating the `y` vector for the matrix-vector product y = Ax. +- `N` - number of global rows (or `PETSC_DETERMINE` to have calculated if `n` is given) + +Output Parameter: +- `C` - the matrix + +-seealso: [](ch_matrices), `Mat`, `MatCreateLRC()`, `MatCreateComposite()` + +# External Links +$(_doc_external("Mat/MatCreateCentering")) +""" +function MatCreateCentering(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateCentering(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + C_ = Ref{CMat}() + + @chk ccall( + (:MatCreateCentering, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, C_, + ) + + C = PetscMat(C_[], petsclib) + + return C +end + +""" + MatDiagonalGetDiagonal(petsclib::PetscLibType,A::PetscMat, diag::PetscVec) +Get the diagonal of a `MATDIAGONAL` + +Input Parameter: +- `A` - the `MATDIAGONAL` + +Output Parameter: +- `diag` - the `Vec` that defines the diagonal + +Level: developer + +-seealso: [](ch_matrices), `MATDIAGONAL`, `MatCreateDiagonal()`, `MatDiagonalRestoreDiagonal()`, `MatDiagonalGetInverseDiagonal()`, `MatGetDiagonal()` + +# External Links +$(_doc_external("Mat/MatDiagonalGetDiagonal")) +""" +function MatDiagonalGetDiagonal(petsclib::PetscLibType, A::PetscMat, diag::PetscVec) end + +@for_petsc function MatDiagonalGetDiagonal(petsclib::$UnionPetscLib, A::PetscMat, diag::PetscVec ) + diag_ = Ref(diag.ptr) + + @chk ccall( + (:MatDiagonalGetDiagonal, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CVec}), + A, diag_, + ) + + diag.ptr = C_NULL + + return nothing +end + +""" + MatDiagonalRestoreDiagonal(petsclib::PetscLibType,A::PetscMat, diag::PetscVec) +Restore the diagonal of a `MATDIAGONAL` + +Input Parameters: +- `A` - the `MATDIAGONAL` +- `diag` - the `Vec` obtained from `MatDiagonalGetDiagonal()` + +Level: developer + +-seealso: [](ch_matrices), `MATDIAGONAL`, `MatCreateDiagonal()`, `MatDiagonalGetDiagonal()` + +# External Links +$(_doc_external("Mat/MatDiagonalRestoreDiagonal")) +""" +function MatDiagonalRestoreDiagonal(petsclib::PetscLibType, A::PetscMat, diag::PetscVec) end + +@for_petsc function MatDiagonalRestoreDiagonal(petsclib::$UnionPetscLib, A::PetscMat, diag::PetscVec ) + diag_ = Ref(diag.ptr) + + @chk ccall( + (:MatDiagonalRestoreDiagonal, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CVec}), + A, diag_, + ) + + diag.ptr = C_NULL + + return nothing +end + +""" + MatDiagonalGetInverseDiagonal(petsclib::PetscLibType,A::PetscMat, inv_diag::PetscVec) +Get the inverse diagonal of a `MATDIAGONAL` + +Input Parameter: +- `A` - the `MATDIAGONAL` + +Output Parameter: +- `inv_diag` - the `Vec` that defines the inverse diagonal + +Level: developer + +-seealso: [](ch_matrices), `MATDIAGONAL`, `MatCreateDiagonal()`, `MatDiagonalRestoreInverseDiagonal()`, `MatDiagonalGetDiagonal()`, `MATLMVMBROYDEN`, `MatSolve()` + +# External Links +$(_doc_external("Mat/MatDiagonalGetInverseDiagonal")) +""" +function MatDiagonalGetInverseDiagonal(petsclib::PetscLibType, A::PetscMat, inv_diag::PetscVec) end + +@for_petsc function MatDiagonalGetInverseDiagonal(petsclib::$UnionPetscLib, A::PetscMat, inv_diag::PetscVec ) + inv_diag_ = Ref(inv_diag.ptr) + + @chk ccall( + (:MatDiagonalGetInverseDiagonal, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CVec}), + A, inv_diag_, + ) + + inv_diag.ptr = C_NULL + + return nothing +end + +""" + MatDiagonalRestoreInverseDiagonal(petsclib::PetscLibType,A::PetscMat, inv_diag::PetscVec) +Restore the inverse diagonal of a `MATDIAGONAL` + +Input Parameters: +- `A` - the `MATDIAGONAL` +- `inv_diag` - the `Vec` obtained from `MatDiagonalGetInverseDiagonal()` + +Level: developer + +-seealso: [](ch_matrices), `MATDIAGONAL`, `MatCreateDiagonal()`, `MatDiagonalGetInverseDiagonal()` + +# External Links +$(_doc_external("Mat/MatDiagonalRestoreInverseDiagonal")) +""" +function MatDiagonalRestoreInverseDiagonal(petsclib::PetscLibType, A::PetscMat, inv_diag::PetscVec) end + +@for_petsc function MatDiagonalRestoreInverseDiagonal(petsclib::$UnionPetscLib, A::PetscMat, inv_diag::PetscVec ) + inv_diag_ = Ref(inv_diag.ptr) + + @chk ccall( + (:MatDiagonalRestoreInverseDiagonal, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CVec}), + A, inv_diag_, + ) + + inv_diag.ptr = C_NULL + + return nothing +end + +""" + J::PetscMat = MatCreateDiagonal(petsclib::PetscLibType,diag::PetscVec) +Creates a matrix defined by a given vector along its diagonal. + +Collective + +Input Parameter: +- `diag` - vector for the diagonal + +Output Parameter: +- `J` - the diagonal matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatDestroy()`, `MATCONSTANTDIAGONAL`, `MatScale()`, `MatShift()`, `MatMult()`, `MatGetDiagonal()`, `MatSolve()` +`MatDiagonalRestoreInverseDiagonal()`, `MatDiagonalGetDiagonal()`, `MatDiagonalRestoreDiagonal()`, `MatDiagonalGetInverseDiagonal()` + +# External Links +$(_doc_external("Mat/MatCreateDiagonal")) +""" +function MatCreateDiagonal(petsclib::PetscLibType, diag::PetscVec) end + +@for_petsc function MatCreateDiagonal(petsclib::$UnionPetscLib, diag::PetscVec ) + J_ = Ref{CMat}() + + @chk ccall( + (:MatCreateDiagonal, $petsc_library), + PetscErrorCode, + (CVec, Ptr{CMat}), + diag, J_, + ) + + J = PetscMat(J_[], petsclib) + + return J +end + +""" + MatNormalGetMat(petsclib::PetscLibType,A::PetscMat, M::PetscMat) +Gets the `Mat` object stored inside a `MATNORMAL` + +Logically Collective + +Input Parameter: +- `A` - the `MATNORMAL` matrix + +Output Parameter: +- `M` - the matrix object stored inside `A` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATNORMAL`, `MATNORMALHERMITIAN`, `MatCreateNormal()` + +# External Links +$(_doc_external("Mat/MatNormalGetMat")) +""" +function MatNormalGetMat(petsclib::PetscLibType, A::PetscMat, M::PetscMat) end + +@for_petsc function MatNormalGetMat(petsclib::$UnionPetscLib, A::PetscMat, M::PetscMat ) + M_ = Ref(M.ptr) + + @chk ccall( + (:MatNormalGetMat, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, M_, + ) + + M.ptr = C_NULL + + return nothing +end + +""" + N::PetscMat = MatCreateNormal(petsclib::PetscLibType,A::PetscMat) +Creates a new `MATNORMAL` matrix object that behaves like A^T A. + +Collective + +Input Parameter: +- `A` - the (possibly rectangular) matrix + +Output Parameter: +- `N` - the matrix that represents A^T A + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATNORMAL`, `MatMult()`, `MatNormalGetMat()`, `MATNORMALHERMITIAN`, `MatCreateNormalHermitian()` + +# External Links +$(_doc_external("Mat/MatCreateNormal")) +""" +function MatCreateNormal(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatCreateNormal(petsclib::$UnionPetscLib, A::PetscMat ) + N_ = Ref{CMat}() + + @chk ccall( + (:MatCreateNormal, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, N_, + ) + + N = PetscMat(N_[], petsclib) + + return N +end + +""" + MatNormalHermitianGetMat(petsclib::PetscLibType,A::PetscMat, M::PetscMat) +Gets the `Mat` object stored inside a `MATNORMALHERMITIAN` + +Logically Collective + +Input Parameter: +- `A` - the `MATNORMALHERMITIAN` matrix + +Output Parameter: +- `M` - the matrix object stored inside `A` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATNORMALHERMITIAN`, `MatCreateNormalHermitian()` + +# External Links +$(_doc_external("Mat/MatNormalHermitianGetMat")) +""" +function MatNormalHermitianGetMat(petsclib::PetscLibType, A::PetscMat, M::PetscMat) end + +@for_petsc function MatNormalHermitianGetMat(petsclib::$UnionPetscLib, A::PetscMat, M::PetscMat ) + M_ = Ref(M.ptr) + + @chk ccall( + (:MatNormalHermitianGetMat, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, M_, + ) + + M.ptr = C_NULL + + return nothing +end + +""" + N::PetscMat = MatCreateNormalHermitian(petsclib::PetscLibType,A::PetscMat) +Creates a new matrix object `MATNORMALHERMITIAN` that behaves like A^* A. + +Collective + +Input Parameter: +- `A` - the (possibly rectangular complex) matrix + +Output Parameter: +- `N` - the matrix that represents A^* A + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATNORMAL`, `MATNORMALHERMITIAN`, `MatNormalHermitianGetMat()` + +# External Links +$(_doc_external("Mat/MatCreateNormalHermitian")) +""" +function MatCreateNormalHermitian(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatCreateNormalHermitian(petsclib::$UnionPetscLib, A::PetscMat ) + N_ = Ref{CMat}() + + @chk ccall( + (:MatCreateNormalHermitian, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, N_, + ) + + N = PetscMat(N_[], petsclib) + + return N +end + +""" + MatBlockMatSetPreallocation(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) +For good matrix assembly performance +the user should preallocate the matrix storage by setting the parameter nz +(or the array nnz). By setting these parameters accurately, performance +during matrix assembly can be increased by more than a factor of 50. + +Collective + +Input Parameters: +- `B` - The matrix +- `bs` - size of each block in matrix +- `nz` - number of nonzeros per block row (same for all rows) +- `nnz` - array containing the number of nonzeros in the various block rows +(possibly different for each row) or `NULL` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateBlockMat()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatBlockMatSetPreallocation")) +""" +function MatBlockMatSetPreallocation(petsclib::PetscLibType, B::PetscMat, bs::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) end + +@for_petsc function MatBlockMatSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, bs::$PetscInt, nz::$PetscInt, nnz::Vector{$PetscInt} ) + + @chk ccall( + (:MatBlockMatSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{$PetscInt}), + B, bs, nz, nnz, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreateBlockMat(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, bs::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) +Creates a new matrix in which each block contains a uniform + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of rows +- `n` - number of columns +- `bs` - size of each submatrix +- `nz` - expected maximum number of nonzero blocks in row (use `PETSC_DEFAULT` if not known) +- `nnz` - expected number of nonzers per block row if known (use `NULL` otherwise) + +Output Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATBLOCKMAT`, `MatCreateNest()` + +# External Links +$(_doc_external("Mat/MatCreateBlockMat")) +""" +function MatCreateBlockMat(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, bs::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateBlockMat(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, bs::$PetscInt, nz::$PetscInt, nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateBlockMat, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, bs, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + A::PetscMat = MatCreateFFT(petsclib::PetscLibType,comm::MPI_Comm, ndim::PetscInt, dim::Vector{PetscInt}, mattype::MatType) +Creates a matrix object that provides FFT via an external package + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `ndim` - the ndim-dimensional transform +- `dim` - array of size ndim, dim[i] contains the vector length in the i-dimension +- `mattype` - package type, e.g., `MATFFTW` or `MATSEQCUFFT` + +Output Parameter: +- `A` - the matrix + +Options Database Key: +- `-mat_fft_type` - set FFT type fft or seqcufft + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATFFTW`, `MATSEQCUFFT`, `MatCreateVecsFFTW()` + +# External Links +$(_doc_external("Mat/MatCreateFFT")) +""" +function MatCreateFFT(petsclib::PetscLibType, comm::MPI_Comm, ndim::PetscInt, dim::Vector{PetscInt}, mattype::MatType) end + +@for_petsc function MatCreateFFT(petsclib::$UnionPetscLib, comm::MPI_Comm, ndim::$PetscInt, dim::Vector{$PetscInt}, mattype::MatType ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateFFT, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{$PetscInt}, MatType, Ptr{CMat}), + comm, ndim, dim, mattype, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + x::PetscVec,y::PetscVec,z::PetscVec = MatCreateVecsFFTW(petsclib::PetscLibType,A::PetscMat) +Get vector(s) compatible with the matrix, i.e. with the +parallel layout determined by `MATFFTW` + +Collective + +Input Parameter: +- `A` - the matrix + +Output Parameters: +- `x` - (optional) input vector of forward FFTW +- `y` - (optional) output vector of forward FFTW +- `z` - (optional) output vector of backward FFTW + +Options Database Key: +- `-mat_fftw_plannerflags` - set FFTW planner flags + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATFFTW`, `MatCreateFFT()`, `MatCreateVecs()` + +# External Links +$(_doc_external("Mat/MatCreateVecsFFTW")) +""" +function MatCreateVecsFFTW(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatCreateVecsFFTW(petsclib::$UnionPetscLib, A::PetscMat ) + x_ = Ref{CVec}() + y_ = Ref{CVec}() + z_ = Ref{CVec}() + + @chk ccall( + (:MatCreateVecsFFTW, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CVec}, Ptr{CVec}, Ptr{CVec}), + A, x_, y_, z_, + ) + + x = PetscVec(x_[], petsclib) + y = PetscVec(y_[], petsclib) + z = PetscVec(z_[], petsclib) + + return x,y,z +end + +""" + MatHtoolSetKernel(petsclib::PetscLibType,A::PetscMat, kernel::MatHtoolKernelFn, kernelctx::Cvoid) + +# External Links +$(_doc_external("Mat/MatHtoolSetKernel")) +""" +function MatHtoolSetKernel(petsclib::PetscLibType, A::PetscMat, kernel::MatHtoolKernelFn, kernelctx::Cvoid) end + +@for_petsc function MatHtoolSetKernel(petsclib::$UnionPetscLib, A::PetscMat, kernel::MatHtoolKernelFn, kernelctx::Cvoid ) + + @chk ccall( + (:MatHtoolSetKernel, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatHtoolKernelFn}, Ptr{Cvoid}), + A, kernel, kernelctx, + ) + + + return nothing +end + +""" + MatHtoolGetPermutationSource(petsclib::PetscLibType,A::PetscMat, is::IS) + +# External Links +$(_doc_external("Mat/MatHtoolGetPermutationSource")) +""" +function MatHtoolGetPermutationSource(petsclib::PetscLibType, A::PetscMat, is::IS) end + +@for_petsc function MatHtoolGetPermutationSource(petsclib::$UnionPetscLib, A::PetscMat, is::IS ) + + @chk ccall( + (:MatHtoolGetPermutationSource, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CIS}), + A, is, + ) + + + return nothing +end + +""" + MatHtoolGetPermutationTarget(petsclib::PetscLibType,A::PetscMat, is::IS) + +# External Links +$(_doc_external("Mat/MatHtoolGetPermutationTarget")) +""" +function MatHtoolGetPermutationTarget(petsclib::PetscLibType, A::PetscMat, is::IS) end + +@for_petsc function MatHtoolGetPermutationTarget(petsclib::$UnionPetscLib, A::PetscMat, is::IS ) + + @chk ccall( + (:MatHtoolGetPermutationTarget, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CIS}), + A, is, + ) + + + return nothing +end + +""" + MatHtoolUsePermutation(petsclib::PetscLibType,A::PetscMat, use::PetscBool) + +# External Links +$(_doc_external("Mat/MatHtoolUsePermutation")) +""" +function MatHtoolUsePermutation(petsclib::PetscLibType, A::PetscMat, use::PetscBool) end + +@for_petsc function MatHtoolUsePermutation(petsclib::$UnionPetscLib, A::PetscMat, use::PetscBool ) + + @chk ccall( + (:MatHtoolUsePermutation, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + A, use, + ) + + + return nothing +end + +""" + MatHtoolUseRecompression(petsclib::PetscLibType,A::PetscMat, use::PetscBool) + +# External Links +$(_doc_external("Mat/MatHtoolUseRecompression")) +""" +function MatHtoolUseRecompression(petsclib::PetscLibType, A::PetscMat, use::PetscBool) end + +@for_petsc function MatHtoolUseRecompression(petsclib::$UnionPetscLib, A::PetscMat, use::PetscBool ) + + @chk ccall( + (:MatHtoolUseRecompression, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + A, use, + ) + + + return nothing +end + +""" + kernel::MatHtoolKernelFn,kernelctx::Cvoid,B::PetscMat = MatCreateHtoolFromKernel(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, spacedim::PetscInt, coords_target::Vector{PetscReal}, coords_source::Vector{PetscReal}) + +# External Links +$(_doc_external("Mat/MatCreateHtoolFromKernel")) +""" +function MatCreateHtoolFromKernel(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, spacedim::PetscInt, coords_target::Vector{PetscReal}, coords_source::Vector{PetscReal}) end + +@for_petsc function MatCreateHtoolFromKernel(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, spacedim::$PetscInt, coords_target::Vector{$PetscReal}, coords_source::Vector{$PetscReal} ) + kernel_ = Ref{MatHtoolKernelFn}() + kernelctx_ = Ref{Cvoid}() + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateHtoolFromKernel, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{MatHtoolKernelFn}, Ptr{Cvoid}, Ptr{CMat}), + comm, m, n, M, N, spacedim, coords_target, coords_source, kernel_, kernelctx_, B_, + ) + + kernel = kernel_[] + kernelctx = kernelctx_[] + B = PetscMat(B_[], petsclib) + + return kernel,kernelctx,B +end + +""" + MatHYPRESetPreallocation(petsclib::PetscLibType,A::PetscMat, dnz::PetscInt, dnnz::Vector{PetscInt}, onz::PetscInt, onnz::Vector{PetscInt}) +Preallocates memory for a sparse parallel matrix in HYPRE IJ format + +Collective + +Input Parameters: +- `A` - the matrix +- `dnz` - number of nonzeros per row in DIAGONAL portion of local submatrix +(same value is used for all local rows) +- `dnnz` - array containing the number of nonzeros in the various rows of the +DIAGONAL portion of the local submatrix (possibly different for each row) +or `NULL` (`PETSC_NULL_INTEGER` in Fortran), if `d_nz` is used to specify the nonzero structure. +The size of this array is equal to the number of local rows, i.e `m`. +For matrices that will be factored, you must leave room for (and set) +the diagonal entry even if it is zero. +- `onz` - number of nonzeros per row in the OFF-DIAGONAL portion of local +submatrix (same value is used for all local rows). +- `onnz` - array containing the number of nonzeros in the various rows of the +OFF-DIAGONAL portion of the local submatrix (possibly different for +each row) or `NULL` (`PETSC_NULL_INTEGER` in Fortran), if `o_nz` is used to specify the nonzero +structure. The size of this array is equal to the number +of local rows, i.e `m`. + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatMPIAIJSetPreallocation()`, `MATHYPRE`, `MATAIJ` + +# External Links +$(_doc_external("Mat/MatHYPRESetPreallocation")) +""" +function MatHYPRESetPreallocation(petsclib::PetscLibType, A::PetscMat, dnz::PetscInt, dnnz::Vector{PetscInt}, onz::PetscInt, onnz::Vector{PetscInt}) end + +@for_petsc function MatHYPRESetPreallocation(petsclib::$UnionPetscLib, A::PetscMat, dnz::$PetscInt, dnnz::Vector{$PetscInt}, onz::$PetscInt, onnz::Vector{$PetscInt} ) + + @chk ccall( + (:MatHYPRESetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}), + A, dnz, dnnz, onz, onnz, + ) + + + return nothing +end + +""" + MatHYPREGetParCSR(petsclib::PetscLibType,A::PetscMat, parcsr::hypre_ParCSRMatrix) +Gets the pointer to the ParCSR matrix + +Not Collective, No Fortran Support + +Input Parameter: +- `A` - the `MATHYPRE` object + +Output Parameter: +- `parcsr` - the pointer to the `hypre_ParCSRMatrix` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATHYPRE`, `PetscCopyMode` + +# External Links +$(_doc_external("Mat/MatHYPREGetParCSR")) +""" +function MatHYPREGetParCSR(petsclib::PetscLibType, A::PetscMat, parcsr::hypre_ParCSRMatrix) end + +@for_petsc function MatHYPREGetParCSR(petsclib::$UnionPetscLib, A::PetscMat, parcsr::hypre_ParCSRMatrix ) + + @chk ccall( + (:MatHYPREGetParCSR, $petsc_library), + PetscErrorCode, + (CMat, hypre_ParCSRMatrix), + A, parcsr, + ) + + + return nothing +end + +""" + newmat::PetscMat = MatCreateSubMatrixVirtual(petsclib::PetscLibType,A::PetscMat, isrow::IS, iscol::IS) +Creates a virtual matrix `MATSUBMATRIX` that acts as a submatrix + +Collective + +Input Parameters: +- `A` - matrix that we will extract a submatrix of +- `isrow` - rows to be present in the submatrix +- `iscol` - columns to be present in the submatrix + +Output Parameter: +- `newmat` - new matrix + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATSUBMATRIX`, `MATLOCALREF`, `MatCreateLocalRef()`, `MatCreateSubMatrix()`, `MatSubMatrixVirtualUpdate()` + +# External Links +$(_doc_external("Mat/MatCreateSubMatrixVirtual")) +""" +function MatCreateSubMatrixVirtual(petsclib::PetscLibType, A::PetscMat, isrow::IS, iscol::IS) end + +@for_petsc function MatCreateSubMatrixVirtual(petsclib::$UnionPetscLib, A::PetscMat, isrow::IS, iscol::IS ) + newmat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSubMatrixVirtual, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, Ptr{CMat}), + A, isrow, iscol, newmat_, + ) + + newmat = PetscMat(newmat_[], petsclib) + + return newmat +end + +""" + MatSubMatrixVirtualUpdate(petsclib::PetscLibType,N::PetscMat, A::PetscMat, isrow::IS, iscol::IS) +Updates a `MATSUBMATRIX` virtual submatrix + +Collective + +Input Parameters: +- `N` - submatrix to update +- `A` - full matrix in the submatrix +- `isrow` - rows in the update (same as the first time the submatrix was created) +- `iscol` - columns in the update (same as the first time the submatrix was created) + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATSUBMATRIX`, `MatCreateSubMatrixVirtual()` + +# External Links +$(_doc_external("Mat/MatSubMatrixVirtualUpdate")) +""" +function MatSubMatrixVirtualUpdate(petsclib::PetscLibType, N::PetscMat, A::PetscMat, isrow::IS, iscol::IS) end + +@for_petsc function MatSubMatrixVirtualUpdate(petsclib::$UnionPetscLib, N::PetscMat, A::PetscMat, isrow::IS, iscol::IS ) + + @chk ccall( + (:MatSubMatrixVirtualUpdate, $petsc_library), + PetscErrorCode, + (CMat, CMat, CIS, CIS), + N, A, isrow, iscol, + ) + + + return nothing +end + +""" + MatNestGetSubMat(petsclib::PetscLibType,A::PetscMat, idxm::PetscInt, jdxm::PetscInt, sub::PetscMat) +Returns a single, sub + +Not Collective + +Input Parameters: +- `A` - `MATNEST` matrix +- `idxm` - index of the matrix within the nest matrix +- `jdxm` - index of the matrix within the nest matrix + +Output Parameter: +- `sub` - matrix at index `idxm`, `jdxm` within the nest matrix + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATNEST`, `MatNestGetSize()`, `MatNestGetSubMats()`, `MatCreateNest()`, `MatNestSetSubMat()`, +`MatNestGetLocalISs()`, `MatNestGetISs()` + +# External Links +$(_doc_external("Mat/MatNestGetSubMat")) +""" +function MatNestGetSubMat(petsclib::PetscLibType, A::PetscMat, idxm::PetscInt, jdxm::PetscInt, sub::PetscMat) end + +@for_petsc function MatNestGetSubMat(petsclib::$UnionPetscLib, A::PetscMat, idxm::$PetscInt, jdxm::$PetscInt, sub::PetscMat ) + sub_ = Ref(sub.ptr) + + @chk ccall( + (:MatNestGetSubMat, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{CMat}), + A, idxm, jdxm, sub_, + ) + + sub.ptr = C_NULL + + return nothing +end + +""" + MatNestSetSubMat(petsclib::PetscLibType,A::PetscMat, idxm::PetscInt, jdxm::PetscInt, sub::PetscMat) +Set a single submatrix in the `MATNEST` + +Logically Collective + +Input Parameters: +- `A` - `MATNEST` matrix +- `idxm` - index of the matrix within the nest matrix +- `jdxm` - index of the matrix within the nest matrix +- `sub` - matrix at index `idxm`, `jdxm` within the nest matrix + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATNEST`, `MatNestSetSubMats()`, `MatNestGetSubMats()`, `MatNestGetLocalISs()`, `MatCreateNest()`, +`MatNestGetSubMat()`, `MatNestGetISs()`, `MatNestGetSize()` + +# External Links +$(_doc_external("Mat/MatNestSetSubMat")) +""" +function MatNestSetSubMat(petsclib::PetscLibType, A::PetscMat, idxm::PetscInt, jdxm::PetscInt, sub::PetscMat) end + +@for_petsc function MatNestSetSubMat(petsclib::$UnionPetscLib, A::PetscMat, idxm::$PetscInt, jdxm::$PetscInt, sub::PetscMat ) + + @chk ccall( + (:MatNestSetSubMat, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, CMat), + A, idxm, jdxm, sub, + ) + + + return nothing +end + +""" + M::PetscInt,N::PetscInt = MatNestGetSubMats(petsclib::PetscLibType,A::PetscMat, mat::PetscMat) +Returns the entire two dimensional array of matrices defining a `MATNEST` matrix. + +Not Collective + +Input Parameter: +- `A` - nest matrix + +Output Parameters: +- `M` - number of submatrix rows in the nest matrix +- `N` - number of submatrix columns in the nest matrix +- `mat` - array of matrices + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATNEST`, `MatNestGetSize()`, `MatNestGetSubMat()`, `MatNestGetLocalISs()`, `MatCreateNest()`, +`MatNestSetSubMats()`, `MatNestGetISs()`, `MatNestSetSubMat()` + +# External Links +$(_doc_external("Mat/MatNestGetSubMats")) +""" +function MatNestGetSubMats(petsclib::PetscLibType, A::PetscMat, mat::PetscMat) end + +@for_petsc function MatNestGetSubMats(petsclib::$UnionPetscLib, A::PetscMat, mat::PetscMat ) + M_ = Ref{$PetscInt}() + N_ = Ref{$PetscInt}() + + @chk ccall( + (:MatNestGetSubMats, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}, CMat), + A, M_, N_, mat, + ) + + M = M_[] + N = N_[] + + return M,N +end + +""" + M::PetscInt,N::PetscInt = MatNestGetSize(petsclib::PetscLibType,A::PetscMat) +Returns the size of the `MATNEST` matrix. + +Not Collective + +Input Parameter: +- `A` - `MATNEST` matrix + +Output Parameters: +- `M` - number of rows in the nested mat +- `N` - number of cols in the nested mat + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATNEST`, `MatNestGetSubMat()`, `MatNestGetSubMats()`, `MatCreateNest()`, `MatNestGetLocalISs()`, +`MatNestGetISs()` + +# External Links +$(_doc_external("Mat/MatNestGetSize")) +""" +function MatNestGetSize(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatNestGetSize(petsclib::$UnionPetscLib, A::PetscMat ) + M_ = Ref{$PetscInt}() + N_ = Ref{$PetscInt}() + + @chk ccall( + (:MatNestGetSize, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}), + A, M_, N_, + ) + + M = M_[] + N = N_[] + + return M,N +end + +""" + MatNestGetISs(petsclib::PetscLibType,A::PetscMat, rows::Vector{IS}, cols::Vector{IS}) +Returns the index sets partitioning the row and column spaces of a `MATNEST` + +Not Collective + +Input Parameter: +- `A` - `MATNEST` matrix + +Output Parameters: +- `rows` - array of row index sets (pass `NULL` to ignore) +- `cols` - array of column index sets (pass `NULL` to ignore) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATNEST`, `MatNestGetSubMat()`, `MatNestGetSubMats()`, `MatNestGetSize()`, `MatNestGetLocalISs()`, +`MatCreateNest()`, `MatNestSetSubMats()` + +# External Links +$(_doc_external("Mat/MatNestGetISs")) +""" +function MatNestGetISs(petsclib::PetscLibType, A::PetscMat, rows::Vector{IS}, cols::Vector{IS}) end + +@for_petsc function MatNestGetISs(petsclib::$UnionPetscLib, A::PetscMat, rows::Vector{IS}, cols::Vector{IS} ) + + @chk ccall( + (:MatNestGetISs, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CIS}, Ptr{CIS}), + A, rows, cols, + ) + + + return nothing +end + +""" + MatNestGetLocalISs(petsclib::PetscLibType,A::PetscMat, rows::Vector{IS}, cols::Vector{IS}) +Returns the index sets partitioning the row and column spaces of a `MATNEST` + +Not Collective + +Input Parameter: +- `A` - `MATNEST` matrix + +Output Parameters: +- `rows` - array of row index sets (pass `NULL` to ignore) +- `cols` - array of column index sets (pass `NULL` to ignore) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATNEST`, `MatNestGetSubMat()`, `MatNestGetSubMats()`, `MatNestGetSize()`, `MatNestGetISs()`, `MatCreateNest()`, +`MatNestSetSubMats()`, `MatNestSetSubMat()` + +# External Links +$(_doc_external("Mat/MatNestGetLocalISs")) +""" +function MatNestGetLocalISs(petsclib::PetscLibType, A::PetscMat, rows::Vector{IS}, cols::Vector{IS}) end + +@for_petsc function MatNestGetLocalISs(petsclib::$UnionPetscLib, A::PetscMat, rows::Vector{IS}, cols::Vector{IS} ) + + @chk ccall( + (:MatNestGetLocalISs, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CIS}, Ptr{CIS}), + A, rows, cols, + ) + + + return nothing +end + +""" + MatNestSetVecType(petsclib::PetscLibType,A::PetscMat, vtype::VecType) +Sets the type of `Vec` returned by `MatCreateVecs()` + +Not Collective + +Input Parameters: +- `A` - `MATNEST` matrix +- `vtype` - `VecType` to use for creating vectors + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATNEST`, `MatCreateVecs()`, `MatCreateNest()`, `VecType` + +# External Links +$(_doc_external("Mat/MatNestSetVecType")) +""" +function MatNestSetVecType(petsclib::PetscLibType, A::PetscMat, vtype::VecType) end + +@for_petsc function MatNestSetVecType(petsclib::$UnionPetscLib, A::PetscMat, vtype::VecType ) + + @chk ccall( + (:MatNestSetVecType, $petsc_library), + PetscErrorCode, + (CMat, VecType), + A, vtype, + ) + + + return nothing +end + +""" + MatNestSetSubMats(petsclib::PetscLibType,A::PetscMat, nr::PetscInt, is_row::Vector{IS}, nc::PetscInt, is_col::Vector{IS}, a::Vector{PetscMat}) +Sets the nested submatrices in a `MATNEST` + +Collective + +Input Parameters: +- `A` - `MATNEST` matrix +- `nr` - number of nested row blocks +- `is_row` - index sets for each nested row block, or `NULL` to make contiguous +- `nc` - number of nested column blocks +- `is_col` - index sets for each nested column block, or `NULL` to make contiguous +- `a` - array of nr \times nc submatrices, or `NULL` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATNEST`, `MatCreateNest()`, `MatNestSetSubMat()`, `MatNestGetSubMat()`, `MatNestGetSubMats()` + +# External Links +$(_doc_external("Mat/MatNestSetSubMats")) +""" +function MatNestSetSubMats(petsclib::PetscLibType, A::PetscMat, nr::PetscInt, is_row::Vector{IS}, nc::PetscInt, is_col::Vector{IS}, a::Vector{PetscMat}) end + +@for_petsc function MatNestSetSubMats(petsclib::$UnionPetscLib, A::PetscMat, nr::$PetscInt, is_row::Vector{IS}, nc::$PetscInt, is_col::Vector{IS}, a::Vector{PetscMat} ) + + @chk ccall( + (:MatNestSetSubMats, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CIS}, $PetscInt, Ptr{CIS}, Ptr{CMat}), + A, nr, is_row, nc, is_col, a, + ) + + + return nothing +end + +""" + B::PetscMat = MatCreateNest(petsclib::PetscLibType,comm::MPI_Comm, nr::PetscInt, is_row::Vector{IS}, nc::PetscInt, is_col::Vector{IS}, a::Vector{PetscMat}) +Creates a new `MATNEST` matrix containing several nested submatrices, each stored separately + +Collective + +Input Parameters: +- `comm` - Communicator for the new `MATNEST` +- `nr` - number of nested row blocks +- `is_row` - index sets for each nested row block, or `NULL` to make contiguous +- `nc` - number of nested column blocks +- `is_col` - index sets for each nested column block, or `NULL` to make contiguous +- `a` - array of nr \times nc submatrices, empty submatrices can be passed using `NULL` + +Output Parameter: +- `B` - new matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATNEST`, `MatCreate()`, `VecCreateNest()`, `DMCreateMatrix()`, `MatNestSetSubMat()`, +`MatNestGetSubMat()`, `MatNestGetLocalISs()`, `MatNestGetSize()`, +`MatNestGetISs()`, `MatNestSetSubMats()`, `MatNestGetSubMats()` + +# External Links +$(_doc_external("Mat/MatCreateNest")) +""" +function MatCreateNest(petsclib::PetscLibType, comm::MPI_Comm, nr::PetscInt, is_row::Vector{IS}, nc::PetscInt, is_col::Vector{IS}, a::Vector{PetscMat}) end + +@for_petsc function MatCreateNest(petsclib::$UnionPetscLib, comm::MPI_Comm, nr::$PetscInt, is_row::Vector{IS}, nc::$PetscInt, is_col::Vector{IS}, a::Vector{PetscMat} ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateNest, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{CIS}, $PetscInt, Ptr{CIS}, Ptr{CMat}, Ptr{CMat}), + comm, nr, is_row, nc, is_col, a, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + MatMPIAIJGetNumberNonzeros(petsclib::PetscLibType,A::PetscMat, nz::PetscCount) +gets the number of nonzeros in the matrix on this MPI rank + +Not Collective + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `nz` - the number of nonzeros + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMPIAIJ` + +# External Links +$(_doc_external("Mat/MatMPIAIJGetNumberNonzeros")) +""" +function MatMPIAIJGetNumberNonzeros(petsclib::PetscLibType, A::PetscMat, nz::PetscCount) end + +@for_petsc function MatMPIAIJGetNumberNonzeros(petsclib::$UnionPetscLib, A::PetscMat, nz::PetscCount ) + + @chk ccall( + (:MatMPIAIJGetNumberNonzeros, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscCount}), + A, nz, + ) + + + return nothing +end + +""" + MatMPIAIJSetUseScalableIncreaseOverlap(petsclib::PetscLibType,A::PetscMat, sc::PetscBool) +Determine if the matrix uses a scalable algorithm to compute the overlap + +Collective + +Input Parameters: +- `A` - the matrix +- `sc` - `PETSC_TRUE` indicates use the scalable algorithm (default is not to use the scalable algorithm) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMPIAIJ` + +# External Links +$(_doc_external("Mat/MatMPIAIJSetUseScalableIncreaseOverlap")) +""" +function MatMPIAIJSetUseScalableIncreaseOverlap(petsclib::PetscLibType, A::PetscMat, sc::PetscBool) end + +@for_petsc function MatMPIAIJSetUseScalableIncreaseOverlap(petsclib::$UnionPetscLib, A::PetscMat, sc::PetscBool ) + + @chk ccall( + (:MatMPIAIJSetUseScalableIncreaseOverlap, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + A, sc, + ) + + + return nothing +end + +""" + garray::PetscInt,mat::PetscMat = MatCreateMPIAIJWithSeqAIJ(petsclib::PetscLibType,comm::MPI_Comm, M::PetscInt, N::PetscInt, A::PetscMat, B::PetscMat) +creates a `MATMPIAIJ` matrix using `MATSEQAIJ` matrices that contain the "diagonal" +and "off-diagonal" part of the matrix in CSR format. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `M` - the global row size +- `N` - the global column size +- `A` - "diagonal" portion of matrix +- `B` - if garray is `NULL`, B should be the offdiag matrix using global col ids and of size N - if garray is not `NULL`, B should be the offdiag matrix using local col ids and of size garray +- `garray` - either `NULL` or the global index of `B` columns. If not `NULL`, it should be allocated by `PetscMalloc1()` and will be owned by `mat` thereafter. + +Output Parameter: +- `mat` - the matrix, with input `A` as its local diagonal matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMPIAIJ`, `MATSEQAIJ`, `MatCreateMPIAIJWithSplitArrays()` + +# External Links +$(_doc_external("Mat/MatCreateMPIAIJWithSeqAIJ")) +""" +function MatCreateMPIAIJWithSeqAIJ(petsclib::PetscLibType, comm::MPI_Comm, M::PetscInt, N::PetscInt, A::PetscMat, B::PetscMat) end + +@for_petsc function MatCreateMPIAIJWithSeqAIJ(petsclib::$UnionPetscLib, comm::MPI_Comm, M::$PetscInt, N::$PetscInt, A::PetscMat, B::PetscMat ) + garray_ = Ref{$PetscInt}() + mat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIAIJWithSeqAIJ, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, CMat, CMat, Ptr{$PetscInt}, Ptr{CMat}), + comm, M, N, A, B, garray_, mat_, + ) + + garray = garray_[] + mat = PetscMat(mat_[], petsclib) + + return garray,mat +end + +""" + MatMPIAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar}) +Allocates memory for a sparse parallel matrix in `MATAIJ` format +(the default parallel PETSc format). + +Collective + +Input Parameters: +- `B` - the matrix +- `i` - the indices into `j` for the start of each local row (indices start with zero) +- `j` - the column indices for each local row (indices start with zero) +- `v` - optional values in the matrix + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATMPIAIJ`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIAIJSetPreallocation()`, `MatCreateAIJ()`, +`MatCreateSeqAIJWithArrays()`, `MatCreateMPIAIJWithSplitArrays()`, `MatCreateMPIAIJWithArrays()`, `MatSetPreallocationCOO()`, `MatSetValuesCOO()` + +# External Links +$(_doc_external("Mat/MatMPIAIJSetPreallocationCSR")) +""" +function MatMPIAIJSetPreallocationCSR(petsclib::PetscLibType, B::PetscMat, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar}) end + +@for_petsc function MatMPIAIJSetPreallocationCSR(petsclib::$UnionPetscLib, B::PetscMat, i::Vector{$PetscInt}, j::Vector{$PetscInt}, v::Vector{$PetscScalar} ) + + @chk ccall( + (:MatMPIAIJSetPreallocationCSR, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}), + B, i, j, v, + ) + + + return nothing +end + +""" + MatMPIAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +Preallocates memory for a sparse parallel matrix in `MATMPIAIJ` format +(the default parallel PETSc format). For good matrix assembly performance +the user should preallocate the matrix storage by setting the parameters +`d_nz` (or `d_nnz`) and `o_nz` (or `o_nnz`). + +Collective + +Input Parameters: +- `B` - the matrix +- `d_nz` - number of nonzeros per row in DIAGONAL portion of local submatrix +(same value is used for all local rows) +- `d_nnz` - array containing the number of nonzeros in the various rows of the +DIAGONAL portion of the local submatrix (possibly different for each row) +or `NULL` (`PETSC_NULL_INTEGER` in Fortran), if `d_nz` is used to specify the nonzero structure. +The size of this array is equal to the number of local rows, i.e 'm'. +For matrices that will be factored, you must leave room for (and set) +the diagonal entry even if it is zero. +- `o_nz` - number of nonzeros per row in the OFF-DIAGONAL portion of local +submatrix (same value is used for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various rows of the +OFF-DIAGONAL portion of the local submatrix (possibly different for +each row) or `NULL` (`PETSC_NULL_INTEGER` in Fortran), if `o_nz` is used to specify the nonzero +structure. The size of this array is equal to the number +of local rows, i.e 'm'. + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrices](sec_matsparse), `MATMPIAIJ`, `MATAIJ`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatCreateAIJ()`, `MatMPIAIJSetPreallocationCSR()`, +`MatGetInfo()`, `PetscSplitOwnership()`, `MatSetPreallocationCOO()`, `MatSetValuesCOO()` + +# External Links +$(_doc_external("Mat/MatMPIAIJSetPreallocation")) +""" +function MatMPIAIJSetPreallocation(petsclib::PetscLibType, B::PetscMat, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) end + +@for_petsc function MatMPIAIJSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, d_nz::$PetscInt, d_nnz::Vector{$PetscInt}, o_nz::$PetscInt, o_nnz::Vector{$PetscInt} ) + + @chk ccall( + (:MatMPIAIJSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}), + B, d_nz, d_nnz, o_nz, o_nnz, + ) + + + return nothing +end + +""" + mat::PetscMat = MatCreateMPIAIJWithArrays(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) +creates a `MATMPIAIJ` matrix using arrays that contain in standard +CSR format for the local rows. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (Cannot be `PETSC_DECIDE`) +- `n` - This value should be the same as the local size used in creating the +x vector for the matrix-vector product y = Ax. (or `PETSC_DECIDE` to have +calculated if `N` is given) For square matrices n is almost always `m`. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) +- `i` - row indices (of length m+1); that is i[0] = 0, i[row] = i[row-1] + number of elements in that row of the matrix +- `j` - global column indices +- `a` - optional matrix values + +Output Parameter: +- `mat` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIAIJSetPreallocation()`, `MatMPIAIJSetPreallocationCSR()`, +`MATMPIAIJ`, `MatCreateAIJ()`, `MatCreateMPIAIJWithSplitArrays()`, `MatUpdateMPIAIJWithArray()`, `MatSetPreallocationCOO()`, `MatSetValuesCOO()` + +# External Links +$(_doc_external("Mat/MatCreateMPIAIJWithArrays")) +""" +function MatCreateMPIAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) end + +@for_petsc function MatCreateMPIAIJWithArrays(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, a::Vector{$PetscScalar} ) + mat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIAIJWithArrays, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}, Ptr{CMat}), + comm, m, n, M, N, i, j, a, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + MatUpdateMPIAIJWithArrays(petsclib::PetscLibType,mat::PetscMat, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, Ii::Vector{PetscInt}, J::Vector{PetscInt}, v::Vector{PetscScalar}) +updates a `MATMPIAIJ` matrix using arrays that contain in standard +CSR format for the local rows. Only the numerical values are updated the other arrays must be identical to what was passed +from `MatCreateMPIAIJWithArrays()` + +Deprecated: Use `MatUpdateMPIAIJWithArray()` + +Collective + +Input Parameters: +- `mat` - the matrix +- `m` - number of local rows (Cannot be `PETSC_DECIDE`) +- `n` - This value should be the same as the local size used in creating the +x vector for the matrix-vector product y = Ax. (or `PETSC_DECIDE` to have +calculated if N is given) For square matrices n is almost always m. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if m is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if n is given) +- `Ii` - row indices; that is Ii[0] = 0, Ii[row] = Ii[row-1] + number of elements in that row of the matrix +- `J` - column indices +- `v` - matrix values + +Level: deprecated + +-seealso: [](ch_matrices), `Mat`, `MATMPIAIJ`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIAIJSetPreallocation()`, `MatMPIAIJSetPreallocationCSR()`, +`MatCreateAIJ()`, `MatCreateMPIAIJWithSplitArrays()`, `MatUpdateMPIAIJWithArray()`, `MatSetPreallocationCOO()`, `MatSetValuesCOO()` + +# External Links +$(_doc_external("Mat/MatUpdateMPIAIJWithArrays")) +""" +function MatUpdateMPIAIJWithArrays(petsclib::PetscLibType, mat::PetscMat, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, Ii::Vector{PetscInt}, J::Vector{PetscInt}, v::Vector{PetscScalar}) end + +@for_petsc function MatUpdateMPIAIJWithArrays(petsclib::$UnionPetscLib, mat::PetscMat, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, Ii::Vector{$PetscInt}, J::Vector{$PetscInt}, v::Vector{$PetscScalar} ) + + @chk ccall( + (:MatUpdateMPIAIJWithArrays, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}), + mat, m, n, M, N, Ii, J, v, + ) + + + return nothing +end + +""" + MatUpdateMPIAIJWithArray(petsclib::PetscLibType,mat::PetscMat, v::Vector{PetscScalar}) +updates an `MATMPIAIJ` matrix using an array that contains the nonzero values + +Collective + +Input Parameters: +- `mat` - the matrix +- `v` - matrix values, stored by row + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIAIJSetPreallocation()`, `MatMPIAIJSetPreallocationCSR()`, +`MATMPIAIJ`, `MatCreateAIJ()`, `MatCreateMPIAIJWithSplitArrays()`, `MatUpdateMPIAIJWithArrays()`, `MatSetPreallocationCOO()`, `MatSetValuesCOO()` + +# External Links +$(_doc_external("Mat/MatUpdateMPIAIJWithArray")) +""" +function MatUpdateMPIAIJWithArray(petsclib::PetscLibType, mat::PetscMat, v::Vector{PetscScalar}) end + +@for_petsc function MatUpdateMPIAIJWithArray(petsclib::$UnionPetscLib, mat::PetscMat, v::Vector{$PetscScalar} ) + + @chk ccall( + (:MatUpdateMPIAIJWithArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + mat, v, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreateAIJ(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +Creates a sparse parallel matrix in `MATAIJ` format +(the default parallel PETSc format). For good matrix assembly performance +the user should preallocate the matrix storage by setting the parameters +`d_nz` (or `d_nnz`) and `o_nz` (or `o_nnz`). + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if M is given). This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax. +- `n` - This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax. (or `PETSC_DECIDE` to have calculated if N is given) For square matrices n is almost always m. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if m is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if n is given) +- `d_nz` - number of nonzeros per row in DIAGONAL portion of local submatrix (same value is used for all local rows) +- `d_nnz` - array containing the number of nonzeros in the various rows of the DIAGONAL portion of the local submatrix (possibly different for each row) or `NULL`, if `d_nz` is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e 'm'. +- `o_nz` - number of nonzeros per row in the OFF-DIAGONAL portion of local submatrix (same value is used for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various rows of the OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or `NULL`, if `o_nz` is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e 'm'. + +Output Parameter: +- `A` - the matrix + +Options Database Keys: +- `-mat_no_inode` - Do not use inodes +- `-mat_inode_limit ` - Sets inode limit (max limit=5) +- `-matmult_vecscatter_view ` - View the vecscatter (i.e., communication pattern) used in `MatMult()` of sparse parallel matrices. +See viewer types in manual of `MatView()`. Of them, ascii_matlab, draw or binary cause the `VecScatter` +to be viewed as a matrix. Entry (i,j) is the size of message (in bytes) rank i sends to rank j in one `MatMult()` call. + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrix Creation](sec_matsparse), `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIAIJSetPreallocation()`, `MatMPIAIJSetPreallocationCSR()`, +`MATMPIAIJ`, `MatCreateMPIAIJWithArrays()`, `MatGetOwnershipRange()`, `MatGetOwnershipRanges()`, `MatGetOwnershipRangeColumn()`, +`MatGetOwnershipRangesColumn()`, `PetscLayout` + +# External Links +$(_doc_external("Mat/MatCreateAIJ")) +""" +function MatCreateAIJ(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr,Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateAIJ(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, d_nz::$PetscInt, d_nnz::Union{Ptr,Vector{$PetscInt}}, o_nz::$PetscInt, o_nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateAIJ, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, M, N, d_nz, d_nnz, o_nz, o_nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + colmap::Vector{PetscInt} = MatMPIAIJGetSeqAIJ(petsclib::PetscLibType,A::PetscMat, Ad::PetscMat, Ao::PetscMat) +Returns the local pieces of this distributed matrix + +Not Collective + +Input Parameter: +- `A` - The `MATMPIAIJ` matrix + +Output Parameters: +- `Ad` - The local diagonal block as a `MATSEQAIJ` matrix +- `Ao` - The local off-diagonal block as a `MATSEQAIJ` matrix +- `colmap` - An array mapping local column numbers of `Ao` to global column numbers of the parallel matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MATMPIAIJ`, `MatMPIAIJGetLocalMat()`, `MatMPIAIJGetLocalMatCondensed()`, `MatCreateAIJ()`, `MATSEQAIJ` + +# External Links +$(_doc_external("Mat/MatMPIAIJGetSeqAIJ")) +""" +function MatMPIAIJGetSeqAIJ(petsclib::PetscLibType, A::PetscMat, Ad::PetscMat, Ao::PetscMat) end + +@for_petsc function MatMPIAIJGetSeqAIJ(petsclib::$UnionPetscLib, A::PetscMat, Ad::PetscMat, Ao::PetscMat ) + Ad_ = Ref(Ad.ptr) + Ao_ = Ref(Ao.ptr) + colmap_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:MatMPIAIJGetSeqAIJ, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}, Ptr{CMat}, Ptr{Ptr{$PetscInt}}), + A, Ad_, Ao_, colmap_, + ) + + Ad.ptr = C_NULL + Ao.ptr = C_NULL + colmap = unsafe_wrap(Array, colmap_[], VecGetLocalSize(petsclib, x); own = false) + + return colmap +end + +""" + MatCreateMPIAIJSumSeqAIJNumeric(petsclib::PetscLibType,seqmat::PetscMat, mpimat::PetscMat) + +# External Links +$(_doc_external("Mat/MatCreateMPIAIJSumSeqAIJNumeric")) +""" +function MatCreateMPIAIJSumSeqAIJNumeric(petsclib::PetscLibType, seqmat::PetscMat, mpimat::PetscMat) end + +@for_petsc function MatCreateMPIAIJSumSeqAIJNumeric(petsclib::$UnionPetscLib, seqmat::PetscMat, mpimat::PetscMat ) + + @chk ccall( + (:MatCreateMPIAIJSumSeqAIJNumeric, $petsc_library), + PetscErrorCode, + (CMat, CMat), + seqmat, mpimat, + ) + + + return nothing +end + +""" + mpimat::PetscMat = MatCreateMPIAIJSumSeqAIJSymbolic(petsclib::PetscLibType,comm::MPI_Comm, seqmat::PetscMat, m::PetscInt, n::PetscInt) + +# External Links +$(_doc_external("Mat/MatCreateMPIAIJSumSeqAIJSymbolic")) +""" +function MatCreateMPIAIJSumSeqAIJSymbolic(petsclib::PetscLibType, comm::MPI_Comm, seqmat::PetscMat, m::PetscInt, n::PetscInt) end + +@for_petsc function MatCreateMPIAIJSumSeqAIJSymbolic(petsclib::$UnionPetscLib, comm::MPI_Comm, seqmat::PetscMat, m::$PetscInt, n::$PetscInt ) + mpimat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIAIJSumSeqAIJSymbolic, $petsc_library), + PetscErrorCode, + (MPI_Comm, CMat, $PetscInt, $PetscInt, Ptr{CMat}), + comm, seqmat, m, n, mpimat_, + ) + + mpimat = PetscMat(mpimat_[], petsclib) + + return mpimat +end + +""" + mpimat::PetscMat = MatCreateMPIAIJSumSeqAIJ(petsclib::PetscLibType,comm::MPI_Comm, seqmat::PetscMat, m::PetscInt, n::PetscInt, scall::MatReuse) +Creates a `MATMPIAIJ` matrix by adding sequential +matrices from each processor + +Collective + +Input Parameters: +- `comm` - the communicators the parallel matrix will live on +- `seqmat` - the input sequential matrices +- `m` - number of local rows (or `PETSC_DECIDE`) +- `n` - number of local columns (or `PETSC_DECIDE`) +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameter: +- `mpimat` - the parallel matrix generated + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateAIJ()` + +# External Links +$(_doc_external("Mat/MatCreateMPIAIJSumSeqAIJ")) +""" +function MatCreateMPIAIJSumSeqAIJ(petsclib::PetscLibType, comm::MPI_Comm, seqmat::PetscMat, m::PetscInt, n::PetscInt, scall::MatReuse) end + +@for_petsc function MatCreateMPIAIJSumSeqAIJ(petsclib::$UnionPetscLib, comm::MPI_Comm, seqmat::PetscMat, m::$PetscInt, n::$PetscInt, scall::MatReuse ) + mpimat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIAIJSumSeqAIJ, $petsc_library), + PetscErrorCode, + (MPI_Comm, CMat, $PetscInt, $PetscInt, MatReuse, Ptr{CMat}), + comm, seqmat, m, n, scall, mpimat_, + ) + + mpimat = PetscMat(mpimat_[], petsclib) + + return mpimat +end + +""" + MatAIJGetLocalMat(petsclib::PetscLibType,A::PetscMat, A_loc::PetscMat) +Creates a `MATSEQAIJ` from a `MATAIJ` matrix. + +Not Collective + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `A_loc` - the local sequential matrix generated + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatMPIAIJGetLocalMat()` + +# External Links +$(_doc_external("Mat/MatAIJGetLocalMat")) +""" +function MatAIJGetLocalMat(petsclib::PetscLibType, A::PetscMat, A_loc::PetscMat) end + +@for_petsc function MatAIJGetLocalMat(petsclib::$UnionPetscLib, A::PetscMat, A_loc::PetscMat ) + A_loc_ = Ref(A_loc.ptr) + + @chk ccall( + (:MatAIJGetLocalMat, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, A_loc_, + ) + + A_loc.ptr = C_NULL + + return nothing +end + +""" + MatMPIAIJGetLocalMat(petsclib::PetscLibType,A::PetscMat, scall::MatReuse, A_loc::PetscMat) +Creates a `MATSEQAIJ` from a `MATMPIAIJ` matrix. + +Not Collective + +Input Parameters: +- `A` - the matrix +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameter: +- `A_loc` - the local sequential matrix generated + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATMPIAIJ`, `MatGetOwnershipRange()`, `MatMPIAIJGetLocalMatCondensed()`, `MatMPIAIJGetLocalMatMerge()` + +# External Links +$(_doc_external("Mat/MatMPIAIJGetLocalMat")) +""" +function MatMPIAIJGetLocalMat(petsclib::PetscLibType, A::PetscMat, scall::MatReuse, A_loc::PetscMat) end + +@for_petsc function MatMPIAIJGetLocalMat(petsclib::$UnionPetscLib, A::PetscMat, scall::MatReuse, A_loc::PetscMat ) + A_loc_ = Ref(A_loc.ptr) + + @chk ccall( + (:MatMPIAIJGetLocalMat, $petsc_library), + PetscErrorCode, + (CMat, MatReuse, Ptr{CMat}), + A, scall, A_loc_, + ) + + A_loc.ptr = C_NULL + + return nothing +end + +""" + MatMPIAIJGetLocalMatMerge(petsclib::PetscLibType,A::PetscMat, scall::MatReuse, glob::IS, A_loc::PetscMat) +Creates a `MATSEQAIJ` from a `MATMPIAIJ` matrix by taking all its local rows and putting them into a sequential matrix with +mlocal rows and n columns. Where n is the sum of the number of columns of the diagonal and off-diagonal part + +Not Collective + +Input Parameters: +- `A` - the matrix +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameters: +- `glob` - sequential `IS` with global indices associated with the columns of the local sequential matrix generated (can be `NULL`) +- `A_loc` - the local sequential matrix generated + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATMPIAIJ`, `MatGetOwnershipRange()`, `MatMPIAIJGetLocalMat()`, `MatMPIAIJGetLocalMatCondensed()` + +# External Links +$(_doc_external("Mat/MatMPIAIJGetLocalMatMerge")) +""" +function MatMPIAIJGetLocalMatMerge(petsclib::PetscLibType, A::PetscMat, scall::MatReuse, glob::IS, A_loc::PetscMat) end + +@for_petsc function MatMPIAIJGetLocalMatMerge(petsclib::$UnionPetscLib, A::PetscMat, scall::MatReuse, glob::IS, A_loc::PetscMat ) + A_loc_ = Ref(A_loc.ptr) + + @chk ccall( + (:MatMPIAIJGetLocalMatMerge, $petsc_library), + PetscErrorCode, + (CMat, MatReuse, Ptr{CIS}, Ptr{CMat}), + A, scall, glob, A_loc_, + ) + + A_loc.ptr = C_NULL + + return nothing +end + +""" + MatMPIAIJGetLocalMatCondensed(petsclib::PetscLibType,A::PetscMat, scall::MatReuse, row::IS, col::IS, A_loc::PetscMat) +Creates a `MATSEQAIJ` matrix from an `MATMPIAIJ` matrix by taking all its local rows and NON + +Not Collective + +Input Parameters: +- `A` - the matrix +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` +- `row` - index set of rows to extract (or `NULL`) +- `col` - index set of columns to extract (or `NULL`) + +Output Parameter: +- `A_loc` - the local sequential matrix generated + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATMPIAIJ`, `MatGetOwnershipRange()`, `MatMPIAIJGetLocalMat()` + +# External Links +$(_doc_external("Mat/MatMPIAIJGetLocalMatCondensed")) +""" +function MatMPIAIJGetLocalMatCondensed(petsclib::PetscLibType, A::PetscMat, scall::MatReuse, row::IS, col::IS, A_loc::PetscMat) end + +@for_petsc function MatMPIAIJGetLocalMatCondensed(petsclib::$UnionPetscLib, A::PetscMat, scall::MatReuse, row::IS, col::IS, A_loc::PetscMat ) + A_loc_ = Ref(A_loc.ptr) + + @chk ccall( + (:MatMPIAIJGetLocalMatCondensed, $petsc_library), + PetscErrorCode, + (CMat, MatReuse, Ptr{CIS}, Ptr{CIS}, Ptr{CMat}), + A, scall, row, col, A_loc_, + ) + + A_loc.ptr = C_NULL + + return nothing +end + +""" + MatGetBrowsOfAcols(petsclib::PetscLibType,A::PetscMat, B::PetscMat, scall::MatReuse, rowb::IS, colb::IS, B_seq::PetscMat) +Returns `IS` that contain rows of `B` that equal to nonzero columns of local `A` + +Collective + +Input Parameters: +- `A` - the first matrix in `MATMPIAIJ` format +- `B` - the second matrix in `MATMPIAIJ` format +- `scall` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameters: +- `rowb` - On input index sets of rows of B to extract (or `NULL`), modified on output +- `colb` - On input index sets of columns of B to extract (or `NULL`), modified on output +- `B_seq` - the sequential matrix generated + +Level: developer + +-seealso: `Mat`, `MATMPIAIJ`, `IS`, `MatReuse` + +# External Links +$(_doc_external("Mat/MatGetBrowsOfAcols")) +""" +function MatGetBrowsOfAcols(petsclib::PetscLibType, A::PetscMat, B::PetscMat, scall::MatReuse, rowb::IS, colb::IS, B_seq::PetscMat) end + +@for_petsc function MatGetBrowsOfAcols(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, scall::MatReuse, rowb::IS, colb::IS, B_seq::PetscMat ) + B_seq_ = Ref(B_seq.ptr) + + @chk ccall( + (:MatGetBrowsOfAcols, $petsc_library), + PetscErrorCode, + (CMat, CMat, MatReuse, Ptr{CIS}, Ptr{CIS}, Ptr{CMat}), + A, B, scall, rowb, colb, B_seq_, + ) + + B_seq.ptr = C_NULL + + return nothing +end + +""" + mat::PetscMat = MatCreateMPIAIJWithSplitArrays(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}, oi::Vector{PetscInt}, oj::Vector{PetscInt}, oa::Vector{PetscScalar}) +creates a `MATMPIAIJ` matrix using arrays that contain the "diagonal" +and "off-diagonal" part of the matrix in CSR format. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (Cannot be `PETSC_DECIDE`) +- `n` - This value should be the same as the local size used in creating the +x vector for the matrix-vector product y = Ax. (or `PETSC_DECIDE` to have +calculated if `N` is given) For square matrices `n` is almost always `m`. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) +- `i` - row indices for "diagonal" portion of matrix; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row of the matrix +- `j` - column indices, which must be local, i.e., based off the start column of the diagonal portion +- `a` - matrix values +- `oi` - row indices for "off-diagonal" portion of matrix; that is oi[0] = 0, oi[row] = oi[row-1] + number of elements in that row of the matrix +- `oj` - column indices, which must be global, representing global columns in the `MATMPIAIJ` matrix +- `oa` - matrix values + +Output Parameter: +- `mat` - the matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIAIJSetPreallocation()`, `MatMPIAIJSetPreallocationCSR()`, +`MATMPIAIJ`, `MatCreateAIJ()`, `MatCreateMPIAIJWithArrays()` + +# External Links +$(_doc_external("Mat/MatCreateMPIAIJWithSplitArrays")) +""" +function MatCreateMPIAIJWithSplitArrays(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}, oi::Vector{PetscInt}, oj::Vector{PetscInt}, oa::Vector{PetscScalar}) end + +@for_petsc function MatCreateMPIAIJWithSplitArrays(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, a::Vector{$PetscScalar}, oi::Vector{$PetscInt}, oj::Vector{$PetscInt}, oa::Vector{$PetscScalar} ) + mat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIAIJWithSplitArrays, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}, Ptr{CMat}), + comm, m, n, M, N, i, j, a, oi, oj, oa, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + A::PetscMat = MatCreateMPIAIJCRL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}, onz::PetscInt, onnz::Vector{PetscInt}) +Creates a sparse matrix of type `MATMPIAIJCRL`. + +Collective + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `m` - number of rows +- `n` - number of columns +- `nz` - number of nonzeros per row (same for all rows), for the "diagonal" submatrix +- `nnz` - array containing the number of nonzeros in the various rows (possibly different for each row) or `NULL`, for the "diagonal" submatrix +- `onz` - number of nonzeros per row (same for all rows), for the "off-diagonal" submatrix +- `onnz` - array containing the number of nonzeros in the various rows (possibly different for each row) or `NULL`, for the "off-diagonal" submatrix + +Output Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrix Creation](sec_matsparse), `MATAIJ`, `MATAIJSELL`, `MATAIJPERM`, `MATAIJMKL`, `MatCreate()`, `MatCreateMPIAIJPERM()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatCreateMPIAIJCRL")) +""" +function MatCreateMPIAIJCRL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}, onz::PetscInt, onnz::Vector{PetscInt}) end + +@for_petsc function MatCreateMPIAIJCRL(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Vector{$PetscInt}, onz::$PetscInt, onnz::Vector{$PetscInt} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIAIJCRL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, nz, nnz, onz, onnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + A::PetscMat = MatCreateAIJKokkos(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) + +# External Links +$(_doc_external("Mat/MatCreateAIJKokkos")) +""" +function MatCreateAIJKokkos(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) end + +@for_petsc function MatCreateAIJKokkos(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, d_nz::$PetscInt, d_nnz::Vector{$PetscInt}, o_nz::$PetscInt, o_nnz::Vector{$PetscInt} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateAIJKokkos, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, M, N, d_nz, d_nnz, o_nz, o_nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + A::PetscMat = MatCreateMPIAIJMKL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +Creates a sparse parallel matrix whose local +portions are stored as `MATSEQAIJMKL` matrices (a matrix class that inherits +from `MATSEQAIJ` but uses some operations provided by Intel MKL). + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given) +This value should be the same as the local size used in creating the +y vector for the matrix-vector product y = Ax. +- `n` - This value should be the same as the local size used in creating the +x vector for the matrix-vector product y = Ax. (or `PETSC_DECIDE` to have +calculated if N is given) For square matrices n is almost always `m`. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) +- `d_nz` - number of nonzeros per row in DIAGONAL portion of local submatrix +(same value is used for all local rows) +- `d_nnz` - array containing the number of nonzeros in the various rows of the +DIAGONAL portion of the local submatrix (possibly different for each row) +or `NULL`, if `d_nz` is used to specify the nonzero structure. +The size of this array is equal to the number of local rows, i.e `m`. +For matrices you plan to factor you must leave room for the diagonal entry and +put in the entry even if it is zero. +- `o_nz` - number of nonzeros per row in the OFF-DIAGONAL portion of local +submatrix (same value is used for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various rows of the +OFF-DIAGONAL portion of the local submatrix (possibly different for +each row) or `NULL`, if `o_nz` is used to specify the nonzero +structure. The size of this array is equal to the number +of local rows, i.e `m`. + +Output Parameter: +- `A` - the matrix + +Options Database Key: +- `-mat_aijmkl_no_spmv2` - disables use of the SpMV2 inspector-executor routines + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrix Creation](sec_matsparse), `MATMPIAIJMKL`, `MatCreate()`, `MatCreateSeqAIJMKL()`, +`MatSetValues()`, `MatGetOwnershipRange()`, `MatGetOwnershipRanges()`, `MatGetOwnershipRangeColumn()`, +`MatGetOwnershipRangesColumn()`, `PetscLayout` + +# External Links +$(_doc_external("Mat/MatCreateMPIAIJMKL")) +""" +function MatCreateMPIAIJMKL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) end + +@for_petsc function MatCreateMPIAIJMKL(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, d_nz::$PetscInt, d_nnz::Vector{$PetscInt}, o_nz::$PetscInt, o_nnz::Vector{$PetscInt} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIAIJMKL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, M, N, d_nz, d_nnz, o_nz, o_nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatSTRUMPACKSetReordering(petsclib::PetscLibType,F::PetscMat, reordering::MatSTRUMPACKReordering) +Set STRUMPACK fill + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface +- `reordering` - the code to be used to find the fill-reducing reordering + +Options Database Key: +- `-mat_strumpack_reordering ` - Sparsity reducing matrix reordering, see `MatSTRUMPACKReordering` + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatSTRUMPACKReordering`, `MatGetFactor()`, `MatSTRUMPACKSetColPerm()`, `MatSTRUMPACKGetReordering()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetReordering")) +""" +function MatSTRUMPACKSetReordering(petsclib::PetscLibType, F::PetscMat, reordering::MatSTRUMPACKReordering) end + +@for_petsc function MatSTRUMPACKSetReordering(petsclib::$UnionPetscLib, F::PetscMat, reordering::MatSTRUMPACKReordering ) + + @chk ccall( + (:MatSTRUMPACKSetReordering, $petsc_library), + PetscErrorCode, + (CMat, MatSTRUMPACKReordering), + F, reordering, + ) + + + return nothing +end + +""" + MatSTRUMPACKGetReordering(petsclib::PetscLibType,F::PetscMat, reordering::MatSTRUMPACKReordering) +Get STRUMPACK fill + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface + +Output Parameter: +- `reordering` - the code to be used to find the fill-reducing reordering + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatSTRUMPACKReordering`, `MatGetFactor()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKGetReordering")) +""" +function MatSTRUMPACKGetReordering(petsclib::PetscLibType, F::PetscMat, reordering::MatSTRUMPACKReordering) end + +@for_petsc function MatSTRUMPACKGetReordering(petsclib::$UnionPetscLib, F::PetscMat, reordering::MatSTRUMPACKReordering ) + + @chk ccall( + (:MatSTRUMPACKGetReordering, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatSTRUMPACKReordering}), + F, reordering, + ) + + + return nothing +end + +""" + MatSTRUMPACKSetColPerm(petsclib::PetscLibType,F::PetscMat, cperm::PetscBool) +Set whether STRUMPACK +should try to permute the columns of the matrix in order to get a nonzero diagonal + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` +- `cperm` - `PETSC_TRUE` to permute (internally) the columns of the matrix + +Options Database Key: +- `-mat_strumpack_colperm ` - true to use the permutation + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `MatSTRUMPACKSetReordering()`, `Mat`, `MatGetFactor()`, `MatSTRUMPACKGetColPerm()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetColPerm")) +""" +function MatSTRUMPACKSetColPerm(petsclib::PetscLibType, F::PetscMat, cperm::PetscBool) end + +@for_petsc function MatSTRUMPACKSetColPerm(petsclib::$UnionPetscLib, F::PetscMat, cperm::PetscBool ) + + @chk ccall( + (:MatSTRUMPACKSetColPerm, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + F, cperm, + ) + + + return nothing +end + +""" + cperm::PetscBool = MatSTRUMPACKGetColPerm(petsclib::PetscLibType,F::PetscMat) +Get whether STRUMPACK +will try to permute the columns of the matrix in order to get a nonzero diagonal + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` + +Output Parameter: +- `cperm` - Indicates whether STRUMPACK will permute columns + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `MatSTRUMPACKSetReordering()`, `Mat`, `MatGetFactor()`, `MatSTRUMPACKSetColPerm()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKGetColPerm")) +""" +function MatSTRUMPACKGetColPerm(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatSTRUMPACKGetColPerm(petsclib::$UnionPetscLib, F::PetscMat ) + cperm_ = Ref{PetscBool}() + + @chk ccall( + (:MatSTRUMPACKGetColPerm, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + F, cperm_, + ) + + cperm = cperm_[] + + return cperm +end + +""" + MatSTRUMPACKSetGPU(petsclib::PetscLibType,F::PetscMat, gpu::PetscBool) +Set whether STRUMPACK +should enable GPU acceleration (not supported for all compression types) + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface +- `gpu` - whether or not to use GPU acceleration + +Options Database Key: +- `-mat_strumpack_gpu ` - true to use gpu offload + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKGetGPU()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetGPU")) +""" +function MatSTRUMPACKSetGPU(petsclib::PetscLibType, F::PetscMat, gpu::PetscBool) end + +@for_petsc function MatSTRUMPACKSetGPU(petsclib::$UnionPetscLib, F::PetscMat, gpu::PetscBool ) + + @chk ccall( + (:MatSTRUMPACKSetGPU, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + F, gpu, + ) + + + return nothing +end + +""" + gpu::PetscBool = MatSTRUMPACKGetGPU(petsclib::PetscLibType,F::PetscMat) +Get whether STRUMPACK +will try to use GPU acceleration (not supported for all compression types) + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface + +Output Parameter: +- `gpu` - whether or not STRUMPACK will try to use GPU acceleration + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKSetGPU()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKGetGPU")) +""" +function MatSTRUMPACKGetGPU(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatSTRUMPACKGetGPU(petsclib::$UnionPetscLib, F::PetscMat ) + gpu_ = Ref{PetscBool}() + + @chk ccall( + (:MatSTRUMPACKGetGPU, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + F, gpu_, + ) + + gpu = gpu_[] + + return gpu +end + +""" + MatSTRUMPACKSetCompression(petsclib::PetscLibType,F::PetscMat, comp::MatSTRUMPACKCompressionType) +Set STRUMPACK compression type + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface +- `comp` - Type of compression to be used in the approximate sparse factorization + +Options Database Key: +- `-mat_strumpack_compression ` - Type of rank-structured compression in sparse LU factors (choose one of) NONE HSS BLR HODLR BLR_HODLR ZFP_BLR_HODLR LOSSLESS LOSSY + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKCompressionType`, `MatSTRUMPACKGetCompression()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetCompression")) +""" +function MatSTRUMPACKSetCompression(petsclib::PetscLibType, F::PetscMat, comp::MatSTRUMPACKCompressionType) end + +@for_petsc function MatSTRUMPACKSetCompression(petsclib::$UnionPetscLib, F::PetscMat, comp::MatSTRUMPACKCompressionType ) + + @chk ccall( + (:MatSTRUMPACKSetCompression, $petsc_library), + PetscErrorCode, + (CMat, MatSTRUMPACKCompressionType), + F, comp, + ) + + + return nothing +end + +""" + MatSTRUMPACKGetCompression(petsclib::PetscLibType,F::PetscMat, comp::MatSTRUMPACKCompressionType) +Get STRUMPACK compression type + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface + +Output Parameter: +- `comp` - Type of compression to be used in the approximate sparse factorization + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKCompressionType`, `MatSTRUMPACKSetCompression()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKGetCompression")) +""" +function MatSTRUMPACKGetCompression(petsclib::PetscLibType, F::PetscMat, comp::MatSTRUMPACKCompressionType) end + +@for_petsc function MatSTRUMPACKGetCompression(petsclib::$UnionPetscLib, F::PetscMat, comp::MatSTRUMPACKCompressionType ) + + @chk ccall( + (:MatSTRUMPACKGetCompression, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatSTRUMPACKCompressionType}), + F, comp, + ) + + + return nothing +end + +""" + MatSTRUMPACKSetCompRelTol(petsclib::PetscLibType,F::PetscMat, rtol::PetscReal) +Set STRUMPACK relative tolerance for compression + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` +- `rtol` - relative compression tolerance + +Options Database Key: +- `-mat_strumpack_compression_rel_tol <1e-4>` - Relative compression tolerance, when using `-pctype ilu` + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKGetCompRelTol()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetCompRelTol")) +""" +function MatSTRUMPACKSetCompRelTol(petsclib::PetscLibType, F::PetscMat, rtol::PetscReal) end + +@for_petsc function MatSTRUMPACKSetCompRelTol(petsclib::$UnionPetscLib, F::PetscMat, rtol::$PetscReal ) + + @chk ccall( + (:MatSTRUMPACKSetCompRelTol, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal), + F, rtol, + ) + + + return nothing +end + +""" + rtol::PetscReal = MatSTRUMPACKGetCompRelTol(petsclib::PetscLibType,F::PetscMat) +Get STRUMPACK relative tolerance for compression + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` + +Output Parameter: +- `rtol` - relative compression tolerance + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKSetCompRelTol()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKGetCompRelTol")) +""" +function MatSTRUMPACKGetCompRelTol(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatSTRUMPACKGetCompRelTol(petsclib::$UnionPetscLib, F::PetscMat ) + rtol_ = Ref{$PetscReal}() + + @chk ccall( + (:MatSTRUMPACKGetCompRelTol, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + F, rtol_, + ) + + rtol = rtol_[] + + return rtol +end + +""" + MatSTRUMPACKSetCompAbsTol(petsclib::PetscLibType,F::PetscMat, atol::PetscReal) +Set STRUMPACK absolute tolerance for compression + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` +- `atol` - absolute compression tolerance + +Options Database Key: +- `-mat_strumpack_compression_abs_tol <1e-10>` - Absolute compression tolerance, when using `-pctype ilu` + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKGetCompAbsTol()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetCompAbsTol")) +""" +function MatSTRUMPACKSetCompAbsTol(petsclib::PetscLibType, F::PetscMat, atol::PetscReal) end + +@for_petsc function MatSTRUMPACKSetCompAbsTol(petsclib::$UnionPetscLib, F::PetscMat, atol::$PetscReal ) + + @chk ccall( + (:MatSTRUMPACKSetCompAbsTol, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal), + F, atol, + ) + + + return nothing +end + +""" + atol::PetscReal = MatSTRUMPACKGetCompAbsTol(petsclib::PetscLibType,F::PetscMat) +Get STRUMPACK absolute tolerance for compression + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` + +Output Parameter: +- `atol` - absolute compression tolerance + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKSetCompAbsTol()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKGetCompAbsTol")) +""" +function MatSTRUMPACKGetCompAbsTol(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatSTRUMPACKGetCompAbsTol(petsclib::$UnionPetscLib, F::PetscMat ) + atol_ = Ref{$PetscReal}() + + @chk ccall( + (:MatSTRUMPACKGetCompAbsTol, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + F, atol_, + ) + + atol = atol_[] + + return atol +end + +""" + MatSTRUMPACKSetCompLeafSize(petsclib::PetscLibType,F::PetscMat, leaf_size::PetscInt) +Set STRUMPACK leaf size for HSS, BLR, HODLR... + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface +- `leaf_size` - Size of diagonal blocks in rank-structured approximation + +Options Database Key: +- `-mat_strumpack_compression_leaf_size` - Size of diagonal blocks in rank-structured approximation, when using `-pctype ilu` + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKGetCompLeafSize()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetCompLeafSize")) +""" +function MatSTRUMPACKSetCompLeafSize(petsclib::PetscLibType, F::PetscMat, leaf_size::PetscInt) end + +@for_petsc function MatSTRUMPACKSetCompLeafSize(petsclib::$UnionPetscLib, F::PetscMat, leaf_size::$PetscInt ) + + @chk ccall( + (:MatSTRUMPACKSetCompLeafSize, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + F, leaf_size, + ) + + + return nothing +end + +""" + leaf_size::PetscInt = MatSTRUMPACKGetCompLeafSize(petsclib::PetscLibType,F::PetscMat) +Get STRUMPACK leaf size for HSS, BLR, HODLR... + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface + +Output Parameter: +- `leaf_size` - Size of diagonal blocks in rank-structured approximation + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKSetCompLeafSize()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKGetCompLeafSize")) +""" +function MatSTRUMPACKGetCompLeafSize(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatSTRUMPACKGetCompLeafSize(petsclib::$UnionPetscLib, F::PetscMat ) + leaf_size_ = Ref{$PetscInt}() + + @chk ccall( + (:MatSTRUMPACKGetCompLeafSize, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + F, leaf_size_, + ) + + leaf_size = leaf_size_[] + + return leaf_size +end + +""" + MatSTRUMPACKSetGeometricNxyz(petsclib::PetscLibType,F::PetscMat, nx::PetscInt, ny::PetscInt, nz::PetscInt) +Set STRUMPACK mesh x, y and z dimensions, for use with GEOMETRIC ordering. + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface +- `nx` - x dimension of the mesh +- `ny` - y dimension of the mesh +- `nz` - z dimension of the mesh + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetGeometricNxyz")) +""" +function MatSTRUMPACKSetGeometricNxyz(petsclib::PetscLibType, F::PetscMat, nx::PetscInt, ny::PetscInt, nz::PetscInt) end + +@for_petsc function MatSTRUMPACKSetGeometricNxyz(petsclib::$UnionPetscLib, F::PetscMat, nx::$PetscInt, ny::$PetscInt, nz::$PetscInt ) + + @chk ccall( + (:MatSTRUMPACKSetGeometricNxyz, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, $PetscInt), + F, nx, ny, nz, + ) + + + return nothing +end + +""" + MatSTRUMPACKSetGeometricComponents(petsclib::PetscLibType,F::PetscMat, nc::PetscInt) +Set STRUMPACK +number of degrees of freedom per mesh point, for use with GEOMETRIC ordering. + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface +- `nc` - Number of components/dof's per grid point + +Options Database Key: +- `-mat_strumpack_geometric_components <1>` - Number of components per mesh point, for geometric nested dissection ordering + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetGeometricComponents")) +""" +function MatSTRUMPACKSetGeometricComponents(petsclib::PetscLibType, F::PetscMat, nc::PetscInt) end + +@for_petsc function MatSTRUMPACKSetGeometricComponents(petsclib::$UnionPetscLib, F::PetscMat, nc::$PetscInt ) + + @chk ccall( + (:MatSTRUMPACKSetGeometricComponents, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + F, nc, + ) + + + return nothing +end + +""" + MatSTRUMPACKSetGeometricWidth(petsclib::PetscLibType,F::PetscMat, w::PetscInt) +Set STRUMPACK width of the separator, for use with GEOMETRIC ordering. + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface +- `w` - width of the separator + +Options Database Key: +- `-mat_strumpack_geometric_width <1>` - Width of the separator of the mesh, for geometric nested dissection ordering + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetGeometricWidth")) +""" +function MatSTRUMPACKSetGeometricWidth(petsclib::PetscLibType, F::PetscMat, w::PetscInt) end + +@for_petsc function MatSTRUMPACKSetGeometricWidth(petsclib::$UnionPetscLib, F::PetscMat, w::$PetscInt ) + + @chk ccall( + (:MatSTRUMPACKSetGeometricWidth, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + F, w, + ) + + + return nothing +end + +""" + MatSTRUMPACKSetCompMinSepSize(petsclib::PetscLibType,F::PetscMat, min_sep_size::PetscInt) +Set STRUMPACK minimum separator size for low + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface +- `min_sep_size` - minimum dense matrix size for low-rank approximation + +Options Database Key: +- `-mat_strumpack_compression_min_sep_size ` - Minimum size of dense sub-block for low-rank compression + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKGetCompMinSepSize()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetCompMinSepSize")) +""" +function MatSTRUMPACKSetCompMinSepSize(petsclib::PetscLibType, F::PetscMat, min_sep_size::PetscInt) end + +@for_petsc function MatSTRUMPACKSetCompMinSepSize(petsclib::$UnionPetscLib, F::PetscMat, min_sep_size::$PetscInt ) + + @chk ccall( + (:MatSTRUMPACKSetCompMinSepSize, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + F, min_sep_size, + ) + + + return nothing +end + +""" + min_sep_size::PetscInt = MatSTRUMPACKGetCompMinSepSize(petsclib::PetscLibType,F::PetscMat) +Get STRUMPACK minimum separator size for low + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface + +Output Parameter: +- `min_sep_size` - minimum dense matrix size for low-rank approximation + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKSetCompMinSepSize()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKGetCompMinSepSize")) +""" +function MatSTRUMPACKGetCompMinSepSize(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatSTRUMPACKGetCompMinSepSize(petsclib::$UnionPetscLib, F::PetscMat ) + min_sep_size_ = Ref{$PetscInt}() + + @chk ccall( + (:MatSTRUMPACKGetCompMinSepSize, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + F, min_sep_size_, + ) + + min_sep_size = min_sep_size_[] + + return min_sep_size +end + +""" + MatSTRUMPACKSetCompLossyPrecision(petsclib::PetscLibType,F::PetscMat, lossy_prec::PetscInt) +Set STRUMPACK precision for lossy compression (requires ZFP support) + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface +- `lossy_prec` - Number of bitplanes to use in lossy compression + +Options Database Key: +- `-mat_strumpack_compression_lossy_precision ` - Precision when using lossy compression [1-64], when using `-pctype ilu -mat_strumpack_compression MAT_STRUMPACK_COMPRESSION_TYPE_LOSSY` + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKGetCompLossyPrecision()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetCompLossyPrecision")) +""" +function MatSTRUMPACKSetCompLossyPrecision(petsclib::PetscLibType, F::PetscMat, lossy_prec::PetscInt) end + +@for_petsc function MatSTRUMPACKSetCompLossyPrecision(petsclib::$UnionPetscLib, F::PetscMat, lossy_prec::$PetscInt ) + + @chk ccall( + (:MatSTRUMPACKSetCompLossyPrecision, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + F, lossy_prec, + ) + + + return nothing +end + +""" + lossy_prec::PetscInt = MatSTRUMPACKGetCompLossyPrecision(petsclib::PetscLibType,F::PetscMat) +Get STRUMPACK precision for lossy compression (requires ZFP support) + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface + +Output Parameter: +- `lossy_prec` - Number of bitplanes to use in lossy compression + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKSetCompLossyPrecision()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKGetCompLossyPrecision")) +""" +function MatSTRUMPACKGetCompLossyPrecision(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatSTRUMPACKGetCompLossyPrecision(petsclib::$UnionPetscLib, F::PetscMat ) + lossy_prec_ = Ref{$PetscInt}() + + @chk ccall( + (:MatSTRUMPACKGetCompLossyPrecision, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + F, lossy_prec_, + ) + + lossy_prec = lossy_prec_[] + + return lossy_prec +end + +""" + MatSTRUMPACKSetCompButterflyLevels(petsclib::PetscLibType,F::PetscMat, bfly_lvls::PetscInt) +Set STRUMPACK +number of butterfly levels in HODLR compression (requires ButterflyPACK support) + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface +- `bfly_lvls` - Number of levels of butterfly compression in HODLR compression + +Options Database Key: +- `-mat_strumpack_compression_butterfly_levels ` - Number of levels in the hierarchically off-diagonal matrix for which to use butterfly, +when using `-pctype ilu`, (BLR_)HODLR compression + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKGetCompButterflyLevels()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKSetCompButterflyLevels")) +""" +function MatSTRUMPACKSetCompButterflyLevels(petsclib::PetscLibType, F::PetscMat, bfly_lvls::PetscInt) end + +@for_petsc function MatSTRUMPACKSetCompButterflyLevels(petsclib::$UnionPetscLib, F::PetscMat, bfly_lvls::$PetscInt ) + + @chk ccall( + (:MatSTRUMPACKSetCompButterflyLevels, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + F, bfly_lvls, + ) + + + return nothing +end + +""" + bfly_lvls::PetscInt = MatSTRUMPACKGetCompButterflyLevels(petsclib::PetscLibType,F::PetscMat) +Get STRUMPACK +number of butterfly levels in HODLR compression (requires ButterflyPACK support) + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface + +Output Parameter: +- `bfly_lvls` - Number of levels of butterfly compression in HODLR compression + +Level: intermediate + +-seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKSetCompButterflyLevels()` + +# External Links +$(_doc_external("Mat/MatSTRUMPACKGetCompButterflyLevels")) +""" +function MatSTRUMPACKGetCompButterflyLevels(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatSTRUMPACKGetCompButterflyLevels(petsclib::$UnionPetscLib, F::PetscMat ) + bfly_lvls_ = Ref{$PetscInt}() + + @chk ccall( + (:MatSTRUMPACKGetCompButterflyLevels, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + F, bfly_lvls_, + ) + + bfly_lvls = bfly_lvls_[] + + return bfly_lvls +end + +""" + A::PetscMat = MatCreateMPIAIJSELL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +Creates a sparse parallel matrix whose local +portions are stored as `MATSEQAIJSELL` matrices (a matrix class that inherits +from SEQAIJ but performs some operations in SELL format). + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given) +This value should be the same as the local size used in creating the +y vector for the matrix-vector product y = Ax. +- `n` - This value should be the same as the local size used in creating the +x vector for the matrix-vector product y = Ax. (or `PETSC_DECIDE` to have +calculated if `N` is given) For square matrices `n` is almost always `m`. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) +- `d_nz` - number of nonzeros per row in DIAGONAL portion of local submatrix +(same value is used for all local rows) +- `d_nnz` - array containing the number of nonzeros in the various rows of the +DIAGONAL portion of the local submatrix (possibly different for each row) +or `NULL`, if `d_nz` is used to specify the nonzero structure. +The size of this array is equal to the number of local rows, i.e `m`. +For matrices you plan to factor you must leave room for the diagonal entry and +put in the entry even if it is zero. +- `o_nz` - number of nonzeros per row in the OFF-DIAGONAL portion of local +submatrix (same value is used for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various rows of the +OFF-DIAGONAL portion of the local submatrix (possibly different for +each row) or `NULL`, if `o_nz` is used to specify the nonzero +structure. The size of this array is equal to the number +of local rows, i.e `m`. + +Output Parameter: +- `A` - the matrix + +Options Database Key: +- `-mat_aijsell_eager_shadow` - Construct shadow matrix upon matrix assembly; default is to take a "lazy" approach, performing this step the first +time the matrix is applied + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrix Creation](sec_matsparse), `MATSEQAIJSELL`, `MATMPIAIJSELL`, `MATAIJSELL`, `MatCreate()`, `MatCreateSeqAIJSELL()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatCreateMPIAIJSELL")) +""" +function MatCreateMPIAIJSELL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) end + +@for_petsc function MatCreateMPIAIJSELL(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, d_nz::$PetscInt, d_nnz::Vector{$PetscInt}, o_nz::$PetscInt, o_nnz::Vector{$PetscInt} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIAIJSELL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, M, N, d_nz, d_nnz, o_nz, o_nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + A::PetscMat = MatCreateAIJViennaCL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) + +# External Links +$(_doc_external("Mat/MatCreateAIJViennaCL")) +""" +function MatCreateAIJViennaCL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) end + +@for_petsc function MatCreateAIJViennaCL(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, d_nz::$PetscInt, d_nnz::Vector{$PetscInt}, o_nz::$PetscInt, o_nnz::Vector{$PetscInt} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateAIJViennaCL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, M, N, d_nz, d_nnz, o_nz, o_nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + diagU::PetscScalar = MatSuperluDistGetDiagU(petsclib::PetscLibType,F::PetscMat) + +# External Links +$(_doc_external("Mat/MatSuperluDistGetDiagU")) +""" +function MatSuperluDistGetDiagU(petsclib::PetscLibType, F::PetscMat) end + +@for_petsc function MatSuperluDistGetDiagU(petsclib::$UnionPetscLib, F::PetscMat ) + diagU_ = Ref{$PetscScalar}() + + @chk ccall( + (:MatSuperluDistGetDiagU, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + F, diagU_, + ) + + diagU = diagU_[] + + return diagU +end + +""" + A::PetscMat = MatCreateMPIAIJPERM(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt}) +Creates a sparse parallel matrix whose local +portions are stored as `MATSEQAIJPERM` matrices (a matrix class that inherits +from SEQAIJ but includes some optimizations to allow more effective +vectorization). + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given) +This value should be the same as the local size used in creating the +y vector for the matrix-vector product y = Ax. +- `n` - This value should be the same as the local size used in creating the +x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have +calculated if `N` is given) For square matrices `n` is almost always `m`. +- `M` - number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given) +- `d_nz` - number of nonzeros per row in DIAGONAL portion of local submatrix +(same value is used for all local rows) +- `d_nnz` - array containing the number of nonzeros in the various rows of the +DIAGONAL portion of the local submatrix (possibly different for each row) +or `NULL`, if `d_nz` is used to specify the nonzero structure. +The size of this array is equal to the number of local rows, i.e `m`. +For matrices you plan to factor you must leave room for the diagonal entry and +put in the entry even if it is zero. +- `o_nz` - number of nonzeros per row in the OFF-DIAGONAL portion of local +submatrix (same value is used for all local rows). +- `o_nnz` - array containing the number of nonzeros in the various rows of the +OFF-DIAGONAL portion of the local submatrix (possibly different for +each row) or `NULL`, if `o_nz` is used to specify the nonzero +structure. The size of this array is equal to the number +of local rows, i.e `m`. + +Output Parameter: +- `A` - the matrix + +Options Database Keys: +- `-mat_no_inode` - Do not use inodes +- `-mat_inode_limit ` - Sets inode limit (max limit=5) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrix Creation](sec_matsparse), `MATMPIAIJPERM`, `MatCreate()`, `MatCreateSeqAIJPERM()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatCreateMPIAIJPERM")) +""" +function MatCreateMPIAIJPERM(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr,Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateMPIAIJPERM(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, d_nz::$PetscInt, d_nnz::Union{Ptr,Vector{$PetscInt}}, o_nz::$PetscInt, o_nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateMPIAIJPERM, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, M, N, d_nz, d_nnz, o_nz, o_nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatMumpsSetIcntl(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt, ival::PetscInt) +Set MUMPS parameter ICNTL() ` - change the option numbered `icntl` to `ival` + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatMumpsGetIcntl()`, `MatMumpsSetCntl()`, `MatMumpsGetCntl()`, `MatMumpsGetInfo()`, `MatMumpsGetInfog()`, `MatMumpsGetRinfo()`, `MatMumpsGetRinfog()` + +# External Links +$(_doc_external("Mat/MatMumpsSetIcntl")) +""" +function MatMumpsSetIcntl(petsclib::PetscLibType, F::PetscMat, icntl::PetscInt, ival::PetscInt) end + +@for_petsc function MatMumpsSetIcntl(petsclib::$UnionPetscLib, F::PetscMat, icntl::$PetscInt, ival::$PetscInt ) + + @chk ccall( + (:MatMumpsSetIcntl, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt), + F, icntl, ival, + ) + + + return nothing +end + +""" + ival::PetscInt = MatMumpsGetIcntl(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt) +Get MUMPS parameter ICNTL() ` - change the option numbered icntl to ival + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MatMumpsSetIcntl()`, `MatMumpsGetIcntl()`, `MatMumpsGetCntl()`, `MatMumpsGetInfo()`, `MatMumpsGetInfog()`, `MatMumpsGetRinfo()`, `MatMumpsGetRinfog()` + +# External Links +$(_doc_external("Mat/MatMumpsSetCntl")) +""" +function MatMumpsSetCntl(petsclib::PetscLibType, F::PetscMat, icntl::PetscInt, val::PetscReal) end + +@for_petsc function MatMumpsSetCntl(petsclib::$UnionPetscLib, F::PetscMat, icntl::$PetscInt, val::$PetscReal ) + + @chk ccall( + (:MatMumpsSetCntl, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscReal), + F, icntl, val, + ) + + + return nothing +end + +""" + val::PetscReal = MatMumpsGetCntl(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt) +Get MUMPS parameter CNTL() ` - Sets inode limit (max limit=5) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, [Sparse Matrix Creation](sec_matsparse), `MatCreate()`, `MatCreateAIJ()`, `MatSetValues()`, `MatSeqAIJSetColumnIndices()`, `MatCreateSeqAIJWithArrays()` + +# External Links +$(_doc_external("Mat/MatCreateSeqAIJ")) +""" +function MatCreateSeqAIJ(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateSeqAIJ(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqAIJ, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatSeqAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, nz::PetscInt, nnz::Vector{PetscInt}) +For good matrix assembly performance +the user should preallocate the matrix storage by setting the parameter nz +(or the array nnz). By setting these parameters accurately, performance +during matrix assembly can be increased by more than a factor of 50. + +Collective + +Input Parameters: +- `B` - The matrix +- `nz` - number of nonzeros per row (same for all rows) +- `nnz` - array containing the number of nonzeros in the various rows +(possibly different for each row) or NULL + +Options Database Keys: +- `-mat_no_inode` - Do not use inodes +- `-mat_inode_limit ` - Sets inode limit (max limit=5) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateAIJ()`, `MatSetValues()`, `MatSeqAIJSetColumnIndices()`, `MatCreateSeqAIJWithArrays()`, `MatGetInfo()`, +`MatSeqAIJSetTotalPreallocation()` + +# External Links +$(_doc_external("Mat/MatSeqAIJSetPreallocation")) +""" +function MatSeqAIJSetPreallocation(petsclib::PetscLibType, B::PetscMat, nz::PetscInt, nnz::Vector{PetscInt}) end + +@for_petsc function MatSeqAIJSetPreallocation(petsclib::$UnionPetscLib, B::PetscMat, nz::$PetscInt, nnz::Vector{$PetscInt} ) + + @chk ccall( + (:MatSeqAIJSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}), + B, nz, nnz, + ) + + + return nothing +end + +""" + MatSeqAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar}) +Allocates memory for a sparse sequential matrix in `MATSEQAIJ` format. + +Input Parameters: +- `B` - the matrix +- `i` - the indices into `j` for the start of each row (indices start with zero) +- `j` - the column indices for each row (indices start with zero) these must be sorted for each row +- `v` - optional values in the matrix, use `NULL` if not provided + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatSeqAIJSetPreallocation()`, `MATSEQAIJ`, `MatResetPreallocation()` + +# External Links +$(_doc_external("Mat/MatSeqAIJSetPreallocationCSR")) +""" +function MatSeqAIJSetPreallocationCSR(petsclib::PetscLibType, B::PetscMat, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar}) end + +@for_petsc function MatSeqAIJSetPreallocationCSR(petsclib::$UnionPetscLib, B::PetscMat, i::Vector{$PetscInt}, j::Vector{$PetscInt}, v::Vector{$PetscScalar} ) + + @chk ccall( + (:MatSeqAIJSetPreallocationCSR, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}), + B, i, j, v, + ) + + + return nothing +end + +""" + MatSeqAIJKron(petsclib::PetscLibType,A::PetscMat, B::PetscMat, reuse::MatReuse, C::PetscMat) +Computes `C`, the Kronecker product of `A` and `B`. + +Input Parameters: +- `A` - left-hand side matrix +- `B` - right-hand side matrix +- `reuse` - either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX` + +Output Parameter: +- `C` - Kronecker product of `A` and `B` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreateSeqAIJ()`, `MATSEQAIJ`, `MATKAIJ`, `MatReuse` + +# External Links +$(_doc_external("Mat/MatSeqAIJKron")) +""" +function MatSeqAIJKron(petsclib::PetscLibType, A::PetscMat, B::PetscMat, reuse::MatReuse, C::PetscMat) end + +@for_petsc function MatSeqAIJKron(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, reuse::MatReuse, C::PetscMat ) + C_ = Ref(C.ptr) + + @chk ccall( + (:MatSeqAIJKron, $petsc_library), + PetscErrorCode, + (CMat, CMat, MatReuse, Ptr{CMat}), + A, B, reuse, C_, + ) + + C.ptr = C_NULL + + return nothing +end + +""" + array::Vector{PetscScalar} = MatSeqAIJGetArray(petsclib::PetscLibType,A::PetscMat) +gives read/write access to the array where the data for a `MATSEQAIJ` matrix is stored + +Not Collective + +Input Parameter: +- `A` - a `MATSEQAIJ` matrix + +Output Parameter: +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJRestoreArray()` + +# External Links +$(_doc_external("Mat/MatSeqAIJGetArray")) +""" +function MatSeqAIJGetArray(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqAIJGetArray(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatSeqAIJGetArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatSeqAIJRestoreArray(petsclib::PetscLibType,A::PetscMat) +returns access to the array where the data for a `MATSEQAIJ` matrix is stored obtained by `MatSeqAIJGetArray()` + +Not Collective + +Input Parameters: +- `A` - a `MATSEQAIJ` matrix +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJGetArray()` + +# External Links +$(_doc_external("Mat/MatSeqAIJRestoreArray")) +""" +function MatSeqAIJRestoreArray(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqAIJRestoreArray(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatSeqAIJRestoreArray, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatSeqAIJGetArrayRead(petsclib::PetscLibType,A::PetscMat) +gives read + +Not Collective; No Fortran Support + +Input Parameter: +- `A` - a `MATSEQAIJ` matrix + +Output Parameter: +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJGetArray()`, `MatSeqAIJRestoreArrayRead()` + +# External Links +$(_doc_external("Mat/MatSeqAIJGetArrayRead")) +""" +function MatSeqAIJGetArrayRead(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqAIJGetArrayRead(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatSeqAIJGetArrayRead, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatSeqAIJRestoreArrayRead(petsclib::PetscLibType,A::PetscMat) +restore the read + +Not Collective; No Fortran Support + +Input Parameter: +- `A` - a `MATSEQAIJ` matrix + +Output Parameter: +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJGetArray()`, `MatSeqAIJGetArrayRead()` + +# External Links +$(_doc_external("Mat/MatSeqAIJRestoreArrayRead")) +""" +function MatSeqAIJRestoreArrayRead(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqAIJRestoreArrayRead(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatSeqAIJRestoreArrayRead, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatSeqAIJGetArrayWrite(petsclib::PetscLibType,A::PetscMat) +gives write + +Not Collective; No Fortran Support + +Input Parameter: +- `A` - a `MATSEQAIJ` matrix + +Output Parameter: +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJGetArray()`, `MatSeqAIJRestoreArrayRead()` + +# External Links +$(_doc_external("Mat/MatSeqAIJGetArrayWrite")) +""" +function MatSeqAIJGetArrayWrite(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqAIJGetArrayWrite(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatSeqAIJGetArrayWrite, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + array::Vector{PetscScalar} = MatSeqAIJRestoreArrayWrite(petsclib::PetscLibType,A::PetscMat) +restore the read + +Not Collective; No Fortran Support + +Input Parameter: +- `A` - a MATSEQAIJ matrix + +Output Parameter: +- `array` - pointer to the data + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJGetArray()`, `MatSeqAIJGetArrayRead()` + +# External Links +$(_doc_external("Mat/MatSeqAIJRestoreArrayWrite")) +""" +function MatSeqAIJRestoreArrayWrite(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqAIJRestoreArrayWrite(petsclib::$UnionPetscLib, A::PetscMat ) + array_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:MatSeqAIJRestoreArrayWrite, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscScalar}}), + A, array_, + ) + + array = unsafe_wrap(Array, array_[], VecGetLocalSize(petsclib, x); own = false) + + return array +end + +""" + i::Vector{PetscInt},j::Vector{PetscInt},a::Vector{PetscScalar},mtype::PetscMemType = MatSeqAIJGetCSRAndMemType(petsclib::PetscLibType,mat::PetscMat) +Get the CSR arrays and the memory type of the `MATSEQAIJ` matrix + +Not Collective; No Fortran Support + +Input Parameter: +- `mat` - a matrix of type `MATSEQAIJ` or its subclasses + +Output Parameters: +- `i` - row map array of the matrix +- `j` - column index array of the matrix +- `a` - data array of the matrix +- `mtype` - memory type of the arrays + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJGetArray()`, `MatSeqAIJGetArrayRead()` + +# External Links +$(_doc_external("Mat/MatSeqAIJGetCSRAndMemType")) +""" +function MatSeqAIJGetCSRAndMemType(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatSeqAIJGetCSRAndMemType(petsclib::$UnionPetscLib, mat::PetscMat ) + i_ = Ref{Ptr{$PetscInt}}() + j_ = Ref{Ptr{$PetscInt}}() + a_ = Ref{Ptr{$PetscScalar}}() + mtype_ = Ref{PetscMemType}() + + @chk ccall( + (:MatSeqAIJGetCSRAndMemType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscScalar}}, Ptr{PetscMemType}), + mat, i_, j_, a_, mtype_, + ) + + i = unsafe_wrap(Array, i_[], VecGetLocalSize(petsclib, x); own = false) + j = unsafe_wrap(Array, j_[], VecGetLocalSize(petsclib, x); own = false) + a = unsafe_wrap(Array, a_[], VecGetLocalSize(petsclib, x); own = false) + mtype = unsafe_string(mtype_[]) + + return i,j,a,mtype +end + +""" + nz::PetscInt = MatSeqAIJGetMaxRowNonzeros(petsclib::PetscLibType,A::PetscMat) +returns the maximum number of nonzeros in any row + +Not Collective + +Input Parameter: +- `A` - a `MATSEQAIJ` matrix + +Output Parameter: +- `nz` - the maximum number of nonzeros in any row + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJRestoreArray()` + +# External Links +$(_doc_external("Mat/MatSeqAIJGetMaxRowNonzeros")) +""" +function MatSeqAIJGetMaxRowNonzeros(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatSeqAIJGetMaxRowNonzeros(petsclib::$UnionPetscLib, A::PetscMat ) + nz_ = Ref{$PetscInt}() + + @chk ccall( + (:MatSeqAIJGetMaxRowNonzeros, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + A, nz_, + ) + + nz = nz_[] + + return nz +end + +""" + mat::PetscMat = MatCreateSeqAIJWithArrays(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) +Creates an sequential `MATSEQAIJ` matrix using matrix elements (in CSR format) +provided by the user. + +Collective + +Input Parameters: +- `comm` - must be an MPI communicator of size 1 +- `m` - number of rows +- `n` - number of columns +- `i` - row indices; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row of the matrix +- `j` - column indices +- `a` - matrix values + +Output Parameter: +- `mat` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateAIJ()`, `MatCreateSeqAIJ()`, `MatCreateMPIAIJWithArrays()`, `MatMPIAIJSetPreallocationCSR()` + +# External Links +$(_doc_external("Mat/MatCreateSeqAIJWithArrays")) +""" +function MatCreateSeqAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}) end + +@for_petsc function MatCreateSeqAIJWithArrays(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, a::Vector{$PetscScalar} ) + mat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqAIJWithArrays, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}, Ptr{CMat}), + comm, m, n, i, j, a, mat_, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + mat::PetscMat = MatCreateSeqAIJFromTriple(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}, nz::PetscCount, idx::PetscBool) +Creates an sequential `MATSEQAIJ` matrix using matrix elements (in COO format) +provided by the user. + +Collective + +Input Parameters: +- `comm` - must be an MPI communicator of size 1 +- `m` - number of rows +- `n` - number of columns +- `i` - row indices +- `j` - column indices +- `a` - matrix values +- `nz` - number of nonzeros +- `idx` - if the `i` and `j` indices start with 1 use `PETSC_TRUE` otherwise use `PETSC_FALSE` + +Output Parameter: +- `mat` - the matrix + +Level: intermediate + +Example: +For the following matrix, the input data expected is as shown (using 0 based indexing) +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateAIJ()`, `MatCreateSeqAIJ()`, `MatCreateSeqAIJWithArrays()`, `MatMPIAIJSetPreallocationCSR()`, `MatSetValuesCOO()`, `MatSetPreallocationCOO()` + +# External Links +$(_doc_external("Mat/MatCreateSeqAIJFromTriple")) +""" +function MatCreateSeqAIJFromTriple(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}, nz::PetscCount, idx::PetscBool) end + +@for_petsc function MatCreateSeqAIJFromTriple(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, i::Vector{$PetscInt}, j::Vector{$PetscInt}, a::Vector{$PetscScalar}, nz::PetscCount, idx::PetscBool ) + mat_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqAIJFromTriple, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscScalar}, Ptr{CMat}, PetscCount, PetscBool), + comm, m, n, i, j, a, mat_, nz, idx, + ) + + mat = PetscMat(mat_[], petsclib) + + return mat +end + +""" + MatSeqAIJSetType(petsclib::PetscLibType,mat::PetscMat, matype::MatType) +Converts a `MATSEQAIJ` matrix to a subtype + +Collective + +Input Parameters: +- `mat` - the matrix object +- `matype` - matrix type + +Options Database Key: +- `-mat_seqaij_type ` - for example seqaijcrl + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `PCSetType()`, `VecSetType()`, `MatCreate()`, `MatType` + +# External Links +$(_doc_external("Mat/MatSeqAIJSetType")) +""" +function MatSeqAIJSetType(petsclib::PetscLibType, mat::PetscMat, matype::MatType) end + +@for_petsc function MatSeqAIJSetType(petsclib::$UnionPetscLib, mat::PetscMat, matype::MatType ) + + @chk ccall( + (:MatSeqAIJSetType, $petsc_library), + PetscErrorCode, + (CMat, MatType), + mat, matype, + ) + + + return nothing +end + +""" + MatSeqAIJRegister(petsclib::PetscLibType,sname::Vector{Cchar}, fnc::external) + + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined matrix type, for example `MATSEQAIJCRL` +- `function` - routine to convert to subtype + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJRegisterAll()` + +# External Links +$(_doc_external("Mat/MatSeqAIJRegister")) +""" +function MatSeqAIJRegister(petsclib::PetscLibType, sname::Vector{Cchar}, fnc::external) end + +@for_petsc function MatSeqAIJRegister(petsclib::$UnionPetscLib, sname::Vector{Cchar}, fnc::external ) + + @chk ccall( + (:MatSeqAIJRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + MatInodeAdjustForInodes(petsclib::PetscLibType,A::PetscMat, rperm::IS, cperm::IS) + +# External Links +$(_doc_external("Mat/MatInodeAdjustForInodes")) +""" +function MatInodeAdjustForInodes(petsclib::PetscLibType, A::PetscMat, rperm::IS, cperm::IS) end + +@for_petsc function MatInodeAdjustForInodes(petsclib::$UnionPetscLib, A::PetscMat, rperm::IS, cperm::IS ) + + @chk ccall( + (:MatInodeAdjustForInodes, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CIS}, Ptr{CIS}), + A, rperm, cperm, + ) + + + return nothing +end + +""" + node_count::PetscInt,sizes::Vector{PetscInt},limit::PetscInt = MatInodeGetInodeSizes(petsclib::PetscLibType,A::PetscMat) +Returns the inode information of a matrix with inodes + +Not Collective + +Input Parameter: +- `A` - the Inode matrix or matrix derived from the Inode class -- e.g., `MATSEQAIJ` + +Output Parameters: +- `node_count` - no of inodes present in the matrix. +- `sizes` - an array of size `node_count`, with the sizes of each inode. +- `limit` - the max size used to generate the inodes. + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetInfo()` + +# External Links +$(_doc_external("Mat/MatInodeGetInodeSizes")) +""" +function MatInodeGetInodeSizes(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatInodeGetInodeSizes(petsclib::$UnionPetscLib, A::PetscMat ) + node_count_ = Ref{$PetscInt}() + sizes_ = Ref{Ptr{$PetscInt}}() + limit_ = Ref{$PetscInt}() + + @chk ccall( + (:MatInodeGetInodeSizes, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}), + A, node_count_, sizes_, limit_, + ) + + node_count = node_count_[] + sizes = unsafe_wrap(Array, sizes_[], VecGetLocalSize(petsclib, x); own = false) + limit = limit_[] + + return node_count,sizes,limit +end + + +""" + A::PetscMat = MatCreateSeqAIJCRL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) +Creates a sparse matrix of type `MATSEQAIJCRL`. + +Collective + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `m` - number of rows +- `n` - number of columns +- `nz` - number of nonzeros per row (same for all rows), ignored if `nnz` is given +- `nnz` - array containing the number of nonzeros in the various rows +(possibly different for each row) or `NULL` + +Output Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateMPIAIJPERM()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatCreateSeqAIJCRL")) +""" +function MatCreateSeqAIJCRL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateSeqAIJCRL(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Vector{$PetscInt} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqAIJCRL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + + +""" + A::PetscMat = MatCreateSeqAIJKokkos(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) + +# External Links +$(_doc_external("Mat/MatCreateSeqAIJKokkos")) +""" +function MatCreateSeqAIJKokkos(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateSeqAIJKokkos(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqAIJKokkos, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatSuperluSetILUDropTol(petsclib::PetscLibType,F::PetscMat, dtol::PetscReal) +Set SuperLU ILU drop tolerance + +Logically Collective + +Input Parameters: +- `F` - the factored matrix obtained by calling `MatGetFactor()` +- `dtol` - drop tolerance + +Options Database Key: +- `-mat_superlu_ilu_droptol ` - the drop tolerance + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatGetFactor()`, `MATSOLVERSUPERLU` + +# External Links +$(_doc_external("Mat/MatSuperluSetILUDropTol")) +""" +function MatSuperluSetILUDropTol(petsclib::PetscLibType, F::PetscMat, dtol::PetscReal) end + +@for_petsc function MatSuperluSetILUDropTol(petsclib::$UnionPetscLib, F::PetscMat, dtol::$PetscReal ) + + @chk ccall( + (:MatSuperluSetILUDropTol, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal), + F, dtol, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreateSeqAIJViennaCL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) + +# External Links +$(_doc_external("Mat/MatCreateSeqAIJViennaCL")) +""" +function MatCreateSeqAIJViennaCL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateSeqAIJViennaCL(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqAIJViennaCL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + A::PetscMat = MatCreateSeqAIJMKL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) +Creates a sparse matrix of type `MATSEQAIJMKL`. + +Collective + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `m` - number of rows +- `n` - number of columns +- `nz` - number of nonzeros per row (same for all rows) +- `nnz` - array containing the number of nonzeros in the various rows +(possibly different for each row) or `NULL` + +Output Parameter: +- `A` - the matrix + +Options Database Keys: +- `-mat_aijmkl_no_spmv2` - disable use of the SpMV2 inspector-executor routines +- `-mat_aijmkl_eager_inspection` - perform MKL "inspection" phase upon matrix assembly; default is to do "lazy" inspection, +performing this step the first time the matrix is applied + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateMPIAIJMKL()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatCreateSeqAIJMKL")) +""" +function MatCreateSeqAIJMKL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) end + +@for_petsc function MatCreateSeqAIJMKL(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Vector{$PetscInt} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqAIJMKL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + A::PetscMat = MatCreateSeqAIJSELL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) +Creates a sparse matrix of type `MATSEQAIJSELL`. + +Collective + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `m` - number of rows +- `n` - number of columns +- `nz` - number of nonzeros per row (same for all rows) +- `nnz` - array containing the number of nonzeros in the various rows +(possibly different for each row) or `NULL` + +Output Parameter: +- `A` - the matrix + +Options Database Keys: +- `-mat_aijsell_eager_shadow` - Construct shadow matrix upon matrix assembly; default is to take a "lazy" approach, +performing this step the first time the matrix is applied + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateMPIAIJSELL()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatCreateSeqAIJSELL")) +""" +function MatCreateSeqAIJSELL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr,Vector{PetscInt}}) end + +@for_petsc function MatCreateSeqAIJSELL(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Union{Ptr,Vector{$PetscInt}} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqAIJSELL, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + A::PetscMat = MatCreateSeqAIJPERM(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) +Creates a sparse matrix of type `MATSEQAIJPERM`. + +Collective + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `m` - number of rows +- `n` - number of columns +- `nz` - number of nonzeros per row (same for all rows), ignored if `nnz` is given +- `nnz` - array containing the number of nonzeros in the various rows (possibly different for each row) or `NULL` + +Output Parameter: +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatCreateMPIAIJPERM()`, `MatSetValues()` + +# External Links +$(_doc_external("Mat/MatCreateSeqAIJPERM")) +""" +function MatCreateSeqAIJPERM(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}) end + +@for_petsc function MatCreateSeqAIJPERM(petsclib::$UnionPetscLib, comm::MPI_Comm, m::$PetscInt, n::$PetscInt, nz::$PetscInt, nnz::Vector{$PetscInt} ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSeqAIJPERM, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{CMat}), + comm, m, n, nz, nnz, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + data::PetscScalar,A::PetscMat = MatCreateDenseFromVecType(petsclib::PetscLibType,comm::MPI_Comm, vtype::VecType, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, lda::PetscInt) +Create a matrix that matches the type of a Vec. + +Collective + +Input Parameters: +- `comm` - the communicator +- `vtype` - the vector type +- `m` - number of local rows (or `PETSC_DECIDE` to have calculated if `M` is given) +- `n` - number of local columns (or `PETSC_DECIDE` to have calculated if `N` is given) +- `M` - number of global rows (or `PETSC_DECIDE` to have calculated if `m` is given) +- `N` - number of global columns (or `PETSC_DECIDE` to have calculated if `n` is given) +- `lda` - optional leading dimension. Pass any non-positive number to use the default. +- `data` - optional location of matrix data, which should have the same memory type as the vector. Pass `NULL` to have PETSc take care of matrix memory allocation. + +Output Parameter: +- `A` - the dense matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatCreateDense()`, `MatCreateDenseCUDA()`, `MatCreateDenseHIP()`, `PetscMemType` + +# External Links +$(_doc_external("Mat/MatCreateDenseFromVecType")) +""" +function MatCreateDenseFromVecType(petsclib::PetscLibType, comm::MPI_Comm, vtype::VecType, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, lda::PetscInt) end + +@for_petsc function MatCreateDenseFromVecType(petsclib::$UnionPetscLib, comm::MPI_Comm, vtype::VecType, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, lda::$PetscInt ) + data_ = Ref{$PetscScalar}() + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateDenseFromVecType, $petsc_library), + PetscErrorCode, + (MPI_Comm, VecType, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{CMat}), + comm, vtype, m, n, M, N, lda, data_, A_, + ) + + data = data_[] + A = PetscMat(A_[], petsclib) + + return data,A +end + +""" + MatGetColumnVector(petsclib::PetscLibType,A::PetscMat, yy::PetscVec, col::PetscInt) +Gets the values from a given column of a matrix. + +Not Collective + +Input Parameters: +- `A` - the matrix +- `yy` - the vector +- `col` - the column requested (in global numbering) + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatGetRow()`, `MatGetDiagonal()`, `MatMult()` + +# External Links +$(_doc_external("Mat/MatGetColumnVector")) +""" +function MatGetColumnVector(petsclib::PetscLibType, A::PetscMat, yy::PetscVec, col::PetscInt) end + +@for_petsc function MatGetColumnVector(petsclib::$UnionPetscLib, A::PetscMat, yy::PetscVec, col::$PetscInt ) + + @chk ccall( + (:MatGetColumnVector, $petsc_library), + PetscErrorCode, + (CMat, CVec, $PetscInt), + A, yy, col, + ) + + + return nothing +end + +""" + MatGetColumnNorms(petsclib::PetscLibType,A::PetscMat, type::NormType, norms::Vector{PetscReal}) +Gets the norms of each column of a sparse or dense matrix. + +Input Parameters: +- `A` - the matrix +- `type` - `NORM_2`, `NORM_1` or `NORM_INFINITY` + +Output Parameter: +- `norms` - an array as large as the TOTAL number of columns in the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `NormType`, `MatNorm()` + +# External Links +$(_doc_external("Mat/MatGetColumnNorms")) +""" +function MatGetColumnNorms(petsclib::PetscLibType, A::PetscMat, type::NormType, norms::Vector{PetscReal}) end + +@for_petsc function MatGetColumnNorms(petsclib::$UnionPetscLib, A::PetscMat, type::NormType, norms::Vector{$PetscReal} ) + + @chk ccall( + (:MatGetColumnNorms, $petsc_library), + PetscErrorCode, + (CMat, NormType, Ptr{$PetscReal}), + A, type, norms, + ) + + + return nothing +end + +""" + MatGetColumnSumsRealPart(petsclib::PetscLibType,A::PetscMat, sums::Vector{PetscReal}) +Gets the sums of the real part of each column of a sparse or dense matrix. + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `sums` - an array as large as the TOTAL number of columns in the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatGetColumnSumsImaginaryPart()`, `VecSum()`, `MatGetColumnMeans()`, `MatGetColumnNorms()`, `MatGetColumnReductions()` + +# External Links +$(_doc_external("Mat/MatGetColumnSumsRealPart")) +""" +function MatGetColumnSumsRealPart(petsclib::PetscLibType, A::PetscMat, sums::Vector{PetscReal}) end + +@for_petsc function MatGetColumnSumsRealPart(petsclib::$UnionPetscLib, A::PetscMat, sums::Vector{$PetscReal} ) + + @chk ccall( + (:MatGetColumnSumsRealPart, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + A, sums, + ) + + + return nothing +end + +""" + MatGetColumnSumsImaginaryPart(petsclib::PetscLibType,A::PetscMat, sums::Vector{PetscReal}) +Gets the sums of the imaginary part of each column of a sparse or dense matrix. + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `sums` - an array as large as the TOTAL number of columns in the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatGetColumnSumsRealPart()`, `VecSum()`, `MatGetColumnMeans()`, `MatGetColumnNorms()`, `MatGetColumnReductions()` + +# External Links +$(_doc_external("Mat/MatGetColumnSumsImaginaryPart")) +""" +function MatGetColumnSumsImaginaryPart(petsclib::PetscLibType, A::PetscMat, sums::Vector{PetscReal}) end + +@for_petsc function MatGetColumnSumsImaginaryPart(petsclib::$UnionPetscLib, A::PetscMat, sums::Vector{$PetscReal} ) + + @chk ccall( + (:MatGetColumnSumsImaginaryPart, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + A, sums, + ) + + + return nothing +end + +""" + MatGetColumnSums(petsclib::PetscLibType,A::PetscMat, sums::Vector{PetscScalar}) +Gets the sums of each column of a sparse or dense matrix. + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `sums` - an array as large as the TOTAL number of columns in the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `VecSum()`, `MatGetColumnMeans()`, `MatGetColumnNorms()`, `MatGetColumnReductions()` + +# External Links +$(_doc_external("Mat/MatGetColumnSums")) +""" +function MatGetColumnSums(petsclib::PetscLibType, A::PetscMat, sums::Vector{PetscScalar}) end + +@for_petsc function MatGetColumnSums(petsclib::$UnionPetscLib, A::PetscMat, sums::Vector{$PetscScalar} ) + + @chk ccall( + (:MatGetColumnSums, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + A, sums, + ) + + + return nothing +end + +""" + MatGetColumnMeansRealPart(petsclib::PetscLibType,A::PetscMat, means::Vector{PetscReal}) +Gets the arithmetic means of the real part of each column of a sparse or dense matrix. + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `means` - an array as large as the TOTAL number of columns in the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatGetColumnMeansImaginaryPart()`, `VecSum()`, `MatGetColumnSums()`, `MatGetColumnNorms()`, `MatGetColumnReductions()` + +# External Links +$(_doc_external("Mat/MatGetColumnMeansRealPart")) +""" +function MatGetColumnMeansRealPart(petsclib::PetscLibType, A::PetscMat, means::Vector{PetscReal}) end + +@for_petsc function MatGetColumnMeansRealPart(petsclib::$UnionPetscLib, A::PetscMat, means::Vector{$PetscReal} ) + + @chk ccall( + (:MatGetColumnMeansRealPart, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + A, means, + ) + + + return nothing +end + +""" + MatGetColumnMeansImaginaryPart(petsclib::PetscLibType,A::PetscMat, means::Vector{PetscReal}) +Gets the arithmetic means of the imaginary part of each column of a sparse or dense matrix. + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `means` - an array as large as the TOTAL number of columns in the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatGetColumnMeansRealPart()`, `VecSum()`, `MatGetColumnSums()`, `MatGetColumnNorms()`, `MatGetColumnReductions()` + +# External Links +$(_doc_external("Mat/MatGetColumnMeansImaginaryPart")) +""" +function MatGetColumnMeansImaginaryPart(petsclib::PetscLibType, A::PetscMat, means::Vector{PetscReal}) end + +@for_petsc function MatGetColumnMeansImaginaryPart(petsclib::$UnionPetscLib, A::PetscMat, means::Vector{$PetscReal} ) + + @chk ccall( + (:MatGetColumnMeansImaginaryPart, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + A, means, + ) + + + return nothing +end + +""" + MatGetColumnMeans(petsclib::PetscLibType,A::PetscMat, means::Vector{PetscScalar}) +Gets the arithmetic means of each column of a sparse or dense matrix. + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `means` - an array as large as the TOTAL number of columns in the matrix + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `VecSum()`, `MatGetColumnSums()`, `MatGetColumnNorms()`, `MatGetColumnReductions()` + +# External Links +$(_doc_external("Mat/MatGetColumnMeans")) +""" +function MatGetColumnMeans(petsclib::PetscLibType, A::PetscMat, means::Vector{PetscScalar}) end + +@for_petsc function MatGetColumnMeans(petsclib::$UnionPetscLib, A::PetscMat, means::Vector{$PetscScalar} ) + + @chk ccall( + (:MatGetColumnMeans, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + A, means, + ) + + + return nothing +end + +""" + MatGetColumnReductions(petsclib::PetscLibType,A::PetscMat, type::PetscInt, reductions::Vector{PetscReal}) +Gets the reductions of each column of a sparse or dense matrix. + +Input Parameters: +- `A` - the matrix +- `type` - A constant defined in `NormType` or `ReductionType`: `NORM_2`, `NORM_1`, `NORM_INFINITY`, `REDUCTION_SUM_REALPART`, +`REDUCTION_SUM_IMAGINARYPART`, `REDUCTION_MEAN_REALPART`, `REDUCTION_MEAN_IMAGINARYPART` + +Output Parameter: +- `reductions` - an array as large as the TOTAL number of columns in the matrix + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `ReductionType`, `NormType`, `MatGetColumnNorms()`, `MatGetColumnSums()`, `MatGetColumnMeans()` + +# External Links +$(_doc_external("Mat/MatGetColumnReductions")) +""" +function MatGetColumnReductions(petsclib::PetscLibType, A::PetscMat, type::PetscInt, reductions::Vector{PetscReal}) end + +@for_petsc function MatGetColumnReductions(petsclib::$UnionPetscLib, A::PetscMat, type::$PetscInt, reductions::Vector{$PetscReal} ) + + @chk ccall( + (:MatGetColumnReductions, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscReal}), + A, type, reductions, + ) + + + return nothing +end + +""" + MatReorderForNonzeroDiagonal(petsclib::PetscLibType,mat::PetscMat, abstol::PetscReal, ris::IS, cis::IS) +Changes matrix ordering to remove +zeros from diagonal. This may help in the `PCLU` factorization to +prevent a zero pivot. + +Collective + +Input Parameters: +- `mat` - matrix to reorder +- `abstol` - absolute tolerance, it attempts to move all values smaller off the diagonal +- `ris` - the row reordering +- `cis` - the column reordering; this may be changed + +Level: intermediate + +Options Database Key: +- `-pc_factor_nonzeros_along_diagonal` - Reorder to remove zeros from diagonal + +-seealso: `Mat`, `MatGetFactor()`, `MatGetOrdering()` + +# External Links +$(_doc_external("Mat/MatReorderForNonzeroDiagonal")) +""" +function MatReorderForNonzeroDiagonal(petsclib::PetscLibType, mat::PetscMat, abstol::PetscReal, ris::IS, cis::IS) end + +@for_petsc function MatReorderForNonzeroDiagonal(petsclib::$UnionPetscLib, mat::PetscMat, abstol::$PetscReal, ris::IS, cis::IS ) + + @chk ccall( + (:MatReorderForNonzeroDiagonal, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal, CIS, CIS), + mat, abstol, ris, cis, + ) + + + return nothing +end + +""" + A::PetscMat = MatCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a matrix where the type is determined +from either a call to `MatSetType()` or from the options database +with a call to `MatSetFromOptions()`. + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `A` - the matrix + +Options Database Keys: +- `-mat_type seqaij` - `MATSEQAIJ` type, uses `MatCreateSeqAIJ()` +- `-mat_type mpiaij` - `MATMPIAIJ` type, uses `MatCreateAIJ()` +- `-mat_type seqdense` - `MATSEQDENSE`, uses `MatCreateSeqDense()` +- `-mat_type mpidense` - `MATMPIDENSE` type, uses `MatCreateDense()` +- `-mat_type seqbaij` - `MATSEQBAIJ` type, uses `MatCreateSeqBAIJ()` +- `-mat_type mpibaij` - `MATMPIBAIJ` type, uses `MatCreateBAIJ()` + +See the manpages for particular formats (e.g., `MATSEQAIJ`) +for additional format-specific options. + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatCreateSeqAIJ()`, `MatCreateAIJ()`, +`MatCreateSeqDense()`, `MatCreateDense()`, +`MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, +`MatCreateSeqSBAIJ()`, `MatCreateSBAIJ()`, +`MatConvert()` + +# External Links +$(_doc_external("Mat/MatCreate")) +""" +function MatCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function MatCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CMat}), + comm, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + A::PetscMat = MatCreateFromOptions(petsclib::PetscLibType,comm::MPI_Comm, prefix::Vector{Cchar}, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt) +Creates a matrix whose type is set from the options database + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `prefix` - [optional] prefix for the options database +- `bs` - the blocksize (commonly 1) +- `m` - the local number of rows (or `PETSC_DECIDE`) +- `n` - the local number of columns (or `PETSC_DECIDE` or `PETSC_DETERMINE`) +- `M` - the global number of rows (or `PETSC_DETERMINE`) +- `N` - the global number of columns (or `PETSC_DETERMINE`) + +Output Parameter: +- `A` - the matrix + +Options Database Key: +- `-mat_type` - see `MatType`, for example `aij`, `aijcusparse`, `baij`, `sbaij`, `dense`, defaults to `aij` + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatCreateSeqAIJ()`, `MatCreateAIJ()`, +`MatCreateSeqDense()`, `MatCreateDense()`, +`MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, +`MatCreateSeqSBAIJ()`, `MatCreateSBAIJ()`, +`MatConvert()`, `MatCreate()` + +# External Links +$(_doc_external("Mat/MatCreateFromOptions")) +""" +function MatCreateFromOptions(petsclib::PetscLibType, comm::MPI_Comm, prefix::Vector{Cchar}, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateFromOptions(petsclib::$UnionPetscLib, comm::MPI_Comm, prefix::Vector{Cchar}, bs::$PetscInt, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt ) + A_ = Ref{CMat}() + + @chk ccall( + (:MatCreateFromOptions, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{CMat}), + comm, prefix, bs, m, n, M, N, A_, + ) + + A = PetscMat(A_[], petsclib) + + return A +end + +""" + MatSetErrorIfFailure(petsclib::PetscLibType,mat::PetscMat, flg::PetscBool) +Causes `Mat` to generate an immediate error, for example a zero pivot, is detected. + +Logically Collective + +Input Parameters: +- `mat` - matrix obtained from `MatCreate()` +- `flg` - `PETSC_TRUE` indicates you want the error generated + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `PCSetErrorIfFailure()`, `KSPConvergedReason`, `SNESConvergedReason` + +# External Links +$(_doc_external("Mat/MatSetErrorIfFailure")) +""" +function MatSetErrorIfFailure(petsclib::PetscLibType, mat::PetscMat, flg::PetscBool) end + +@for_petsc function MatSetErrorIfFailure(petsclib::$UnionPetscLib, mat::PetscMat, flg::PetscBool ) + + @chk ccall( + (:MatSetErrorIfFailure, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + mat, flg, + ) + + + return nothing +end + +""" + MatSetSizes(petsclib::PetscLibType,A::PetscMat, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt) +Sets the local and global sizes, and checks to determine compatibility + +Collective + +Input Parameters: +- `A` - the matrix +- `m` - number of local rows (or `PETSC_DECIDE`) +- `n` - number of local columns (or `PETSC_DECIDE`) +- `M` - number of global rows (or `PETSC_DETERMINE`) +- `N` - number of global columns (or `PETSC_DETERMINE`) + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatGetSize()`, `PetscSplitOwnership()`, `MatGetOwnershipRange()`, `MatGetOwnershipRanges()`, +`MatGetOwnershipRangeColumn()`, `MatGetOwnershipRangesColumn()`, `PetscLayout`, `VecSetSizes()` + +# External Links +$(_doc_external("Mat/MatSetSizes")) +""" +function MatSetSizes(petsclib::PetscLibType, A::PetscMat, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt) end + +@for_petsc function MatSetSizes(petsclib::$UnionPetscLib, A::PetscMat, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt ) + + @chk ccall( + (:MatSetSizes, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, $PetscInt, $PetscInt), + A, m, n, M, N, + ) + + + return nothing +end + +""" + MatSetFromOptions(petsclib::PetscLibType,B::PetscMat) +Creates a matrix where the type is determined +from the options database. + +Collective + +Input Parameter: +- `B` - the matrix + +Options Database Keys: +- `-mat_type seqaij` - `MATSEQAIJ` type, uses `MatCreateSeqAIJ()` +- `-mat_type mpiaij` - `MATMPIAIJ` type, uses `MatCreateAIJ()` +- `-mat_type seqdense` - `MATSEQDENSE` type, uses `MatCreateSeqDense()` +- `-mat_type mpidense` - `MATMPIDENSE`, uses `MatCreateDense()` +- `-mat_type seqbaij` - `MATSEQBAIJ`, uses `MatCreateSeqBAIJ()` +- `-mat_type mpibaij` - `MATMPIBAIJ`, uses `MatCreateBAIJ()` + +See the manpages for particular formats (e.g., `MATSEQAIJ`) +for additional format-specific options. + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatCreateSeqAIJ()`, `MatCreateAIJ()`, +`MatCreateSeqDense()`, `MatCreateDense()`, +`MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, +`MatCreateSeqSBAIJ()`, `MatCreateSBAIJ()`, +`MatConvert()` + +# External Links +$(_doc_external("Mat/MatSetFromOptions")) +""" +function MatSetFromOptions(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatSetFromOptions(petsclib::$UnionPetscLib, B::PetscMat ) + + @chk ccall( + (:MatSetFromOptions, $petsc_library), + PetscErrorCode, + (CMat,), + B, + ) + + + return nothing +end + +""" + MatXAIJSetPreallocation(petsclib::PetscLibType,A::PetscMat, bs::PetscInt, dnnz::Vector{PetscInt}, onnz::Vector{PetscInt}, dnnzu::Vector{PetscInt}, onnzu::Vector{PetscInt}) +set preallocation for serial and parallel `MATAIJ`, `MATBAIJ`, and `MATSBAIJ` matrices and their unassembled versions. + +Collective + +Input Parameters: +- `A` - matrix being preallocated +- `bs` - block size +- `dnnz` - number of nonzero column blocks per block row of diagonal part of parallel matrix +- `onnz` - number of nonzero column blocks per block row of off-diagonal part of parallel matrix +- `dnnzu` - number of nonzero column blocks per block row of upper-triangular part of diagonal part of parallel matrix +- `onnzu` - number of nonzero column blocks per block row of upper-triangular part of off-diagonal part of parallel matrix + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatSeqAIJSetPreallocation()`, `MatMPIAIJSetPreallocation()`, `MatSeqBAIJSetPreallocation()`, `MatMPIBAIJSetPreallocation()`, +`MatSeqSBAIJSetPreallocation()`, `MatMPISBAIJSetPreallocation()`, +`PetscSplitOwnership()` + +# External Links +$(_doc_external("Mat/MatXAIJSetPreallocation")) +""" +function MatXAIJSetPreallocation(petsclib::PetscLibType, A::PetscMat, bs::PetscInt, dnnz::Vector{PetscInt}, onnz::Vector{PetscInt}, dnnzu::Vector{PetscInt}, onnzu::Vector{PetscInt}) end + +@for_petsc function MatXAIJSetPreallocation(petsclib::$UnionPetscLib, A::PetscMat, bs::$PetscInt, dnnz::Vector{$PetscInt}, onnz::Vector{$PetscInt}, dnnzu::Vector{$PetscInt}, onnzu::Vector{$PetscInt} ) + + @chk ccall( + (:MatXAIJSetPreallocation, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + A, bs, dnnz, onnz, dnnzu, onnzu, + ) + + + return nothing +end + +""" + MatHeaderMerge(petsclib::PetscLibType,A::PetscMat, C::PetscMat) +Merges some information from the header of `C` to `A`; the `C` object is then destroyed + +Collective, No Fortran Support + +Input Parameters: +- `A` - a `Mat` being merged into +- `C` - the `Mat` providing the merge information + +Level: developer + +-seealso: `Mat`, `MatHeaderReplace()` + +# External Links +$(_doc_external("Mat/MatHeaderMerge")) +""" +function MatHeaderMerge(petsclib::PetscLibType, A::PetscMat, C::PetscMat) end + +@for_petsc function MatHeaderMerge(petsclib::$UnionPetscLib, A::PetscMat, C::PetscMat ) + C_ = Ref(C.ptr) + + @chk ccall( + (:MatHeaderMerge, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, C_, + ) + + C.ptr = C_NULL + + return nothing +end + +""" + MatHeaderReplace(petsclib::PetscLibType,A::PetscMat, C::PetscMat) +Replaces the internal data of matrix `A` by the internal data of matrix `C` while deleting the outer wrapper of `C` + +Input Parameters: +- `A` - a `Mat` whose internal data is to be replaced +- `C` - the `Mat` providing new internal data for `A` + +Level: advanced + +-seealso: `Mat`, `MatHeaderMerge()` + +# External Links +$(_doc_external("Mat/MatHeaderReplace")) +""" +function MatHeaderReplace(petsclib::PetscLibType, A::PetscMat, C::PetscMat) end + +@for_petsc function MatHeaderReplace(petsclib::$UnionPetscLib, A::PetscMat, C::PetscMat ) + C_ = Ref(C.ptr) + + @chk ccall( + (:MatHeaderReplace, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, C_, + ) + + C.ptr = C_NULL + + return nothing +end + +""" + MatBindToCPU(petsclib::PetscLibType,A::PetscMat, flg::PetscBool) +marks a matrix to temporarily stay on the CPU and perform computations on the CPU + +Logically Collective + +Input Parameters: +- `A` - the matrix +- `flg` - bind to the CPU if value of `PETSC_TRUE` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatBoundToCPU()` + +# External Links +$(_doc_external("Mat/MatBindToCPU")) +""" +function MatBindToCPU(petsclib::PetscLibType, A::PetscMat, flg::PetscBool) end + +@for_petsc function MatBindToCPU(petsclib::$UnionPetscLib, A::PetscMat, flg::PetscBool ) + + @chk ccall( + (:MatBindToCPU, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + A, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = MatBoundToCPU(petsclib::PetscLibType,A::PetscMat) +query if a matrix is bound to the CPU + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `flg` - the logical flag + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatBindToCPU()` + +# External Links +$(_doc_external("Mat/MatBoundToCPU")) +""" +function MatBoundToCPU(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatBoundToCPU(petsclib::$UnionPetscLib, A::PetscMat ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatBoundToCPU, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + A, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatSetPreallocationCOO(petsclib::PetscLibType,A::PetscMat, ncoo::PetscCount, coo_i::Vector{PetscInt}, coo_j::Vector{PetscInt}) +set preallocation for matrices using a coordinate format of the entries with global indices + +Collective + +Input Parameters: +- `A` - matrix being preallocated +- `ncoo` - number of entries +- `coo_i` - row indices +- `coo_j` - column indices + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatSetValuesCOO()`, `MatSeqAIJSetPreallocation()`, `MatMPIAIJSetPreallocation()`, `MatSeqBAIJSetPreallocation()`, +`MatMPIBAIJSetPreallocation()`, `MatSeqSBAIJSetPreallocation()`, `MatMPISBAIJSetPreallocation()`, `MatSetPreallocationCOOLocal()`, +`DMSetMatrixPreallocateSkip()`, `MatCreateSeqAIJFromTriple()` + +# External Links +$(_doc_external("Mat/MatSetPreallocationCOO")) +""" +function MatSetPreallocationCOO(petsclib::PetscLibType, A::PetscMat, ncoo::PetscCount, coo_i::Vector{PetscInt}, coo_j::Vector{PetscInt}) end + +@for_petsc function MatSetPreallocationCOO(petsclib::$UnionPetscLib, A::PetscMat, ncoo::PetscCount, coo_i::Vector{$PetscInt}, coo_j::Vector{$PetscInt} ) + + @chk ccall( + (:MatSetPreallocationCOO, $petsc_library), + PetscErrorCode, + (CMat, PetscCount, Ptr{$PetscInt}, Ptr{$PetscInt}), + A, ncoo, coo_i, coo_j, + ) + + + return nothing +end + +""" + MatSetPreallocationCOOLocal(petsclib::PetscLibType,A::PetscMat, ncoo::PetscCount, coo_i::Vector{PetscInt}, coo_j::Vector{PetscInt}) +set preallocation for matrices using a coordinate format of the entries with local indices + +Collective + +Input Parameters: +- `A` - matrix being preallocated +- `ncoo` - number of entries +- `coo_i` - row indices (local numbering; may be modified) +- `coo_j` - column indices (local numbering; may be modified) + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatSetValuesCOO()`, `MatSeqAIJSetPreallocation()`, `MatMPIAIJSetPreallocation()`, `MatSeqBAIJSetPreallocation()`, +`MatMPIBAIJSetPreallocation()`, `MatSeqSBAIJSetPreallocation()`, `MatMPISBAIJSetPreallocation()`, `MatSetPreallocationCOO()`, +`DMSetMatrixPreallocateSkip()` + +# External Links +$(_doc_external("Mat/MatSetPreallocationCOOLocal")) +""" +function MatSetPreallocationCOOLocal(petsclib::PetscLibType, A::PetscMat, ncoo::PetscCount, coo_i::Vector{PetscInt}, coo_j::Vector{PetscInt}) end + +@for_petsc function MatSetPreallocationCOOLocal(petsclib::$UnionPetscLib, A::PetscMat, ncoo::PetscCount, coo_i::Vector{$PetscInt}, coo_j::Vector{$PetscInt} ) + + @chk ccall( + (:MatSetPreallocationCOOLocal, $petsc_library), + PetscErrorCode, + (CMat, PetscCount, Ptr{$PetscInt}, Ptr{$PetscInt}), + A, ncoo, coo_i, coo_j, + ) + + + return nothing +end + +""" + MatSetValuesCOO(petsclib::PetscLibType,A::PetscMat, coo_v::Vector{PetscScalar}, imode::InsertMode) +set values at once in a matrix preallocated using `MatSetPreallocationCOO()` + +Collective + +Input Parameters: +- `A` - matrix being preallocated +- `coo_v` - the matrix values (can be `NULL`) +- `imode` - the insert mode + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatSetPreallocationCOO()`, `MatSetPreallocationCOOLocal()`, `InsertMode`, `INSERT_VALUES`, `ADD_VALUES` + +# External Links +$(_doc_external("Mat/MatSetValuesCOO")) +""" +function MatSetValuesCOO(petsclib::PetscLibType, A::PetscMat, coo_v::Vector{PetscScalar}, imode::InsertMode) end + +@for_petsc function MatSetValuesCOO(petsclib::$UnionPetscLib, A::PetscMat, coo_v::Vector{$PetscScalar}, imode::InsertMode ) + + @chk ccall( + (:MatSetValuesCOO, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}, InsertMode), + A, coo_v, imode, + ) + + + return nothing +end + +""" + MatSetBindingPropagates(petsclib::PetscLibType,A::PetscMat, flg::PetscBool) +Sets whether the state of being bound to the CPU for a GPU matrix type propagates to child and some other associated objects + +Input Parameters: +- `A` - the matrix +- `flg` - flag indicating whether the boundtocpu flag should be propagated + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `VecSetBindingPropagates()`, `MatGetBindingPropagates()` + +# External Links +$(_doc_external("Mat/MatSetBindingPropagates")) +""" +function MatSetBindingPropagates(petsclib::PetscLibType, A::PetscMat, flg::PetscBool) end + +@for_petsc function MatSetBindingPropagates(petsclib::$UnionPetscLib, A::PetscMat, flg::PetscBool ) + + @chk ccall( + (:MatSetBindingPropagates, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + A, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = MatGetBindingPropagates(petsclib::PetscLibType,A::PetscMat) +Gets whether the state of being bound to the CPU for a GPU matrix type propagates to child and some other associated objects + +Input Parameter: +- `A` - the matrix + +Output Parameter: +- `flg` - flag indicating whether the boundtocpu flag will be propagated + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatSetBindingPropagates()` + +# External Links +$(_doc_external("Mat/MatGetBindingPropagates")) +""" +function MatGetBindingPropagates(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatGetBindingPropagates(petsclib::$UnionPetscLib, A::PetscMat ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatGetBindingPropagates, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + A, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + bw::PetscInt = MatComputeBandwidth(petsclib::PetscLibType,A::PetscMat, fraction::PetscReal) +Calculate the full bandwidth of the matrix, meaning the width 2k+1 where k diagonals on either side are sufficient to contain all the matrix nonzeros. + +Collective + +Input Parameters: +- `A` - The `Mat` +- `fraction` - An optional percentage of the Frobenius norm of the matrix that the bandwidth should enclose + +Output Parameter: +- `bw` - The matrix bandwidth + +Level: beginner + +-seealso: `DMPlexCreate()`, `DMPlexSetConeSize()`, `DMPlexSetChart()` + +# External Links +$(_doc_external("Mat/MatComputeBandwidth")) +""" +function MatComputeBandwidth(petsclib::PetscLibType, A::PetscMat, fraction::PetscReal) end + +@for_petsc function MatComputeBandwidth(petsclib::$UnionPetscLib, A::PetscMat, fraction::$PetscReal ) + bw_ = Ref{$PetscInt}() + + @chk ccall( + (:MatComputeBandwidth, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal, Ptr{$PetscInt}), + A, fraction, bw_, + ) + + bw = bw_[] + + return bw +end + +""" + MatAXPY(petsclib::PetscLibType,Y::PetscMat, a::PetscScalar, X::PetscMat, str::MatStructure) +Computes Y = a*X + Y. + +Logically Collective + +Input Parameters: +- `a` - the scalar multiplier +- `X` - the first matrix +- `Y` - the second matrix +- `str` - either `SAME_NONZERO_PATTERN`, `DIFFERENT_NONZERO_PATTERN`, `UNKNOWN_NONZERO_PATTERN`, or `SUBSET_NONZERO_PATTERN` (nonzeros of `X` is a subset of `Y`'s) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatAYPX()` + +# External Links +$(_doc_external("Mat/MatAXPY")) +""" +function MatAXPY(petsclib::PetscLibType, Y::PetscMat, a::PetscScalar, X::PetscMat, str::MatStructure) end + +@for_petsc function MatAXPY(petsclib::$UnionPetscLib, Y::PetscMat, a::$PetscScalar, X::PetscMat, str::MatStructure ) + + @chk ccall( + (:MatAXPY, $petsc_library), + PetscErrorCode, + (CMat, $PetscScalar, CMat, MatStructure), + Y, a, X, str, + ) + + + return nothing +end + +""" + MatShift(petsclib::PetscLibType,Y::PetscMat, a::PetscScalar) +Computes `Y = Y + a I`, where `a` is a `PetscScalar` + +Neighbor-wise Collective + +Input Parameters: +- `Y` - the matrix +- `a` - the `PetscScalar` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatDiagonalSet()`, `MatScale()`, `MatDiagonalScale()` + +# External Links +$(_doc_external("Mat/MatShift")) +""" +function MatShift(petsclib::PetscLibType, Y::PetscMat, a::PetscScalar) end + +@for_petsc function MatShift(petsclib::$UnionPetscLib, Y::PetscMat, a::$PetscScalar ) + + @chk ccall( + (:MatShift, $petsc_library), + PetscErrorCode, + (CMat, $PetscScalar), + Y, a, + ) + + + return nothing +end + +""" + MatDiagonalSet(petsclib::PetscLibType,Y::PetscMat, D::PetscVec, is::InsertMode) +Computes `Y` = `Y` + `D`, where `D` is a diagonal matrix +that is represented as a vector. Or Y[i,i] = D[i] if `InsertMode` is +`INSERT_VALUES`. + +Neighbor-wise Collective + +Input Parameters: +- `Y` - the input matrix +- `D` - the diagonal matrix, represented as a vector +- `is` - `INSERT_VALUES` or `ADD_VALUES` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatShift()`, `MatScale()`, `MatDiagonalScale()` + +# External Links +$(_doc_external("Mat/MatDiagonalSet")) +""" +function MatDiagonalSet(petsclib::PetscLibType, Y::PetscMat, D::PetscVec, is::InsertMode) end + +@for_petsc function MatDiagonalSet(petsclib::$UnionPetscLib, Y::PetscMat, D::PetscVec, is::InsertMode ) + + @chk ccall( + (:MatDiagonalSet, $petsc_library), + PetscErrorCode, + (CMat, CVec, InsertMode), + Y, D, is, + ) + + + return nothing +end + +""" + MatAYPX(petsclib::PetscLibType,Y::PetscMat, a::PetscScalar, X::PetscMat, str::MatStructure) +Computes Y = a*Y + X. + +Logically Collective + +Input Parameters: +- `a` - the `PetscScalar` multiplier +- `Y` - the first matrix +- `X` - the second matrix +- `str` - either `SAME_NONZERO_PATTERN`, `DIFFERENT_NONZERO_PATTERN`, `UNKNOWN_NONZERO_PATTERN`, or `SUBSET_NONZERO_PATTERN` (nonzeros of `X` is a subset of `Y`'s) + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatAXPY()` + +# External Links +$(_doc_external("Mat/MatAYPX")) +""" +function MatAYPX(petsclib::PetscLibType, Y::PetscMat, a::PetscScalar, X::PetscMat, str::MatStructure) end + +@for_petsc function MatAYPX(petsclib::$UnionPetscLib, Y::PetscMat, a::$PetscScalar, X::PetscMat, str::MatStructure ) + + @chk ccall( + (:MatAYPX, $petsc_library), + PetscErrorCode, + (CMat, $PetscScalar, CMat, MatStructure), + Y, a, X, str, + ) + + + return nothing +end + +""" + MatComputeOperator(petsclib::PetscLibType,inmat::PetscMat, mattype::MatType, mat::PetscMat) +Computes the explicit matrix + +Collective + +Input Parameters: +- `inmat` - the matrix +- `mattype` - the matrix type for the explicit operator + +Output Parameter: +- `mat` - the explicit operator + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatConvert()`, `MatMult()`, `MatComputeOperatorTranspose()` + +# External Links +$(_doc_external("Mat/MatComputeOperator")) +""" +function MatComputeOperator(petsclib::PetscLibType, inmat::PetscMat, mattype::MatType, mat::PetscMat) end + +@for_petsc function MatComputeOperator(petsclib::$UnionPetscLib, inmat::PetscMat, mattype::MatType, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:MatComputeOperator, $petsc_library), + PetscErrorCode, + (CMat, MatType, Ptr{CMat}), + inmat, mattype, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + MatComputeOperatorTranspose(petsclib::PetscLibType,inmat::PetscMat, mattype::MatType, mat::PetscMat) +Computes the explicit matrix representation of +a give matrix that can apply `MatMultTranspose()` + +Collective + +Input Parameters: +- `inmat` - the matrix +- `mattype` - the matrix type for the explicit operator + +Output Parameter: +- `mat` - the explicit operator transposed + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatConvert()`, `MatMult()`, `MatComputeOperator()` + +# External Links +$(_doc_external("Mat/MatComputeOperatorTranspose")) +""" +function MatComputeOperatorTranspose(petsclib::PetscLibType, inmat::PetscMat, mattype::MatType, mat::PetscMat) end + +@for_petsc function MatComputeOperatorTranspose(petsclib::$UnionPetscLib, inmat::PetscMat, mattype::MatType, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:MatComputeOperatorTranspose, $petsc_library), + PetscErrorCode, + (CMat, MatType, Ptr{CMat}), + inmat, mattype, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + MatFilter(petsclib::PetscLibType,A::PetscMat, tol::PetscReal, compress::PetscBool, keep::PetscBool) +Set all values in the matrix with an absolute value less than or equal to the tolerance to zero, and optionally compress the underlying storage + +Input Parameters: +- `A` - The matrix +- `tol` - The zero tolerance +- `compress` - Whether the storage from the input matrix `A` should be compressed once values less than or equal to `tol` are set to zero +- `keep` - If `compress` is true and for a given row of `A`, the diagonal coefficient is less than or equal to `tol`, indicates whether it should be left in the structure or eliminated as well + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()`, `MatZeroEntries()`, `MatEliminateZeros()`, `VecFilter()` + +# External Links +$(_doc_external("Mat/MatFilter")) +""" +function MatFilter(petsclib::PetscLibType, A::PetscMat, tol::PetscReal, compress::PetscBool, keep::PetscBool) end + +@for_petsc function MatFilter(petsclib::$UnionPetscLib, A::PetscMat, tol::$PetscReal, compress::PetscBool, keep::PetscBool ) + + @chk ccall( + (:MatFilter, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal, PetscBool, PetscBool), + A, tol, compress, keep, + ) + + + return nothing +end + +""" + flg::PetscBool = MatMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt) +Compares matrix + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMultAddEqual()`, `MatMultTransposeEqual()`, `MatMultTransposeAddEqual()`, `MatIsLinear()`, `MatEqual()` + +# External Links +$(_doc_external("Mat/MatMultEqual")) +""" +function MatMultEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, n::PetscInt) end + +@for_petsc function MatMultEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatMultEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatMultAddEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt) +Compares matrix + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMultEqual()`, `MatMultTransposeEqual()`, `MatMultTransposeAddEqual()` + +# External Links +$(_doc_external("Mat/MatMultAddEqual")) +""" +function MatMultAddEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, n::PetscInt) end + +@for_petsc function MatMultAddEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatMultAddEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatMultTransposeEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt) +Compares matrix + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMultEqual()`, `MatMultAddEqual()`, `MatMultTransposeAddEqual()` + +# External Links +$(_doc_external("Mat/MatMultTransposeEqual")) +""" +function MatMultTransposeEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, n::PetscInt) end + +@for_petsc function MatMultTransposeEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatMultTransposeEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatMultTransposeAddEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt) +Compares matrix + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMultEqual()`, `MatMultAddEqual()`, `MatMultTransposeEqual()` + +# External Links +$(_doc_external("Mat/MatMultTransposeAddEqual")) +""" +function MatMultTransposeAddEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, n::PetscInt) end + +@for_petsc function MatMultTransposeAddEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatMultTransposeAddEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatMultHermitianTransposeEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt) +Compares matrix + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMatMultEqual()`, `MatMultEqual()`, `MatMultAddEqual()`, `MatMultTransposeEqual()` + +# External Links +$(_doc_external("Mat/MatMultHermitianTransposeEqual")) +""" +function MatMultHermitianTransposeEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, n::PetscInt) end + +@for_petsc function MatMultHermitianTransposeEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatMultHermitianTransposeEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatMultHermitianTransposeAddEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt) +Compares matrix + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMatMultEqual()`, `MatMultEqual()`, `MatMultAddEqual()`, `MatMultTransposeEqual()` + +# External Links +$(_doc_external("Mat/MatMultHermitianTransposeAddEqual")) +""" +function MatMultHermitianTransposeAddEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, n::PetscInt) end + +@for_petsc function MatMultHermitianTransposeAddEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatMultHermitianTransposeAddEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatMatMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt) +Test A*B*x = C*x for n random vector x + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `C` - the third matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMultEqual()`, `MatMultAddEqual()`, `MatMultTransposeEqual()` + +# External Links +$(_doc_external("Mat/MatMatMultEqual")) +""" +function MatMatMultEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt) end + +@for_petsc function MatMatMultEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, C::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatMatMultEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, C, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatTransposeMatMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt) +Test A^T*B*x = C*x for n random vector x + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `C` - the third matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMatMultEqual()`, `MatMultEqual()`, `MatMultAddEqual()`, `MatMultTransposeEqual()` + +# External Links +$(_doc_external("Mat/MatTransposeMatMultEqual")) +""" +function MatTransposeMatMultEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt) end + +@for_petsc function MatTransposeMatMultEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, C::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatTransposeMatMultEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, C, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatMatTransposeMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt) +Test A*B^T*x = C*x for n random vector x + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `C` - the third matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMatMultEqual()`, `MatMultEqual()`, `MatMultAddEqual()`, `MatMultTransposeEqual()` + +# External Links +$(_doc_external("Mat/MatMatTransposeMultEqual")) +""" +function MatMatTransposeMultEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt) end + +@for_petsc function MatMatTransposeMultEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, C::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatMatTransposeMultEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, C, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatPtAPMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt) +Compares matrix + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `C` - the third matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMatMultEqual()`, `MatMultEqual()`, `MatMultAddEqual()`, `MatMultTransposeEqual()` + +# External Links +$(_doc_external("Mat/MatPtAPMultEqual")) +""" +function MatPtAPMultEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt) end + +@for_petsc function MatPtAPMultEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, C::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatPtAPMultEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, C, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatRARtMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt) +Compares matrix + +Collective + +Input Parameters: +- `A` - the first matrix +- `B` - the second matrix +- `C` - the third matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMatMultEqual()`, `MatMultEqual()`, `MatMultAddEqual()`, `MatMultTransposeEqual()` + +# External Links +$(_doc_external("Mat/MatRARtMultEqual")) +""" +function MatRARtMultEqual(petsclib::PetscLibType, A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt) end + +@for_petsc function MatRARtMultEqual(petsclib::$UnionPetscLib, A::PetscMat, B::PetscMat, C::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatRARtMultEqual, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, $PetscInt, Ptr{PetscBool}), + A, B, C, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = MatIsLinear(petsclib::PetscLibType,A::PetscMat, n::PetscInt) +Check if a shell matrix `A` is a linear operator. + +Collective + +Input Parameters: +- `A` - the shell matrix +- `n` - number of random vectors to be tested + +Output Parameter: +- `flg` - `PETSC_TRUE` if the shell matrix is linear; `PETSC_FALSE` otherwise. + +Level: intermediate + +-seealso: `Mat`, `MatMatMultEqual()`, `MatMultEqual()`, `MatMultAddEqual()`, `MatMultTransposeEqual()` + +# External Links +$(_doc_external("Mat/MatIsLinear")) +""" +function MatIsLinear(petsclib::PetscLibType, A::PetscMat, n::PetscInt) end + +@for_petsc function MatIsLinear(petsclib::$UnionPetscLib, A::PetscMat, n::$PetscInt ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatIsLinear, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{PetscBool}), + A, n, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatSetHPL(petsclib::PetscLibType,A::PetscMat, iseed::Cint) +fills a `MATSEQDENSE` matrix using the HPL 2.3 random matrix generation routine + +Collective + +Input Parameters: +- `A` - the matrix +- `iseed` - the random number seed + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatCreate()` + +# External Links +$(_doc_external("Mat/MatSetHPL")) +""" +function MatSetHPL(petsclib::PetscLibType, A::PetscMat, iseed::Cint) end + +@for_petsc function MatSetHPL(petsclib::$UnionPetscLib, A::PetscMat, iseed::Cint ) + + @chk ccall( + (:MatSetHPL, $petsc_library), + PetscErrorCode, + (CMat, Cint), + A, iseed, + ) + + + return nothing +end + +""" + L::PetscMat = MatCreateLaplacian(petsclib::PetscLibType,A::PetscMat, tol::PetscReal, weighted::PetscBool) +Create the matrix Laplacian, with all values in the matrix less than the tolerance set to zero + +Input Parameters: +- `A` - The matrix +- `tol` - The zero tolerance +- `weighted` - Flag for using edge weights + +Output Parameter: +- `L` - The graph Laplacian matrix + +Level: intermediate + +-seealso: `MatFilter()`, `MatGetGraph()` + +# External Links +$(_doc_external("Mat/MatCreateLaplacian")) +""" +function MatCreateLaplacian(petsclib::PetscLibType, A::PetscMat, tol::PetscReal, weighted::PetscBool) end + +@for_petsc function MatCreateLaplacian(petsclib::$UnionPetscLib, A::PetscMat, tol::$PetscReal, weighted::PetscBool ) + L_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLaplacian, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal, PetscBool, Ptr{CMat}), + A, tol, weighted, L_, + ) + + L = PetscMat(L_[], petsclib) + + return L +end + +""" + MatOrderingRegister(petsclib::PetscLibType,sname::Vector{Cchar}, fnc::external) +Adds a new sparse matrix ordering to the matrix package. + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of ordering (for example `MATORDERINGND`) +- `function` - function pointer that creates the ordering + +Level: developer + +-seealso: `Mat`, `MatOrderingType`, `MatOrderingRegisterAll()`, `MatGetOrdering()` + +# External Links +$(_doc_external("Mat/MatOrderingRegister")) +""" +function MatOrderingRegister(petsclib::PetscLibType, sname::Vector{Cchar}, fnc::external) end + +@for_petsc function MatOrderingRegister(petsclib::$UnionPetscLib, sname::Vector{Cchar}, fnc::external ) + + @chk ccall( + (:MatOrderingRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + MatGetOrdering(petsclib::PetscLibType,mat::PetscMat, type::MatOrderingType, rperm::IS, cperm::IS) +Gets a reordering for a matrix to reduce fill or to +improve numerical stability of LU factorization. + +Collective + +Input Parameters: +- `mat` - the matrix +- `type` - type of reordering, one of the following +-seealso: `MatOrderingRegister()`, `PCFactorSetMatOrderingType()`, `MatColoring`, `MatColoringCreate()`, `MatOrderingType`, `Mat` + +# External Links +$(_doc_external("Mat/MatGetOrdering")) +""" +function MatGetOrdering(petsclib::PetscLibType, mat::PetscMat, type::MatOrderingType, rperm::IS, cperm::IS) end + +@for_petsc function MatGetOrdering(petsclib::$UnionPetscLib, mat::PetscMat, type::MatOrderingType, rperm::IS, cperm::IS ) + + @chk ccall( + (:MatGetOrdering, $petsc_library), + PetscErrorCode, + (CMat, MatOrderingType, Ptr{CIS}, Ptr{CIS}), + mat, type, rperm, cperm, + ) + + + return nothing +end + +""" + MatGetOrderingList(petsclib::PetscLibType,list::PetscFunctionList) + +# External Links +$(_doc_external("Mat/MatGetOrderingList")) +""" +function MatGetOrderingList(petsclib::PetscLibType, list::PetscFunctionList) end + +@for_petsc function MatGetOrderingList(petsclib::$UnionPetscLib, list::PetscFunctionList ) + + @chk ccall( + (:MatGetOrderingList, $petsc_library), + PetscErrorCode, + (Ptr{PetscFunctionList},), + list, + ) + + + return nothing +end + +""" + MatMeshToCellGraph(petsclib::PetscLibType,mesh::PetscMat, ncommonnodes::PetscInt, dual::PetscMat) +Convert a mesh to a cell graph. + +Collective + +Input Parameters: +- `mesh` - the graph that represents the coupling of the vertices of the mesh +- `ncommonnodes` - mesh elements that share this number of common nodes are considered neighbors, use 2 for triangles and +quadrilaterials, 3 for tetrahedrals and 4 for hexahedrals + +Output Parameter: +- `dual` - the dual graph + +Level: advanced + +-seealso: `MatCreateMPIAdj()`, `MatPartitioningCreate()` + +# External Links +$(_doc_external("Mat/MatMeshToCellGraph")) +""" +function MatMeshToCellGraph(petsclib::PetscLibType, mesh::PetscMat, ncommonnodes::PetscInt, dual::PetscMat) end + +@for_petsc function MatMeshToCellGraph(petsclib::$UnionPetscLib, mesh::PetscMat, ncommonnodes::$PetscInt, dual::PetscMat ) + dual_ = Ref(dual.ptr) + + @chk ccall( + (:MatMeshToCellGraph, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{CMat}), + mesh, ncommonnodes, dual_, + ) + + dual.ptr = C_NULL + + return nothing +end + +""" + MatLMVMSetMultAlgorithm(petsclib::PetscLibType,B::PetscMat, alg::MatLMVMMultAlgorithm) +Set the algorithm used by a `MatLMVM` for products + +Logically collective + +Input Parameters: +- `B` - a `MatLMVM` matrix +- `alg` - one of the algorithm classes (`MAT_LMVM_MULT_RECURSIVE`, `MAT_LMVM_MULT_DENSE`, `MAT_LMVM_MULT_COMPACT_DENSE`) + +Level: advanced + +-seealso: [](ch_matrices), `MatLMVM`, `MatLMVMMultAlgorithm`, `MatLMVMGetMultAlgorithm()` + +# External Links +$(_doc_external("Ksp/MatLMVMSetMultAlgorithm")) +""" +function MatLMVMSetMultAlgorithm(petsclib::PetscLibType, B::PetscMat, alg::MatLMVMMultAlgorithm) end + +@for_petsc function MatLMVMSetMultAlgorithm(petsclib::$UnionPetscLib, B::PetscMat, alg::MatLMVMMultAlgorithm ) + + @chk ccall( + (:MatLMVMSetMultAlgorithm, $petsc_library), + PetscErrorCode, + (CMat, MatLMVMMultAlgorithm), + B, alg, + ) + + + return nothing +end + +""" + MatLMVMGetMultAlgorithm(petsclib::PetscLibType,B::PetscMat, alg::MatLMVMMultAlgorithm) +Get the algorithm used by a `MatLMVM` for products + +Not collective + +Input Parameter: +- `B` - a `MatLMVM` matrix + +Output Parameter: +- `alg` - one of the algorithm classes (`MAT_LMVM_MULT_RECURSIVE`, `MAT_LMVM_MULT_DENSE`, `MAT_LMVM_MULT_COMPACT_DENSE`) + +Level: advanced + +-seealso: [](ch_matrices), `MatLMVM`, `MatLMVMMultAlgorithm`, `MatLMVMSetMultAlgorithm()` + +# External Links +$(_doc_external("Ksp/MatLMVMGetMultAlgorithm")) +""" +function MatLMVMGetMultAlgorithm(petsclib::PetscLibType, B::PetscMat, alg::MatLMVMMultAlgorithm) end + +@for_petsc function MatLMVMGetMultAlgorithm(petsclib::$UnionPetscLib, B::PetscMat, alg::MatLMVMMultAlgorithm ) + + @chk ccall( + (:MatLMVMGetMultAlgorithm, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatLMVMMultAlgorithm}), + B, alg, + ) + + + return nothing +end + +""" + MatLMVMGetLastUpdate(petsclib::PetscLibType,B::PetscMat, x_prev::PetscVec, f_prev::PetscVec) +Get the last vectors passed to `MatLMVMUpdate()` + +Not collective + +Input Parameter: +- `B` - a `MatLMVM` matrix + +Output Parameters: +- `x_prev` - the last solution vector +- `f_prev` - the last function vector + +Level: intermediate + +-seealso: [](ch_matrices), `MatLMVM`, `MatLMVMUpdate()` + +# External Links +$(_doc_external("Ksp/MatLMVMGetLastUpdate")) +""" +function MatLMVMGetLastUpdate(petsclib::PetscLibType, B::PetscMat, x_prev::PetscVec, f_prev::PetscVec) end + +@for_petsc function MatLMVMGetLastUpdate(petsclib::$UnionPetscLib, B::PetscMat, x_prev::PetscVec, f_prev::PetscVec ) + x_prev_ = Ref(x_prev.ptr) + f_prev_ = Ref(f_prev.ptr) + + @chk ccall( + (:MatLMVMGetLastUpdate, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CVec}, Ptr{CVec}), + B, x_prev_, f_prev_, + ) + + x_prev.ptr = C_NULL + f_prev.ptr = C_NULL + + return nothing +end + +""" + MatLMVMUpdate(petsclib::PetscLibType,B::PetscMat, X::PetscVec, F::PetscVec) +Adds (X + +Input Parameters: +- `B` - A `MATLMVM` matrix +- `X` - Solution vector +- `F` - Function vector + +Level: intermediate + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMReset()`, `MatLMVMAllocate()` + +# External Links +$(_doc_external("Ksp/MatLMVMUpdate")) +""" +function MatLMVMUpdate(petsclib::PetscLibType, B::PetscMat, X::PetscVec, F::PetscVec) end + +@for_petsc function MatLMVMUpdate(petsclib::$UnionPetscLib, B::PetscMat, X::PetscVec, F::PetscVec ) + + @chk ccall( + (:MatLMVMUpdate, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + B, X, F, + ) + + + return nothing +end + +""" + MatLMVMClearJ0(petsclib::PetscLibType,B::PetscMat) +Removes all definitions of J0 and reverts to +an identity matrix (scale = 1.0). + +Input Parameter: +- `B` - A `MATLMVM` matrix + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMSetJ0()` + +# External Links +$(_doc_external("Ksp/MatLMVMClearJ0")) +""" +function MatLMVMClearJ0(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatLMVMClearJ0(petsclib::$UnionPetscLib, B::PetscMat ) + + @chk ccall( + (:MatLMVMClearJ0, $petsc_library), + PetscErrorCode, + (CMat,), + B, + ) + + + return nothing +end + +""" + MatLMVMSetJ0Scale(petsclib::PetscLibType,B::PetscMat, scale::PetscReal) +Allows the user to define a scalar value +mu such that J0 = mu*I. + +Input Parameters: +- `B` - A `MATLMVM` matrix +- `scale` - Scalar value mu that defines the initial Jacobian + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMSetDiagScale()`, `MatLMVMSetJ0()` + +# External Links +$(_doc_external("Ksp/MatLMVMSetJ0Scale")) +""" +function MatLMVMSetJ0Scale(petsclib::PetscLibType, B::PetscMat, scale::PetscReal) end + +@for_petsc function MatLMVMSetJ0Scale(petsclib::$UnionPetscLib, B::PetscMat, scale::$PetscReal ) + + @chk ccall( + (:MatLMVMSetJ0Scale, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal), + B, scale, + ) + + + return nothing +end + +""" + MatLMVMSetJ0Diag(petsclib::PetscLibType,B::PetscMat, V::PetscVec) +Allows the user to define a vector +V such that J0 = diag(V). + +Input Parameters: +- `B` - An LMVM-type matrix +- `V` - Vector that defines the diagonal of the initial Jacobian: values are copied, V is not referenced + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMSetScale()`, `MatLMVMSetJ0()` + +# External Links +$(_doc_external("Ksp/MatLMVMSetJ0Diag")) +""" +function MatLMVMSetJ0Diag(petsclib::PetscLibType, B::PetscMat, V::PetscVec) end + +@for_petsc function MatLMVMSetJ0Diag(petsclib::$UnionPetscLib, B::PetscMat, V::PetscVec ) + + @chk ccall( + (:MatLMVMSetJ0Diag, $petsc_library), + PetscErrorCode, + (CMat, CVec), + B, V, + ) + + + return nothing +end + +""" + MatLMVMSetJ0(petsclib::PetscLibType,B::PetscMat, J0::PetscMat) +Allows the user to define the initial Jacobian matrix from which the LMVM +up. + +Input Parameters: +- `B` - An LMVM-type matrix +- `J0` - The initial Jacobian matrix, will be referenced by B. + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMSetJ0PC()`, `MatLMVMSetJ0KSP()` + +# External Links +$(_doc_external("Ksp/MatLMVMSetJ0")) +""" +function MatLMVMSetJ0(petsclib::PetscLibType, B::PetscMat, J0::PetscMat) end + +@for_petsc function MatLMVMSetJ0(petsclib::$UnionPetscLib, B::PetscMat, J0::PetscMat ) + + @chk ccall( + (:MatLMVMSetJ0, $petsc_library), + PetscErrorCode, + (CMat, CMat), + B, J0, + ) + + + return nothing +end + +""" + MatLMVMSetJ0PC(petsclib::PetscLibType,B::PetscMat, J0pc::PC) +Allows the user to define a `PC` object that acts as the initial inverse + +Input Parameters: +- `B` - A `MATLMVM` matrix +- `J0pc` - `PC` object where `PCApply()` defines an inverse application for J0 + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMGetJ0PC()` + +# External Links +$(_doc_external("Ksp/MatLMVMSetJ0PC")) +""" +function MatLMVMSetJ0PC(petsclib::PetscLibType, B::PetscMat, J0pc::PC) end + +@for_petsc function MatLMVMSetJ0PC(petsclib::$UnionPetscLib, B::PetscMat, J0pc::PC ) + + @chk ccall( + (:MatLMVMSetJ0PC, $petsc_library), + PetscErrorCode, + (CMat, PC), + B, J0pc, + ) + + + return nothing +end + +""" + MatLMVMSetJ0KSP(petsclib::PetscLibType,B::PetscMat, J0ksp::PetscKSP) +Allows the user to provide a pre +approximation. + +Input Parameters: +- `B` - A `MATLMVM` matrix +- `J0ksp` - `KSP` solver for the initial inverse-Jacobian application + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMGetJ0KSP()` + +# External Links +$(_doc_external("Ksp/MatLMVMSetJ0KSP")) +""" +function MatLMVMSetJ0KSP(petsclib::PetscLibType, B::PetscMat, J0ksp::PetscKSP) end + +@for_petsc function MatLMVMSetJ0KSP(petsclib::$UnionPetscLib, B::PetscMat, J0ksp::PetscKSP ) + + @chk ccall( + (:MatLMVMSetJ0KSP, $petsc_library), + PetscErrorCode, + (CMat, CKSP), + B, J0ksp, + ) + + + return nothing +end + +""" + MatLMVMGetJ0(petsclib::PetscLibType,B::PetscMat, J0::PetscMat) +Returns a pointer to the internal `J0` matrix. + +Input Parameter: +- `B` - A `MATLMVM` matrix + +Output Parameter: +- `J0` - `Mat` object for defining the initial Jacobian + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMSetJ0()` + +# External Links +$(_doc_external("Ksp/MatLMVMGetJ0")) +""" +function MatLMVMGetJ0(petsclib::PetscLibType, B::PetscMat, J0::PetscMat) end + +@for_petsc function MatLMVMGetJ0(petsclib::$UnionPetscLib, B::PetscMat, J0::PetscMat ) + J0_ = Ref(J0.ptr) + + @chk ccall( + (:MatLMVMGetJ0, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + B, J0_, + ) + + J0.ptr = C_NULL + + return nothing +end + +""" + MatLMVMGetJ0PC(petsclib::PetscLibType,B::PetscMat, J0pc::PC) +Returns a pointer to the internal `PC` object +associated with the initial Jacobian. + +Input Parameter: +- `B` - A `MATLMVM` matrix + +Output Parameter: +- `J0pc` - `PC` object for defining the initial inverse-Jacobian + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMSetJ0PC()` + +# External Links +$(_doc_external("Ksp/MatLMVMGetJ0PC")) +""" +function MatLMVMGetJ0PC(petsclib::PetscLibType, B::PetscMat, J0pc::PC) end + +@for_petsc function MatLMVMGetJ0PC(petsclib::$UnionPetscLib, B::PetscMat, J0pc::PC ) + + @chk ccall( + (:MatLMVMGetJ0PC, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PC}), + B, J0pc, + ) + + + return nothing +end + +""" + MatLMVMGetJ0KSP(petsclib::PetscLibType,B::PetscMat, J0ksp::PetscKSP) +Returns a pointer to the internal `KSP` solver +associated with the initial Jacobian. + +Input Parameter: +- `B` - A `MATLMVM` matrix + +Output Parameter: +- `J0ksp` - `KSP` solver for defining the initial inverse-Jacobian + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMSetJ0KSP()` + +# External Links +$(_doc_external("Ksp/MatLMVMGetJ0KSP")) +""" +function MatLMVMGetJ0KSP(petsclib::PetscLibType, B::PetscMat, J0ksp::PetscKSP) end + +@for_petsc function MatLMVMGetJ0KSP(petsclib::$UnionPetscLib, B::PetscMat, J0ksp::PetscKSP ) + J0ksp_ = Ref(J0ksp.ptr) + + @chk ccall( + (:MatLMVMGetJ0KSP, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CKSP}), + B, J0ksp_, + ) + + J0ksp.ptr = C_NULL + + return nothing +end + +""" + MatLMVMApplyJ0Fwd(petsclib::PetscLibType,B::PetscMat, X::PetscVec, Y::PetscVec) +Applies an approximation of the forward +matrix-vector product with the initial Jacobian. + +Input Parameters: +- `B` - A `MATLMVM` matrix +- `X` - vector to multiply with J0 + +Output Parameter: +- `Y` - resulting vector for the operation + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMSetJ0()`, `MatLMVMSetJ0Scale()`, `MatLMVMSetJ0ScaleDiag()`, +`MatLMVMSetJ0PC()`, `MatLMVMSetJ0KSP()`, `MatLMVMApplyJ0Inv()` + +# External Links +$(_doc_external("Ksp/MatLMVMApplyJ0Fwd")) +""" +function MatLMVMApplyJ0Fwd(petsclib::PetscLibType, B::PetscMat, X::PetscVec, Y::PetscVec) end + +@for_petsc function MatLMVMApplyJ0Fwd(petsclib::$UnionPetscLib, B::PetscMat, X::PetscVec, Y::PetscVec ) + + @chk ccall( + (:MatLMVMApplyJ0Fwd, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + B, X, Y, + ) + + + return nothing +end + +""" + MatLMVMApplyJ0Inv(petsclib::PetscLibType,B::PetscMat, X::PetscVec, Y::PetscVec) +Applies some estimation of the initial Jacobian +inverse to the given vector. + +Input Parameters: +- `B` - A `MATLMVM` matrix +- `X` - vector to "multiply" with J0^{-1} + +Output Parameter: +- `Y` - resulting vector for the operation + +Level: advanced + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMSetJ0()`, `MatLMVMSetJ0Scale()`, `MatLMVMSetJ0ScaleDiag()`, +`MatLMVMSetJ0PC()`, `MatLMVMSetJ0KSP()`, `MatLMVMApplyJ0Fwd()` + +# External Links +$(_doc_external("Ksp/MatLMVMApplyJ0Inv")) +""" +function MatLMVMApplyJ0Inv(petsclib::PetscLibType, B::PetscMat, X::PetscVec, Y::PetscVec) end + +@for_petsc function MatLMVMApplyJ0Inv(petsclib::$UnionPetscLib, B::PetscMat, X::PetscVec, Y::PetscVec ) + + @chk ccall( + (:MatLMVMApplyJ0Inv, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + B, X, Y, + ) + + + return nothing +end + +""" + flg::PetscBool = MatLMVMIsAllocated(petsclib::PetscLibType,B::PetscMat) +Returns a boolean flag that shows whether +the necessary data structures for the underlying matrix is allocated. + +Input Parameter: +- `B` - A `MATLMVM` matrix + +Output Parameter: +- `flg` - `PETSC_TRUE` if allocated, `PETSC_FALSE` otherwise + +Level: intermediate + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMAllocate()`, `MatLMVMReset()` + +# External Links +$(_doc_external("Ksp/MatLMVMIsAllocated")) +""" +function MatLMVMIsAllocated(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatLMVMIsAllocated(petsclib::$UnionPetscLib, B::PetscMat ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:MatLMVMIsAllocated, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + B, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + MatLMVMAllocate(petsclib::PetscLibType,B::PetscMat, X::PetscVec, F::PetscVec) +Produces all necessary common memory for +LMVM approximations based on the solution and function vectors +provided. + +Input Parameters: +- `B` - A `MATLMVM` matrix +- `X` - Solution vector +- `F` - Function vector + +Level: intermediate + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMReset()`, `MatLMVMUpdate()` + +# External Links +$(_doc_external("Ksp/MatLMVMAllocate")) +""" +function MatLMVMAllocate(petsclib::PetscLibType, B::PetscMat, X::PetscVec, F::PetscVec) end + +@for_petsc function MatLMVMAllocate(petsclib::$UnionPetscLib, B::PetscMat, X::PetscVec, F::PetscVec ) + + @chk ccall( + (:MatLMVMAllocate, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + B, X, F, + ) + + + return nothing +end + +""" + MatLMVMResetShift(petsclib::PetscLibType,B::PetscMat) +Zero the shift factor for a `MATLMVM`. + +Input Parameter: +- `B` - A `MATLMVM` matrix + +Level: intermediate + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMAllocate()`, `MatLMVMUpdate()` + +# External Links +$(_doc_external("Ksp/MatLMVMResetShift")) +""" +function MatLMVMResetShift(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatLMVMResetShift(petsclib::$UnionPetscLib, B::PetscMat ) + + @chk ccall( + (:MatLMVMResetShift, $petsc_library), + PetscErrorCode, + (CMat,), + B, + ) + + + return nothing +end + +""" + MatLMVMReset(petsclib::PetscLibType,B::PetscMat, destructive::PetscBool) +Flushes all of the accumulated updates out of +the `MATLMVM` approximation. + +Input Parameters: +- `B` - A `MATLMVM` matrix +- `destructive` - flag for enabling destruction of data structures + +Level: intermediate + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMAllocate()`, `MatLMVMUpdate()` + +# External Links +$(_doc_external("Ksp/MatLMVMReset")) +""" +function MatLMVMReset(petsclib::PetscLibType, B::PetscMat, destructive::PetscBool) end + +@for_petsc function MatLMVMReset(petsclib::$UnionPetscLib, B::PetscMat, destructive::PetscBool ) + + @chk ccall( + (:MatLMVMReset, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + B, destructive, + ) + + + return nothing +end + +""" + MatLMVMSetHistorySize(petsclib::PetscLibType,B::PetscMat, hist_size::PetscInt) +Set the number of past iterates to be +stored for the construction of the limited-memory quasi-Newton update. + +Input Parameters: +- `B` - A `MATLMVM` matrix +- `hist_size` - number of past iterates (default 5) + +Options Database Key: +- `-mat_lmvm_hist_size ` - set number of past iterates + +Level: beginner + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMGetUpdateCount()` + +# External Links +$(_doc_external("Ksp/MatLMVMSetHistorySize")) +""" +function MatLMVMSetHistorySize(petsclib::PetscLibType, B::PetscMat, hist_size::PetscInt) end + +@for_petsc function MatLMVMSetHistorySize(petsclib::$UnionPetscLib, B::PetscMat, hist_size::$PetscInt ) + + @chk ccall( + (:MatLMVMSetHistorySize, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + B, hist_size, + ) + + + return nothing +end + +""" + hist_size::PetscInt = MatLMVMGetHistorySize(petsclib::PetscLibType,B::PetscMat) + +# External Links +$(_doc_external("Ksp/MatLMVMGetHistorySize")) +""" +function MatLMVMGetHistorySize(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatLMVMGetHistorySize(petsclib::$UnionPetscLib, B::PetscMat ) + hist_size_ = Ref{$PetscInt}() + + @chk ccall( + (:MatLMVMGetHistorySize, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + B, hist_size_, + ) + + hist_size = hist_size_[] + + return hist_size +end + +""" + nupdates::PetscInt = MatLMVMGetUpdateCount(petsclib::PetscLibType,B::PetscMat) +Returns the number of accepted updates. + +Input Parameter: +- `B` - A `MATLMVM` matrix + +Output Parameter: +- `nupdates` - number of accepted updates + +Level: intermediate + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMGetRejectCount()`, `MatLMVMReset()` + +# External Links +$(_doc_external("Ksp/MatLMVMGetUpdateCount")) +""" +function MatLMVMGetUpdateCount(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatLMVMGetUpdateCount(petsclib::$UnionPetscLib, B::PetscMat ) + nupdates_ = Ref{$PetscInt}() + + @chk ccall( + (:MatLMVMGetUpdateCount, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + B, nupdates_, + ) + + nupdates = nupdates_[] + + return nupdates +end + +""" + nrejects::PetscInt = MatLMVMGetRejectCount(petsclib::PetscLibType,B::PetscMat) +Returns the number of rejected updates. +The counters are reset when `MatLMVMReset()` is called. + +Input Parameter: +- `B` - A `MATLMVM` matrix + +Output Parameter: +- `nrejects` - number of rejected updates + +Level: intermediate + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMReset()` + +# External Links +$(_doc_external("Ksp/MatLMVMGetRejectCount")) +""" +function MatLMVMGetRejectCount(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatLMVMGetRejectCount(petsclib::$UnionPetscLib, B::PetscMat ) + nrejects_ = Ref{$PetscInt}() + + @chk ccall( + (:MatLMVMGetRejectCount, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscInt}), + B, nrejects_, + ) + + nrejects = nrejects_[] + + return nrejects +end + +""" + B::PetscMat = MatCreateLMVMDiagBroyden(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +DiagBrdn creates a symmetric Broyden +for approximating Hessians. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Options Database Keys: +- `-mat_lmvm_theta` - (developer) convex ratio between BFGS and DFP components of the diagonal J0 scaling +- `-mat_lmvm_rho` - (developer) update limiter for the J0 scaling +- `-mat_lmvm_alpha` - (developer) coefficient factor for the quadratic subproblem in J0 scaling +- `-mat_lmvm_beta` - (developer) exponential factor for the diagonal J0 scaling +- `-mat_lmvm_sigma_hist` - (developer) number of past updates to use in J0 scaling. +- `-mat_lmvm_tol` - (developer) tolerance for bounding the denominator of the rescaling away from 0. +- `-mat_lmvm_forward` - (developer) whether or not to use the forward or backward Broyden update to the diagonal + +Level: intermediate + +-seealso: [](ch_ksp), `MatCreate()`, `MATLMVM`, `MATLMVMDIAGBRDN`, `MatCreateLMVMDFP()`, `MatCreateLMVMSR1()`, +`MatCreateLMVMBFGS()`, `MatCreateLMVMBroyden()`, `MatCreateLMVMSymBroyden()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMDiagBroyden")) +""" +function MatCreateLMVMDiagBroyden(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMDiagBroyden(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMDiagBroyden, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + B::PetscMat = MatCreateLMVMBadBroyden(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a limited +approximation matrix used for a Jacobian. L-BadBrdn is not guaranteed to be +symmetric or positive-definite. + +To use the L-BadBrdn matrix with other vector types, the matrix must be +created using `MatCreate()` and `MatSetType()`, followed by `MatLMVMAllocate()`. +This ensures that the internal storage and work vectors are duplicated from the +correct type of vector. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Options Database Keys: +- `-mat_lmvm_hist_size` - the number of history vectors to keep +- `-mat_lmvm_mult_algorithm` - the algorithm to use for multiplication (recursive, dense, compact_dense) +- `-mat_lmvm_cache_J0_products` - whether products between the base Jacobian J0 and history vectors should be cached or recomputed +- `-mat_lmvm_debug` - (developer) perform internal debugging checks + +Level: intermediate + +-seealso: [](ch_ksp), `MatCreate()`, `MATLMVM`, `MATLMVMBADBRDN`, `MatCreateLMVMDFP()`, `MatCreateLMVMSR1()`, +`MatCreateLMVMBFGS()`, `MatCreateLMVMBroyden()`, `MatCreateLMVMSymBroyden()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMBadBroyden")) +""" +function MatCreateLMVMBadBroyden(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMBadBroyden(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMBadBroyden, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + B::PetscMat = MatCreateLMVMBroyden(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a limited +matrix used for a Jacobian. L-Brdn is not guaranteed to be symmetric or +positive-definite. + +To use the L-Brdn matrix with other vector types, the matrix must be +created using `MatCreate()` and `MatSetType()`, followed by `MatLMVMAllocate()`. +This ensures that the internal storage and work vectors are duplicated from the +correct type of vector. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Options Database Keys: +- `-mat_lmvm_hist_size` - the number of history vectors to keep +- `-mat_lmvm_mult_algorithm` - the algorithm to use for multiplication (recursive, dense, compact_dense) +- `-mat_lmvm_cache_J0_products` - whether products between the base Jacobian J0 and history vectors should be cached or recomputed +- `-mat_lmvm_debug` - (developer) perform internal debugging checks + +Level: intermediate + +-seealso: [](ch_ksp), `MatCreate()`, `MATLMVM`, `MATLMVMBRDN`, `MatCreateLMVMDFP()`, `MatCreateLMVMSR1()`, +`MatCreateLMVMBFGS()`, `MatCreateLMVMBadBroyden()`, `MatCreateLMVMSymBroyden()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMBroyden")) +""" +function MatCreateLMVMBroyden(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMBroyden(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMBroyden, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + B::PetscMat = MatCreateLMVMDQN(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a dense representation of the limited +Quasi-Newton approximation to a Hessian. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Level: advanced + +-seealso: `MatCreate()`, `MATLMVM`, `MATLMVMDBFGS`, `MATLMVMDDFP`, `MatCreateLMVMDDFP()`, `MatCreateLMVMDBFGS()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMDQN")) +""" +function MatCreateLMVMDQN(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMDQN(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMDQN, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + B::PetscMat = MatCreateLMVMDBFGS(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a dense representation of the limited +Broyden-Fletcher-Goldfarb-Shanno (BFGS) approximation to a Hessian. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Level: advanced + +-seealso: `MatCreate()`, `MATLMVM`, `MATLMVMDBFGS`, `MatCreateLMVMBFGS()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMDBFGS")) +""" +function MatCreateLMVMDBFGS(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMDBFGS(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMDBFGS, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + B::PetscMat = MatCreateLMVMDDFP(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a dense representation of the limited +Davidon-Fletcher-Powell (DFP) approximation to a Hessian. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Level: advanced + +-seealso: `MatCreate()`, `MATLMVM`, `MATLMVMDDFP`, `MatCreateLMVMDFP()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMDDFP")) +""" +function MatCreateLMVMDDFP(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMDDFP(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMDDFP, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + MatLMVMDenseSetType(petsclib::PetscLibType,B::PetscMat, type::MatLMVMDenseType) +Sets the memory storage type for dense `MATLMVM` + +Input Parameters: +- `B` - the `MATLMVM` matrix +- `type` - scale type, see `MatLMVMDenseSetType` + +Options Database Keys: +- `-mat_lqn_type ` - set the strategy +- `-mat_lbfgs_type ` - set the strategy +- `-mat_ldfp_type ` - set the strategy + +Level: intermediate + +MatLMVMDenseTypes: +- `MAT_LMVM_DENSE_REORDER` - reorders memory to minimize kernel launch +- `MAT_LMVM_DENSE_INPLACE` - launches kernel inplace to minimize memory movement + +-seealso: [](ch_ksp), `MATLMVMDQN`, `MATLMVMDBFGS`, `MATLMVMDDFP`, `MatLMVMDenseType` + +# External Links +$(_doc_external("Ksp/MatLMVMDenseSetType")) +""" +function MatLMVMDenseSetType(petsclib::PetscLibType, B::PetscMat, type::MatLMVMDenseType) end + +@for_petsc function MatLMVMDenseSetType(petsclib::$UnionPetscLib, B::PetscMat, type::MatLMVMDenseType ) + + @chk ccall( + (:MatLMVMDenseSetType, $petsc_library), + PetscErrorCode, + (CMat, MatLMVMDenseType), + B, type, + ) + + + return nothing +end + +""" + B::PetscMat = MatCreateLMVMSR1(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a limited +matrix used for a Jacobian. L-SR1 is symmetric by construction, but is not +guaranteed to be positive-definite. + +To use the L-SR1 matrix with other vector types, the matrix must be +created using `MatCreate()` and `MatSetType()`, followed by `MatLMVMAllocate()`. +This ensures that the internal storage and work vectors are duplicated from the +correct type of vector. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Options Database Keys: +- `-mat_lmvm_hist_size` - the number of history vectors to keep +- `-mat_lmvm_mult_algorithm` - the algorithm to use for multiplication (recursive, dense, compact_dense) +- `-mat_lmvm_cache_J0_products` - whether products between the base Jacobian J0 and history vectors should be cached or recomputed +- `-mat_lmvm_eps` - (developer) numerical zero tolerance for testing when an update should be skipped +- `-mat_lmvm_debug` - (developer) perform internal debugging checks + +Level: intermediate + +-seealso: [](ch_ksp), `MatCreate()`, `MATLMVM`, `MATLMVMSR1`, `MatCreateLMVMBFGS()`, `MatCreateLMVMDFP()`, +`MatCreateLMVMBroyden()`, `MatCreateLMVMBadBroyden()`, `MatCreateLMVMSymBroyden()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMSR1")) +""" +function MatCreateLMVMSR1(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMSR1(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMSR1, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + B::PetscMat = MatCreateLMVMBFGS(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a limited +matrix used for approximating Jacobians. L-BFGS is symmetric positive-definite by +construction, and is commonly used to approximate Hessians in optimization +problems. + +To use the L-BFGS matrix with other vector types, the matrix must be +created using `MatCreate()` and `MatSetType()`, followed by `MatLMVMAllocate()`. +This ensures that the internal storage and work vectors are duplicated from the +correct type of vector. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Options Database Keys: +- `-mat_lmvm_scale_type` - (developer) type of scaling applied to J0 (none, scalar, diagonal) +- `-mat_lmvm_theta` - (developer) convex ratio between BFGS and DFP components of the diagonal J0 scaling +- `-mat_lmvm_rho` - (developer) update limiter for the J0 scaling +- `-mat_lmvm_alpha` - (developer) coefficient factor for the quadratic subproblem in J0 scaling +- `-mat_lmvm_beta` - (developer) exponential factor for the diagonal J0 scaling +- `-mat_lmvm_sigma_hist` - (developer) number of past updates to use in J0 scaling + +Level: intermediate + +-seealso: [](ch_ksp), `MatCreate()`, `MATLMVM`, `MATLMVMBFGS`, `MatCreateLMVMDFP()`, `MatCreateLMVMSR1()`, +`MatCreateLMVMBroyden()`, `MatCreateLMVMBadBroyden()`, `MatCreateLMVMSymBroyden()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMBFGS")) +""" +function MatCreateLMVMBFGS(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMBFGS(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMBFGS, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + phi::PetscReal = MatLMVMSymBroydenGetPhi(petsclib::PetscLibType,B::PetscMat) +Get the phi parameter for a Broyden class quasi + +Input Parameter: +- `B` - The matrix + +Output Parameter: +- `phi` - a number defining an update that is an affine combination of the BFGS update (phi = 0) and DFP update (phi = 1) + +Level: advanced + +-seealso: [](ch_ksp), +`MATLMVMSYMBROYDEN`, `MATLMVMSYMBADBROYDEN`, +`MATLMVMDFP`, `MATLMVMBFGS`, +`MatLMVMSymBroydenSetPhi()`, +`MatLMVMSymBadBroydenGetPsi()`, `MatLMVMSymBadBroydenSetPsi()` + +# External Links +$(_doc_external("Ksp/MatLMVMSymBroydenGetPhi")) +""" +function MatLMVMSymBroydenGetPhi(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatLMVMSymBroydenGetPhi(petsclib::$UnionPetscLib, B::PetscMat ) + phi_ = Ref{$PetscReal}() + + @chk ccall( + (:MatLMVMSymBroydenGetPhi, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + B, phi_, + ) + + phi = phi_[] + + return phi +end + +""" + MatLMVMSymBroydenSetPhi(petsclib::PetscLibType,B::PetscMat, phi::PetscReal) +Get the phi parameter for a Broyden class quasi + +Input Parameters: +- `B` - The matrix +- `phi` - a number defining an update that is a convex combination of the BFGS update (phi = 0) and DFP update (phi = 1) + +Level: advanced + +-seealso: [](ch_ksp), +`MATLMVMSYMBROYDEN`, `MATLMVMSYMBADBROYDEN`, +`MATLMVMDFP`, `MATLMVMBFGS`, +`MatLMVMSymBroydenGetPhi()`, +`MatLMVMSymBadBroydenGetPsi()`, `MatLMVMSymBadBroydenSetPsi()` + +# External Links +$(_doc_external("Ksp/MatLMVMSymBroydenSetPhi")) +""" +function MatLMVMSymBroydenSetPhi(petsclib::PetscLibType, B::PetscMat, phi::PetscReal) end + +@for_petsc function MatLMVMSymBroydenSetPhi(petsclib::$UnionPetscLib, B::PetscMat, phi::$PetscReal ) + + @chk ccall( + (:MatLMVMSymBroydenSetPhi, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal), + B, phi, + ) + + + return nothing +end + +""" + psi::PetscReal = MatLMVMSymBadBroydenGetPsi(petsclib::PetscLibType,B::PetscMat) +Get the psi parameter for a Broyden class quasi + +Input Parameter: +- `B` - The matrix + +Output Parameter: +- `psi` - a number defining an update that is an affine combination of the BFGS update (psi = 1) and DFP update (psi = 0) + +Level: advanced + +-seealso: [](ch_ksp), +`MATLMVMSYMBROYDEN`, `MATLMVMSYMBADBROYDEN`, +`MATLMVMDFP`, `MATLMVMBFGS`, +`MatLMVMSymBadBroydenSetPsi()`, +`MatLMVMSymBroydenGetPhi()`, `MatLMVMSymBroydenSetPhi()` + +# External Links +$(_doc_external("Ksp/MatLMVMSymBadBroydenGetPsi")) +""" +function MatLMVMSymBadBroydenGetPsi(petsclib::PetscLibType, B::PetscMat) end + +@for_petsc function MatLMVMSymBadBroydenGetPsi(petsclib::$UnionPetscLib, B::PetscMat ) + psi_ = Ref{$PetscReal}() + + @chk ccall( + (:MatLMVMSymBadBroydenGetPsi, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscReal}), + B, psi_, + ) + + psi = psi_[] + + return psi +end + +""" + MatLMVMSymBadBroydenSetPsi(petsclib::PetscLibType,B::PetscMat, psi::PetscReal) +Get the psi parameter for a Broyden class quasi + +Input Parameters: +- `B` - The matrix +- `psi` - a number defining an update that is a convex combination of the BFGS update (psi = 1) and DFP update (psi = 0) + +Level: developer + +-seealso: [](ch_ksp), +`MATLMVMSYMBROYDEN`, `MATLMVMSYMBADBROYDEN`, +`MATLMVMDFP`, `MATLMVMBFGS`, +`MatLMVMSymBadBroydenGetPsi()`, +`MatLMVMSymBroydenGetPhi()`, `MatLMVMSymBroydenSetPhi()` + +# External Links +$(_doc_external("Ksp/MatLMVMSymBadBroydenSetPsi")) +""" +function MatLMVMSymBadBroydenSetPsi(petsclib::PetscLibType, B::PetscMat, psi::PetscReal) end + +@for_petsc function MatLMVMSymBadBroydenSetPsi(petsclib::$UnionPetscLib, B::PetscMat, psi::$PetscReal ) + + @chk ccall( + (:MatLMVMSymBadBroydenSetPsi, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal), + B, psi, + ) + + + return nothing +end + +""" + MatLMVMSymBroydenSetDelta(petsclib::PetscLibType,B::PetscMat, delta::PetscScalar) +Sets the starting value for the diagonal scaling vector computed +in the SymBrdn approximations (also works for BFGS and DFP). + +Input Parameters: +- `B` - `MATLMVM` matrix +- `delta` - initial value for diagonal scaling + +Level: intermediate + +-seealso: [](ch_ksp), `MATLMVMSYMBROYDEN` + +# External Links +$(_doc_external("Ksp/MatLMVMSymBroydenSetDelta")) +""" +function MatLMVMSymBroydenSetDelta(petsclib::PetscLibType, B::PetscMat, delta::PetscScalar) end + +@for_petsc function MatLMVMSymBroydenSetDelta(petsclib::$UnionPetscLib, B::PetscMat, delta::$PetscScalar ) + + @chk ccall( + (:MatLMVMSymBroydenSetDelta, $petsc_library), + PetscErrorCode, + (CMat, $PetscScalar), + B, delta, + ) + + + return nothing +end + +""" + MatLMVMSymBroydenSetScaleType(petsclib::PetscLibType,B::PetscMat, stype::MatLMVMSymBroydenScaleType) +Sets the scale type for symmetric Broyden + +Input Parameters: +- `B` - the `MATLMVM` matrix +- `stype` - scale type, see `MatLMVMSymBroydenScaleType` + +Options Database Key: +- `-mat_lmvm_scale_type ` - set the scaling type + +Level: intermediate + +MatLMVMSymBrdnScaleTypes: +- `MAT_LMVM_SYMBROYDEN_SCALE_NONE` - use whatever initial Hessian is already there (will be the identity if the user does nothing) +- `MAT_LMVM_SYMBROYDEN_SCALE_SCALAR` - use the Shanno scalar as the initial Hessian +- `MAT_LMVM_SYMBROYDEN_SCALE_DIAGONAL` - use a diagonalized BFGS update as the initial Hessian +- `MAT_LMVM_SYMBROYDEN_SCALE_USER` - same as `MAT_LMVM_SYMBROYDEN_NONE` +- `MAT_LMVM_SYMBROYDEN_SCALE_DECIDE` - let PETSc decide + +-seealso: [](ch_ksp), `MATLMVMSYMBROYDEN`, `MatCreateLMVMSymBroyden()`, `MatLMVMSymBroydenScaleType` + +# External Links +$(_doc_external("Ksp/MatLMVMSymBroydenSetScaleType")) +""" +function MatLMVMSymBroydenSetScaleType(petsclib::PetscLibType, B::PetscMat, stype::MatLMVMSymBroydenScaleType) end + +@for_petsc function MatLMVMSymBroydenSetScaleType(petsclib::$UnionPetscLib, B::PetscMat, stype::MatLMVMSymBroydenScaleType ) + + @chk ccall( + (:MatLMVMSymBroydenSetScaleType, $petsc_library), + PetscErrorCode, + (CMat, MatLMVMSymBroydenScaleType), + B, stype, + ) + + + return nothing +end + +""" + B::PetscMat = MatCreateLMVMSymBroyden(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a limited +for approximating Jacobians. + +Collective + +Input Parameters: +- `comm` - MPI communicator, set to `PETSC_COMM_SELF` +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Options Database Keys: +- `-mat_lmvm_hist_size` - the number of history vectors to keep +- `-mat_lmvm_phi` - convex ratio between BFGS and DFP components of the update +- `-mat_lmvm_scale_type` - type of scaling applied to J0 (none, scalar, diagonal) +- `-mat_lmvm_mult_algorithm` - the algorithm to use for multiplication (recursive, dense, compact_dense) +- `-mat_lmvm_cache_J0_products` - whether products between the base Jacobian J0 and history vectors should be cached or recomputed +- `-mat_lmvm_eps` - (developer) numerical zero tolerance for testing when an update should be skipped +- `-mat_lmvm_debug` - (developer) perform internal debugging checks +- `-mat_lmvm_theta` - (developer) convex ratio between BFGS and DFP components of the diagonal J0 scaling +- `-mat_lmvm_rho` - (developer) update limiter for the J0 scaling +- `-mat_lmvm_alpha` - (developer) coefficient factor for the quadratic subproblem in J0 scaling +- `-mat_lmvm_beta` - (developer) exponential factor for the diagonal J0 scaling +- `-mat_lmvm_sigma_hist` - (developer) number of past updates to use in J0 scaling + +Level: intermediate + +-seealso: [](ch_ksp), `MatCreate()`, `MATLMVM`, `MATLMVMSYMBROYDEN`, `MatCreateLMVMDFP()`, `MatCreateLMVMSR1()`, +`MatCreateLMVMBFGS()`, `MatCreateLMVMBroyden()`, `MatCreateLMVMBadBroyden()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMSymBroyden")) +""" +function MatCreateLMVMSymBroyden(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMSymBroyden(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMSymBroyden, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + B::PetscMat = MatCreateLMVMSymBadBroyden(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a limited +for approximating Jacobians. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Options Database Keys: +- `-mat_lmvm_hist_size` - the number of history vectors to keep +- `-mat_lmvm_psi` - convex ratio between BFGS and DFP components of the update +- `-mat_lmvm_scale_type` - type of scaling applied to J0 (none, scalar, diagonal) +- `-mat_lmvm_mult_algorithm` - the algorithm to use for multiplication (recursive, dense, compact_dense) +- `-mat_lmvm_cache_J0_products` - whether products between the base Jacobian J0 and history vectors should be cached or recomputed +- `-mat_lmvm_eps` - (developer) numerical zero tolerance for testing when an update should be skipped +- `-mat_lmvm_debug` - (developer) perform internal debugging checks +- `-mat_lmvm_theta` - (developer) convex ratio between BFGS and DFP components of the diagonal J0 scaling +- `-mat_lmvm_rho` - (developer) update limiter for the J0 scaling +- `-mat_lmvm_alpha` - (developer) coefficient factor for the quadratic subproblem in J0 scaling +- `-mat_lmvm_beta` - (developer) exponential factor for the diagonal J0 scaling +- `-mat_lmvm_sigma_hist` - (developer) number of past updates to use in J0 scaling + +Level: intermediate + +-seealso: [](ch_ksp), [LMVM Matrices](sec_matlmvm), `MatCreate()`, `MATLMVM`, `MATLMVMSYMBROYDEN`, `MatCreateLMVMDFP()`, `MatCreateLMVMSR1()`, +`MatCreateLMVMBFGS()`, `MatCreateLMVMBroyden()`, `MatCreateLMVMBadBroyden()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMSymBadBroyden")) +""" +function MatCreateLMVMSymBadBroyden(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMSymBadBroyden(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMSymBadBroyden, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + B::PetscMat = MatCreateLMVMDFP(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Creates a limited +used for approximating Jacobians. L-DFP is symmetric positive-definite by +construction, and is the dual of L-BFGS where Y and S vectors swap roles. + +To use the L-DFP matrix with other vector types, the matrix must be +created using `MatCreate()` and `MatSetType()`, followed by `MatLMVMAllocate()`. +This ensures that the internal storage and work vectors are duplicated from the +correct type of vector. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `n` - number of local rows for storage vectors +- `N` - global size of the storage vectors + +Output Parameter: +- `B` - the matrix + +Options Database Keys: +- `-mat_lmvm_scale_type` - (developer) type of scaling applied to J0 (none, scalar, diagonal) +- `-mat_lmvm_theta` - (developer) convex ratio between BFGS and DFP components of the diagonal J0 scaling +- `-mat_lmvm_rho` - (developer) update limiter for the J0 scaling +- `-mat_lmvm_alpha` - (developer) coefficient factor for the quadratic subproblem in J0 scaling +- `-mat_lmvm_beta` - (developer) exponential factor for the diagonal J0 scaling +- `-mat_lmvm_sigma_hist` - (developer) number of past updates to use in J0 scaling + +Level: intermediate + +-seealso: [](ch_ksp), `MatCreate()`, `MATLMVM`, `MATLMVMDFP`, `MatCreateLMVMBFGS()`, `MatCreateLMVMSR1()`, +`MatCreateLMVMBroyden()`, `MatCreateLMVMBadBroyden()`, `MatCreateLMVMSymBroyden()` + +# External Links +$(_doc_external("Ksp/MatCreateLMVMDFP")) +""" +function MatCreateLMVMDFP(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function MatCreateLMVMDFP(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + B_ = Ref{CMat}() + + @chk ccall( + (:MatCreateLMVMDFP, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CMat}), + comm, n, N, B_, + ) + + B = PetscMat(B_[], petsclib) + + return B +end + +""" + S::PetscMat = MatCreateSchurComplement(petsclib::PetscLibType,A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat) +Creates a new `Mat` that behaves like the Schur complement of a matrix + +Collective + +Input Parameters: +- `A00` - the upper-left block of the original matrix A = [A00 A01; A10 A11] +- `Ap00` - matrix from which the preconditioner is constructed for use in ksp(A00,Ap00) to approximate the action of A00^{-1} +- `A01` - the upper-right block of the original matrix A = [A00 A01; A10 A11] +- `A10` - the lower-left block of the original matrix A = [A00 A01; A10 A11] +- `A11` - (optional) the lower-right block of the original matrix A = [A00 A01; A10 A11] + +Output Parameter: +- `S` - the matrix that behaves as the Schur complement S = A11 - A10 ksp(A00,Ap00) A01 + +Level: intermediate + +-seealso: [](ch_ksp), `MatCreateNormal()`, `MatMult()`, `MatCreate()`, `MatSchurComplementGetKSP()`, `MatSchurComplementUpdateSubMatrices()`, `MatCreateTranspose()`, `MatGetSchurComplement()`, +`MatSchurComplementGetPmat()`, `MatSchurComplementSetSubMatrices()` + +# External Links +$(_doc_external("Ksp/MatCreateSchurComplement")) +""" +function MatCreateSchurComplement(petsclib::PetscLibType, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat) end + +@for_petsc function MatCreateSchurComplement(petsclib::$UnionPetscLib, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat ) + S_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSchurComplement, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, CMat, CMat, Ptr{CMat}), + A00, Ap00, A01, A10, A11, S_, + ) + + S = PetscMat(S_[], petsclib) + + return S +end + +""" + MatSchurComplementSetSubMatrices(petsclib::PetscLibType,S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat) +Sets the matrices that define the Schur complement + +Collective + +Input Parameters: +- `S` - matrix obtained with `MatSetType`(S,`MATSCHURCOMPLEMENT`) +- `A00` - the upper-left block of the original matrix A = [A00 A01; A10 A11] +- `Ap00` - matrix from which the preconditioner is constructed for use in ksp(A00,Ap00) to approximate the action of A00^{-1} +- `A01` - the upper-right block of the original matrix A = [A00 A01; A10 A11] +- `A10` - the lower-left block of the original matrix A = [A00 A01; A10 A11] +- `A11` - (optional) the lower-right block of the original matrix A = [A00 A01; A10 A11] + +Level: intermediate + +-seealso: [](ch_ksp), `Mat`, `MatCreateNormal()`, `MatMult()`, `MatCreate()`, `MatSchurComplementGetKSP()`, `MatSchurComplementUpdateSubMatrices()`, `MatCreateTranspose()`, `MatCreateSchurComplement()`, `MatGetSchurComplement()` + +# External Links +$(_doc_external("Ksp/MatSchurComplementSetSubMatrices")) +""" +function MatSchurComplementSetSubMatrices(petsclib::PetscLibType, S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat) end + +@for_petsc function MatSchurComplementSetSubMatrices(petsclib::$UnionPetscLib, S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat ) + + @chk ccall( + (:MatSchurComplementSetSubMatrices, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, CMat, CMat, CMat), + S, A00, Ap00, A01, A10, A11, + ) + + + return nothing +end + +""" + MatSchurComplementGetKSP(petsclib::PetscLibType,S::PetscMat, ksp::PetscKSP) +Gets the `KSP` object that is used to solve with `A00` in the Schur complement matrix S = A11 + +Not Collective + +Input Parameter: +- `S` - matrix obtained with `MatCreateSchurComplement()` (or equivalent) and implementing the action of A11 - A10 ksp(A00,Ap00) A01 + +Output Parameter: +- `ksp` - the linear solver object + +Options Database Key: +- `-fieldsplit__XXX` - sets `KSP` and `PC` options for the 0-split solver inside the Schur complement used in `PCFIELDSPLIT`; default is 0. + +Level: intermediate + +-seealso: [](ch_ksp), `Mat`, `MatSchurComplementSetKSP()`, `MatCreateSchurComplement()`, `MatCreateNormal()`, `MatMult()`, `MatCreate()` + +# External Links +$(_doc_external("Ksp/MatSchurComplementGetKSP")) +""" +function MatSchurComplementGetKSP(petsclib::PetscLibType, S::PetscMat, ksp::PetscKSP) end + +@for_petsc function MatSchurComplementGetKSP(petsclib::$UnionPetscLib, S::PetscMat, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:MatSchurComplementGetKSP, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CKSP}), + S, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + MatSchurComplementSetKSP(petsclib::PetscLibType,S::PetscMat, ksp::PetscKSP) +Sets the `KSP` object that is used to solve with `A00` in the Schur complement matrix S = A11 + +Not Collective + +Input Parameters: +- `S` - matrix created with `MatCreateSchurComplement()` +- `ksp` - the linear solver object + +Level: developer + +-seealso: [](ch_ksp), `Mat`, `MatSchurComplementGetKSP()`, `MatCreateSchurComplement()`, `MatCreateNormal()`, `MatMult()`, `MatCreate()`, `MATSCHURCOMPLEMENT` + +# External Links +$(_doc_external("Ksp/MatSchurComplementSetKSP")) +""" +function MatSchurComplementSetKSP(petsclib::PetscLibType, S::PetscMat, ksp::PetscKSP) end + +@for_petsc function MatSchurComplementSetKSP(petsclib::$UnionPetscLib, S::PetscMat, ksp::PetscKSP ) + + @chk ccall( + (:MatSchurComplementSetKSP, $petsc_library), + PetscErrorCode, + (CMat, CKSP), + S, ksp, + ) + + + return nothing +end + +""" + MatSchurComplementUpdateSubMatrices(petsclib::PetscLibType,S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat) +Updates the Schur complement matrix object with new submatrices + +Collective + +Input Parameters: +- `S` - matrix obtained with `MatCreateSchurComplement()` (or `MatSchurSetSubMatrices()`) and implementing the action of A11 - A10 ksp(A00,Ap00) A01 +- `A00` - the upper-left block of the original matrix A = [A00 A01; A10 A11] +- `Ap00` - matrix from which the preconditioner is constructed for use in ksp(A00,Ap00) to approximate the action of A00^{-1} +- `A01` - the upper-right block of the original matrix A = [A00 A01; A10 A11] +- `A10` - the lower-left block of the original matrix A = [A00 A01; A10 A11] +- `A11` - (optional) the lower-right block of the original matrix A = [A00 A01; A10 A11] + +Level: intermediate + +-seealso: [](ch_ksp), `Mat`, `MatCreateNormal()`, `MatMult()`, `MatCreate()`, `MatSchurComplementGetKSP()`, `MatCreateSchurComplement()` + +# External Links +$(_doc_external("Ksp/MatSchurComplementUpdateSubMatrices")) +""" +function MatSchurComplementUpdateSubMatrices(petsclib::PetscLibType, S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat) end + +@for_petsc function MatSchurComplementUpdateSubMatrices(petsclib::$UnionPetscLib, S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat ) + + @chk ccall( + (:MatSchurComplementUpdateSubMatrices, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, CMat, CMat, CMat), + S, A00, Ap00, A01, A10, A11, + ) + + + return nothing +end + +""" + MatSchurComplementGetSubMatrices(petsclib::PetscLibType,S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat) +Get the individual submatrices in the Schur complement + +Collective + +Input Parameter: +- `S` - matrix obtained with `MatCreateSchurComplement()` (or equivalent) and implementing the action of A11 - A10 ksp(A00,Ap00) A01 + +Output Parameters: +- `A00` - the upper-left block of the original matrix A = [A00 A01; A10 A11] +- `Ap00` - matrix from which the preconditioner is constructed for use in ksp(A00,Ap00) to approximate the action of A^{-1} +- `A01` - the upper-right block of the original matrix A = [A00 A01; A10 A11] +- `A10` - the lower-left block of the original matrix A = [A00 A01; A10 A11] +- `A11` - (optional) the lower-right block of the original matrix A = [A00 A01; A10 A11] + +Level: intermediate + +-seealso: [](ch_ksp), `MatCreateNormal()`, `MatMult()`, `MatCreate()`, `MatSchurComplementGetKSP()`, `MatCreateSchurComplement()`, `MatSchurComplementUpdateSubMatrices()` + +# External Links +$(_doc_external("Ksp/MatSchurComplementGetSubMatrices")) +""" +function MatSchurComplementGetSubMatrices(petsclib::PetscLibType, S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat) end + +@for_petsc function MatSchurComplementGetSubMatrices(petsclib::$UnionPetscLib, S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat ) + A00_ = Ref(A00.ptr) + Ap00_ = Ref(Ap00.ptr) + A01_ = Ref(A01.ptr) + A10_ = Ref(A10.ptr) + A11_ = Ref(A11.ptr) + + @chk ccall( + (:MatSchurComplementGetSubMatrices, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}, Ptr{CMat}, Ptr{CMat}, Ptr{CMat}, Ptr{CMat}), + S, A00_, Ap00_, A01_, A10_, A11_, + ) + + A00.ptr = C_NULL + Ap00.ptr = C_NULL + A01.ptr = C_NULL + A10.ptr = C_NULL + A11.ptr = C_NULL + + return nothing +end + +""" + MatSchurComplementComputeExplicitOperator(petsclib::PetscLibType,A::PetscMat, S::PetscMat) +Compute the Schur complement matrix explicitly + +Collective + +Input Parameter: +- `A` - the matrix obtained with `MatCreateSchurComplement()` + +Output Parameter: +- `S` - the Schur complement matrix + +Level: advanced + +-seealso: [](ch_ksp), `MatCreateSchurComplement()`, `MatSchurComplementUpdateSubMatrices()`, `MatSchurComplementGetPmat()` + +# External Links +$(_doc_external("Ksp/MatSchurComplementComputeExplicitOperator")) +""" +function MatSchurComplementComputeExplicitOperator(petsclib::PetscLibType, A::PetscMat, S::PetscMat) end + +@for_petsc function MatSchurComplementComputeExplicitOperator(petsclib::$UnionPetscLib, A::PetscMat, S::PetscMat ) + S_ = Ref(S.ptr) + + @chk ccall( + (:MatSchurComplementComputeExplicitOperator, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CMat}), + A, S_, + ) + + S.ptr = C_NULL + + return nothing +end + +""" + MatGetSchurComplement(petsclib::PetscLibType,A::PetscMat, isrow0::IS, iscol0::IS, isrow1::IS, iscol1::IS, mreuse::MatReuse, S::PetscMat, ainvtype::MatSchurComplementAinvType, preuse::MatReuse, Sp::PetscMat) +Obtain the Schur complement from eliminating part of the matrix in another part. + +Collective + +Input Parameters: +- `A` - matrix in which the complement is to be taken +- `isrow0` - rows to eliminate +- `iscol0` - columns to eliminate, (isrow0,iscol0) should be square and nonsingular +- `isrow1` - rows in which the Schur complement is formed +- `iscol1` - columns in which the Schur complement is formed +- `mreuse` - `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX`, use `MAT_IGNORE_MATRIX` to put nothing in `S` +- `ainvtype` - the type of approximation used for the inverse of the (0,0) block used in forming `Sp`: +`MAT_SCHUR_COMPLEMENT_AINV_DIAG`, `MAT_SCHUR_COMPLEMENT_AINV_LUMP`, `MAT_SCHUR_COMPLEMENT_AINV_BLOCK_DIAG`, or `MAT_SCHUR_COMPLEMENT_AINV_FULL` +- `preuse` - `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX`, use `MAT_IGNORE_MATRIX` to put nothing in `Sp` + +Output Parameters: +- `S` - exact Schur complement, often of type `MATSCHURCOMPLEMENT` which is difficult to use for preconditioning +- `Sp` - approximate Schur complement from which a preconditioner can be built A11 - A10 inv(DIAGFORM(A00)) A01 + +Level: advanced + +-seealso: [](ch_ksp), `MatCreateSubMatrix()`, `PCFIELDSPLIT`, `MatCreateSchurComplement()`, `MatSchurComplementAinvType` + +# External Links +$(_doc_external("Ksp/MatGetSchurComplement")) +""" +function MatGetSchurComplement(petsclib::PetscLibType, A::PetscMat, isrow0::IS, iscol0::IS, isrow1::IS, iscol1::IS, mreuse::MatReuse, S::PetscMat, ainvtype::MatSchurComplementAinvType, preuse::MatReuse, Sp::PetscMat) end + +@for_petsc function MatGetSchurComplement(petsclib::$UnionPetscLib, A::PetscMat, isrow0::IS, iscol0::IS, isrow1::IS, iscol1::IS, mreuse::MatReuse, S::PetscMat, ainvtype::MatSchurComplementAinvType, preuse::MatReuse, Sp::PetscMat ) + S_ = Ref(S.ptr) + Sp_ = Ref(Sp.ptr) + + @chk ccall( + (:MatGetSchurComplement, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, CIS, CIS, MatReuse, Ptr{CMat}, MatSchurComplementAinvType, MatReuse, Ptr{CMat}), + A, isrow0, iscol0, isrow1, iscol1, mreuse, S_, ainvtype, preuse, Sp_, + ) + + S.ptr = C_NULL + Sp.ptr = C_NULL + + return nothing +end + +""" + MatSchurComplementSetAinvType(petsclib::PetscLibType,S::PetscMat, ainvtype::MatSchurComplementAinvType) +set the type of approximation used for the inverse of the (0,0) block used in forming `Sp` in `MatSchurComplementGetPmat()` + +Not Collective + +Input Parameters: +- `S` - matrix obtained with `MatCreateSchurComplement()` (or equivalent) and implementing the action of A11 - A10 ksp(A00,Ap00) A01 +- `ainvtype` - type of approximation to be used to form approximate Schur complement Sp = A11 - A10 inv(DIAGFORM(A00)) A01: +`MAT_SCHUR_COMPLEMENT_AINV_DIAG`, `MAT_SCHUR_COMPLEMENT_AINV_LUMP`, `MAT_SCHUR_COMPLEMENT_AINV_BLOCK_DIAG`, or `MAT_SCHUR_COMPLEMENT_AINV_FULL` + +Options Database Key: +- `-mat_schur_complement_ainv_type diag | lump | blockdiag | full` - set schur complement type + +Level: advanced + +-seealso: [](ch_ksp), `MatSchurComplementAinvType`, `MatCreateSchurComplement()`, `MatGetSchurComplement()`, `MatSchurComplementGetPmat()`, `MatSchurComplementGetAinvType()` + +# External Links +$(_doc_external("Ksp/MatSchurComplementSetAinvType")) +""" +function MatSchurComplementSetAinvType(petsclib::PetscLibType, S::PetscMat, ainvtype::MatSchurComplementAinvType) end + +@for_petsc function MatSchurComplementSetAinvType(petsclib::$UnionPetscLib, S::PetscMat, ainvtype::MatSchurComplementAinvType ) + + @chk ccall( + (:MatSchurComplementSetAinvType, $petsc_library), + PetscErrorCode, + (CMat, MatSchurComplementAinvType), + S, ainvtype, + ) + + + return nothing +end + +""" + ainvtype::MatSchurComplementAinvType = MatSchurComplementGetAinvType(petsclib::PetscLibType,S::PetscMat) +get the type of approximation for the inverse of the (0,0) block used in forming `Sp` in `MatSchurComplementGetPmat()` + +Not Collective + +Input Parameter: +- `S` - matrix obtained with `MatCreateSchurComplement()` (or equivalent) and implementing the action of A11 - A10 ksp(A00,Ap00) A01 + +Output Parameter: +- `ainvtype` - type of approximation used to form approximate Schur complement Sp = A11 - A10 inv(DIAGFORM(A00)) A01: +`MAT_SCHUR_COMPLEMENT_AINV_DIAG`, `MAT_SCHUR_COMPLEMENT_AINV_LUMP`, `MAT_SCHUR_COMPLEMENT_AINV_BLOCK_DIAG`, or `MAT_SCHUR_COMPLEMENT_AINV_FULL` + +Level: advanced + +-seealso: [](ch_ksp), `MatSchurComplementAinvType`, `MatCreateSchurComplement()`, `MatGetSchurComplement()`, `MatSchurComplementGetPmat()`, `MatSchurComplementSetAinvType()` + +# External Links +$(_doc_external("Ksp/MatSchurComplementGetAinvType")) +""" +function MatSchurComplementGetAinvType(petsclib::PetscLibType, S::PetscMat) end + +@for_petsc function MatSchurComplementGetAinvType(petsclib::$UnionPetscLib, S::PetscMat ) + ainvtype_ = Ref{MatSchurComplementAinvType}() + + @chk ccall( + (:MatSchurComplementGetAinvType, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatSchurComplementAinvType}), + S, ainvtype_, + ) + + ainvtype = unsafe_string(ainvtype_[]) + + return ainvtype +end + +""" + Sp::PetscMat = MatCreateSchurComplementPmat(petsclib::PetscLibType,A00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat, ainvtype::MatSchurComplementAinvType, preuse::MatReuse) +create a matrix for preconditioning the Schur complement by explicitly assembling the sparse matrix +Sp = A11 - A10 inv(DIAGFORM(A00)) A01 + +Collective + +Input Parameters: +- `A00` - the upper-left part of the original matrix A = [A00 A01; A10 A11] +- `A01` - (optional) the upper-right part of the original matrix A = [A00 A01; A10 A11] +- `A10` - (optional) the lower-left part of the original matrix A = [A00 A01; A10 A11] +- `A11` - (optional) the lower-right part of the original matrix A = [A00 A01; A10 A11] +- `ainvtype` - type of approximation for DIAGFORM(A00) used when forming Sp = A11 - A10 inv(DIAGFORM(A00)) A01. See `MatSchurComplementAinvType`. +- `preuse` - `MAT_INITIAL_MATRIX` for a new `Sp`, or `MAT_REUSE_MATRIX` to reuse an existing `Sp`, or `MAT_IGNORE_MATRIX` to put nothing in `Sp` + +Output Parameter: +- `Sp` - approximate Schur complement suitable for constructing a preconditioner for the true Schur complement S = A11 - A10 inv(A00) A01 + +Level: advanced + +-seealso: [](ch_ksp), `MatCreateSchurComplement()`, `MatGetSchurComplement()`, `MatSchurComplementGetPmat()`, `MatSchurComplementAinvType` + +# External Links +$(_doc_external("Ksp/MatCreateSchurComplementPmat")) +""" +function MatCreateSchurComplementPmat(petsclib::PetscLibType, A00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat, ainvtype::MatSchurComplementAinvType, preuse::MatReuse) end + +@for_petsc function MatCreateSchurComplementPmat(petsclib::$UnionPetscLib, A00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat, ainvtype::MatSchurComplementAinvType, preuse::MatReuse ) + Sp_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSchurComplementPmat, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, CMat, MatSchurComplementAinvType, MatReuse, Ptr{CMat}), + A00, A01, A10, A11, ainvtype, preuse, Sp_, + ) + + Sp = PetscMat(Sp_[], petsclib) + + return Sp +end + +""" + MatSchurComplementGetPmat(petsclib::PetscLibType,S::PetscMat, preuse::MatReuse, Sp::PetscMat) +Obtain a matrix for preconditioning the Schur complement by assembling Sp = A11 + +Collective + +Input Parameters: +- `S` - matrix obtained with MatCreateSchurComplement() (or equivalent) that implements the action of A11 - A10 ksp(A00,Ap00) A01 +- `preuse` - `MAT_INITIAL_MATRIX` for a new `Sp`, or `MAT_REUSE_MATRIX` to reuse an existing `Sp`, or `MAT_IGNORE_MATRIX` to put nothing in `Sp` + +Output Parameter: +- `Sp` - approximate Schur complement suitable for preconditioning the exact Schur complement S = A11 - A10 inv(A00) A01 + +Level: advanced + +-seealso: [](ch_ksp), `MatCreateSubMatrix()`, `PCFIELDSPLIT`, `MatGetSchurComplement()`, `MatCreateSchurComplement()`, `MatSchurComplementSetAinvType()` + +# External Links +$(_doc_external("Ksp/MatSchurComplementGetPmat")) +""" +function MatSchurComplementGetPmat(petsclib::PetscLibType, S::PetscMat, preuse::MatReuse, Sp::PetscMat) end + +@for_petsc function MatSchurComplementGetPmat(petsclib::$UnionPetscLib, S::PetscMat, preuse::MatReuse, Sp::PetscMat ) + Sp_ = Ref(Sp.ptr) + + @chk ccall( + (:MatSchurComplementGetPmat, $petsc_library), + PetscErrorCode, + (CMat, MatReuse, Ptr{CMat}), + S, preuse, Sp_, + ) + + Sp.ptr = C_NULL + + return nothing +end + +""" + J::PetscMat = MatCreateSNESMFMore(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec) +Creates a matrix +context for use with a `SNES` solver that uses the More method to compute an optimal h based on the noise of the function. This matrix can be used as +the Jacobian argument for the routine `SNESSetJacobian()`. + +Input Parameters: +- `snes` - the `SNES` context +- `x` - vector where `SNES` solution is to be stored. + +Output Parameter: +- `J` - the matrix-free matrix + +Options Database Keys: +- `-snes_mf_err ` - see `MatCreateSNESMF()` +- `-snes_mf_umin ` - see `MatCreateSNESMF()` +- `-snes_mf_compute_err` - compute the square root or relative error in function +- `-snes_mf_freq_err ` - set the frequency to recompute the parameters +- `-snes_mf_jorge` - use the method of Jorge More + +Level: advanced + +-seealso: [](ch_snes), `SNESCreateMF()`, `MatCreateMFFD()`, `MatDestroy()`, `MatMFFDSetFunctionError()` + +# External Links +$(_doc_external("Snes/MatCreateSNESMFMore")) +""" +function MatCreateSNESMFMore(petsclib::PetscLibType, snes::PetscSNES, x::PetscVec) end + +@for_petsc function MatCreateSNESMFMore(petsclib::$UnionPetscLib, snes::PetscSNES, x::PetscVec ) + J_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSNESMFMore, $petsc_library), + PetscErrorCode, + (CSNES, CVec, Ptr{CMat}), + snes, x, J_, + ) + + J = PetscMat(J_[], petsclib) + + return J +end + +""" + MatSNESMFMoreSetParameters(petsclib::PetscLibType,mat::PetscMat, error::PetscReal, umin::PetscReal, h::PetscReal) +Sets the parameters for the approximation of +matrix-vector products using finite differences, see `MatCreateSNESMFMore()` + +Input Parameters: +- `mat` - the matrix +- `error` - relative error (should be set to the square root of the relative error in the function evaluations) +- `umin` - minimum allowable u-value +- `h` - differencing parameter + +Options Database Keys: +- `-snes_mf_err ` - see `MatCreateSNESMF()` +- `-snes_mf_umin ` - see `MatCreateSNESMF()` +- `-snes_mf_compute_err` - compute the square root or relative error in function +- `-snes_mf_freq_err ` - set the frequency to recompute the parameters +- `-snes_mf_jorge` - use the method of Jorge More + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `MatCreateSNESMF()`, `MatCreateSNESMFMore()` + +# External Links +$(_doc_external("Snes/MatSNESMFMoreSetParameters")) +""" +function MatSNESMFMoreSetParameters(petsclib::PetscLibType, mat::PetscMat, error::PetscReal, umin::PetscReal, h::PetscReal) end + +@for_petsc function MatSNESMFMoreSetParameters(petsclib::$UnionPetscLib, mat::PetscMat, error::$PetscReal, umin::$PetscReal, h::$PetscReal ) + + @chk ccall( + (:MatSNESMFMoreSetParameters, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal, $PetscReal, $PetscReal), + mat, error, umin, h, + ) + + + return nothing +end + +""" + MatSNESMFGetSNES(petsclib::PetscLibType,J::PetscMat, snes::PetscSNES) +returns the `SNES` associated with a matrix created with `MatCreateSNESMF()` + +Not Collective + +Input Parameter: +- `J` - the matrix + +Output Parameter: +- `snes` - the `SNES` object + +Level: advanced + +-seealso: [](ch_snes), `Mat`, `SNES`, `MatCreateSNESMF()` + +# External Links +$(_doc_external("Snes/MatSNESMFGetSNES")) +""" +function MatSNESMFGetSNES(petsclib::PetscLibType, J::PetscMat, snes::PetscSNES) end + +@for_petsc function MatSNESMFGetSNES(petsclib::$UnionPetscLib, J::PetscMat, snes::PetscSNES ) + snes_ = Ref(snes.ptr) + + @chk ccall( + (:MatSNESMFGetSNES, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CSNES}), + J, snes_, + ) + + snes.ptr = C_NULL + + return nothing +end + +""" + MatSNESMFSetReuseBase(petsclib::PetscLibType,J::PetscMat, use::PetscBool) +Causes the base vector to be used for differencing even if the function provided to `SNESSetFunction()` is not the +same as that provided to `MatMFFDSetFunction()`. + +Logically Collective + +Input Parameters: +- `J` - the `MATMFFD` matrix +- `use` - if true always reuse the base vector instead of recomputing f(u) even if the function in the `MATMFFD` is +not `SNESComputeFunction()` + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `MATMFFD`, `MatMFFDSetFunction()`, `SNESSetFunction()`, `MatCreateSNESMF()`, `MatSNESMFGetReuseBase()` + +# External Links +$(_doc_external("Snes/MatSNESMFSetReuseBase")) +""" +function MatSNESMFSetReuseBase(petsclib::PetscLibType, J::PetscMat, use::PetscBool) end + +@for_petsc function MatSNESMFSetReuseBase(petsclib::$UnionPetscLib, J::PetscMat, use::PetscBool ) + + @chk ccall( + (:MatSNESMFSetReuseBase, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + J, use, + ) + + + return nothing +end + +""" + use::PetscBool = MatSNESMFGetReuseBase(petsclib::PetscLibType,J::PetscMat) +Determines if the base vector is to be used for differencing even if the function provided to `SNESSetFunction()` is not the +same as that provided to `MatMFFDSetFunction()`. + +Logically Collective + +Input Parameter: +- `J` - the `MATMFFD` matrix + +Output Parameter: +- `use` - if true always reuse the base vector instead of recomputing f(u) even if the function in the `MATMFFD` is +not `SNESComputeFunction()` + +Level: advanced + +-seealso: [](ch_snes), `Mat`, `SNES`, `MatSNESMFSetReuseBase()`, `MatCreateSNESMF()` + +# External Links +$(_doc_external("Snes/MatSNESMFGetReuseBase")) +""" +function MatSNESMFGetReuseBase(petsclib::PetscLibType, J::PetscMat) end + +@for_petsc function MatSNESMFGetReuseBase(petsclib::$UnionPetscLib, J::PetscMat ) + use_ = Ref{PetscBool}() + + @chk ccall( + (:MatSNESMFGetReuseBase, $petsc_library), + PetscErrorCode, + (CMat, Ptr{PetscBool}), + J, use_, + ) + + use = use_[] + + return use +end + +""" + J::PetscMat = MatCreateSNESMF(petsclib::PetscLibType,snes::PetscSNES) +Creates a finite differencing based matrix +a `SNES` solver. This matrix can be used as the Jacobian argument for +the routine `SNESSetJacobian()`. See `MatCreateMFFD()` for details on how +the finite difference computation is done. + +Collective + +Input Parameters: +- `snes` - the `SNES` context + +Output Parameter: +- `J` - the matrix-free matrix which is of type `MATMFFD` + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `MATMFFD`, `MatDestroy()`, `MatMFFDSetFunction()`, `MatMFFDSetFunctionError()`, `MatMFFDDSSetUmin()` +`MatMFFDSetHHistory()`, `MatMFFDResetHHistory()`, `MatCreateMFFD()`, `MatCreateShell()`, +`MatMFFDGetH()`, `MatMFFDRegister()`, `MatMFFDComputeJacobian()`, `MatSNESMFSetReuseBase()`, `MatSNESMFGetReuseBase()` + +# External Links +$(_doc_external("Snes/MatCreateSNESMF")) +""" +function MatCreateSNESMF(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function MatCreateSNESMF(petsclib::$UnionPetscLib, snes::PetscSNES ) + J_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSNESMF, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CMat}), + snes, J_, + ) + + J = PetscMat(J_[], petsclib) + + return J +end + +""" + dm::PetscDM = MatGetDM(petsclib::PetscLibType,A::PetscMat) +Gets the `DM` defining the data layout of the matrix + +Not Collective + +Input Parameter: +- `A` - The `Mat` + +Output Parameter: +- `dm` - The `DM` + +Level: intermediate + +Note: +A matrix may not have a `DM` associated with it + +Developer Note: +Since the `Mat` class doesn't know about the `DM` class the `DM` object is associated with the `Mat` through a `PetscObjectCompose()` operation + +See also: +=== +`DM`, `MatSetDM()`, `DMCreateMatrix()`, `DMSetMatType()` + +# External Links +$(_doc_external("DM/MatGetDM")) +""" +function MatGetDM(petsclib::PetscLibType, A::PetscMat) end + +@for_petsc function MatGetDM(petsclib::$UnionPetscLib, A::PetscMat ) + dm_ = Ref{CDM}() + + @chk ccall( + (:MatGetDM, $petsc_library), + PetscErrorCode, + (CMat, Ptr{CDM}), + A, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + MatSetDM(petsclib::PetscLibType,A::PetscMat, dm::PetscDM) +Sets the `DM` defining the data layout of the matrix + +Not Collective + +Input Parameters: +- `A` - The `Mat` +- `dm` - The `DM` + +Level: developer + +Note: +This is rarely used in practice, rather `DMCreateMatrix()` is used to create a matrix associated with a particular `DM` + +Developer Note: +Since the `Mat` class doesn't know about the `DM` class the `DM` object is associated with +the `Mat` through a `PetscObjectCompose()` operation + +See also: +=== +`DM`, `MatGetDM()`, `DMCreateMatrix()`, `DMSetMatType()` + +# External Links +$(_doc_external("DM/MatSetDM")) +""" +function MatSetDM(petsclib::PetscLibType, A::PetscMat, dm::PetscDM) end + +@for_petsc function MatSetDM(petsclib::$UnionPetscLib, A::PetscMat, dm::PetscDM ) + + @chk ccall( + (:MatSetDM, $petsc_library), + PetscErrorCode, + (CMat, CDM), + A, dm, + ) + + + return nothing +end + +""" + MatDFischer(petsclib::PetscLibType,jac::PetscMat, X::PetscVec, Con::PetscVec, XL::PetscVec, XU::PetscVec, T1::PetscVec, T2::PetscVec, Da::PetscVec, Db::PetscVec) +Calculates an element of the B +Fischer-Burmeister function for complementarity problems. + +Collective + +Input Parameters: +- `jac` - the jacobian of `f` at `X` +- `X` - current point +- `Con` - constraints function evaluated at `X` +- `XL` - lower bounds +- `XU` - upper bounds +- `T1` - work vector +- `T2` - work vector + +Output Parameters: +- `Da` - diagonal perturbation component of the result +- `Db` - row scaling component of the result + +Level: developer + +-seealso: `Mat`, `VecFischer()`, `VecSFischer()`, `MatDSFischer()` + +# External Links +$(_doc_external("Tao/MatDFischer")) +""" +function MatDFischer(petsclib::PetscLibType, jac::PetscMat, X::PetscVec, Con::PetscVec, XL::PetscVec, XU::PetscVec, T1::PetscVec, T2::PetscVec, Da::PetscVec, Db::PetscVec) end + +@for_petsc function MatDFischer(petsclib::$UnionPetscLib, jac::PetscMat, X::PetscVec, Con::PetscVec, XL::PetscVec, XU::PetscVec, T1::PetscVec, T2::PetscVec, Da::PetscVec, Db::PetscVec ) + + @chk ccall( + (:MatDFischer, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec, CVec, CVec, CVec, CVec, CVec), + jac, X, Con, XL, XU, T1, T2, Da, Db, + ) + + + return nothing +end + +""" + MatDSFischer(petsclib::PetscLibType,jac::PetscMat, X::PetscVec, Con::PetscVec, XL::PetscVec, XU::PetscVec, mu::PetscReal, T1::PetscVec, T2::PetscVec, Da::PetscVec, Db::PetscVec, Dm::PetscVec) +Calculates an element of the B +smoothed Fischer-Burmeister function for complementarity problems. + +Collective + +Input Parameters: +- `jac` - the jacobian of f at X +- `X` - current point +- `Con` - constraint function evaluated at X +- `XL` - lower bounds +- `XU` - upper bounds +- `mu` - smoothing parameter +- `T1` - work vector +- `T2` - work vector + +Output Parameters: +- `Da` - diagonal perturbation component of the result +- `Db` - row scaling component of the result +- `Dm` - derivative with respect to scaling parameter + +Level: developer + +-seealso: `Mat`, `VecFischer()`, `VecDFischer()`, `MatDFischer()` + +# External Links +$(_doc_external("Tao/MatDSFischer")) +""" +function MatDSFischer(petsclib::PetscLibType, jac::PetscMat, X::PetscVec, Con::PetscVec, XL::PetscVec, XU::PetscVec, mu::PetscReal, T1::PetscVec, T2::PetscVec, Da::PetscVec, Db::PetscVec, Dm::PetscVec) end + +@for_petsc function MatDSFischer(petsclib::$UnionPetscLib, jac::PetscMat, X::PetscVec, Con::PetscVec, XL::PetscVec, XU::PetscVec, mu::$PetscReal, T1::PetscVec, T2::PetscVec, Da::PetscVec, Db::PetscVec, Dm::PetscVec ) + + @chk ccall( + (:MatDSFischer, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec, CVec, $PetscReal, CVec, CVec, CVec, CVec, CVec), + jac, X, Con, XL, XU, mu, T1, T2, Da, Db, Dm, + ) + + + return nothing +end + +""" + J::PetscMat = MatCreateSubMatrixFree(petsclib::PetscLibType,mat::PetscMat, Rows::IS, Cols::IS) +Creates a reduced matrix by masking a +full matrix. + +Collective + +Input Parameters: +- `mat` - matrix of arbitrary type +- `Rows` - the rows that will be in the submatrix +- `Cols` - the columns that will be in the submatrix + +Output Parameter: +- `J` - New matrix + +Level: developer + +-seealso: `MatCreate()` + +# External Links +$(_doc_external("Tao/MatCreateSubMatrixFree")) +""" +function MatCreateSubMatrixFree(petsclib::PetscLibType, mat::PetscMat, Rows::IS, Cols::IS) end + +@for_petsc function MatCreateSubMatrixFree(petsclib::$UnionPetscLib, mat::PetscMat, Rows::IS, Cols::IS ) + J_ = Ref{CMat}() + + @chk ccall( + (:MatCreateSubMatrixFree, $petsc_library), + PetscErrorCode, + (CMat, CIS, CIS, Ptr{CMat}), + mat, Rows, Cols, J_, + ) + + J = PetscMat(J_[], petsclib) + + return J +end + +""" + MatSetValue(petsclib::PetscLibType,mat::PetscMat, i::PetscInt, j::PetscInt, va::PetscScalar, mode::InsertMode) + +# External Links +$(_doc_external("Mat/MatSetValue")) +""" +function MatSetValue(petsclib::PetscLibType, mat::PetscMat, i::PetscInt, j::PetscInt, va::PetscScalar, mode::InsertMode) end + +@for_petsc function MatSetValue(petsclib::$UnionPetscLib, mat::PetscMat, i::$PetscInt, j::$PetscInt, va::$PetscScalar, mode::InsertMode ) + + @chk ccall( + (:MatSetValue, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, $PetscScalar, InsertMode), + mat, i, j, va, mode, + ) + + + return nothing +end + +""" + va::PetscScalar = MatGetValue(petsclib::PetscLibType,mat::PetscMat, row::PetscInt, col::PetscInt) + +# External Links +$(_doc_external("Mat/MatGetValue")) +""" +function MatGetValue(petsclib::PetscLibType, mat::PetscMat, row::PetscInt, col::PetscInt) end + +@for_petsc function MatGetValue(petsclib::$UnionPetscLib, mat::PetscMat, row::$PetscInt, col::$PetscInt ) + va_ = Ref{$PetscScalar}() + + @chk ccall( + (:MatGetValue, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + mat, row, col, va_, + ) + + va = va_[] + + return va +end + +""" + MatSetValueLocal(petsclib::PetscLibType,mat::PetscMat, i::PetscInt, j::PetscInt, va::PetscScalar, mode::InsertMode) + +# External Links +$(_doc_external("Mat/MatSetValueLocal")) +""" +function MatSetValueLocal(petsclib::PetscLibType, mat::PetscMat, i::PetscInt, j::PetscInt, va::PetscScalar, mode::InsertMode) end + +@for_petsc function MatSetValueLocal(petsclib::$UnionPetscLib, mat::PetscMat, i::$PetscInt, j::$PetscInt, va::$PetscScalar, mode::InsertMode ) + + @chk ccall( + (:MatSetValueLocal, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, $PetscScalar, InsertMode), + mat, i, j, va, mode, + ) + + + return nothing +end + +# NOTE: +# there are a few functions that are not listed by the python routine, but that are relevant +# Below, they are wrapped manually + + + +""" + MatShellSetOperation(petsclib::PetscLibType, mat::PetscMat, op::MatOperation, g::Ptr) + +Allows user to set a matrix operation for a `MATSHELL` shell matrix. + +Logically Collective + +Input Parameters: +`mat` - the `MATSHELL` shell matrix +`op` - the name of the operation +`g` - a pointer to the function that provides the operation created with `@cfunction` + +Level: advanced + +-seealso: `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellGetContext()`, `MatShellGetOperation()`, `MatShellSetContext()`, `MatSetOperation()`, `MatShellSetManageScalingShifts()`, `MatShellSetMatProductOperation()` + +# External Links +$(_doc_external("Mat/MatShellSetOperation")) +""" +function MatShellSetOperation(petsclib::PetscLibType, mat::AbstractPetscMat, op::MatOperation, g::Ptr) end + +@for_petsc function MatShellSetOperation(petsclib::$UnionPetscLib, mat::AbstractPetscMat, op::MatOperation, g::Ptr) + + @chk ccall( + (:MatShellSetOperation, $petsc_library), + PetscErrorCode, + (CMat, MatOperation, Ptr{Cvoid}), + mat, op, g, + ) + + return nothing +end \ No newline at end of file diff --git a/src/autowrapped/Mataddons_wrappers.jl b/src/autowrapped/Mataddons_wrappers.jl new file mode 100644 index 00000000..4b602a88 --- /dev/null +++ b/src/autowrapped/Mataddons_wrappers.jl @@ -0,0 +1,4242 @@ +# autodefined type arguments for class ------ +mutable struct _n_MatColoring end +const MatColoring = Ptr{_n_MatColoring} + +mutable struct _n_MatFDColoring end +const MatFDColoring = Ptr{_n_MatFDColoring} + +mutable struct MatFDColoringFn end + +mutable struct _n_MatPartitioning end +const MatPartitioning = Ptr{_n_MatPartitioning} + +mutable struct MatNullSpaceRemoveFn end + +mutable struct MatMFFDFn end + +mutable struct MatMFFDiFn end + +mutable struct MatMFFDiBaseFn end + +mutable struct MatMFFDCheckhFn end + +mutable struct _n_MatCoarsen end +const MatCoarsen = Ptr{_n_MatCoarsen} + +mutable struct _n_PetscCoarsenData end +const PetscCoarsenData = Ptr{_n_PetscCoarsenData} + +# ------------------------------------------------------- +""" + MatColoringPatch(petsclib::PetscLibType,mat::PetscMat, ncolors::PetscInt, n::PetscInt, colorarray::Vector{ISColoringValue}, iscoloring::ISColoring) +Used inside matrix coloring routines that use `MatGetRowIJ()` and/or +`MatGetColumnIJ()`. + +Collective + +Input Parameters: +- `mat` - the matrix +- `ncolors` - maximum color value +- `n` - number of entries in colorarray +- `colorarray` - array indicating color for each column + +Output Parameter: +- `iscoloring` - coloring generated using colorarray information + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatGetRowIJ()`, `MatGetColumnIJ()` + +# External Links +$(_doc_external("Mat/MatColoringPatch")) +""" +function MatColoringPatch(petsclib::PetscLibType, mat::PetscMat, ncolors::PetscInt, n::PetscInt, colorarray::Vector{ISColoringValue}, iscoloring::ISColoring) end + +@for_petsc function MatColoringPatch(petsclib::$UnionPetscLib, mat::PetscMat, ncolors::$PetscInt, n::$PetscInt, colorarray::Vector{ISColoringValue}, iscoloring::ISColoring ) + + @chk ccall( + (:MatColoringPatch, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, $PetscInt, Ptr{ISColoringValue}, Ptr{ISColoring}), + mat, ncolors, n, colorarray, iscoloring, + ) + + + return nothing +end + +""" + MatColoringRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new sparse matrix coloring to the matrix package. + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of Coloring (for example `MATCOLORINGSL`) +- `function` - function pointer that creates the coloring + +Level: developer + +-seealso: `MatColoringType`, `MatColoringRegisterDestroy()`, `MatColoringRegisterAll()` + +# External Links +$(_doc_external("Mat/MatColoringRegister")) +""" +function MatColoringRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function MatColoringRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:MatColoringRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + mcptr::MatColoring = MatColoringCreate(petsclib::PetscLibType,m::PetscMat) +Creates a matrix coloring context. + +Collective + +Input Parameter: +- `m` - a `Mat` from which a coloring is derived + +Output Parameter: +- `mcptr` - the new `MatColoring` context + +Options Database Keys: +- `-mat_coloring_type` - the type of coloring algorithm used. See `MatColoringType`. +- `-mat_coloring_maxcolors` - the maximum number of relevant colors, all nodes not in a color are in maxcolors+1 +- `-mat_coloring_distance` - compute a distance 1,2,... coloring. +- `-mat_coloring_view` - print information about the coloring and the produced index sets +- `-mat_coloring_test` - debugging option that prints all coloring incompatibilities +- `-mat_is_coloring_test` - debugging option that throws an error if MatColoringApply() generates an incorrect iscoloring + +Level: beginner + +-seealso: `MatColoringSetFromOptions()`, `MatColoring`, `MatColoringApply()`, `MatFDColoringCreate()`, `DMCreateColoring()`, `MatColoringType` + +# External Links +$(_doc_external("Mat/MatColoringCreate")) +""" +function MatColoringCreate(petsclib::PetscLibType, m::PetscMat) end + +@for_petsc function MatColoringCreate(petsclib::$UnionPetscLib, m::PetscMat ) + mcptr_ = Ref{MatColoring}() + + @chk ccall( + (:MatColoringCreate, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatColoring}), + m, mcptr_, + ) + + mcptr = mcptr_[] + + return mcptr +end + +""" + MatColoringDestroy(petsclib::PetscLibType,mc::MatColoring) +Destroys the matrix coloring context + +Collective + +Input Parameter: +- `mc` - the `MatColoring` context + +Level: beginner + +-seealso: `MatColoring`, `MatColoringCreate()`, `MatColoringApply()` + +# External Links +$(_doc_external("Mat/MatColoringDestroy")) +""" +function MatColoringDestroy(petsclib::PetscLibType, mc::MatColoring) end + +@for_petsc function MatColoringDestroy(petsclib::$UnionPetscLib, mc::MatColoring ) + + @chk ccall( + (:MatColoringDestroy, $petsc_library), + PetscErrorCode, + (Ptr{MatColoring},), + mc, + ) + + + return nothing +end + +""" + MatColoringSetType(petsclib::PetscLibType,mc::MatColoring, type::MatColoringType) +Sets the type of coloring algorithm used + +Collective + +Input Parameters: +- `mc` - the `MatColoring` context +- `type` - the type of coloring + +Options Database Key: +- `-mat_coloring_type type` - the name of the type + +Level: beginner + +-seealso: `MatColoring`, `MatColoringSetFromOptions()`, `MatColoringType`, `MatColoringCreate()`, `MatColoringApply()` + +# External Links +$(_doc_external("Mat/MatColoringSetType")) +""" +function MatColoringSetType(petsclib::PetscLibType, mc::MatColoring, type::MatColoringType) end + +@for_petsc function MatColoringSetType(petsclib::$UnionPetscLib, mc::MatColoring, type::MatColoringType ) + + @chk ccall( + (:MatColoringSetType, $petsc_library), + PetscErrorCode, + (MatColoring, MatColoringType), + mc, type, + ) + + + return nothing +end + +""" + MatColoringSetFromOptions(petsclib::PetscLibType,mc::MatColoring) +Sets `MatColoring` options from options database + +Collective + +Input Parameter: +- `mc` - `MatColoring` context + +Options Database Keys: +- `-mat_coloring_type` - the type of coloring algorithm used. See `MatColoringType`. +- `-mat_coloring_maxcolors` - the maximum number of relevant colors, all nodes not in a color are in maxcolors+1 +- `-mat_coloring_distance` - compute a distance 1,2,... coloring. +- `-mat_coloring_view` - print information about the coloring and the produced index sets +- `-snes_fd_color` - instruct SNES to using coloring and then `MatFDColoring` to compute the Jacobians +- `-snes_fd_color_use_mat` - instruct `SNES` to color the matrix directly instead of the `DM` from which the matrix comes (the default) + +Level: beginner + +-seealso: `MatColoring`, `MatColoringApply()`, `MatColoringSetDistance()`, `MatColoringSetType()`, `SNESComputeJacobianDefaultColor()`, `MatColoringType` + +# External Links +$(_doc_external("Mat/MatColoringSetFromOptions")) +""" +function MatColoringSetFromOptions(petsclib::PetscLibType, mc::MatColoring) end + +@for_petsc function MatColoringSetFromOptions(petsclib::$UnionPetscLib, mc::MatColoring ) + + @chk ccall( + (:MatColoringSetFromOptions, $petsc_library), + PetscErrorCode, + (MatColoring,), + mc, + ) + + + return nothing +end + +""" + MatColoringSetDistance(petsclib::PetscLibType,mc::MatColoring, dist::PetscInt) +Sets the distance of the coloring + +Logically Collective + +Input Parameters: +- `mc` - the `MatColoring` context +- `dist` - the distance the coloring should compute + +Options Database Key: +- `-mat_coloring_type` - the type of coloring algorithm used. See `MatColoringType`. + +Level: beginner + +-seealso: `MatColoring`, `MatColoringSetFromOptions()`, `MatColoringGetDistance()`, `MatColoringApply()` + +# External Links +$(_doc_external("Mat/MatColoringSetDistance")) +""" +function MatColoringSetDistance(petsclib::PetscLibType, mc::MatColoring, dist::PetscInt) end + +@for_petsc function MatColoringSetDistance(petsclib::$UnionPetscLib, mc::MatColoring, dist::$PetscInt ) + + @chk ccall( + (:MatColoringSetDistance, $petsc_library), + PetscErrorCode, + (MatColoring, $PetscInt), + mc, dist, + ) + + + return nothing +end + +""" + dist::PetscInt = MatColoringGetDistance(petsclib::PetscLibType,mc::MatColoring) +Gets the distance of the coloring + +Logically Collective + +Input Parameter: +- `mc` - the `MatColoring` context + +Output Parameter: +- `dist` - the current distance being used for the coloring. + +Level: beginner + +-seealso: `MatColoring`, `MatColoringSetDistance()`, `MatColoringApply()` + +# External Links +$(_doc_external("Mat/MatColoringGetDistance")) +""" +function MatColoringGetDistance(petsclib::PetscLibType, mc::MatColoring) end + +@for_petsc function MatColoringGetDistance(petsclib::$UnionPetscLib, mc::MatColoring ) + dist_ = Ref{$PetscInt}() + + @chk ccall( + (:MatColoringGetDistance, $petsc_library), + PetscErrorCode, + (MatColoring, Ptr{$PetscInt}), + mc, dist_, + ) + + dist = dist_[] + + return dist +end + +""" + MatColoringSetMaxColors(petsclib::PetscLibType,mc::MatColoring, maxcolors::PetscInt) +Sets the maximum number of colors to produce + +Logically Collective + +Input Parameters: +- `mc` - the `MatColoring` context +- `maxcolors` - the maximum number of colors to produce + +Level: beginner + +-seealso: `MatColoring`, `MatColoringGetMaxColors()`, `MatColoringApply()` + +# External Links +$(_doc_external("Mat/MatColoringSetMaxColors")) +""" +function MatColoringSetMaxColors(petsclib::PetscLibType, mc::MatColoring, maxcolors::PetscInt) end + +@for_petsc function MatColoringSetMaxColors(petsclib::$UnionPetscLib, mc::MatColoring, maxcolors::$PetscInt ) + + @chk ccall( + (:MatColoringSetMaxColors, $petsc_library), + PetscErrorCode, + (MatColoring, $PetscInt), + mc, maxcolors, + ) + + + return nothing +end + +""" + maxcolors::PetscInt = MatColoringGetMaxColors(petsclib::PetscLibType,mc::MatColoring) +Gets the maximum number of colors + +Logically Collective + +Input Parameter: +- `mc` - the `MatColoring` context + +Output Parameter: +- `maxcolors` - the current maximum number of colors to produce + +Level: beginner + +-seealso: `MatColoring`, `MatColoringSetMaxColors()`, `MatColoringApply()` + +# External Links +$(_doc_external("Mat/MatColoringGetMaxColors")) +""" +function MatColoringGetMaxColors(petsclib::PetscLibType, mc::MatColoring) end + +@for_petsc function MatColoringGetMaxColors(petsclib::$UnionPetscLib, mc::MatColoring ) + maxcolors_ = Ref{$PetscInt}() + + @chk ccall( + (:MatColoringGetMaxColors, $petsc_library), + PetscErrorCode, + (MatColoring, Ptr{$PetscInt}), + mc, maxcolors_, + ) + + maxcolors = maxcolors_[] + + return maxcolors +end + +""" + MatColoringApply(petsclib::PetscLibType,mc::MatColoring, coloring::ISColoring) +Apply the coloring to the matrix, producing index +sets corresponding to a number of independent sets in the induced +graph. + +Collective + +Input Parameter: +- `mc` - the `MatColoring` context + +Output Parameter: +- `coloring` - the `ISColoring` instance containing the coloring + +Level: beginner + +-seealso: `ISColoring`, `MatColoring`, `MatColoringCreate()` + +# External Links +$(_doc_external("Mat/MatColoringApply")) +""" +function MatColoringApply(petsclib::PetscLibType, mc::MatColoring, coloring::ISColoring) end + +@for_petsc function MatColoringApply(petsclib::$UnionPetscLib, mc::MatColoring, coloring::ISColoring ) + + @chk ccall( + (:MatColoringApply, $petsc_library), + PetscErrorCode, + (MatColoring, Ptr{ISColoring}), + mc, coloring, + ) + + + return nothing +end + +""" + MatColoringView(petsclib::PetscLibType,mc::MatColoring, viewer::PetscViewer) +Output details about the `MatColoring`. + +Collective + +Input Parameters: +- `mc` - the `MatColoring` context +- `viewer` - the Viewer context + +Level: beginner + +-seealso: `PetscViewer`, `MatColoring`, `MatColoringApply()` + +# External Links +$(_doc_external("Mat/MatColoringView")) +""" +function MatColoringView(petsclib::PetscLibType, mc::MatColoring, viewer::PetscViewer) end + +@for_petsc function MatColoringView(petsclib::$UnionPetscLib, mc::MatColoring, viewer::PetscViewer ) + + @chk ccall( + (:MatColoringView, $petsc_library), + PetscErrorCode, + (MatColoring, PetscViewer), + mc, viewer, + ) + + + return nothing +end + +""" + MatColoringSetWeightType(petsclib::PetscLibType,mc::MatColoring, wt::MatColoringWeightType) +Set the type of weight computation used while computing the coloring + +Logically Collective + +Input Parameters: +- `mc` - the `MatColoring` context +- `wt` - the weight type + +Level: beginner + +-seealso: `MatColoring`, `MatColoringWeightType`, `MatColoringApply()` + +# External Links +$(_doc_external("Mat/MatColoringSetWeightType")) +""" +function MatColoringSetWeightType(petsclib::PetscLibType, mc::MatColoring, wt::MatColoringWeightType) end + +@for_petsc function MatColoringSetWeightType(petsclib::$UnionPetscLib, mc::MatColoring, wt::MatColoringWeightType ) + + @chk ccall( + (:MatColoringSetWeightType, $petsc_library), + PetscErrorCode, + (MatColoring, MatColoringWeightType), + mc, wt, + ) + + + return nothing +end + +""" + degrees::PetscInt = MatColoringGetDegrees(petsclib::PetscLibType,G::PetscMat, distance::PetscInt) + +# External Links +$(_doc_external("Mat/MatColoringGetDegrees")) +""" +function MatColoringGetDegrees(petsclib::PetscLibType, G::PetscMat, distance::PetscInt) end + +@for_petsc function MatColoringGetDegrees(petsclib::$UnionPetscLib, G::PetscMat, distance::$PetscInt ) + degrees_ = Ref{$PetscInt}() + + @chk ccall( + (:MatColoringGetDegrees, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}), + G, distance, degrees_, + ) + + degrees = degrees_[] + + return degrees +end + +""" + MatColoringCreateWeights(petsclib::PetscLibType,mc::MatColoring, weights::PetscReal, lperm::PetscInt) + +# External Links +$(_doc_external("Mat/MatColoringCreateWeights")) +""" +function MatColoringCreateWeights(petsclib::PetscLibType, mc::MatColoring, weights::PetscReal, lperm::PetscInt) end + +@for_petsc function MatColoringCreateWeights(petsclib::$UnionPetscLib, mc::MatColoring, weights::$PetscReal, lperm::$PetscInt ) + + @chk ccall( + (:MatColoringCreateWeights, $petsc_library), + PetscErrorCode, + (MatColoring, $PetscReal, $PetscInt), + mc, weights, lperm, + ) + + + return nothing +end + +""" + weights::PetscReal,lperm::PetscInt = MatColoringSetWeights(petsclib::PetscLibType,mc::MatColoring) + +# External Links +$(_doc_external("Mat/MatColoringSetWeights")) +""" +function MatColoringSetWeights(petsclib::PetscLibType, mc::MatColoring) end + +@for_petsc function MatColoringSetWeights(petsclib::$UnionPetscLib, mc::MatColoring ) + weights_ = Ref{$PetscReal}() + lperm_ = Ref{$PetscInt}() + + @chk ccall( + (:MatColoringSetWeights, $petsc_library), + PetscErrorCode, + (MatColoring, Ptr{$PetscReal}, Ptr{$PetscInt}), + mc, weights_, lperm_, + ) + + weights = weights_[] + lperm = lperm_[] + + return weights,lperm +end + +""" + MatFDColoringSetF(petsclib::PetscLibType,fd::MatFDColoring, F::PetscVec) + +# External Links +$(_doc_external("Mat/MatFDColoringSetF")) +""" +function MatFDColoringSetF(petsclib::PetscLibType, fd::MatFDColoring, F::PetscVec) end + +@for_petsc function MatFDColoringSetF(petsclib::$UnionPetscLib, fd::MatFDColoring, F::PetscVec ) + + @chk ccall( + (:MatFDColoringSetF, $petsc_library), + PetscErrorCode, + (MatFDColoring, CVec), + fd, F, + ) + + + return nothing +end + +""" + MatFDColoringView(petsclib::PetscLibType,c::MatFDColoring, viewer::PetscViewer) +Views a finite difference coloring context. + +Collective + +Input Parameters: +- `c` - the coloring context +- `viewer` - visualization context + +Level: intermediate + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()` + +# External Links +$(_doc_external("Mat/MatFDColoringView")) +""" +function MatFDColoringView(petsclib::PetscLibType, c::MatFDColoring, viewer::PetscViewer) end + +@for_petsc function MatFDColoringView(petsclib::$UnionPetscLib, c::MatFDColoring, viewer::PetscViewer ) + + @chk ccall( + (:MatFDColoringView, $petsc_library), + PetscErrorCode, + (MatFDColoring, PetscViewer), + c, viewer, + ) + + + return nothing +end + +""" + MatFDColoringSetParameters(petsclib::PetscLibType,matfd::MatFDColoring, error::PetscReal, umin::PetscReal) +Sets the parameters for the approximation of +a sparse Jacobian matrix using finite differences and matrix coloring + +Logically Collective + +Input Parameters: +- `matfd` - the coloring context +- `error` - relative error +- `umin` - minimum allowable u-value magnitude + +Level: advanced + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()`, `MatFDColoringSetFromOptions()` + +# External Links +$(_doc_external("Mat/MatFDColoringSetParameters")) +""" +function MatFDColoringSetParameters(petsclib::PetscLibType, matfd::MatFDColoring, error::PetscReal, umin::PetscReal) end + +@for_petsc function MatFDColoringSetParameters(petsclib::$UnionPetscLib, matfd::MatFDColoring, error::$PetscReal, umin::$PetscReal ) + + @chk ccall( + (:MatFDColoringSetParameters, $petsc_library), + PetscErrorCode, + (MatFDColoring, $PetscReal, $PetscReal), + matfd, error, umin, + ) + + + return nothing +end + +""" + MatFDColoringSetBlockSize(petsclib::PetscLibType,matfd::MatFDColoring, brows::PetscInt, bcols::PetscInt) +Sets block size for efficient inserting entries of Jacobian matrix. + +Logically Collective + +Input Parameters: +- `matfd` - the coloring context +- `brows` - number of rows in the block +- `bcols` - number of columns in the block + +Level: intermediate + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()`, `MatFDColoringSetFromOptions()` + +# External Links +$(_doc_external("Mat/MatFDColoringSetBlockSize")) +""" +function MatFDColoringSetBlockSize(petsclib::PetscLibType, matfd::MatFDColoring, brows::PetscInt, bcols::PetscInt) end + +@for_petsc function MatFDColoringSetBlockSize(petsclib::$UnionPetscLib, matfd::MatFDColoring, brows::$PetscInt, bcols::$PetscInt ) + + @chk ccall( + (:MatFDColoringSetBlockSize, $petsc_library), + PetscErrorCode, + (MatFDColoring, $PetscInt, $PetscInt), + matfd, brows, bcols, + ) + + + return nothing +end + +""" + MatFDColoringSetUp(petsclib::PetscLibType,mat::PetscMat, iscoloring::ISColoring, color::MatFDColoring) +Sets up the internal data structures of matrix coloring context for the later use. + +Collective + +Input Parameters: +- `mat` - the matrix containing the nonzero structure of the Jacobian +- `iscoloring` - the coloring of the matrix; usually obtained with `MatGetColoring()` or `DMCreateColoring()` +- `color` - the matrix coloring context + +Level: beginner + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()`, `MatFDColoringDestroy()` + +# External Links +$(_doc_external("Mat/MatFDColoringSetUp")) +""" +function MatFDColoringSetUp(petsclib::PetscLibType, mat::PetscMat, iscoloring::ISColoring, color::MatFDColoring) end + +@for_petsc function MatFDColoringSetUp(petsclib::$UnionPetscLib, mat::PetscMat, iscoloring::ISColoring, color::MatFDColoring ) + + @chk ccall( + (:MatFDColoringSetUp, $petsc_library), + PetscErrorCode, + (CMat, ISColoring, MatFDColoring), + mat, iscoloring, color, + ) + + + return nothing +end + +""" + MatFDColoringGetFunction(petsclib::PetscLibType,matfd::MatFDColoring, f::MatFDColoringFn, fctx::Cvoid) +Gets the function to use for computing the Jacobian. + +Not Collective + +Input Parameter: +- `matfd` - the coloring context + +Output Parameters: +- `f` - the function, see `MatFDColoringFn` for the calling sequence +- `fctx` - the optional user-defined function context + +Level: intermediate + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()`, `MatFDColoringSetFunction()`, `MatFDColoringSetFromOptions()`, `MatFDColoringFn` + +# External Links +$(_doc_external("Mat/MatFDColoringGetFunction")) +""" +function MatFDColoringGetFunction(petsclib::PetscLibType, matfd::MatFDColoring, f::MatFDColoringFn, fctx::Cvoid) end + +@for_petsc function MatFDColoringGetFunction(petsclib::$UnionPetscLib, matfd::MatFDColoring, f::MatFDColoringFn, fctx::Cvoid ) + + @chk ccall( + (:MatFDColoringGetFunction, $petsc_library), + PetscErrorCode, + (MatFDColoring, MatFDColoringFn, Cvoid), + matfd, f, fctx, + ) + + + return nothing +end + +""" + MatFDColoringSetFunction(petsclib::PetscLibType,matfd::MatFDColoring, f::MatFDColoringFn, fctx::Cvoid) +Sets the function to use for computing the Jacobian. + +Logically Collective + +Input Parameters: +- `matfd` - the coloring context +- `f` - the function, see `MatFDColoringFn` for the calling sequence +- `fctx` - the optional user-defined function context + +Level: advanced + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()`, `MatFDColoringGetFunction()`, `MatFDColoringSetFromOptions()`, `MatFDColoringFn` + +# External Links +$(_doc_external("Mat/MatFDColoringSetFunction")) +""" +function MatFDColoringSetFunction(petsclib::PetscLibType, matfd::MatFDColoring, f::MatFDColoringFn, fctx::Cvoid) end + +@for_petsc function MatFDColoringSetFunction(petsclib::$UnionPetscLib, matfd::MatFDColoring, f::MatFDColoringFn, fctx::Cvoid ) + + @chk ccall( + (:MatFDColoringSetFunction, $petsc_library), + PetscErrorCode, + (MatFDColoring, Ptr{MatFDColoringFn}, Ptr{Cvoid}), + matfd, f, fctx, + ) + + + return nothing +end + +""" + MatFDColoringSetFromOptions(petsclib::PetscLibType,matfd::MatFDColoring) +Sets coloring finite difference parameters from +the options database. + +Collective + +The Jacobian, F'(u), is estimated with the differencing approximation +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()`, `MatFDColoringView()`, `MatFDColoringSetParameters()` + +# External Links +$(_doc_external("Mat/MatFDColoringSetFromOptions")) +""" +function MatFDColoringSetFromOptions(petsclib::PetscLibType, matfd::MatFDColoring) end + +@for_petsc function MatFDColoringSetFromOptions(petsclib::$UnionPetscLib, matfd::MatFDColoring ) + + @chk ccall( + (:MatFDColoringSetFromOptions, $petsc_library), + PetscErrorCode, + (MatFDColoring,), + matfd, + ) + + + return nothing +end + +""" + MatFDColoringSetType(petsclib::PetscLibType,matfd::MatFDColoring, type::MatMFFDType) +Sets the approach for computing the finite difference parameter + +Collective + +Input Parameters: +- `matfd` - the coloring context +- `type` - either `MATMFFD_WP` or `MATMFFD_DS` + +Options Database Key: +- `-mat_fd_type` - "wp" or "ds" + +Level: intermediate + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()`, `MatFDColoringView()`, `MatFDColoringSetParameters()` + +# External Links +$(_doc_external("Mat/MatFDColoringSetType")) +""" +function MatFDColoringSetType(petsclib::PetscLibType, matfd::MatFDColoring, type::MatMFFDType) end + +@for_petsc function MatFDColoringSetType(petsclib::$UnionPetscLib, matfd::MatFDColoring, type::MatMFFDType ) + + @chk ccall( + (:MatFDColoringSetType, $petsc_library), + PetscErrorCode, + (MatFDColoring, MatMFFDType), + matfd, type, + ) + + + return nothing +end + +""" + color::MatFDColoring = MatFDColoringCreate(petsclib::PetscLibType,mat::PetscMat, iscoloring::ISColoring) +Creates a matrix coloring context for finite difference +computation of Jacobians. + +Collective + +Input Parameters: +- `mat` - the matrix containing the nonzero structure of the Jacobian +- `iscoloring` - the coloring of the matrix; usually obtained with `MatColoringCreate()` or `DMCreateColoring()` + +Output Parameter: +- `color` - the new coloring context + +Level: intermediate + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringDestroy()`, `SNESComputeJacobianDefaultColor()`, `ISColoringCreate()`, +`MatFDColoringSetFunction()`, `MatFDColoringSetFromOptions()`, `MatFDColoringApply()`, +`MatFDColoringView()`, `MatFDColoringSetParameters()`, `MatColoringCreate()`, `DMCreateColoring()`, `MatFDColoringSetValues()` + +# External Links +$(_doc_external("Mat/MatFDColoringCreate")) +""" +function MatFDColoringCreate(petsclib::PetscLibType, mat::PetscMat, iscoloring::ISColoring) end + +@for_petsc function MatFDColoringCreate(petsclib::$UnionPetscLib, mat::PetscMat, iscoloring::ISColoring ) + color_ = Ref{MatFDColoring}() + + @chk ccall( + (:MatFDColoringCreate, $petsc_library), + PetscErrorCode, + (CMat, ISColoring, Ptr{MatFDColoring}), + mat, iscoloring, color_, + ) + + color = color_[] + + return color +end + +""" + MatFDColoringDestroy(petsclib::PetscLibType,c::MatFDColoring) +Destroys a matrix coloring context that was created +via `MatFDColoringCreate()`. + +Collective + +Input Parameter: +- `c` - coloring context + +Level: intermediate + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()` + +# External Links +$(_doc_external("Mat/MatFDColoringDestroy")) +""" +function MatFDColoringDestroy(petsclib::PetscLibType, c::MatFDColoring) end + +@for_petsc function MatFDColoringDestroy(petsclib::$UnionPetscLib, c::MatFDColoring ) + + @chk ccall( + (:MatFDColoringDestroy, $petsc_library), + PetscErrorCode, + (Ptr{MatFDColoring},), + c, + ) + + + return nothing +end + +""" + n::PetscInt,cols::Vector{PetscInt} = MatFDColoringGetPerturbedColumns(petsclib::PetscLibType,coloring::MatFDColoring) +Returns the indices of the columns that +that are currently being perturbed. + +Not Collective + +Input Parameter: +- `coloring` - coloring context created with `MatFDColoringCreate()` + +Output Parameters: +- `n` - the number of local columns being perturbed +- `cols` - the column indices, in global numbering + +Level: advanced + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()`, `MatFDColoringDestroy()`, `MatFDColoringView()`, `MatFDColoringApply()` + +# External Links +$(_doc_external("Mat/MatFDColoringGetPerturbedColumns")) +""" +function MatFDColoringGetPerturbedColumns(petsclib::PetscLibType, coloring::MatFDColoring) end + +@for_petsc function MatFDColoringGetPerturbedColumns(petsclib::$UnionPetscLib, coloring::MatFDColoring ) + n_ = Ref{$PetscInt}() + cols_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:MatFDColoringGetPerturbedColumns, $petsc_library), + PetscErrorCode, + (MatFDColoring, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + coloring, n_, cols_, + ) + + n = n_[] + cols = unsafe_wrap(Array, cols_[], VecGetLocalSize(petsclib, x); own = false) + + return n,cols +end + +""" + MatFDColoringApply(petsclib::PetscLibType,J::PetscMat, coloring::MatFDColoring, x1::PetscVec, sctx::Cvoid) +Given a matrix for which a `MatFDColoring` context +has been created, computes the Jacobian for a function via finite differences. + +Collective + +Input Parameters: +- `J` - matrix to store Jacobian entries into +- `coloring` - coloring context created with `MatFDColoringCreate()` +- `x1` - location at which Jacobian is to be computed +- `sctx` - context required by function, if this is being used with the `SNES` solver then it is `SNES` object, otherwise it is `NULL` + +Options Database Keys: +- `-mat_fd_type` - "wp" or "ds" (see `MATMFFD_WP` or `MATMFFD_DS`) +- `-mat_fd_coloring_view` - Activates basic viewing or coloring +- `-mat_fd_coloring_view draw` - Activates drawing of coloring +- `-mat_fd_coloring_view ::ascii_info` - Activates viewing of coloring info + +Level: intermediate + +-seealso: `Mat`, `MatFDColoring`, `MatFDColoringCreate()`, `MatFDColoringDestroy()`, `MatFDColoringView()`, `MatFDColoringSetFunction()`, `MatFDColoringSetValues()` + +# External Links +$(_doc_external("Mat/MatFDColoringApply")) +""" +function MatFDColoringApply(petsclib::PetscLibType, J::PetscMat, coloring::MatFDColoring, x1::PetscVec, sctx::Cvoid) end + +@for_petsc function MatFDColoringApply(petsclib::$UnionPetscLib, J::PetscMat, coloring::MatFDColoring, x1::PetscVec, sctx::Cvoid ) + + @chk ccall( + (:MatFDColoringApply, $petsc_library), + PetscErrorCode, + (CMat, MatFDColoring, CVec, Ptr{Cvoid}), + J, coloring, x1, sctx, + ) + + + return nothing +end + +""" + MatFDColoringSetValues(petsclib::PetscLibType,J::PetscMat, coloring::MatFDColoring, y::Vector{PetscScalar}) +takes a matrix in compressed color format and enters the matrix into a PETSc `Mat` + +Collective + +Input Parameters: +- `J` - the sparse matrix +- `coloring` - created with `MatFDColoringCreate()` and a local coloring +- `y` - column major storage of matrix values with one color of values per column, the number of rows of `y` should match +the number of local rows of `J` and the number of columns is the number of colors. + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatFDColoringCreate()`, `ISColoring`, `ISColoringCreate()`, `ISColoringSetType()`, `IS_COLORING_LOCAL`, `MatFDColoringSetBlockSize()` + +# External Links +$(_doc_external("Mat/MatFDColoringSetValues")) +""" +function MatFDColoringSetValues(petsclib::PetscLibType, J::PetscMat, coloring::MatFDColoring, y::Vector{PetscScalar}) end + +@for_petsc function MatFDColoringSetValues(petsclib::$UnionPetscLib, J::PetscMat, coloring::MatFDColoring, y::Vector{$PetscScalar} ) + + @chk ccall( + (:MatFDColoringSetValues, $petsc_library), + PetscErrorCode, + (CMat, MatFDColoring, Ptr{$PetscScalar}), + J, coloring, y, + ) + + + return nothing +end + +""" + MatFDColoringUseDM(petsclib::PetscLibType,coloring::PetscMat, fdcoloring::MatFDColoring) +allows a `MatFDColoring` object to use the `DM` associated with the matrix to compute a `IS_COLORING_LOCAL` coloring + +Input Parameters: +- `coloring` - The matrix to get the `DM` from +- `fdcoloring` - the `MatFDColoring` object + +Level: advanced + +Developer Note: +This routine exists because the PETSc `Mat` library does not know about the `DM` objects + +See also: +=== +`DM`, `MatFDColoring`, `MatFDColoringCreate()`, `ISColoringType` + +# External Links +$(_doc_external("Dm/MatFDColoringUseDM")) +""" +function MatFDColoringUseDM(petsclib::PetscLibType, coloring::PetscMat, fdcoloring::MatFDColoring) end + +@for_petsc function MatFDColoringUseDM(petsclib::$UnionPetscLib, coloring::PetscMat, fdcoloring::MatFDColoring ) + + @chk ccall( + (:MatFDColoringUseDM, $petsc_library), + PetscErrorCode, + (CMat, MatFDColoring), + coloring, fdcoloring, + ) + + + return nothing +end + +""" + MatTransposeColoringDestroy(petsclib::PetscLibType,c::MatTransposeColoring) +Destroys a coloring context for matrix product C = A*B^T that was created +via `MatTransposeColoringCreate()`. + +Collective + +Input Parameter: +- `c` - coloring context + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatTransposeColoringCreate()` + +# External Links +$(_doc_external("Mat/MatTransposeColoringDestroy")) +""" +function MatTransposeColoringDestroy(petsclib::PetscLibType, c::MatTransposeColoring) end + +@for_petsc function MatTransposeColoringDestroy(petsclib::$UnionPetscLib, c::MatTransposeColoring ) + + @chk ccall( + (:MatTransposeColoringDestroy, $petsc_library), + PetscErrorCode, + (Ptr{MatTransposeColoring},), + c, + ) + + + return nothing +end + +""" + color::MatTransposeColoring = MatTransposeColoringCreate(petsclib::PetscLibType,mat::PetscMat, iscoloring::ISColoring) +Creates a matrix coloring context for the matrix product C = A*B^T. + +Collective + +Input Parameters: +- `mat` - the matrix product C +- `iscoloring` - the coloring of the matrix; usually obtained with `MatColoringCreate()` or `DMCreateColoring()` + +Output Parameter: +- `color` - the new coloring context + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatTransposeColoringDestroy()`, `MatTransColoringApplySpToDen()`, +`MatTransColoringApplyDenToSp()` + +# External Links +$(_doc_external("Mat/MatTransposeColoringCreate")) +""" +function MatTransposeColoringCreate(petsclib::PetscLibType, mat::PetscMat, iscoloring::ISColoring) end + +@for_petsc function MatTransposeColoringCreate(petsclib::$UnionPetscLib, mat::PetscMat, iscoloring::ISColoring ) + color_ = Ref{MatTransposeColoring}() + + @chk ccall( + (:MatTransposeColoringCreate, $petsc_library), + PetscErrorCode, + (CMat, ISColoring, Ptr{MatTransposeColoring}), + mat, iscoloring, color_, + ) + + color = color_[] + + return color +end + +""" + MatPartitioningRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new sparse matrix partitioning to the matrix package. + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of partitioning (for example `MATPARTITIONINGCURRENT`) or `MATPARTITIONINGPARMETIS` +- `function` - function pointer that creates the partitioning type + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningType`, `MatPartitioningCreate()`, `MatPartitioningRegisterDestroy()`, `MatPartitioningRegisterAll()` + +# External Links +$(_doc_external("Mat/MatPartitioningRegister")) +""" +function MatPartitioningRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function MatPartitioningRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:MatPartitioningRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + type::MatPartitioningType = MatPartitioningGetType(petsclib::PetscLibType,partitioning::MatPartitioning) +Gets the Partitioning method type and name (as a string) +from the partitioning context. + +Not Collective + +Input Parameter: +- `partitioning` - the partitioning context + +Output Parameter: +- `type` - partitioner type + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningType`, `MatPartitioningCreate()`, `MatPartitioningRegisterDestroy()`, `MatPartitioningRegisterAll()` + +# External Links +$(_doc_external("Mat/MatPartitioningGetType")) +""" +function MatPartitioningGetType(petsclib::PetscLibType, partitioning::MatPartitioning) end + +@for_petsc function MatPartitioningGetType(petsclib::$UnionPetscLib, partitioning::MatPartitioning ) + type_ = Ref{MatPartitioningType}() + + @chk ccall( + (:MatPartitioningGetType, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{MatPartitioningType}), + partitioning, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + MatPartitioningSetNParts(petsclib::PetscLibType,part::MatPartitioning, n::PetscInt) +Set how many partitions need to be created; +by default this is one per processor. Certain partitioning schemes may +in fact only support that option. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `n` - the number of partitions + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningCreate()`, `MatPartitioningApply()` + +# External Links +$(_doc_external("Mat/MatPartitioningSetNParts")) +""" +function MatPartitioningSetNParts(petsclib::PetscLibType, part::MatPartitioning, n::PetscInt) end + +@for_petsc function MatPartitioningSetNParts(petsclib::$UnionPetscLib, part::MatPartitioning, n::$PetscInt ) + + @chk ccall( + (:MatPartitioningSetNParts, $petsc_library), + PetscErrorCode, + (MatPartitioning, $PetscInt), + part, n, + ) + + + return nothing +end + +""" + MatPartitioningApplyND(petsclib::PetscLibType,matp::MatPartitioning, partitioning::IS) +Gets a nested dissection partitioning for a matrix. + +Collective + +Input Parameter: +- `matp` - the matrix partitioning object + +Output Parameter: +- `partitioning` - the partitioning. For each local node, a positive value indicates the processor +number the node has been assigned to. Negative x values indicate the separator level -(x+1). + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatPartitioningRegister()`, `MatPartitioningCreate()`, +`MatPartitioningDestroy()`, `MatPartitioningSetAdjacency()`, `ISPartitioningToNumbering()`, +`ISPartitioningCount()` + +# External Links +$(_doc_external("Mat/MatPartitioningApplyND")) +""" +function MatPartitioningApplyND(petsclib::PetscLibType, matp::MatPartitioning, partitioning::IS) end + +@for_petsc function MatPartitioningApplyND(petsclib::$UnionPetscLib, matp::MatPartitioning, partitioning::IS ) + partitioning_ = Ref(partitioning.ptr) + + @chk ccall( + (:MatPartitioningApplyND, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{CIS}), + matp, partitioning_, + ) + + partitioning.ptr = C_NULL + + return nothing +end + +""" + MatPartitioningApply(petsclib::PetscLibType,matp::MatPartitioning, partitioning::IS) +Gets a partitioning for the graph represented by a sparse matrix. + +Collective + +Input Parameter: +- `matp` - the matrix partitioning object + +Output Parameter: +- `partitioning` - the partitioning. For each local node this tells the MPI rank that that node is assigned to. + +Options Database Keys: +- `-mat_partitioning_type ` - set the partitioning package or algorithm to use +- `-mat_partitioning_view` - display information about the partitioning object + +Level: beginner + +The user can define additional partitionings; see `MatPartitioningRegister()`. + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningType`, `MatPartitioningRegister()`, `MatPartitioningCreate()`, +`MatPartitioningDestroy()`, `MatPartitioningSetAdjacency()`, `ISPartitioningToNumbering()`, +`ISPartitioningCount()` + +# External Links +$(_doc_external("Mat/MatPartitioningApply")) +""" +function MatPartitioningApply(petsclib::PetscLibType, matp::MatPartitioning, partitioning::IS) end + +@for_petsc function MatPartitioningApply(petsclib::$UnionPetscLib, matp::MatPartitioning, partitioning::IS ) + partitioning_ = Ref(partitioning.ptr) + + @chk ccall( + (:MatPartitioningApply, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{CIS}), + matp, partitioning_, + ) + + partitioning.ptr = C_NULL + + return nothing +end + +""" + MatPartitioningImprove(petsclib::PetscLibType,matp::MatPartitioning, partitioning::IS) +Improves the quality of a given partition. + +Collective + +Input Parameters: +- `matp` - the matrix partitioning object +- `partitioning` - the original partitioning. For each local node this tells the processor +number that that node is assigned to. + +Options Database Key: +- `-mat_partitioning_improve` - improve the quality of the given partition + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningType`, `MatPartitioningApply()`, `MatPartitioningCreate()`, +`MatPartitioningDestroy()`, `MatPartitioningSetAdjacency()`, `ISPartitioningToNumbering()`, +`ISPartitioningCount()` + +# External Links +$(_doc_external("Mat/MatPartitioningImprove")) +""" +function MatPartitioningImprove(petsclib::PetscLibType, matp::MatPartitioning, partitioning::IS) end + +@for_petsc function MatPartitioningImprove(petsclib::$UnionPetscLib, matp::MatPartitioning, partitioning::IS ) + partitioning_ = Ref(partitioning.ptr) + + @chk ccall( + (:MatPartitioningImprove, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{CIS}), + matp, partitioning_, + ) + + partitioning.ptr = C_NULL + + return nothing +end + +""" + MatPartitioningViewImbalance(petsclib::PetscLibType,matp::MatPartitioning, partitioning::IS) +Display partitioning imbalance information. + +Collective + +Input Parameters: +- `matp` - the matrix partitioning object +- `partitioning` - the partitioning. For each local node this tells the MPI rank that that node is assigned to. + +Options Database Key: +- `-mat_partitioning_view_balance` - view the balance information from the last partitioning + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningType`, `MatPartitioningApply()`, `MatPartitioningView()` + +# External Links +$(_doc_external("Mat/MatPartitioningViewImbalance")) +""" +function MatPartitioningViewImbalance(petsclib::PetscLibType, matp::MatPartitioning, partitioning::IS) end + +@for_petsc function MatPartitioningViewImbalance(petsclib::$UnionPetscLib, matp::MatPartitioning, partitioning::IS ) + + @chk ccall( + (:MatPartitioningViewImbalance, $petsc_library), + PetscErrorCode, + (MatPartitioning, CIS), + matp, partitioning, + ) + + + return nothing +end + +""" + MatPartitioningSetAdjacency(petsclib::PetscLibType,part::MatPartitioning, adj::PetscMat) +Sets the adjacency graph (matrix) of the thing to be +partitioned. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `adj` - the adjacency matrix, this can be any `MatType` but the natural representation is `MATMPIADJ` + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningType`, `MatPartitioningCreate()` + +# External Links +$(_doc_external("Mat/MatPartitioningSetAdjacency")) +""" +function MatPartitioningSetAdjacency(petsclib::PetscLibType, part::MatPartitioning, adj::PetscMat) end + +@for_petsc function MatPartitioningSetAdjacency(petsclib::$UnionPetscLib, part::MatPartitioning, adj::PetscMat ) + + @chk ccall( + (:MatPartitioningSetAdjacency, $petsc_library), + PetscErrorCode, + (MatPartitioning, CMat), + part, adj, + ) + + + return nothing +end + +""" + MatPartitioningDestroy(petsclib::PetscLibType,part::MatPartitioning) +Destroys the partitioning context. + +Collective + +Input Parameter: +- `part` - the partitioning context + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningType`, `MatPartitioningCreate()` + +# External Links +$(_doc_external("Mat/MatPartitioningDestroy")) +""" +function MatPartitioningDestroy(petsclib::PetscLibType, part::MatPartitioning) end + +@for_petsc function MatPartitioningDestroy(petsclib::$UnionPetscLib, part::MatPartitioning ) + + @chk ccall( + (:MatPartitioningDestroy, $petsc_library), + PetscErrorCode, + (Ptr{MatPartitioning},), + part, + ) + + + return nothing +end + +""" + MatPartitioningSetVertexWeights(petsclib::PetscLibType,part::MatPartitioning, weights::Vector{PetscInt}) +Sets the weights for vertices for a partitioning. + +Logically Collective + +Input Parameters: +- `part` - the partitioning context +- `weights` - the weights, on each process this array must have the same size as the number of local rows times the value passed with `MatPartitioningSetNumberVertexWeights()` or +1 if that is not provided + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningCreate()`, `MatPartitioningSetType()`, `MatPartitioningSetPartitionWeights()`, `MatPartitioningSetNumberVertexWeights()` + +# External Links +$(_doc_external("Mat/MatPartitioningSetVertexWeights")) +""" +function MatPartitioningSetVertexWeights(petsclib::PetscLibType, part::MatPartitioning, weights::Vector{PetscInt}) end + +@for_petsc function MatPartitioningSetVertexWeights(petsclib::$UnionPetscLib, part::MatPartitioning, weights::Vector{$PetscInt} ) + + @chk ccall( + (:MatPartitioningSetVertexWeights, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{$PetscInt}), + part, weights, + ) + + + return nothing +end + +""" + MatPartitioningSetPartitionWeights(petsclib::PetscLibType,part::MatPartitioning, weights::Vector{PetscReal}) +Sets the weights for each partition. + +Logically Collective + +Input Parameters: +- `part` - the partitioning context +- `weights` - An array of size nparts that is used to specify the fraction of +vertex weight that should be distributed to each sub-domain for +the balance constraint. If all of the sub-domains are to be of +the same size, then each of the nparts elements should be set +to a value of 1/nparts. Note that the sum of all of the weights +should be one. + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningSetVertexWeights()`, `MatPartitioningCreate()`, `MatPartitioningSetType()` + +# External Links +$(_doc_external("Mat/MatPartitioningSetPartitionWeights")) +""" +function MatPartitioningSetPartitionWeights(petsclib::PetscLibType, part::MatPartitioning, weights::Vector{PetscReal}) end + +@for_petsc function MatPartitioningSetPartitionWeights(petsclib::$UnionPetscLib, part::MatPartitioning, weights::Vector{$PetscReal} ) + + @chk ccall( + (:MatPartitioningSetPartitionWeights, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{$PetscReal}), + part, weights, + ) + + + return nothing +end + +""" + MatPartitioningSetUseEdgeWeights(petsclib::PetscLibType,part::MatPartitioning, use_edge_weights::PetscBool) +Set a flag to indicate whether or not to use edge weights. + +Logically Collective + +Input Parameters: +- `part` - the partitioning context +- `use_edge_weights` - the flag indicateing whether or not to use edge weights. By default no edge weights will be used, +that is, use_edge_weights is set to FALSE. If set use_edge_weights to TRUE, users need to make sure legal +edge weights are stored in an ADJ matrix. + +Options Database Key: +- `-mat_partitioning_use_edge_weights` - (true or false) + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningCreate()`, `MatPartitioningSetType()`, `MatPartitioningSetVertexWeights()`, `MatPartitioningSetPartitionWeights()` + +# External Links +$(_doc_external("Mat/MatPartitioningSetUseEdgeWeights")) +""" +function MatPartitioningSetUseEdgeWeights(petsclib::PetscLibType, part::MatPartitioning, use_edge_weights::PetscBool) end + +@for_petsc function MatPartitioningSetUseEdgeWeights(petsclib::$UnionPetscLib, part::MatPartitioning, use_edge_weights::PetscBool ) + + @chk ccall( + (:MatPartitioningSetUseEdgeWeights, $petsc_library), + PetscErrorCode, + (MatPartitioning, PetscBool), + part, use_edge_weights, + ) + + + return nothing +end + +""" + use_edge_weights::PetscBool = MatPartitioningGetUseEdgeWeights(petsclib::PetscLibType,part::MatPartitioning) +Get a flag that indicates whether or not to edge weights are used. + +Logically Collective + +Input Parameter: +- `part` - the partitioning context + +Output Parameter: +- `use_edge_weights` - the flag indicateing whether or not to edge weights are used. + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningCreate()`, `MatPartitioningSetType()`, `MatPartitioningSetVertexWeights()`, `MatPartitioningSetPartitionWeights()`, +`MatPartitioningSetUseEdgeWeights` + +# External Links +$(_doc_external("Mat/MatPartitioningGetUseEdgeWeights")) +""" +function MatPartitioningGetUseEdgeWeights(petsclib::PetscLibType, part::MatPartitioning) end + +@for_petsc function MatPartitioningGetUseEdgeWeights(petsclib::$UnionPetscLib, part::MatPartitioning ) + use_edge_weights_ = Ref{PetscBool}() + + @chk ccall( + (:MatPartitioningGetUseEdgeWeights, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{PetscBool}), + part, use_edge_weights_, + ) + + use_edge_weights = use_edge_weights_[] + + return use_edge_weights +end + +""" + newp::MatPartitioning = MatPartitioningCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a partitioning context. + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `newp` - location to put the context + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningSetType()`, `MatPartitioningApply()`, `MatPartitioningDestroy()`, +`MatPartitioningSetAdjacency()` + +# External Links +$(_doc_external("Mat/MatPartitioningCreate")) +""" +function MatPartitioningCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function MatPartitioningCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + newp_ = Ref{MatPartitioning}() + + @chk ccall( + (:MatPartitioningCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{MatPartitioning}), + comm, newp_, + ) + + newp = newp_[] + + return newp +end + +""" + MatPartitioningViewFromOptions(petsclib::PetscLibType,A::MatPartitioning, obj::PetscObject, name::String) +View a partitioning context from the options database + +Collective + +Input Parameters: +- `A` - the partitioning context +- `obj` - Optional object that provides the prefix used in the options database check +- `name` - command line option + +Options Database Key: +- `-mat_partitioning_view [viewertype]:...` - the viewer and its options + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningView()`, `PetscObjectViewFromOptions()`, `MatPartitioningCreate()` + +# External Links +$(_doc_external("Mat/MatPartitioningViewFromOptions")) +""" +function MatPartitioningViewFromOptions(petsclib::PetscLibType, A::MatPartitioning, obj::PetscObject, name::String) end + +@for_petsc function MatPartitioningViewFromOptions(petsclib::$UnionPetscLib, A::MatPartitioning, obj::PetscObject, name::String ) + + @chk ccall( + (:MatPartitioningViewFromOptions, $petsc_library), + PetscErrorCode, + (MatPartitioning, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + MatPartitioningView(petsclib::PetscLibType,part::MatPartitioning, viewer::PetscViewer) +Prints the partitioning data structure. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `viewer` - optional visualization context + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `PetscViewer`, `PetscViewerASCIIOpen()` + +# External Links +$(_doc_external("Mat/MatPartitioningView")) +""" +function MatPartitioningView(petsclib::PetscLibType, part::MatPartitioning, viewer::PetscViewer) end + +@for_petsc function MatPartitioningView(petsclib::$UnionPetscLib, part::MatPartitioning, viewer::PetscViewer ) + + @chk ccall( + (:MatPartitioningView, $petsc_library), + PetscErrorCode, + (MatPartitioning, PetscViewer), + part, viewer, + ) + + + return nothing +end + +""" + MatPartitioningSetType(petsclib::PetscLibType,part::MatPartitioning, type::MatPartitioningType) +Sets the type of partitioner to use + +Collective + +Input Parameters: +- `part` - the partitioning context. +- `type` - a known method + +Options Database Key: +- `-mat_partitioning_type ` - (for instance, parmetis), use -help for a list of available methods or see `MatPartitioningType` + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningCreate()`, `MatPartitioningApply()`, `MatPartitioningType` + +# External Links +$(_doc_external("Mat/MatPartitioningSetType")) +""" +function MatPartitioningSetType(petsclib::PetscLibType, part::MatPartitioning, type::MatPartitioningType) end + +@for_petsc function MatPartitioningSetType(petsclib::$UnionPetscLib, part::MatPartitioning, type::MatPartitioningType ) + + @chk ccall( + (:MatPartitioningSetType, $petsc_library), + PetscErrorCode, + (MatPartitioning, MatPartitioningType), + part, type, + ) + + + return nothing +end + +""" + MatPartitioningSetFromOptions(petsclib::PetscLibType,part::MatPartitioning) +Sets various partitioning options from the +options database for the partitioning object + +Collective + +Input Parameter: +- `part` - the partitioning context. + +Options Database Keys: +- `-mat_partitioning_type ` - (for instance, parmetis), use -help for a list of available methods +- `-mat_partitioning_nparts` - number of subgraphs + +Level: beginner + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning` + +# External Links +$(_doc_external("Mat/MatPartitioningSetFromOptions")) +""" +function MatPartitioningSetFromOptions(petsclib::PetscLibType, part::MatPartitioning) end + +@for_petsc function MatPartitioningSetFromOptions(petsclib::$UnionPetscLib, part::MatPartitioning ) + + @chk ccall( + (:MatPartitioningSetFromOptions, $petsc_library), + PetscErrorCode, + (MatPartitioning,), + part, + ) + + + return nothing +end + +""" + MatPartitioningSetNumberVertexWeights(petsclib::PetscLibType,partitioning::MatPartitioning, ncon::PetscInt) +Sets the number of weights per vertex + +Not Collective + +Input Parameters: +- `partitioning` - the partitioning context +- `ncon` - the number of weights + +Level: intermediate + +-seealso: [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningSetVertexWeights()` + +# External Links +$(_doc_external("Mat/MatPartitioningSetNumberVertexWeights")) +""" +function MatPartitioningSetNumberVertexWeights(petsclib::PetscLibType, partitioning::MatPartitioning, ncon::PetscInt) end + +@for_petsc function MatPartitioningSetNumberVertexWeights(petsclib::$UnionPetscLib, partitioning::MatPartitioning, ncon::$PetscInt ) + + @chk ccall( + (:MatPartitioningSetNumberVertexWeights, $petsc_library), + PetscErrorCode, + (MatPartitioning, $PetscInt), + partitioning, ncon, + ) + + + return nothing +end + +""" + MatPartitioningHierarchicalGetFineparts(petsclib::PetscLibType,part::MatPartitioning, fineparts::IS) + +# External Links +$(_doc_external("Mat/MatPartitioningHierarchicalGetFineparts")) +""" +function MatPartitioningHierarchicalGetFineparts(petsclib::PetscLibType, part::MatPartitioning, fineparts::IS) end + +@for_petsc function MatPartitioningHierarchicalGetFineparts(petsclib::$UnionPetscLib, part::MatPartitioning, fineparts::IS ) + fineparts_ = Ref(fineparts.ptr) + + @chk ccall( + (:MatPartitioningHierarchicalGetFineparts, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{CIS}), + part, fineparts_, + ) + + fineparts.ptr = C_NULL + + return nothing +end + +""" + MatPartitioningHierarchicalGetCoarseparts(petsclib::PetscLibType,part::MatPartitioning, coarseparts::IS) + +# External Links +$(_doc_external("Mat/MatPartitioningHierarchicalGetCoarseparts")) +""" +function MatPartitioningHierarchicalGetCoarseparts(petsclib::PetscLibType, part::MatPartitioning, coarseparts::IS) end + +@for_petsc function MatPartitioningHierarchicalGetCoarseparts(petsclib::$UnionPetscLib, part::MatPartitioning, coarseparts::IS ) + coarseparts_ = Ref(coarseparts.ptr) + + @chk ccall( + (:MatPartitioningHierarchicalGetCoarseparts, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{CIS}), + part, coarseparts_, + ) + + coarseparts.ptr = C_NULL + + return nothing +end + +""" + MatPartitioningHierarchicalSetNcoarseparts(petsclib::PetscLibType,part::MatPartitioning, ncoarseparts::PetscInt) + +# External Links +$(_doc_external("Mat/MatPartitioningHierarchicalSetNcoarseparts")) +""" +function MatPartitioningHierarchicalSetNcoarseparts(petsclib::PetscLibType, part::MatPartitioning, ncoarseparts::PetscInt) end + +@for_petsc function MatPartitioningHierarchicalSetNcoarseparts(petsclib::$UnionPetscLib, part::MatPartitioning, ncoarseparts::$PetscInt ) + + @chk ccall( + (:MatPartitioningHierarchicalSetNcoarseparts, $petsc_library), + PetscErrorCode, + (MatPartitioning, $PetscInt), + part, ncoarseparts, + ) + + + return nothing +end + +""" + MatPartitioningHierarchicalSetNfineparts(petsclib::PetscLibType,part::MatPartitioning, nfineparts::PetscInt) + +# External Links +$(_doc_external("Mat/MatPartitioningHierarchicalSetNfineparts")) +""" +function MatPartitioningHierarchicalSetNfineparts(petsclib::PetscLibType, part::MatPartitioning, nfineparts::PetscInt) end + +@for_petsc function MatPartitioningHierarchicalSetNfineparts(petsclib::$UnionPetscLib, part::MatPartitioning, nfineparts::$PetscInt ) + + @chk ccall( + (:MatPartitioningHierarchicalSetNfineparts, $petsc_library), + PetscErrorCode, + (MatPartitioning, $PetscInt), + part, nfineparts, + ) + + + return nothing +end + +""" + MatPartitioningPartySetGlobal(petsclib::PetscLibType,part::MatPartitioning, glob::String) +Set global method for Party partitioner. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `global` - a string representing the method + +Options Database Key: +- `-mat_partitioning_party_global ` - the global method + +Level: advanced + +-seealso: `MATPARTITIONINGPARTY`, `MatPartitioningPartySetLocal()` + +# External Links +$(_doc_external("Mat/MatPartitioningPartySetGlobal")) +""" +function MatPartitioningPartySetGlobal(petsclib::PetscLibType, part::MatPartitioning, glob::String) end + +@for_petsc function MatPartitioningPartySetGlobal(petsclib::$UnionPetscLib, part::MatPartitioning, glob::String ) + + @chk ccall( + (:MatPartitioningPartySetGlobal, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{Cchar}), + part, glob, + ) + + + return nothing +end + +""" + MatPartitioningPartySetLocal(petsclib::PetscLibType,part::MatPartitioning, loc::String) +Set local method used by the Party partitioner. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `local` - a string representing the method + +Options Database Key: +- `-mat_partitioning_party_local ` - the local method + +Level: advanced + +-seealso: `MATPARTITIONINGPARTY`, `MatPartitioningPartySetGlobal()` + +# External Links +$(_doc_external("Mat/MatPartitioningPartySetLocal")) +""" +function MatPartitioningPartySetLocal(petsclib::PetscLibType, part::MatPartitioning, loc::String) end + +@for_petsc function MatPartitioningPartySetLocal(petsclib::$UnionPetscLib, part::MatPartitioning, loc::String ) + + @chk ccall( + (:MatPartitioningPartySetLocal, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{Cchar}), + part, loc, + ) + + + return nothing +end + +""" + MatPartitioningPartySetCoarseLevel(petsclib::PetscLibType,part::MatPartitioning, level::PetscReal) +Set the coarse level parameter for the +Party partitioner. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `level` - the coarse level in range [0.0,1.0] + +Options Database Key: +- `-mat_partitioning_party_coarse ` - Coarse level + +Level: advanced + +-seealso: `MATPARTITIONINGPARTY` + +# External Links +$(_doc_external("Mat/MatPartitioningPartySetCoarseLevel")) +""" +function MatPartitioningPartySetCoarseLevel(petsclib::PetscLibType, part::MatPartitioning, level::PetscReal) end + +@for_petsc function MatPartitioningPartySetCoarseLevel(petsclib::$UnionPetscLib, part::MatPartitioning, level::$PetscReal ) + + @chk ccall( + (:MatPartitioningPartySetCoarseLevel, $petsc_library), + PetscErrorCode, + (MatPartitioning, $PetscReal), + part, level, + ) + + + return nothing +end + +""" + MatPartitioningPartySetMatchOptimization(petsclib::PetscLibType,part::MatPartitioning, opt::PetscBool) +Activate matching optimization for +graph reduction. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `opt` - boolean flag + +Options Database Key: +- `-mat_partitioning_party_match_optimization` - Matching optimization on/off + +Level: advanced + +-seealso: `MATPARTITIONINGPARTY` + +# External Links +$(_doc_external("Mat/MatPartitioningPartySetMatchOptimization")) +""" +function MatPartitioningPartySetMatchOptimization(petsclib::PetscLibType, part::MatPartitioning, opt::PetscBool) end + +@for_petsc function MatPartitioningPartySetMatchOptimization(petsclib::$UnionPetscLib, part::MatPartitioning, opt::PetscBool ) + + @chk ccall( + (:MatPartitioningPartySetMatchOptimization, $petsc_library), + PetscErrorCode, + (MatPartitioning, PetscBool), + part, opt, + ) + + + return nothing +end + +""" + MatPartitioningPartySetBipart(petsclib::PetscLibType,part::MatPartitioning, bp::PetscBool) +Activate or deactivate recursive bisection in the Party partitioner + +Collective + +Input Parameters: +- `part` - the partitioning context +- `bp` - boolean flag + +Options Database Key: +- `-mat_partitioning_party_bipart` - Bipartitioning option on/off + +Level: advanced + +-seealso: `MATPARTITIONINGPARTY` + +# External Links +$(_doc_external("Mat/MatPartitioningPartySetBipart")) +""" +function MatPartitioningPartySetBipart(petsclib::PetscLibType, part::MatPartitioning, bp::PetscBool) end + +@for_petsc function MatPartitioningPartySetBipart(petsclib::$UnionPetscLib, part::MatPartitioning, bp::PetscBool ) + + @chk ccall( + (:MatPartitioningPartySetBipart, $petsc_library), + PetscErrorCode, + (MatPartitioning, PetscBool), + part, bp, + ) + + + return nothing +end + +""" + MatPartitioningParmetisSetCoarseSequential(petsclib::PetscLibType,part::MatPartitioning) +Use the sequential code to +do the partitioning of the coarse grid. + +Logically Collective + +Input Parameter: +- `part` - the partitioning context + +Level: advanced + +-seealso: `MATPARTITIONINGPARMETIS` + +# External Links +$(_doc_external("Mat/MatPartitioningParmetisSetCoarseSequential")) +""" +function MatPartitioningParmetisSetCoarseSequential(petsclib::PetscLibType, part::MatPartitioning) end + +@for_petsc function MatPartitioningParmetisSetCoarseSequential(petsclib::$UnionPetscLib, part::MatPartitioning ) + + @chk ccall( + (:MatPartitioningParmetisSetCoarseSequential, $petsc_library), + PetscErrorCode, + (MatPartitioning,), + part, + ) + + + return nothing +end + +""" + MatPartitioningParmetisSetRepartition(petsclib::PetscLibType,part::MatPartitioning) +Repartition +current mesh to rebalance computation. + +Logically Collective + +Input Parameter: +- `part` - the partitioning context + +Level: advanced + +-seealso: `MATPARTITIONINGPARMETIS` + +# External Links +$(_doc_external("Mat/MatPartitioningParmetisSetRepartition")) +""" +function MatPartitioningParmetisSetRepartition(petsclib::PetscLibType, part::MatPartitioning) end + +@for_petsc function MatPartitioningParmetisSetRepartition(petsclib::$UnionPetscLib, part::MatPartitioning ) + + @chk ccall( + (:MatPartitioningParmetisSetRepartition, $petsc_library), + PetscErrorCode, + (MatPartitioning,), + part, + ) + + + return nothing +end + +""" + cut::PetscInt = MatPartitioningParmetisGetEdgeCut(petsclib::PetscLibType,part::MatPartitioning) +Returns the number of edge cuts in the vertex partition. + +Input Parameter: +- `part` - the partitioning context + +Output Parameter: +- `cut` - the edge cut + +Level: advanced + +-seealso: `MATPARTITIONINGPARMETIS` + +# External Links +$(_doc_external("Mat/MatPartitioningParmetisGetEdgeCut")) +""" +function MatPartitioningParmetisGetEdgeCut(petsclib::PetscLibType, part::MatPartitioning) end + +@for_petsc function MatPartitioningParmetisGetEdgeCut(petsclib::$UnionPetscLib, part::MatPartitioning ) + cut_ = Ref{$PetscInt}() + + @chk ccall( + (:MatPartitioningParmetisGetEdgeCut, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{$PetscInt}), + part, cut_, + ) + + cut = cut_[] + + return cut +end + +""" + MatPartitioningPTScotchSetImbalance(petsclib::PetscLibType,part::MatPartitioning, imb::PetscReal) +Sets the value of the load imbalance +ratio to be used during strategy selection. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `imb` - the load imbalance ratio + +Options Database Key: +- `-mat_partitioning_ptscotch_imbalance ` - set load imbalance ratio + +-seealso: `MATPARTITIONINGSCOTCH`, `MatPartitioningPTScotchSetStrategy()`, `MatPartitioningPTScotchGetImbalance()` + +# External Links +$(_doc_external("Mat/MatPartitioningPTScotchSetImbalance")) +""" +function MatPartitioningPTScotchSetImbalance(petsclib::PetscLibType, part::MatPartitioning, imb::PetscReal) end + +@for_petsc function MatPartitioningPTScotchSetImbalance(petsclib::$UnionPetscLib, part::MatPartitioning, imb::$PetscReal ) + + @chk ccall( + (:MatPartitioningPTScotchSetImbalance, $petsc_library), + PetscErrorCode, + (MatPartitioning, $PetscReal), + part, imb, + ) + + + return nothing +end + +""" + imb::PetscReal = MatPartitioningPTScotchGetImbalance(petsclib::PetscLibType,part::MatPartitioning) +Gets the value of the load imbalance +ratio used during strategy selection. + +Not Collective + +Input Parameter: +- `part` - the partitioning context + +Output Parameter: +- `imb` - the load imbalance ratio + +Level: advanced + +-seealso: `MATPARTITIONINGSCOTCH`, `MatPartitioningPTScotchSetImbalance()` + +# External Links +$(_doc_external("Mat/MatPartitioningPTScotchGetImbalance")) +""" +function MatPartitioningPTScotchGetImbalance(petsclib::PetscLibType, part::MatPartitioning) end + +@for_petsc function MatPartitioningPTScotchGetImbalance(petsclib::$UnionPetscLib, part::MatPartitioning ) + imb_ = Ref{$PetscReal}() + + @chk ccall( + (:MatPartitioningPTScotchGetImbalance, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{$PetscReal}), + part, imb_, + ) + + imb = imb_[] + + return imb +end + +""" + MatPartitioningPTScotchSetStrategy(petsclib::PetscLibType,part::MatPartitioning, strategy::MPPTScotchStrategyType) +Sets the strategy to be used in PTScotch. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `strategy` - the strategy, one of +-seealso: `MATPARTITIONINGSCOTCH`, `MatPartitioningPTScotchSetImbalance()`, `MatPartitioningPTScotchGetStrategy()` + +# External Links +$(_doc_external("Mat/MatPartitioningPTScotchSetStrategy")) +""" +function MatPartitioningPTScotchSetStrategy(petsclib::PetscLibType, part::MatPartitioning, strategy::MPPTScotchStrategyType) end + +@for_petsc function MatPartitioningPTScotchSetStrategy(petsclib::$UnionPetscLib, part::MatPartitioning, strategy::MPPTScotchStrategyType ) + + @chk ccall( + (:MatPartitioningPTScotchSetStrategy, $petsc_library), + PetscErrorCode, + (MatPartitioning, MPPTScotchStrategyType), + part, strategy, + ) + + + return nothing +end + +""" + MatPartitioningPTScotchGetStrategy(petsclib::PetscLibType,part::MatPartitioning, strategy::MPPTScotchStrategyType) +Gets the strategy used in PTScotch. + +Not Collective + +Input Parameter: +- `part` - the partitioning context + +Output Parameter: +- `strategy` - the strategy + +Level: advanced + +-seealso: `MATPARTITIONINGSCOTCH`, `MatPartitioningPTScotchSetStrategy()` + +# External Links +$(_doc_external("Mat/MatPartitioningPTScotchGetStrategy")) +""" +function MatPartitioningPTScotchGetStrategy(petsclib::PetscLibType, part::MatPartitioning, strategy::MPPTScotchStrategyType) end + +@for_petsc function MatPartitioningPTScotchGetStrategy(petsclib::$UnionPetscLib, part::MatPartitioning, strategy::MPPTScotchStrategyType ) + + @chk ccall( + (:MatPartitioningPTScotchGetStrategy, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{MPPTScotchStrategyType}), + part, strategy, + ) + + + return nothing +end + +""" + MatPartitioningChacoSetGlobal(petsclib::PetscLibType,part::MatPartitioning, method::MPChacoGlobalType) +Set the global method for Chaco partitioner. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `method` - one of `MP_CHACO_MULTILEVEL`, `MP_CHACO_SPECTRAL`, `MP_CHACO_LINEAR`, +`MP_CHACO_RANDOM` or `MP_CHACO_SCATTERED` + +Options Database Key: +- `-mat_partitioning_chaco_global ` - the global method + +Level: advanced + +-seealso: `MatPartitioning`, `MatPartioningSetType()`, `MatPartitioningType`, `MATPARTITIONINGCHACO`, `MatPartitioningChacoSetLocal()`, `MatPartitioningChacoGetGlobal()` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoSetGlobal")) +""" +function MatPartitioningChacoSetGlobal(petsclib::PetscLibType, part::MatPartitioning, method::MPChacoGlobalType) end + +@for_petsc function MatPartitioningChacoSetGlobal(petsclib::$UnionPetscLib, part::MatPartitioning, method::MPChacoGlobalType ) + + @chk ccall( + (:MatPartitioningChacoSetGlobal, $petsc_library), + PetscErrorCode, + (MatPartitioning, MPChacoGlobalType), + part, method, + ) + + + return nothing +end + +""" + MatPartitioningChacoGetGlobal(petsclib::PetscLibType,part::MatPartitioning, method::MPChacoGlobalType) +Get the global method used by the Chaco partitioner. + +Not Collective + +Input Parameter: +- `part` - the partitioning context + +Output Parameter: +- `method` - the method + +Level: advanced + +-seealso: `MatPartitioningType`, `MATPARTITIONINGCHACO`, `MatPartitioningChacoSetGlobal()` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoGetGlobal")) +""" +function MatPartitioningChacoGetGlobal(petsclib::PetscLibType, part::MatPartitioning, method::MPChacoGlobalType) end + +@for_petsc function MatPartitioningChacoGetGlobal(petsclib::$UnionPetscLib, part::MatPartitioning, method::MPChacoGlobalType ) + + @chk ccall( + (:MatPartitioningChacoGetGlobal, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{MPChacoGlobalType}), + part, method, + ) + + + return nothing +end + +""" + MatPartitioningChacoSetLocal(petsclib::PetscLibType,part::MatPartitioning, method::MPChacoLocalType) +Set the local method for the Chaco partitioner. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `method` - one of `MP_CHACO_KERNIGHAN` or `MP_CHACO_NONE` + +Options Database Key: +- `-mat_partitioning_chaco_local ` - the local method + +Level: advanced + +-seealso: `MatPartitioningType`, `MATPARTITIONINGCHACO`, `MatPartitioningChacoSetGlobal()`, `MatPartitioningChacoGetLocal()` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoSetLocal")) +""" +function MatPartitioningChacoSetLocal(petsclib::PetscLibType, part::MatPartitioning, method::MPChacoLocalType) end + +@for_petsc function MatPartitioningChacoSetLocal(petsclib::$UnionPetscLib, part::MatPartitioning, method::MPChacoLocalType ) + + @chk ccall( + (:MatPartitioningChacoSetLocal, $petsc_library), + PetscErrorCode, + (MatPartitioning, MPChacoLocalType), + part, method, + ) + + + return nothing +end + +""" + MatPartitioningChacoGetLocal(petsclib::PetscLibType,part::MatPartitioning, method::MPChacoLocalType) +Get local method used by the Chaco partitioner. + +Not Collective + +Input Parameter: +- `part` - the partitioning context + +Output Parameter: +- `method` - the method + +Level: advanced + +-seealso: `MatPartitioningType`, `MATPARTITIONINGCHACO`, `MatPartitioningChacoSetLocal()` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoGetLocal")) +""" +function MatPartitioningChacoGetLocal(petsclib::PetscLibType, part::MatPartitioning, method::MPChacoLocalType) end + +@for_petsc function MatPartitioningChacoGetLocal(petsclib::$UnionPetscLib, part::MatPartitioning, method::MPChacoLocalType ) + + @chk ccall( + (:MatPartitioningChacoGetLocal, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{MPChacoLocalType}), + part, method, + ) + + + return nothing +end + +""" + MatPartitioningChacoSetCoarseLevel(petsclib::PetscLibType,part::MatPartitioning, level::PetscReal) +Set the coarse level parameter for the +Chaco partitioner. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `level` - the coarse level in range [0.0,1.0] + +Options Database Key: +- `-mat_partitioning_chaco_coarse ` - Coarse level + +Level: advanced + +-seealso: `MatPartitioningType`, `MatPartitioning`, `MATPARTITIONINGCHACO` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoSetCoarseLevel")) +""" +function MatPartitioningChacoSetCoarseLevel(petsclib::PetscLibType, part::MatPartitioning, level::PetscReal) end + +@for_petsc function MatPartitioningChacoSetCoarseLevel(petsclib::$UnionPetscLib, part::MatPartitioning, level::$PetscReal ) + + @chk ccall( + (:MatPartitioningChacoSetCoarseLevel, $petsc_library), + PetscErrorCode, + (MatPartitioning, $PetscReal), + part, level, + ) + + + return nothing +end + +""" + MatPartitioningChacoSetEigenSolver(petsclib::PetscLibType,part::MatPartitioning, method::MPChacoEigenType) +Set the eigensolver method for Chaco partitioner. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `method` - one of `MP_CHACO_LANCZOS` or `MP_CHACO_RQI` + +Options Database Key: +- `-mat_partitioning_chaco_eigen_solver ` - the eigensolver + +Level: advanced + +-seealso: `MatPartitioningType`, `MatPartitioning`, `MATPARTITIONINGCHACO`, `MatPartitioningChacoSetEigenTol()`, `MatPartitioningChacoSetEigenNumber()`, +`MatPartitioningChacoGetEigenSolver()` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoSetEigenSolver")) +""" +function MatPartitioningChacoSetEigenSolver(petsclib::PetscLibType, part::MatPartitioning, method::MPChacoEigenType) end + +@for_petsc function MatPartitioningChacoSetEigenSolver(petsclib::$UnionPetscLib, part::MatPartitioning, method::MPChacoEigenType ) + + @chk ccall( + (:MatPartitioningChacoSetEigenSolver, $petsc_library), + PetscErrorCode, + (MatPartitioning, MPChacoEigenType), + part, method, + ) + + + return nothing +end + +""" + MatPartitioningChacoGetEigenSolver(petsclib::PetscLibType,part::MatPartitioning, method::MPChacoEigenType) +Get the eigensolver used by the Chaco partitioner. + +Not Collective + +Input Parameter: +- `part` - the partitioning context + +Output Parameter: +- `method` - the method + +Level: advanced + +-seealso: `MatPartitioningType`, `MatPartitioning`, `MATPARTITIONINGCHACO`, `MatPartitioningChacoSetEigenSolver()` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoGetEigenSolver")) +""" +function MatPartitioningChacoGetEigenSolver(petsclib::PetscLibType, part::MatPartitioning, method::MPChacoEigenType) end + +@for_petsc function MatPartitioningChacoGetEigenSolver(petsclib::$UnionPetscLib, part::MatPartitioning, method::MPChacoEigenType ) + + @chk ccall( + (:MatPartitioningChacoGetEigenSolver, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{MPChacoEigenType}), + part, method, + ) + + + return nothing +end + +""" + MatPartitioningChacoSetEigenTol(petsclib::PetscLibType,part::MatPartitioning, tol::PetscReal) +Sets the tolerance for the eigensolver used by Chaco + +Collective + +Input Parameters: +- `part` - the partitioning context +- `tol` - the tolerance + +Options Database Key: +- `-mat_partitioning_chaco_eigen_tol ` - Tolerance for eigensolver + +-seealso: `MatPartitioningType`, `MatPartitioning`, `MATPARTITIONINGCHACO`, `MatPartitioningChacoSetEigenSolver()`, `MatPartitioningChacoGetEigenTol()` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoSetEigenTol")) +""" +function MatPartitioningChacoSetEigenTol(petsclib::PetscLibType, part::MatPartitioning, tol::PetscReal) end + +@for_petsc function MatPartitioningChacoSetEigenTol(petsclib::$UnionPetscLib, part::MatPartitioning, tol::$PetscReal ) + + @chk ccall( + (:MatPartitioningChacoSetEigenTol, $petsc_library), + PetscErrorCode, + (MatPartitioning, $PetscReal), + part, tol, + ) + + + return nothing +end + +""" + tol::PetscReal = MatPartitioningChacoGetEigenTol(petsclib::PetscLibType,part::MatPartitioning) +Gets the eigensolver tolerance used by Chaco + +Not Collective + +Input Parameter: +- `part` - the partitioning context + +Output Parameter: +- `tol` - the tolerance + +Level: advanced + +-seealso: `MatPartitioningType`, `MatPartitioning`, `MATPARTITIONINGCHACO`, `MatPartitioningChacoSetEigenTol()` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoGetEigenTol")) +""" +function MatPartitioningChacoGetEigenTol(petsclib::PetscLibType, part::MatPartitioning) end + +@for_petsc function MatPartitioningChacoGetEigenTol(petsclib::$UnionPetscLib, part::MatPartitioning ) + tol_ = Ref{$PetscReal}() + + @chk ccall( + (:MatPartitioningChacoGetEigenTol, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{$PetscReal}), + part, tol_, + ) + + tol = tol_[] + + return tol +end + +""" + MatPartitioningChacoSetEigenNumber(petsclib::PetscLibType,part::MatPartitioning, num::PetscInt) +Sets the number of eigenvectors to compute by Chaco during partitioning +during partitioning. + +Collective + +Input Parameters: +- `part` - the partitioning context +- `num` - the number of eigenvectors + +Options Database Key: +- `-mat_partitioning_chaco_eigen_number ` - Number of eigenvectors + +-seealso: `MatPartitioningType`, `MatPartitioning`, `MATPARTITIONINGCHACO`, `MatPartitioningChacoSetEigenSolver()`, `MatPartitioningChacoGetEigenTol()` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoSetEigenNumber")) +""" +function MatPartitioningChacoSetEigenNumber(petsclib::PetscLibType, part::MatPartitioning, num::PetscInt) end + +@for_petsc function MatPartitioningChacoSetEigenNumber(petsclib::$UnionPetscLib, part::MatPartitioning, num::$PetscInt ) + + @chk ccall( + (:MatPartitioningChacoSetEigenNumber, $petsc_library), + PetscErrorCode, + (MatPartitioning, $PetscInt), + part, num, + ) + + + return nothing +end + +""" + num::PetscInt = MatPartitioningChacoGetEigenNumber(petsclib::PetscLibType,part::MatPartitioning) +Gets the number of eigenvectors used by Chaco. + +Not Collective + +Input Parameter: +- `part` - the partitioning context + +Output Parameter: +- `num` - number of eigenvectors + +Level: advanced + +-seealso: `MatPartitioningType`, `MatPartitioning`, `MATPARTITIONINGCHACO`, `MatPartitioningChacoSetEigenNumber()` + +# External Links +$(_doc_external("Mat/MatPartitioningChacoGetEigenNumber")) +""" +function MatPartitioningChacoGetEigenNumber(petsclib::PetscLibType, part::MatPartitioning) end + +@for_petsc function MatPartitioningChacoGetEigenNumber(petsclib::$UnionPetscLib, part::MatPartitioning ) + num_ = Ref{$PetscInt}() + + @chk ccall( + (:MatPartitioningChacoGetEigenNumber, $petsc_library), + PetscErrorCode, + (MatPartitioning, Ptr{$PetscInt}), + part, num_, + ) + + num = num_[] + + return num +end + +""" + MatNullSpaceSetFunction(petsclib::PetscLibType,sp::MatNullSpace, rem::MatNullSpaceRemoveFn, ctx::Cvoid) +set a function that removes a null space from a vector +out of null spaces. + +Logically Collective + +Input Parameters: +- `sp` - the `MatNullSpace` null space object +- `rem` - the function that removes the null space +- `ctx` - context for the remove function + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatNullSpaceDestroy()`, `MatNullSpaceRemove()`, `MatSetNullSpace()`, `MatNullSpaceCreate()`, `MatNullSpaceRemoveFn` + +# External Links +$(_doc_external("Mat/MatNullSpaceSetFunction")) +""" +function MatNullSpaceSetFunction(petsclib::PetscLibType, sp::MatNullSpace, rem::MatNullSpaceRemoveFn, ctx::Cvoid) end + +@for_petsc function MatNullSpaceSetFunction(petsclib::$UnionPetscLib, sp::MatNullSpace, rem::MatNullSpaceRemoveFn, ctx::Cvoid ) + + @chk ccall( + (:MatNullSpaceSetFunction, $petsc_library), + PetscErrorCode, + (MatNullSpace, Ptr{MatNullSpaceRemoveFn}, Ptr{Cvoid}), + sp, rem, ctx, + ) + + + return nothing +end + +""" + has_const::PetscBool,n::PetscInt = MatNullSpaceGetVecs(petsclib::PetscLibType,sp::MatNullSpace, vecs::Vector{PetscVec}) +get the vectors defining the null space + +Not Collective + +Input Parameter: +- `sp` - null space object + +Output Parameters: +- `has_const` - `PETSC_TRUE` if the null space contains the constant vector, otherwise `PETSC_FALSE` +- `n` - number of vectors (excluding constant vector) in the null space +- `vecs` - returns array of length `n` containing the orthonormal vectors that span the null space (excluding the constant vector), `NULL` if `n` is 0 + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatNullSpaceCreate()`, `MatGetNullSpace()`, `MatGetNearNullSpace()` + +# External Links +$(_doc_external("Mat/MatNullSpaceGetVecs")) +""" +function MatNullSpaceGetVecs(petsclib::PetscLibType, sp::MatNullSpace, vecs::Vector{PetscVec}) end + +@for_petsc function MatNullSpaceGetVecs(petsclib::$UnionPetscLib, sp::MatNullSpace, vecs::Vector{PetscVec} ) + has_const_ = Ref{PetscBool}() + n_ = Ref{$PetscInt}() + vecs_ = Ref(pointer(vecs)) + + @chk ccall( + (:MatNullSpaceGetVecs, $petsc_library), + PetscErrorCode, + (MatNullSpace, Ptr{PetscBool}, Ptr{$PetscInt}, Ptr{Ptr{CVec}}), + sp, has_const_, n_, vecs_, + ) + + has_const = has_const_[] + n = n_[] + + return has_const,n +end + +""" + sp::MatNullSpace = MatNullSpaceCreateRigidBody(petsclib::PetscLibType,coords::PetscVec) +create rigid body modes from coordinates + +Collective + +Input Parameter: +- `coords` - block of coordinates of each node, must have block size set + +Output Parameter: +- `sp` - the null space + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatNullSpaceCreate()`, `MatSetNearNullSpace()`, `MatSetNullSpace()`, `PCGAMG` + +# External Links +$(_doc_external("Mat/MatNullSpaceCreateRigidBody")) +""" +function MatNullSpaceCreateRigidBody(petsclib::PetscLibType, coords::PetscVec) end + +@for_petsc function MatNullSpaceCreateRigidBody(petsclib::$UnionPetscLib, coords::PetscVec ) + sp_ = Ref{MatNullSpace}() + + @chk ccall( + (:MatNullSpaceCreateRigidBody, $petsc_library), + PetscErrorCode, + (CVec, Ptr{MatNullSpace}), + coords, sp_, + ) + + sp = sp_[] + + return sp +end + +""" + MatNullSpaceView(petsclib::PetscLibType,sp::MatNullSpace, viewer::PetscViewer) +Visualizes a null space object. + +Collective + +Input Parameters: +- `sp` - the null space +- `viewer` - visualization context + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `PetscViewer`, `MatNullSpaceCreate()`, `PetscViewerASCIIOpen()` + +# External Links +$(_doc_external("Mat/MatNullSpaceView")) +""" +function MatNullSpaceView(petsclib::PetscLibType, sp::MatNullSpace, viewer::PetscViewer) end + +@for_petsc function MatNullSpaceView(petsclib::$UnionPetscLib, sp::MatNullSpace, viewer::PetscViewer ) + + @chk ccall( + (:MatNullSpaceView, $petsc_library), + PetscErrorCode, + (MatNullSpace, PetscViewer), + sp, viewer, + ) + + + return nothing +end + +""" + SP::MatNullSpace = MatNullSpaceCreate(petsclib::PetscLibType,comm::MPI_Comm, has_cnst::PetscBool, n::PetscInt, vecs::Vector{PetscVec}) +Creates a `MatNullSpace` data structure used to project vectors out of null spaces. + +Collective + +Input Parameters: +- `comm` - the MPI communicator associated with the object +- `has_cnst` - `PETSC_TRUE` if the null space contains the constant vector; otherwise `PETSC_FALSE` +- `n` - number of vectors (excluding constant vector) in null space +- `vecs` - the vectors that span the null space (excluding the constant vector); +these vectors must be orthonormal. These vectors are NOT copied, so do not change them +after this call. You should free the array that you pass in and destroy the vectors (this will reduce the reference count +for them by one). + +Output Parameter: +- `SP` - the null space context + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatNullSpaceDestroy()`, `MatNullSpaceRemove()`, `MatSetNullSpace()`, `MatNullSpaceSetFunction()` + +# External Links +$(_doc_external("Mat/MatNullSpaceCreate")) +""" +function MatNullSpaceCreate(petsclib::PetscLibType, comm::MPI_Comm, has_cnst::PetscBool, n::PetscInt, vecs::Vector{PetscVec}) end + +@for_petsc function MatNullSpaceCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, has_cnst::PetscBool, n::$PetscInt, vecs::Vector{PetscVec} ) + SP_ = Ref{MatNullSpace}() + + @chk ccall( + (:MatNullSpaceCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscBool, $PetscInt, Ptr{CVec}, Ptr{MatNullSpace}), + comm, has_cnst, n, vecs, SP_, + ) + + SP = SP_[] + + return SP +end + +""" + MatNullSpaceDestroy(petsclib::PetscLibType,sp::MatNullSpace) +Destroys a data structure used to project vectors out of null spaces. + +Collective + +Input Parameter: +- `sp` - the null space context to be destroyed + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatNullSpaceCreate()`, `MatNullSpaceRemove()`, `MatNullSpaceSetFunction()` + +# External Links +$(_doc_external("Mat/MatNullSpaceDestroy")) +""" +function MatNullSpaceDestroy(petsclib::PetscLibType, sp::MatNullSpace) end + +@for_petsc function MatNullSpaceDestroy(petsclib::$UnionPetscLib, sp::MatNullSpace ) + + @chk ccall( + (:MatNullSpaceDestroy, $petsc_library), + PetscErrorCode, + (Ptr{MatNullSpace},), + sp, + ) + + + return nothing +end + +""" + MatNullSpaceRemove(petsclib::PetscLibType,sp::MatNullSpace, vec::PetscVec) +Removes all the components of a null space from a vector. + +Collective + +Input Parameters: +- `sp` - the null space context (if this is `NULL` then no null space is removed) +- `vec` - the vector from which the null space is to be removed + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatNullSpaceCreate()`, `MatNullSpaceDestroy()`, `MatNullSpaceSetFunction()` + +# External Links +$(_doc_external("Mat/MatNullSpaceRemove")) +""" +function MatNullSpaceRemove(petsclib::PetscLibType, sp::MatNullSpace, vec::PetscVec) end + +@for_petsc function MatNullSpaceRemove(petsclib::$UnionPetscLib, sp::MatNullSpace, vec::PetscVec ) + + @chk ccall( + (:MatNullSpaceRemove, $petsc_library), + PetscErrorCode, + (MatNullSpace, CVec), + sp, vec, + ) + + + return nothing +end + +""" + isNull::PetscBool = MatNullSpaceTest(petsclib::PetscLibType,sp::MatNullSpace, mat::PetscMat) +Tests if the claimed null space is really a null space of a matrix + +Collective + +Input Parameters: +- `sp` - the null space context +- `mat` - the matrix + +Output Parameter: +- `isNull` - `PETSC_TRUE` if the nullspace is valid for this matrix + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MatNullSpace`, `MatNullSpaceCreate()`, `MatNullSpaceDestroy()`, `MatNullSpaceSetFunction()` + +# External Links +$(_doc_external("Mat/MatNullSpaceTest")) +""" +function MatNullSpaceTest(petsclib::PetscLibType, sp::MatNullSpace, mat::PetscMat) end + +@for_petsc function MatNullSpaceTest(petsclib::$UnionPetscLib, sp::MatNullSpace, mat::PetscMat ) + isNull_ = Ref{PetscBool}() + + @chk ccall( + (:MatNullSpaceTest, $petsc_library), + PetscErrorCode, + (MatNullSpace, CMat, Ptr{PetscBool}), + sp, mat, isNull_, + ) + + isNull = isNull_[] + + return isNull +end + +""" + MatMFFDWPSetComputeNormU(petsclib::PetscLibType,A::PetscMat, flag::PetscBool) +Sets whether it computes the ||U|| used by the Walker +PETSc routine for computing h. With any Krylov solver this need only +be computed during the first iteration and kept for later. + +Input Parameters: +- `A` - the `MATMFFD` matrix +- `flag` - `PETSC_TRUE` causes it to compute ||U||, `PETSC_FALSE` uses the previous value + +Options Database Key: +- `-mat_mffd_compute_normu ` - true by default, false can save calculations but you +must be sure that ||U|| has not changed in the mean time. + +Level: advanced + +-seealso: `MATMFFD_WP`, `MATMFFD`, `MatMFFDSetFunctionError()`, `MatCreateSNESMF()` + +# External Links +$(_doc_external("Mat/MatMFFDWPSetComputeNormU")) +""" +function MatMFFDWPSetComputeNormU(petsclib::PetscLibType, A::PetscMat, flag::PetscBool) end + +@for_petsc function MatMFFDWPSetComputeNormU(petsclib::$UnionPetscLib, A::PetscMat, flag::PetscBool ) + + @chk ccall( + (:MatMFFDWPSetComputeNormU, $petsc_library), + PetscErrorCode, + (CMat, PetscBool), + A, flag, + ) + + + return nothing +end + +""" + MatMFFDFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the MATMFFD` package. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `PetscFinalize()`, `MatCreateMFFD()`, `MatCreateSNESMF()` + +# External Links +$(_doc_external("Mat/MatMFFDFinalizePackage")) +""" +function MatMFFDFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function MatMFFDFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:MatMFFDFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + MatMFFDInitializePackage(petsclib::PetscLibType) +This function initializes everything in the MATMFFD` package. It is called +from `MatInitializePackage()`. + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `PetscInitialize()` + +# External Links +$(_doc_external("Mat/MatMFFDInitializePackage")) +""" +function MatMFFDInitializePackage(petsclib::PetscLibType) end + +@for_petsc function MatMFFDInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:MatMFFDInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + MatMFFDSetType(petsclib::PetscLibType,mat::PetscMat, ftype::MatMFFDType) +Sets the method that is used to compute the +differencing parameter for finite difference matrix-free formulations. + +Input Parameters: +- `mat` - the "matrix-free" matrix created via `MatCreateSNESMF()`, or `MatCreateMFFD()` +or `MatSetType`(mat,`MATMFFD`); +- `ftype` - the type requested, either `MATMFFD_WP` or `MATMFFD_DS` + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MATMFFD_WP`, `MATMFFD_DS`, `MatCreateSNESMF()`, `MatMFFDRegister()`, `MatMFFDSetFunction()`, `MatCreateMFFD()` + +# External Links +$(_doc_external("Mat/MatMFFDSetType")) +""" +function MatMFFDSetType(petsclib::PetscLibType, mat::PetscMat, ftype::MatMFFDType) end + +@for_petsc function MatMFFDSetType(petsclib::$UnionPetscLib, mat::PetscMat, ftype::MatMFFDType ) + + @chk ccall( + (:MatMFFDSetType, $petsc_library), + PetscErrorCode, + (CMat, MatMFFDType), + mat, ftype, + ) + + + return nothing +end + +""" + MatMFFDRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a method to the `MATMFFD` registry. + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined compute-h module +- `function` - routine to create method context + +Level: developer + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatMFFDRegisterAll()`, `MatMFFDRegisterDestroy()` + +# External Links +$(_doc_external("Mat/MatMFFDRegister")) +""" +function MatMFFDRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function MatMFFDRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:MatMFFDRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + MatMFFDSetOptionsPrefix(petsclib::PetscLibType,mat::PetscMat, prefix::String) +Sets the prefix used for searching for all +MATMFFD` options in the database. + +Collective + +Input Parameters: +- `mat` - the `MATMFFD` context +- `prefix` - the prefix to prepend to all option names + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatSetFromOptions()`, `MatCreateSNESMF()`, `MatCreateMFFD()` + +# External Links +$(_doc_external("Mat/MatMFFDSetOptionsPrefix")) +""" +function MatMFFDSetOptionsPrefix(petsclib::PetscLibType, mat::PetscMat, prefix::String) end + +@for_petsc function MatMFFDSetOptionsPrefix(petsclib::$UnionPetscLib, mat::PetscMat, prefix::String ) + + @chk ccall( + (:MatMFFDSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (CMat, Ptr{Cchar}), + mat, prefix, + ) + + + return nothing +end + +""" + h::PetscScalar = MatMFFDGetH(petsclib::PetscLibType,mat::PetscMat) +Gets the last value that was used as the differencing for a `MATMFFD` matrix +parameter. + +Not Collective + +Input Parameters: +- `mat` - the `MATMFFD` matrix + +Output Parameter: +- `h` - the differencing step size + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatCreateSNESMF()`, `MatMFFDSetHHistory()`, `MatCreateMFFD()`, `MatMFFDResetHHistory()` + +# External Links +$(_doc_external("Mat/MatMFFDGetH")) +""" +function MatMFFDGetH(petsclib::PetscLibType, mat::PetscMat) end + +@for_petsc function MatMFFDGetH(petsclib::$UnionPetscLib, mat::PetscMat ) + h_ = Ref{$PetscScalar}() + + @chk ccall( + (:MatMFFDGetH, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}), + mat, h_, + ) + + h = h_[] + + return h +end + +""" + MatMFFDSetFunction(petsclib::PetscLibType,mat::PetscMat, func::MatMFFDFn, funcctx::Cvoid) +Sets the function used in applying the matrix + +Logically Collective + +Input Parameters: +- `mat` - the matrix-free matrix `MATMFFD` created via `MatCreateSNESMF()` or `MatCreateMFFD()` +- `func` - the function to use +- `funcctx` - optional function context passed to function + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatMFFDFn`, `MatCreateSNESMF()`, `MatMFFDGetH()`, `MatCreateMFFD()`, +`MatMFFDSetHHistory()`, `MatMFFDResetHHistory()`, `SNESSetFunction()` + +# External Links +$(_doc_external("Mat/MatMFFDSetFunction")) +""" +function MatMFFDSetFunction(petsclib::PetscLibType, mat::PetscMat, func::MatMFFDFn, funcctx::Cvoid) end + +@for_petsc function MatMFFDSetFunction(petsclib::$UnionPetscLib, mat::PetscMat, func::MatMFFDFn, funcctx::Cvoid ) + + @chk ccall( + (:MatMFFDSetFunction, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatMFFDFn}, Ptr{Cvoid}), + mat, func, funcctx, + ) + + + return nothing +end + +""" + MatMFFDSetFunctioni(petsclib::PetscLibType,mat::PetscMat, funci::MatMFFDiFn) +Sets the function for computing a single component for a `MATMFFD` matrix + +Logically Collective + +Input Parameters: +- `mat` - the matrix-free matrix `MATMFFD` +- `funci` - the function to use + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatMFFDiFn`, `MatCreateSNESMF()`, `MatMFFDGetH()`, `MatMFFDSetHHistory()`, `MatMFFDResetHHistory()`, +`SNESSetFunction()`, `MatGetDiagonal()` + +# External Links +$(_doc_external("Mat/MatMFFDSetFunctioni")) +""" +function MatMFFDSetFunctioni(petsclib::PetscLibType, mat::PetscMat, funci::MatMFFDiFn) end + +@for_petsc function MatMFFDSetFunctioni(petsclib::$UnionPetscLib, mat::PetscMat, funci::MatMFFDiFn ) + + @chk ccall( + (:MatMFFDSetFunctioni, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatMFFDiFn}), + mat, funci, + ) + + + return nothing +end + +""" + MatMFFDSetFunctioniBase(petsclib::PetscLibType,mat::PetscMat, func::MatMFFDiBaseFn) +Sets the function to compute the base vector for a single component function evaluation for a `MATMFFD` matrix + +Logically Collective + +Input Parameters: +- `mat` - the `MATMFFD` matrix-free matrix +- `func` - the function to use + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatCreateSNESMF()`, `MatMFFDGetH()`, `MatCreateMFFD()`, +`MatMFFDSetHHistory()`, `MatMFFDResetHHistory()`, `SNESSetFunction()`, `MatGetDiagonal()` + +# External Links +$(_doc_external("Mat/MatMFFDSetFunctioniBase")) +""" +function MatMFFDSetFunctioniBase(petsclib::PetscLibType, mat::PetscMat, func::MatMFFDiBaseFn) end + +@for_petsc function MatMFFDSetFunctioniBase(petsclib::$UnionPetscLib, mat::PetscMat, func::MatMFFDiBaseFn ) + + @chk ccall( + (:MatMFFDSetFunctioniBase, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatMFFDiBaseFn}), + mat, func, + ) + + + return nothing +end + +""" + MatMFFDSetPeriod(petsclib::PetscLibType,mat::PetscMat, period::PetscInt) +Sets how often the step + +Logically Collective + +Input Parameters: +- `mat` - the `MATMFFD` matrix-free matrix +- `period` - 1 for every time, 2 for every second etc + +Options Database Key: +- `-mat_mffd_period ` - Sets how often `h` is recomputed + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatCreateSNESMF()`, `MatMFFDGetH()`, +`MatMFFDSetHHistory()`, `MatMFFDResetHHistory()` + +# External Links +$(_doc_external("Mat/MatMFFDSetPeriod")) +""" +function MatMFFDSetPeriod(petsclib::PetscLibType, mat::PetscMat, period::PetscInt) end + +@for_petsc function MatMFFDSetPeriod(petsclib::$UnionPetscLib, mat::PetscMat, period::$PetscInt ) + + @chk ccall( + (:MatMFFDSetPeriod, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt), + mat, period, + ) + + + return nothing +end + +""" + MatMFFDSetFunctionError(petsclib::PetscLibType,mat::PetscMat, error::PetscReal) +Sets the error_rel for the approximation of matrix + +Logically Collective + +Input Parameters: +- `mat` - the `MATMFFD` matrix-free matrix +- `error` - relative error (should be set to the square root of the relative error in the function evaluations) + +Options Database Key: +- `-mat_mffd_err ` - Sets error_rel + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatCreateSNESMF()`, `MatMFFDGetH()`, `MatCreateMFFD()`, +`MatMFFDSetHHistory()`, `MatMFFDResetHHistory()` + +# External Links +$(_doc_external("Mat/MatMFFDSetFunctionError")) +""" +function MatMFFDSetFunctionError(petsclib::PetscLibType, mat::PetscMat, error::PetscReal) end + +@for_petsc function MatMFFDSetFunctionError(petsclib::$UnionPetscLib, mat::PetscMat, error::$PetscReal ) + + @chk ccall( + (:MatMFFDSetFunctionError, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal), + mat, error, + ) + + + return nothing +end + +""" + MatMFFDSetHHistory(petsclib::PetscLibType,J::PetscMat, history::Vector{PetscScalar}, nhistory::PetscInt) +Sets an array to collect a history of the +differencing values (h) computed for the matrix-free product `MATMFFD` matrix + +Logically Collective + +Input Parameters: +- `J` - the `MATMFFD` matrix-free matrix +- `history` - space to hold the history +- `nhistory` - number of entries in history, if more entries are generated than +nhistory, then the later ones are discarded + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatMFFDGetH()`, `MatCreateSNESMF()`, +`MatMFFDResetHHistory()`, `MatMFFDSetFunctionError()` + +# External Links +$(_doc_external("Mat/MatMFFDSetHHistory")) +""" +function MatMFFDSetHHistory(petsclib::PetscLibType, J::PetscMat, history::Vector{PetscScalar}, nhistory::PetscInt) end + +@for_petsc function MatMFFDSetHHistory(petsclib::$UnionPetscLib, J::PetscMat, history::Vector{$PetscScalar}, nhistory::$PetscInt ) + + @chk ccall( + (:MatMFFDSetHHistory, $petsc_library), + PetscErrorCode, + (CMat, Ptr{$PetscScalar}, $PetscInt), + J, history, nhistory, + ) + + + return nothing +end + +""" + MatMFFDResetHHistory(petsclib::PetscLibType,J::PetscMat) +Resets the counter to zero to begin +collecting a new set of differencing histories for the `MATMFFD` matrix + +Logically Collective + +Input Parameter: +- `J` - the matrix-free matrix context + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatMFFDGetH()`, `MatCreateSNESMF()`, +`MatMFFDSetHHistory()`, `MatMFFDSetFunctionError()` + +# External Links +$(_doc_external("Mat/MatMFFDResetHHistory")) +""" +function MatMFFDResetHHistory(petsclib::PetscLibType, J::PetscMat) end + +@for_petsc function MatMFFDResetHHistory(petsclib::$UnionPetscLib, J::PetscMat ) + + @chk ccall( + (:MatMFFDResetHHistory, $petsc_library), + PetscErrorCode, + (CMat,), + J, + ) + + + return nothing +end + +""" + MatMFFDSetBase(petsclib::PetscLibType,J::PetscMat, U::PetscVec, F::PetscVec) +Sets the vector `U` at which matrix vector products of the +Jacobian are computed for the `MATMFFD` matrix + +Logically Collective + +Input Parameters: +- `J` - the `MATMFFD` matrix +- `U` - the vector +- `F` - (optional) vector that contains F(u) if it has been already computed + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatMult()` + +# External Links +$(_doc_external("Mat/MatMFFDSetBase")) +""" +function MatMFFDSetBase(petsclib::PetscLibType, J::PetscMat, U::PetscVec, F::PetscVec) end + +@for_petsc function MatMFFDSetBase(petsclib::$UnionPetscLib, J::PetscMat, U::PetscVec, F::PetscVec ) + + @chk ccall( + (:MatMFFDSetBase, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + J, U, F, + ) + + + return nothing +end + +""" + MatMFFDSetCheckh(petsclib::PetscLibType,J::PetscMat, fun::MatMFFDCheckhFn, ctx::Cvoid) +Sets a function that checks the computed `h` and adjusts +it to satisfy some criteria for the `MATMFFD` matrix + +Logically Collective + +Input Parameters: +- `J` - the `MATMFFD` matrix +- `fun` - the function that checks `h`, see `MatMFFDCheckhFn` +- `ctx` - any context needed by the function + +Options Database Keys: +- `-mat_mffd_check_positivity ` - Ensure that U + h*a is non-negative + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatMFFDCheckhFn`, `MatMFFDCheckPositivity()` + +# External Links +$(_doc_external("Mat/MatMFFDSetCheckh")) +""" +function MatMFFDSetCheckh(petsclib::PetscLibType, J::PetscMat, fun::MatMFFDCheckhFn, ctx::Cvoid) end + +@for_petsc function MatMFFDSetCheckh(petsclib::$UnionPetscLib, J::PetscMat, fun::MatMFFDCheckhFn, ctx::Cvoid ) + + @chk ccall( + (:MatMFFDSetCheckh, $petsc_library), + PetscErrorCode, + (CMat, Ptr{MatMFFDCheckhFn}, Ptr{Cvoid}), + J, fun, ctx, + ) + + + return nothing +end + +""" + MatMFFDCheckPositivity(petsclib::PetscLibType,dummy::Cvoid, U::PetscVec, a::PetscVec, h::PetscScalar) +Checks that all entries in U + h*a are positive or +zero, decreases `h` until this is satisfied for a `MATMFFD` matrix + +Logically Collective + +Input Parameters: +- `dummy` - context variable (unused) +- `U` - base vector that is added to +- `a` - vector that is added +- `h` - scaling factor on `a`, may be changed on output + +Options Database Keys: +- `-mat_mffd_check_positivity ` - Ensure that U + h*a is nonnegative + +Level: advanced + +-seealso: [](ch_matrices), `Mat`, `MATMFFD`, `MatMFFDSetCheckh()` + +# External Links +$(_doc_external("Mat/MatMFFDCheckPositivity")) +""" +function MatMFFDCheckPositivity(petsclib::PetscLibType, dummy::Cvoid, U::PetscVec, a::PetscVec, h::PetscScalar) end + +@for_petsc function MatMFFDCheckPositivity(petsclib::$UnionPetscLib, dummy::Cvoid, U::PetscVec, a::PetscVec, h::$PetscScalar ) + + @chk ccall( + (:MatMFFDCheckPositivity, $petsc_library), + PetscErrorCode, + (Ptr{Cvoid}, CVec, CVec, Ptr{$PetscScalar}), + dummy, U, a, h, + ) + + + return nothing +end + +""" + MatMFFDDSSetUmin(petsclib::PetscLibType,A::PetscMat, umin::PetscReal) +Sets the "umin" parameter used by the +PETSc routine for computing the differencing parameter, h, which is used +for matrix-free Jacobian-vector products for a `MATMFFD` matrix. + +Input Parameters: +- `A` - the `MATMFFD` matrix +- `umin` - the parameter + +Level: advanced + +-seealso: `MATMFFD`, `MatMFFDSetFunctionError()`, `MatCreateSNESMF()` + +# External Links +$(_doc_external("Mat/MatMFFDDSSetUmin")) +""" +function MatMFFDDSSetUmin(petsclib::PetscLibType, A::PetscMat, umin::PetscReal) end + +@for_petsc function MatMFFDDSSetUmin(petsclib::$UnionPetscLib, A::PetscMat, umin::$PetscReal ) + + @chk ccall( + (:MatMFFDDSSetUmin, $petsc_library), + PetscErrorCode, + (CMat, $PetscReal), + A, umin, + ) + + + return nothing +end + +""" + MatMFFDComputeJacobian(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, jac::PetscMat, B::PetscMat, dummy::Cvoid) +Tells the matrix +Jacobian matrix-vector products will be computed at, i.e. J(x) * a. The x is obtained +from the `SNES` object (using `SNESGetSolution()`). + +Collective + +Input Parameters: +- `snes` - the nonlinear solver context +- `x` - the point at which the Jacobian-vector products will be performed +- `jac` - the matrix-free Jacobian object of `MatType` `MATMFFD`, likely obtained with `MatCreateSNESMF()` +- `B` - either the same as `jac` or another matrix type (ignored) +- `dummy` - the user context (ignored) + +Options Database Key: +- `-snes_mf` - use the matrix created with `MatSNESMFCreate()` to setup the Jacobian for each new solution in the Newton process + +Level: developer + +-seealso: [](ch_snes), `MatMFFDGetH()`, `MatCreateSNESMF()`, `MatMFFDSetBase()`, `MatCreateMFFD()`, `MATMFFD`, +`MatMFFDSetHHistory()`, `MatMFFDSetFunctionError()`, `SNESSetJacobian()` + +# External Links +$(_doc_external("Snes/MatMFFDComputeJacobian")) +""" +function MatMFFDComputeJacobian(petsclib::PetscLibType, snes::PetscSNES, x::PetscVec, jac::PetscMat, B::PetscMat, dummy::Cvoid) end + +@for_petsc function MatMFFDComputeJacobian(petsclib::$UnionPetscLib, snes::PetscSNES, x::PetscVec, jac::PetscMat, B::PetscMat, dummy::Cvoid ) + + @chk ccall( + (:MatMFFDComputeJacobian, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CMat, CMat, Ptr{Cvoid}), + snes, x, jac, B, dummy, + ) + + + return nothing +end + +""" + MatCoarsenRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new sparse matrix coarsening algorithm to the matrix package. + +Logically Collective, No Fortran Support + +Input Parameters: +- `sname` - name of coarsen (for example `MATCOARSENMIS`) +- `function` - function pointer that creates the coarsen type + +Level: developer + +-seealso: `MatCoarsen`, `MatCoarsenType`, `MatCoarsenSetType()`, `MatCoarsenCreate()`, `MatCoarsenRegisterDestroy()`, `MatCoarsenRegisterAll()` + +# External Links +$(_doc_external("Mat/MatCoarsenRegister")) +""" +function MatCoarsenRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function MatCoarsenRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:MatCoarsenRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + type::MatCoarsenType = MatCoarsenGetType(petsclib::PetscLibType,coarsen::MatCoarsen) +Gets the Coarsen method type and name (as a string) +from the coarsen context. + +Not Collective + +Input Parameter: +- `coarsen` - the coarsen context + +Output Parameter: +- `type` - coarsener type + +Level: advanced + +-seealso: `MatCoarsen`, `MatCoarsenCreate()`, `MatCoarsenType`, `MatCoarsenSetType()`, `MatCoarsenRegister()` + +# External Links +$(_doc_external("Mat/MatCoarsenGetType")) +""" +function MatCoarsenGetType(petsclib::PetscLibType, coarsen::MatCoarsen) end + +@for_petsc function MatCoarsenGetType(petsclib::$UnionPetscLib, coarsen::MatCoarsen ) + type_ = Ref{MatCoarsenType}() + + @chk ccall( + (:MatCoarsenGetType, $petsc_library), + PetscErrorCode, + (MatCoarsen, Ptr{MatCoarsenType}), + coarsen, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + MatCoarsenApply(petsclib::PetscLibType,coarser::MatCoarsen) +Gets a coarsen for a matrix. + +Collective + +Input Parameter: +- `coarser` - the coarsen + +Options Database Keys: +- `-mat_coarsen_type mis|hem|misk` - mis: maximal independent set based; misk: distance k MIS; hem: heavy edge matching +- `-mat_coarsen_view` - view the coarsening object + +Level: advanced + +-seealso: `MatCoarsen`, `MatCoarsenSetFromOptions()`, `MatCoarsenSetType()`, `MatCoarsenRegister()`, `MatCoarsenCreate()`, +`MatCoarsenDestroy()`, `MatCoarsenSetAdjacency()` +`MatCoarsenGetData()` + +# External Links +$(_doc_external("Mat/MatCoarsenApply")) +""" +function MatCoarsenApply(petsclib::PetscLibType, coarser::MatCoarsen) end + +@for_petsc function MatCoarsenApply(petsclib::$UnionPetscLib, coarser::MatCoarsen ) + + @chk ccall( + (:MatCoarsenApply, $petsc_library), + PetscErrorCode, + (MatCoarsen,), + coarser, + ) + + + return nothing +end + +""" + MatCoarsenSetAdjacency(petsclib::PetscLibType,agg::MatCoarsen, adj::PetscMat) +Sets the adjacency graph (matrix) of the thing to be coarsened. + +Collective + +Input Parameters: +- `agg` - the coarsen context +- `adj` - the adjacency matrix + +Level: advanced + +-seealso: `MatCoarsen`, `MatCoarsenSetFromOptions()`, `Mat`, `MatCoarsenCreate()`, `MatCoarsenApply()` + +# External Links +$(_doc_external("Mat/MatCoarsenSetAdjacency")) +""" +function MatCoarsenSetAdjacency(petsclib::PetscLibType, agg::MatCoarsen, adj::PetscMat) end + +@for_petsc function MatCoarsenSetAdjacency(petsclib::$UnionPetscLib, agg::MatCoarsen, adj::PetscMat ) + + @chk ccall( + (:MatCoarsenSetAdjacency, $petsc_library), + PetscErrorCode, + (MatCoarsen, CMat), + agg, adj, + ) + + + return nothing +end + +""" + MatCoarsenSetStrictAggs(petsclib::PetscLibType,agg::MatCoarsen, str::PetscBool) +Set whether to keep strict (non overlapping) aggregates in the linked list of aggregates for a coarsen context + +Logically Collective + +Input Parameters: +- `agg` - the coarsen context +- `str` - `PETSC_TRUE` keep strict aggregates, `PETSC_FALSE` allow overlap + +Level: advanced + +-seealso: `MatCoarsen`, `MatCoarsenCreate()`, `MatCoarsenSetFromOptions()` + +# External Links +$(_doc_external("Mat/MatCoarsenSetStrictAggs")) +""" +function MatCoarsenSetStrictAggs(petsclib::PetscLibType, agg::MatCoarsen, str::PetscBool) end + +@for_petsc function MatCoarsenSetStrictAggs(petsclib::$UnionPetscLib, agg::MatCoarsen, str::PetscBool ) + + @chk ccall( + (:MatCoarsenSetStrictAggs, $petsc_library), + PetscErrorCode, + (MatCoarsen, PetscBool), + agg, str, + ) + + + return nothing +end + +""" + MatCoarsenDestroy(petsclib::PetscLibType,agg::MatCoarsen) +Destroys the coarsen context. + +Collective + +Input Parameter: +- `agg` - the coarsen context + +Level: advanced + +-seealso: `MatCoarsen`, `MatCoarsenCreate()` + +# External Links +$(_doc_external("Mat/MatCoarsenDestroy")) +""" +function MatCoarsenDestroy(petsclib::PetscLibType, agg::MatCoarsen) end + +@for_petsc function MatCoarsenDestroy(petsclib::$UnionPetscLib, agg::MatCoarsen ) + + @chk ccall( + (:MatCoarsenDestroy, $petsc_library), + PetscErrorCode, + (Ptr{MatCoarsen},), + agg, + ) + + + return nothing +end + +""" + MatCoarsenViewFromOptions(petsclib::PetscLibType,A::MatCoarsen, obj::PetscObject, name::String) +View the coarsener from the options database + +Collective + +Input Parameters: +- `A` - the coarsen context +- `obj` - Optional object that provides the prefix for the option name +- `name` - command line option (usually `-mat_coarsen_view`) + +Options Database Key: +- `-mat_coarsen_view [viewertype]:...` - the viewer and its options + +-seealso: `MatCoarsen`, `MatCoarsenView`, `PetscObjectViewFromOptions()`, `MatCoarsenCreate()` + +# External Links +$(_doc_external("Mat/MatCoarsenViewFromOptions")) +""" +function MatCoarsenViewFromOptions(petsclib::PetscLibType, A::MatCoarsen, obj::PetscObject, name::String) end + +@for_petsc function MatCoarsenViewFromOptions(petsclib::$UnionPetscLib, A::MatCoarsen, obj::PetscObject, name::String ) + + @chk ccall( + (:MatCoarsenViewFromOptions, $petsc_library), + PetscErrorCode, + (MatCoarsen, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + MatCoarsenView(petsclib::PetscLibType,agg::MatCoarsen, viewer::PetscViewer) +Prints the coarsen data structure. + +Collective + +Input Parameters: +- `agg` - the coarsen context +- `viewer` - optional visualization context + +For viewing the options database see `MatCoarsenViewFromOptions()` + +Level: advanced + +-seealso: `MatCoarsen`, `PetscViewer`, `PetscViewerASCIIOpen()`, `MatCoarsenViewFromOptions` + +# External Links +$(_doc_external("Mat/MatCoarsenView")) +""" +function MatCoarsenView(petsclib::PetscLibType, agg::MatCoarsen, viewer::PetscViewer) end + +@for_petsc function MatCoarsenView(petsclib::$UnionPetscLib, agg::MatCoarsen, viewer::PetscViewer ) + + @chk ccall( + (:MatCoarsenView, $petsc_library), + PetscErrorCode, + (MatCoarsen, PetscViewer), + agg, viewer, + ) + + + return nothing +end + +""" + MatCoarsenSetType(petsclib::PetscLibType,coarser::MatCoarsen, type::MatCoarsenType) +Sets the type of aggregator to use + +Collective + +Input Parameters: +- `coarser` - the coarsen context. +- `type` - a known coarsening method + +Options Database Key: +- `-mat_coarsen_type ` - maximal independent set based; distance k MIS; heavy edge matching + +Level: advanced + +-seealso: `MatCoarsen`, `MatCoarsenCreate()`, `MatCoarsenApply()`, `MatCoarsenType`, `MatCoarsenGetType()` + +# External Links +$(_doc_external("Mat/MatCoarsenSetType")) +""" +function MatCoarsenSetType(petsclib::PetscLibType, coarser::MatCoarsen, type::MatCoarsenType) end + +@for_petsc function MatCoarsenSetType(petsclib::$UnionPetscLib, coarser::MatCoarsen, type::MatCoarsenType ) + + @chk ccall( + (:MatCoarsenSetType, $petsc_library), + PetscErrorCode, + (MatCoarsen, MatCoarsenType), + coarser, type, + ) + + + return nothing +end + +""" + MatCoarsenSetGreedyOrdering(petsclib::PetscLibType,coarser::MatCoarsen, perm::IS) +Sets the ordering of the vertices to use with a greedy coarsening method + +Logically Collective + +Input Parameters: +- `coarser` - the coarsen context +- `perm` - vertex ordering of (greedy) algorithm + +Level: advanced + +-seealso: `MatCoarsen`, `MatCoarsenType`, `MatCoarsenCreate()`, `MatCoarsenSetType()` + +# External Links +$(_doc_external("Mat/MatCoarsenSetGreedyOrdering")) +""" +function MatCoarsenSetGreedyOrdering(petsclib::PetscLibType, coarser::MatCoarsen, perm::IS) end + +@for_petsc function MatCoarsenSetGreedyOrdering(petsclib::$UnionPetscLib, coarser::MatCoarsen, perm::IS ) + + @chk ccall( + (:MatCoarsenSetGreedyOrdering, $petsc_library), + PetscErrorCode, + (MatCoarsen, CIS), + coarser, perm, + ) + + + return nothing +end + +""" + MatCoarsenGetData(petsclib::PetscLibType,coarser::MatCoarsen, llist::PetscCoarsenData) +Gets the weights for vertices for a coarsener. + +Logically Collective, No Fortran Support + +Input Parameter: +- `coarser` - the coarsen context + +Output Parameter: +- `llist` - linked list of aggregates + +Level: advanced + +-seealso: `MatCoarsen`, `MatCoarsenApply()`, `MatCoarsenCreate()`, `MatCoarsenSetType()`, `PetscCoarsenData` + +# External Links +$(_doc_external("Mat/MatCoarsenGetData")) +""" +function MatCoarsenGetData(petsclib::PetscLibType, coarser::MatCoarsen, llist::PetscCoarsenData) end + +@for_petsc function MatCoarsenGetData(petsclib::$UnionPetscLib, coarser::MatCoarsen, llist::PetscCoarsenData ) + + @chk ccall( + (:MatCoarsenGetData, $petsc_library), + PetscErrorCode, + (MatCoarsen, PetscCoarsenData), + coarser, llist, + ) + + + return nothing +end + +""" + MatCoarsenSetFromOptions(petsclib::PetscLibType,coarser::MatCoarsen) +Sets various coarsen options from the options database. + +Collective + +Input Parameter: +- `coarser` - the coarsen context. + +Options Database Key: +- `-mat_coarsen_type ` - mis: maximal independent set based; misk: distance k MIS; hem: heavy edge matching +- `-mat_coarsen_max_it number of iterations to use in the coarsening process` - see `MatCoarsenSetMaximumIterations()` + +Level: advanced + +-seealso: `MatCoarsen`, `MatCoarsenType`, `MatCoarsenApply()`, `MatCoarsenCreate()`, `MatCoarsenSetType()`, +`MatCoarsenSetMaximumIterations()` + +# External Links +$(_doc_external("Mat/MatCoarsenSetFromOptions")) +""" +function MatCoarsenSetFromOptions(petsclib::PetscLibType, coarser::MatCoarsen) end + +@for_petsc function MatCoarsenSetFromOptions(petsclib::$UnionPetscLib, coarser::MatCoarsen ) + + @chk ccall( + (:MatCoarsenSetFromOptions, $petsc_library), + PetscErrorCode, + (MatCoarsen,), + coarser, + ) + + + return nothing +end + +""" + MatCoarsenSetMaximumIterations(petsclib::PetscLibType,coarse::MatCoarsen, n::PetscInt) +Maximum `MATCOARSENHEM` iterations to use + +Logically Collective + +Input Parameters: +- `coarse` - the coarsen context +- `n` - number of HEM iterations + +Options Database Key: +- `-mat_coarsen_max_it ` - Maximum `MATCOARSENHEM` iterations to use + +Level: intermediate + +-seealso: `MatCoarsen`, `MatCoarsenType`, `MatCoarsenApply()`, `MatCoarsenCreate()`, `MatCoarsenSetType()` + +# External Links +$(_doc_external("Mat/MatCoarsenSetMaximumIterations")) +""" +function MatCoarsenSetMaximumIterations(petsclib::PetscLibType, coarse::MatCoarsen, n::PetscInt) end + +@for_petsc function MatCoarsenSetMaximumIterations(petsclib::$UnionPetscLib, coarse::MatCoarsen, n::$PetscInt ) + + @chk ccall( + (:MatCoarsenSetMaximumIterations, $petsc_library), + PetscErrorCode, + (MatCoarsen, $PetscInt), + coarse, n, + ) + + + return nothing +end + +""" + MatCoarsenSetStrengthIndex(petsclib::PetscLibType,coarse::MatCoarsen, n::PetscInt, idx::Vector{PetscInt}) +Index array to use for index to use for strength of connection + +Logically Collective + +Input Parameters: +- `coarse` - the coarsen context +- `n` - number of indices +- `idx` - array of indices + +Options Database Key: +- `-mat_coarsen_strength_index` - array of subset of variables per vertex to use for strength norm, -1 for using all (default) + +Level: intermediate + +-seealso: `MatCoarsen`, `MatCoarsenType`, `MatCoarsenApply()`, `MatCoarsenCreate()`, `MatCoarsenSetType()` + +# External Links +$(_doc_external("Mat/MatCoarsenSetStrengthIndex")) +""" +function MatCoarsenSetStrengthIndex(petsclib::PetscLibType, coarse::MatCoarsen, n::PetscInt, idx::Vector{PetscInt}) end + +@for_petsc function MatCoarsenSetStrengthIndex(petsclib::$UnionPetscLib, coarse::MatCoarsen, n::$PetscInt, idx::Vector{$PetscInt} ) + + @chk ccall( + (:MatCoarsenSetStrengthIndex, $petsc_library), + PetscErrorCode, + (MatCoarsen, $PetscInt, Ptr{$PetscInt}), + coarse, n, idx, + ) + + + return nothing +end + +""" + MatCoarsenSetThreshold(petsclib::PetscLibType,coarse::MatCoarsen, b::PetscReal) +Set the threshold for HEM + +Logically Collective + +Input Parameters: +- `coarse` - the coarsen context +- `b` - threshold value + +Options Database Key: +- `-mat_coarsen_threshold <-1>` - threshold + +Level: intermediate + +-seealso: `MatCoarsen`, `MatCoarsenType`, `MatCoarsenApply()`, `MatCoarsenCreate()`, `MatCoarsenSetType()` + +# External Links +$(_doc_external("Mat/MatCoarsenSetThreshold")) +""" +function MatCoarsenSetThreshold(petsclib::PetscLibType, coarse::MatCoarsen, b::PetscReal) end + +@for_petsc function MatCoarsenSetThreshold(petsclib::$UnionPetscLib, coarse::MatCoarsen, b::$PetscReal ) + + @chk ccall( + (:MatCoarsenSetThreshold, $petsc_library), + PetscErrorCode, + (MatCoarsen, $PetscReal), + coarse, b, + ) + + + return nothing +end + +""" + newcrs::MatCoarsen = MatCoarsenCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a coarsen context. + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `newcrs` - location to put the context + +Level: advanced + +-seealso: `MatCoarsen`, `MatCoarsenSetType()`, `MatCoarsenApply()`, `MatCoarsenDestroy()`, +`MatCoarsenSetAdjacency()`, `MatCoarsenGetData()` + +# External Links +$(_doc_external("Mat/MatCoarsenCreate")) +""" +function MatCoarsenCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function MatCoarsenCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + newcrs_ = Ref{MatCoarsen}() + + @chk ccall( + (:MatCoarsenCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{MatCoarsen}), + comm, newcrs_, + ) + + newcrs = newcrs_[] + + return newcrs +end + +""" + MatCoarsenMISKSetDistance(petsclib::PetscLibType,crs::MatCoarsen, k::PetscInt) +the distance to be used by MISK + +Collective + +Input Parameters: +- `crs` - the coarsen +- `k` - the distance + +Options Database Key: +- `-mat_coarsen_misk_distance ` - distance for MIS + +Level: advanced + +-seealso: `MATCOARSENMISK`, `MatCoarsen`, `MatCoarsenSetFromOptions()`, `MatCoarsenSetType()`, `MatCoarsenRegister()`, `MatCoarsenCreate()`, +`MatCoarsenDestroy()`, `MatCoarsenSetAdjacency()`, `MatCoarsenMISKGetDistance()` +`MatCoarsenGetData()` + +# External Links +$(_doc_external("Mat/MatCoarsenMISKSetDistance")) +""" +function MatCoarsenMISKSetDistance(petsclib::PetscLibType, crs::MatCoarsen, k::PetscInt) end + +@for_petsc function MatCoarsenMISKSetDistance(petsclib::$UnionPetscLib, crs::MatCoarsen, k::$PetscInt ) + + @chk ccall( + (:MatCoarsenMISKSetDistance, $petsc_library), + PetscErrorCode, + (MatCoarsen, $PetscInt), + crs, k, + ) + + + return nothing +end + +""" + k::PetscInt = MatCoarsenMISKGetDistance(petsclib::PetscLibType,crs::MatCoarsen) +gets the distance to be used by MISK + +Collective + +Input Parameter: +- `crs` - the coarsen + +Output Parameter: +- `k` - the distance + +Level: advanced + +-seealso: `MATCOARSENMISK`, `MatCoarsen`, `MatCoarsenSetFromOptions()`, `MatCoarsenSetType()`, +`MatCoarsenRegister()`, `MatCoarsenCreate()`, `MatCoarsenDestroy()`, +`MatCoarsenSetAdjacency()`, `MatCoarsenGetData()` + +# External Links +$(_doc_external("Mat/MatCoarsenMISKGetDistance")) +""" +function MatCoarsenMISKGetDistance(petsclib::PetscLibType, crs::MatCoarsen) end + +@for_petsc function MatCoarsenMISKGetDistance(petsclib::$UnionPetscLib, crs::MatCoarsen ) + k_ = Ref{$PetscInt}() + + @chk ccall( + (:MatCoarsenMISKGetDistance, $petsc_library), + PetscErrorCode, + (MatCoarsen, Ptr{$PetscInt}), + crs, k_, + ) + + k = k_[] + + return k +end + diff --git a/src/autowrapped/PC_wrappers.jl b/src/autowrapped/PC_wrappers.jl new file mode 100644 index 00000000..75b66fa5 --- /dev/null +++ b/src/autowrapped/PC_wrappers.jl @@ -0,0 +1,13999 @@ +# autodefined type arguments for class ------ +mutable struct _n_PCRiCchardsonConvergedReason end +const PCRiCchardsonConvergedReason = Ptr{_n_PCRiCchardsonConvergedReason} + +mutable struct PCModifySubMatricesFn end + +mutable struct PCMGCoarseSpaceConstructorFn end + +mutable struct PCShellPSolveFn end + +# ------------------------------------------------------- +""" + PCSetType(petsclib::PetscLibType,pc::PC, type::PCType) +Builds `PC` for a particular preconditioner type + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - a known method, see `PCType` for possible values + +Options Database Key: +- `-pc_type ` - Sets `PC` type + +-seealso: [](ch_ksp), `KSPSetType()`, `PCType`, `PCRegister()`, `PCCreate()`, `KSPGetPC()` + +# External Links +$(_doc_external("Ksp/PCSetType")) +""" +function PCSetType(petsclib::PetscLibType, pc::PC, type::PCType) end + +@for_petsc function PCSetType(petsclib::$UnionPetscLib, pc::PC, type::PCType ) + + @chk ccall( + (:PCSetType, $petsc_library), + PetscErrorCode, + (PC, PCType), + pc, type, + ) + + + return nothing +end + +""" + type::PCType = PCGetType(petsclib::PetscLibType,pc::PC) +Gets the `PCType` (as a string) from the `PC` +context. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `type` - name of preconditioner method + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCType`, `PCSetType()` + +# External Links +$(_doc_external("Ksp/PCGetType")) +""" +function PCGetType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCGetType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{PCType}() + + @chk ccall( + (:PCGetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PCSetFromOptions(petsclib::PetscLibType,pc::PC) +Sets `PC` options from the options database. + +Collective + +Input Parameter: +- `pc` - the preconditioner context + +Options Database Key: +- `-pc_type` - name of type, for example `bjacobi` + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCSetType()`, `PCType`, `KSPSetFromOptions()` + +# External Links +$(_doc_external("Ksp/PCSetFromOptions")) +""" +function PCSetFromOptions(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCSetFromOptions(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCSetFromOptions, $petsc_library), + PetscErrorCode, + (PC,), + pc, + ) + + + return nothing +end + +""" + PCSetDM(petsclib::PetscLibType,pc::PC, dm::PetscDM) +Sets the `DM` that may be used by some preconditioners + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `dm` - the `DM`, can be `NULL` to remove any current `DM` + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `DM`, `PCGetDM()`, `KSPSetDM()`, `KSPGetDM()`, `SNESSetDM()`, `TSSetDM()` + +# External Links +$(_doc_external("Ksp/PCSetDM")) +""" +function PCSetDM(petsclib::PetscLibType, pc::PC, dm::PetscDM) end + +@for_petsc function PCSetDM(petsclib::$UnionPetscLib, pc::PC, dm::PetscDM ) + + @chk ccall( + (:PCSetDM, $petsc_library), + PetscErrorCode, + (PC, CDM), + pc, dm, + ) + + + return nothing +end + +""" + dm::PetscDM = PCGetDM(petsclib::PetscLibType,pc::PC) +Gets the `DM` that may be used by some preconditioners + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `dm` - the `DM` + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `DM`, `PCSetDM()`, `KSPSetDM()`, `KSPGetDM()` + +# External Links +$(_doc_external("Ksp/PCGetDM")) +""" +function PCGetDM(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCGetDM(petsclib::$UnionPetscLib, pc::PC) + dm_ = Ref{CDM}() + + @chk ccall( + (:PCGetDM, $petsc_library), + PetscErrorCode, + (PC, Ptr{CDM}), + pc, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + return dm +end + +""" + PCSetApplicationContext(petsclib::PetscLibType,pc::PC, ctx::Cvoid) +Sets the optional user + +Logically Collective + +Input Parameters: +- `pc` - the `PC` context +- `ctx` - optional user context + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCGetApplicationContext()`, `KSPSetApplicationContext()`, `KSPGetApplicationContext()`, `PetscObjectCompose()` + +# External Links +$(_doc_external("Ksp/PCSetApplicationContext")) +""" +function PCSetApplicationContext(petsclib::PetscLibType, pc::PC, ctx::Cvoid) end + +@for_petsc function PCSetApplicationContext(petsclib::$UnionPetscLib, pc::PC, ctx::Cvoid ) + + @chk ccall( + (:PCSetApplicationContext, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cvoid}), + pc, ctx, + ) + + + return nothing +end + +""" + PCGetApplicationContext(petsclib::PetscLibType,pc::PC, ctx::PeCtx) +Gets the user + +Not Collective + +Input Parameter: +- `pc` - `PC` context + +Output Parameter: +- `ctx` - user context + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCSetApplicationContext()`, `KSPSetApplicationContext()`, `KSPGetApplicationContext()` + +# External Links +$(_doc_external("Ksp/PCGetApplicationContext")) +""" +function PCGetApplicationContext(petsclib::PetscLibType, pc::PC, ctx::PeCtx) end + +@for_petsc function PCGetApplicationContext(petsclib::$UnionPetscLib, pc::PC, ctx::PeCtx ) + + @chk ccall( + (:PCGetApplicationContext, $petsc_library), + PetscErrorCode, + (PC, PeCtx), + pc, ctx, + ) + + + return nothing +end + +""" + PCReset(petsclib::PetscLibType,pc::PC) +Resets a `PC` context to the state it was in before `PCSetUp()` was called, and removes any allocated `Vec` and `Mat` from its data structure + +Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetUp()` + +# External Links +$(_doc_external("Ksp/PCReset")) +""" +function PCReset(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCReset(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCReset, $petsc_library), + PetscErrorCode, + (PC,), + pc, + ) + + + return nothing +end + +""" + PCDestroy(petsclib::PetscLibType,pc::PC) +Destroys `PC` context that was created with `PCCreate()`. + +Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetUp()` + +# External Links +$(_doc_external("Ksp/PCDestroy")) +""" +function PCDestroy(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCDestroy(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PC},), + pc, + ) + + + return nothing +end + +""" + flag::PetscBool = PCGetDiagonalScale(petsclib::PetscLibType,pc::PC) +Indicates if the preconditioner applies an additional left and right +scaling as needed by certain time-stepping codes. + +Logically Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Output Parameter: +- `flag` - `PETSC_TRUE` if it applies the scaling + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetUp()`, `PCDiagonalScaleLeft()`, `PCDiagonalScaleRight()`, `PCSetDiagonalScale()` + +# External Links +$(_doc_external("Ksp/PCGetDiagonalScale")) +""" +function PCGetDiagonalScale(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCGetDiagonalScale(petsclib::$UnionPetscLib, pc::PC ) + flag_ = Ref{PetscBool}() + + @chk ccall( + (:PCGetDiagonalScale, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flag_, + ) + + flag = flag_[] + + return flag +end + +""" + PCSetDiagonalScale(petsclib::PetscLibType,pc::PC, s::PetscVec) +Indicates the left scaling to use to apply an additional left and right +scaling as needed by certain time-stepping codes. + +Logically Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `s` - scaling vector + +Level: intermediate + +-seealso: [](ch_ksp), `PCCreate()`, `PCSetUp()`, `PCDiagonalScaleLeft()`, `PCDiagonalScaleRight()`, `PCGetDiagonalScale()` + +# External Links +$(_doc_external("Ksp/PCSetDiagonalScale")) +""" +function PCSetDiagonalScale(petsclib::PetscLibType, pc::PC, s::PetscVec) end + +@for_petsc function PCSetDiagonalScale(petsclib::$UnionPetscLib, pc::PC, s::PetscVec ) + + @chk ccall( + (:PCSetDiagonalScale, $petsc_library), + PetscErrorCode, + (PC, CVec), + pc, s, + ) + + + return nothing +end + +""" + PCDiagonalScaleLeft(petsclib::PetscLibType,pc::PC, in::PetscVec, out::PetscVec) +Scales a vector by the left scaling as needed by certain time + +Logically Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `in` - input vector +- `out` - scaled vector (maybe the same as in) + +Level: intermediate + +-seealso: [](ch_ksp), `PCCreate()`, `PCSetUp()`, `PCSetDiagonalScale()`, `PCDiagonalScaleRight()`, `MatDiagonalScale()` + +# External Links +$(_doc_external("Ksp/PCDiagonalScaleLeft")) +""" +function PCDiagonalScaleLeft(petsclib::PetscLibType, pc::PC, in::PetscVec, out::PetscVec) end + +@for_petsc function PCDiagonalScaleLeft(petsclib::$UnionPetscLib, pc::PC, in::PetscVec, out::PetscVec ) + + @chk ccall( + (:PCDiagonalScaleLeft, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec), + pc, in, out, + ) + + + return nothing +end + +""" + PCDiagonalScaleRight(petsclib::PetscLibType,pc::PC, in::PetscVec, out::PetscVec) +Scales a vector by the right scaling as needed by certain time + +Logically Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `in` - input vector +- `out` - scaled vector (maybe the same as in) + +Level: intermediate + +-seealso: [](ch_ksp), `PCCreate()`, `PCSetUp()`, `PCDiagonalScaleLeft()`, `PCSetDiagonalScale()`, `MatDiagonalScale()` + +# External Links +$(_doc_external("Ksp/PCDiagonalScaleRight")) +""" +function PCDiagonalScaleRight(petsclib::PetscLibType, pc::PC, in::PetscVec, out::PetscVec) end + +@for_petsc function PCDiagonalScaleRight(petsclib::$UnionPetscLib, pc::PC, in::PetscVec, out::PetscVec ) + + @chk ccall( + (:PCDiagonalScaleRight, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec), + pc, in, out, + ) + + + return nothing +end + +""" + PCSetUseAmat(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Sets a flag to indicate that when the preconditioner needs to apply (part of) the +operator during the preconditioning process it applies the Amat provided to `TSSetRHSJacobian()`, +`TSSetIJacobian()`, `SNESSetJacobian()`, `KSPSetOperators()` or `PCSetOperators()` not the Pmat. + +Logically Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `flg` - `PETSC_TRUE` to use the Amat, `PETSC_FALSE` to use the Pmat (default is false) + +Options Database Key: +- `-pc_use_amat ` - use the amat argument to `KSPSetOperators()` or `PCSetOperators()` to apply the operator + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCGetUseAmat()`, `PCBJACOBI`, `PCMG`, `PCFIELDSPLIT`, `PCCOMPOSITE`, +`KSPSetOperators()`, `PCSetOperators()` + +# External Links +$(_doc_external("Ksp/PCSetUseAmat")) +""" +function PCSetUseAmat(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCSetUseAmat(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCSetUseAmat, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + PCSetErrorIfFailure(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Causes `PC` to generate an error if a floating point exception, for example a zero pivot, is detected. + +Logically Collective + +Input Parameters: +- `pc` - iterative context obtained from `PCCreate()` +- `flg` - `PETSC_TRUE` indicates you want the error generated + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `KSPSetErrorIfNotConverged()`, `PCGetInitialGuessNonzero()`, `PCSetInitialGuessKnoll()`, `PCGetInitialGuessKnoll()` + +# External Links +$(_doc_external("Ksp/PCSetErrorIfFailure")) +""" +function PCSetErrorIfFailure(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCSetErrorIfFailure(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCSetErrorIfFailure, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCGetUseAmat(petsclib::PetscLibType,pc::PC) +Gets a flag to indicate that when the preconditioner needs to apply (part of) the +operator during the preconditioning process it applies the Amat provided to `TSSetRHSJacobian()`, +`TSSetIJacobian()`, `SNESSetJacobian()`, `KSPSetOperators()` or `PCSetOperators()` not the Pmat. + +Logically Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Output Parameter: +- `flg` - `PETSC_TRUE` to use the Amat, `PETSC_FALSE` to use the Pmat (default is false) + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCSetUseAmat()`, `PCBJACOBI`, `PCMG`, `PCFIELDSPLIT`, `PCCOMPOSITE` + +# External Links +$(_doc_external("Ksp/PCGetUseAmat")) +""" +function PCGetUseAmat(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCGetUseAmat(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCGetUseAmat, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCSetKSPNestLevel(petsclib::PetscLibType,pc::PC, level::PetscInt) +sets the amount of nesting the `KSP` that contains this `PC` has + +Collective + +Input Parameters: +- `pc` - the `PC` +- `level` - the nest level + +Level: developer + +-seealso: [](ch_ksp), `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSP`, `KSPGMRES`, `KSPType`, `KSPGetNestLevel()`, `PCGetKSPNestLevel()`, `KSPSetNestLevel()` + +# External Links +$(_doc_external("Ksp/PCSetKSPNestLevel")) +""" +function PCSetKSPNestLevel(petsclib::PetscLibType, pc::PC, level::PetscInt) end + +@for_petsc function PCSetKSPNestLevel(petsclib::$UnionPetscLib, pc::PC, level::$PetscInt ) + + @chk ccall( + (:PCSetKSPNestLevel, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, level, + ) + + + return nothing +end + +""" + level::PetscInt = PCGetKSPNestLevel(petsclib::PetscLibType,pc::PC) +gets the amount of nesting the `KSP` that contains this `PC` has + +Not Collective + +Input Parameter: +- `pc` - the `PC` + +Output Parameter: +- `level` - the nest level + +Level: developer + +-seealso: [](ch_ksp), `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSP`, `KSPGMRES`, `KSPType`, `KSPSetNestLevel()`, `PCSetKSPNestLevel()`, `KSPGetNestLevel()` + +# External Links +$(_doc_external("Ksp/PCGetKSPNestLevel")) +""" +function PCGetKSPNestLevel(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCGetKSPNestLevel(petsclib::$UnionPetscLib, pc::PC ) + level_ = Ref{$PetscInt}() + + @chk ccall( + (:PCGetKSPNestLevel, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}), + pc, level_, + ) + + level = level_[] + + return level +end + +""" + newpc::PC = PCCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a preconditioner context, `PC` + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `newpc` - location to put the `PC` preconditioner context + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCType`, `PCSetType`, `PCSetUp()`, `PCApply()`, `PCDestroy()`, `KSP`, `KSPGetPC()` + +# External Links +$(_doc_external("Ksp/PCCreate")) +""" +function PCCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PCCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + newpc_ = Ref{PC}() + + @chk ccall( + (:PCCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PC}), + comm, newpc_, + ) + + newpc = newpc_[] + + return newpc +end + +""" + PCApply(petsclib::PetscLibType,pc::PC, x::PetscVec, y::PetscVec) +Applies the preconditioner to a vector. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `x` - input vector + +Output Parameter: +- `y` - output vector + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCApplyTranspose()`, `PCApplyBAorAB()` + +# External Links +$(_doc_external("Ksp/PCApply")) +""" +function PCApply(petsclib::PetscLibType, pc::PC, x::PetscVec, y::PetscVec) end + +@for_petsc function PCApply(petsclib::$UnionPetscLib, pc::PC, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:PCApply, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec), + pc, x, y, + ) + + + return nothing +end + +""" + PCMatApply(petsclib::PetscLibType,pc::PC, X::PetscMat, Y::PetscMat) +Applies the preconditioner to multiple vectors stored as a `MATDENSE`. Like `PCApply()`, `Y` and `X` must be different matrices. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `X` - block of input vectors + +Output Parameter: +- `Y` - block of output vectors + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCApply()`, `KSPMatSolve()` + +# External Links +$(_doc_external("Ksp/PCMatApply")) +""" +function PCMatApply(petsclib::PetscLibType, pc::PC, X::PetscMat, Y::PetscMat) end + +@for_petsc function PCMatApply(petsclib::$UnionPetscLib, pc::PC, X::PetscMat, Y::PetscMat ) + + @chk ccall( + (:PCMatApply, $petsc_library), + PetscErrorCode, + (PC, CMat, CMat), + pc, X, Y, + ) + + + return nothing +end + +""" + PCMatApplyTranspose(petsclib::PetscLibType,pc::PC, X::PetscMat, Y::PetscMat) +Applies the transpose of preconditioner to multiple vectors stored as a `MATDENSE`. Like `PCApplyTranspose()`, `Y` and `X` must be different matrices. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `X` - block of input vectors + +Output Parameter: +- `Y` - block of output vectors + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCApplyTranspose()`, `KSPMatSolveTranspose()` + +# External Links +$(_doc_external("Ksp/PCMatApplyTranspose")) +""" +function PCMatApplyTranspose(petsclib::PetscLibType, pc::PC, X::PetscMat, Y::PetscMat) end + +@for_petsc function PCMatApplyTranspose(petsclib::$UnionPetscLib, pc::PC, X::PetscMat, Y::PetscMat ) + + @chk ccall( + (:PCMatApplyTranspose, $petsc_library), + PetscErrorCode, + (PC, CMat, CMat), + pc, X, Y, + ) + + + return nothing +end + +""" + PCApplySymmetricLeft(petsclib::PetscLibType,pc::PC, x::PetscVec, y::PetscVec) +Applies the left part of a symmetric preconditioner to a vector. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `x` - input vector + +Output Parameter: +- `y` - output vector + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCApply()`, `PCApplySymmetricRight()` + +# External Links +$(_doc_external("Ksp/PCApplySymmetricLeft")) +""" +function PCApplySymmetricLeft(petsclib::PetscLibType, pc::PC, x::PetscVec, y::PetscVec) end + +@for_petsc function PCApplySymmetricLeft(petsclib::$UnionPetscLib, pc::PC, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:PCApplySymmetricLeft, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec), + pc, x, y, + ) + + + return nothing +end + +""" + PCApplySymmetricRight(petsclib::PetscLibType,pc::PC, x::PetscVec, y::PetscVec) +Applies the right part of a symmetric preconditioner to a vector. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `x` - input vector + +Output Parameter: +- `y` - output vector + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCApply()`, `PCApplySymmetricLeft()` + +# External Links +$(_doc_external("Ksp/PCApplySymmetricRight")) +""" +function PCApplySymmetricRight(petsclib::PetscLibType, pc::PC, x::PetscVec, y::PetscVec) end + +@for_petsc function PCApplySymmetricRight(petsclib::$UnionPetscLib, pc::PC, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:PCApplySymmetricRight, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec), + pc, x, y, + ) + + + return nothing +end + +""" + PCApplyTranspose(petsclib::PetscLibType,pc::PC, x::PetscVec, y::PetscVec) +Applies the transpose of preconditioner to a vector. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `x` - input vector + +Output Parameter: +- `y` - output vector + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCApply()`, `PCApplyBAorAB()`, `PCApplyBAorABTranspose()`, `PCApplyTransposeExists()` + +# External Links +$(_doc_external("Ksp/PCApplyTranspose")) +""" +function PCApplyTranspose(petsclib::PetscLibType, pc::PC, x::PetscVec, y::PetscVec) end + +@for_petsc function PCApplyTranspose(petsclib::$UnionPetscLib, pc::PC, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:PCApplyTranspose, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec), + pc, x, y, + ) + + + return nothing +end + +""" + flg::PetscBool = PCApplyTransposeExists(petsclib::PetscLibType,pc::PC) +Test whether the preconditioner has a transpose apply operation + +Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Output Parameter: +- `flg` - `PETSC_TRUE` if a transpose operation is defined + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCApplyTranspose()` + +# External Links +$(_doc_external("Ksp/PCApplyTransposeExists")) +""" +function PCApplyTransposeExists(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCApplyTransposeExists(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCApplyTransposeExists, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCApplyBAorAB(petsclib::PetscLibType,pc::PC, side::PCSide, x::PetscVec, y::PetscVec, work::PetscVec) +Applies the preconditioner and operator to a vector. y = B*A*x or y = A*B*x. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `side` - indicates the preconditioner side, one of `PC_LEFT`, `PC_RIGHT`, or `PC_SYMMETRIC` +- `x` - input vector +- `work` - work vector + +Output Parameter: +- `y` - output vector + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCApply()`, `PCApplyTranspose()`, `PCApplyBAorABTranspose()` + +# External Links +$(_doc_external("Ksp/PCApplyBAorAB")) +""" +function PCApplyBAorAB(petsclib::PetscLibType, pc::PC, side::PCSide, x::PetscVec, y::PetscVec, work::PetscVec) end + +@for_petsc function PCApplyBAorAB(petsclib::$UnionPetscLib, pc::PC, side::PCSide, x::PetscVec, y::PetscVec, work::PetscVec ) + + @chk ccall( + (:PCApplyBAorAB, $petsc_library), + PetscErrorCode, + (PC, PCSide, CVec, CVec, CVec), + pc, side, x, y, work, + ) + + + return nothing +end + +""" + PCApplyBAorABTranspose(petsclib::PetscLibType,pc::PC, side::PCSide, x::PetscVec, y::PetscVec, work::PetscVec) +Applies the transpose of the preconditioner +and operator to a vector. That is, applies B^T * A^T with left preconditioning, +NOT (B*A)^T = A^T*B^T. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `side` - indicates the preconditioner side, one of `PC_LEFT`, `PC_RIGHT`, or `PC_SYMMETRIC` +- `x` - input vector +- `work` - work vector + +Output Parameter: +- `y` - output vector + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCApply()`, `PCApplyTranspose()`, `PCApplyBAorAB()` + +# External Links +$(_doc_external("Ksp/PCApplyBAorABTranspose")) +""" +function PCApplyBAorABTranspose(petsclib::PetscLibType, pc::PC, side::PCSide, x::PetscVec, y::PetscVec, work::PetscVec) end + +@for_petsc function PCApplyBAorABTranspose(petsclib::$UnionPetscLib, pc::PC, side::PCSide, x::PetscVec, y::PetscVec, work::PetscVec ) + + @chk ccall( + (:PCApplyBAorABTranspose, $petsc_library), + PetscErrorCode, + (PC, PCSide, CVec, CVec, CVec), + pc, side, x, y, work, + ) + + + return nothing +end + +""" + exists::PetscBool = PCApplyRichardsonExists(petsclib::PetscLibType,pc::PC) +Determines whether a particular preconditioner has a +built-in fast application of Richardson's method. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner + +Output Parameter: +- `exists` - `PETSC_TRUE` or `PETSC_FALSE` + +Level: developer + +-seealso: [](ch_ksp), `PC`, `KSPRICHARDSON`, `PCApplyRichardson()` + +# External Links +$(_doc_external("Ksp/PCApplyRichardsonExists")) +""" +function PCApplyRichardsonExists(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCApplyRichardsonExists(petsclib::$UnionPetscLib, pc::PC ) + exists_ = Ref{PetscBool}() + + @chk ccall( + (:PCApplyRichardsonExists, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, exists_, + ) + + exists = exists_[] + + return exists +end + +""" + outits::PetscInt = PCApplyRichardson(petsclib::PetscLibType,pc::PC, b::PetscVec, y::PetscVec, w::PetscVec, rtol::PetscReal, abstol::PetscReal, dtol::PetscReal, its::PetscInt, guesszero::PetscBool, reason::PCRiCchardsonConvergedReason) +Applies several steps of Richardson iteration with +the particular preconditioner. This routine is usually used by the +Krylov solvers and not the application code directly. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `b` - the right-hand side +- `w` - one work vector +- `rtol` - relative decrease in residual norm convergence criteria +- `abstol` - absolute residual norm convergence criteria +- `dtol` - divergence residual norm increase criteria +- `its` - the number of iterations to apply. +- `guesszero` - if the input x contains nonzero initial guess + +Output Parameters: +- `outits` - number of iterations actually used (for SOR this always equals its) +- `reason` - the reason the apply terminated +- `y` - the solution (also contains initial guess if guesszero is `PETSC_FALSE` + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCApplyRichardsonExists()` + +# External Links +$(_doc_external("Ksp/PCApplyRichardson")) +""" +function PCApplyRichardson(petsclib::PetscLibType, pc::PC, b::PetscVec, y::PetscVec, w::PetscVec, rtol::PetscReal, abstol::PetscReal, dtol::PetscReal, its::PetscInt, guesszero::PetscBool, reason::PCRiCchardsonConvergedReason) end + +@for_petsc function PCApplyRichardson(petsclib::$UnionPetscLib, pc::PC, b::PetscVec, y::PetscVec, w::PetscVec, rtol::$PetscReal, abstol::$PetscReal, dtol::$PetscReal, its::$PetscInt, guesszero::PetscBool, reason::PCRiCchardsonConvergedReason ) + outits_ = Ref{$PetscInt}() + + @chk ccall( + (:PCApplyRichardson, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec, CVec, $PetscReal, $PetscReal, $PetscReal, $PetscInt, PetscBool, Ptr{$PetscInt}, Ptr{PCRiCchardsonConvergedReason}), + pc, b, y, w, rtol, abstol, dtol, its, guesszero, outits_, reason, + ) + + outits = outits_[] + + return outits +end + +""" + PCSetFailedReason(petsclib::PetscLibType,pc::PC, reason::PCFailedReason) +Sets the reason a `PCSetUp()` failed or `PC_NOERROR` if it did not fail + +Logically Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `reason` - the reason it failed + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCApply()`, `PCDestroy()`, `PCFailedReason` + +# External Links +$(_doc_external("Ksp/PCSetFailedReason")) +""" +function PCSetFailedReason(petsclib::PetscLibType, pc::PC, reason::PCFailedReason) end + +@for_petsc function PCSetFailedReason(petsclib::$UnionPetscLib, pc::PC, reason::PCFailedReason ) + + @chk ccall( + (:PCSetFailedReason, $petsc_library), + PetscErrorCode, + (PC, PCFailedReason), + pc, reason, + ) + + + return nothing +end + +""" + PCGetFailedReason(petsclib::PetscLibType,pc::PC, reason::PCFailedReason) +Gets the reason a `PCSetUp()` failed or `PC_NOERROR` if it did not fail + +Not Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Output Parameter: +- `reason` - the reason it failed + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCApply()`, `PCDestroy()`, `PCSetFailedReason()`, `PCFailedReason` + +# External Links +$(_doc_external("Ksp/PCGetFailedReason")) +""" +function PCGetFailedReason(petsclib::PetscLibType, pc::PC, reason::PCFailedReason) end + +@for_petsc function PCGetFailedReason(petsclib::$UnionPetscLib, pc::PC, reason::PCFailedReason ) + + @chk ccall( + (:PCGetFailedReason, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCFailedReason}), + pc, reason, + ) + + + return nothing +end + +""" + PCReduceFailedReason(petsclib::PetscLibType,pc::PC) +Reduce the failed reason among the MPI processes that share the `PC` + +Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCApply()`, `PCDestroy()`, `PCGetFailedReason()`, `PCSetFailedReason()`, `PCFailedReason` + +# External Links +$(_doc_external("Ksp/PCReduceFailedReason")) +""" +function PCReduceFailedReason(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCReduceFailedReason(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCReduceFailedReason, $petsc_library), + PetscErrorCode, + (PC,), + pc, + ) + + + return nothing +end + +""" + PCSetUp(petsclib::PetscLibType,pc::PC) +Prepares for the use of a preconditioner. Performs all the one +can be used with `PCApply()` + +Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCApply()`, `PCDestroy()`, `KSPSetUp()`, `PCSetUpOnBlocks()` + +# External Links +$(_doc_external("Ksp/PCSetUp")) +""" +function PCSetUp(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCSetUp(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCSetUp, $petsc_library), + PetscErrorCode, + (PC,), + pc, + ) + + + return nothing +end + +""" + PCSetUpOnBlocks(petsclib::PetscLibType,pc::PC) +Sets up the preconditioner for each block in +the block Jacobi, overlapping Schwarz, and fieldsplit methods. + +Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCSetUp()`, `PCCreate()`, `PCApply()`, `PCDestroy()` + +# External Links +$(_doc_external("Ksp/PCSetUpOnBlocks")) +""" +function PCSetUpOnBlocks(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCSetUpOnBlocks(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCSetUpOnBlocks, $petsc_library), + PetscErrorCode, + (PC,), + pc, + ) + + + return nothing +end + +""" + PCSetModifySubMatrices(petsclib::PetscLibType,pc::PC, func::PCModifySubMatricesFn, ctx::Cvoid) +Sets a user +submatrices that arise within certain subdomain-based preconditioners such as `PCASM` + +Logically Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `func` - routine for modifying the submatrices, see `PCModifySubMatricesFn` +- `ctx` - optional user-defined context (may be `NULL`) + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCModifySubMatricesFn`, `PCBJACOBI`, `PCASM`, `PCModifySubMatrices()` + +# External Links +$(_doc_external("Ksp/PCSetModifySubMatrices")) +""" +function PCSetModifySubMatrices(petsclib::PetscLibType, pc::PC, func::PCModifySubMatricesFn, ctx::Cvoid) end + +@for_petsc function PCSetModifySubMatrices(petsclib::$UnionPetscLib, pc::PC, func::PCModifySubMatricesFn, ctx::Cvoid ) + + @chk ccall( + (:PCSetModifySubMatrices, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCModifySubMatricesFn}, Ptr{Cvoid}), + pc, func, ctx, + ) + + + return nothing +end + +""" + PCModifySubMatrices(petsclib::PetscLibType,pc::PC, nsub::PetscInt, row::Vector{IS}, col::Vector{IS}, submat::Vector{PetscMat}, ctx::Cvoid) +Calls an optional user +certain preconditioners if one has been set with `PCSetModifySubMatrices()`. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `nsub` - the number of local submatrices +- `row` - an array of index sets that contain the global row numbers +that comprise each local submatrix +- `col` - an array of index sets that contain the global column numbers +that comprise each local submatrix +- `submat` - array of local submatrices +- `ctx` - optional user-defined context for private data for the +user-defined routine (may be `NULL`) + +Output Parameter: +- `submat` - array of local submatrices (the entries of which may +have been modified) + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCModifySubMatricesFn`, `PCSetModifySubMatrices()` + +# External Links +$(_doc_external("Ksp/PCModifySubMatrices")) +""" +function PCModifySubMatrices(petsclib::PetscLibType, pc::PC, nsub::PetscInt, row::Vector{IS}, col::Vector{IS}, submat::Vector{PetscMat}, ctx::Cvoid) end + +@for_petsc function PCModifySubMatrices(petsclib::$UnionPetscLib, pc::PC, nsub::$PetscInt, row::Vector{IS}, col::Vector{IS}, submat::Vector{PetscMat}, ctx::Cvoid ) + + @chk ccall( + (:PCModifySubMatrices, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{IS}, Ptr{IS}, Ptr{CMat}, Ptr{Cvoid}), + pc, nsub, row, col, submat, ctx, + ) + + + return nothing +end + +""" + PCSetOperators(petsclib::PetscLibType,pc::PC, Amat::PetscMat, Pmat::PetscMat) +Sets the matrix associated with the linear system and +a (possibly) different one associated with the preconditioner. + +Logically Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `Amat` - the matrix that defines the linear system +- `Pmat` - the matrix to be used in constructing the preconditioner, usually the same as Amat. + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCGetOperators()`, `MatZeroEntries()` + +# External Links +$(_doc_external("Ksp/PCSetOperators")) +""" +function PCSetOperators(petsclib::PetscLibType, pc::PC, Amat::PetscMat, Pmat::PetscMat) end + +@for_petsc function PCSetOperators(petsclib::$UnionPetscLib, pc::PC, Amat::PetscMat, Pmat::PetscMat ) + + @chk ccall( + (:PCSetOperators, $petsc_library), + PetscErrorCode, + (PC, CMat, CMat), + pc, Amat, Pmat, + ) + + + return nothing +end + +""" + PCSetReusePreconditioner(petsclib::PetscLibType,pc::PC, flag::PetscBool) +reuse the current preconditioner even if the operator in the preconditioner `PC` has changed. + +Logically Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `flag` - `PETSC_TRUE` do not compute a new preconditioner, `PETSC_FALSE` do compute a new preconditioner + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCGetOperators()`, `MatZeroEntries()`, `PCGetReusePreconditioner()`, `KSPSetReusePreconditioner()` + +# External Links +$(_doc_external("Ksp/PCSetReusePreconditioner")) +""" +function PCSetReusePreconditioner(petsclib::PetscLibType, pc::PC, flag::PetscBool) end + +@for_petsc function PCSetReusePreconditioner(petsclib::$UnionPetscLib, pc::PC, flag::PetscBool ) + + @chk ccall( + (:PCSetReusePreconditioner, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flag, + ) + + + return nothing +end + +""" + flag::PetscBool = PCGetReusePreconditioner(petsclib::PetscLibType,pc::PC) +Determines if the `PC` reuses the current preconditioner even if the operator in the preconditioner has changed. + +Not Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Output Parameter: +- `flag` - `PETSC_TRUE` do not compute a new preconditioner, `PETSC_FALSE` do compute a new preconditioner + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCGetOperators()`, `MatZeroEntries()`, `PCSetReusePreconditioner()` + +# External Links +$(_doc_external("Ksp/PCGetReusePreconditioner")) +""" +function PCGetReusePreconditioner(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCGetReusePreconditioner(petsclib::$UnionPetscLib, pc::PC ) + flag_ = Ref{PetscBool}() + + @chk ccall( + (:PCGetReusePreconditioner, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flag_, + ) + + flag = flag_[] + + return flag +end + +""" + PCGetOperators(petsclib::PetscLibType,pc::PC, Amat::PetscMat, Pmat::PetscMat) +Gets the matrix associated with the linear system and +possibly a different one which is used to construct the preconditioner. + +Not Collective, though parallel `Mat`s are returned if `pc` is parallel + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Output Parameters: +- `Amat` - the matrix defining the linear system +- `Pmat` - the matrix from which the preconditioner is constructed, usually the same as Amat. + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCSetOperators()`, `KSPGetOperators()`, `KSPSetOperators()`, `PCGetOperatorsSet()` + +# External Links +$(_doc_external("Ksp/PCGetOperators")) +""" +function PCGetOperators(petsclib::PetscLibType, pc::PC, Amat::PetscMat, Pmat::PetscMat) end + +@for_petsc function PCGetOperators(petsclib::$UnionPetscLib, pc::PC, Amat::PetscMat, Pmat::PetscMat ) + Amat_ = Ref(Amat.ptr) + Pmat_ = Ref(Pmat.ptr) + + @chk ccall( + (:PCGetOperators, $petsc_library), + PetscErrorCode, + (PC, Ptr{CMat}, Ptr{CMat}), + pc, Amat_, Pmat_, + ) + + Amat.ptr = C_NULL + Pmat.ptr = C_NULL + + return nothing +end + +""" + mat::PetscBool,pmat::PetscBool = PCGetOperatorsSet(petsclib::PetscLibType,pc::PC) +Determines if the matrix associated with the linear system and +possibly a different one associated with the preconditioner have been set in the `PC`. + +Not Collective, though the results on all processes should be the same + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Output Parameters: +- `mat` - the matrix associated with the linear system was set +- `pmat` - matrix associated with the preconditioner was set, usually the same + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCSetOperators()`, `KSPGetOperators()`, `KSPSetOperators()`, `PCGetOperators()` + +# External Links +$(_doc_external("Ksp/PCGetOperatorsSet")) +""" +function PCGetOperatorsSet(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCGetOperatorsSet(petsclib::$UnionPetscLib, pc::PC ) + mat_ = Ref{PetscBool}() + pmat_ = Ref{PetscBool}() + + @chk ccall( + (:PCGetOperatorsSet, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}, Ptr{PetscBool}), + pc, mat_, pmat_, + ) + + mat = mat_[] + pmat = pmat_[] + + return mat,pmat +end + +""" + PCFactorGetMatrix(petsclib::PetscLibType,pc::PC, mat::PetscMat) +Gets the factored matrix from the +preconditioner context. This routine is valid only for the `PCLU`, +`PCILU`, `PCCHOLESKY`, and `PCICC` methods. + +Not Collective though `mat` is parallel if `pc` is parallel + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Output Parameters: +- `mat` - the factored matrix + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCLU`, `PCILU`, `PCCHOLESKY`, `PCICC` + +# External Links +$(_doc_external("Ksp/PCFactorGetMatrix")) +""" +function PCFactorGetMatrix(petsclib::PetscLibType, pc::PC, mat::PetscMat) end + +@for_petsc function PCFactorGetMatrix(petsclib::$UnionPetscLib, pc::PC, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:PCFactorGetMatrix, $petsc_library), + PetscErrorCode, + (PC, Ptr{CMat}), + pc, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + PCSetOptionsPrefix(petsclib::PetscLibType,pc::PC, prefix::String) +Sets the prefix used for searching for all +`PC` options in the database. + +Logically Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `prefix` - the prefix string to prepend to all `PC` option requests + +-seealso: [](ch_ksp), `PC`, `PCSetFromOptions`, `PCAppendOptionsPrefix()`, `PCGetOptionsPrefix()` + +# External Links +$(_doc_external("Ksp/PCSetOptionsPrefix")) +""" +function PCSetOptionsPrefix(petsclib::PetscLibType, pc::PC, prefix::String) end + +@for_petsc function PCSetOptionsPrefix(petsclib::$UnionPetscLib, pc::PC, prefix::String ) + + @chk ccall( + (:PCSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cchar}), + pc, prefix, + ) + + + return nothing +end + +""" + PCAppendOptionsPrefix(petsclib::PetscLibType,pc::PC, prefix::String) +Appends to the prefix used for searching for all +`PC` options in the database. + +Logically Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `prefix` - the prefix string to prepend to all `PC` option requests + +-seealso: [](ch_ksp), `PC`, `PCSetFromOptions`, `PCSetOptionsPrefix()`, `PCGetOptionsPrefix()` + +# External Links +$(_doc_external("Ksp/PCAppendOptionsPrefix")) +""" +function PCAppendOptionsPrefix(petsclib::PetscLibType, pc::PC, prefix::String) end + +@for_petsc function PCAppendOptionsPrefix(petsclib::$UnionPetscLib, pc::PC, prefix::String ) + + @chk ccall( + (:PCAppendOptionsPrefix, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cchar}), + pc, prefix, + ) + + + return nothing +end + +""" + PCGetOptionsPrefix(petsclib::PetscLibType,pc::PC, prefix::String) +Gets the prefix used for searching for all +PC options in the database. + +Not Collective + +Input Parameter: +- `pc` - the `PC` preconditioner context + +Output Parameter: +- `prefix` - pointer to the prefix string used, is returned + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCSetFromOptions`, `PCSetOptionsPrefix()`, `PCAppendOptionsPrefix()` + +# External Links +$(_doc_external("Ksp/PCGetOptionsPrefix")) +""" +function PCGetOptionsPrefix(petsclib::PetscLibType, pc::PC, prefix::String) end + +@for_petsc function PCGetOptionsPrefix(petsclib::$UnionPetscLib, pc::PC, prefix::String ) + prefix_ = Ref(pointer(prefix)) + + @chk ccall( + (:PCGetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PC, Ptr{Ptr{Cchar}}), + pc, prefix_, + ) + + + return nothing +end + +""" + PCPreSolve(petsclib::PetscLibType,pc::PC, ksp::PetscKSP) +Optional pre +the iterative solve itself. Used in conjunction with `PCPostSolve()` + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `ksp` - the Krylov subspace context + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCPostSolve()`, `KSP`, `PCSetPostSetUp()`, `KSPSetPreSolve()`, `KSPSetPostSolve()` + +# External Links +$(_doc_external("Ksp/PCPreSolve")) +""" +function PCPreSolve(petsclib::PetscLibType, pc::PC, ksp::PetscKSP) end + +@for_petsc function PCPreSolve(petsclib::$UnionPetscLib, pc::PC, ksp::PetscKSP ) + + @chk ccall( + (:PCPreSolve, $petsc_library), + PetscErrorCode, + (PC, CKSP), + pc, ksp, + ) + + + return nothing +end + +""" + PCSetPostSetUp(petsclib::PetscLibType,pc::PC, postsetup::external) +Sets function called at the end of `PCSetUp()` to adjust the computed preconditioner + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner object +- `postsetup` - the function to call after `PCSetUp()` + +Calling sequence of `postsetup`: +- `pc` - the `PC` context + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCSetUp()` + +# External Links +$(_doc_external("Ksp/PCSetPostSetUp")) +""" +function PCSetPostSetUp(petsclib::PetscLibType, pc::PC, postsetup::external) end + +@for_petsc function PCSetPostSetUp(petsclib::$UnionPetscLib, pc::PC, postsetup::external ) + + @chk ccall( + (:PCSetPostSetUp, $petsc_library), + PetscErrorCode, + (PC, external), + pc, postsetup, + ) + + + return nothing +end + +""" + PCPostSolve(petsclib::PetscLibType,pc::PC, ksp::PetscKSP) +Optional post +preconditioner-specific actions that must be performed after +the iterative solve itself. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `ksp` - the `KSP` Krylov subspace context + +-seealso: [](ch_ksp), `PC`, `KSPSetPostSolve()`, `KSPSetPreSolve()`, `PCPreSolve()`, `KSPSolve()` + +# External Links +$(_doc_external("Ksp/PCPostSolve")) +""" +function PCPostSolve(petsclib::PetscLibType, pc::PC, ksp::PetscKSP) end + +@for_petsc function PCPostSolve(petsclib::$UnionPetscLib, pc::PC, ksp::PetscKSP ) + + @chk ccall( + (:PCPostSolve, $petsc_library), + PetscErrorCode, + (PC, CKSP), + pc, ksp, + ) + + + return nothing +end + +""" + PCLoad(petsclib::PetscLibType,newdm::PC, viewer::PetscViewer) +Loads a `PC` that has been stored in binary with `PCView()`. + +Collective + +Input Parameters: +- `newdm` - the newly loaded `PC`, this needs to have been created with `PCCreate()` or +some related function before a call to `PCLoad()`. +- `viewer` - binary file viewer `PETSCVIEWERBINARY`, obtained from `PetscViewerBinaryOpen()` + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PetscViewerBinaryOpen()`, `PCView()`, `MatLoad()`, `VecLoad()`, `PETSCVIEWERBINARY` + +# External Links +$(_doc_external("Ksp/PCLoad")) +""" +function PCLoad(petsclib::PetscLibType, newdm::PC, viewer::PetscViewer) end + +@for_petsc function PCLoad(petsclib::$UnionPetscLib, newdm::PC, viewer::PetscViewer ) + + @chk ccall( + (:PCLoad, $petsc_library), + PetscErrorCode, + (PC, PetscViewer), + newdm, viewer, + ) + + + return nothing +end + +""" + PCViewFromOptions(petsclib::PetscLibType,A::PC, obj::PetscObject, name::String) +View (print or provide information about) the `PC`, based on options in the options database + +Collective + +Input Parameters: +- `A` - the `PC` context +- `obj` - Optional object that provides the options prefix +- `name` - command line option name + +Level: developer + +-seealso: [](ch_ksp), `PC`, `PCView`, `PetscObjectViewFromOptions()`, `PCCreate()` + +# External Links +$(_doc_external("Ksp/PCViewFromOptions")) +""" +function PCViewFromOptions(petsclib::PetscLibType, A::PC, obj::PetscObject, name::String) end + +@for_petsc function PCViewFromOptions(petsclib::$UnionPetscLib, A::PC, obj::PetscObject, name::String ) + + @chk ccall( + (:PCViewFromOptions, $petsc_library), + PetscErrorCode, + (PC, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PCView(petsclib::PetscLibType,pc::PC, viewer::PetscViewer) +Prints information about the `PC` + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `viewer` - optional `PetscViewer` visualization context + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PetscViewer`, `PetscViewerType`, `KSPView()`, `PetscViewerASCIIOpen()` + +# External Links +$(_doc_external("Ksp/PCView")) +""" +function PCView(petsclib::PetscLibType, pc::PC, viewer::PetscViewer) end + +@for_petsc function PCView(petsclib::$UnionPetscLib, pc::PC, viewer::PetscViewer ) + + @chk ccall( + (:PCView, $petsc_library), + PetscErrorCode, + (PC, PetscViewer), + pc, viewer, + ) + + + return nothing +end + +""" + PCRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a method (`PCType`) to the PETSc preconditioner package. + +Not collective. No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined solver +- `function` - routine to create the method context which will be stored in a `PC` when `PCSetType()` is called + +-seealso: [](ch_ksp), `PC`, `PCType`, `PCRegisterAll()`, `PCSetType()`, `PCShellSetContext()`, `PCShellSetApply()`, `PCSHELL` + +# External Links +$(_doc_external("Ksp/PCRegister")) +""" +function PCRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PCRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PCRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PCComputeOperator(petsclib::PetscLibType,pc::PC, mattype::MatType, mat::PetscMat) +Computes the explicit preconditioned operator as a matrix `Mat`. + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner object +- `mattype` - the `MatType` to be used for the operator + +Output Parameter: +- `mat` - the explicit preconditioned operator + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `KSPComputeOperator()`, `MatType` + +# External Links +$(_doc_external("Ksp/PCComputeOperator")) +""" +function PCComputeOperator(petsclib::PetscLibType, pc::PC, mattype::MatType, mat::PetscMat) end + +@for_petsc function PCComputeOperator(petsclib::$UnionPetscLib, pc::PC, mattype::MatType, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:PCComputeOperator, $petsc_library), + PetscErrorCode, + (PC, MatType, Ptr{CMat}), + pc, mattype, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + PCSetCoordinates(petsclib::PetscLibType,pc::PC, dim::PetscInt, nloc::PetscInt, coords::Vector{PetscReal}) +sets the coordinates of all the nodes (degrees of freedom in the vector) on the local process + +Collective + +Input Parameters: +- `pc` - the `PC` preconditioner context +- `dim` - the dimension of the coordinates 1, 2, or 3 +- `nloc` - the blocked size of the coordinates array +- `coords` - the coordinates array + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `MatSetNearNullSpace()` + +# External Links +$(_doc_external("Ksp/PCSetCoordinates")) +""" +function PCSetCoordinates(petsclib::PetscLibType, pc::PC, dim::PetscInt, nloc::PetscInt, coords::Vector{PetscReal}) end + +@for_petsc function PCSetCoordinates(petsclib::$UnionPetscLib, pc::PC, dim::$PetscInt, nloc::$PetscInt, coords::Vector{$PetscReal} ) + + @chk ccall( + (:PCSetCoordinates, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, $PetscInt, Ptr{$PetscReal}), + pc, dim, nloc, coords, + ) + + + return nothing +end + +""" + num_levels::PetscInt = PCGetInterpolations(petsclib::PetscLibType,pc::PC, interpolations::Vector{PetscMat}) +Gets interpolation matrices for all levels (except level 0) + +Logically Collective + +Input Parameter: +- `pc` - the precondition context + +Output Parameters: +- `num_levels` - the number of levels +- `interpolations` - the interpolation matrices (size of `num_levels`-1) + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCMG`, `PCMGGetRestriction()`, `PCMGSetInterpolation()`, `PCMGGetInterpolation()`, `PCGetCoarseOperators()` + +# External Links +$(_doc_external("Ksp/PCGetInterpolations")) +""" +function PCGetInterpolations(petsclib::PetscLibType, pc::PC, interpolations::Vector{PetscMat}) end + +@for_petsc function PCGetInterpolations(petsclib::$UnionPetscLib, pc::PC, interpolations::Vector{PetscMat} ) + num_levels_ = Ref{$PetscInt}() + interpolations_ = Ref(pointer(interpolations)) + + @chk ccall( + (:PCGetInterpolations, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{Ptr{CMat}}), + pc, num_levels_, interpolations_, + ) + + num_levels = num_levels_[] + + return num_levels +end + +""" + num_levels::PetscInt = PCGetCoarseOperators(petsclib::PetscLibType,pc::PC, coarseOperators::Vector{PetscMat}) +Gets coarse operator matrices for all levels (except the finest level) + +Logically Collective + +Input Parameter: +- `pc` - the precondition context + +Output Parameters: +- `num_levels` - the number of levels +- `coarseOperators` - the coarse operator matrices (size of `num_levels`-1) + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCMG`, `PCMGGetRestriction()`, `PCMGSetInterpolation()`, `PCMGGetRScale()`, `PCMGGetInterpolation()`, `PCGetInterpolations()` + +# External Links +$(_doc_external("Ksp/PCGetCoarseOperators")) +""" +function PCGetCoarseOperators(petsclib::PetscLibType, pc::PC, coarseOperators::Vector{PetscMat}) end + +@for_petsc function PCGetCoarseOperators(petsclib::$UnionPetscLib, pc::PC, coarseOperators::Vector{PetscMat} ) + num_levels_ = Ref{$PetscInt}() + coarseOperators_ = Ref(pointer(coarseOperators)) + + @chk ccall( + (:PCGetCoarseOperators, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{Ptr{CMat}}), + pc, num_levels_, coarseOperators_, + ) + + num_levels = num_levels_[] + + return num_levels +end + +""" + PCMatSetApplyOperation(petsclib::PetscLibType,pc::PC, matop::MatOperation) +Set which matrix operation of the matrix implements `PCApply()` for `PCMAT`. + +Logically collective + +Input Parameters: +- `pc` - An instance of `PCMAT` +- `matop` - The selected `MatOperation` + +Level: intermediate + +-seealso: [](ch_ksp), `PCMAT`, `PCMatGetApplyOperation()`, `PCApply()`, `MatOperation` + +# External Links +$(_doc_external("Ksp/PCMatSetApplyOperation")) +""" +function PCMatSetApplyOperation(petsclib::PetscLibType, pc::PC, matop::MatOperation) end + +@for_petsc function PCMatSetApplyOperation(petsclib::$UnionPetscLib, pc::PC, matop::MatOperation ) + + @chk ccall( + (:PCMatSetApplyOperation, $petsc_library), + PetscErrorCode, + (PC, MatOperation), + pc, matop, + ) + + + return nothing +end + +""" + PCMatGetApplyOperation(petsclib::PetscLibType,pc::PC, matop::MatOperation) +Get which matrix operation of the matrix implements `PCApply()` for `PCMAT`. + +Logically collective + +Input Parameter: +- `pc` - An instance of `PCMAT` + +Output Parameter: +- `matop` - The `MatOperation` + +Level: intermediate + +-seealso: [](ch_ksp), `PCMAT`, `PCMatSetApplyOperation()`, `PCApply()`, `MatOperation` + +# External Links +$(_doc_external("Ksp/PCMatGetApplyOperation")) +""" +function PCMatGetApplyOperation(petsclib::PetscLibType, pc::PC, matop::MatOperation) end + +@for_petsc function PCMatGetApplyOperation(petsclib::$UnionPetscLib, pc::PC, matop::MatOperation ) + + @chk ccall( + (:PCMatGetApplyOperation, $petsc_library), + PetscErrorCode, + (PC, Ptr{MatOperation}), + pc, matop, + ) + + + return nothing +end + +""" + PCASMSetLocalSubdomains(petsclib::PetscLibType,pc::PC, n::PetscInt, is::Vector{IS}, is_loc::Vector{IS}) +Sets the local subdomains (for this processor only) for the additive Schwarz preconditioner `PCASM`. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `n` - the number of subdomains for this processor (default value = 1) +- `is` - the index set that defines the subdomains for this processor (or `NULL` for PETSc to determine subdomains) +the values of the `is` array are copied so you can free the array (not the `IS` in the array) after this call +- `is_local` - the index sets that define the local part of the subdomains for this processor, not used unless `PCASMType` is `PC_ASM_RESTRICT` +(or `NULL` to not provide these). The values of the `is_local` array are copied so you can free the array +(not the `IS` in the array) after this call + +Options Database Key: +- `-pc_asm_local_blocks ` - Sets number of local blocks + +Level: advanced + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetTotalSubdomains()`, `PCASMSetOverlap()`, `PCASMGetSubKSP()`, +`PCASMCreateSubdomains2D()`, `PCASMGetLocalSubdomains()`, `PCASMType`, `PCASMSetType()`, `PCGASM` + +# External Links +$(_doc_external("Ksp/PCASMSetLocalSubdomains")) +""" +function PCASMSetLocalSubdomains(petsclib::PetscLibType, pc::PC, n::PetscInt, is::Vector{IS}, is_loc::Vector{IS}) end + +@for_petsc function PCASMSetLocalSubdomains(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt, is::Vector{IS}, is_loc::Vector{IS} ) + + @chk ccall( + (:PCASMSetLocalSubdomains, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{IS}, Ptr{IS}), + pc, n, is, is_loc, + ) + + + return nothing +end + +""" + PCASMSetTotalSubdomains(petsclib::PetscLibType,pc::PC, N::PetscInt, is::Vector{IS}, is_loc::Vector{IS}) +Sets the subdomains for all processors for the +additive Schwarz preconditioner, `PCASM`. + +Collective, all MPI ranks must pass in the same array of `IS` + +Input Parameters: +- `pc` - the preconditioner context +- `N` - the number of subdomains for all processors +- `is` - the index sets that define the subdomains for all processors (or `NULL` to ask PETSc to determine the subdomains) +the values of the `is` array are copied so you can free the array (not the `IS` in the array) after this call +- `is_local` - the index sets that define the local part of the subdomains for this processor (or `NULL` to not provide this information) +The values of the `is_local` array are copied so you can free the array (not the `IS` in the array) after this call + +Options Database Key: +- `-pc_asm_blocks ` - Sets total blocks + +Level: advanced + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetLocalSubdomains()`, `PCASMSetOverlap()`, `PCASMGetSubKSP()`, +`PCASMCreateSubdomains2D()`, `PCGASM` + +# External Links +$(_doc_external("Ksp/PCASMSetTotalSubdomains")) +""" +function PCASMSetTotalSubdomains(petsclib::PetscLibType, pc::PC, N::PetscInt, is::Vector{IS}, is_loc::Vector{IS}) end + +@for_petsc function PCASMSetTotalSubdomains(petsclib::$UnionPetscLib, pc::PC, N::$PetscInt, is::Vector{IS}, is_loc::Vector{IS} ) + + @chk ccall( + (:PCASMSetTotalSubdomains, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{IS}, Ptr{IS}), + pc, N, is, is_loc, + ) + + + return nothing +end + +""" + PCASMSetOverlap(petsclib::PetscLibType,pc::PC, ovl::PetscInt) +Sets the overlap between a pair of subdomains for the +additive Schwarz preconditioner, `PCASM`. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `ovl` - the amount of overlap between subdomains (ovl >= 0, default value = 1) + +Options Database Key: +- `-pc_asm_overlap ` - Sets overlap + +Level: intermediate + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetTotalSubdomains()`, `PCASMSetLocalSubdomains()`, `PCASMGetSubKSP()`, +`PCASMCreateSubdomains2D()`, `PCASMGetLocalSubdomains()`, `MatIncreaseOverlap()`, `PCGASM` + +# External Links +$(_doc_external("Ksp/PCASMSetOverlap")) +""" +function PCASMSetOverlap(petsclib::PetscLibType, pc::PC, ovl::PetscInt) end + +@for_petsc function PCASMSetOverlap(petsclib::$UnionPetscLib, pc::PC, ovl::$PetscInt ) + + @chk ccall( + (:PCASMSetOverlap, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, ovl, + ) + + + return nothing +end + +""" + PCASMSetType(petsclib::PetscLibType,pc::PC, type::PCASMType) +Sets the type of restriction and interpolation used +for local problems in the additive Schwarz method, `PCASM`. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - variant of `PCASM`, one of +-seealso: [](ch_ksp), `PCASM`, `PCASMSetTotalSubdomains()`, `PCASMGetSubKSP()`, +`PCASMCreateSubdomains2D()`, `PCASMType`, `PCASMSetLocalType()`, `PCASMGetLocalType()`, `PCGASM` + +# External Links +$(_doc_external("Ksp/PCASMSetType")) +""" +function PCASMSetType(petsclib::PetscLibType, pc::PC, type::PCASMType) end + +@for_petsc function PCASMSetType(petsclib::$UnionPetscLib, pc::PC, type::PCASMType ) + + @chk ccall( + (:PCASMSetType, $petsc_library), + PetscErrorCode, + (PC, PCASMType), + pc, type, + ) + + + return nothing +end + +""" + type::PCASMType = PCASMGetType(petsclib::PetscLibType,pc::PC) +Gets the type of restriction and interpolation used +for local problems in the additive Schwarz method, `PCASM`. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `type` - variant of `PCASM`, one of +-seealso: [](ch_ksp), `PCASM`, `PCASMSetTotalSubdomains()`, `PCASMGetSubKSP()`, `PCGASM`, +`PCASMCreateSubdomains2D()`, `PCASMType`, `PCASMSetType()`, `PCASMSetLocalType()`, `PCASMGetLocalType()` + +# External Links +$(_doc_external("Ksp/PCASMGetType")) +""" +function PCASMGetType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCASMGetType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{PCASMType}() + + @chk ccall( + (:PCASMGetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCASMType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PCASMSetLocalType(petsclib::PetscLibType,pc::PC, type::PCCompositeType) +Sets the type of composition used for local problems in the additive Schwarz method, `PCASM`. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - type of composition, one of +-seealso: [](ch_ksp), `PCASM`, `PCASMSetType()`, `PCASMGetType()`, `PCASMGetLocalType()`, `PCASMType`, `PCCompositeType` + +# External Links +$(_doc_external("Ksp/PCASMSetLocalType")) +""" +function PCASMSetLocalType(petsclib::PetscLibType, pc::PC, type::PCCompositeType) end + +@for_petsc function PCASMSetLocalType(petsclib::$UnionPetscLib, pc::PC, type::PCCompositeType ) + + @chk ccall( + (:PCASMSetLocalType, $petsc_library), + PetscErrorCode, + (PC, PCCompositeType), + pc, type, + ) + + + return nothing +end + +""" + type::PCCompositeType = PCASMGetLocalType(petsclib::PetscLibType,pc::PC) +Gets the type of composition used for local problems in the additive Schwarz method, `PCASM`. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `type` - type of composition, one of +-seealso: [](ch_ksp), `PCASM`, `PCASMSetType()`, `PCASMGetType()`, `PCASMSetLocalType()`, `PCASMType`, `PCCompositeType` + +# External Links +$(_doc_external("Ksp/PCASMGetLocalType")) +""" +function PCASMGetLocalType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCASMGetLocalType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{PCCompositeType}() + + @chk ccall( + (:PCASMGetLocalType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCCompositeType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PCASMSetSortIndices(petsclib::PetscLibType,pc::PC, doSort::PetscBool) +Determines whether subdomain indices are sorted. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `doSort` - sort the subdomain indices + +Level: intermediate + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetLocalSubdomains()`, `PCASMSetTotalSubdomains()`, `PCASMGetSubKSP()`, +`PCASMCreateSubdomains2D()` + +# External Links +$(_doc_external("Ksp/PCASMSetSortIndices")) +""" +function PCASMSetSortIndices(petsclib::PetscLibType, pc::PC, doSort::PetscBool) end + +@for_petsc function PCASMSetSortIndices(petsclib::$UnionPetscLib, pc::PC, doSort::PetscBool ) + + @chk ccall( + (:PCASMSetSortIndices, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, doSort, + ) + + + return nothing +end + +""" + n_loc::PetscInt,first_loc::PetscInt = PCASMGetSubKSP(petsclib::PetscLibType,pc::PC, ksp::Vector{PetscKSP}) +Gets the local `KSP` contexts for all blocks on +this processor. + +Collective iff first_local is requested + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `n_local` - the number of blocks on this processor or `NULL` +- `first_local` - the global number of the first block on this processor or `NULL`, all processors must request or all must pass `NULL` +- `ksp` - the array of `KSP` contexts + +Level: advanced + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetTotalSubdomains()`, `PCASMSetOverlap()`, +`PCASMCreateSubdomains2D()`, + +# External Links +$(_doc_external("Ksp/PCASMGetSubKSP")) +""" +function PCASMGetSubKSP(petsclib::PetscLibType, pc::PC, ksp::Vector{PetscKSP}) end + +@for_petsc function PCASMGetSubKSP(petsclib::$UnionPetscLib, pc::PC, ksp::Vector{PetscKSP} ) + n_loc_ = Ref{$PetscInt}() + first_loc_ = Ref{$PetscInt}() + ksp_ = Ref(pointer(ksp)) + + @chk ccall( + (:PCASMGetSubKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{CKSP}}), + pc, n_loc_, first_loc_, ksp_, + ) + + n_loc = n_loc_[] + first_loc = first_loc_[] + + return n_loc,first_loc +end + +""" + outis::Vector{IS} = PCASMCreateSubdomains(petsclib::PetscLibType,A::PetscMat, n::PetscInt) +Creates the index sets for the overlapping Schwarz +preconditioner, `PCASM`, for any problem on a general grid. + +Collective + +Input Parameters: +- `A` - The global matrix operator +- `n` - the number of local blocks + +Output Parameter: +- `outis` - the array of index sets defining the subdomains + +Level: advanced + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetLocalSubdomains()`, `PCASMDestroySubdomains()` + +# External Links +$(_doc_external("Ksp/PCASMCreateSubdomains")) +""" +function PCASMCreateSubdomains(petsclib::PetscLibType, A::PetscMat, n::PetscInt) end + +@for_petsc function PCASMCreateSubdomains(petsclib::$UnionPetscLib, A::PetscMat, n::$PetscInt ) + outis_ = Ref{Ptr{IS}}() + + @chk ccall( + (:PCASMCreateSubdomains, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{Ptr{IS}}), + A, n, outis_, + ) + + outis = unsafe_wrap(Array, outis_[], VecGetLocalSize(petsclib, x); own = false) + + return outis +end + +""" + PCASMDestroySubdomains(petsclib::PetscLibType,n::PetscInt, is::Vector{IS}, is_loc::Vector{IS}) +Destroys the index sets created with +`PCASMCreateSubdomains()`. Should be called after setting subdomains with `PCASMSetLocalSubdomains()`. + +Collective + +Input Parameters: +- `n` - the number of index sets +- `is` - the array of index sets +- `is_local` - the array of local index sets, can be `NULL` + +Level: advanced + +-seealso: [](ch_ksp), `PCASM`, `PCASMCreateSubdomains()`, `PCASMSetLocalSubdomains()` + +# External Links +$(_doc_external("Ksp/PCASMDestroySubdomains")) +""" +function PCASMDestroySubdomains(petsclib::PetscLibType, n::PetscInt, is::Vector{IS}, is_loc::Vector{IS}) end + +@for_petsc function PCASMDestroySubdomains(petsclib::$UnionPetscLib, n::$PetscInt, is::Vector{IS}, is_loc::Vector{IS} ) + is_ = Ref(pointer(is)) + is_loc_ = Ref(pointer(is_loc)) + + @chk ccall( + (:PCASMDestroySubdomains, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Ptr{IS}}, Ptr{Ptr{IS}}), + n, is_, is_loc_, + ) + + + return nothing +end + +""" + Nsub::PetscInt,is::Vector{IS},is_loc::Vector{IS} = PCASMCreateSubdomains2D(petsclib::PetscLibType,m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, dof::PetscInt, overlap::PetscInt) +Creates the index sets for the overlapping Schwarz +preconditioner, `PCASM`, for a two-dimensional problem on a regular grid. + +Not Collective + +Input Parameters: +- `m` - the number of mesh points in the x direction +- `n` - the number of mesh points in the y direction +- `M` - the number of subdomains in the x direction +- `N` - the number of subdomains in the y direction +- `dof` - degrees of freedom per node +- `overlap` - overlap in mesh lines + +Output Parameters: +- `Nsub` - the number of subdomains created +- `is` - array of index sets defining overlapping (if overlap > 0) subdomains +- `is_local` - array of index sets defining non-overlapping subdomains + +Level: advanced + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetTotalSubdomains()`, `PCASMSetLocalSubdomains()`, `PCASMGetSubKSP()`, +`PCASMSetOverlap()` + +# External Links +$(_doc_external("Ksp/PCASMCreateSubdomains2D")) +""" +function PCASMCreateSubdomains2D(petsclib::PetscLibType, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, dof::PetscInt, overlap::PetscInt) end + +@for_petsc function PCASMCreateSubdomains2D(petsclib::$UnionPetscLib, m::$PetscInt, n::$PetscInt, M::$PetscInt, N::$PetscInt, dof::$PetscInt, overlap::$PetscInt ) + Nsub_ = Ref{$PetscInt}() + is_ = Ref{Ptr{IS}}() + is_loc_ = Ref{Ptr{IS}}() + + @chk ccall( + (:PCASMCreateSubdomains2D, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{IS}}, Ptr{Ptr{IS}}), + m, n, M, N, dof, overlap, Nsub_, is_, is_loc_, + ) + + Nsub = Nsub_[] + is = unsafe_wrap(Array, is_[], VecGetLocalSize(petsclib, x); own = false) + is_loc = unsafe_wrap(Array, is_loc_[], VecGetLocalSize(petsclib, x); own = false) + + return Nsub,is,is_loc +end + +""" + n::PetscInt = PCASMGetLocalSubdomains(petsclib::PetscLibType,pc::PC, is::Vector{IS}, is_loc::Vector{IS}) +Gets the local subdomains (for this processor +only) for the additive Schwarz preconditioner, `PCASM`. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `n` - if requested, the number of subdomains for this processor (default value = 1) +- `is` - if requested, the index sets that define the subdomains for this processor +- `is_local` - if requested, the index sets that define the local part of the subdomains for this processor (can be `NULL`) + +Level: advanced + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetTotalSubdomains()`, `PCASMSetOverlap()`, `PCASMGetSubKSP()`, +`PCASMCreateSubdomains2D()`, `PCASMSetLocalSubdomains()`, `PCASMGetLocalSubmatrices()` + +# External Links +$(_doc_external("Ksp/PCASMGetLocalSubdomains")) +""" +function PCASMGetLocalSubdomains(petsclib::PetscLibType, pc::PC, is::Vector{IS}, is_loc::Vector{IS}) end + +@for_petsc function PCASMGetLocalSubdomains(petsclib::$UnionPetscLib, pc::PC, is::Vector{IS}, is_loc::Vector{IS} ) + n_ = Ref{$PetscInt}() + is_ = Ref(pointer(is)) + is_loc_ = Ref(pointer(is_loc)) + + @chk ccall( + (:PCASMGetLocalSubdomains, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{Ptr{IS}}, Ptr{Ptr{IS}}), + pc, n_, is_, is_loc_, + ) + + n = n_[] + + return n +end + +""" + n::PetscInt = PCASMGetLocalSubmatrices(petsclib::PetscLibType,pc::PC, mat::Vector{PetscMat}) +Gets the local submatrices (for this processor +only) for the additive Schwarz preconditioner, `PCASM`. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `n` - if requested, the number of matrices for this processor (default value = 1) +- `mat` - if requested, the matrices + +Level: advanced + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetTotalSubdomains()`, `PCASMSetOverlap()`, `PCASMGetSubKSP()`, +`PCASMCreateSubdomains2D()`, `PCASMSetLocalSubdomains()`, `PCASMGetLocalSubdomains()`, `PCSetModifySubMatrices()` + +# External Links +$(_doc_external("Ksp/PCASMGetLocalSubmatrices")) +""" +function PCASMGetLocalSubmatrices(petsclib::PetscLibType, pc::PC, mat::Vector{PetscMat}) end + +@for_petsc function PCASMGetLocalSubmatrices(petsclib::$UnionPetscLib, pc::PC, mat::Vector{PetscMat} ) + n_ = Ref{$PetscInt}() + mat_ = Ref(pointer(mat)) + + @chk ccall( + (:PCASMGetLocalSubmatrices, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{Ptr{CMat}}), + pc, n_, mat_, + ) + + n = n_[] + + return n +end + +""" + PCASMSetDMSubdomains(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Indicates whether to use `DMCreateDomainDecomposition()` to define the subdomains, whenever possible. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner +- `flg` - boolean indicating whether to use subdomains defined by the `DM` + +Options Database Key: +- `-pc_asm_dm_subdomains ` - use subdomains defined by the `DM` with `DMCreateDomainDecomposition()` + +Level: intermediate + +-seealso: [](ch_ksp), `PCASM`, `PCASMGetDMSubdomains()`, `PCASMSetTotalSubdomains()`, `PCASMSetOverlap()` +`PCASMCreateSubdomains2D()`, `PCASMSetLocalSubdomains()`, `PCASMGetLocalSubdomains()` + +# External Links +$(_doc_external("Ksp/PCASMSetDMSubdomains")) +""" +function PCASMSetDMSubdomains(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCASMSetDMSubdomains(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCASMSetDMSubdomains, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCASMGetDMSubdomains(petsclib::PetscLibType,pc::PC) +Returns flag indicating whether to use `DMCreateDomainDecomposition()` to define the subdomains, whenever possible. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner + +Output Parameter: +- `flg` - boolean indicating whether to use subdomains defined by the `DM` + +Level: intermediate + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetDMSubdomains()`, `PCASMSetTotalSubdomains()`, `PCASMSetOverlap()` +`PCASMCreateSubdomains2D()`, `PCASMSetLocalSubdomains()`, `PCASMGetLocalSubdomains()` + +# External Links +$(_doc_external("Ksp/PCASMGetDMSubdomains")) +""" +function PCASMGetDMSubdomains(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCASMGetDMSubdomains(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCASMGetDMSubdomains, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + sub_mat_type::MatType = PCASMGetSubMatType(petsclib::PetscLibType,pc::PC) +Gets the matrix type used for `PCASM` subsolves, as a string. + +Not Collective + +Input Parameter: +- `pc` - the `PC` + +Output Parameter: +- `sub_mat_type` - name of matrix type + +Level: advanced + +-seealso: [](ch_ksp), `PCASM`, `PCASMSetSubMatType()`, `PCSetType()`, `VecSetType()`, `MatType`, `Mat` + +# External Links +$(_doc_external("Ksp/PCASMGetSubMatType")) +""" +function PCASMGetSubMatType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCASMGetSubMatType(petsclib::$UnionPetscLib, pc::PC ) + sub_mat_type_ = Ref{MatType}() + + @chk ccall( + (:PCASMGetSubMatType, $petsc_library), + PetscErrorCode, + (PC, Ptr{MatType}), + pc, sub_mat_type_, + ) + + sub_mat_type = unsafe_string(sub_mat_type_[]) + + return sub_mat_type +end + +""" + PCASMSetSubMatType(petsclib::PetscLibType,pc::PC, sub_mat_type::MatType) +Set the type of matrix used for `PCASM` subsolves + +Collective + +Input Parameters: +- `pc` - the `PC` object +- `sub_mat_type` - the `MatType` + +Options Database Key: +- `-pc_asm_sub_mat_type ` - Sets the matrix type used for subsolves, for example, seqaijviennacl. +If you specify a base name like aijviennacl, the corresponding sequential type is assumed. + +-seealso: [](ch_ksp), `PCASM`, `PCASMGetSubMatType()`, `PCSetType()`, `VecSetType()`, `MatType`, `Mat` + +# External Links +$(_doc_external("Ksp/PCASMSetSubMatType")) +""" +function PCASMSetSubMatType(petsclib::PetscLibType, pc::PC, sub_mat_type::MatType) end + +@for_petsc function PCASMSetSubMatType(petsclib::$UnionPetscLib, pc::PC, sub_mat_type::MatType ) + + @chk ccall( + (:PCASMSetSubMatType, $petsc_library), + PetscErrorCode, + (PC, MatType), + pc, sub_mat_type, + ) + + + return nothing +end + +""" + PCMPIServerBegin(petsclib::PetscLibType) +starts a server that runs on the `rank != 0` MPI processes waiting to process requests for +parallel `KSP` solves and management of parallel `KSP` objects. + +Logically Collective on all MPI processes except rank 0 + +Options Database Keys: +- `-mpi_linear_solver_server` - causes the PETSc program to start in MPI linear solver server mode where only the first MPI rank runs user code +- `-mpi_linear_solver_server_view` - displays information about all the linear systems solved by the MPI linear solver server at the conclusion of the program +- `-mpi_linear_solver_server_use_shared_memory` - use shared memory when communicating matrices and vectors to server processes (default where supported) + +Level: developer + +-seealso: [](sec_pcmpi), `PCMPIServerEnd()`, `PCMPI`, `KSPCheckPCMPI()` + +# External Links +$(_doc_external("Ksp/PCMPIServerBegin")) +""" +function PCMPIServerBegin(petsclib::PetscLibType) end + +@for_petsc function PCMPIServerBegin(petsclib::$UnionPetscLib) + + @chk ccall( + (:PCMPIServerBegin, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PCMPIServerEnd(petsclib::PetscLibType) +ends a server that runs on the rank != 0 MPI processes waiting to process requests for +parallel KSP solves and management of parallel `KSP` objects. + +Logically Collective on all MPI ranks except 0 + +Level: developer + +-seealso: [](sec_pcmpi), `PCMPIServerBegin()`, `PCMPI`, `KSPCheckPCMPI()` + +# External Links +$(_doc_external("Ksp/PCMPIServerEnd")) +""" +function PCMPIServerEnd(petsclib::PetscLibType) end + +@for_petsc function PCMPIServerEnd(petsclib::$UnionPetscLib) + + @chk ccall( + (:PCMPIServerEnd, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PCMPIGetKSP(petsclib::PetscLibType,pc::PC, innerksp::PetscKSP) +Gets the `KSP` created by the `PCMPI` + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `innerksp` - the inner `KSP` + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `PCMPI`, `PCREDISTRIBUTE` + +# External Links +$(_doc_external("Ksp/PCMPIGetKSP")) +""" +function PCMPIGetKSP(petsclib::PetscLibType, pc::PC, innerksp::PetscKSP) end + +@for_petsc function PCMPIGetKSP(petsclib::$UnionPetscLib, pc::PC, innerksp::PetscKSP ) + innerksp_ = Ref(innerksp.ptr) + + @chk ccall( + (:PCMPIGetKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{CKSP}), + pc, innerksp_, + ) + + innerksp.ptr = C_NULL + + return nothing +end + +""" + PCPythonSetType(petsclib::PetscLibType,pc::PC, pyname::String) +Initialize a `PC` object implemented in Python, a `PCPYTHON`. + +Collective + +Input Parameters: +- `pc` - the preconditioner (`PC`) context. +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Options Database Key: +- `-pc_python_type ` - python class + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCSHELL`, `PCCreate()`, `PCSetType()`, `PCPYTHON`, `PetscPythonInitialize()` + +# External Links +$(_doc_external("Ksp/PCPythonSetType")) +""" +function PCPythonSetType(petsclib::PetscLibType, pc::PC, pyname::String) end + +@for_petsc function PCPythonSetType(petsclib::$UnionPetscLib, pc::PC, pyname::String ) + + @chk ccall( + (:PCPythonSetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cchar}), + pc, pyname, + ) + + + return nothing +end + +""" + pyname::String = PCPythonGetType(petsclib::PetscLibType,pc::PC) +Get the type of a `PC` object implemented in Python, a `PCPYTHON`. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner (`PC`) context. + +Output Parameter: +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCSHELL`, `PCCreate()`, `PCSetType()`, `PCPYTHON`, `PetscPythonInitialize()`, `PCPythonSetType()` + +# External Links +$(_doc_external("Ksp/PCPythonGetType")) +""" +function PCPythonGetType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCPythonGetType(petsclib::$UnionPetscLib, pc::PC ) + pyname_ = Ref{Ptr{Cchar}}() + + @chk ccall( + (:PCPythonGetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{Ptr{Cchar}}), + pc, pyname_, + ) + + pyname = unsafe_wrap(Array, pyname_[], VecGetLocalSize(petsclib, x); own = false) + + return pyname +end + +""" + PCKSPSetKSP(petsclib::PetscLibType,pc::PC, ksp::PetscKSP) +Sets the `KSP` context for a `PCKSP`. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `ksp` - the `KSP` solver + +Level: advanced + +-seealso: [](ch_ksp), `PCKSP`, `PCKSPGetKSP()` + +# External Links +$(_doc_external("Ksp/PCKSPSetKSP")) +""" +function PCKSPSetKSP(petsclib::PetscLibType, pc::PC, ksp::PetscKSP) end + +@for_petsc function PCKSPSetKSP(petsclib::$UnionPetscLib, pc::PC, ksp::PetscKSP ) + + @chk ccall( + (:PCKSPSetKSP, $petsc_library), + PetscErrorCode, + (PC, CKSP), + pc, ksp, + ) + + + return nothing +end + +""" + PCKSPGetKSP(petsclib::PetscLibType,pc::PC, ksp::PetscKSP) +Gets the `KSP` context for a `PCKSP`. + +Not Collective but ksp returned is parallel if pc was parallel + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `ksp` - the `KSP` solver + +-seealso: [](ch_ksp), `PCKSP`, `PCKSPSetKSP()` + +# External Links +$(_doc_external("Ksp/PCKSPGetKSP")) +""" +function PCKSPGetKSP(petsclib::PetscLibType, pc::PC, ksp::PetscKSP) end + +@for_petsc function PCKSPGetKSP(petsclib::$UnionPetscLib, pc::PC, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:PCKSPGetKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{CKSP}), + pc, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + PCMGResidualDefault(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec, r::PetscVec) +Default routine to calculate the residual. + +Collective + +Input Parameters: +- `mat` - the matrix +- `b` - the right-hand side +- `x` - the approximate solution + +Output Parameter: +- `r` - location to store the residual + +Level: developer + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetResidual()`, `PCMGSetMatResidual()` + +# External Links +$(_doc_external("Ksp/PCMGResidualDefault")) +""" +function PCMGResidualDefault(petsclib::PetscLibType, mat::PetscMat, b::PetscVec, x::PetscVec, r::PetscVec) end + +@for_petsc function PCMGResidualDefault(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscVec, x::PetscVec, r::PetscVec ) + + @chk ccall( + (:PCMGResidualDefault, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec), + mat, b, x, r, + ) + + + return nothing +end + +""" + PCMGResidualTransposeDefault(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec, r::PetscVec) +Default routine to calculate the residual of the transposed linear system + +Collective + +Input Parameters: +- `mat` - the matrix +- `b` - the right-hand side +- `x` - the approximate solution + +Output Parameter: +- `r` - location to store the residual + +Level: developer + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetResidualTranspose()`, `PCMGMatResidualTransposeDefault()` + +# External Links +$(_doc_external("Ksp/PCMGResidualTransposeDefault")) +""" +function PCMGResidualTransposeDefault(petsclib::PetscLibType, mat::PetscMat, b::PetscVec, x::PetscVec, r::PetscVec) end + +@for_petsc function PCMGResidualTransposeDefault(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscVec, x::PetscVec, r::PetscVec ) + + @chk ccall( + (:PCMGResidualTransposeDefault, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec, CVec), + mat, b, x, r, + ) + + + return nothing +end + +""" + PCMGMatResidualDefault(petsclib::PetscLibType,mat::PetscMat, b::PetscMat, x::PetscMat, r::PetscMat) +Default routine to calculate the residual. + +Collective + +Input Parameters: +- `mat` - the matrix +- `b` - the right-hand side +- `x` - the approximate solution + +Output Parameter: +- `r` - location to store the residual + +Level: developer + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetMatResidual()`, `PCMGResidualDefault()` + +# External Links +$(_doc_external("Ksp/PCMGMatResidualDefault")) +""" +function PCMGMatResidualDefault(petsclib::PetscLibType, mat::PetscMat, b::PetscMat, x::PetscMat, r::PetscMat) end + +@for_petsc function PCMGMatResidualDefault(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscMat, x::PetscMat, r::PetscMat ) + + @chk ccall( + (:PCMGMatResidualDefault, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, CMat), + mat, b, x, r, + ) + + + return nothing +end + +""" + PCMGMatResidualTransposeDefault(petsclib::PetscLibType,mat::PetscMat, b::PetscMat, x::PetscMat, r::PetscMat) +Default routine to calculate the residual of the transposed linear system + +Collective + +Input Parameters: +- `mat` - the matrix +- `b` - the right-hand side +- `x` - the approximate solution + +Output Parameter: +- `r` - location to store the residual + +Level: developer + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetMatResidualTranspose()` + +# External Links +$(_doc_external("Ksp/PCMGMatResidualTransposeDefault")) +""" +function PCMGMatResidualTransposeDefault(petsclib::PetscLibType, mat::PetscMat, b::PetscMat, x::PetscMat, r::PetscMat) end + +@for_petsc function PCMGMatResidualTransposeDefault(petsclib::$UnionPetscLib, mat::PetscMat, b::PetscMat, x::PetscMat, r::PetscMat ) + + @chk ccall( + (:PCMGMatResidualTransposeDefault, $petsc_library), + PetscErrorCode, + (CMat, CMat, CMat, CMat), + mat, b, x, r, + ) + + + return nothing +end + +""" + PCMGGetCoarseSolve(petsclib::PetscLibType,pc::PC, ksp::PetscKSP) +Gets the solver context to be used on the coarse grid. + +Not Collective + +Input Parameter: +- `pc` - the multigrid context + +Output Parameter: +- `ksp` - the coarse grid solver context + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGGetSmootherUp()`, `PCMGGetSmootherDown()`, `PCMGGetSmoother()` + +# External Links +$(_doc_external("Ksp/PCMGGetCoarseSolve")) +""" +function PCMGGetCoarseSolve(petsclib::PetscLibType, pc::PC, ksp::PetscKSP) end + +@for_petsc function PCMGGetCoarseSolve(petsclib::$UnionPetscLib, pc::PC, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:PCMGGetCoarseSolve, $petsc_library), + PetscErrorCode, + (PC, Ptr{CKSP}), + pc, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + PCMGSetResidual(petsclib::PetscLibType,pc::PC, l::PetscInt, residual::external, mat::PetscMat) +Sets the function to be used to calculate the residual on the lth level. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply +- `residual` - function used to form residual, if none is provided the previously provide one is used, if no +previous one were provided then a default is used +- `mat` - matrix associated with residual + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGResidualDefault()` + +# External Links +$(_doc_external("Ksp/PCMGSetResidual")) +""" +function PCMGSetResidual(petsclib::PetscLibType, pc::PC, l::PetscInt, residual::external, mat::PetscMat) end + +@for_petsc function PCMGSetResidual(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, residual::external, mat::PetscMat ) + + @chk ccall( + (:PCMGSetResidual, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, external, CMat), + pc, l, residual, mat, + ) + + + return nothing +end + +""" + PCMGSetResidualTranspose(petsclib::PetscLibType,pc::PC, l::PetscInt, residualt::external, mat::PetscMat) +Sets the function to be used to calculate the residual of the transposed linear system +on the lth level. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply +- `residualt` - function used to form transpose of residual, if none is provided the previously provide one is used, if no +previous one were provided then a default is used +- `mat` - matrix associated with residual + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGResidualTransposeDefault()` + +# External Links +$(_doc_external("Ksp/PCMGSetResidualTranspose")) +""" +function PCMGSetResidualTranspose(petsclib::PetscLibType, pc::PC, l::PetscInt, residualt::external, mat::PetscMat) end + +@for_petsc function PCMGSetResidualTranspose(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, residualt::external, mat::PetscMat ) + + @chk ccall( + (:PCMGSetResidualTranspose, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, external, CMat), + pc, l, residualt, mat, + ) + + + return nothing +end + +""" + PCMGSetInterpolation(petsclib::PetscLibType,pc::PC, l::PetscInt, mat::PetscMat) +Sets the function to be used to calculate the +interpolation from l-1 to the lth level + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `mat` - the interpolation operator +- `l` - the level (0 is coarsest) to supply [do not supply 0] + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetRestriction()` + +# External Links +$(_doc_external("Ksp/PCMGSetInterpolation")) +""" +function PCMGSetInterpolation(petsclib::PetscLibType, pc::PC, l::PetscInt, mat::PetscMat) end + +@for_petsc function PCMGSetInterpolation(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, mat::PetscMat ) + + @chk ccall( + (:PCMGSetInterpolation, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, CMat), + pc, l, mat, + ) + + + return nothing +end + +""" + PCMGSetOperators(petsclib::PetscLibType,pc::PC, l::PetscInt, Amat::PetscMat, Pmat::PetscMat) +Sets operator and matrix from which to construct a preconditioner for lth level + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `Amat` - the operator +- `Pmat` - the preconditioning operator +- `l` - the level (0 is the coarsest) to supply + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetGalerkin()`, `PCMGSetRestriction()`, `PCMGSetInterpolation()` + +# External Links +$(_doc_external("Ksp/PCMGSetOperators")) +""" +function PCMGSetOperators(petsclib::PetscLibType, pc::PC, l::PetscInt, Amat::PetscMat, Pmat::PetscMat) end + +@for_petsc function PCMGSetOperators(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, Amat::PetscMat, Pmat::PetscMat ) + + @chk ccall( + (:PCMGSetOperators, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, CMat, CMat), + pc, l, Amat, Pmat, + ) + + + return nothing +end + +""" + PCMGGetInterpolation(petsclib::PetscLibType,pc::PC, l::PetscInt, mat::PetscMat) +Gets the function to be used to calculate the +interpolation from l-1 to the lth level + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply [Do not supply 0] + +Output Parameter: +- `mat` - the interpolation matrix, can be `NULL` + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGGetRestriction()`, `PCMGSetInterpolation()`, `PCMGGetRScale()` + +# External Links +$(_doc_external("Ksp/PCMGGetInterpolation")) +""" +function PCMGGetInterpolation(petsclib::PetscLibType, pc::PC, l::PetscInt, mat::PetscMat) end + +@for_petsc function PCMGGetInterpolation(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:PCMGGetInterpolation, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{CMat}), + pc, l, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + PCMGSetRestriction(petsclib::PetscLibType,pc::PC, l::PetscInt, mat::PetscMat) +Sets the function to be used to restrict dual vectors +from level l to l-1. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply [Do not supply 0] +- `mat` - the restriction matrix + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetInterpolation()` + +# External Links +$(_doc_external("Ksp/PCMGSetRestriction")) +""" +function PCMGSetRestriction(petsclib::PetscLibType, pc::PC, l::PetscInt, mat::PetscMat) end + +@for_petsc function PCMGSetRestriction(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, mat::PetscMat ) + + @chk ccall( + (:PCMGSetRestriction, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, CMat), + pc, l, mat, + ) + + + return nothing +end + +""" + PCMGGetRestriction(petsclib::PetscLibType,pc::PC, l::PetscInt, mat::PetscMat) +Gets the function to be used to restrict dual (i.e. residual) vectors +from level l to l-1. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply [Do not supply 0] + +Output Parameter: +- `mat` - the restriction matrix + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGGetInterpolation()`, `PCMGSetRestriction()`, `PCMGGetRScale()`, `PCMGGetInjection()` + +# External Links +$(_doc_external("Ksp/PCMGGetRestriction")) +""" +function PCMGGetRestriction(petsclib::PetscLibType, pc::PC, l::PetscInt, mat::PetscMat) end + +@for_petsc function PCMGGetRestriction(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:PCMGGetRestriction, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{CMat}), + pc, l, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + PCMGSetRScale(petsclib::PetscLibType,pc::PC, l::PetscInt, rscale::PetscVec) +Sets the pointwise scaling for the restriction operator from level l to l + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply [Do not supply 0] +- `rscale` - the scaling + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetInterpolation()`, `PCMGSetRestriction()`, `PCMGGetRScale()`, `PCMGSetInjection()` + +# External Links +$(_doc_external("Ksp/PCMGSetRScale")) +""" +function PCMGSetRScale(petsclib::PetscLibType, pc::PC, l::PetscInt, rscale::PetscVec) end + +@for_petsc function PCMGSetRScale(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, rscale::PetscVec ) + + @chk ccall( + (:PCMGSetRScale, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, CVec), + pc, l, rscale, + ) + + + return nothing +end + +""" + PCMGGetRScale(petsclib::PetscLibType,pc::PC, l::PetscInt, rscale::PetscVec) +Gets the pointwise scaling for the restriction operator from level l to l + +Collective + +Input Parameters: +- `pc` - the multigrid context +- `rscale` - the scaling +- `l` - the level (0 is coarsest) to supply [Do not supply 0] + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetInterpolation()`, `PCMGGetRestriction()`, `PCMGGetInjection()` + +# External Links +$(_doc_external("Ksp/PCMGGetRScale")) +""" +function PCMGGetRScale(petsclib::PetscLibType, pc::PC, l::PetscInt, rscale::PetscVec) end + +@for_petsc function PCMGGetRScale(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, rscale::PetscVec ) + rscale_ = Ref(rscale.ptr) + + @chk ccall( + (:PCMGGetRScale, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{CVec}), + pc, l, rscale_, + ) + + rscale.ptr = C_NULL + + return nothing +end + +""" + PCMGSetInjection(petsclib::PetscLibType,pc::PC, l::PetscInt, mat::PetscMat) +Sets the function to be used to inject primal (i.e. solution) vectors +from level l to l-1. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply [Do not supply 0] +- `mat` - the injection matrix + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetRestriction()` + +# External Links +$(_doc_external("Ksp/PCMGSetInjection")) +""" +function PCMGSetInjection(petsclib::PetscLibType, pc::PC, l::PetscInt, mat::PetscMat) end + +@for_petsc function PCMGSetInjection(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, mat::PetscMat ) + + @chk ccall( + (:PCMGSetInjection, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, CMat), + pc, l, mat, + ) + + + return nothing +end + +""" + PCMGGetInjection(petsclib::PetscLibType,pc::PC, l::PetscInt, mat::PetscMat) +Gets the function to be used to inject primal vectors (i.e. solutions) +from level l to l-1. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply [Do not supply 0] + +Output Parameter: +- `mat` - the restriction matrix (may be `NULL` if no injection is available). + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetInjection()`, `PCMGetGetRestriction()` + +# External Links +$(_doc_external("Ksp/PCMGGetInjection")) +""" +function PCMGGetInjection(petsclib::PetscLibType, pc::PC, l::PetscInt, mat::PetscMat) end + +@for_petsc function PCMGGetInjection(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:PCMGGetInjection, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{CMat}), + pc, l, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + PCMGGetSmoother(petsclib::PetscLibType,pc::PC, l::PetscInt, ksp::PetscKSP) +Gets the `KSP` context to be used as smoother for +both pre- and post-smoothing. Call both `PCMGGetSmootherUp()` and +`PCMGGetSmootherDown()` to use different functions for pre- and +post-smoothing. + +Not Collective, ksp returned is parallel if pc is + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply + +Output Parameter: +- `ksp` - the smoother + +-seealso: [](ch_ksp), `PCMG`, `PCMGGetSmootherUp()`, `PCMGGetSmootherDown()`, `PCMGGetCoarseSolve()` + +# External Links +$(_doc_external("Ksp/PCMGGetSmoother")) +""" +function PCMGGetSmoother(petsclib::PetscLibType, pc::PC, l::PetscInt, ksp::PetscKSP) end + +@for_petsc function PCMGGetSmoother(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:PCMGGetSmoother, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{CKSP}), + pc, l, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + PCMGGetSmootherUp(petsclib::PetscLibType,pc::PC, l::PetscInt, ksp::PetscKSP) +Gets the KSP context to be used as smoother after +coarse grid correction (post-smoother). + +Not Collective, ksp returned is parallel if pc is + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply + +Output Parameter: +- `ksp` - the smoother + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGGetSmootherDown()` + +# External Links +$(_doc_external("Ksp/PCMGGetSmootherUp")) +""" +function PCMGGetSmootherUp(petsclib::PetscLibType, pc::PC, l::PetscInt, ksp::PetscKSP) end + +@for_petsc function PCMGGetSmootherUp(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:PCMGGetSmootherUp, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{CKSP}), + pc, l, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + PCMGGetSmootherDown(petsclib::PetscLibType,pc::PC, l::PetscInt, ksp::PetscKSP) +Gets the `KSP` context to be used as smoother before +coarse grid correction (pre-smoother). + +Not Collective, ksp returned is parallel if pc is + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) to supply + +Output Parameter: +- `ksp` - the smoother + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGGetSmootherUp()`, `PCMGGetSmoother()` + +# External Links +$(_doc_external("Ksp/PCMGGetSmootherDown")) +""" +function PCMGGetSmootherDown(petsclib::PetscLibType, pc::PC, l::PetscInt, ksp::PetscKSP) end + +@for_petsc function PCMGGetSmootherDown(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:PCMGGetSmootherDown, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{CKSP}), + pc, l, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + PCMGSetCycleTypeOnLevel(petsclib::PetscLibType,pc::PC, l::PetscInt, c::PCMGCycleType) +Sets the type of cycle (aka cycle index) to run on the specified level. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) +- `c` - either `PC_MG_CYCLE_V` or `PC_MG_CYCLE_W` + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGCycleType`, `PCMGSetCycleType()` + +# External Links +$(_doc_external("Ksp/PCMGSetCycleTypeOnLevel")) +""" +function PCMGSetCycleTypeOnLevel(petsclib::PetscLibType, pc::PC, l::PetscInt, c::PCMGCycleType) end + +@for_petsc function PCMGSetCycleTypeOnLevel(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, c::PCMGCycleType ) + + @chk ccall( + (:PCMGSetCycleTypeOnLevel, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, PCMGCycleType), + pc, l, c, + ) + + + return nothing +end + +""" + PCMGSetRhs(petsclib::PetscLibType,pc::PC, l::PetscInt, c::PetscVec) +Sets the vector to be used to store the right + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) this is to be used for +- `c` - the Vec + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetX()`, `PCMGSetR()` + +# External Links +$(_doc_external("Ksp/PCMGSetRhs")) +""" +function PCMGSetRhs(petsclib::PetscLibType, pc::PC, l::PetscInt, c::PetscVec) end + +@for_petsc function PCMGSetRhs(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, c::PetscVec ) + + @chk ccall( + (:PCMGSetRhs, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, CVec), + pc, l, c, + ) + + + return nothing +end + +""" + PCMGSetX(petsclib::PetscLibType,pc::PC, l::PetscInt, c::PetscVec) +Sets the vector to be used to store the solution on a particular level. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) this is to be used for (do not supply the finest level) +- `c` - the Vec + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetRhs()`, `PCMGSetR()` + +# External Links +$(_doc_external("Ksp/PCMGSetX")) +""" +function PCMGSetX(petsclib::PetscLibType, pc::PC, l::PetscInt, c::PetscVec) end + +@for_petsc function PCMGSetX(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, c::PetscVec ) + + @chk ccall( + (:PCMGSetX, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, CVec), + pc, l, c, + ) + + + return nothing +end + +""" + PCMGSetR(petsclib::PetscLibType,pc::PC, l::PetscInt, c::PetscVec) +Sets the vector to be used to store the residual on a particular level. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `l` - the level (0 is coarsest) this is to be used for +- `c` - the Vec + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetRhs()`, `PCMGSetX()` + +# External Links +$(_doc_external("Ksp/PCMGSetR")) +""" +function PCMGSetR(petsclib::PetscLibType, pc::PC, l::PetscInt, c::PetscVec) end + +@for_petsc function PCMGSetR(petsclib::$UnionPetscLib, pc::PC, l::$PetscInt, c::PetscVec ) + + @chk ccall( + (:PCMGSetR, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, CVec), + pc, l, c, + ) + + + return nothing +end + +""" + PCMGSetLevels(petsclib::PetscLibType,pc::PC, levels::PetscInt, comms::MPI_Comm) +Sets the number of levels to use with `PCMG`. +Must be called before any other `PCMG` routine. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `levels` - the number of levels +- `comms` - optional communicators for each level; this is to allow solving the coarser problems +on smaller sets of processes. For processes that are not included in the computation +you must pass `MPI_COMM_NULL`. Use comms = `NULL` to specify that all processes +should participate in each level of problem. + +Options Database Key: +- `-pc_mg_levels ` - set the number of levels to use + +Level: intermediate + +-seealso: [](ch_ksp), `PCMGSetType()`, `PCMGGetLevels()` + +# External Links +$(_doc_external("Ksp/PCMGSetLevels")) +""" +function PCMGSetLevels(petsclib::PetscLibType, pc::PC, levels::PetscInt, comms::MPI_Comm) end + +@for_petsc function PCMGSetLevels(petsclib::$UnionPetscLib, pc::PC, levels::$PetscInt, comms::MPI_Comm ) + + @chk ccall( + (:PCMGSetLevels, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{MPI_Comm}), + pc, levels, comms, + ) + + + return nothing +end + +""" + levels::PetscInt = PCMGGetLevels(petsclib::PetscLibType,pc::PC) +Gets the number of levels to use with `PCMG`. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `levels` - the number of levels + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetLevels()` + +# External Links +$(_doc_external("Ksp/PCMGGetLevels")) +""" +function PCMGGetLevels(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCMGGetLevels(petsclib::$UnionPetscLib, pc::PC ) + levels_ = Ref{$PetscInt}() + + @chk ccall( + (:PCMGGetLevels, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}), + pc, levels_, + ) + + levels = levels_[] + + return levels +end + +""" + gc::PetscReal,oc::PetscReal = PCMGGetGridComplexity(petsclib::PetscLibType,pc::PC) +compute operator and grid complexity of the `PCMG` hierarchy + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `gc` - grid complexity = sum_i(n_i) / n_0 +- `oc` - operator complexity = sum_i(nnz_i) / nnz_0 + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGGetLevels()`, `PCMGSetLevels()` + +# External Links +$(_doc_external("Ksp/PCMGGetGridComplexity")) +""" +function PCMGGetGridComplexity(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCMGGetGridComplexity(petsclib::$UnionPetscLib, pc::PC ) + gc_ = Ref{$PetscReal}() + oc_ = Ref{$PetscReal}() + + @chk ccall( + (:PCMGGetGridComplexity, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscReal}, Ptr{$PetscReal}), + pc, gc_, oc_, + ) + + gc = gc_[] + oc = oc_[] + + return gc,oc +end + +""" + PCMGSetType(petsclib::PetscLibType,pc::PC, form::PCMGType) +Determines the form of multigrid to use, either +multiplicative, additive, full, or the Kaskade algorithm. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `form` - multigrid form, one of `PC_MG_MULTIPLICATIVE`, `PC_MG_ADDITIVE`, `PC_MG_FULL`, `PC_MG_KASKADE` + +Options Database Key: +- `-pc_mg_type
` - Sets , one of multiplicative, additive, full, kaskade + +Level: advanced + +-seealso: [](ch_ksp), `PCMGType`, `PCMG`, `PCMGGetLevels()`, `PCMGSetLevels()`, `PCMGGetType()`, `PCMGCycleType` + +# External Links +$(_doc_external("Ksp/PCMGSetType")) +""" +function PCMGSetType(petsclib::PetscLibType, pc::PC, form::PCMGType) end + +@for_petsc function PCMGSetType(petsclib::$UnionPetscLib, pc::PC, form::PCMGType ) + + @chk ccall( + (:PCMGSetType, $petsc_library), + PetscErrorCode, + (PC, PCMGType), + pc, form, + ) + + + return nothing +end + +""" + type::PCMGType = PCMGGetType(petsclib::PetscLibType,pc::PC) +Finds the form of multigrid the `PCMG` is using multiplicative, additive, full, or the Kaskade algorithm. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `type` - one of `PC_MG_MULTIPLICATIVE`, `PC_MG_ADDITIVE`, `PC_MG_FULL`, `PC_MG_KASKADE`, `PCMGCycleType` + +Level: advanced + +-seealso: [](ch_ksp), `PCMGType`, `PCMG`, `PCMGGetLevels()`, `PCMGSetLevels()`, `PCMGSetType()` + +# External Links +$(_doc_external("Ksp/PCMGGetType")) +""" +function PCMGGetType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCMGGetType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{PCMGType}() + + @chk ccall( + (:PCMGGetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCMGType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PCMGSetCycleType(petsclib::PetscLibType,pc::PC, n::PCMGCycleType) +Sets the type cycles to use. Use `PCMGSetCycleTypeOnLevel()` for more +complicated cycling. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `n` - either `PC_MG_CYCLE_V` or `PC_MG_CYCLE_W` + +Options Database Key: +- `-pc_mg_cycle_type ` - provide the cycle desired + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetCycleTypeOnLevel()`, `PCMGType`, `PCMGCycleType` + +# External Links +$(_doc_external("Ksp/PCMGSetCycleType")) +""" +function PCMGSetCycleType(petsclib::PetscLibType, pc::PC, n::PCMGCycleType) end + +@for_petsc function PCMGSetCycleType(petsclib::$UnionPetscLib, pc::PC, n::PCMGCycleType ) + + @chk ccall( + (:PCMGSetCycleType, $petsc_library), + PetscErrorCode, + (PC, PCMGCycleType), + pc, n, + ) + + + return nothing +end + +""" + PCMGMultiplicativeSetCycles(petsclib::PetscLibType,pc::PC, n::PetscInt) +Sets the number of cycles to use for each preconditioner step +of multigrid when `PCMGType` is `PC_MG_MULTIPLICATIVE` + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `n` - number of cycles (default is 1) + +Options Database Key: +- `-pc_mg_multiplicative_cycles n` - set the number of cycles + +Level: advanced + +-seealso: [](ch_ksp), `PCMGSetCycleTypeOnLevel()`, `PCMGSetCycleType()`, `PCMGCycleType`, `PCMGType` + +# External Links +$(_doc_external("Ksp/PCMGMultiplicativeSetCycles")) +""" +function PCMGMultiplicativeSetCycles(petsclib::PetscLibType, pc::PC, n::PetscInt) end + +@for_petsc function PCMGMultiplicativeSetCycles(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt ) + + @chk ccall( + (:PCMGMultiplicativeSetCycles, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, n, + ) + + + return nothing +end + +""" + PCMGSetGalerkin(petsclib::PetscLibType,pc::PC, use::PCMGGalerkinType) +Causes the coarser grid matrices to be computed from the +finest grid via the Galerkin process: A_i-1 = r_i * A_i * p_i + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `use` - one of `PC_MG_GALERKIN_BOTH`, `PC_MG_GALERKIN_PMAT`, `PC_MG_GALERKIN_MAT`, or `PC_MG_GALERKIN_NONE` + +Options Database Key: +- `-pc_mg_galerkin ` - set the matrices to form via the Galerkin process + +Level: intermediate + +-seealso: [](ch_ksp), `PCMG`, `PCMGGetGalerkin()`, `PCMGGalerkinType` + +# External Links +$(_doc_external("Ksp/PCMGSetGalerkin")) +""" +function PCMGSetGalerkin(petsclib::PetscLibType, pc::PC, use::PCMGGalerkinType) end + +@for_petsc function PCMGSetGalerkin(petsclib::$UnionPetscLib, pc::PC, use::PCMGGalerkinType ) + + @chk ccall( + (:PCMGSetGalerkin, $petsc_library), + PetscErrorCode, + (PC, PCMGGalerkinType), + pc, use, + ) + + + return nothing +end + +""" + PCMGGetGalerkin(petsclib::PetscLibType,pc::PC, galerkin::PCMGGalerkinType) +Checks if Galerkin multigrid is being used, i.e. A_i + +Not Collective + +Input Parameter: +- `pc` - the multigrid context + +Output Parameter: +- `galerkin` - one of `PC_MG_GALERKIN_BOTH`,`PC_MG_GALERKIN_PMAT`,`PC_MG_GALERKIN_MAT`, `PC_MG_GALERKIN_NONE`, or `PC_MG_GALERKIN_EXTERNAL` + +Level: intermediate + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetGalerkin()`, `PCMGGalerkinType` + +# External Links +$(_doc_external("Ksp/PCMGGetGalerkin")) +""" +function PCMGGetGalerkin(petsclib::PetscLibType, pc::PC, galerkin::PCMGGalerkinType) end + +@for_petsc function PCMGGetGalerkin(petsclib::$UnionPetscLib, pc::PC, galerkin::PCMGGalerkinType ) + + @chk ccall( + (:PCMGGetGalerkin, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCMGGalerkinType}), + pc, galerkin, + ) + + + return nothing +end + +""" + PCMGSetAdaptCoarseSpaceType(petsclib::PetscLibType,pc::PC, ctype::PCMGCoarseSpaceType) +Set the type of adaptive coarse space. + +Adapts or creates the interpolator based upon a vector space which should be accurately captured by the next coarser mesh, and thus accurately interpolated. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `ctype` - the type of coarse space + +Options Database Keys: +- `-pc_mg_adapt_interp_n ` - The number of modes to use +- `-pc_mg_adapt_interp_coarse_space ` - The type of coarse space: none, `polynomial`, `harmonic`, `eigenvector`, `generalized_eigenvector`, `gdsw` + +Level: intermediate + +-seealso: [](ch_ksp), `PCMG`, `PCMGCoarseSpaceType`, `PCMGGetAdaptCoarseSpaceType()`, `PCMGSetGalerkin()`, `PCMGSetAdaptInterpolation()`, `DM` + +# External Links +$(_doc_external("Ksp/PCMGSetAdaptCoarseSpaceType")) +""" +function PCMGSetAdaptCoarseSpaceType(petsclib::PetscLibType, pc::PC, ctype::PCMGCoarseSpaceType) end + +@for_petsc function PCMGSetAdaptCoarseSpaceType(petsclib::$UnionPetscLib, pc::PC, ctype::PCMGCoarseSpaceType ) + + @chk ccall( + (:PCMGSetAdaptCoarseSpaceType, $petsc_library), + PetscErrorCode, + (PC, PCMGCoarseSpaceType), + pc, ctype, + ) + + + return nothing +end + +""" + ctype::PCMGCoarseSpaceType = PCMGGetAdaptCoarseSpaceType(petsclib::PetscLibType,pc::PC) +Get the type of adaptive coarse space. + +Not Collective + +Input Parameter: +- `pc` - the multigrid context + +Output Parameter: +- `ctype` - the type of coarse space + +Level: intermediate + +-seealso: [](ch_ksp), `PCMG`, `PCMGCoarseSpaceType`, `PCMGSetAdaptCoarseSpaceType()`, `PCMGSetGalerkin()`, `PCMGSetAdaptInterpolation()` + +# External Links +$(_doc_external("Ksp/PCMGGetAdaptCoarseSpaceType")) +""" +function PCMGGetAdaptCoarseSpaceType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCMGGetAdaptCoarseSpaceType(petsclib::$UnionPetscLib, pc::PC ) + ctype_ = Ref{PCMGCoarseSpaceType}() + + @chk ccall( + (:PCMGGetAdaptCoarseSpaceType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCMGCoarseSpaceType}), + pc, ctype_, + ) + + ctype = unsafe_string(ctype_[]) + + return ctype +end + +""" + PCMGSetAdaptInterpolation(petsclib::PetscLibType,pc::PC, adapt::PetscBool) +Adapt the interpolator based upon a vector space which should be accurately captured by the next coarser mesh, and thus accurately interpolated. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `adapt` - flag for adaptation of the interpolator + +Options Database Keys: +- `-pc_mg_adapt_interp` - Turn on adaptation +- `-pc_mg_adapt_interp_n ` - The number of modes to use, should be divisible by dimension +- `-pc_mg_adapt_interp_coarse_space ` - The type of coarse space: polynomial, harmonic, eigenvector, generalized_eigenvector + +Level: intermediate + +-seealso: [](ch_ksp), `PCMG`, `PCMGGetAdaptInterpolation()`, `PCMGSetGalerkin()`, `PCMGGetAdaptCoarseSpaceType()`, `PCMGSetAdaptCoarseSpaceType()` + +# External Links +$(_doc_external("Ksp/PCMGSetAdaptInterpolation")) +""" +function PCMGSetAdaptInterpolation(petsclib::PetscLibType, pc::PC, adapt::PetscBool) end + +@for_petsc function PCMGSetAdaptInterpolation(petsclib::$UnionPetscLib, pc::PC, adapt::PetscBool ) + + @chk ccall( + (:PCMGSetAdaptInterpolation, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, adapt, + ) + + + return nothing +end + +""" + adapt::PetscBool = PCMGGetAdaptInterpolation(petsclib::PetscLibType,pc::PC) +Get the flag to adapt the interpolator based upon a vector space which should be accurately captured by the next coarser mesh, +and thus accurately interpolated. + +Not Collective + +Input Parameter: +- `pc` - the multigrid context + +Output Parameter: +- `adapt` - flag for adaptation of the interpolator + +Level: intermediate + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetAdaptInterpolation()`, `PCMGSetGalerkin()`, `PCMGGetAdaptCoarseSpaceType()`, `PCMGSetAdaptCoarseSpaceType()` + +# External Links +$(_doc_external("Ksp/PCMGGetAdaptInterpolation")) +""" +function PCMGGetAdaptInterpolation(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCMGGetAdaptInterpolation(petsclib::$UnionPetscLib, pc::PC ) + adapt_ = Ref{PetscBool}() + + @chk ccall( + (:PCMGGetAdaptInterpolation, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, adapt_, + ) + + adapt = adapt_[] + + return adapt +end + +""" + PCMGSetAdaptCR(petsclib::PetscLibType,pc::PC, cr::PetscBool) +Monitor the coarse space quality using an auxiliary solve with compatible relaxation. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `cr` - flag for compatible relaxation + +Options Database Key: +- `-pc_mg_adapt_cr` - Turn on compatible relaxation + +Level: intermediate + +-seealso: [](ch_ksp), `PCMG`, `PCMGGetAdaptCR()`, `PCMGSetAdaptInterpolation()`, `PCMGSetGalerkin()`, `PCMGGetAdaptCoarseSpaceType()`, `PCMGSetAdaptCoarseSpaceType()` + +# External Links +$(_doc_external("Ksp/PCMGSetAdaptCR")) +""" +function PCMGSetAdaptCR(petsclib::PetscLibType, pc::PC, cr::PetscBool) end + +@for_petsc function PCMGSetAdaptCR(petsclib::$UnionPetscLib, pc::PC, cr::PetscBool ) + + @chk ccall( + (:PCMGSetAdaptCR, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, cr, + ) + + + return nothing +end + +""" + cr::PetscBool = PCMGGetAdaptCR(petsclib::PetscLibType,pc::PC) +Get the flag to monitor coarse space quality using an auxiliary solve with compatible relaxation. + +Not Collective + +Input Parameter: +- `pc` - the multigrid context + +Output Parameter: +- `cr` - flag for compatible relaxaion + +Level: intermediate + +-seealso: [](ch_ksp), `PCMGSetAdaptCR()`, `PCMGGetAdaptInterpolation()`, `PCMGSetGalerkin()`, `PCMGGetAdaptCoarseSpaceType()`, `PCMGSetAdaptCoarseSpaceType()` + +# External Links +$(_doc_external("Ksp/PCMGGetAdaptCR")) +""" +function PCMGGetAdaptCR(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCMGGetAdaptCR(petsclib::$UnionPetscLib, pc::PC ) + cr_ = Ref{PetscBool}() + + @chk ccall( + (:PCMGGetAdaptCR, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, cr_, + ) + + cr = cr_[] + + return cr +end + +""" + PCMGSetNumberSmooth(petsclib::PetscLibType,pc::PC, n::PetscInt) +Sets the number of pre and post +on all levels. Use `PCMGDistinctSmoothUp()` to create separate up and down smoothers if you want different numbers of +pre- and post-smoothing steps. + +Logically Collective + +Input Parameters: +- `pc` - the multigrid context +- `n` - the number of smoothing steps + +Options Database Key: +- `-mg_levels_ksp_max_it ` - Sets number of pre and post-smoothing steps + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetDistinctSmoothUp()` + +# External Links +$(_doc_external("Ksp/PCMGSetNumberSmooth")) +""" +function PCMGSetNumberSmooth(petsclib::PetscLibType, pc::PC, n::PetscInt) end + +@for_petsc function PCMGSetNumberSmooth(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt ) + + @chk ccall( + (:PCMGSetNumberSmooth, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, n, + ) + + + return nothing +end + +""" + PCMGSetDistinctSmoothUp(petsclib::PetscLibType,pc::PC) +sets the up (post) smoother to be a separate `KSP` from the down (pre) smoother on all levels +and adds the suffix _up to the options name + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Options Database Key: +- `-pc_mg_distinct_smoothup ` - use distinct smoothing objects + +Level: advanced + +-seealso: [](ch_ksp), `PCMG`, `PCMGSetNumberSmooth()` + +# External Links +$(_doc_external("Ksp/PCMGSetDistinctSmoothUp")) +""" +function PCMGSetDistinctSmoothUp(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCMGSetDistinctSmoothUp(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCMGSetDistinctSmoothUp, $petsc_library), + PetscErrorCode, + (PC,), + pc, + ) + + + return nothing +end + +""" + PCMGRegisterCoarseSpaceConstructor(petsclib::PetscLibType,name::String, fnc::PCMGCoarseSpaceConstructorFn) +Adds a method to the `PCMG` package for coarse space construction. + +Not Collective, No Fortran Support + +Input Parameters: +- `name` - name of the constructor +- `function` - constructor routine, see `PCMGCoarseSpaceConstructorFn` + +Level: advanced + +-seealso: [](ch_ksp), `PCMGCoarseSpaceConstructorFn`, `PCMG`, `PCMGGetCoarseSpaceConstructor()`, `PCRegister()` + +# External Links +$(_doc_external("Ksp/PCMGRegisterCoarseSpaceConstructor")) +""" +function PCMGRegisterCoarseSpaceConstructor(petsclib::PetscLibType, name::String, fnc::PCMGCoarseSpaceConstructorFn) end + +@for_petsc function PCMGRegisterCoarseSpaceConstructor(petsclib::$UnionPetscLib, name::String, fnc::PCMGCoarseSpaceConstructorFn ) + + @chk ccall( + (:PCMGRegisterCoarseSpaceConstructor, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PCMGCoarseSpaceConstructorFn}), + name, fnc, + ) + + + return nothing +end + +""" + PCMGGetCoarseSpaceConstructor(petsclib::PetscLibType,name::String, fnc::PCMGCoarseSpaceConstructorFn) +Returns the given coarse space construction method. + +Not Collective, No Fortran Support + +Input Parameter: +- `name` - name of the constructor + +Output Parameter: +- `function` - constructor routine + +Level: advanced + +-seealso: [](ch_ksp), `PCMGCoarseSpaceConstructorFn`, `PCMG`, `PCMGRegisterCoarseSpaceConstructor()`, `PCRegister()` + +# External Links +$(_doc_external("Ksp/PCMGGetCoarseSpaceConstructor")) +""" +function PCMGGetCoarseSpaceConstructor(petsclib::PetscLibType, name::String, fnc::PCMGCoarseSpaceConstructorFn) end + +@for_petsc function PCMGGetCoarseSpaceConstructor(petsclib::$UnionPetscLib, name::String, fnc::PCMGCoarseSpaceConstructorFn ) + + @chk ccall( + (:PCMGGetCoarseSpaceConstructor, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, PCMGCoarseSpaceConstructorFn), + name, fnc, + ) + + + return nothing +end + +""" + PCHMGSetReuseInterpolation(petsclib::PetscLibType,pc::PC, reuse::PetscBool) +Reuse the interpolation matrices in `PCHMG` after changing the matrices numerical values + +Logically Collective + +Input Parameters: +- `pc` - the `PCHMG` context +- `reuse` - `PETSC_TRUE` indicates that `PCHMG` will reuse the interpolations + +Options Database Key: +- `-pc_hmg_reuse_interpolation ` - Whether or not to reuse the interpolations. If true, it potentially save the compute time. + +Level: beginner + +-seealso: [](ch_ksp), `PCHMG`, `PCGAMG`, `PCHMGSetUseSubspaceCoarsening()`, `PCHMGSetCoarseningComponent()`, `PCHMGSetInnerPCType()` + +# External Links +$(_doc_external("Ksp/PCHMGSetReuseInterpolation")) +""" +function PCHMGSetReuseInterpolation(petsclib::PetscLibType, pc::PC, reuse::PetscBool) end + +@for_petsc function PCHMGSetReuseInterpolation(petsclib::$UnionPetscLib, pc::PC, reuse::PetscBool ) + + @chk ccall( + (:PCHMGSetReuseInterpolation, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, reuse, + ) + + + return nothing +end + +""" + PCHMGSetUseSubspaceCoarsening(petsclib::PetscLibType,pc::PC, subspace::PetscBool) +Use subspace coarsening in `PCHMG` + +Logically Collective + +Input Parameters: +- `pc` - the `PCHMG` context +- `subspace` - `PETSC_TRUE` indicates that `PCHMG` will use the subspace coarsening + +Options Database Key: +- `-pc_hmg_use_subspace_coarsening ` - Whether or not to use subspace coarsening (that is, coarsen a submatrix). + +Level: beginner + +-seealso: [](ch_ksp), `PCHMG`, `PCHMGSetReuseInterpolation()`, `PCHMGSetCoarseningComponent()`, `PCHMGSetInnerPCType()` + +# External Links +$(_doc_external("Ksp/PCHMGSetUseSubspaceCoarsening")) +""" +function PCHMGSetUseSubspaceCoarsening(petsclib::PetscLibType, pc::PC, subspace::PetscBool) end + +@for_petsc function PCHMGSetUseSubspaceCoarsening(petsclib::$UnionPetscLib, pc::PC, subspace::PetscBool ) + + @chk ccall( + (:PCHMGSetUseSubspaceCoarsening, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, subspace, + ) + + + return nothing +end + +""" + PCHMGSetInnerPCType(petsclib::PetscLibType,pc::PC, type::PCType) +Set an inner `PC` type to be used in the `PCHMG` preconditioner. That is the method used to compute +the hierarchy of restriction operators. + +Logically Collective + +Input Parameters: +- `pc` - the `PCHMG` context +- `type` - `PCHYPRE` or `PCGAMG` coarsening algorithm + +Options Database Key: +- `-hmg_inner_pc_type ` - What method is used to coarsen matrix + +Level: beginner + +-seealso: [](ch_ksp), `PCHMG`, `PCType`, `PCHMGSetReuseInterpolation()`, `PCHMGSetUseSubspaceCoarsening()`, `PCHMGSetCoarseningComponent()` + +# External Links +$(_doc_external("Ksp/PCHMGSetInnerPCType")) +""" +function PCHMGSetInnerPCType(petsclib::PetscLibType, pc::PC, type::PCType) end + +@for_petsc function PCHMGSetInnerPCType(petsclib::$UnionPetscLib, pc::PC, type::PCType ) + + @chk ccall( + (:PCHMGSetInnerPCType, $petsc_library), + PetscErrorCode, + (PC, PCType), + pc, type, + ) + + + return nothing +end + +""" + PCHMGSetCoarseningComponent(petsclib::PetscLibType,pc::PC, component::PetscInt) +Set which component of the PDE is used for the subspace + +Logically Collective + +Input Parameters: +- `pc` - the `PCHMG` context +- `component` - which component `PC` will coarsen + +Options Database Key: +- `-pc_hmg_coarsening_component ` - Which component is chosen for the subspace-based coarsening algorithm + +Level: beginner + +-seealso: [](ch_ksp), `PCHMG`, `PCType`, `PCGAMG`, `PCHMGSetReuseInterpolation()`, `PCHMGSetUseSubspaceCoarsening()`, `PCHMGSetInnerPCType()` + +# External Links +$(_doc_external("Ksp/PCHMGSetCoarseningComponent")) +""" +function PCHMGSetCoarseningComponent(petsclib::PetscLibType, pc::PC, component::PetscInt) end + +@for_petsc function PCHMGSetCoarseningComponent(petsclib::$UnionPetscLib, pc::PC, component::$PetscInt ) + + @chk ccall( + (:PCHMGSetCoarseningComponent, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, component, + ) + + + return nothing +end + +""" + PCHMGUseMatMAIJ(petsclib::PetscLibType,pc::PC, usematmaij::PetscBool) +Set a flag that indicates if or not to use `MATMAIJ` for the interpolation matrices to save memory + +Logically Collective + +Input Parameters: +- `pc` - the `PCHMG` context +- `usematmaij` - `PETSC_TRUE` (default) to use `MATMAIJ` for interpolations. + +Options Database Key: +- `-pc_hmg_use_matmaij` - + +Level: beginner + +-seealso: [](ch_ksp), `PCHMG`, `PCType`, `PCGAMG` + +# External Links +$(_doc_external("Ksp/PCHMGUseMatMAIJ")) +""" +function PCHMGUseMatMAIJ(petsclib::PetscLibType, pc::PC, usematmaij::PetscBool) end + +@for_petsc function PCHMGUseMatMAIJ(petsclib::$UnionPetscLib, pc::PC, usematmaij::PetscBool ) + + @chk ccall( + (:PCHMGUseMatMAIJ, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, usematmaij, + ) + + + return nothing +end + +""" + PCTelescopeGetKSP(petsclib::PetscLibType,pc::PC, subksp::PetscKSP) +Gets the `KSP` created by the telescoping `PC`. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `subksp` - the `KSP` defined on the smaller set of processes + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `KSP`, `PCTELESCOPE` + +# External Links +$(_doc_external("Ksp/PCTelescopeGetKSP")) +""" +function PCTelescopeGetKSP(petsclib::PetscLibType, pc::PC, subksp::PetscKSP) end + +@for_petsc function PCTelescopeGetKSP(petsclib::$UnionPetscLib, pc::PC, subksp::PetscKSP ) + subksp_ = Ref(subksp.ptr) + + @chk ccall( + (:PCTelescopeGetKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{CKSP}), + pc, subksp_, + ) + + subksp.ptr = C_NULL + + return nothing +end + +""" + fact::PetscInt = PCTelescopeGetReductionFactor(petsclib::PetscLibType,pc::PC) +Gets the factor by which the original number of MPI processes has been reduced by that was set by +`PCTelescopeSetReductionFactor()` + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `fact` - the reduction factor + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCTELESCOPE`, `PCTelescopeSetReductionFactor()` + +# External Links +$(_doc_external("Ksp/PCTelescopeGetReductionFactor")) +""" +function PCTelescopeGetReductionFactor(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCTelescopeGetReductionFactor(petsclib::$UnionPetscLib, pc::PC ) + fact_ = Ref{$PetscInt}() + + @chk ccall( + (:PCTelescopeGetReductionFactor, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}), + pc, fact_, + ) + + fact = fact_[] + + return fact +end + +""" + fact::PetscInt = PCTelescopeSetReductionFactor(petsclib::PetscLibType,pc::PC) +Sets the factor by which the original number of MPI processes will been reduced by when +constructing the subcommunicator to be used with the `PCTELESCOPE`. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `fact` - the reduction factor + +Level: advanced + +-seealso: [](ch_ksp), `PCTELESCOPE`, `PCTelescopeGetReductionFactor()` + +# External Links +$(_doc_external("Ksp/PCTelescopeSetReductionFactor")) +""" +function PCTelescopeSetReductionFactor(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCTelescopeSetReductionFactor(petsclib::$UnionPetscLib, pc::PC ) + fact_ = Ref{$PetscInt}() + + @chk ccall( + (:PCTelescopeSetReductionFactor, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, fact_, + ) + + fact = fact_[] + + return fact +end + +""" + v::PetscBool = PCTelescopeGetIgnoreDM(petsclib::PetscLibType,pc::PC) +Get the flag indicating if any `DM` attached to the `PC` will be used in constructing the `PC` on the +reduced number of MPI processes + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `v` - the flag + +Level: advanced + +-seealso: [](ch_ksp), `DM`, `PCTELESCOPE`, `PCTelescopeSetIgnoreDM()` + +# External Links +$(_doc_external("Ksp/PCTelescopeGetIgnoreDM")) +""" +function PCTelescopeGetIgnoreDM(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCTelescopeGetIgnoreDM(petsclib::$UnionPetscLib, pc::PC ) + v_ = Ref{PetscBool}() + + @chk ccall( + (:PCTelescopeGetIgnoreDM, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, v_, + ) + + v = v_[] + + return v +end + +""" + v::PetscBool = PCTelescopeSetIgnoreDM(petsclib::PetscLibType,pc::PC) +Set a flag to ignore any `DM` attached to the `PC` when constructing the `PC` on the +reduced number of MPI processes + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `v` - Use `PETSC_TRUE` to ignore any `DM` + +Level: advanced + +-seealso: [](ch_ksp), `DM`, `PCTELESCOPE`, `PCTelescopeGetIgnoreDM()` + +# External Links +$(_doc_external("Ksp/PCTelescopeSetIgnoreDM")) +""" +function PCTelescopeSetIgnoreDM(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCTelescopeSetIgnoreDM(petsclib::$UnionPetscLib, pc::PC ) + v_ = Ref{PetscBool}() + + @chk ccall( + (:PCTelescopeSetIgnoreDM, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, v_, + ) + + v = v_[] + + return v +end + +""" + v::PetscBool = PCTelescopeGetUseCoarseDM(petsclib::PetscLibType,pc::PC) +Get the flag indicating if the coarse `DM` attached to `DM` associated with the `PC` will be used in constructing +the `PC` on the reduced number of MPI processes + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `v` - the flag + +Level: advanced + +-seealso: [](ch_ksp), `DM`, `PCTELESCOPE`, `PCTelescopeSetIgnoreDM()`, `PCTelescopeSetUseCoarseDM()` + +# External Links +$(_doc_external("Ksp/PCTelescopeGetUseCoarseDM")) +""" +function PCTelescopeGetUseCoarseDM(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCTelescopeGetUseCoarseDM(petsclib::$UnionPetscLib, pc::PC ) + v_ = Ref{PetscBool}() + + @chk ccall( + (:PCTelescopeGetUseCoarseDM, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, v_, + ) + + v = v_[] + + return v +end + +""" + v::PetscBool = PCTelescopeSetUseCoarseDM(petsclib::PetscLibType,pc::PC) +Set a flag to query the `DM` attached to the `PC` if it also has a coarse `DM` and utilize that `DM` +in constructing the `PC` on the reduced number of MPI processes + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `v` - Use `PETSC_FALSE` to ignore any coarse `DM` + +Level: advanced + +-seealso: [](ch_ksp), `DM`, `PCTELESCOPE`, `PCTelescopeSetIgnoreDM()` + +# External Links +$(_doc_external("Ksp/PCTelescopeSetUseCoarseDM")) +""" +function PCTelescopeSetUseCoarseDM(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCTelescopeSetUseCoarseDM(petsclib::$UnionPetscLib, pc::PC ) + v_ = Ref{PetscBool}() + + @chk ccall( + (:PCTelescopeSetUseCoarseDM, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, v_, + ) + + v = v_[] + + return v +end + +""" + v::PetscBool = PCTelescopeGetIgnoreKSPComputeOperators(petsclib::PetscLibType,pc::PC) +Get the flag indicating if `KSPComputeOperators()` will be used to construct +the matrix on the reduced number of MPI processes + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `v` - the flag + +Level: advanced + +-seealso: [](ch_ksp), `PCTELESCOPE`, `PCTelescopeSetIgnoreDM()`, `PCTelescopeSetUseCoarseDM()`, `PCTelescopeSetIgnoreKSPComputeOperators()` + +# External Links +$(_doc_external("Ksp/PCTelescopeGetIgnoreKSPComputeOperators")) +""" +function PCTelescopeGetIgnoreKSPComputeOperators(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCTelescopeGetIgnoreKSPComputeOperators(petsclib::$UnionPetscLib, pc::PC ) + v_ = Ref{PetscBool}() + + @chk ccall( + (:PCTelescopeGetIgnoreKSPComputeOperators, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, v_, + ) + + v = v_[] + + return v +end + +""" + v::PetscBool = PCTelescopeSetIgnoreKSPComputeOperators(petsclib::PetscLibType,pc::PC) +Set a flag to have `PCTELESCOPE` ignore the function provided to `KSPComputeOperators()` in +constructint the matrix on the reduced number of MPI processes + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `v` - Use `PETSC_TRUE` to ignore the function (if defined) set via `KSPSetComputeOperators()` on `pc` + +Level: advanced + +-seealso: [](ch_ksp), `PCTELESCOPE`, `PCTelescopeSetIgnoreDM()`, `PCTelescopeSetUseCoarseDM()`, `PCTelescopeGetIgnoreKSPComputeOperators()` + +# External Links +$(_doc_external("Ksp/PCTelescopeSetIgnoreKSPComputeOperators")) +""" +function PCTelescopeSetIgnoreKSPComputeOperators(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCTelescopeSetIgnoreKSPComputeOperators(petsclib::$UnionPetscLib, pc::PC ) + v_ = Ref{PetscBool}() + + @chk ccall( + (:PCTelescopeSetIgnoreKSPComputeOperators, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, v_, + ) + + v = v_[] + + return v +end + +""" + subdm::PetscDM = PCTelescopeGetDM(petsclib::PetscLibType,pc::PC) +Get the re + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `subdm` - The re-partitioned `DM` + +Level: advanced + +-seealso: [](ch_ksp), `DM`, `PCTELESCOPE`, `PCTelescopeSetIgnoreDM()`, `PCTelescopeSetUseCoarseDM()`, `PCTelescopeGetIgnoreKSPComputeOperators()` + +# External Links +$(_doc_external("Ksp/PCTelescopeGetDM")) +""" +function PCTelescopeGetDM(petsclib::PetscLibType, pc::PC, subdm::PetscDM) end + +@for_petsc function PCTelescopeGetDM(petsclib::$UnionPetscLib, pc::PC, subdm::PetscDM ) + subdm_ = Ref{CDM}() + + @chk ccall( + (:PCTelescopeGetDM, $petsc_library), + PetscErrorCode, + (PC, Ptr{CDM}), + pc, subdm_, + ) + + subdm = PetscDM(subdm_[], petsclib) + + return subdm +end + +""" + PCTelescopeSetSubcommType(petsclib::PetscLibType,pc::PC, subcommtype::PetscSubcommType) +set subcommunicator type `PetscSubcommType` (interlaced or contiguous) to be used when +the subcommunicator is generated from the given `PC` + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `subcommtype` - the subcommunicator type (see `PetscSubcommType`) + +Level: advanced + +-seealso: [](ch_ksp), `PetscSubcommType`, `PetscSubcomm`, `PCTELESCOPE`, `PCTelescopeGetSubcommType()` + +# External Links +$(_doc_external("Ksp/PCTelescopeSetSubcommType")) +""" +function PCTelescopeSetSubcommType(petsclib::PetscLibType, pc::PC, subcommtype::PetscSubcommType) end + +@for_petsc function PCTelescopeSetSubcommType(petsclib::$UnionPetscLib, pc::PC, subcommtype::PetscSubcommType ) + + @chk ccall( + (:PCTelescopeSetSubcommType, $petsc_library), + PetscErrorCode, + (PC, PetscSubcommType), + pc, subcommtype, + ) + + + return nothing +end + +""" + subcommtype::PetscSubcommType = PCTelescopeGetSubcommType(petsclib::PetscLibType,pc::PC) +Get the subcommunicator type `PetscSubcommType` (interlaced or contiguous) set with `PCTelescopeSetSubcommType()` + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `subcommtype` - the subcommunicator type (see `PetscSubcommType`) + +Level: advanced + +-seealso: [](ch_ksp), `PetscSubcomm`, `PetscSubcommType`, `PCTELESCOPE`, `PCTelescopeSetSubcommType()` + +# External Links +$(_doc_external("Ksp/PCTelescopeGetSubcommType")) +""" +function PCTelescopeGetSubcommType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCTelescopeGetSubcommType(petsclib::$UnionPetscLib, pc::PC ) + subcommtype_ = Ref{PetscSubcommType}() + + @chk ccall( + (:PCTelescopeGetSubcommType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscSubcommType}), + pc, subcommtype_, + ) + + subcommtype = unsafe_string(subcommtype_[]) + + return subcommtype +end + +""" + PCShellGetContext(petsclib::PetscLibType,pc::PC, ctx::Cvoid) +Returns the user + +Not Collective + +Input Parameter: +- `pc` - of type `PCSHELL` + +Output Parameter: +- `ctx` - the user provided context + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCSHELL`, `PCShellSetContext()`, `PCShellSetApply()`, `PCShellSetDestroy()` + +# External Links +$(_doc_external("Ksp/PCShellGetContext")) +""" +function PCShellGetContext(petsclib::PetscLibType, pc::PC, ctx::Cvoid) end + +@for_petsc function PCShellGetContext(petsclib::$UnionPetscLib, pc::PC, ctx::Cvoid ) + + @chk ccall( + (:PCShellGetContext, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cvoid}), + pc, ctx, + ) + + + return nothing +end + +""" + PCShellSetContext(petsclib::PetscLibType,pc::PC, ctx::Cvoid) +sets the context for a shell `PC` that can be accessed with `PCShellGetContext()` + +Logically Collective + +Input Parameters: +- `pc` - the `PC` of type `PCSHELL` +- `ctx` - the context + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCShellGetContext()`, `PCSHELL`, `PCShellSetApply()`, `PCShellSetDestroy()` + +# External Links +$(_doc_external("Ksp/PCShellSetContext")) +""" +function PCShellSetContext(petsclib::PetscLibType, pc::PC, ctx::Cvoid) end + +@for_petsc function PCShellSetContext(petsclib::$UnionPetscLib, pc::PC, ctx::Cvoid ) + + @chk ccall( + (:PCShellSetContext, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cvoid}), + pc, ctx, + ) + + + return nothing +end + +""" + PCShellSetDestroy(petsclib::PetscLibType,pc::PC, destroy::external) +Sets routine to use to destroy the user + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `destroy` - the application-provided destroy routine + +Calling sequence of `destroy`: +- `pc` - the preconditioner + +Level: intermediate + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetApply()`, `PCShellSetContext()`, `PCShellGetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetDestroy")) +""" +function PCShellSetDestroy(petsclib::PetscLibType, pc::PC, destroy::external) end + +@for_petsc function PCShellSetDestroy(petsclib::$UnionPetscLib, pc::PC, destroy::external ) + + @chk ccall( + (:PCShellSetDestroy, $petsc_library), + PetscErrorCode, + (PC, external), + pc, destroy, + ) + + + return nothing +end + +""" + PCShellSetSetUp(petsclib::PetscLibType,pc::PC, setup::external) +Sets routine to use to "setup" the preconditioner whenever the +matrix operator is changed. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `setup` - the application-provided setup routine + +Calling sequence of `setup`: +- `pc` - the preconditioner + +Level: intermediate + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetApply()`, `PCShellSetContext()`, , `PCShellGetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetSetUp")) +""" +function PCShellSetSetUp(petsclib::PetscLibType, pc::PC, setup::external) end + +@for_petsc function PCShellSetSetUp(petsclib::$UnionPetscLib, pc::PC, setup::external ) + + @chk ccall( + (:PCShellSetSetUp, $petsc_library), + PetscErrorCode, + (PC, external), + pc, setup, + ) + + + return nothing +end + +""" + PCShellSetView(petsclib::PetscLibType,pc::PC, view::external) +Sets routine to use as viewer of a `PCSHELL` shell preconditioner + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `view` - the application-provided view routine + +Calling sequence of `view`: +- `pc` - the preconditioner +- `v` - viewer + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetContext()`, `PCShellGetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetView")) +""" +function PCShellSetView(petsclib::PetscLibType, pc::PC, view::external) end + +@for_petsc function PCShellSetView(petsclib::$UnionPetscLib, pc::PC, view::external ) + + @chk ccall( + (:PCShellSetView, $petsc_library), + PetscErrorCode, + (PC, external), + pc, view, + ) + + + return nothing +end + +""" + PCShellSetApply(petsclib::PetscLibType,pc::PC, apply::external) +Sets routine to use as preconditioner. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `apply` - the application-provided preconditioning routine + +Calling sequence of `apply`: +- `pc` - the preconditioner, get the application context with `PCShellGetContext()` +- `xin` - input vector +- `xout` - output vector + +Level: intermediate + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetContext()`, `PCShellSetApplyBA()`, `PCShellSetApplySymmetricRight()`, `PCShellSetApplySymmetricLeft()`, `PCShellGetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetApply")) +""" +function PCShellSetApply(petsclib::PetscLibType, pc::PC, apply::external) end + +@for_petsc function PCShellSetApply(petsclib::$UnionPetscLib, pc::PC, apply::external ) + + @chk ccall( + (:PCShellSetApply, $petsc_library), + PetscErrorCode, + (PC, external), + pc, apply, + ) + + + return nothing +end + +""" + PCShellSetMatApply(petsclib::PetscLibType,pc::PC, matapply::external) +Sets routine to use as preconditioner on a block of vectors. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `matapply` - the application-provided preconditioning routine + +Calling sequence of `matapply`: +- `pc` - the preconditioner +- `Xin` - input block of vectors represented as a dense `Mat` +- `Xout` - output block of vectors represented as a dense `Mat` + +Level: advanced + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetApply()`, `PCShellSetContext()`, `PCShellGetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetMatApply")) +""" +function PCShellSetMatApply(petsclib::PetscLibType, pc::PC, matapply::external) end + +@for_petsc function PCShellSetMatApply(petsclib::$UnionPetscLib, pc::PC, matapply::external ) + + @chk ccall( + (:PCShellSetMatApply, $petsc_library), + PetscErrorCode, + (PC, external), + pc, matapply, + ) + + + return nothing +end + +""" + PCShellSetApplySymmetricLeft(petsclib::PetscLibType,pc::PC, apply::external) +Sets routine to use as left preconditioner (when the `PC_SYMMETRIC` is used). + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `apply` - the application-provided left preconditioning routine + +Calling sequence of `apply`: +- `pc` - the preconditioner +- `xin` - input vector +- `xout` - output vector + +Level: advanced + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetApply()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetApplySymmetricLeft")) +""" +function PCShellSetApplySymmetricLeft(petsclib::PetscLibType, pc::PC, apply::external) end + +@for_petsc function PCShellSetApplySymmetricLeft(petsclib::$UnionPetscLib, pc::PC, apply::external ) + + @chk ccall( + (:PCShellSetApplySymmetricLeft, $petsc_library), + PetscErrorCode, + (PC, external), + pc, apply, + ) + + + return nothing +end + +""" + PCShellSetApplySymmetricRight(petsclib::PetscLibType,pc::PC, apply::external) +Sets routine to use as right preconditioner (when the `PC_SYMMETRIC` is used). + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `apply` - the application-provided right preconditioning routine + +Calling sequence of `apply`: +- `pc` - the preconditioner +- `xin` - input vector +- `xout` - output vector + +Level: advanced + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetApply()`, `PCShellSetApplySymmetricLeft()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetContext()`, `PCShellGetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetApplySymmetricRight")) +""" +function PCShellSetApplySymmetricRight(petsclib::PetscLibType, pc::PC, apply::external) end + +@for_petsc function PCShellSetApplySymmetricRight(petsclib::$UnionPetscLib, pc::PC, apply::external ) + + @chk ccall( + (:PCShellSetApplySymmetricRight, $petsc_library), + PetscErrorCode, + (PC, external), + pc, apply, + ) + + + return nothing +end + +""" + PCShellSetApplyBA(petsclib::PetscLibType,pc::PC, applyBA::external) +Sets routine to use as the preconditioner times the operator. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `applyBA` - the application-provided BA routine + +Calling sequence of `applyBA`: +- `pc` - the preconditioner +- `side` - `PC_LEFT`, `PC_RIGHT`, or `PC_SYMMETRIC` +- `xin` - input vector +- `xout` - output vector +- `w` - work vector + +Level: intermediate + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetContext()`, `PCShellSetApply()`, `PCShellGetContext()`, `PCSide` + +# External Links +$(_doc_external("Ksp/PCShellSetApplyBA")) +""" +function PCShellSetApplyBA(petsclib::PetscLibType, pc::PC, applyBA::external) end + +@for_petsc function PCShellSetApplyBA(petsclib::$UnionPetscLib, pc::PC, applyBA::external ) + + @chk ccall( + (:PCShellSetApplyBA, $petsc_library), + PetscErrorCode, + (PC, external), + pc, applyBA, + ) + + + return nothing +end + +""" + PCShellSetApplyTranspose(petsclib::PetscLibType,pc::PC, applytranspose::external) +Sets routine to use as preconditioner transpose. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `applytranspose` - the application-provided preconditioning transpose routine + +Calling sequence of `applytranspose`: +- `pc` - the preconditioner +- `xin` - input vector +- `xout` - output vector + +Level: intermediate + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApply()`, `PCShellSetContext()`, `PCShellSetApplyBA()`, `PCShellGetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetApplyTranspose")) +""" +function PCShellSetApplyTranspose(petsclib::PetscLibType, pc::PC, applytranspose::external) end + +@for_petsc function PCShellSetApplyTranspose(petsclib::$UnionPetscLib, pc::PC, applytranspose::external ) + + @chk ccall( + (:PCShellSetApplyTranspose, $petsc_library), + PetscErrorCode, + (PC, external), + pc, applytranspose, + ) + + + return nothing +end + +""" + PCShellSetMatApplyTranspose(petsclib::PetscLibType,pc::PC, matapplytranspose::external) +Sets routine to use as preconditioner transpose. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `matapplytranspose` - the application-provided preconditioning transpose routine + +Calling sequence of `matapplytranspose`: +- `pc` - the preconditioner +- `xin` - input matrix +- `xout` - output matrix + +Level: intermediate + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApply()`, `PCShellSetContext()`, `PCShellSetApplyBA()`, `PCShellGetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetMatApplyTranspose")) +""" +function PCShellSetMatApplyTranspose(petsclib::PetscLibType, pc::PC, matapplytranspose::external) end + +@for_petsc function PCShellSetMatApplyTranspose(petsclib::$UnionPetscLib, pc::PC, matapplytranspose::external ) + + @chk ccall( + (:PCShellSetMatApplyTranspose, $petsc_library), + PetscErrorCode, + (PC, external), + pc, matapplytranspose, + ) + + + return nothing +end + +""" + PCShellSetPreSolve(petsclib::PetscLibType,pc::PC, presolve::PCShellPSolveFn) +Sets routine to apply to the operators/vectors before a `KSPSolve()` is +applied. This usually does something like scale the linear system in some application +specific way. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `presolve` - the application-provided presolve routine, see `PCShellPSolveFn` + +Level: advanced + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellPSolveFn`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetPostSolve()`, `PCShellSetContext()`, `PCShellGetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetPreSolve")) +""" +function PCShellSetPreSolve(petsclib::PetscLibType, pc::PC, presolve::PCShellPSolveFn) end + +@for_petsc function PCShellSetPreSolve(petsclib::$UnionPetscLib, pc::PC, presolve::PCShellPSolveFn ) + + @chk ccall( + (:PCShellSetPreSolve, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCShellPSolveFn}), + pc, presolve, + ) + + + return nothing +end + +""" + PCShellSetPostSolve(petsclib::PetscLibType,pc::PC, postsolve::PCShellPSolveFn) +Sets routine to apply to the operators/vectors after a `KSPSolve()` is +applied. This usually does something like scale the linear system in some application +specific way. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `postsolve` - the application-provided postsolve routine, see `PCShellPSolveFn` + +Level: advanced + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellPSolveFn`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetPreSolve()`, `PCShellSetContext()`, `PCShellGetContext()` + +# External Links +$(_doc_external("Ksp/PCShellSetPostSolve")) +""" +function PCShellSetPostSolve(petsclib::PetscLibType, pc::PC, postsolve::PCShellPSolveFn) end + +@for_petsc function PCShellSetPostSolve(petsclib::$UnionPetscLib, pc::PC, postsolve::PCShellPSolveFn ) + + @chk ccall( + (:PCShellSetPostSolve, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCShellPSolveFn}), + pc, postsolve, + ) + + + return nothing +end + +""" + PCShellSetName(petsclib::PetscLibType,pc::PC, name::String) +Sets an optional name to associate with a `PCSHELL` +preconditioner. + +Not Collective + +Input Parameters: +- `pc` - the preconditioner context +- `name` - character string describing shell preconditioner + +Level: intermediate + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellGetName()`, `PetscObjectSetName()`, `PetscObjectGetName()` + +# External Links +$(_doc_external("Ksp/PCShellSetName")) +""" +function PCShellSetName(petsclib::PetscLibType, pc::PC, name::String) end + +@for_petsc function PCShellSetName(petsclib::$UnionPetscLib, pc::PC, name::String ) + + @chk ccall( + (:PCShellSetName, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cchar}), + pc, name, + ) + + + return nothing +end + +""" + PCShellGetName(petsclib::PetscLibType,pc::PC, name::String) +Gets an optional name that the user has set for a `PCSHELL` with `PCShellSetName()` +preconditioner. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `name` - character string describing shell preconditioner (you should not free this) + +Level: intermediate + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetName()`, `PetscObjectSetName()`, `PetscObjectGetName()` + +# External Links +$(_doc_external("Ksp/PCShellGetName")) +""" +function PCShellGetName(petsclib::PetscLibType, pc::PC, name::String) end + +@for_petsc function PCShellGetName(petsclib::$UnionPetscLib, pc::PC, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PCShellGetName, $petsc_library), + PetscErrorCode, + (PC, Ptr{Ptr{Cchar}}), + pc, name_, + ) + + + return nothing +end + +""" + PCShellSetApplyRichardson(petsclib::PetscLibType,pc::PC, apply::external) +Sets routine to use as preconditioner +in Richardson iteration. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `apply` - the application-provided preconditioning routine + +Calling sequence of `apply`: +- `pc` - the preconditioner +- `b` - right-hand side +- `x` - current iterate +- `r` - work space +- `rtol` - relative tolerance of residual norm to stop at +- `abstol` - absolute tolerance of residual norm to stop at +- `dtol` - if residual norm increases by this factor than return +- `maxits` - number of iterations to run +- `zeroinitialguess` - `PETSC_TRUE` if `x` is known to be initially zero +- `its` - returns the number of iterations used +- `reason` - returns the reason the iteration has converged + +Level: advanced + +-seealso: [](ch_ksp), `PCSHELL`, `PCShellSetApply()`, `PCShellSetContext()`, `PCRichardsonConvergedReason()`, `PCShellGetContext()`, `KSPRICHARDSON` + +# External Links +$(_doc_external("Ksp/PCShellSetApplyRichardson")) +""" +function PCShellSetApplyRichardson(petsclib::PetscLibType, pc::PC, apply::external) end + +@for_petsc function PCShellSetApplyRichardson(petsclib::$UnionPetscLib, pc::PC, apply::external ) + + @chk ccall( + (:PCShellSetApplyRichardson, $petsc_library), + PetscErrorCode, + (PC, external), + pc, apply, + ) + + + return nothing +end + +""" + PCISSetUseStiffnessScaling(petsclib::PetscLibType,pc::PC, use::PetscBool) +Tells `PCIS` to construct partition of unity using +the local matrices' diagonal entries + +Logically Collective + +Input Parameters: +- `pc` - the preconditioning context +- `use` - whether or not it should use matrix diagonal to build partition of unity. + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCNN`, `PCISSetSubdomainDiagonalScaling()`, `PCISScatterArrayNToVecB()`, +`PCISSetSubdomainScalingFactor()`, +`PCISReset()`, `PCISInitialize()`, `PCISApplyInvSchur()`, `PCISApplySchur()` + +# External Links +$(_doc_external("Ksp/PCISSetUseStiffnessScaling")) +""" +function PCISSetUseStiffnessScaling(petsclib::PetscLibType, pc::PC, use::PetscBool) end + +@for_petsc function PCISSetUseStiffnessScaling(petsclib::$UnionPetscLib, pc::PC, use::PetscBool ) + + @chk ccall( + (:PCISSetUseStiffnessScaling, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, use, + ) + + + return nothing +end + +""" + PCISSetSubdomainDiagonalScaling(petsclib::PetscLibType,pc::PC, scaling_factors::PetscVec) +Set diagonal scaling for `PCIS`. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioning context +- `scaling_factors` - scaling factors for the subdomain + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCNN`, `PCISScatterArrayNToVecB()`, +`PCISSetSubdomainScalingFactor()`, `PCISSetUseStiffnessScaling()`, +`PCISReset()`, `PCISInitialize()`, `PCISApplyInvSchur()`, `PCISApplySchur()` + +# External Links +$(_doc_external("Ksp/PCISSetSubdomainDiagonalScaling")) +""" +function PCISSetSubdomainDiagonalScaling(petsclib::PetscLibType, pc::PC, scaling_factors::PetscVec) end + +@for_petsc function PCISSetSubdomainDiagonalScaling(petsclib::$UnionPetscLib, pc::PC, scaling_factors::PetscVec ) + + @chk ccall( + (:PCISSetSubdomainDiagonalScaling, $petsc_library), + PetscErrorCode, + (PC, CVec), + pc, scaling_factors, + ) + + + return nothing +end + +""" + PCISSetSubdomainScalingFactor(petsclib::PetscLibType,pc::PC, scal::PetscScalar) +Set scaling factor for `PCIS`. + +Not Collective + +Input Parameters: +- `pc` - the preconditioning context +- `scal` - scaling factor for the subdomain + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCNN`, `PCISScatterArrayNToVecB()`, +`PCISSetSubdomainDiagonalScaling()`, `PCISSetUseStiffnessScaling()`, +`PCISReset()`, `PCISInitialize()`, `PCISApplyInvSchur()`, `PCISApplySchur()` + +# External Links +$(_doc_external("Ksp/PCISSetSubdomainScalingFactor")) +""" +function PCISSetSubdomainScalingFactor(petsclib::PetscLibType, pc::PC, scal::PetscScalar) end + +@for_petsc function PCISSetSubdomainScalingFactor(petsclib::$UnionPetscLib, pc::PC, scal::$PetscScalar ) + + @chk ccall( + (:PCISSetSubdomainScalingFactor, $petsc_library), + PetscErrorCode, + (PC, $PetscScalar), + pc, scal, + ) + + + return nothing +end + +""" + PCISSetUp(petsclib::PetscLibType,pc::PC, computematrices::PetscBool, computesolvers::PetscBool) +sets up the `PC_IS` portion of `PCNN` and `PCBDDC` preconditioner context as part of their setup process + +Input Parameters: +- `pc` - the `PC` object, must be of type `PCNN` or `PCBDDC` +- `computematrices` - Extract the blocks `A_II`, `A_BI`, `A_IB` and `A_BB` from the matrix +- `computesolvers` - Create the `KSP` for the local Dirichlet and Neumann problems + +Level: advanced + +-seealso: [](ch_ksp), `PCBDDC`, `PCNN`, `PCISSetUseStiffnessScaling()`, `PCISSetSubdomainDiagonalScaling()`, `PCISScatterArrayNToVecB()`, +`PCISSetSubdomainScalingFactor()`, +`PCISReset()`, `PCISApplySchur()`, `PCISApplyInvSchur()` + +# External Links +$(_doc_external("Ksp/PCISSetUp")) +""" +function PCISSetUp(petsclib::PetscLibType, pc::PC, computematrices::PetscBool, computesolvers::PetscBool) end + +@for_petsc function PCISSetUp(petsclib::$UnionPetscLib, pc::PC, computematrices::PetscBool, computesolvers::PetscBool ) + + @chk ccall( + (:PCISSetUp, $petsc_library), + PetscErrorCode, + (PC, PetscBool, PetscBool), + pc, computematrices, computesolvers, + ) + + + return nothing +end + +""" + PCISReset(petsclib::PetscLibType,pc::PC) +Removes all the `PC_IS` parts of the `PC` implementation data structure + +Input Parameter: +- `pc` - the `PC` object, must be of type `PCNN` or `PCBDDC` + +Level: advanced + +-seealso: [](ch_ksp), `PCISSetUseStiffnessScaling()`, `PCISSetSubdomainDiagonalScaling()`, `PCISScatterArrayNToVecB()`, `PCISSetSubdomainScalingFactor()`, +`PCISInitialize()`, `PCISApplySchur()`, `PCISApplyInvSchur()` + +# External Links +$(_doc_external("Ksp/PCISReset")) +""" +function PCISReset(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCISReset(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCISReset, $petsc_library), + PetscErrorCode, + (PC,), + pc, + ) + + + return nothing +end + +""" + PCISInitialize(petsclib::PetscLibType,pc::PC) +initializes the `PC_IS` portion of `PCNN` and `PCBDDC` preconditioner context + +Input Parameter: +- `pc` - the `PC` object, must be of type `PCNN` or `PCBDDC` + +Level: advanced + +-seealso: [](ch_ksp), `PCBDDC`, `PCNN`, `PCISSetUseStiffnessScaling()`, `PCISSetSubdomainDiagonalScaling()`, `PCISScatterArrayNToVecB()`, +`PCISSetSubdomainScalingFactor()`, +`PCISReset()`, `PCISApplySchur()`, `PCISApplyInvSchur()` + +# External Links +$(_doc_external("Ksp/PCISInitialize")) +""" +function PCISInitialize(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCISInitialize(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCISInitialize, $petsc_library), + PetscErrorCode, + (PC,), + pc, + ) + + + return nothing +end + +""" + PCISApplySchur(petsclib::PetscLibType,pc::PC, v::PetscVec, vec1_B::PetscVec, vec2_B::PetscVec, vec1_D::PetscVec, vec2_D::PetscVec) +applies the Schur complement arising from the `MATIS` inside the `PCNN` preconditioner + +Input Parameters: +- `pc` - preconditioner context +- `v` - vector to which the Schur complement is to be applied (it is NOT modified inside this function, UNLESS vec2_B is null) +- `vec1_B` - location to store the result of Schur complement applied to chunk +- `vec2_B` - workspace or `NULL`, `v` is used as workspace in that case +- `vec1_D` - work space +- `vec2_D` - work space + +Level: advanced + +-seealso: [](ch_ksp), `PCBDDC`, `PCNN`, `PCISSetUseStiffnessScaling()`, `PCISSetSubdomainDiagonalScaling()`, `PCISScatterArrayNToVecB()`, +`PCISSetSubdomainScalingFactor()`, `PCISApplyInvSchur()`, +`PCISReset()`, `PCISInitialize()` + +# External Links +$(_doc_external("Ksp/PCISApplySchur")) +""" +function PCISApplySchur(petsclib::PetscLibType, pc::PC, v::PetscVec, vec1_B::PetscVec, vec2_B::PetscVec, vec1_D::PetscVec, vec2_D::PetscVec) end + +@for_petsc function PCISApplySchur(petsclib::$UnionPetscLib, pc::PC, v::PetscVec, vec1_B::PetscVec, vec2_B::PetscVec, vec1_D::PetscVec, vec2_D::PetscVec ) + + @chk ccall( + (:PCISApplySchur, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec, CVec, CVec, CVec), + pc, v, vec1_B, vec2_B, vec1_D, vec2_D, + ) + + + return nothing +end + +""" + PCISScatterArrayNToVecB(petsclib::PetscLibType,pc::PC, array_N::PetscScalar, v_B::PetscVec, imode::InsertMode, smode::ScatterMode) +Scatters interface node values from a big array (of all local nodes, interior or interface, +including ghosts) into an interface vector, when in `SCATTER_FORWARD` mode, or vice-versa, when in `SCATTER_REVERSE` +mode. + +Input Parameters: +- `pc` - preconditioner context +- `array_N` - [when in `SCATTER_FORWARD` mode] Array to be scattered into the vector otherwise output array +- `imode` - insert mode, `ADD_VALUES` or `INSERT_VALUES` +- `smode` - scatter mode, `SCATTER_FORWARD` or `SCATTER_REVERSE` mode] +- `v_B` - [when in `SCATTER_REVERSE` mode] Vector to be scattered into the array, otherwise output vector + +Level: advanced + +-seealso: [](ch_ksp), `PCBDDC`, `PCNN`, `PCISSetUseStiffnessScaling()`, `PCISSetSubdomainDiagonalScaling()`, +`PCISSetSubdomainScalingFactor()`, `PCISApplySchur()`, `PCISApplyInvSchur()`, +`PCISReset()`, `PCISInitialize()`, `InsertMode` + +# External Links +$(_doc_external("Ksp/PCISScatterArrayNToVecB")) +""" +function PCISScatterArrayNToVecB(petsclib::PetscLibType, pc::PC, array_N::PetscScalar, v_B::PetscVec, imode::InsertMode, smode::ScatterMode) end + +@for_petsc function PCISScatterArrayNToVecB(petsclib::$UnionPetscLib, pc::PC, array_N::$PetscScalar, v_B::PetscVec, imode::InsertMode, smode::ScatterMode ) + + @chk ccall( + (:PCISScatterArrayNToVecB, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscScalar}, CVec, InsertMode, ScatterMode), + pc, array_N, v_B, imode, smode, + ) + + + return nothing +end + +""" + PCISApplyInvSchur(petsclib::PetscLibType,pc::PC, b::PetscVec, x::PetscVec, vec1_N::PetscVec, vec2_N::PetscVec) +Solves the Neumann problem related to applying the inverse of the Schur complement. + +Input Parameters: +- `pc` - preconditioner context +- `b` - vector of local interface nodes (including ghosts) +- `x` - vector of local interface nodes (including ghosts); returns the application of the inverse of the Schur complement to `b` +- `vec1_N` - vector of local nodes (interior and interface, including ghosts); used as work space +- `vec2_N` - vector of local nodes (interior and interface, including ghosts); used as work space + +Level: advanced + +-seealso: [](ch_ksp), `PCBDDC`, `PCNN`, `PCISSetUseStiffnessScaling()`, `PCISSetSubdomainDiagonalScaling()`, `PCISScatterArrayNToVecB()`, +`PCISSetSubdomainScalingFactor()`, +`PCISReset()`, `PCISInitialize()` + +# External Links +$(_doc_external("Ksp/PCISApplyInvSchur")) +""" +function PCISApplyInvSchur(petsclib::PetscLibType, pc::PC, b::PetscVec, x::PetscVec, vec1_N::PetscVec, vec2_N::PetscVec) end + +@for_petsc function PCISApplyInvSchur(petsclib::$UnionPetscLib, pc::PC, b::PetscVec, x::PetscVec, vec1_N::PetscVec, vec2_N::PetscVec ) + + @chk ccall( + (:PCISApplyInvSchur, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec, CVec, CVec), + pc, b, x, vec1_N, vec2_N, + ) + + + return nothing +end + +""" + PCEisenstatSetOmega(petsclib::PetscLibType,pc::PC, omega::PetscReal) +Sets the SSOR relaxation coefficient, omega, +to use with Eisenstat's trick (where omega = 1.0 by default) + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `omega` - relaxation coefficient (0 < omega < 2) + +Options Database Key: +- `-pc_eisenstat_omega ` - Sets omega + +Level: intermediate + +-seealso: [](ch_ksp), `PCSORSetOmega()`, `PCEISENSTAT` + +# External Links +$(_doc_external("Ksp/PCEisenstatSetOmega")) +""" +function PCEisenstatSetOmega(petsclib::PetscLibType, pc::PC, omega::PetscReal) end + +@for_petsc function PCEisenstatSetOmega(petsclib::$UnionPetscLib, pc::PC, omega::$PetscReal ) + + @chk ccall( + (:PCEisenstatSetOmega, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, omega, + ) + + + return nothing +end + +""" + PCEisenstatSetNoDiagonalScaling(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Causes the Eisenstat preconditioner, `PCEISENSTAT` +not to do additional diagonal preconditioning. For matrices with a constant +along the diagonal, this may save a small amount of work. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - `PETSC_TRUE` turns off diagonal scaling inside the algorithm + +Options Database Key: +- `-pc_eisenstat_no_diagonal_scaling` - Activates `PCEisenstatSetNoDiagonalScaling()` + +Level: intermediate + +-seealso: [](ch_ksp), `PCEisenstatSetOmega()`, `PCEISENSTAT` + +# External Links +$(_doc_external("Ksp/PCEisenstatSetNoDiagonalScaling")) +""" +function PCEisenstatSetNoDiagonalScaling(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCEisenstatSetNoDiagonalScaling(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCEisenstatSetNoDiagonalScaling, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + omega::PetscReal = PCEisenstatGetOmega(petsclib::PetscLibType,pc::PC) +Gets the SSOR relaxation coefficient, omega, +to use with Eisenstat's trick (where omega = 1.0 by default). + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `omega` - relaxation coefficient (0 < omega < 2) + +Options Database Key: +- `-pc_eisenstat_omega ` - Sets omega + +-seealso: [](ch_ksp), `PCEISENSTAT`, `PCSORGetOmega()`, `PCEisenstatSetOmega()` + +# External Links +$(_doc_external("Ksp/PCEisenstatGetOmega")) +""" +function PCEisenstatGetOmega(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCEisenstatGetOmega(petsclib::$UnionPetscLib, pc::PC ) + omega_ = Ref{$PetscReal}() + + @chk ccall( + (:PCEisenstatGetOmega, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscReal}), + pc, omega_, + ) + + omega = omega_[] + + return omega +end + +""" + flg::PetscBool = PCEisenstatGetNoDiagonalScaling(petsclib::PetscLibType,pc::PC) +Tells if the Eisenstat preconditioner +not to do additional diagonal preconditioning. For matrices with a constant +along the diagonal, this may save a small amount of work. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `flg` - `PETSC_TRUE` means there is no diagonal scaling applied + +Options Database Key: +- `-pc_eisenstat_no_diagonal_scaling` - Activates `PCEisenstatSetNoDiagonalScaling()` + +Level: intermediate + +-seealso: , `PCEISENSTAT`, `PCEisenstatGetOmega()` + +# External Links +$(_doc_external("Ksp/PCEisenstatGetNoDiagonalScaling")) +""" +function PCEisenstatGetNoDiagonalScaling(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCEisenstatGetNoDiagonalScaling(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCEisenstatGetNoDiagonalScaling, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCJacobiSetUseAbs(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Causes the Jacobi preconditioner `PCJACOBI` to use the +absolute values of the diagonal divisors in the preconditioner + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - whether to use absolute values or not + +Options Database Key: +- `-pc_jacobi_abs ` - use absolute values + +-seealso: [](ch_ksp), `PCJACOBI`, `PCJacobiSetType()`, `PCJacobiGetUseAbs()` + +# External Links +$(_doc_external("Ksp/PCJacobiSetUseAbs")) +""" +function PCJacobiSetUseAbs(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCJacobiSetUseAbs(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCJacobiSetUseAbs, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCJacobiGetUseAbs(petsclib::PetscLibType,pc::PC) +Determines if the Jacobi preconditioner `PCJACOBI` uses the +absolute values of the diagonal divisors in the preconditioner + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `flg` - whether to use absolute values or not + +Level: intermediate + +-seealso: [](ch_ksp), `PCJACOBI`, `PCJacobiSetType()`, `PCJacobiSetUseAbs()`, `PCJacobiGetType()` + +# External Links +$(_doc_external("Ksp/PCJacobiGetUseAbs")) +""" +function PCJacobiGetUseAbs(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCJacobiGetUseAbs(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCJacobiGetUseAbs, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCJacobiSetRowl1Scale(petsclib::PetscLibType,pc::PC, scale::PetscReal) +Set scaling of off +Remark 6.1 in "Multigrid Smoothers for Ultraparallel Computing", Baker et al, with 0.5 scaling + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `scale` - scaling + +Options Database Key: +- `-pc_jacobi_rowl1_scale ` - use absolute values + +Level: intermediate + +-seealso: [](ch_ksp), `PCJACOBI`, `PCJacobiSetType()`, `PCJacobiGetRowl1Scale()` + +# External Links +$(_doc_external("Ksp/PCJacobiSetRowl1Scale")) +""" +function PCJacobiSetRowl1Scale(petsclib::PetscLibType, pc::PC, scale::PetscReal) end + +@for_petsc function PCJacobiSetRowl1Scale(petsclib::$UnionPetscLib, pc::PC, scale::$PetscReal ) + + @chk ccall( + (:PCJacobiSetRowl1Scale, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, scale, + ) + + + return nothing +end + +""" + scale::PetscReal = PCJacobiGetRowl1Scale(petsclib::PetscLibType,pc::PC) +Get scaling of off + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `scale` - scaling + +Level: intermediate + +-seealso: [](ch_ksp), `PCJACOBI`, `PCJacobiSetType()`, `PCJacobiSetRowl1Scale()`, `PCJacobiGetType()` + +# External Links +$(_doc_external("Ksp/PCJacobiGetRowl1Scale")) +""" +function PCJacobiGetRowl1Scale(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCJacobiGetRowl1Scale(petsclib::$UnionPetscLib, pc::PC ) + scale_ = Ref{$PetscReal}() + + @chk ccall( + (:PCJacobiGetRowl1Scale, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscReal}), + pc, scale_, + ) + + scale = scale_[] + + return scale +end + +""" + PCJacobiSetFixDiagonal(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Check for zero values on the diagonal and replace them with 1.0 + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - the boolean flag + +Options Database Key: +- `-pc_jacobi_fixdiagonal ` - check for zero values on the diagonal + +-seealso: [](ch_ksp), `PCJACOBI`, `PCJacobiSetType()`, `PCJacobiGetFixDiagonal()`, `PCJacobiSetUseAbs()` + +# External Links +$(_doc_external("Ksp/PCJacobiSetFixDiagonal")) +""" +function PCJacobiSetFixDiagonal(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCJacobiSetFixDiagonal(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCJacobiSetFixDiagonal, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCJacobiGetFixDiagonal(petsclib::PetscLibType,pc::PC) +Determines if the Jacobi preconditioner `PCJACOBI` checks for zero diagonal terms + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `flg` - the boolean flag + +Options Database Key: +- `-pc_jacobi_fixdiagonal ` - Fix 0 terms on diagonal by using 1 + +Level: intermediate + +-seealso: [](ch_ksp), `PCJACOBI`, `PCJacobiSetType()`, `PCJacobiSetFixDiagonal()` + +# External Links +$(_doc_external("Ksp/PCJacobiGetFixDiagonal")) +""" +function PCJacobiGetFixDiagonal(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCJacobiGetFixDiagonal(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCJacobiGetFixDiagonal, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCJacobiGetDiagonal(petsclib::PetscLibType,pc::PC, diagonal::PetscVec, diagonal_sqrt::PetscVec) +Returns copy of the diagonal and/or diagonal squareroot `Vec` + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `diagonal` - Copy of `Vec` of the inverted diagonal +- `diagonal_sqrt` - Copy of `Vec` of the inverted square root diagonal + +Level: developer + +-seealso: [](ch_ksp), `PCJACOBI`, `PCJacobiSetType()` + +# External Links +$(_doc_external("Ksp/PCJacobiGetDiagonal")) +""" +function PCJacobiGetDiagonal(petsclib::PetscLibType, pc::PC, diagonal::PetscVec, diagonal_sqrt::PetscVec) end + +@for_petsc function PCJacobiGetDiagonal(petsclib::$UnionPetscLib, pc::PC, diagonal::PetscVec, diagonal_sqrt::PetscVec ) + + @chk ccall( + (:PCJacobiGetDiagonal, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec), + pc, diagonal, diagonal_sqrt, + ) + + + return nothing +end + +""" + PCJacobiSetType(petsclib::PetscLibType,pc::PC, type::PCJacobiType) +Causes the Jacobi preconditioner to use either the diagonal, the maximum entry in each row, +of the sum of rows entries for the diagonal preconditioner + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - `PC_JACOBI_DIAGONAL`, `PC_JACOBI_ROWL1`, `PC_JACOBI_ROWMAX`, `PC_JACOBI_ROWSUM` + +Options Database Key: +- `-pc_jacobi_type ` - the type of diagonal matrix to use for Jacobi + +Level: intermediate + +-seealso: [](ch_ksp), `PCJACOBI`, `PCJacobiSetUseAbs()`, `PCJacobiGetType()` + +# External Links +$(_doc_external("Ksp/PCJacobiSetType")) +""" +function PCJacobiSetType(petsclib::PetscLibType, pc::PC, type::PCJacobiType) end + +@for_petsc function PCJacobiSetType(petsclib::$UnionPetscLib, pc::PC, type::PCJacobiType ) + + @chk ccall( + (:PCJacobiSetType, $petsc_library), + PetscErrorCode, + (PC, PCJacobiType), + pc, type, + ) + + + return nothing +end + +""" + type::PCJacobiType = PCJacobiGetType(petsclib::PetscLibType,pc::PC) +Gets how the diagonal matrix is produced for the preconditioner + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `type` - `PC_JACOBI_DIAGONAL`, `PC_JACOBI_ROWL1`, `PC_JACOBI_ROWMAX`, `PC_JACOBI_ROWSUM` + +Level: intermediate + +-seealso: [](ch_ksp), `PCJACOBI`, `PCJacobiSetUseAbs()`, `PCJacobiSetType()` + +# External Links +$(_doc_external("Ksp/PCJacobiGetType")) +""" +function PCJacobiGetType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCJacobiGetType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{PCJacobiType}() + + @chk ccall( + (:PCJacobiGetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCJacobiType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PCGalerkinSetRestriction(petsclib::PetscLibType,pc::PC, R::PetscMat) +Sets the restriction operator for the `PCGALERKIN` preconditioner + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `R` - the restriction operator + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetType()`, `PCType`, `PCGALERKIN`, +`PCGalerkinSetInterpolation()`, `PCGalerkinGetKSP()` + +# External Links +$(_doc_external("Ksp/PCGalerkinSetRestriction")) +""" +function PCGalerkinSetRestriction(petsclib::PetscLibType, pc::PC, R::PetscMat) end + +@for_petsc function PCGalerkinSetRestriction(petsclib::$UnionPetscLib, pc::PC, R::PetscMat ) + + @chk ccall( + (:PCGalerkinSetRestriction, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, R, + ) + + + return nothing +end + +""" + PCGalerkinSetInterpolation(petsclib::PetscLibType,pc::PC, P::PetscMat) +Sets the interpolation operator for the `PCGALERKIN` preconditioner + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `P` - the interpolation operator + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetType()`, `PCType`, `PCGALERKIN`, +`PCGalerkinSetRestriction()`, `PCGalerkinGetKSP()` + +# External Links +$(_doc_external("Ksp/PCGalerkinSetInterpolation")) +""" +function PCGalerkinSetInterpolation(petsclib::PetscLibType, pc::PC, P::PetscMat) end + +@for_petsc function PCGalerkinSetInterpolation(petsclib::$UnionPetscLib, pc::PC, P::PetscMat ) + + @chk ccall( + (:PCGalerkinSetInterpolation, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, P, + ) + + + return nothing +end + +""" + PCGalerkinSetComputeSubmatrix(petsclib::PetscLibType,pc::PC, computeAsub::external, ctx::Cvoid) +Provide a routine that will be called to compute the Galerkin submatrix + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `computeAsub` - routine that computes the submatrix from the global matrix +- `ctx` - context used by the routine, or `NULL` + +Calling sequence of `computeAsub`: +- `pc` - the `PCGALERKIN` preconditioner +- `A` - the matrix in the `PCGALERKIN` +- `Ap` - the computed submatrix from any previous computation, if `NULL` it has not previously been computed +- `cAp` - the submatrix computed by this routine +- `ctx` - optional user-defined function context + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetType()`, `PCType`, `PCGALERKIN`, +`PCGalerkinSetRestriction()`, `PCGalerkinSetInterpolation()`, `PCGalerkinGetKSP()` + +# External Links +$(_doc_external("Ksp/PCGalerkinSetComputeSubmatrix")) +""" +function PCGalerkinSetComputeSubmatrix(petsclib::PetscLibType, pc::PC, computeAsub::external, ctx::Cvoid) end + +@for_petsc function PCGalerkinSetComputeSubmatrix(petsclib::$UnionPetscLib, pc::PC, computeAsub::external, ctx::Cvoid ) + + @chk ccall( + (:PCGalerkinSetComputeSubmatrix, $petsc_library), + PetscErrorCode, + (PC, external, Ptr{Cvoid}), + pc, computeAsub, ctx, + ) + + + return nothing +end + +""" + PCGalerkinGetKSP(petsclib::PetscLibType,pc::PC, ksp::PetscKSP) +Gets the `KSP` object in the `PCGALERKIN` + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `ksp` - the `KSP` object + +Level: intermediate + +-seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetType()`, `PCType`, `PCGALERKIN`, +`PCGalerkinSetRestriction()`, `PCGalerkinSetInterpolation()`, `PCGalerkinSetComputeSubmatrix()` + +# External Links +$(_doc_external("Ksp/PCGalerkinGetKSP")) +""" +function PCGalerkinGetKSP(petsclib::PetscLibType, pc::PC, ksp::PetscKSP) end + +@for_petsc function PCGalerkinGetKSP(petsclib::$UnionPetscLib, pc::PC, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:PCGalerkinGetKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{CKSP}), + pc, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + PCPARMSSetGlobal(petsclib::PetscLibType,pc::PC, type::PCPARMSGlobalType) +Sets the global preconditioner to be used in `PCPARMS`. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - the global preconditioner type, one of +-seealso: [](ch_ksp), `PCPARMS`, `PCPARMSSetLocal()` + +# External Links +$(_doc_external("Ksp/PCPARMSSetGlobal")) +""" +function PCPARMSSetGlobal(petsclib::PetscLibType, pc::PC, type::PCPARMSGlobalType) end + +@for_petsc function PCPARMSSetGlobal(petsclib::$UnionPetscLib, pc::PC, type::PCPARMSGlobalType ) + + @chk ccall( + (:PCPARMSSetGlobal, $petsc_library), + PetscErrorCode, + (PC, PCPARMSGlobalType), + pc, type, + ) + + + return nothing +end + +""" + PCPARMSSetLocal(petsclib::PetscLibType,pc::PC, type::PCPARMSLocalType) +Sets the local preconditioner to be used in `PCPARMS`. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - the local preconditioner type, one of +-seealso: [](ch_ksp), `PCPARMS`, `PCPARMSSetGlobal()`, `PCPARMSSetNonsymPerm()` + + +# External Links +$(_doc_external("Ksp/PCPARMSSetLocal")) +""" +function PCPARMSSetLocal(petsclib::PetscLibType, pc::PC, type::PCPARMSLocalType) end + +@for_petsc function PCPARMSSetLocal(petsclib::$UnionPetscLib, pc::PC, type::PCPARMSLocalType ) + + @chk ccall( + (:PCPARMSSetLocal, $petsc_library), + PetscErrorCode, + (PC, PCPARMSLocalType), + pc, type, + ) + + + return nothing +end + +""" + PCPARMSSetSolveTolerances(petsclib::PetscLibType,pc::PC, tol::PetscReal, maxits::PetscInt) +Sets the convergence tolerance and the maximum iterations for the +inner GMRES solver, when the Schur global preconditioner is used. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `tol` - the convergence tolerance +- `maxits` - the maximum number of iterations to use + +Options Database Keys: +- `-pc_parms_solve_tol` - set the tolerance for local solve +- `-pc_parms_max_it` - set the maximum number of inner iterations + +Level: intermediate + +-seealso: [](ch_ksp), `PCPARMS`, `PCPARMSSetSolveRestart()` + +# External Links +$(_doc_external("Ksp/PCPARMSSetSolveTolerances")) +""" +function PCPARMSSetSolveTolerances(petsclib::PetscLibType, pc::PC, tol::PetscReal, maxits::PetscInt) end + +@for_petsc function PCPARMSSetSolveTolerances(petsclib::$UnionPetscLib, pc::PC, tol::$PetscReal, maxits::$PetscInt ) + + @chk ccall( + (:PCPARMSSetSolveTolerances, $petsc_library), + PetscErrorCode, + (PC, $PetscReal, $PetscInt), + pc, tol, maxits, + ) + + + return nothing +end + +""" + PCPARMSSetSolveRestart(petsclib::PetscLibType,pc::PC, restart::PetscInt) +Sets the number of iterations at which the +inner GMRES solver restarts. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `restart` - maximum dimension of the Krylov subspace + +Options Database Key: +- `-pc_parms_max_dim` - sets the inner Krylov dimension + +Level: intermediate + +-seealso: [](ch_ksp), `PCPARMS`, `PCPARMSSetSolveTolerances()` + +# External Links +$(_doc_external("Ksp/PCPARMSSetSolveRestart")) +""" +function PCPARMSSetSolveRestart(petsclib::PetscLibType, pc::PC, restart::PetscInt) end + +@for_petsc function PCPARMSSetSolveRestart(petsclib::$UnionPetscLib, pc::PC, restart::$PetscInt ) + + @chk ccall( + (:PCPARMSSetSolveRestart, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, restart, + ) + + + return nothing +end + +""" + PCPARMSSetNonsymPerm(petsclib::PetscLibType,pc::PC, nonsym::PetscBool) +Sets the type of permutation for the ARMS preconditioner: the standard +symmetric ARMS or the non-symmetric ARMS (ARMS-ddPQ). + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `nonsym` - `PETSC_TRUE` indicates the non-symmetric ARMS is used; +`PETSC_FALSE` indicates the symmetric ARMS is used + +Options Database Key: +- `-pc_parms_nonsymmetric_perm` - sets the use of nonsymmetric permutation + +Level: intermediate + +-seealso: [](ch_ksp), `PCPARMS` + +# External Links +$(_doc_external("Ksp/PCPARMSSetNonsymPerm")) +""" +function PCPARMSSetNonsymPerm(petsclib::PetscLibType, pc::PC, nonsym::PetscBool) end + +@for_petsc function PCPARMSSetNonsymPerm(petsclib::$UnionPetscLib, pc::PC, nonsym::PetscBool ) + + @chk ccall( + (:PCPARMSSetNonsymPerm, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, nonsym, + ) + + + return nothing +end + +""" + PCPARMSSetFill(petsclib::PetscLibType,pc::PC, lfil0::PetscInt, lfil1::PetscInt, lfil2::PetscInt) +Sets the fill +Consider the original matrix A = [B F; E C] and the approximate version +M = [LB 0; E/UB I]*[UB LB F; 0 S]. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `lfil0` - the level of fill-in kept in LB, UB, E/UB and LB F +- `lfil1` - the level of fill-in kept in S +- `lfil2` - the level of fill-in kept in the L and U parts of the LU factorization of S + +Options Database Keys: +- `-pc_parms_lfil_ilu_arms` - set the amount of fill-in for ilut, iluk and arms +- `-pc_parms_lfil_schur` - set the amount of fill-in for schur +- `-pc_parms_lfil_ilut_L_U` - set the amount of fill-in for ILUT L and U + +Level: intermediate + +-seealso: [](ch_ksp), `PCPARMS` + +# External Links +$(_doc_external("Ksp/PCPARMSSetFill")) +""" +function PCPARMSSetFill(petsclib::PetscLibType, pc::PC, lfil0::PetscInt, lfil1::PetscInt, lfil2::PetscInt) end + +@for_petsc function PCPARMSSetFill(petsclib::$UnionPetscLib, pc::PC, lfil0::$PetscInt, lfil1::$PetscInt, lfil2::$PetscInt ) + + @chk ccall( + (:PCPARMSSetFill, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, $PetscInt, $PetscInt), + pc, lfil0, lfil1, lfil2, + ) + + + return nothing +end + +""" + PCExoticSetType(petsclib::PetscLibType,pc::PC, type::PCExoticType) +Sets the type of coarse grid interpolation to use + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - either `PC_EXOTIC_FACE` or `PC_EXOTIC_WIREBASKET` (defaults to face) + +Options Database Keys: +- `-pc_exotic_type ` - use a coarse grid point for each face, or edge and vertex + +-seealso: [](ch_ksp), `PCEXOTIC`, `PCExoticType()` + +# External Links +$(_doc_external("Ksp/PCExoticSetType")) +""" +function PCExoticSetType(petsclib::PetscLibType, pc::PC, type::PCExoticType) end + +@for_petsc function PCExoticSetType(petsclib::$UnionPetscLib, pc::PC, type::PCExoticType ) + + @chk ccall( + (:PCExoticSetType, $petsc_library), + PetscErrorCode, + (PC, PCExoticType), + pc, type, + ) + + + return nothing +end + +""" + PCFactorSetUpMatSolverType(petsclib::PetscLibType,pc::PC) +Can be called after `KSPSetOperators()` or `PCSetOperators()`, causes `MatGetFactor()` to be called so then one may +set the options for that particular factorization object. + +Input Parameter: +- `pc` - the preconditioner context + +-seealso: [](ch_ksp), `PCCHOLESKY`, `PCLU`, `PCFactorSetMatSolverType()`, `PCFactorGetMatrix()` + +# External Links +$(_doc_external("Ksp/PCFactorSetUpMatSolverType")) +""" +function PCFactorSetUpMatSolverType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFactorSetUpMatSolverType(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCFactorSetUpMatSolverType, $petsc_library), + PetscErrorCode, + (PC,), + pc, + ) + + + return nothing +end + +""" + PCFactorSetZeroPivot(petsclib::PetscLibType,pc::PC, zero::PetscReal) +Sets the size at which smaller pivots are declared to be zero + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `zero` - all pivots smaller than this will be considered zero + +Options Database Key: +- `-pc_factor_zeropivot ` - Sets tolerance for what is considered a zero pivot + +Level: intermediate + +-seealso: [](ch_ksp), `PCCHOLESKY`, `PCLU`, `PCFactorSetShiftType()`, `PCFactorSetShiftAmount()` + +# External Links +$(_doc_external("Ksp/PCFactorSetZeroPivot")) +""" +function PCFactorSetZeroPivot(petsclib::PetscLibType, pc::PC, zero::PetscReal) end + +@for_petsc function PCFactorSetZeroPivot(petsclib::$UnionPetscLib, pc::PC, zero::$PetscReal ) + + @chk ccall( + (:PCFactorSetZeroPivot, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, zero, + ) + + + return nothing +end + +""" + PCFactorSetShiftType(petsclib::PetscLibType,pc::PC, shifttype::MatFactorShiftType) +adds a particular type of quantity to the diagonal of the matrix during +numerical factorization, thus the matrix has nonzero pivots + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `shifttype` - type of shift; one of `MAT_SHIFT_NONE`, `MAT_SHIFT_NONZERO`, `MAT_SHIFT_POSITIVE_DEFINITE`, `MAT_SHIFT_INBLOCKS` + +Options Database Key: +- `-pc_factor_shift_type ` - Sets shift type; use '-help' for a list of available types + +Level: intermediate + +-seealso: [](ch_ksp), `PCCHOLESKY`, `PCLU`, `PCFactorSetZeroPivot()`, `PCFactorSetShiftAmount()` + +# External Links +$(_doc_external("Ksp/PCFactorSetShiftType")) +""" +function PCFactorSetShiftType(petsclib::PetscLibType, pc::PC, shifttype::MatFactorShiftType) end + +@for_petsc function PCFactorSetShiftType(petsclib::$UnionPetscLib, pc::PC, shifttype::MatFactorShiftType ) + + @chk ccall( + (:PCFactorSetShiftType, $petsc_library), + PetscErrorCode, + (PC, MatFactorShiftType), + pc, shifttype, + ) + + + return nothing +end + +""" + PCFactorSetShiftAmount(petsclib::PetscLibType,pc::PC, shiftamount::PetscReal) +adds a quantity to the diagonal of the matrix during +numerical factorization, thus the matrix has nonzero pivots + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `shiftamount` - amount of shift or `PETSC_DECIDE` for the default + +Options Database Key: +- `-pc_factor_shift_amount ` - Sets shift amount or -1 for the default + +Level: intermediate + +-seealso: [](ch_ksp), `PCCHOLESKY`, `PCLU`, `PCFactorSetZeroPivot()`, `PCFactorSetShiftType()` + +# External Links +$(_doc_external("Ksp/PCFactorSetShiftAmount")) +""" +function PCFactorSetShiftAmount(petsclib::PetscLibType, pc::PC, shiftamount::PetscReal) end + +@for_petsc function PCFactorSetShiftAmount(petsclib::$UnionPetscLib, pc::PC, shiftamount::$PetscReal ) + + @chk ccall( + (:PCFactorSetShiftAmount, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, shiftamount, + ) + + + return nothing +end + +""" + PCFactorSetDropTolerance(petsclib::PetscLibType,pc::PC, dt::PetscReal, dtcol::PetscReal, maxrowcount::PetscInt) +The preconditioner will use an `PCILU` +based on a drop tolerance. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `dt` - the drop tolerance, try from 1.e-10 to .1 +- `dtcol` - tolerance for column pivot, good values [0.1 to 0.01] +- `maxrowcount` - the max number of nonzeros allowed in a row, best value +depends on the number of nonzeros in row of original matrix + +Options Database Key: +- `-pc_factor_drop_tolerance ` - Sets drop tolerance + +Level: intermediate + +-seealso: [](ch_ksp), `PCILU` + +# External Links +$(_doc_external("Ksp/PCFactorSetDropTolerance")) +""" +function PCFactorSetDropTolerance(petsclib::PetscLibType, pc::PC, dt::PetscReal, dtcol::PetscReal, maxrowcount::PetscInt) end + +@for_petsc function PCFactorSetDropTolerance(petsclib::$UnionPetscLib, pc::PC, dt::$PetscReal, dtcol::$PetscReal, maxrowcount::$PetscInt ) + + @chk ccall( + (:PCFactorSetDropTolerance, $petsc_library), + PetscErrorCode, + (PC, $PetscReal, $PetscReal, $PetscInt), + pc, dt, dtcol, maxrowcount, + ) + + + return nothing +end + +""" + pivot::PetscReal = PCFactorGetZeroPivot(petsclib::PetscLibType,pc::PC) +Gets the tolerance used to define a zero privot + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `pivot` - the tolerance + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `PCFactorSetZeroPivot()` + +# External Links +$(_doc_external("Ksp/PCFactorGetZeroPivot")) +""" +function PCFactorGetZeroPivot(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFactorGetZeroPivot(petsclib::$UnionPetscLib, pc::PC ) + pivot_ = Ref{$PetscReal}() + + @chk ccall( + (:PCFactorGetZeroPivot, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscReal}), + pc, pivot_, + ) + + pivot = pivot_[] + + return pivot +end + +""" + shift::PetscReal = PCFactorGetShiftAmount(petsclib::PetscLibType,pc::PC) +Gets the tolerance used to define a zero privot + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `shift` - how much to shift the diagonal entry + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `PCFactorSetShiftAmount()`, `PCFactorSetShiftType()`, `PCFactorGetShiftType()` + +# External Links +$(_doc_external("Ksp/PCFactorGetShiftAmount")) +""" +function PCFactorGetShiftAmount(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFactorGetShiftAmount(petsclib::$UnionPetscLib, pc::PC ) + shift_ = Ref{$PetscReal}() + + @chk ccall( + (:PCFactorGetShiftAmount, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscReal}), + pc, shift_, + ) + + shift = shift_[] + + return shift +end + +""" + type::MatFactorShiftType = PCFactorGetShiftType(petsclib::PetscLibType,pc::PC) +Gets the type of shift, if any, done when a zero pivot is detected + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `type` - one of `MAT_SHIFT_NONE`, `MAT_SHIFT_NONZERO`, `MAT_SHIFT_POSITIVE_DEFINITE`, or `MAT_SHIFT_INBLOCKS` + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `PCFactorSetShiftType()`, `MatFactorShiftType`, `PCFactorSetShiftAmount()`, `PCFactorGetShiftAmount()` + +# External Links +$(_doc_external("Ksp/PCFactorGetShiftType")) +""" +function PCFactorGetShiftType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFactorGetShiftType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{MatFactorShiftType}() + + @chk ccall( + (:PCFactorGetShiftType, $petsc_library), + PetscErrorCode, + (PC, Ptr{MatFactorShiftType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + levels::PetscInt = PCFactorGetLevels(petsclib::PetscLibType,pc::PC) +Gets the number of levels of fill to use. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `levels` - number of levels of fill + +Level: intermediate + +-seealso: [](ch_ksp), `PCILU`, `PCICC`, `PCFactorSetLevels()` + +# External Links +$(_doc_external("Ksp/PCFactorGetLevels")) +""" +function PCFactorGetLevels(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFactorGetLevels(petsclib::$UnionPetscLib, pc::PC ) + levels_ = Ref{$PetscInt}() + + @chk ccall( + (:PCFactorGetLevels, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}), + pc, levels_, + ) + + levels = levels_[] + + return levels +end + +""" + PCFactorSetLevels(petsclib::PetscLibType,pc::PC, levels::PetscInt) +Sets the number of levels of fill to use. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `levels` - number of levels of fill + +Options Database Key: +- `-pc_factor_levels ` - Sets fill level + +Level: intermediate + +-seealso: [](ch_ksp), `PCILU`, `PCICC`, `PCFactorGetLevels()` + +# External Links +$(_doc_external("Ksp/PCFactorSetLevels")) +""" +function PCFactorSetLevels(petsclib::PetscLibType, pc::PC, levels::PetscInt) end + +@for_petsc function PCFactorSetLevels(petsclib::$UnionPetscLib, pc::PC, levels::$PetscInt ) + + @chk ccall( + (:PCFactorSetLevels, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, levels, + ) + + + return nothing +end + +""" + PCFactorSetAllowDiagonalFill(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Causes all diagonal matrix entries to be +treated as level 0 fill even if there is no non-zero location. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - `PETSC_TRUE` to turn on, `PETSC_FALSE` to turn off + +Options Database Key: +- `-pc_factor_diagonal_fill ` - allow the diagonal fill + +-seealso: [](ch_ksp), `PCILU`, `PCICC`, `PCFactorGetAllowDiagonalFill()` + +# External Links +$(_doc_external("Ksp/PCFactorSetAllowDiagonalFill")) +""" +function PCFactorSetAllowDiagonalFill(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCFactorSetAllowDiagonalFill(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCFactorSetAllowDiagonalFill, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCFactorGetAllowDiagonalFill(petsclib::PetscLibType,pc::PC) +Determines if all diagonal matrix entries are +treated as level 0 fill even if there is no non-zero location. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `flg` - `PETSC_TRUE` to turn on, `PETSC_FALSE` to turn off + +-seealso: [](ch_ksp), `PCILU`, `PCICC`, `PCFactorSetAllowDiagonalFill()` + +# External Links +$(_doc_external("Ksp/PCFactorGetAllowDiagonalFill")) +""" +function PCFactorGetAllowDiagonalFill(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFactorGetAllowDiagonalFill(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCFactorGetAllowDiagonalFill, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCFactorReorderForNonzeroDiagonal(petsclib::PetscLibType,pc::PC, rtol::PetscReal) +reorders rows/columns of matrix to remove zeros from diagonal + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `rtol` - diagonal entries smaller than this in absolute value are considered zero + +Options Database Key: +- `-pc_factor_nonzeros_along_diagonal ` - perform the reordering with the given tolerance + +Level: intermediate + +-seealso: [](ch_ksp), `PCILU`, `PCICC`, `PCFactorSetFill()`, `PCFactorSetShiftAmount()`, `PCFactorSetZeroPivot()`, `MatReorderForNonzeroDiagonal()` + +# External Links +$(_doc_external("Ksp/PCFactorReorderForNonzeroDiagonal")) +""" +function PCFactorReorderForNonzeroDiagonal(petsclib::PetscLibType, pc::PC, rtol::PetscReal) end + +@for_petsc function PCFactorReorderForNonzeroDiagonal(petsclib::$UnionPetscLib, pc::PC, rtol::$PetscReal ) + + @chk ccall( + (:PCFactorReorderForNonzeroDiagonal, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, rtol, + ) + + + return nothing +end + +""" + PCFactorSetMatSolverType(petsclib::PetscLibType,pc::PC, stype::MatSolverType) +sets the solver package that is used to perform the factorization + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `stype` - for example, `MATSOLVERSUPERLU`, `MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS` + +Options Database Key: +- `-pc_factor_mat_solver_type ` - petsc, superlu, superlu_dist, mumps, cusparse + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `MatGetFactor()`, `MatSolverType`, `PCFactorGetMatSolverType()`, `MatSolverTypeRegister()`, +`MatInitializePackage()`, `MATSOLVERSUPERLU`, `MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS`, `MatSolverTypeGet()` + +# External Links +$(_doc_external("Ksp/PCFactorSetMatSolverType")) +""" +function PCFactorSetMatSolverType(petsclib::PetscLibType, pc::PC, stype::MatSolverType) end + +@for_petsc function PCFactorSetMatSolverType(petsclib::$UnionPetscLib, pc::PC, stype::MatSolverType ) + + @chk ccall( + (:PCFactorSetMatSolverType, $petsc_library), + PetscErrorCode, + (PC, MatSolverType), + pc, stype, + ) + + + return nothing +end + +""" + stype::MatSolverType = PCFactorGetMatSolverType(petsclib::PetscLibType,pc::PC) +gets the solver package that is used to perform the factorization + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `stype` - for example, `MATSOLVERSUPERLU`, `MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS` + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `MatGetFactor()`, `MatSolverType`, `MATSOLVERSUPERLU`, +`MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS` + +# External Links +$(_doc_external("Ksp/PCFactorGetMatSolverType")) +""" +function PCFactorGetMatSolverType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFactorGetMatSolverType(petsclib::$UnionPetscLib, pc::PC ) + stype_ = Ref{MatSolverType}() + + @chk ccall( + (:PCFactorGetMatSolverType, $petsc_library), + PetscErrorCode, + (PC, Ptr{MatSolverType}), + pc, stype_, + ) + + stype = unsafe_string(stype_[]) + + return stype +end + +""" + PCFactorSetFill(petsclib::PetscLibType,pc::PC, fill::PetscReal) +Indicate the amount of fill you expect in the factored matrix, +fill = number nonzeros in factor/number nonzeros in original matrix. + +Not Collective, each process can expect a different amount of fill + +Input Parameters: +- `pc` - the preconditioner context +- `fill` - amount of expected fill + +Options Database Key: +- `-pc_factor_fill ` - Sets fill amount + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCFactorSetReuseFill()` + +# External Links +$(_doc_external("Ksp/PCFactorSetFill")) +""" +function PCFactorSetFill(petsclib::PetscLibType, pc::PC, fill::PetscReal) end + +@for_petsc function PCFactorSetFill(petsclib::$UnionPetscLib, pc::PC, fill::$PetscReal ) + + @chk ccall( + (:PCFactorSetFill, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, fill, + ) + + + return nothing +end + +""" + PCFactorSetUseInPlace(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Tells the preconditioner to do an in + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - `PETSC_TRUE` to enable, `PETSC_FALSE` to disable + +Options Database Key: +- `-pc_factor_in_place ` - Activate/deactivate in-place factorization + +-seealso: [](ch_ksp), `PC`, `Mat`, `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCFactorGetUseInPlace()` + +# External Links +$(_doc_external("Ksp/PCFactorSetUseInPlace")) +""" +function PCFactorSetUseInPlace(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCFactorSetUseInPlace(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCFactorSetUseInPlace, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCFactorGetUseInPlace(petsclib::PetscLibType,pc::PC) +Determines if an in + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `flg` - `PETSC_TRUE` to enable, `PETSC_FALSE` to disable + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCFactorSetUseInPlace()` + +# External Links +$(_doc_external("Ksp/PCFactorGetUseInPlace")) +""" +function PCFactorGetUseInPlace(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFactorGetUseInPlace(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCFactorGetUseInPlace, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCFactorSetMatOrderingType(petsclib::PetscLibType,pc::PC, ordering::MatOrderingType) +Sets the ordering routine (to reduce fill) to +be used in the `PCLU`, `PCCHOLESKY`, `PCILU`, or `PCICC` preconditioners + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `ordering` - the matrix ordering name, for example, `MATORDERINGND` or `MATORDERINGRCM` + +Options Database Key: +- `-pc_factor_mat_ordering_type ` - Sets ordering routine + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `MatOrderingType`, `MATORDERINGEXTERNAL`, `MATORDERINGND`, `MATORDERINGRCM` + +# External Links +$(_doc_external("Ksp/PCFactorSetMatOrderingType")) +""" +function PCFactorSetMatOrderingType(petsclib::PetscLibType, pc::PC, ordering::MatOrderingType) end + +@for_petsc function PCFactorSetMatOrderingType(petsclib::$UnionPetscLib, pc::PC, ordering::MatOrderingType ) + + @chk ccall( + (:PCFactorSetMatOrderingType, $petsc_library), + PetscErrorCode, + (PC, MatOrderingType), + pc, ordering, + ) + + + return nothing +end + +""" + PCFactorSetColumnPivot(petsclib::PetscLibType,pc::PC, dtcol::PetscReal) +Determines when column pivoting is done during matrix factorization. +For PETSc dense matrices column pivoting is always done, for PETSc sparse matrices +it is never done. For the MATLAB and `MATSOLVERSUPERLU` factorization this is used. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `dtcol` - 0.0 implies no pivoting, 1.0 complete pivoting (slower, requires more memory but more stable) + +Options Database Key: +- `-pc_factor_pivoting ` - perform the pivoting with the given tolerance + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCILUSetMatOrdering()`, `PCFactorSetPivotInBlocks()` + +# External Links +$(_doc_external("Ksp/PCFactorSetColumnPivot")) +""" +function PCFactorSetColumnPivot(petsclib::PetscLibType, pc::PC, dtcol::PetscReal) end + +@for_petsc function PCFactorSetColumnPivot(petsclib::$UnionPetscLib, pc::PC, dtcol::$PetscReal ) + + @chk ccall( + (:PCFactorSetColumnPivot, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, dtcol, + ) + + + return nothing +end + +""" + PCFactorSetPivotInBlocks(petsclib::PetscLibType,pc::PC, pivot::PetscBool) +Determines if pivoting is done while factoring each block +with `MATBAIJ` or `MATSBAIJ` matrices + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `pivot` - `PETSC_TRUE` or `PETSC_FALSE` + +Options Database Key: +- `-pc_factor_pivot_in_blocks ` - Pivot inside matrix dense blocks for `MATBAIJ` and `MATSBAIJ` + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCILUSetMatOrdering()`, `PCFactorSetColumnPivot()` + +# External Links +$(_doc_external("Ksp/PCFactorSetPivotInBlocks")) +""" +function PCFactorSetPivotInBlocks(petsclib::PetscLibType, pc::PC, pivot::PetscBool) end + +@for_petsc function PCFactorSetPivotInBlocks(petsclib::$UnionPetscLib, pc::PC, pivot::PetscBool ) + + @chk ccall( + (:PCFactorSetPivotInBlocks, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, pivot, + ) + + + return nothing +end + +""" + PCFactorSetReuseFill(petsclib::PetscLibType,pc::PC, flag::PetscBool) +When matrices with different nonzero structure are factored, +this causes later ones to use the fill ratio computed in the initial factorization. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flag` - `PETSC_TRUE` to reuse else `PETSC_FALSE` + +Options Database Key: +- `-pc_factor_reuse_fill` - Activates `PCFactorSetReuseFill()` + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCFactorSetReuseOrdering()`, `PCFactorSetFill()` + +# External Links +$(_doc_external("Ksp/PCFactorSetReuseFill")) +""" +function PCFactorSetReuseFill(petsclib::PetscLibType, pc::PC, flag::PetscBool) end + +@for_petsc function PCFactorSetReuseFill(petsclib::$UnionPetscLib, pc::PC, flag::PetscBool ) + + @chk ccall( + (:PCFactorSetReuseFill, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flag, + ) + + + return nothing +end + +""" + PCFactorSetReuseOrdering(petsclib::PetscLibType,pc::PC, flag::PetscBool) +When similar matrices are factored, this +causes the ordering computed in the first factor to be used for all +following factors. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flag` - `PETSC_TRUE` to reuse else `PETSC_FALSE` + +Options Database Key: +- `-pc_factor_reuse_ordering` - Activate `PCFactorSetReuseOrdering()` + +Level: intermediate + +-seealso: [](ch_ksp), `PCLU`, `PCCHOLESKY`, `PCFactorSetReuseFill()` + +# External Links +$(_doc_external("Ksp/PCFactorSetReuseOrdering")) +""" +function PCFactorSetReuseOrdering(petsclib::PetscLibType, pc::PC, flag::PetscBool) end + +@for_petsc function PCFactorSetReuseOrdering(petsclib::$UnionPetscLib, pc::PC, flag::PetscBool ) + + @chk ccall( + (:PCFactorSetReuseOrdering, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flag, + ) + + + return nothing +end + +""" + PCCompositeSetType(petsclib::PetscLibType,pc::PC, type::PCCompositeType) +Sets the type of composite preconditioner. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - `PC_COMPOSITE_ADDITIVE` (default), `PC_COMPOSITE_MULTIPLICATIVE`, `PC_COMPOSITE_SPECIAL` + +Options Database Key: +- `-pc_composite_type ` - Sets composite preconditioner type + +Level: advanced + +-seealso: [](ch_ksp), `PCCOMPOSITE`, `PC_COMPOSITE_ADDITIVE`, `PC_COMPOSITE_MULTIPLICATIVE`, `PC_COMPOSITE_SPECIAL`, `PCCompositeType`, +`PCCompositeGetType()` + +# External Links +$(_doc_external("Ksp/PCCompositeSetType")) +""" +function PCCompositeSetType(petsclib::PetscLibType, pc::PC, type::PCCompositeType) end + +@for_petsc function PCCompositeSetType(petsclib::$UnionPetscLib, pc::PC, type::PCCompositeType ) + + @chk ccall( + (:PCCompositeSetType, $petsc_library), + PetscErrorCode, + (PC, PCCompositeType), + pc, type, + ) + + + return nothing +end + +""" + type::PCCompositeType = PCCompositeGetType(petsclib::PetscLibType,pc::PC) +Gets the type of composite preconditioner. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `type` - `PC_COMPOSITE_ADDITIVE` (default), `PC_COMPOSITE_MULTIPLICATIVE`, `PC_COMPOSITE_SPECIAL` + +Level: advanced + +-seealso: [](ch_ksp), `PCCOMPOSITE`, `PC_COMPOSITE_ADDITIVE`, `PC_COMPOSITE_MULTIPLICATIVE`, `PC_COMPOSITE_SPECIAL`, `PCCompositeType`, +`PCCompositeSetType()` + +# External Links +$(_doc_external("Ksp/PCCompositeGetType")) +""" +function PCCompositeGetType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCCompositeGetType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{PCCompositeType}() + + @chk ccall( + (:PCCompositeGetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCCompositeType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PCCompositeSpecialSetAlpha(petsclib::PetscLibType,pc::PC, alpha::PetscScalar) +Sets alpha for the special composite preconditioner, `PC_COMPOSITE_SPECIAL`, +for \alpha I + R + S + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `alpha` - scale on identity + +Level: developer + +-seealso: [](ch_ksp), `PCCOMPOSITE`, `PC_COMPOSITE_ADDITIVE`, `PC_COMPOSITE_MULTIPLICATIVE`, `PC_COMPOSITE_SPECIAL`, `PCCompositeType`, +`PCCompositeSetType()`, `PCCompositeGetType()` + +# External Links +$(_doc_external("Ksp/PCCompositeSpecialSetAlpha")) +""" +function PCCompositeSpecialSetAlpha(petsclib::PetscLibType, pc::PC, alpha::PetscScalar) end + +@for_petsc function PCCompositeSpecialSetAlpha(petsclib::$UnionPetscLib, pc::PC, alpha::$PetscScalar ) + + @chk ccall( + (:PCCompositeSpecialSetAlpha, $petsc_library), + PetscErrorCode, + (PC, $PetscScalar), + pc, alpha, + ) + + + return nothing +end + +""" + PCCompositeSpecialSetAlphaMat(petsclib::PetscLibType,pc::PC, alpha_mat::PetscMat) + +# External Links +$(_doc_external("Ksp/PCCompositeSpecialSetAlphaMat")) +""" +function PCCompositeSpecialSetAlphaMat(petsclib::PetscLibType, pc::PC, alpha_mat::PetscMat) end + +@for_petsc function PCCompositeSpecialSetAlphaMat(petsclib::$UnionPetscLib, pc::PC, alpha_mat::PetscMat ) + + @chk ccall( + (:PCCompositeSpecialSetAlphaMat, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, alpha_mat, + ) + + + return nothing +end + +""" + PCCompositeAddPCType(petsclib::PetscLibType,pc::PC, type::PCType) +Adds another `PC` of the given type to the composite `PC`. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - the type of the new preconditioner + +Level: intermediate + +-seealso: [](ch_ksp), `PCCOMPOSITE`, `PCCompositeAddPC()`, `PCCompositeGetNumberPC()` + +# External Links +$(_doc_external("Ksp/PCCompositeAddPCType")) +""" +function PCCompositeAddPCType(petsclib::PetscLibType, pc::PC, type::PCType) end + +@for_petsc function PCCompositeAddPCType(petsclib::$UnionPetscLib, pc::PC, type::PCType ) + + @chk ccall( + (:PCCompositeAddPCType, $petsc_library), + PetscErrorCode, + (PC, PCType), + pc, type, + ) + + + return nothing +end + +""" + PCCompositeAddPC(petsclib::PetscLibType,pc::PC, subpc::PC) +Adds another `PC` to the composite `PC`. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `subpc` - the new preconditioner + +Level: intermediate + +-seealso: [](ch_ksp), `PCCOMPOSITE`, `PCCompositeAddPCType()`, `PCCompositeGetNumberPC()` + +# External Links +$(_doc_external("Ksp/PCCompositeAddPC")) +""" +function PCCompositeAddPC(petsclib::PetscLibType, pc::PC, subpc::PC) end + +@for_petsc function PCCompositeAddPC(petsclib::$UnionPetscLib, pc::PC, subpc::PC ) + + @chk ccall( + (:PCCompositeAddPC, $petsc_library), + PetscErrorCode, + (PC, PC), + pc, subpc, + ) + + + return nothing +end + +""" + num::PetscInt = PCCompositeGetNumberPC(petsclib::PetscLibType,pc::PC) +Gets the number of `PC` objects in the composite `PC`. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `num` - the number of sub pcs + +Level: developer + +-seealso: [](ch_ksp), `PCCOMPOSITE`, `PCCompositeGetPC()`, `PCCompositeAddPC()`, `PCCompositeAddPCType()` + +# External Links +$(_doc_external("Ksp/PCCompositeGetNumberPC")) +""" +function PCCompositeGetNumberPC(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCCompositeGetNumberPC(petsclib::$UnionPetscLib, pc::PC ) + num_ = Ref{$PetscInt}() + + @chk ccall( + (:PCCompositeGetNumberPC, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}), + pc, num_, + ) + + num = num_[] + + return num +end + +""" + PCCompositeGetPC(petsclib::PetscLibType,pc::PC, n::PetscInt, subpc::PC) +Gets one of the `PC` objects in the composite `PC`. + +Not Collective + +Input Parameters: +- `pc` - the preconditioner context +- `n` - the number of the pc requested + +Output Parameter: +- `subpc` - the PC requested + +Level: intermediate + +-seealso: [](ch_ksp), `PCCOMPOSITE`, `PCCompositeAddPCType()`, `PCCompositeGetNumberPC()`, `PCSetOperators()` + +# External Links +$(_doc_external("Ksp/PCCompositeGetPC")) +""" +function PCCompositeGetPC(petsclib::PetscLibType, pc::PC, n::PetscInt, subpc::PC) end + +@for_petsc function PCCompositeGetPC(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt, subpc::PC ) + + @chk ccall( + (:PCCompositeGetPC, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{PC}), + pc, n, subpc, + ) + + + return nothing +end + +""" + PCBDDCSetDiscreteGradient(petsclib::PetscLibType,pc::PC, G::PetscMat, order::PetscInt, field::PetscInt, global_::PetscBool, conforming::PetscBool) +Sets the discrete gradient to be used by the `PCBDDC` preconditioner + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `G` - the discrete gradient matrix (in `MATAIJ` format) +- `order` - the order of the Nedelec space (1 for the lowest order) +- `field` - the field id of the Nedelec dofs (not used if the fields have not been specified) +- `global` - the type of global ordering for the rows of `G` +- `conforming` - whether the mesh is conforming or not + +Level: advanced + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetDofsSplitting()`, `PCBDDCSetDofsSplittingLocal()`, `MATAIJ`, `PCBDDCSetDivergenceMat()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetDiscreteGradient")) +""" +function PCBDDCSetDiscreteGradient(petsclib::PetscLibType, pc::PC, G::PetscMat, order::PetscInt, field::PetscInt, global_::PetscBool, conforming::PetscBool) end + +@for_petsc function PCBDDCSetDiscreteGradient(petsclib::$UnionPetscLib, pc::PC, G::PetscMat, order::$PetscInt, field::$PetscInt, global_::PetscBool, conforming::PetscBool ) + + @chk ccall( + (:PCBDDCSetDiscreteGradient, $petsc_library), + PetscErrorCode, + (PC, CMat, $PetscInt, $PetscInt, PetscBool, PetscBool), + pc, G, order, field, global_, conforming, + ) + + + return nothing +end + +""" + PCBDDCSetDivergenceMat(petsclib::PetscLibType,pc::PC, divudotp::PetscMat, trans::PetscBool, vl2l::IS) +Sets the linear operator representing .. for the `PCBDDC` preconditioner + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `divudotp` - the matrix (must be of type `MATIS`) +- `trans` - if `PETSC_FALSE` (resp. `PETSC_TRUE`), then pressures are in the test (trial) space and velocities are in the trial (test) space. +- `vl2l` - optional index set describing the local (wrt the local matrix in `divudotp`) to local (wrt the local matrix +in the matrix used to construct the preconditioner) map for the velocities + +Level: advanced + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetDiscreteGradient()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetDivergenceMat")) +""" +function PCBDDCSetDivergenceMat(petsclib::PetscLibType, pc::PC, divudotp::PetscMat, trans::PetscBool, vl2l::IS) end + +@for_petsc function PCBDDCSetDivergenceMat(petsclib::$UnionPetscLib, pc::PC, divudotp::PetscMat, trans::PetscBool, vl2l::IS ) + + @chk ccall( + (:PCBDDCSetDivergenceMat, $petsc_library), + PetscErrorCode, + (PC, CMat, PetscBool, IS), + pc, divudotp, trans, vl2l, + ) + + + return nothing +end + +""" + PCBDDCSetChangeOfBasisMat(petsclib::PetscLibType,pc::PC, change::PetscMat, interior::PetscBool) +Set user defined change of basis for dofs + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `change` - the change of basis matrix +- `interior` - whether or not the change of basis modifies interior dofs + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC` + +# External Links +$(_doc_external("Ksp/PCBDDCSetChangeOfBasisMat")) +""" +function PCBDDCSetChangeOfBasisMat(petsclib::PetscLibType, pc::PC, change::PetscMat, interior::PetscBool) end + +@for_petsc function PCBDDCSetChangeOfBasisMat(petsclib::$UnionPetscLib, pc::PC, change::PetscMat, interior::PetscBool ) + + @chk ccall( + (:PCBDDCSetChangeOfBasisMat, $petsc_library), + PetscErrorCode, + (PC, CMat, PetscBool), + pc, change, interior, + ) + + + return nothing +end + +""" + PCBDDCSetPrimalVerticesIS(petsclib::PetscLibType,pc::PC, PrimalVertices::IS) +Set additional user defined primal vertices in `PCBDDC` + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `PrimalVertices` - index set of primal vertices in global numbering (can be empty) + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCGetPrimalVerticesIS()`, `PCBDDCSetPrimalVerticesLocalIS()`, `PCBDDCGetPrimalVerticesLocalIS()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetPrimalVerticesIS")) +""" +function PCBDDCSetPrimalVerticesIS(petsclib::PetscLibType, pc::PC, PrimalVertices::IS) end + +@for_petsc function PCBDDCSetPrimalVerticesIS(petsclib::$UnionPetscLib, pc::PC, PrimalVertices::IS ) + + @chk ccall( + (:PCBDDCSetPrimalVerticesIS, $petsc_library), + PetscErrorCode, + (PC, IS), + pc, PrimalVertices, + ) + + + return nothing +end + +""" + PCBDDCGetPrimalVerticesIS(petsclib::PetscLibType,pc::PC, is::IS) +Get user defined primal vertices set with `PCBDDCSetPrimalVerticesIS()` + +Collective + +Input Parameter: +- `pc` - the preconditioning context + +Output Parameter: +- `is` - index set of primal vertices in global numbering (`NULL` if not set) + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetPrimalVerticesIS()`, `PCBDDCSetPrimalVerticesLocalIS()`, `PCBDDCGetPrimalVerticesLocalIS()` + +# External Links +$(_doc_external("Ksp/PCBDDCGetPrimalVerticesIS")) +""" +function PCBDDCGetPrimalVerticesIS(petsclib::PetscLibType, pc::PC, is::IS) end + +@for_petsc function PCBDDCGetPrimalVerticesIS(petsclib::$UnionPetscLib, pc::PC, is::IS ) + + @chk ccall( + (:PCBDDCGetPrimalVerticesIS, $petsc_library), + PetscErrorCode, + (PC, Ptr{IS}), + pc, is, + ) + + + return nothing +end + +""" + PCBDDCSetPrimalVerticesLocalIS(petsclib::PetscLibType,pc::PC, PrimalVertices::IS) +Set additional user defined primal vertices in `PCBDDC` + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `PrimalVertices` - index set of primal vertices in local numbering (can be empty) + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetPrimalVerticesIS()`, `PCBDDCGetPrimalVerticesIS()`, `PCBDDCGetPrimalVerticesLocalIS()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetPrimalVerticesLocalIS")) +""" +function PCBDDCSetPrimalVerticesLocalIS(petsclib::PetscLibType, pc::PC, PrimalVertices::IS) end + +@for_petsc function PCBDDCSetPrimalVerticesLocalIS(petsclib::$UnionPetscLib, pc::PC, PrimalVertices::IS ) + + @chk ccall( + (:PCBDDCSetPrimalVerticesLocalIS, $petsc_library), + PetscErrorCode, + (PC, IS), + pc, PrimalVertices, + ) + + + return nothing +end + +""" + PCBDDCGetPrimalVerticesLocalIS(petsclib::PetscLibType,pc::PC, is::IS) +Get user defined primal vertices set with `PCBDDCSetPrimalVerticesLocalIS()` + +Collective + +Input Parameter: +- `pc` - the preconditioning context + +Output Parameter: +- `is` - index set of primal vertices in local numbering (`NULL` if not set) + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetPrimalVerticesIS()`, `PCBDDCGetPrimalVerticesIS()`, `PCBDDCSetPrimalVerticesLocalIS()` + +# External Links +$(_doc_external("Ksp/PCBDDCGetPrimalVerticesLocalIS")) +""" +function PCBDDCGetPrimalVerticesLocalIS(petsclib::PetscLibType, pc::PC, is::IS) end + +@for_petsc function PCBDDCGetPrimalVerticesLocalIS(petsclib::$UnionPetscLib, pc::PC, is::IS ) + + @chk ccall( + (:PCBDDCGetPrimalVerticesLocalIS, $petsc_library), + PetscErrorCode, + (PC, Ptr{IS}), + pc, is, + ) + + + return nothing +end + +""" + PCBDDCSetCoarseningRatio(petsclib::PetscLibType,pc::PC, k::PetscInt) +Set coarsening ratio used in the multi + +Logically Collective + +Input Parameters: +- `pc` - the preconditioning context +- `k` - coarsening ratio (H/h at the coarser level) + +Options Database Key: +- `-pc_bddc_coarsening_ratio ` - Set the coarsening ratio used in multi-level coarsening + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetLevels()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetCoarseningRatio")) +""" +function PCBDDCSetCoarseningRatio(petsclib::PetscLibType, pc::PC, k::PetscInt) end + +@for_petsc function PCBDDCSetCoarseningRatio(petsclib::$UnionPetscLib, pc::PC, k::$PetscInt ) + + @chk ccall( + (:PCBDDCSetCoarseningRatio, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, k, + ) + + + return nothing +end + +""" + PCBDDCSetLevels(petsclib::PetscLibType,pc::PC, levels::PetscInt) +Sets the maximum number of additional levels allowed for multilevel `PCBDDC` + +Logically Collective + +Input Parameters: +- `pc` - the preconditioning context +- `levels` - the maximum number of levels + +Options Database Key: +- `-pc_bddc_levels ` - Set maximum number of levels for multilevel + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetCoarseningRatio()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetLevels")) +""" +function PCBDDCSetLevels(petsclib::PetscLibType, pc::PC, levels::PetscInt) end + +@for_petsc function PCBDDCSetLevels(petsclib::$UnionPetscLib, pc::PC, levels::$PetscInt ) + + @chk ccall( + (:PCBDDCSetLevels, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, levels, + ) + + + return nothing +end + +""" + PCBDDCSetDirichletBoundaries(petsclib::PetscLibType,pc::PC, DirichletBoundaries::IS) +Set the `IS` defining Dirichlet boundaries for the global problem. + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `DirichletBoundaries` - parallel `IS` defining the Dirichlet boundaries + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetDirichletBoundariesLocal()`, `MatZeroRows()`, `MatZeroRowsColumns()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetDirichletBoundaries")) +""" +function PCBDDCSetDirichletBoundaries(petsclib::PetscLibType, pc::PC, DirichletBoundaries::IS) end + +@for_petsc function PCBDDCSetDirichletBoundaries(petsclib::$UnionPetscLib, pc::PC, DirichletBoundaries::IS ) + + @chk ccall( + (:PCBDDCSetDirichletBoundaries, $petsc_library), + PetscErrorCode, + (PC, IS), + pc, DirichletBoundaries, + ) + + + return nothing +end + +""" + PCBDDCSetDirichletBoundariesLocal(petsclib::PetscLibType,pc::PC, DirichletBoundaries::IS) +Set the `IS` defining Dirichlet boundaries for the global problem in local ordering. + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `DirichletBoundaries` - parallel `IS` defining the Dirichlet boundaries (in local ordering) + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetDirichletBoundaries()`, `MatZeroRows()`, `MatZeroRowsColumns()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetDirichletBoundariesLocal")) +""" +function PCBDDCSetDirichletBoundariesLocal(petsclib::PetscLibType, pc::PC, DirichletBoundaries::IS) end + +@for_petsc function PCBDDCSetDirichletBoundariesLocal(petsclib::$UnionPetscLib, pc::PC, DirichletBoundaries::IS ) + + @chk ccall( + (:PCBDDCSetDirichletBoundariesLocal, $petsc_library), + PetscErrorCode, + (PC, IS), + pc, DirichletBoundaries, + ) + + + return nothing +end + +""" + PCBDDCSetNeumannBoundaries(petsclib::PetscLibType,pc::PC, NeumannBoundaries::IS) +Set the `IS` defining Neumann boundaries for the global problem. + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `NeumannBoundaries` - parallel `IS` defining the Neumann boundaries + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetNeumannBoundariesLocal()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetNeumannBoundaries")) +""" +function PCBDDCSetNeumannBoundaries(petsclib::PetscLibType, pc::PC, NeumannBoundaries::IS) end + +@for_petsc function PCBDDCSetNeumannBoundaries(petsclib::$UnionPetscLib, pc::PC, NeumannBoundaries::IS ) + + @chk ccall( + (:PCBDDCSetNeumannBoundaries, $petsc_library), + PetscErrorCode, + (PC, IS), + pc, NeumannBoundaries, + ) + + + return nothing +end + +""" + PCBDDCSetNeumannBoundariesLocal(petsclib::PetscLibType,pc::PC, NeumannBoundaries::IS) +Set the `IS` defining Neumann boundaries for the global problem in local ordering. + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `NeumannBoundaries` - parallel `IS` defining the subdomain part of Neumann boundaries (in local ordering) + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetNeumannBoundaries()`, `PCBDDCGetDirichletBoundaries()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetNeumannBoundariesLocal")) +""" +function PCBDDCSetNeumannBoundariesLocal(petsclib::PetscLibType, pc::PC, NeumannBoundaries::IS) end + +@for_petsc function PCBDDCSetNeumannBoundariesLocal(petsclib::$UnionPetscLib, pc::PC, NeumannBoundaries::IS ) + + @chk ccall( + (:PCBDDCSetNeumannBoundariesLocal, $petsc_library), + PetscErrorCode, + (PC, IS), + pc, NeumannBoundaries, + ) + + + return nothing +end + +""" + PCBDDCGetDirichletBoundaries(petsclib::PetscLibType,pc::PC, DirichletBoundaries::IS) +Get parallel `IS` for Dirichlet boundaries + +Collective + +Input Parameter: +- `pc` - the preconditioning context + +Output Parameter: +- `DirichletBoundaries` - index set defining the Dirichlet boundaries + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetDirichletBoundaries()` + +# External Links +$(_doc_external("Ksp/PCBDDCGetDirichletBoundaries")) +""" +function PCBDDCGetDirichletBoundaries(petsclib::PetscLibType, pc::PC, DirichletBoundaries::IS) end + +@for_petsc function PCBDDCGetDirichletBoundaries(petsclib::$UnionPetscLib, pc::PC, DirichletBoundaries::IS ) + + @chk ccall( + (:PCBDDCGetDirichletBoundaries, $petsc_library), + PetscErrorCode, + (PC, Ptr{IS}), + pc, DirichletBoundaries, + ) + + + return nothing +end + +""" + PCBDDCGetDirichletBoundariesLocal(petsclib::PetscLibType,pc::PC, DirichletBoundaries::IS) +Get parallel `IS` for Dirichlet boundaries (in local ordering) + +Collective + +Input Parameter: +- `pc` - the preconditioning context + +Output Parameter: +- `DirichletBoundaries` - index set defining the subdomain part of Dirichlet boundaries + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCGetDirichletBoundaries()`, `PCBDDCSetDirichletBoundaries()` + +# External Links +$(_doc_external("Ksp/PCBDDCGetDirichletBoundariesLocal")) +""" +function PCBDDCGetDirichletBoundariesLocal(petsclib::PetscLibType, pc::PC, DirichletBoundaries::IS) end + +@for_petsc function PCBDDCGetDirichletBoundariesLocal(petsclib::$UnionPetscLib, pc::PC, DirichletBoundaries::IS ) + + @chk ccall( + (:PCBDDCGetDirichletBoundariesLocal, $petsc_library), + PetscErrorCode, + (PC, Ptr{IS}), + pc, DirichletBoundaries, + ) + + + return nothing +end + +""" + PCBDDCGetNeumannBoundaries(petsclib::PetscLibType,pc::PC, NeumannBoundaries::IS) +Get parallel `IS` for Neumann boundaries + +Not Collective + +Input Parameter: +- `pc` - the preconditioning context + +Output Parameter: +- `NeumannBoundaries` - index set defining the Neumann boundaries + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetNeumannBoundaries()`, `PCBDDCGetDirichletBoundaries()`, `PCBDDCSetDirichletBoundaries()` + +# External Links +$(_doc_external("Ksp/PCBDDCGetNeumannBoundaries")) +""" +function PCBDDCGetNeumannBoundaries(petsclib::PetscLibType, pc::PC, NeumannBoundaries::IS) end + +@for_petsc function PCBDDCGetNeumannBoundaries(petsclib::$UnionPetscLib, pc::PC, NeumannBoundaries::IS ) + + @chk ccall( + (:PCBDDCGetNeumannBoundaries, $petsc_library), + PetscErrorCode, + (PC, Ptr{IS}), + pc, NeumannBoundaries, + ) + + + return nothing +end + +""" + PCBDDCGetNeumannBoundariesLocal(petsclib::PetscLibType,pc::PC, NeumannBoundaries::IS) +Get parallel `IS` for Neumann boundaries (in local ordering) + +Not Collective + +Input Parameter: +- `pc` - the preconditioning context + +Output Parameter: +- `NeumannBoundaries` - index set defining the subdomain part of Neumann boundaries + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetNeumannBoundaries()`, `PCBDDCSetNeumannBoundariesLocal()`, `PCBDDCGetNeumannBoundaries()` + +# External Links +$(_doc_external("Ksp/PCBDDCGetNeumannBoundariesLocal")) +""" +function PCBDDCGetNeumannBoundariesLocal(petsclib::PetscLibType, pc::PC, NeumannBoundaries::IS) end + +@for_petsc function PCBDDCGetNeumannBoundariesLocal(petsclib::$UnionPetscLib, pc::PC, NeumannBoundaries::IS ) + + @chk ccall( + (:PCBDDCGetNeumannBoundariesLocal, $petsc_library), + PetscErrorCode, + (PC, Ptr{IS}), + pc, NeumannBoundaries, + ) + + + return nothing +end + +""" + PCBDDCSetLocalAdjacencyGraph(petsclib::PetscLibType,pc::PC, nvtxs::PetscInt, xadj::Vector{PetscInt}, adjncy::Vector{PetscInt}, copymode::PetscCopyMode) +Set adjacency structure (CSR graph) of the local degrees of freedom. + +Not collective + +Input Parameters: +- `pc` - the preconditioning context. +- `nvtxs` - number of local vertices of the graph (i.e., the number of local dofs). +- `xadj` - CSR format row pointers for the connectivity of the dofs +- `adjncy` - CSR format column pointers for the connectivity of the dofs +- `copymode` - supported modes are `PETSC_COPY_VALUES`, `PETSC_USE_POINTER` or `PETSC_OWN_POINTER`. + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PetscCopyMode` + +# External Links +$(_doc_external("Ksp/PCBDDCSetLocalAdjacencyGraph")) +""" +function PCBDDCSetLocalAdjacencyGraph(petsclib::PetscLibType, pc::PC, nvtxs::PetscInt, xadj::Vector{PetscInt}, adjncy::Vector{PetscInt}, copymode::PetscCopyMode) end + +@for_petsc function PCBDDCSetLocalAdjacencyGraph(petsclib::$UnionPetscLib, pc::PC, nvtxs::$PetscInt, xadj::Vector{$PetscInt}, adjncy::Vector{$PetscInt}, copymode::PetscCopyMode ) + + @chk ccall( + (:PCBDDCSetLocalAdjacencyGraph, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, PetscCopyMode), + pc, nvtxs, xadj, adjncy, copymode, + ) + + + return nothing +end + +""" + PCBDDCSetDofsSplittingLocal(petsclib::PetscLibType,pc::PC, n_is::PetscInt, ISForDofs::Vector{IS}) +Set the `IS` defining fields of the local subdomain matrix + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `n_is` - number of index sets defining the fields, must be the same on all MPI processes +- `ISForDofs` - array of `IS` describing the fields in local ordering + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetDofsSplitting()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetDofsSplittingLocal")) +""" +function PCBDDCSetDofsSplittingLocal(petsclib::PetscLibType, pc::PC, n_is::PetscInt, ISForDofs::Vector{IS}) end + +@for_petsc function PCBDDCSetDofsSplittingLocal(petsclib::$UnionPetscLib, pc::PC, n_is::$PetscInt, ISForDofs::Vector{IS} ) + + @chk ccall( + (:PCBDDCSetDofsSplittingLocal, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{IS}), + pc, n_is, ISForDofs, + ) + + + return nothing +end + +""" + PCBDDCSetDofsSplitting(petsclib::PetscLibType,pc::PC, n_is::PetscInt, ISForDofs::Vector{IS}) +Set the `IS` defining fields of the global matrix + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `n_is` - number of index sets defining the fields +- `ISForDofs` - array of `IS` describing the fields in global ordering + +Level: intermediate + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCSetDofsSplittingLocal()` + +# External Links +$(_doc_external("Ksp/PCBDDCSetDofsSplitting")) +""" +function PCBDDCSetDofsSplitting(petsclib::PetscLibType, pc::PC, n_is::PetscInt, ISForDofs::Vector{IS}) end + +@for_petsc function PCBDDCSetDofsSplitting(petsclib::$UnionPetscLib, pc::PC, n_is::$PetscInt, ISForDofs::Vector{IS} ) + + @chk ccall( + (:PCBDDCSetDofsSplitting, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{IS}), + pc, n_is, ISForDofs, + ) + + + return nothing +end + +""" + PCBDDCMatFETIDPGetRHS(petsclib::PetscLibType,fetidp_mat::PetscMat, standard_rhs::PetscVec, fetidp_flux_rhs::PetscVec) +Compute the right + +Collective + +Input Parameters: +- `fetidp_mat` - the FETI-DP matrix object obtained by a call to `PCBDDCCreateFETIDPOperators()` +- `standard_rhs` - the right-hand side of the original linear system + +Output Parameter: +- `fetidp_flux_rhs` - the right-hand side for the FETI-DP linear system + +Level: developer + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCCreateFETIDPOperators()`, `PCBDDCMatFETIDPGetSolution()` + +# External Links +$(_doc_external("Ksp/PCBDDCMatFETIDPGetRHS")) +""" +function PCBDDCMatFETIDPGetRHS(petsclib::PetscLibType, fetidp_mat::PetscMat, standard_rhs::PetscVec, fetidp_flux_rhs::PetscVec) end + +@for_petsc function PCBDDCMatFETIDPGetRHS(petsclib::$UnionPetscLib, fetidp_mat::PetscMat, standard_rhs::PetscVec, fetidp_flux_rhs::PetscVec ) + + @chk ccall( + (:PCBDDCMatFETIDPGetRHS, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + fetidp_mat, standard_rhs, fetidp_flux_rhs, + ) + + + return nothing +end + +""" + PCBDDCMatFETIDPGetSolution(petsclib::PetscLibType,fetidp_mat::PetscMat, fetidp_flux_sol::PetscVec, standard_sol::PetscVec) +Compute the physical solution using the solution of the FETI + +Collective + +Input Parameters: +- `fetidp_mat` - the FETI-DP matrix obtained by a call to `PCBDDCCreateFETIDPOperators()` +- `fetidp_flux_sol` - the solution of the FETI-DP linear system` + +Output Parameter: +- `standard_sol` - the solution defined on the physical domain + +Level: developer + +-seealso: [](ch_ksp), `PCBDDC`, `PCBDDCCreateFETIDPOperators()`, `PCBDDCMatFETIDPGetRHS()` + +# External Links +$(_doc_external("Ksp/PCBDDCMatFETIDPGetSolution")) +""" +function PCBDDCMatFETIDPGetSolution(petsclib::PetscLibType, fetidp_mat::PetscMat, fetidp_flux_sol::PetscVec, standard_sol::PetscVec) end + +@for_petsc function PCBDDCMatFETIDPGetSolution(petsclib::$UnionPetscLib, fetidp_mat::PetscMat, fetidp_flux_sol::PetscVec, standard_sol::PetscVec ) + + @chk ccall( + (:PCBDDCMatFETIDPGetSolution, $petsc_library), + PetscErrorCode, + (CMat, CVec, CVec), + fetidp_mat, fetidp_flux_sol, standard_sol, + ) + + + return nothing +end + +""" + fetidp_mat::PetscMat,fetidp_pc::PC = PCBDDCCreateFETIDPOperators(petsclib::PetscLibType,pc::PC, fully_redundant::PetscBool, prefix::String) +Create FETI + +Collective + +Input Parameters: +- `pc` - the `PCBDDC` preconditioning context (setup should have been called before) +- `fully_redundant` - true for a fully redundant set of Lagrange multipliers +- `prefix` - optional options database prefix for the objects to be created (can be `NULL`) + +Output Parameters: +- `fetidp_mat` - shell FETI-DP matrix object +- `fetidp_pc` - shell Dirichlet preconditioner for FETI-DP matrix + +Level: developer + +-seealso: [](ch_ksp), `KSPFETIDP`, `PCBDDC`, `PCBDDCMatFETIDPGetRHS()`, `PCBDDCMatFETIDPGetSolution()` + +# External Links +$(_doc_external("Ksp/PCBDDCCreateFETIDPOperators")) +""" +function PCBDDCCreateFETIDPOperators(petsclib::PetscLibType, pc::PC, fully_redundant::PetscBool, prefix::String) end + +@for_petsc function PCBDDCCreateFETIDPOperators(petsclib::$UnionPetscLib, pc::PC, fully_redundant::PetscBool, prefix::String ) + fetidp_mat_ = Ref{CMat}() + fetidp_pc_ = Ref{PC}() + + @chk ccall( + (:PCBDDCCreateFETIDPOperators, $petsc_library), + PetscErrorCode, + (PC, PetscBool, Ptr{Cchar}, Ptr{CMat}, Ptr{PC}), + pc, fully_redundant, prefix, fetidp_mat_, fetidp_pc_, + ) + + fetidp_mat = PetscMat(fetidp_mat_[], petsclib) + fetidp_pc = fetidp_pc_[] + + return fetidp_mat,fetidp_pc +end + +""" + PCBDDCInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PCBDDC` package. It is called +from `PCInitializePackage()`. + +Level: developer + +-seealso: [](ch_ksp), `PetscInitialize()`, `PCBDDCFinalizePackage()` + +# External Links +$(_doc_external("Ksp/PCBDDCInitializePackage")) +""" +function PCBDDCInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PCBDDCInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PCBDDCInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PCBDDCFinalizePackage(petsclib::PetscLibType) +This function frees everything from the `PCBDDC` package. It is +called from `PetscFinalize()` automatically. + +Level: developer + +-seealso: [](ch_ksp), `PetscFinalize()`, `PCBDDCInitializePackage()` + +# External Links +$(_doc_external("Ksp/PCBDDCFinalizePackage")) +""" +function PCBDDCFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PCBDDCFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PCBDDCFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PCHPDDMSetAuxiliaryMat(petsclib::PetscLibType,pc::PC, is::IS, A::PetscMat, setup::external, ctx::Cvoid) + +# External Links +$(_doc_external("Ksp/PCHPDDMSetAuxiliaryMat")) +""" +function PCHPDDMSetAuxiliaryMat(petsclib::PetscLibType, pc::PC, is::IS, A::PetscMat, setup::external, ctx::Cvoid) end + +@for_petsc function PCHPDDMSetAuxiliaryMat(petsclib::$UnionPetscLib, pc::PC, is::IS, A::PetscMat, setup::external, ctx::Cvoid ) + + @chk ccall( + (:PCHPDDMSetAuxiliaryMat, $petsc_library), + PetscErrorCode, + (PC, IS, CMat, external, Ptr{Cvoid}), + pc, is, A, setup, ctx, + ) + + + return nothing +end + +""" + PCHPDDMHasNeumannMat(petsclib::PetscLibType,pc::PC, has::PetscBool) + +# External Links +$(_doc_external("Ksp/PCHPDDMHasNeumannMat")) +""" +function PCHPDDMHasNeumannMat(petsclib::PetscLibType, pc::PC, has::PetscBool) end + +@for_petsc function PCHPDDMHasNeumannMat(petsclib::$UnionPetscLib, pc::PC, has::PetscBool ) + + @chk ccall( + (:PCHPDDMHasNeumannMat, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, has, + ) + + + return nothing +end + +""" + PCHPDDMSetRHSMat(petsclib::PetscLibType,pc::PC, B::PetscMat) + +# External Links +$(_doc_external("Ksp/PCHPDDMSetRHSMat")) +""" +function PCHPDDMSetRHSMat(petsclib::PetscLibType, pc::PC, B::PetscMat) end + +@for_petsc function PCHPDDMSetRHSMat(petsclib::$UnionPetscLib, pc::PC, B::PetscMat ) + + @chk ccall( + (:PCHPDDMSetRHSMat, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, B, + ) + + + return nothing +end + +""" + gc::PetscReal,oc::PetscReal = PCHPDDMGetComplexities(petsclib::PetscLibType,pc::PC) + +# External Links +$(_doc_external("Ksp/PCHPDDMGetComplexities")) +""" +function PCHPDDMGetComplexities(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCHPDDMGetComplexities(petsclib::$UnionPetscLib, pc::PC ) + gc_ = Ref{$PetscReal}() + oc_ = Ref{$PetscReal}() + + @chk ccall( + (:PCHPDDMGetComplexities, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscReal}, Ptr{$PetscReal}), + pc, gc_, oc_, + ) + + gc = gc_[] + oc = oc_[] + + return gc,oc +end + +""" + PCHPDDMSetCoarseCorrectionType(petsclib::PetscLibType,pc::PC, type::PCHPDDMCoarseCorrectionType) + +# External Links +$(_doc_external("Ksp/PCHPDDMSetCoarseCorrectionType")) +""" +function PCHPDDMSetCoarseCorrectionType(petsclib::PetscLibType, pc::PC, type::PCHPDDMCoarseCorrectionType) end + +@for_petsc function PCHPDDMSetCoarseCorrectionType(petsclib::$UnionPetscLib, pc::PC, type::PCHPDDMCoarseCorrectionType ) + + @chk ccall( + (:PCHPDDMSetCoarseCorrectionType, $petsc_library), + PetscErrorCode, + (PC, PCHPDDMCoarseCorrectionType), + pc, type, + ) + + + return nothing +end + +""" + type::PCHPDDMCoarseCorrectionType = PCHPDDMGetCoarseCorrectionType(petsclib::PetscLibType,pc::PC) + +# External Links +$(_doc_external("Ksp/PCHPDDMGetCoarseCorrectionType")) +""" +function PCHPDDMGetCoarseCorrectionType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCHPDDMGetCoarseCorrectionType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{PCHPDDMCoarseCorrectionType}() + + @chk ccall( + (:PCHPDDMGetCoarseCorrectionType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCHPDDMCoarseCorrectionType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PCHPDDMSetSTShareSubKSP(petsclib::PetscLibType,pc::PC, share::PetscBool) + +# External Links +$(_doc_external("Ksp/PCHPDDMSetSTShareSubKSP")) +""" +function PCHPDDMSetSTShareSubKSP(petsclib::PetscLibType, pc::PC, share::PetscBool) end + +@for_petsc function PCHPDDMSetSTShareSubKSP(petsclib::$UnionPetscLib, pc::PC, share::PetscBool ) + + @chk ccall( + (:PCHPDDMSetSTShareSubKSP, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, share, + ) + + + return nothing +end + +""" + share::PetscBool = PCHPDDMGetSTShareSubKSP(petsclib::PetscLibType,pc::PC) + +# External Links +$(_doc_external("Ksp/PCHPDDMGetSTShareSubKSP")) +""" +function PCHPDDMGetSTShareSubKSP(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCHPDDMGetSTShareSubKSP(petsclib::$UnionPetscLib, pc::PC ) + share_ = Ref{PetscBool}() + + @chk ccall( + (:PCHPDDMGetSTShareSubKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, share_, + ) + + share = share_[] + + return share +end + +""" + PCHPDDMSetDeflationMat(petsclib::PetscLibType,pc::PC, is::IS, U::PetscMat) + +# External Links +$(_doc_external("Ksp/PCHPDDMSetDeflationMat")) +""" +function PCHPDDMSetDeflationMat(petsclib::PetscLibType, pc::PC, is::IS, U::PetscMat) end + +@for_petsc function PCHPDDMSetDeflationMat(petsclib::$UnionPetscLib, pc::PC, is::IS, U::PetscMat ) + + @chk ccall( + (:PCHPDDMSetDeflationMat, $petsc_library), + PetscErrorCode, + (PC, IS, CMat), + pc, is, U, + ) + + + return nothing +end + +""" + PCHPDDMInitializePackage(petsclib::PetscLibType) + +# External Links +$(_doc_external("Ksp/PCHPDDMInitializePackage")) +""" +function PCHPDDMInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PCHPDDMInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PCHPDDMInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PCHPDDMFinalizePackage(petsclib::PetscLibType) + +# External Links +$(_doc_external("Ksp/PCHPDDMFinalizePackage")) +""" +function PCHPDDMFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PCHPDDMFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PCHPDDMFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PCPatchSetSaveOperators(petsclib::PetscLibType,pc::PC, flg::PetscBool) + +# External Links +$(_doc_external("Ksp/PCPatchSetSaveOperators")) +""" +function PCPatchSetSaveOperators(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCPatchSetSaveOperators(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCPatchSetSaveOperators, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCPatchGetSaveOperators(petsclib::PetscLibType,pc::PC) + +# External Links +$(_doc_external("Ksp/PCPatchGetSaveOperators")) +""" +function PCPatchGetSaveOperators(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCPatchGetSaveOperators(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCPatchGetSaveOperators, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCPatchSetPrecomputeElementTensors(petsclib::PetscLibType,pc::PC, flg::PetscBool) + +# External Links +$(_doc_external("Ksp/PCPatchSetPrecomputeElementTensors")) +""" +function PCPatchSetPrecomputeElementTensors(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCPatchSetPrecomputeElementTensors(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCPatchSetPrecomputeElementTensors, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCPatchGetPrecomputeElementTensors(petsclib::PetscLibType,pc::PC) + +# External Links +$(_doc_external("Ksp/PCPatchGetPrecomputeElementTensors")) +""" +function PCPatchGetPrecomputeElementTensors(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCPatchGetPrecomputeElementTensors(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCPatchGetPrecomputeElementTensors, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCPatchSetPartitionOfUnity(petsclib::PetscLibType,pc::PC, flg::PetscBool) + +# External Links +$(_doc_external("Ksp/PCPatchSetPartitionOfUnity")) +""" +function PCPatchSetPartitionOfUnity(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCPatchSetPartitionOfUnity(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCPatchSetPartitionOfUnity, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCPatchGetPartitionOfUnity(petsclib::PetscLibType,pc::PC) + +# External Links +$(_doc_external("Ksp/PCPatchGetPartitionOfUnity")) +""" +function PCPatchGetPartitionOfUnity(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCPatchGetPartitionOfUnity(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCPatchGetPartitionOfUnity, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + npatch::PetscInt = PCPatchGetSubKSP(petsclib::PetscLibType,pc::PC, ksp::PetscKSP) + +# External Links +$(_doc_external("Ksp/PCPatchGetSubKSP")) +""" +function PCPatchGetSubKSP(petsclib::PetscLibType, pc::PC, ksp::PetscKSP) end + +@for_petsc function PCPatchGetSubKSP(petsclib::$UnionPetscLib, pc::PC, ksp::PetscKSP ) + npatch_ = Ref{$PetscInt}() + + @chk ccall( + (:PCPatchGetSubKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, CKSP), + pc, npatch_, ksp, + ) + + npatch = npatch_[] + + return npatch +end + +""" + PCPatchSetSubMatType(petsclib::PetscLibType,pc::PC, sub_mat_type::MatType) + +# External Links +$(_doc_external("Ksp/PCPatchSetSubMatType")) +""" +function PCPatchSetSubMatType(petsclib::PetscLibType, pc::PC, sub_mat_type::MatType) end + +@for_petsc function PCPatchSetSubMatType(petsclib::$UnionPetscLib, pc::PC, sub_mat_type::MatType ) + + @chk ccall( + (:PCPatchSetSubMatType, $petsc_library), + PetscErrorCode, + (PC, MatType), + pc, sub_mat_type, + ) + + + return nothing +end + +""" + sub_mat_type::MatType = PCPatchGetSubMatType(petsclib::PetscLibType,pc::PC) + +# External Links +$(_doc_external("Ksp/PCPatchGetSubMatType")) +""" +function PCPatchGetSubMatType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCPatchGetSubMatType(petsclib::$UnionPetscLib, pc::PC ) + sub_mat_type_ = Ref{MatType}() + + @chk ccall( + (:PCPatchGetSubMatType, $petsc_library), + PetscErrorCode, + (PC, Ptr{MatType}), + pc, sub_mat_type_, + ) + + sub_mat_type = unsafe_string(sub_mat_type_[]) + + return sub_mat_type +end + +""" + PCPatchSetCellNumbering(petsclib::PetscLibType,pc::PC, cellNumbering::PetscSection) + +# External Links +$(_doc_external("Ksp/PCPatchSetCellNumbering")) +""" +function PCPatchSetCellNumbering(petsclib::PetscLibType, pc::PC, cellNumbering::PetscSection) end + +@for_petsc function PCPatchSetCellNumbering(petsclib::$UnionPetscLib, pc::PC, cellNumbering::PetscSection ) + + @chk ccall( + (:PCPatchSetCellNumbering, $petsc_library), + PetscErrorCode, + (PC, PetscSection), + pc, cellNumbering, + ) + + + return nothing +end + +""" + PCPatchGetCellNumbering(petsclib::PetscLibType,pc::PC, cellNumbering::PetscSection) + +# External Links +$(_doc_external("Ksp/PCPatchGetCellNumbering")) +""" +function PCPatchGetCellNumbering(petsclib::PetscLibType, pc::PC, cellNumbering::PetscSection) end + +@for_petsc function PCPatchGetCellNumbering(petsclib::$UnionPetscLib, pc::PC, cellNumbering::PetscSection ) + + @chk ccall( + (:PCPatchGetCellNumbering, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscSection}), + pc, cellNumbering, + ) + + + return nothing +end + +""" + ctx::Cvoid = PCPatchSetConstructType(petsclib::PetscLibType,pc::PC, ctype::PCPatchConstructType, func::external) + +# External Links +$(_doc_external("Ksp/PCPatchSetConstructType")) +""" +function PCPatchSetConstructType(petsclib::PetscLibType, pc::PC, ctype::PCPatchConstructType, func::external) end + +@for_petsc function PCPatchSetConstructType(petsclib::$UnionPetscLib, pc::PC, ctype::PCPatchConstructType, func::external ) + ctx_ = Ref{Cvoid}() + + @chk ccall( + (:PCPatchSetConstructType, $petsc_library), + PetscErrorCode, + (PC, PCPatchConstructType, external, Ptr{Cvoid}), + pc, ctype, func, ctx_, + ) + + ctx = ctx_[] + + return ctx +end + +""" + bs::PetscInt,nodesPerCell::PetscInt,subspaceOffsets::PetscInt,ghostBcNodes::PetscInt,globalBcNodes::PetscInt = PCPatchSetDiscretisationInfo(petsclib::PetscLibType,pc::PC, nsubspaces::PetscInt, dms::PetscDM, cellNodeMap::PetscInt, numGhostBcs::PetscInt, numGlobalBcs::PetscInt) + +# External Links +$(_doc_external("Ksp/PCPatchSetDiscretisationInfo")) +""" +function PCPatchSetDiscretisationInfo(petsclib::PetscLibType, pc::PC, nsubspaces::PetscInt, dms::PetscDM, cellNodeMap::PetscInt, numGhostBcs::PetscInt, numGlobalBcs::PetscInt) end + +@for_petsc function PCPatchSetDiscretisationInfo(petsclib::$UnionPetscLib, pc::PC, nsubspaces::$PetscInt, dms::PetscDM, cellNodeMap::$PetscInt, numGhostBcs::$PetscInt, numGlobalBcs::$PetscInt ) + dms_ = Ref(dms.ptr) + bs_ = Ref{$PetscInt}() + nodesPerCell_ = Ref{$PetscInt}() + subspaceOffsets_ = Ref{$PetscInt}() + ghostBcNodes_ = Ref{$PetscInt}() + globalBcNodes_ = Ref{$PetscInt}() + + @chk ccall( + (:PCPatchSetDiscretisationInfo, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{CDM}, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}), + pc, nsubspaces, dms_, bs_, nodesPerCell_, cellNodeMap, subspaceOffsets_, numGhostBcs, ghostBcNodes_, numGlobalBcs, globalBcNodes_, + ) + + dms.ptr = C_NULL + bs = bs_[] + nodesPerCell = nodesPerCell_[] + subspaceOffsets = subspaceOffsets_[] + ghostBcNodes = ghostBcNodes_[] + globalBcNodes = globalBcNodes_[] + + return bs,nodesPerCell,subspaceOffsets,ghostBcNodes,globalBcNodes +end + +""" + PCPatchSetComputeFunction(petsclib::PetscLibType,pc::PC, func::external, ctx::Cvoid) +Set the callback function used to compute patch residuals + +Logically Collective + +Input Parameters: +- `pc` - The `PC` +- `func` - The callback function +- `ctx` - The user context + +Calling sequence of `func`: +- `pc` - The `PC` +- `point` - The point +- `x` - The input solution (not used in linear problems) +- `f` - The patch residual vector +- `cellIS` - An array of the cell numbers +- `n` - The size of `dofsArray` +- `dofsArray` - The dofmap for the dofs to be solved for +- `dofsArrayWithAll` - The dofmap for all dofs on the patch +- `ctx` - The user context + +Level: advanced + +-seealso: [](ch_ksp), `PCPatchSetComputeOperator()`, `PCPatchGetComputeOperator()`, `PCPatchSetDiscretisationInfo()`, `PCPatchSetComputeFunctionInteriorFacets()` + +# External Links +$(_doc_external("Ksp/PCPatchSetComputeFunction")) +""" +function PCPatchSetComputeFunction(petsclib::PetscLibType, pc::PC, func::external, ctx::Cvoid) end + +@for_petsc function PCPatchSetComputeFunction(petsclib::$UnionPetscLib, pc::PC, func::external, ctx::Cvoid ) + + @chk ccall( + (:PCPatchSetComputeFunction, $petsc_library), + PetscErrorCode, + (PC, external, Ptr{Cvoid}), + pc, func, ctx, + ) + + + return nothing +end + +""" + PCPatchSetComputeFunctionInteriorFacets(petsclib::PetscLibType,pc::PC, func::external, ctx::Cvoid) +Set the callback function used to compute facet integrals for patch residuals + +Logically Collective + +Input Parameters: +- `pc` - The `PC` +- `func` - The callback function +- `ctx` - The user context + +Calling sequence of `func`: +- `pc` - The `PC` +- `point` - The point +- `x` - The input solution (not used in linear problems) +- `f` - The patch residual vector +- `facetIS` - An array of the facet numbers +- `n` - The size of `dofsArray` +- `dofsArray` - The dofmap for the dofs to be solved for +- `dofsArrayWithAll` - The dofmap for all dofs on the patch +- `ctx` - The user context + +Level: advanced + +-seealso: [](ch_ksp), `PCPatchSetComputeOperator()`, `PCPatchGetComputeOperator()`, `PCPatchSetDiscretisationInfo()`, `PCPatchSetComputeFunction()` + +# External Links +$(_doc_external("Ksp/PCPatchSetComputeFunctionInteriorFacets")) +""" +function PCPatchSetComputeFunctionInteriorFacets(petsclib::PetscLibType, pc::PC, func::external, ctx::Cvoid) end + +@for_petsc function PCPatchSetComputeFunctionInteriorFacets(petsclib::$UnionPetscLib, pc::PC, func::external, ctx::Cvoid ) + + @chk ccall( + (:PCPatchSetComputeFunctionInteriorFacets, $petsc_library), + PetscErrorCode, + (PC, external, Ptr{Cvoid}), + pc, func, ctx, + ) + + + return nothing +end + +""" + PCPatchSetComputeOperator(petsclib::PetscLibType,pc::PC, func::external, ctx::Cvoid) +Set the callback function used to compute patch matrices + +Logically Collective + +Input Parameters: +- `pc` - The `PC` +- `func` - The callback function +- `ctx` - The user context + +Calling sequence of `func`: +- `pc` - The `PC` +- `point` - The point +- `x` - The input solution (not used in linear problems) +- `mat` - The patch matrix +- `facetIS` - An array of the cell numbers +- `n` - The size of `dofsArray` +- `dofsArray` - The dofmap for the dofs to be solved for +- `dofsArrayWithAll` - The dofmap for all dofs on the patch +- `ctx` - The user context + +Level: advanced + +-seealso: [](ch_ksp), `PCPatchGetComputeOperator()`, `PCPatchSetComputeFunction()`, `PCPatchSetDiscretisationInfo()` + +# External Links +$(_doc_external("Ksp/PCPatchSetComputeOperator")) +""" +function PCPatchSetComputeOperator(petsclib::PetscLibType, pc::PC, func::external, ctx::Cvoid) end + +@for_petsc function PCPatchSetComputeOperator(petsclib::$UnionPetscLib, pc::PC, func::external, ctx::Cvoid ) + + @chk ccall( + (:PCPatchSetComputeOperator, $petsc_library), + PetscErrorCode, + (PC, external, Ptr{Cvoid}), + pc, func, ctx, + ) + + + return nothing +end + +""" + PCPatchSetComputeOperatorInteriorFacets(petsclib::PetscLibType,pc::PC, func::external, ctx::Cvoid) +Set the callback function used to compute facet integrals for patch matrices + +Logically Collective + +Input Parameters: +- `pc` - The `PC` +- `func` - The callback function +- `ctx` - The user context + +Calling sequence of `func`: +- `pc` - The `PC` +- `point` - The point +- `x` - The input solution (not used in linear problems) +- `mat` - The patch matrix +- `facetIS` - An array of the facet numbers +- `n` - The size of `dofsArray` +- `dofsArray` - The dofmap for the dofs to be solved for +- `dofsArrayWithAll` - The dofmap for all dofs on the patch +- `ctx` - The user context + +Level: advanced + +-seealso: [](ch_ksp), `PCPatchGetComputeOperator()`, `PCPatchSetComputeFunction()`, `PCPatchSetDiscretisationInfo()` + +# External Links +$(_doc_external("Ksp/PCPatchSetComputeOperatorInteriorFacets")) +""" +function PCPatchSetComputeOperatorInteriorFacets(petsclib::PetscLibType, pc::PC, func::external, ctx::Cvoid) end + +@for_petsc function PCPatchSetComputeOperatorInteriorFacets(petsclib::$UnionPetscLib, pc::PC, func::external, ctx::Cvoid ) + + @chk ccall( + (:PCPatchSetComputeOperatorInteriorFacets, $petsc_library), + PetscErrorCode, + (PC, external, Ptr{Cvoid}), + pc, func, ctx, + ) + + + return nothing +end + +""" + n_loc::PetscInt,first_loc::PetscInt = PCBJacobiGetSubKSP(petsclib::PetscLibType,pc::PC, ksp::Vector{PetscKSP}) +Gets the local `KSP` contexts for all blocks on +this processor. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `n_local` - the number of blocks on this processor, or NULL +- `first_local` - the global number of the first block on this processor, or NULL +- `ksp` - the array of KSP contexts + +Level: advanced + +-seealso: [](ch_ksp), `PCBJACOBI`, `PCASM`, `PCASMGetSubKSP()` + +# External Links +$(_doc_external("Ksp/PCBJacobiGetSubKSP")) +""" +function PCBJacobiGetSubKSP(petsclib::PetscLibType, pc::PC, ksp::Vector{PetscKSP}) end + +@for_petsc function PCBJacobiGetSubKSP(petsclib::$UnionPetscLib, pc::PC, ksp::Vector{PetscKSP} ) + n_loc_ = Ref{$PetscInt}() + first_loc_ = Ref{$PetscInt}() + ksp_ = Ref(pointer(ksp)) + + @chk ccall( + (:PCBJacobiGetSubKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{CKSP}}), + pc, n_loc_, first_loc_, ksp_, + ) + + n_loc = n_loc_[] + first_loc = first_loc_[] + + return n_loc,first_loc +end + +""" + PCBJacobiSetTotalBlocks(petsclib::PetscLibType,pc::PC, blocks::PetscInt, lens::Vector{PetscInt}) +Sets the global number of blocks for the block +Jacobi preconditioner. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `blocks` - the number of blocks +- `lens` - [optional] integer array containing the size of each block + +Options Database Key: +- `-pc_bjacobi_blocks ` - Sets the number of global blocks + +Level: intermediate + +-seealso: [](ch_ksp), `PCBJACOBI`, `PCSetUseAmat()`, `PCBJacobiSetLocalBlocks()` + +# External Links +$(_doc_external("Ksp/PCBJacobiSetTotalBlocks")) +""" +function PCBJacobiSetTotalBlocks(petsclib::PetscLibType, pc::PC, blocks::PetscInt, lens::Vector{PetscInt}) end + +@for_petsc function PCBJacobiSetTotalBlocks(petsclib::$UnionPetscLib, pc::PC, blocks::$PetscInt, lens::Vector{$PetscInt} ) + + @chk ccall( + (:PCBJacobiSetTotalBlocks, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{$PetscInt}), + pc, blocks, lens, + ) + + + return nothing +end + +""" + blocks::PetscInt,lens::Vector{PetscInt} = PCBJacobiGetTotalBlocks(petsclib::PetscLibType,pc::PC) +Gets the global number of blocks for the block +Jacobi, `PCBJACOBI`, preconditioner. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `blocks` - the number of blocks +- `lens` - integer array containing the size of each block + +Level: intermediate + +-seealso: [](ch_ksp), `PCBJACOBI`, `PCSetUseAmat()`, `PCBJacobiGetLocalBlocks()` + +# External Links +$(_doc_external("Ksp/PCBJacobiGetTotalBlocks")) +""" +function PCBJacobiGetTotalBlocks(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCBJacobiGetTotalBlocks(petsclib::$UnionPetscLib, pc::PC ) + blocks_ = Ref{$PetscInt}() + lens_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PCBJacobiGetTotalBlocks, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + pc, blocks_, lens_, + ) + + blocks = blocks_[] + lens = unsafe_wrap(Array, lens_[], VecGetLocalSize(petsclib, x); own = false) + + return blocks,lens +end + +""" + PCBJacobiSetLocalBlocks(petsclib::PetscLibType,pc::PC, blocks::PetscInt, lens::Vector{PetscInt}) +Sets the local number of blocks for the block +Jacobi, `PCBJACOBI`, preconditioner. + +Not Collective + +Input Parameters: +- `pc` - the preconditioner context +- `blocks` - the number of blocks +- `lens` - [optional] integer array containing size of each block + +Options Database Key: +- `-pc_bjacobi_local_blocks ` - Sets the number of local blocks + +Level: intermediate + +-seealso: [](ch_ksp), `PCBJACOBI`, `PCSetUseAmat()`, `PCBJacobiSetTotalBlocks()` + +# External Links +$(_doc_external("Ksp/PCBJacobiSetLocalBlocks")) +""" +function PCBJacobiSetLocalBlocks(petsclib::PetscLibType, pc::PC, blocks::PetscInt, lens::Vector{PetscInt}) end + +@for_petsc function PCBJacobiSetLocalBlocks(petsclib::$UnionPetscLib, pc::PC, blocks::$PetscInt, lens::Vector{$PetscInt} ) + + @chk ccall( + (:PCBJacobiSetLocalBlocks, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{$PetscInt}), + pc, blocks, lens, + ) + + + return nothing +end + +""" + PCBJacobiGetLocalBlocks(petsclib::PetscLibType,pc::PC, blocks::PetscInt, lens::Vector{PetscInt}) +Gets the local number of blocks for the block +Jacobi, `PCBJACOBI`, preconditioner. + +Not Collective + +Input Parameters: +- `pc` - the preconditioner context +- `blocks` - the number of blocks +- `lens` - [optional] integer array containing size of each block + +Level: intermediate + +-seealso: [](ch_ksp), `PCBJACOBI`, `PCSetUseAmat()`, `PCBJacobiGetTotalBlocks()` + +# External Links +$(_doc_external("Ksp/PCBJacobiGetLocalBlocks")) +""" +function PCBJacobiGetLocalBlocks(petsclib::PetscLibType, pc::PC, blocks::PetscInt, lens::Vector{PetscInt}) end + +@for_petsc function PCBJacobiGetLocalBlocks(petsclib::$UnionPetscLib, pc::PC, blocks::$PetscInt, lens::Vector{$PetscInt} ) + lens_ = Ref(pointer(lens)) + + @chk ccall( + (:PCBJacobiGetLocalBlocks, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + pc, blocks, lens_, + ) + + + return nothing +end + +""" + PCBJKOKKOSSetKSP(petsclib::PetscLibType,pc::PC, ksp::PetscKSP) + +# External Links +$(_doc_external("Ksp/PCBJKOKKOSSetKSP")) +""" +function PCBJKOKKOSSetKSP(petsclib::PetscLibType, pc::PC, ksp::PetscKSP) end + +@for_petsc function PCBJKOKKOSSetKSP(petsclib::$UnionPetscLib, pc::PC, ksp::PetscKSP ) + + @chk ccall( + (:PCBJKOKKOSSetKSP, $petsc_library), + PetscErrorCode, + (PC, CKSP), + pc, ksp, + ) + + + return nothing +end + +""" + PCBJKOKKOSGetKSP(petsclib::PetscLibType,pc::PC, ksp::PetscKSP) + +# External Links +$(_doc_external("Ksp/PCBJKOKKOSGetKSP")) +""" +function PCBJKOKKOSGetKSP(petsclib::PetscLibType, pc::PC, ksp::PetscKSP) end + +@for_petsc function PCBJKOKKOSGetKSP(petsclib::$UnionPetscLib, pc::PC, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:PCBJKOKKOSGetKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{CKSP}), + pc, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + PCSPAISetEpsilon(petsclib::PetscLibType,pc::PC, epsilon1::PetscReal) + + +Input Parameters: +- `pc` - the preconditioner +- `epsilon1` - the tolerance (default .4) + +Level: intermediate + +-seealso: [](ch_ksp), `PCSPAI`, `PCSetType()` + +# External Links +$(_doc_external("Ksp/PCSPAISetEpsilon")) +""" +function PCSPAISetEpsilon(petsclib::PetscLibType, pc::PC, epsilon1::PetscReal) end + +@for_petsc function PCSPAISetEpsilon(petsclib::$UnionPetscLib, pc::PC, epsilon1::$PetscReal ) + + @chk ccall( + (:PCSPAISetEpsilon, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, epsilon1, + ) + + + return nothing +end + +""" + PCSPAISetNBSteps(petsclib::PetscLibType,pc::PC, nbsteps1::PetscInt) +set maximum number of improvement steps per row in +the `PCSPAI` preconditioner + +Input Parameters: +- `pc` - the preconditioner +- `nbsteps1` - number of steps (default 5) + +-seealso: [](ch_ksp), `PCSPAI`, `PCSetType()`, `PCSPAISetMaxNew()` + +# External Links +$(_doc_external("Ksp/PCSPAISetNBSteps")) +""" +function PCSPAISetNBSteps(petsclib::PetscLibType, pc::PC, nbsteps1::PetscInt) end + +@for_petsc function PCSPAISetNBSteps(petsclib::$UnionPetscLib, pc::PC, nbsteps1::$PetscInt ) + + @chk ccall( + (:PCSPAISetNBSteps, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, nbsteps1, + ) + + + return nothing +end + +""" + PCSPAISetMax(petsclib::PetscLibType,pc::PC, max1::PetscInt) +set the size of various working buffers in the `PCSPAI` preconditioner + +Input Parameters: +- `pc` - the preconditioner +- `max1` - size (default is 5000) + +Level: intermediate + +-seealso: [](ch_ksp), `PCSPAI`, `PCSetType()` + +# External Links +$(_doc_external("Ksp/PCSPAISetMax")) +""" +function PCSPAISetMax(petsclib::PetscLibType, pc::PC, max1::PetscInt) end + +@for_petsc function PCSPAISetMax(petsclib::$UnionPetscLib, pc::PC, max1::$PetscInt ) + + @chk ccall( + (:PCSPAISetMax, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, max1, + ) + + + return nothing +end + +""" + PCSPAISetMaxNew(petsclib::PetscLibType,pc::PC, maxnew1::PetscInt) +set maximum number of new nonzero candidates per step in the `PCSPAI` preconditioner + +Input Parameters: +- `pc` - the preconditioner +- `maxnew1` - maximum number (default 5) + +Level: intermediate + +-seealso: [](ch_ksp), `PCSPAI`, `PCSetType()`, `PCSPAISetNBSteps()` + +# External Links +$(_doc_external("Ksp/PCSPAISetMaxNew")) +""" +function PCSPAISetMaxNew(petsclib::PetscLibType, pc::PC, maxnew1::PetscInt) end + +@for_petsc function PCSPAISetMaxNew(petsclib::$UnionPetscLib, pc::PC, maxnew1::$PetscInt ) + + @chk ccall( + (:PCSPAISetMaxNew, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, maxnew1, + ) + + + return nothing +end + +""" + PCSPAISetBlockSize(petsclib::PetscLibType,pc::PC, block_size1::PetscInt) +set the block size for the `PCSPAI` preconditioner + +Input Parameters: +- `pc` - the preconditioner +- `block_size1` - block size (default 1) + +Level: intermediate + +-seealso: [](ch_ksp), `PCSPAI`, `PCSetType()` + +# External Links +$(_doc_external("Ksp/PCSPAISetBlockSize")) +""" +function PCSPAISetBlockSize(petsclib::PetscLibType, pc::PC, block_size1::PetscInt) end + +@for_petsc function PCSPAISetBlockSize(petsclib::$UnionPetscLib, pc::PC, block_size1::$PetscInt ) + + @chk ccall( + (:PCSPAISetBlockSize, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, block_size1, + ) + + + return nothing +end + +""" + PCSPAISetCacheSize(petsclib::PetscLibType,pc::PC, cache_size::PetscInt) +specify cache size in the `PCSPAI` preconditioner + +Input Parameters: +- `pc` - the preconditioner +- `cache_size` - cache size {0,1,2,3,4,5} (default 5) + +Level: intermediate + +-seealso: [](ch_ksp), `PCSPAI`, `PCSetType()` + +# External Links +$(_doc_external("Ksp/PCSPAISetCacheSize")) +""" +function PCSPAISetCacheSize(petsclib::PetscLibType, pc::PC, cache_size::PetscInt) end + +@for_petsc function PCSPAISetCacheSize(petsclib::$UnionPetscLib, pc::PC, cache_size::$PetscInt ) + + @chk ccall( + (:PCSPAISetCacheSize, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, cache_size, + ) + + + return nothing +end + +""" + PCSPAISetVerbose(petsclib::PetscLibType,pc::PC, verbose::PetscInt) +verbosity level for the `PCSPAI` preconditioner + +Input Parameters: +- `pc` - the preconditioner +- `verbose` - level (default 1) + +Level: intermediate + +-seealso: [](ch_ksp), `PCSPAI`, `PCSetType()` + +# External Links +$(_doc_external("Ksp/PCSPAISetVerbose")) +""" +function PCSPAISetVerbose(petsclib::PetscLibType, pc::PC, verbose::PetscInt) end + +@for_petsc function PCSPAISetVerbose(petsclib::$UnionPetscLib, pc::PC, verbose::$PetscInt ) + + @chk ccall( + (:PCSPAISetVerbose, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, verbose, + ) + + + return nothing +end + +""" + PCSPAISetSp(petsclib::PetscLibType,pc::PC, sp::PetscInt) +specify a symmetric matrix sparsity pattern in the `PCSPAI` preconditioner + +Input Parameters: +- `pc` - the preconditioner +- `sp` - 0 or 1 + +Level: intermediate + +-seealso: [](ch_ksp), `PCSPAI`, `PCSetType()` + +# External Links +$(_doc_external("Ksp/PCSPAISetSp")) +""" +function PCSPAISetSp(petsclib::PetscLibType, pc::PC, sp::PetscInt) end + +@for_petsc function PCSPAISetSp(petsclib::$UnionPetscLib, pc::PC, sp::$PetscInt ) + + @chk ccall( + (:PCSPAISetSp, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, sp, + ) + + + return nothing +end + +""" + PCRedundantSetNumber(petsclib::PetscLibType,pc::PC, nredundant::PetscInt) +Sets the number of redundant preconditioner contexts. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `nredundant` - number of redundant preconditioner contexts; for example if you are using 64 MPI processes and +use an nredundant of 4 there will be 4 parallel solves each on 16 = 64/4 processes. + +Level: advanced + +-seealso: [](ch_ksp), `PCREDUNDANT` + +# External Links +$(_doc_external("Ksp/PCRedundantSetNumber")) +""" +function PCRedundantSetNumber(petsclib::PetscLibType, pc::PC, nredundant::PetscInt) end + +@for_petsc function PCRedundantSetNumber(petsclib::$UnionPetscLib, pc::PC, nredundant::$PetscInt ) + + @chk ccall( + (:PCRedundantSetNumber, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, nredundant, + ) + + + return nothing +end + +""" + PCRedundantSetScatter(petsclib::PetscLibType,pc::PC, in::VecScatter, out::VecScatter) +Sets the scatter used to copy values into the +redundant local solve and the scatter to move them back into the global +vector. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `in` - the scatter to move the values in +- `out` - the scatter to move them out + +Level: advanced + +-seealso: [](ch_ksp), `PCREDUNDANT` + +# External Links +$(_doc_external("Ksp/PCRedundantSetScatter")) +""" +function PCRedundantSetScatter(petsclib::PetscLibType, pc::PC, in::VecScatter, out::VecScatter) end + +@for_petsc function PCRedundantSetScatter(petsclib::$UnionPetscLib, pc::PC, in::VecScatter, out::VecScatter ) + + @chk ccall( + (:PCRedundantSetScatter, $petsc_library), + PetscErrorCode, + (PC, VecScatter, VecScatter), + pc, in, out, + ) + + + return nothing +end + +""" + PCRedundantGetKSP(petsclib::PetscLibType,pc::PC, innerksp::PetscKSP) +Gets the less parallel `KSP` created by the redundant `PC`. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `innerksp` - the `KSP` on the smaller set of processes + +Level: advanced + +-seealso: [](ch_ksp), `PCREDUNDANT` + +# External Links +$(_doc_external("Ksp/PCRedundantGetKSP")) +""" +function PCRedundantGetKSP(petsclib::PetscLibType, pc::PC, innerksp::PetscKSP) end + +@for_petsc function PCRedundantGetKSP(petsclib::$UnionPetscLib, pc::PC, innerksp::PetscKSP ) + innerksp_ = Ref(innerksp.ptr) + + @chk ccall( + (:PCRedundantGetKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{CKSP}), + pc, innerksp_, + ) + + innerksp.ptr = C_NULL + + return nothing +end + +""" + PCRedundantGetOperators(petsclib::PetscLibType,pc::PC, mat::PetscMat, pmat::PetscMat) +gets the sequential linear system matrix and matrix used to construct the preconditioner + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `mat` - the matrix +- `pmat` - the (possibly different) matrix used to construct the preconditioner + +Level: advanced + +-seealso: [](ch_ksp), `PCREDUNDANT` + +# External Links +$(_doc_external("Ksp/PCRedundantGetOperators")) +""" +function PCRedundantGetOperators(petsclib::PetscLibType, pc::PC, mat::PetscMat, pmat::PetscMat) end + +@for_petsc function PCRedundantGetOperators(petsclib::$UnionPetscLib, pc::PC, mat::PetscMat, pmat::PetscMat ) + mat_ = Ref(mat.ptr) + pmat_ = Ref(pmat.ptr) + + @chk ccall( + (:PCRedundantGetOperators, $petsc_library), + PetscErrorCode, + (PC, Ptr{CMat}, Ptr{CMat}), + pc, mat_, pmat_, + ) + + mat.ptr = C_NULL + pmat.ptr = C_NULL + + return nothing +end + +""" + PCLMVMSetUpdateVec(petsclib::PetscLibType,pc::PC, X::PetscVec) +Set the vector to be used as solution update for the internal LMVM matrix. + +Input Parameters: +- `pc` - The preconditioner +- `X` - Solution vector + +Level: intermediate + +-seealso: `MatLMVMUpdate()`, `PCLMVMSetMatLMVM()` + +# External Links +$(_doc_external("Ksp/PCLMVMSetUpdateVec")) +""" +function PCLMVMSetUpdateVec(petsclib::PetscLibType, pc::PC, X::PetscVec) end + +@for_petsc function PCLMVMSetUpdateVec(petsclib::$UnionPetscLib, pc::PC, X::PetscVec ) + + @chk ccall( + (:PCLMVMSetUpdateVec, $petsc_library), + PetscErrorCode, + (PC, CVec), + pc, X, + ) + + + return nothing +end + +""" + PCLMVMSetMatLMVM(petsclib::PetscLibType,pc::PC, B::PetscMat) +Replaces the `MATLMVM` matrix inside the preconditioner with the one provided by the user. + +Input Parameters: +- `pc` - An `PCLMVM` preconditioner +- `B` - An `MATLMVM` type matrix + +Level: intermediate + +-seealso: [](ch_ksp), `PCLMVMGetMatLMVM()` + +# External Links +$(_doc_external("Ksp/PCLMVMSetMatLMVM")) +""" +function PCLMVMSetMatLMVM(petsclib::PetscLibType, pc::PC, B::PetscMat) end + +@for_petsc function PCLMVMSetMatLMVM(petsclib::$UnionPetscLib, pc::PC, B::PetscMat ) + + @chk ccall( + (:PCLMVMSetMatLMVM, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, B, + ) + + + return nothing +end + +""" + PCLMVMGetMatLMVM(petsclib::PetscLibType,pc::PC, B::PetscMat) +Returns a pointer to the underlying `MATLMVM` matrix. + +Input Parameter: +- `pc` - An `PCLMVM` preconditioner + +Output Parameter: +- `B` - `MATLMVM` matrix used by the preconditioner + +Level: intermediate + +-seealso: [](ch_ksp), `PCLMVMSetMatLMVM()` + +# External Links +$(_doc_external("Ksp/PCLMVMGetMatLMVM")) +""" +function PCLMVMGetMatLMVM(petsclib::PetscLibType, pc::PC, B::PetscMat) end + +@for_petsc function PCLMVMGetMatLMVM(petsclib::$UnionPetscLib, pc::PC, B::PetscMat ) + B_ = Ref(B.ptr) + + @chk ccall( + (:PCLMVMGetMatLMVM, $petsc_library), + PetscErrorCode, + (PC, Ptr{CMat}), + pc, B_, + ) + + B.ptr = C_NULL + + return nothing +end + +""" + PCLMVMSetIS(petsclib::PetscLibType,pc::PC, inactive::IS) +Sets the index sets that reduce the `PC` application. + +Input Parameters: +- `pc` - An `PCLMVM` preconditioner +- `inactive` - Index set defining the variables removed from the problem + +Level: intermediate + +-seealso: [](ch_ksp), `PCLMVMClearIS()` + +# External Links +$(_doc_external("Ksp/PCLMVMSetIS")) +""" +function PCLMVMSetIS(petsclib::PetscLibType, pc::PC, inactive::IS) end + +@for_petsc function PCLMVMSetIS(petsclib::$UnionPetscLib, pc::PC, inactive::IS ) + + @chk ccall( + (:PCLMVMSetIS, $petsc_library), + PetscErrorCode, + (PC, IS), + pc, inactive, + ) + + + return nothing +end + +""" + PCLMVMClearIS(petsclib::PetscLibType,pc::PC) +Removes the inactive variable index set from a `PCLMVM` + +Input Parameter: +- `pc` - An `PCLMVM` preconditioner + +Level: intermediate + +-seealso: [](ch_ksp), `PCLMVMSetIS()` + +# External Links +$(_doc_external("Ksp/PCLMVMClearIS")) +""" +function PCLMVMClearIS(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCLMVMClearIS(petsclib::$UnionPetscLib, pc::PC ) + + @chk ccall( + (:PCLMVMClearIS, $petsc_library), + PetscErrorCode, + (PC,), + pc, + ) + + + return nothing +end + +""" + PCRedistributeGetKSP(petsclib::PetscLibType,pc::PC, innerksp::PetscKSP) +Gets the `KSP` created by the `PCREDISTRIBUTE` + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `innerksp` - the inner `KSP` + +Level: advanced + +-seealso: [](ch_ksp), `KSP`, `PCREDISTRIBUTE` + +# External Links +$(_doc_external("Ksp/PCRedistributeGetKSP")) +""" +function PCRedistributeGetKSP(petsclib::PetscLibType, pc::PC, innerksp::PetscKSP) end + +@for_petsc function PCRedistributeGetKSP(petsclib::$UnionPetscLib, pc::PC, innerksp::PetscKSP ) + innerksp_ = Ref(innerksp.ptr) + + @chk ccall( + (:PCRedistributeGetKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{CKSP}), + pc, innerksp_, + ) + + innerksp.ptr = C_NULL + + return nothing +end + +""" + PCFieldSplitRestrictIS(petsclib::PetscLibType,pc::PC, isy::IS) +Restricts the fieldsplit `IS`s to be within a given `IS`. + +Input Parameters: +- `pc` - the preconditioner context +- `isy` - the index set that defines the indices to which the fieldsplit is to be restricted + +Level: advanced + +-seealso: [](sec_block_matrices), `PCFIELDSPLIT`, `PCFieldSplitSetFields()`, `PCFieldSplitSetIS()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitRestrictIS")) +""" +function PCFieldSplitRestrictIS(petsclib::PetscLibType, pc::PC, isy::IS) end + +@for_petsc function PCFieldSplitRestrictIS(petsclib::$UnionPetscLib, pc::PC, isy::IS ) + + @chk ccall( + (:PCFieldSplitRestrictIS, $petsc_library), + PetscErrorCode, + (PC, IS), + pc, isy, + ) + + + return nothing +end + +""" + PCFieldSplitSetFields(petsclib::PetscLibType,pc::PC, splitname::String, n::PetscInt, fields::Vector{PetscInt}, fields_col::Vector{PetscInt}) +Sets the fields that define one particular split in `PCFIELDSPLIT` + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `splitname` - name of this split, if `NULL` the number of the split is used +- `n` - the number of fields in this split +- `fields` - the fields in this split +- `fields_col` - generally the same as `fields`, if it does not match `fields` then the submatrix that is solved for this set of fields comes from an off-diagonal block +of the matrix and `fields_col` provides the column indices for that block + +Options Database Key: +- `-pc_fieldsplit_%d_fields ` - indicates the fields to be used in the `%d`'th split + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitSetBlockSize()`, `PCFieldSplitSetIS()`, `PCFieldSplitRestrictIS()`, +`MatSetBlockSize()`, `MatCreateNest()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetFields")) +""" +function PCFieldSplitSetFields(petsclib::PetscLibType, pc::PC, splitname::String, n::PetscInt, fields::Vector{PetscInt}, fields_col::Vector{PetscInt}) end + +@for_petsc function PCFieldSplitSetFields(petsclib::$UnionPetscLib, pc::PC, splitname::String, n::$PetscInt, fields::Vector{$PetscInt}, fields_col::Vector{$PetscInt} ) + + @chk ccall( + (:PCFieldSplitSetFields, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cchar}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + pc, splitname, n, fields, fields_col, + ) + + + return nothing +end + +""" + PCFieldSplitSetDiagUseAmat(petsclib::PetscLibType,pc::PC, flg::PetscBool) +set flag indicating whether to extract diagonal blocks from Amat (rather than Pmat) to build +the sub-matrices associated with each split. Where `KSPSetOperators`(ksp,Amat,Pmat) was used to supply the operators. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner object +- `flg` - boolean flag indicating whether or not to use Amat to extract the diagonal blocks from + +Options Database Key: +- `-pc_fieldsplit_diag_use_amat` - use the Amat to provide the diagonal blocks + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCSetOperators()`, `KSPSetOperators()`, `PCFieldSplitGetDiagUseAmat()`, `PCFieldSplitSetOffDiagUseAmat()`, `PCFIELDSPLIT` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetDiagUseAmat")) +""" +function PCFieldSplitSetDiagUseAmat(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCFieldSplitSetDiagUseAmat(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCFieldSplitSetDiagUseAmat, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCFieldSplitGetDiagUseAmat(petsclib::PetscLibType,pc::PC) +get the flag indicating whether to extract diagonal blocks from Amat (rather than Pmat) to build +the sub-matrices associated with each split. Where `KSPSetOperators`(ksp,Amat,Pmat) was used to supply the operators. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner object + +Output Parameter: +- `flg` - boolean flag indicating whether or not to use Amat to extract the diagonal blocks from + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCSetOperators()`, `KSPSetOperators()`, `PCFieldSplitSetDiagUseAmat()`, `PCFieldSplitGetOffDiagUseAmat()`, `PCFIELDSPLIT` + +# External Links +$(_doc_external("Ksp/PCFieldSplitGetDiagUseAmat")) +""" +function PCFieldSplitGetDiagUseAmat(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFieldSplitGetDiagUseAmat(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCFieldSplitGetDiagUseAmat, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCFieldSplitSetOffDiagUseAmat(petsclib::PetscLibType,pc::PC, flg::PetscBool) +set flag indicating whether to extract off +the sub-matrices associated with each split. Where `KSPSetOperators`(ksp,Amat,Pmat) was used to supply the operators. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner object +- `flg` - boolean flag indicating whether or not to use Amat to extract the off-diagonal blocks from + +Options Database Key: +- `-pc_fieldsplit_off_diag_use_amat ` - use the Amat to extract the off-diagonal blocks + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCSetOperators()`, `KSPSetOperators()`, `PCFieldSplitGetOffDiagUseAmat()`, `PCFieldSplitSetDiagUseAmat()`, `PCFIELDSPLIT` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetOffDiagUseAmat")) +""" +function PCFieldSplitSetOffDiagUseAmat(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCFieldSplitSetOffDiagUseAmat(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCFieldSplitSetOffDiagUseAmat, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCFieldSplitGetOffDiagUseAmat(petsclib::PetscLibType,pc::PC) +get the flag indicating whether to extract off +the sub-matrices associated with each split. Where `KSPSetOperators`(ksp,Amat,Pmat) was used to supply the operators. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner object + +Output Parameter: +- `flg` - boolean flag indicating whether or not to use Amat to extract the off-diagonal blocks from + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCSetOperators()`, `KSPSetOperators()`, `PCFieldSplitSetOffDiagUseAmat()`, `PCFieldSplitGetDiagUseAmat()`, `PCFIELDSPLIT` + +# External Links +$(_doc_external("Ksp/PCFieldSplitGetOffDiagUseAmat")) +""" +function PCFieldSplitGetOffDiagUseAmat(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFieldSplitGetOffDiagUseAmat(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCFieldSplitGetOffDiagUseAmat, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCFieldSplitSetIS(petsclib::PetscLibType,pc::PC, splitname::String, is::IS) +Sets the exact elements for a split in a `PCFIELDSPLIT` + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `splitname` - name of this split, if `NULL` the number of the split is used +- `is` - the index set that defines the elements in this split + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitSetBlockSize()`, `PCFieldSplitSetFields()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetIS")) +""" +function PCFieldSplitSetIS(petsclib::PetscLibType, pc::PC, splitname::String, is::IS) end + +@for_petsc function PCFieldSplitSetIS(petsclib::$UnionPetscLib, pc::PC, splitname::String, is::IS ) + + @chk ccall( + (:PCFieldSplitSetIS, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cchar}, IS), + pc, splitname, is, + ) + + + return nothing +end + +""" + PCFieldSplitGetIS(petsclib::PetscLibType,pc::PC, splitname::String, is::IS) +Retrieves the elements for a split as an `IS` + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `splitname` - name of this split + +Output Parameter: +- `is` - the index set that defines the elements in this split, or `NULL` if the split is not found + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitSetIS()`, `PCFieldSplitGetISByIndex()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitGetIS")) +""" +function PCFieldSplitGetIS(petsclib::PetscLibType, pc::PC, splitname::String, is::IS) end + +@for_petsc function PCFieldSplitGetIS(petsclib::$UnionPetscLib, pc::PC, splitname::String, is::IS ) + + @chk ccall( + (:PCFieldSplitGetIS, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cchar}, Ptr{IS}), + pc, splitname, is, + ) + + + return nothing +end + +""" + PCFieldSplitGetISByIndex(petsclib::PetscLibType,pc::PC, index::PetscInt, is::IS) +Retrieves the elements for a given split as an `IS` + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `index` - index of this split + +Output Parameter: +- `is` - the index set that defines the elements in this split + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitGetIS()`, `PCFieldSplitSetIS()`, + + +# External Links +$(_doc_external("Ksp/PCFieldSplitGetISByIndex")) +""" +function PCFieldSplitGetISByIndex(petsclib::PetscLibType, pc::PC, index::PetscInt, is::IS) end + +@for_petsc function PCFieldSplitGetISByIndex(petsclib::$UnionPetscLib, pc::PC, index::$PetscInt, is::IS ) + + @chk ccall( + (:PCFieldSplitGetISByIndex, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{IS}), + pc, index, is, + ) + + + return nothing +end + +""" + PCFieldSplitSetBlockSize(petsclib::PetscLibType,pc::PC, bs::PetscInt) +Sets the block size for defining where fields start in the +fieldsplit preconditioner when calling `PCFieldSplitSetFields()`. If not set the matrix block size is used. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `bs` - the block size + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitSetFields()`, `PCFieldSplitSetIS()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetBlockSize")) +""" +function PCFieldSplitSetBlockSize(petsclib::PetscLibType, pc::PC, bs::PetscInt) end + +@for_petsc function PCFieldSplitSetBlockSize(petsclib::$UnionPetscLib, pc::PC, bs::$PetscInt ) + + @chk ccall( + (:PCFieldSplitSetBlockSize, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, bs, + ) + + + return nothing +end + +""" + n::PetscInt = PCFieldSplitGetSubKSP(petsclib::PetscLibType,pc::PC, subksp::Vector{PetscKSP}) +Gets the `KSP` contexts for all splits + +Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `n` - the number of splits +- `subksp` - the array of `KSP` contexts + +Level: advanced + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitSetFields()`, `PCFieldSplitSetIS()`, `PCFieldSplitSchurGetSubKSP()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitGetSubKSP")) +""" +function PCFieldSplitGetSubKSP(petsclib::PetscLibType, pc::PC, subksp::Vector{PetscKSP}) end + +@for_petsc function PCFieldSplitGetSubKSP(petsclib::$UnionPetscLib, pc::PC, subksp::Vector{PetscKSP} ) + n_ = Ref{$PetscInt}() + subksp_ = Ref(pointer(subksp)) + + @chk ccall( + (:PCFieldSplitGetSubKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{Ptr{CKSP}}), + pc, n_, subksp_, + ) + + n = n_[] + + return n +end + +""" + n::PetscInt = PCFieldSplitSchurGetSubKSP(petsclib::PetscLibType,pc::PC, subksp::Vector{PetscKSP}) +Gets the `KSP` contexts used inside the Schur complement based `PCFIELDSPLIT` + +Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `n` - the number of splits +- `subksp` - the array of `KSP` contexts + +Level: advanced + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitSetFields()`, `PCFieldSplitSetIS()`, `PCFieldSplitGetSubKSP()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSchurGetSubKSP")) +""" +function PCFieldSplitSchurGetSubKSP(petsclib::PetscLibType, pc::PC, subksp::Vector{PetscKSP}) end + +@for_petsc function PCFieldSplitSchurGetSubKSP(petsclib::$UnionPetscLib, pc::PC, subksp::Vector{PetscKSP} ) + n_ = Ref{$PetscInt}() + subksp_ = Ref(pointer(subksp)) + + @chk ccall( + (:PCFieldSplitSchurGetSubKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{Ptr{CKSP}}), + pc, n_, subksp_, + ) + + n = n_[] + + return n +end + +""" + PCFieldSplitSetSchurPre(petsclib::PetscLibType,pc::PC, ptype::PCFieldSplitSchurPreType, pre::PetscMat) +Indicates from what operator the preconditioner is constructed for the Schur complement. +The default is the A11 matrix. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `ptype` - which matrix to use for preconditioning the Schur complement: `PC_FIELDSPLIT_SCHUR_PRE_A11` (default), +`PC_FIELDSPLIT_SCHUR_PRE_SELF`, `PC_FIELDSPLIT_SCHUR_PRE_USER`, +`PC_FIELDSPLIT_SCHUR_PRE_SELFP`, and `PC_FIELDSPLIT_SCHUR_PRE_FULL` +- `pre` - matrix to use for preconditioning, or `NULL` + +Options Database Keys: +- `-pc_fieldsplit_schur_precondition ` - default is `a11`. See notes for meaning of various arguments +- `-fieldsplit_1_pc_type ` - the preconditioner algorithm that is used to construct the preconditioner from the operator + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFieldSplitGetSchurPre()`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitSetFields()`, `PCFieldSplitSchurPreType`, +`MatSchurComplementSetAinvType()`, `PCLSC`, `PCFieldSplitSetSchurFactType()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetSchurPre")) +""" +function PCFieldSplitSetSchurPre(petsclib::PetscLibType, pc::PC, ptype::PCFieldSplitSchurPreType, pre::PetscMat) end + +@for_petsc function PCFieldSplitSetSchurPre(petsclib::$UnionPetscLib, pc::PC, ptype::PCFieldSplitSchurPreType, pre::PetscMat ) + + @chk ccall( + (:PCFieldSplitSetSchurPre, $petsc_library), + PetscErrorCode, + (PC, PCFieldSplitSchurPreType, CMat), + pc, ptype, pre, + ) + + + return nothing +end + +""" + PCFieldSplitGetSchurPre(petsclib::PetscLibType,pc::PC, ptype::PCFieldSplitSchurPreType, pre::PetscMat) +For Schur complement fieldsplit, determine how the Schur complement will be +preconditioned. See `PCFieldSplitSetSchurPre()` for details. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `ptype` - which matrix to use for preconditioning the Schur complement: `PC_FIELDSPLIT_SCHUR_PRE_A11`, `PC_FIELDSPLIT_SCHUR_PRE_SELF`, `PC_FIELDSPLIT_SCHUR_PRE_USER` +- `pre` - matrix to use for preconditioning (with `PC_FIELDSPLIT_SCHUR_PRE_USER`), or `NULL` + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFieldSplitSetSchurPre()`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitSetFields()`, `PCFieldSplitSchurPreType`, `PCLSC` + +# External Links +$(_doc_external("Ksp/PCFieldSplitGetSchurPre")) +""" +function PCFieldSplitGetSchurPre(petsclib::PetscLibType, pc::PC, ptype::PCFieldSplitSchurPreType, pre::PetscMat) end + +@for_petsc function PCFieldSplitGetSchurPre(petsclib::$UnionPetscLib, pc::PC, ptype::PCFieldSplitSchurPreType, pre::PetscMat ) + pre_ = Ref(pre.ptr) + + @chk ccall( + (:PCFieldSplitGetSchurPre, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCFieldSplitSchurPreType}, Ptr{CMat}), + pc, ptype, pre_, + ) + + pre.ptr = C_NULL + + return nothing +end + +""" + PCFieldSplitSchurGetS(petsclib::PetscLibType,pc::PC, S::PetscMat) +extract the `MATSCHURCOMPLEMENT` object used by this `PCFIELDSPLIT` in case it needs to be configured separately + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `S` - the Schur complement matrix + +Level: advanced + +-seealso: [](sec_block_matrices), `PC`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitSchurPreType`, `PCFieldSplitSetSchurPre()`, `MATSCHURCOMPLEMENT`, `PCFieldSplitSchurRestoreS()`, +`MatCreateSchurComplement()`, `MatSchurComplementGetKSP()`, `MatSchurComplementComputeExplicitOperator()`, `MatGetSchurComplement()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSchurGetS")) +""" +function PCFieldSplitSchurGetS(petsclib::PetscLibType, pc::PC, S::PetscMat) end + +@for_petsc function PCFieldSplitSchurGetS(petsclib::$UnionPetscLib, pc::PC, S::PetscMat ) + S_ = Ref(S.ptr) + + @chk ccall( + (:PCFieldSplitSchurGetS, $petsc_library), + PetscErrorCode, + (PC, Ptr{CMat}), + pc, S_, + ) + + S.ptr = C_NULL + + return nothing +end + +""" + PCFieldSplitSchurRestoreS(petsclib::PetscLibType,pc::PC, S::PetscMat) +returns the `MATSCHURCOMPLEMENT` matrix used by this `PC` + +Not Collective + +Input Parameters: +- `pc` - the preconditioner context +- `S` - the Schur complement matrix + +Level: advanced + +-seealso: [](sec_block_matrices), `PC`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitSchurPreType`, `PCFieldSplitSetSchurPre()`, `MatSchurComplement`, `PCFieldSplitSchurGetS()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSchurRestoreS")) +""" +function PCFieldSplitSchurRestoreS(petsclib::PetscLibType, pc::PC, S::PetscMat) end + +@for_petsc function PCFieldSplitSchurRestoreS(petsclib::$UnionPetscLib, pc::PC, S::PetscMat ) + S_ = Ref(S.ptr) + + @chk ccall( + (:PCFieldSplitSchurRestoreS, $petsc_library), + PetscErrorCode, + (PC, Ptr{CMat}), + pc, S_, + ) + + S.ptr = C_NULL + + return nothing +end + +""" + PCFieldSplitSetSchurFactType(petsclib::PetscLibType,pc::PC, ftype::PCFieldSplitSchurFactType) +sets which blocks of the approximate block factorization to retain in the preconditioner {cite}`murphy2000note` and {cite}`ipsen2001note` + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `ftype` - which blocks of factorization to retain, `PC_FIELDSPLIT_SCHUR_FACT_FULL` is default + +Options Database Key: +- `-pc_fieldsplit_schur_fact_type ` - default is `full` + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitSetFields()`, `PCFieldSplitSchurPreType`, `PCFieldSplitSetSchurScale()`, +[](sec_flexibleksp), `PCFieldSplitSetSchurPre()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetSchurFactType")) +""" +function PCFieldSplitSetSchurFactType(petsclib::PetscLibType, pc::PC, ftype::PCFieldSplitSchurFactType) end + +@for_petsc function PCFieldSplitSetSchurFactType(petsclib::$UnionPetscLib, pc::PC, ftype::PCFieldSplitSchurFactType ) + + @chk ccall( + (:PCFieldSplitSetSchurFactType, $petsc_library), + PetscErrorCode, + (PC, PCFieldSplitSchurFactType), + pc, ftype, + ) + + + return nothing +end + +""" + PCFieldSplitSetSchurScale(petsclib::PetscLibType,pc::PC, scale::PetscScalar) +Controls the sign flip of S for `PC_FIELDSPLIT_SCHUR_FACT_DIAG`. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `scale` - scaling factor for the Schur complement + +Options Database Key: +- `-pc_fieldsplit_schur_scale ` - default is -1.0 + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitSetFields()`, `PCFieldSplitSchurFactType`, `PCFieldSplitSetSchurFactType()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetSchurScale")) +""" +function PCFieldSplitSetSchurScale(petsclib::PetscLibType, pc::PC, scale::PetscScalar) end + +@for_petsc function PCFieldSplitSetSchurScale(petsclib::$UnionPetscLib, pc::PC, scale::$PetscScalar ) + + @chk ccall( + (:PCFieldSplitSetSchurScale, $petsc_library), + PetscErrorCode, + (PC, $PetscScalar), + pc, scale, + ) + + + return nothing +end + +""" + PCFieldSplitGetSchurBlocks(petsclib::PetscLibType,pc::PC, A00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat) +Gets all matrix blocks for the Schur complement + +Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `A00` - the (0,0) block +- `A01` - the (0,1) block +- `A10` - the (1,0) block +- `A11` - the (1,1) block + +Level: advanced + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `MatSchurComplementGetSubMatrices()`, `MatSchurComplementSetSubMatrices()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitGetSchurBlocks")) +""" +function PCFieldSplitGetSchurBlocks(petsclib::PetscLibType, pc::PC, A00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat) end + +@for_petsc function PCFieldSplitGetSchurBlocks(petsclib::$UnionPetscLib, pc::PC, A00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat ) + A00_ = Ref(A00.ptr) + A01_ = Ref(A01.ptr) + A10_ = Ref(A10.ptr) + A11_ = Ref(A11.ptr) + + @chk ccall( + (:PCFieldSplitGetSchurBlocks, $petsc_library), + PetscErrorCode, + (PC, Ptr{CMat}, Ptr{CMat}, Ptr{CMat}, Ptr{CMat}), + pc, A00_, A01_, A10_, A11_, + ) + + A00.ptr = C_NULL + A01.ptr = C_NULL + A10.ptr = C_NULL + A11.ptr = C_NULL + + return nothing +end + +""" + PCFieldSplitSetGKBTol(petsclib::PetscLibType,pc::PC, tolerance::PetscReal) +Sets the solver tolerance for the generalized Golub + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `tolerance` - the solver tolerance + +Options Database Key: +- `-pc_fieldsplit_gkb_tol ` - default is 1e-5 + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitSetGKBDelay()`, `PCFieldSplitSetGKBNu()`, `PCFieldSplitSetGKBMaxit()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetGKBTol")) +""" +function PCFieldSplitSetGKBTol(petsclib::PetscLibType, pc::PC, tolerance::PetscReal) end + +@for_petsc function PCFieldSplitSetGKBTol(petsclib::$UnionPetscLib, pc::PC, tolerance::$PetscReal ) + + @chk ccall( + (:PCFieldSplitSetGKBTol, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, tolerance, + ) + + + return nothing +end + +""" + PCFieldSplitSetGKBMaxit(petsclib::PetscLibType,pc::PC, maxit::PetscInt) +Sets the maximum number of iterations for the generalized Golub + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `maxit` - the maximum number of iterations + +Options Database Key: +- `-pc_fieldsplit_gkb_maxit ` - default is 100 + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitSetGKBDelay()`, `PCFieldSplitSetGKBTol()`, `PCFieldSplitSetGKBNu()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetGKBMaxit")) +""" +function PCFieldSplitSetGKBMaxit(petsclib::PetscLibType, pc::PC, maxit::PetscInt) end + +@for_petsc function PCFieldSplitSetGKBMaxit(petsclib::$UnionPetscLib, pc::PC, maxit::$PetscInt ) + + @chk ccall( + (:PCFieldSplitSetGKBMaxit, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, maxit, + ) + + + return nothing +end + +""" + PCFieldSplitSetGKBDelay(petsclib::PetscLibType,pc::PC, delay::PetscInt) +Sets the delay in the lower bound error estimate in the generalized Golub +preconditioner. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `delay` - the delay window in the lower bound estimate + +Options Database Key: +- `-pc_fieldsplit_gkb_delay ` - default is 5 + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitSetGKBNu()`, `PCFieldSplitSetGKBTol()`, `PCFieldSplitSetGKBMaxit()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetGKBDelay")) +""" +function PCFieldSplitSetGKBDelay(petsclib::PetscLibType, pc::PC, delay::PetscInt) end + +@for_petsc function PCFieldSplitSetGKBDelay(petsclib::$UnionPetscLib, pc::PC, delay::$PetscInt ) + + @chk ccall( + (:PCFieldSplitSetGKBDelay, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, delay, + ) + + + return nothing +end + +""" + PCFieldSplitSetGKBNu(petsclib::PetscLibType,pc::PC, nu::PetscReal) +Sets the scalar value nu >= 0 in the transformation H = A00 + nu*A01*A01' of the (1,1) block in the +Golub-Kahan bidiagonalization preconditioner {cite}`arioli2013` in `PCFIELDSPLIT` + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `nu` - the shift parameter + +Options Database Key: +- `-pc_fieldsplit_gkb_nu ` - default is 1 + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitSetGKBDelay()`, `PCFieldSplitSetGKBTol()`, `PCFieldSplitSetGKBMaxit()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetGKBNu")) +""" +function PCFieldSplitSetGKBNu(petsclib::PetscLibType, pc::PC, nu::PetscReal) end + +@for_petsc function PCFieldSplitSetGKBNu(petsclib::$UnionPetscLib, pc::PC, nu::$PetscReal ) + + @chk ccall( + (:PCFieldSplitSetGKBNu, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, nu, + ) + + + return nothing +end + +""" + PCFieldSplitSetType(petsclib::PetscLibType,pc::PC, type::PCCompositeType) +Sets the type, `PCCompositeType`, of a `PCFIELDSPLIT` + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - `PC_COMPOSITE_ADDITIVE`, `PC_COMPOSITE_MULTIPLICATIVE` (default), `PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE`, `PC_COMPOSITE_SPECIAL`, `PC_COMPOSITE_SCHUR`, +`PC_COMPOSITE_GKB` + +Options Database Key: +- `-pc_fieldsplit_type ` - Sets fieldsplit preconditioner type + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCCompositeType`, `PCCompositeGetType()`, `PC_COMPOSITE_ADDITIVE`, `PC_COMPOSITE_MULTIPLICATIVE`, +`PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE`, `PC_COMPOSITE_SPECIAL`, `PC_COMPOSITE_SCHUR`, `PCFieldSplitSetSchurFactType()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetType")) +""" +function PCFieldSplitSetType(petsclib::PetscLibType, pc::PC, type::PCCompositeType) end + +@for_petsc function PCFieldSplitSetType(petsclib::$UnionPetscLib, pc::PC, type::PCCompositeType ) + + @chk ccall( + (:PCFieldSplitSetType, $petsc_library), + PetscErrorCode, + (PC, PCCompositeType), + pc, type, + ) + + + return nothing +end + +""" + type::PCCompositeType = PCFieldSplitGetType(petsclib::PetscLibType,pc::PC) +Gets the type, `PCCompositeType`, of a `PCFIELDSPLIT` + +Not collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `type` - `PC_COMPOSITE_ADDITIVE`, `PC_COMPOSITE_MULTIPLICATIVE` (default), `PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE`, `PC_COMPOSITE_SPECIAL`, `PC_COMPOSITE_SCHUR` + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCCompositeSetType()`, `PCFIELDSPLIT`, `PCCompositeType`, `PC_COMPOSITE_ADDITIVE`, `PC_COMPOSITE_MULTIPLICATIVE`, +`PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE`, `PC_COMPOSITE_SPECIAL`, `PC_COMPOSITE_SCHUR` + +# External Links +$(_doc_external("Ksp/PCFieldSplitGetType")) +""" +function PCFieldSplitGetType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFieldSplitGetType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{PCCompositeType}() + + @chk ccall( + (:PCFieldSplitGetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCCompositeType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PCFieldSplitSetDMSplits(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Flags whether `DMCreateFieldDecomposition()` should be used to define the splits in a `PCFIELDSPLIT`, whenever possible. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - boolean indicating whether to use field splits defined by the `DM` + +Options Database Key: +- `-pc_fieldsplit_dm_splits ` - use the field splits defined by the `DM` + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitGetDMSplits()`, `DMCreateFieldDecomposition()`, `PCFieldSplitSetFields()`, `PCFieldSplitSetIS()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetDMSplits")) +""" +function PCFieldSplitSetDMSplits(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCFieldSplitSetDMSplits(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCFieldSplitSetDMSplits, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCFieldSplitGetDMSplits(petsclib::PetscLibType,pc::PC) +Returns flag indicating whether `DMCreateFieldDecomposition()` should be used to define the splits in a `PCFIELDSPLIT`, whenever possible. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `flg` - boolean indicating whether to use field splits defined by the `DM` + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitSetDMSplits()`, `DMCreateFieldDecomposition()`, `PCFieldSplitSetFields()`, `PCFieldSplitSetIS()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitGetDMSplits")) +""" +function PCFieldSplitGetDMSplits(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFieldSplitGetDMSplits(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCFieldSplitGetDMSplits, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = PCFieldSplitGetDetectSaddlePoint(petsclib::PetscLibType,pc::PC) +Returns flag indicating whether `PCFIELDSPLIT` will attempt to automatically determine fields based on zero diagonal entries. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `flg` - boolean indicating whether to detect fields or not + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitSetDetectSaddlePoint()` + +# External Links +$(_doc_external("Ksp/PCFieldSplitGetDetectSaddlePoint")) +""" +function PCFieldSplitGetDetectSaddlePoint(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFieldSplitGetDetectSaddlePoint(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCFieldSplitGetDetectSaddlePoint, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = PCFieldSplitSetDetectSaddlePoint(petsclib::PetscLibType,pc::PC) +Sets flag indicating whether `PCFIELDSPLIT` will attempt to automatically determine fields based on zero diagonal entries. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `flg` - boolean indicating whether to detect fields or not + +Options Database Key: +- `-pc_fieldsplit_detect_saddle_point ` - detect and use the saddle point + +Level: intermediate + +-seealso: [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitGetDetectSaddlePoint()`, `PCFieldSplitSetType()`, `PCFieldSplitSetSchurPre()`, `PC_FIELDSPLIT_SCHUR_PRE_SELF` + +# External Links +$(_doc_external("Ksp/PCFieldSplitSetDetectSaddlePoint")) +""" +function PCFieldSplitSetDetectSaddlePoint(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCFieldSplitSetDetectSaddlePoint(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCFieldSplitSetDetectSaddlePoint, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCGASMSetTotalSubdomains(petsclib::PetscLibType,pc::PC, N::PetscInt) +sets the total number of subdomains to use across the communicator for `PCGASM` + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner +- `N` - total number of subdomains + +Level: beginner + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetSubdomains()`, `PCGASMSetOverlap()` +`PCGASMCreateSubdomains2D()` + +# External Links +$(_doc_external("Ksp/PCGASMSetTotalSubdomains")) +""" +function PCGASMSetTotalSubdomains(petsclib::PetscLibType, pc::PC, N::PetscInt) end + +@for_petsc function PCGASMSetTotalSubdomains(petsclib::$UnionPetscLib, pc::PC, N::$PetscInt ) + + @chk ccall( + (:PCGASMSetTotalSubdomains, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, N, + ) + + + return nothing +end + +""" + PCGASMSetSubdomains(petsclib::PetscLibType,pc::PC, n::PetscInt, iis::Vector{IS}, ois::Vector{IS}) +Sets the subdomains for this MPI process +for the additive Schwarz preconditioner with multiple MPI processes per subdomain, `PCGASM` + +Collective + +Input Parameters: +- `pc` - the preconditioner object +- `n` - the number of subdomains for this MPI process +- `iis` - the index sets that define the inner subdomains (or `NULL` for PETSc to determine subdomains), the `iis` array is +copied so may be freed after this call. +- `ois` - the index sets that define the outer subdomains (or `NULL` to use the same as `iis`, or to construct by expanding `iis` by +the requested overlap), the `ois` array is copied so may be freed after this call. + +Level: advanced + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetOverlap()`, `PCGASMGetSubKSP()`, `PCGASMDestroySubdomains()`, +`PCGASMCreateSubdomains2D()`, `PCGASMGetSubdomains()` + +# External Links +$(_doc_external("Ksp/PCGASMSetSubdomains")) +""" +function PCGASMSetSubdomains(petsclib::PetscLibType, pc::PC, n::PetscInt, iis::Vector{IS}, ois::Vector{IS}) end + +@for_petsc function PCGASMSetSubdomains(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt, iis::Vector{IS}, ois::Vector{IS} ) + + @chk ccall( + (:PCGASMSetSubdomains, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{IS}, Ptr{IS}), + pc, n, iis, ois, + ) + + + return nothing +end + +""" + PCGASMSetOverlap(petsclib::PetscLibType,pc::PC, ovl::PetscInt) +Sets the overlap between a pair of subdomains for the +additive Schwarz preconditioner `PCGASM`. Either all or no MPI processes in the +pc communicator must call this routine. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `ovl` - the amount of overlap between subdomains (ovl >= 0, default value = 0) + +Options Database Key: +- `-pc_gasm_overlap ` - Sets overlap + +Level: intermediate + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetSubdomains()`, `PCGASMGetSubKSP()`, +`PCGASMCreateSubdomains2D()`, `PCGASMGetSubdomains()` + +# External Links +$(_doc_external("Ksp/PCGASMSetOverlap")) +""" +function PCGASMSetOverlap(petsclib::PetscLibType, pc::PC, ovl::PetscInt) end + +@for_petsc function PCGASMSetOverlap(petsclib::$UnionPetscLib, pc::PC, ovl::$PetscInt ) + + @chk ccall( + (:PCGASMSetOverlap, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, ovl, + ) + + + return nothing +end + +""" + PCGASMSetType(petsclib::PetscLibType,pc::PC, type::PCGASMType) +Sets the type of restriction and interpolation used +for local problems in the `PCGASM` additive Schwarz method. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - variant of `PCGASM`, one of +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetSubdomains()`, `PCGASMGetSubKSP()`, +`PCGASMCreateSubdomains2D()`, `PCASM`, `PCASMSetType()` + +# External Links +$(_doc_external("Ksp/PCGASMSetType")) +""" +function PCGASMSetType(petsclib::PetscLibType, pc::PC, type::PCGASMType) end + +@for_petsc function PCGASMSetType(petsclib::$UnionPetscLib, pc::PC, type::PCGASMType ) + + @chk ccall( + (:PCGASMSetType, $petsc_library), + PetscErrorCode, + (PC, PCGASMType), + pc, type, + ) + + + return nothing +end + +""" + PCGASMSetSortIndices(petsclib::PetscLibType,pc::PC, doSort::PetscBool) +Determines whether subdomain indices are sorted. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `doSort` - sort the subdomain indices + +Level: intermediate + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetSubdomains()`, `PCGASMGetSubKSP()`, +`PCGASMCreateSubdomains2D()` + +# External Links +$(_doc_external("Ksp/PCGASMSetSortIndices")) +""" +function PCGASMSetSortIndices(petsclib::PetscLibType, pc::PC, doSort::PetscBool) end + +@for_petsc function PCGASMSetSortIndices(petsclib::$UnionPetscLib, pc::PC, doSort::PetscBool ) + + @chk ccall( + (:PCGASMSetSortIndices, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, doSort, + ) + + + return nothing +end + +""" + n_loc::PetscInt,first_loc::PetscInt = PCGASMGetSubKSP(petsclib::PetscLibType,pc::PC, ksp::Vector{PetscKSP}) +Gets the local `KSP` contexts for all subdomains on this MPI process. + +Collective iff first_local is requested + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `n_local` - the number of blocks on this MPI process or `NULL` +- `first_local` - the global number of the first block on this process or `NULL`, all processes must request or all must pass `NULL` +- `ksp` - the array of `KSP` contexts + +Level: advanced + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetSubdomains()`, `PCGASMSetOverlap()`, +`PCGASMCreateSubdomains2D()`, + +# External Links +$(_doc_external("Ksp/PCGASMGetSubKSP")) +""" +function PCGASMGetSubKSP(petsclib::PetscLibType, pc::PC, ksp::Vector{PetscKSP}) end + +@for_petsc function PCGASMGetSubKSP(petsclib::$UnionPetscLib, pc::PC, ksp::Vector{PetscKSP} ) + n_loc_ = Ref{$PetscInt}() + first_loc_ = Ref{$PetscInt}() + ksp_ = Ref(pointer(ksp)) + + @chk ccall( + (:PCGASMGetSubKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{CKSP}}), + pc, n_loc_, first_loc_, ksp_, + ) + + n_loc = n_loc_[] + first_loc = first_loc_[] + + return n_loc,first_loc +end + +""" + n::PetscInt,iis::Vector{IS} = PCGASMCreateSubdomains(petsclib::PetscLibType,A::PetscMat, N::PetscInt) +Creates `n` index sets defining `n` nonoverlapping subdomains on this MPI process for the `PCGASM` additive +Schwarz preconditioner for a any problem based on its matrix. + +Collective + +Input Parameters: +- `A` - The global matrix operator +- `N` - the number of global subdomains requested + +Output Parameters: +- `n` - the number of subdomains created on this MPI process +- `iis` - the array of index sets defining the local inner subdomains (on which the correction is applied) + +Level: advanced + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetSubdomains()`, `PCGASMDestroySubdomains()` + +# External Links +$(_doc_external("Ksp/PCGASMCreateSubdomains")) +""" +function PCGASMCreateSubdomains(petsclib::PetscLibType, A::PetscMat, N::PetscInt) end + +@for_petsc function PCGASMCreateSubdomains(petsclib::$UnionPetscLib, A::PetscMat, N::$PetscInt ) + n_ = Ref{$PetscInt}() + iis_ = Ref{Ptr{IS}}() + + @chk ccall( + (:PCGASMCreateSubdomains, $petsc_library), + PetscErrorCode, + (CMat, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{IS}}), + A, N, n_, iis_, + ) + + n = n_[] + iis = unsafe_wrap(Array, iis_[], VecGetLocalSize(petsclib, x); own = false) + + return n,iis +end + +""" + PCGASMDestroySubdomains(petsclib::PetscLibType,n::PetscInt, iis::Vector{IS}, ois::Vector{IS}) +Destroys the index sets created with +`PCGASMCreateSubdomains()` or `PCGASMCreateSubdomains2D()`. Should be +called after setting subdomains with `PCGASMSetSubdomains()`. + +Collective + +Input Parameters: +- `n` - the number of index sets +- `iis` - the array of inner subdomains +- `ois` - the array of outer subdomains, can be `NULL` + +Level: intermediate + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMCreateSubdomains()`, `PCGASMSetSubdomains()` + +# External Links +$(_doc_external("Ksp/PCGASMDestroySubdomains")) +""" +function PCGASMDestroySubdomains(petsclib::PetscLibType, n::PetscInt, iis::Vector{IS}, ois::Vector{IS}) end + +@for_petsc function PCGASMDestroySubdomains(petsclib::$UnionPetscLib, n::$PetscInt, iis::Vector{IS}, ois::Vector{IS} ) + iis_ = Ref(pointer(iis)) + ois_ = Ref(pointer(ois)) + + @chk ccall( + (:PCGASMDestroySubdomains, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Ptr{IS}}, Ptr{Ptr{IS}}), + n, iis_, ois_, + ) + + + return nothing +end + +""" + nsub::PetscInt,iis::Vector{IS},ois::Vector{IS} = PCGASMCreateSubdomains2D(petsclib::PetscLibType,pc::PC, M::PetscInt, N::PetscInt, Mdomains::PetscInt, Ndomains::PetscInt, dof::PetscInt, overlap::PetscInt) +Creates the index sets for the `PCGASM` overlapping Schwarz +preconditioner for a two-dimensional problem on a regular grid. + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `M` - the global number of grid points in the x direction +- `N` - the global number of grid points in the y direction +- `Mdomains` - the global number of subdomains in the x direction +- `Ndomains` - the global number of subdomains in the y direction +- `dof` - degrees of freedom per node +- `overlap` - overlap in mesh lines + +Output Parameters: +- `nsub` - the number of local subdomains created +- `iis` - array of index sets defining inner (nonoverlapping) subdomains +- `ois` - array of index sets defining outer (overlapping, if overlap > 0) subdomains + +Level: advanced + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetSubdomains()`, `PCGASMGetSubKSP()`, `PCGASMSetOverlap()`, `PCASMCreateSubdomains2D()`, +`PCGASMDestroySubdomains()` + +# External Links +$(_doc_external("Ksp/PCGASMCreateSubdomains2D")) +""" +function PCGASMCreateSubdomains2D(petsclib::PetscLibType, pc::PC, M::PetscInt, N::PetscInt, Mdomains::PetscInt, Ndomains::PetscInt, dof::PetscInt, overlap::PetscInt) end + +@for_petsc function PCGASMCreateSubdomains2D(petsclib::$UnionPetscLib, pc::PC, M::$PetscInt, N::$PetscInt, Mdomains::$PetscInt, Ndomains::$PetscInt, dof::$PetscInt, overlap::$PetscInt ) + nsub_ = Ref{$PetscInt}() + iis_ = Ref{Ptr{IS}}() + ois_ = Ref{Ptr{IS}}() + + @chk ccall( + (:PCGASMCreateSubdomains2D, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{Ptr{IS}}, Ptr{Ptr{IS}}), + pc, M, N, Mdomains, Ndomains, dof, overlap, nsub_, iis_, ois_, + ) + + nsub = nsub_[] + iis = unsafe_wrap(Array, iis_[], VecGetLocalSize(petsclib, x); own = false) + ois = unsafe_wrap(Array, ois_[], VecGetLocalSize(petsclib, x); own = false) + + return nsub,iis,ois +end + +""" + n::PetscInt = PCGASMGetSubdomains(petsclib::PetscLibType,pc::PC, iis::Vector{IS}, ois::Vector{IS}) +Gets the subdomains supported on this MPI process +for the `PCGASM` additive Schwarz preconditioner. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `n` - the number of subdomains for this MPI process (default value = 1) +- `iis` - the index sets that define the inner subdomains (without overlap) supported on this process (can be `NULL`) +- `ois` - the index sets that define the outer subdomains (with overlap) supported on this process (can be `NULL`) + +Level: advanced + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetOverlap()`, `PCGASMGetSubKSP()`, `PCGASMCreateSubdomains2D()`, +`PCGASMSetSubdomains()`, `PCGASMGetSubmatrices()`, `PCGASMDestroySubdomains()` + +# External Links +$(_doc_external("Ksp/PCGASMGetSubdomains")) +""" +function PCGASMGetSubdomains(petsclib::PetscLibType, pc::PC, iis::Vector{IS}, ois::Vector{IS}) end + +@for_petsc function PCGASMGetSubdomains(petsclib::$UnionPetscLib, pc::PC, iis::Vector{IS}, ois::Vector{IS} ) + n_ = Ref{$PetscInt}() + iis_ = Ref(pointer(iis)) + ois_ = Ref(pointer(ois)) + + @chk ccall( + (:PCGASMGetSubdomains, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{Ptr{IS}}, Ptr{Ptr{IS}}), + pc, n_, iis_, ois_, + ) + + n = n_[] + + return n +end + +""" + n::PetscInt = PCGASMGetSubmatrices(petsclib::PetscLibType,pc::PC, mat::Vector{PetscMat}) +Gets the local submatrices (for this MPI process +only) for the `PCGASM` additive Schwarz preconditioner. + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `n` - the number of matrices for this MPI process (default value = 1) +- `mat` - the matrices + +Level: advanced + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetOverlap()`, `PCGASMGetSubKSP()`, +`PCGASMCreateSubdomains2D()`, `PCGASMSetSubdomains()`, `PCGASMGetSubdomains()` + +# External Links +$(_doc_external("Ksp/PCGASMGetSubmatrices")) +""" +function PCGASMGetSubmatrices(petsclib::PetscLibType, pc::PC, mat::Vector{PetscMat}) end + +@for_petsc function PCGASMGetSubmatrices(petsclib::$UnionPetscLib, pc::PC, mat::Vector{PetscMat} ) + n_ = Ref{$PetscInt}() + mat_ = Ref(pointer(mat)) + + @chk ccall( + (:PCGASMGetSubmatrices, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{Ptr{CMat}}), + pc, n_, mat_, + ) + + n = n_[] + + return n +end + +""" + PCGASMSetUseDMSubdomains(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Indicates whether to use `DMCreateDomainDecomposition()` to define the subdomains, whenever possible for `PCGASM` + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner +- `flg` - boolean indicating whether to use subdomains defined by the `DM` + +Options Database Key: +- `-pc_gasm_dm_subdomains` - configure subdomains +- `-pc_gasm_overlap` - set overlap +- `-pc_gasm_total_subdomains` - set number of subdomains + +Level: intermediate + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMGetUseDMSubdomains()`, `PCGASMSetSubdomains()`, `PCGASMSetOverlap()` +`PCGASMCreateSubdomains2D()` + +# External Links +$(_doc_external("Ksp/PCGASMSetUseDMSubdomains")) +""" +function PCGASMSetUseDMSubdomains(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCGASMSetUseDMSubdomains(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCGASMSetUseDMSubdomains, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PCGASMGetUseDMSubdomains(petsclib::PetscLibType,pc::PC) +Returns flag indicating whether to use `DMCreateDomainDecomposition()` to define the subdomains, whenever possible with `PCGASM` + +Not Collective + +Input Parameter: +- `pc` - the preconditioner + +Output Parameter: +- `flg` - boolean indicating whether to use subdomains defined by the `DM` + +Level: intermediate + +-seealso: [](ch_ksp), `PCGASM`, `PCGASMSetUseDMSubdomains()`, `PCGASMSetOverlap()` +`PCGASMCreateSubdomains2D()` + +# External Links +$(_doc_external("Ksp/PCGASMGetUseDMSubdomains")) +""" +function PCGASMGetUseDMSubdomains(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCGASMGetUseDMSubdomains(petsclib::$UnionPetscLib, pc::PC ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PCGASMGetUseDMSubdomains, $petsc_library), + PetscErrorCode, + (PC, Ptr{PetscBool}), + pc, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PCHYPRESetDiscreteGradient(petsclib::PetscLibType,pc::PC, G::PetscMat) +Set the discrete gradient matrix for `PCHYPRE` type of AMS or ADS + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `G` - the discrete gradient + +Level: intermediate + +-seealso: [](ch_ksp), `PCHYPRE`, `PCHYPRESetDiscreteCurl()` + +# External Links +$(_doc_external("Ksp/PCHYPRESetDiscreteGradient")) +""" +function PCHYPRESetDiscreteGradient(petsclib::PetscLibType, pc::PC, G::PetscMat) end + +@for_petsc function PCHYPRESetDiscreteGradient(petsclib::$UnionPetscLib, pc::PC, G::PetscMat ) + + @chk ccall( + (:PCHYPRESetDiscreteGradient, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, G, + ) + + + return nothing +end + +""" + PCHYPRESetDiscreteCurl(petsclib::PetscLibType,pc::PC, C::PetscMat) +Set the discrete curl matrix for `PCHYPRE` type of ADS + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `C` - the discrete curl + +Level: intermediate + +-seealso: [](ch_ksp), `PCHYPRE`, `PCHYPRESetDiscreteGradient()` + +# External Links +$(_doc_external("Ksp/PCHYPRESetDiscreteCurl")) +""" +function PCHYPRESetDiscreteCurl(petsclib::PetscLibType, pc::PC, C::PetscMat) end + +@for_petsc function PCHYPRESetDiscreteCurl(petsclib::$UnionPetscLib, pc::PC, C::PetscMat ) + + @chk ccall( + (:PCHYPRESetDiscreteCurl, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, C, + ) + + + return nothing +end + +""" + PCHYPRESetInterpolations(petsclib::PetscLibType,pc::PC, dim::PetscInt, RT_PiFull::PetscMat, RT_Pi::Vector{PetscMat}, ND_PiFull::PetscMat, ND_Pi::Vector{PetscMat}) +Set the interpolation matrices for `PCHYPRE` type of AMS or ADS + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `dim` - the dimension of the problem, only used in AMS +- `RT_PiFull` - Raviart-Thomas interpolation matrix +- `RT_Pi` - x/y/z component of Raviart-Thomas interpolation matrix +- `ND_PiFull` - Nedelec interpolation matrix +- `ND_Pi` - x/y/z component of Nedelec interpolation matrix + +Level: intermediate + +-seealso: [](ch_ksp), `PCHYPRE` + +# External Links +$(_doc_external("Ksp/PCHYPRESetInterpolations")) +""" +function PCHYPRESetInterpolations(petsclib::PetscLibType, pc::PC, dim::PetscInt, RT_PiFull::PetscMat, RT_Pi::Vector{PetscMat}, ND_PiFull::PetscMat, ND_Pi::Vector{PetscMat}) end + +@for_petsc function PCHYPRESetInterpolations(petsclib::$UnionPetscLib, pc::PC, dim::$PetscInt, RT_PiFull::PetscMat, RT_Pi::Vector{PetscMat}, ND_PiFull::PetscMat, ND_Pi::Vector{PetscMat} ) + + @chk ccall( + (:PCHYPRESetInterpolations, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, CMat, Ptr{CMat}, CMat, Ptr{CMat}), + pc, dim, RT_PiFull, RT_Pi, ND_PiFull, ND_Pi, + ) + + + return nothing +end + +""" + PCHYPRESetAlphaPoissonMatrix(petsclib::PetscLibType,pc::PC, A::PetscMat) +Set the vector Poisson matrix for `PCHYPRE` of type AMS + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `A` - the matrix + +Level: intermediate + +-seealso: [](ch_ksp), `PCHYPRE`, `PCHYPRESetDiscreteGradient()`, `PCHYPRESetDiscreteCurl()`, `PCHYPRESetBetaPoissonMatrix()` + +# External Links +$(_doc_external("Ksp/PCHYPRESetAlphaPoissonMatrix")) +""" +function PCHYPRESetAlphaPoissonMatrix(petsclib::PetscLibType, pc::PC, A::PetscMat) end + +@for_petsc function PCHYPRESetAlphaPoissonMatrix(petsclib::$UnionPetscLib, pc::PC, A::PetscMat ) + + @chk ccall( + (:PCHYPRESetAlphaPoissonMatrix, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, A, + ) + + + return nothing +end + +""" + PCHYPRESetBetaPoissonMatrix(petsclib::PetscLibType,pc::PC, A::PetscMat) +Set the Poisson matrix for `PCHYPRE` of type AMS + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `A` - the matrix, or `NULL` to turn it off + +Level: intermediate + +-seealso: [](ch_ksp), `PCHYPRE`, `PCHYPRESetDiscreteGradient()`, `PCHYPRESetDiscreteCurl()`, `PCHYPRESetAlphaPoissonMatrix()` + +# External Links +$(_doc_external("Ksp/PCHYPRESetBetaPoissonMatrix")) +""" +function PCHYPRESetBetaPoissonMatrix(petsclib::PetscLibType, pc::PC, A::PetscMat) end + +@for_petsc function PCHYPRESetBetaPoissonMatrix(petsclib::$UnionPetscLib, pc::PC, A::PetscMat ) + + @chk ccall( + (:PCHYPRESetBetaPoissonMatrix, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, A, + ) + + + return nothing +end + +""" + PCHYPRESetEdgeConstantVectors(petsclib::PetscLibType,pc::PC, ozz::PetscVec, zoz::PetscVec, zzo::PetscVec) +Set the representation of the constant vector fields in the edge element basis for `PCHYPRE` of type AMS + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `ozz` - vector representing (1,0,0) (or (1,0) in 2D) +- `zoz` - vector representing (0,1,0) (or (0,1) in 2D) +- `zzo` - vector representing (0,0,1) (use NULL in 2D) + +Level: intermediate + +-seealso: [](ch_ksp), `PCHYPRE`, `PCHYPRESetDiscreteGradient()`, `PCHYPRESetDiscreteCurl()`, `PCHYPRESetAlphaPoissonMatrix()` + +# External Links +$(_doc_external("Ksp/PCHYPRESetEdgeConstantVectors")) +""" +function PCHYPRESetEdgeConstantVectors(petsclib::PetscLibType, pc::PC, ozz::PetscVec, zoz::PetscVec, zzo::PetscVec) end + +@for_petsc function PCHYPRESetEdgeConstantVectors(petsclib::$UnionPetscLib, pc::PC, ozz::PetscVec, zoz::PetscVec, zzo::PetscVec ) + + @chk ccall( + (:PCHYPRESetEdgeConstantVectors, $petsc_library), + PetscErrorCode, + (PC, CVec, CVec, CVec), + pc, ozz, zoz, zzo, + ) + + + return nothing +end + +""" + PCHYPREAMSSetInteriorNodes(petsclib::PetscLibType,pc::PC, interior::PetscVec) +Set the list of interior nodes to a zero + +Collective + +Input Parameters: +- `pc` - the preconditioning context +- `interior` - vector. node is interior if its entry in the array is 1.0. + +Level: intermediate + +-seealso: [](ch_ksp), `PCHYPRE`, `PCHYPRESetDiscreteGradient()`, `PCHYPRESetDiscreteCurl()`, `PCHYPRESetAlphaPoissonMatrix()` + +# External Links +$(_doc_external("Ksp/PCHYPREAMSSetInteriorNodes")) +""" +function PCHYPREAMSSetInteriorNodes(petsclib::PetscLibType, pc::PC, interior::PetscVec) end + +@for_petsc function PCHYPREAMSSetInteriorNodes(petsclib::$UnionPetscLib, pc::PC, interior::PetscVec ) + + @chk ccall( + (:PCHYPREAMSSetInteriorNodes, $petsc_library), + PetscErrorCode, + (PC, CVec), + pc, interior, + ) + + + return nothing +end + +""" + PCHYPRESetType(petsclib::PetscLibType,pc::PC, name::String) +Sets which hypre preconditioner you wish to use + +Input Parameters: +- `pc` - the preconditioner context +- `name` - either euclid, ilu, pilut, parasails, boomeramg, ams, or ads + +Options Database Key: +- `pc_hypre_type` - One of euclid, ilu, pilut, parasails, boomeramg, ams, or ads + +Level: intermediate + +-seealso: [](ch_ksp), `PCCreate()`, `PCSetType()`, `PCType`, `PC`, `PCHYPRE` + +# External Links +$(_doc_external("Ksp/PCHYPRESetType")) +""" +function PCHYPRESetType(petsclib::PetscLibType, pc::PC, name::String) end + +@for_petsc function PCHYPRESetType(petsclib::$UnionPetscLib, pc::PC, name::String ) + + @chk ccall( + (:PCHYPRESetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cchar}), + pc, name, + ) + + + return nothing +end + +""" + n_per_level::Vector{PetscInt} = PCHYPREGetCFMarkers(petsclib::PetscLibType,pc::PC, CFMarkers::Vector{PetscBT}) +Gets CF marker arrays for all levels (except the finest level) + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `n_per_level` - the number of nodes per level (size of `num_levels`) +- `CFMarkers` - the Coarse/Fine Boolean arrays (size of `num_levels` - 1) + +Level: advanced + +-seealso: [](ch_ksp), `PC`, `PCMG`, `PCMGGetRestriction()`, `PCMGSetInterpolation()`, `PCMGGetRScale()`, `PCMGGetInterpolation()`, `PCGetInterpolations()` + +# External Links +$(_doc_external("Ksp/PCHYPREGetCFMarkers")) +""" +function PCHYPREGetCFMarkers(petsclib::PetscLibType, pc::PC, CFMarkers::Vector{PetscBT}) end + +@for_petsc function PCHYPREGetCFMarkers(petsclib::$UnionPetscLib, pc::PC, CFMarkers::Vector{PetscBT} ) + n_per_level_ = Ref{Ptr{$PetscInt}}() + CFMarkers_ = Ref(pointer(CFMarkers)) + + @chk ccall( + (:PCHYPREGetCFMarkers, $petsc_library), + PetscErrorCode, + (PC, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{PetscBT}}), + pc, n_per_level_, CFMarkers_, + ) + + n_per_level = unsafe_wrap(Array, n_per_level_[], VecGetLocalSize(petsclib, x); own = false) + + return n_per_level +end + +""" + name::String = PCHYPREGetType(petsclib::PetscLibType,pc::PC) +Gets which hypre preconditioner you are using + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `name` - either euclid, ilu, pilut, parasails, boomeramg, ams, or ads + +Level: intermediate + +-seealso: [](ch_ksp), `PCCreate()`, `PCHYPRESetType()`, `PCType`, `PC`, `PCHYPRE` + +# External Links +$(_doc_external("Ksp/PCHYPREGetType")) +""" +function PCHYPREGetType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCHYPREGetType(petsclib::$UnionPetscLib, pc::PC ) + name_ = Ref{Ptr{Cchar}}() + + @chk ccall( + (:PCHYPREGetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{Ptr{Cchar}}), + pc, name_, + ) + + name = unsafe_wrap(Array, name_[], VecGetLocalSize(petsclib, x); own = false) + + return name +end + +""" + PCMGGalerkinSetMatProductAlgorithm(petsclib::PetscLibType,pc::PC, name::String) +Set type of sparse matrix + +Logically Collective + +Input Parameters: +- `pc` - the hypre context +- `name` - one of 'cusparse', 'hypre' + +Options Database Key: +- `-pc_mg_galerkin_mat_product_algorithm ` - Type of sparse matrix-matrix product to use in hypre + +Level: intermediate + +-seealso: [](ch_ksp), `PCHYPRE`, `PCMGGalerkinGetMatProductAlgorithm()` + +# External Links +$(_doc_external("Ksp/PCMGGalerkinSetMatProductAlgorithm")) +""" +function PCMGGalerkinSetMatProductAlgorithm(petsclib::PetscLibType, pc::PC, name::String) end + +@for_petsc function PCMGGalerkinSetMatProductAlgorithm(petsclib::$UnionPetscLib, pc::PC, name::String ) + + @chk ccall( + (:PCMGGalerkinSetMatProductAlgorithm, $petsc_library), + PetscErrorCode, + (PC, Ptr{Cchar}), + pc, name, + ) + + + return nothing +end + +""" + PCMGGalerkinGetMatProductAlgorithm(petsclib::PetscLibType,pc::PC, name::String) +Get type of sparse matrix + +Not Collective + +Input Parameter: +- `pc` - the multigrid context + +Output Parameter: +- `name` - one of 'cusparse', 'hypre' + +Level: intermediate + +-seealso: [](ch_ksp), `PCHYPRE`, `PCMGGalerkinSetMatProductAlgorithm()` + +# External Links +$(_doc_external("Ksp/PCMGGalerkinGetMatProductAlgorithm")) +""" +function PCMGGalerkinGetMatProductAlgorithm(petsclib::PetscLibType, pc::PC, name::String) end + +@for_petsc function PCMGGalerkinGetMatProductAlgorithm(petsclib::$UnionPetscLib, pc::PC, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PCMGGalerkinGetMatProductAlgorithm, $petsc_library), + PetscErrorCode, + (PC, Ptr{Ptr{Cchar}}), + pc, name_, + ) + + + return nothing +end + +""" + PCSORGetSymmetric(petsclib::PetscLibType,pc::PC, flag::MatSORType) +Gets the form the SOR preconditioner is using; backward, or forward relaxation. The local variants perform SOR on +each processor. By default forward relaxation is used. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `flag` - one of the following +-seealso: [](ch_ksp), `PCSOR`, `PCEisenstatSetOmega()`, `PCSORSetIterations()`, `PCSORSetOmega()`, `PCSORSetSymmetric()` + +# External Links +$(_doc_external("Ksp/PCSORGetSymmetric")) +""" +function PCSORGetSymmetric(petsclib::PetscLibType, pc::PC, flag::MatSORType) end + +@for_petsc function PCSORGetSymmetric(petsclib::$UnionPetscLib, pc::PC, flag::MatSORType ) + + @chk ccall( + (:PCSORGetSymmetric, $petsc_library), + PetscErrorCode, + (PC, Ptr{MatSORType}), + pc, flag, + ) + + + return nothing +end + +""" + omega::PetscReal = PCSORGetOmega(petsclib::PetscLibType,pc::PC) +Gets the SOR relaxation coefficient, omega +(where omega = 1.0 by default). + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `omega` - relaxation coefficient (0 < omega < 2). + +Options Database Key: +- `-pc_sor_omega ` - Sets omega + +Level: intermediate + +-seealso: [](ch_ksp), `PCSOR`, `PCSORSetSymmetric()`, `PCSORSetIterations()`, `PCEisenstatSetOmega()`, `PCSORSetOmega()` + +# External Links +$(_doc_external("Ksp/PCSORGetOmega")) +""" +function PCSORGetOmega(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCSORGetOmega(petsclib::$UnionPetscLib, pc::PC ) + omega_ = Ref{$PetscReal}() + + @chk ccall( + (:PCSORGetOmega, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscReal}), + pc, omega_, + ) + + omega = omega_[] + + return omega +end + +""" + its::PetscInt,lits::PetscInt = PCSORGetIterations(petsclib::PetscLibType,pc::PC) +Gets the number of inner iterations to +be used by the SOR preconditioner. The default is 1. + +Logically Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameters: +- `lits` - number of local iterations, smoothings over just variables on processor +- `its` - number of parallel iterations to use; each parallel iteration has lits local iterations + +Options Database Keys: +- `-pc_sor_its ` - Sets number of iterations +- `-pc_sor_lits ` - Sets number of local iterations + +Level: intermediate + +-seealso: [](ch_ksp), `PCSOR`, `PCSORSetOmega()`, `PCSORSetSymmetric()`, `PCSORSetIterations()` + +# External Links +$(_doc_external("Ksp/PCSORGetIterations")) +""" +function PCSORGetIterations(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCSORGetIterations(petsclib::$UnionPetscLib, pc::PC ) + its_ = Ref{$PetscInt}() + lits_ = Ref{$PetscInt}() + + @chk ccall( + (:PCSORGetIterations, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, Ptr{$PetscInt}), + pc, its_, lits_, + ) + + its = its_[] + lits = lits_[] + + return its,lits +end + +""" + PCSORSetSymmetric(petsclib::PetscLibType,pc::PC, flag::MatSORType) +Sets the SOR preconditioner to use symmetric (SSOR), +backward, or forward relaxation. The local variants perform SOR on +each processor. By default forward relaxation is used. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flag` - one of the following +-seealso: [](ch_ksp), `PCSOR`, `PCEisenstatSetOmega()`, `PCSORSetIterations()`, `PCSORSetOmega()` + +# External Links +$(_doc_external("Ksp/PCSORSetSymmetric")) +""" +function PCSORSetSymmetric(petsclib::PetscLibType, pc::PC, flag::MatSORType) end + +@for_petsc function PCSORSetSymmetric(petsclib::$UnionPetscLib, pc::PC, flag::MatSORType ) + + @chk ccall( + (:PCSORSetSymmetric, $petsc_library), + PetscErrorCode, + (PC, MatSORType), + pc, flag, + ) + + + return nothing +end + +""" + PCSORSetOmega(petsclib::PetscLibType,pc::PC, omega::PetscReal) +Sets the SOR relaxation coefficient, omega +(where omega = 1.0 by default). + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `omega` - relaxation coefficient (0 < omega < 2). + +Options Database Key: +- `-pc_sor_omega ` - Sets omega + +Level: intermediate + +-seealso: [](ch_ksp), `PCSOR`, `PCSORSetSymmetric()`, `PCSORSetIterations()`, `PCEisenstatSetOmega()`, `MatSetOption()` + +# External Links +$(_doc_external("Ksp/PCSORSetOmega")) +""" +function PCSORSetOmega(petsclib::PetscLibType, pc::PC, omega::PetscReal) end + +@for_petsc function PCSORSetOmega(petsclib::$UnionPetscLib, pc::PC, omega::$PetscReal ) + + @chk ccall( + (:PCSORSetOmega, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, omega, + ) + + + return nothing +end + +""" + PCSORSetIterations(petsclib::PetscLibType,pc::PC, its::PetscInt, lits::PetscInt) +Sets the number of inner iterations to +be used by the SOR preconditioner. The default is 1. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `lits` - number of local iterations, smoothings over just variables on processor +- `its` - number of parallel iterations to use; each parallel iteration has lits local iterations + +Options Database Keys: +- `-pc_sor_its ` - Sets number of iterations +- `-pc_sor_lits ` - Sets number of local iterations + +Level: intermediate + +-seealso: [](ch_ksp), `PCSOR`, `PCSORSetOmega()`, `PCSORSetSymmetric()` + +# External Links +$(_doc_external("Ksp/PCSORSetIterations")) +""" +function PCSORSetIterations(petsclib::PetscLibType, pc::PC, its::PetscInt, lits::PetscInt) end + +@for_petsc function PCSORSetIterations(petsclib::$UnionPetscLib, pc::PC, its::$PetscInt, lits::$PetscInt ) + + @chk ccall( + (:PCSORSetIterations, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, $PetscInt), + pc, its, lits, + ) + + + return nothing +end + +""" + PCDeflationSetInitOnly(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Do only initialization step. +Sets initial guess to the solution on the deflation space but does not apply +the deflation preconditioner. The additional preconditioner is still applied. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - default `PETSC_FALSE` + +Options Database Key: +- `-pc_deflation_init_only ` - if true computes only the special guess + +Level: intermediate + +-seealso: [](ch_ksp), `PCDEFLATION` + +# External Links +$(_doc_external("Ksp/PCDeflationSetInitOnly")) +""" +function PCDeflationSetInitOnly(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCDeflationSetInitOnly(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCDeflationSetInitOnly, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + PCDeflationSetLevels(petsclib::PetscLibType,pc::PC, max::PetscInt) +Set the maximum level of deflation nesting. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `max` - maximum deflation level + +Options Database Key: +- `-pc_deflation_max_lvl <0>` - maximum number of levels for multilevel deflation + +Level: intermediate + +-seealso: [](ch_ksp), `PCDeflationSetSpaceToCompute()`, `PCDeflationSetSpace()`, `PCDEFLATION` + +# External Links +$(_doc_external("Ksp/PCDeflationSetLevels")) +""" +function PCDeflationSetLevels(petsclib::PetscLibType, pc::PC, max::PetscInt) end + +@for_petsc function PCDeflationSetLevels(petsclib::$UnionPetscLib, pc::PC, max::$PetscInt ) + + @chk ccall( + (:PCDeflationSetLevels, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, max, + ) + + + return nothing +end + +""" + PCDeflationSetReductionFactor(petsclib::PetscLibType,pc::PC, red::PetscInt) +Set reduction factor for the `PCDEFLATION` + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `red` - reduction factor (or `PETSC_DETERMINE`) + +Options Database Key: +- `-pc_deflation_reduction_factor <-1>` - reduction factor on bottom level coarse problem for `PCDEFLATION` + +-seealso: [](ch_ksp), `PCTELESCOPE`, `PCDEFLATION`, `PCDeflationSetLevels()` + +# External Links +$(_doc_external("Ksp/PCDeflationSetReductionFactor")) +""" +function PCDeflationSetReductionFactor(petsclib::PetscLibType, pc::PC, red::PetscInt) end + +@for_petsc function PCDeflationSetReductionFactor(petsclib::$UnionPetscLib, pc::PC, red::$PetscInt ) + + @chk ccall( + (:PCDeflationSetReductionFactor, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, red, + ) + + + return nothing +end + +""" + PCDeflationSetCorrectionFactor(petsclib::PetscLibType,pc::PC, fact::PetscScalar) +Set coarse problem correction factor. +The preconditioner becomes P*M^{-1} + fact*Q. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `fact` - correction factor + +Options Database Keys: +- `-pc_deflation_correction ` - if true apply coarse problem correction +- `-pc_deflation_correction_factor <1.0>` - sets coarse problem correction factor + +-seealso: [](ch_ksp), `PCDEFLATION`, `PCDeflationSetLevels()`, `PCDeflationSetReductionFactor()` + +# External Links +$(_doc_external("Ksp/PCDeflationSetCorrectionFactor")) +""" +function PCDeflationSetCorrectionFactor(petsclib::PetscLibType, pc::PC, fact::PetscScalar) end + +@for_petsc function PCDeflationSetCorrectionFactor(petsclib::$UnionPetscLib, pc::PC, fact::$PetscScalar ) + + @chk ccall( + (:PCDeflationSetCorrectionFactor, $petsc_library), + PetscErrorCode, + (PC, $PetscScalar), + pc, fact, + ) + + + return nothing +end + +""" + PCDeflationSetSpaceToCompute(petsclib::PetscLibType,pc::PC, type::PCDeflationSpaceType, size::PetscInt) +Set deflation space type and size to compute. + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - deflation space type to compute (or `PETSC_IGNORE`) +- `size` - size of the space to compute (or `PETSC_DEFAULT`) + +Options Database Keys: +- `-pc_deflation_compute_space ` - compute `PCDeflationSpaceType` deflation space +- `-pc_deflation_compute_space_size <1>` - size of the deflation space + +-seealso: [](ch_ksp), `PCDeflationSetLevels()`, `PCDEFLATION` + +# External Links +$(_doc_external("Ksp/PCDeflationSetSpaceToCompute")) +""" +function PCDeflationSetSpaceToCompute(petsclib::PetscLibType, pc::PC, type::PCDeflationSpaceType, size::PetscInt) end + +@for_petsc function PCDeflationSetSpaceToCompute(petsclib::$UnionPetscLib, pc::PC, type::PCDeflationSpaceType, size::$PetscInt ) + + @chk ccall( + (:PCDeflationSetSpaceToCompute, $petsc_library), + PetscErrorCode, + (PC, PCDeflationSpaceType, $PetscInt), + pc, type, size, + ) + + + return nothing +end + +""" + PCDeflationSetSpace(petsclib::PetscLibType,pc::PC, W::PetscMat, transpose::PetscBool) +Set the deflation space matrix (or its (Hermitian) transpose). + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `W` - deflation matrix +- `transpose` - indicates that W is an explicit transpose of the deflation matrix + +Level: intermediate + +-seealso: [](ch_ksp), `PCDeflationSetLevels()`, `PCDEFLATION`, `PCDeflationSetProjectionNullSpaceMat()` + +# External Links +$(_doc_external("Ksp/PCDeflationSetSpace")) +""" +function PCDeflationSetSpace(petsclib::PetscLibType, pc::PC, W::PetscMat, transpose::PetscBool) end + +@for_petsc function PCDeflationSetSpace(petsclib::$UnionPetscLib, pc::PC, W::PetscMat, transpose::PetscBool ) + + @chk ccall( + (:PCDeflationSetSpace, $petsc_library), + PetscErrorCode, + (PC, CMat, PetscBool), + pc, W, transpose, + ) + + + return nothing +end + +""" + PCDeflationSetProjectionNullSpaceMat(petsclib::PetscLibType,pc::PC, mat::PetscMat) +Set the projection null space matrix (W'*A). + +Collective + +Input Parameters: +- `pc` - preconditioner context +- `mat` - projection null space matrix + +Level: developer + +-seealso: [](ch_ksp), `PCDEFLATION`, `PCDeflationSetSpace()` + +# External Links +$(_doc_external("Ksp/PCDeflationSetProjectionNullSpaceMat")) +""" +function PCDeflationSetProjectionNullSpaceMat(petsclib::PetscLibType, pc::PC, mat::PetscMat) end + +@for_petsc function PCDeflationSetProjectionNullSpaceMat(petsclib::$UnionPetscLib, pc::PC, mat::PetscMat ) + + @chk ccall( + (:PCDeflationSetProjectionNullSpaceMat, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, mat, + ) + + + return nothing +end + +""" + PCDeflationSetCoarseMat(petsclib::PetscLibType,pc::PC, mat::PetscMat) +Set the coarse problem `Mat`. + +Collective + +Input Parameters: +- `pc` - preconditioner context +- `mat` - coarse problem mat + +Level: developer + +-seealso: [](ch_ksp), `PCDEFLATION`, `PCDeflationGetCoarseKSP()` + +# External Links +$(_doc_external("Ksp/PCDeflationSetCoarseMat")) +""" +function PCDeflationSetCoarseMat(petsclib::PetscLibType, pc::PC, mat::PetscMat) end + +@for_petsc function PCDeflationSetCoarseMat(petsclib::$UnionPetscLib, pc::PC, mat::PetscMat ) + + @chk ccall( + (:PCDeflationSetCoarseMat, $petsc_library), + PetscErrorCode, + (PC, CMat), + pc, mat, + ) + + + return nothing +end + +""" + PCDeflationGetCoarseKSP(petsclib::PetscLibType,pc::PC, ksp::PetscKSP) +Returns the coarse problem `KSP`. + +Not Collective + +Input Parameter: +- `pc` - preconditioner context + +Output Parameter: +- `ksp` - coarse problem `KSP` context + +Level: advanced + +-seealso: [](ch_ksp), `PCDEFLATION`, `PCDeflationSetCoarseMat()` + +# External Links +$(_doc_external("Ksp/PCDeflationGetCoarseKSP")) +""" +function PCDeflationGetCoarseKSP(petsclib::PetscLibType, pc::PC, ksp::PetscKSP) end + +@for_petsc function PCDeflationGetCoarseKSP(petsclib::$UnionPetscLib, pc::PC, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:PCDeflationGetCoarseKSP, $petsc_library), + PetscErrorCode, + (PC, Ptr{CKSP}), + pc, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + PCDeflationGetPC(petsclib::PetscLibType,pc::PC, apc::PC) +Returns the additional preconditioner M^{ + +Not Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `apc` - additional preconditioner + +Level: advanced + +-seealso: [](ch_ksp), `PCDEFLATION`, `PCDeflationGetCoarseKSP()` + +# External Links +$(_doc_external("Ksp/PCDeflationGetPC")) +""" +function PCDeflationGetPC(petsclib::PetscLibType, pc::PC, apc::PC) end + +@for_petsc function PCDeflationGetPC(petsclib::$UnionPetscLib, pc::PC, apc::PC ) + + @chk ccall( + (:PCDeflationGetPC, $petsc_library), + PetscErrorCode, + (PC, Ptr{PC}), + pc, apc, + ) + + + return nothing +end + +""" + PCGAMGSetNSmooths(petsclib::PetscLibType,pc::PC, n::PetscInt) +Set number of smoothing steps (1 is typical) used to construct the prolongation operator + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `n` - the number of smooths + +Options Database Key: +- `-pc_gamg_agg_nsmooths ` - the flag + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCMG`, `PCGAMG` + +# External Links +$(_doc_external("Ksp/PCGAMGSetNSmooths")) +""" +function PCGAMGSetNSmooths(petsclib::PetscLibType, pc::PC, n::PetscInt) end + +@for_petsc function PCGAMGSetNSmooths(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt ) + + @chk ccall( + (:PCGAMGSetNSmooths, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, n, + ) + + + return nothing +end + +""" + PCGAMGSetAggressiveLevels(petsclib::PetscLibType,pc::PC, n::PetscInt) +Use aggressive coarsening on first n levels + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `n` - 0, 1 or more + +Options Database Key: +- `-pc_gamg_aggressive_coarsening ` - the flag + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetThreshold()`, `PCGAMGMISkSetAggressive()`, `PCGAMGSetAggressiveSquareGraph()`, `PCGAMGMISkSetMinDegreeOrdering()`, `PCGAMGSetLowMemoryFilter()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetAggressiveLevels")) +""" +function PCGAMGSetAggressiveLevels(petsclib::PetscLibType, pc::PC, n::PetscInt) end + +@for_petsc function PCGAMGSetAggressiveLevels(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt ) + + @chk ccall( + (:PCGAMGSetAggressiveLevels, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, n, + ) + + + return nothing +end + +""" + PCGAMGMISkSetAggressive(petsclib::PetscLibType,pc::PC, n::PetscInt) +Number (k) distance in MIS coarsening (>2 is 'aggressive') + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `n` - 1 or more (default = 2) + +Options Database Key: +- `-pc_gamg_aggressive_mis_k ` - the flag + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetThreshold()`, `PCGAMGSetAggressiveLevels()`, `PCGAMGSetAggressiveSquareGraph()`, `PCGAMGMISkSetMinDegreeOrdering()`, `PCGAMGSetLowMemoryFilter()` + +# External Links +$(_doc_external("Ksp/PCGAMGMISkSetAggressive")) +""" +function PCGAMGMISkSetAggressive(petsclib::PetscLibType, pc::PC, n::PetscInt) end + +@for_petsc function PCGAMGMISkSetAggressive(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt ) + + @chk ccall( + (:PCGAMGMISkSetAggressive, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, n, + ) + + + return nothing +end + +""" + PCGAMGSetAggressiveSquareGraph(petsclib::PetscLibType,pc::PC, b::PetscBool) +Use graph square, A^T A, for aggressive coarsening. Coarsening is slower than the alternative (MIS + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `b` - default true + +Options Database Key: +- `-pc_gamg_aggressive_square_graph ` - the flag + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetThreshold()`, `PCGAMGSetAggressiveLevels()`, `PCGAMGMISkSetAggressive()`, `PCGAMGMISkSetMinDegreeOrdering()`, `PCGAMGSetLowMemoryFilter()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetAggressiveSquareGraph")) +""" +function PCGAMGSetAggressiveSquareGraph(petsclib::PetscLibType, pc::PC, b::PetscBool) end + +@for_petsc function PCGAMGSetAggressiveSquareGraph(petsclib::$UnionPetscLib, pc::PC, b::PetscBool ) + + @chk ccall( + (:PCGAMGSetAggressiveSquareGraph, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, b, + ) + + + return nothing +end + +""" + PCGAMGMISkSetMinDegreeOrdering(petsclib::PetscLibType,pc::PC, b::PetscBool) +Use minimum degree ordering in greedy MIS algorithm + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `b` - default false + +Options Database Key: +- `-pc_gamg_mis_k_minimum_degree_ordering ` - the flag + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetThreshold()`, `PCGAMGSetAggressiveLevels()`, `PCGAMGMISkSetAggressive()`, `PCGAMGSetAggressiveSquareGraph()`, `PCGAMGSetLowMemoryFilter()` + +# External Links +$(_doc_external("Ksp/PCGAMGMISkSetMinDegreeOrdering")) +""" +function PCGAMGMISkSetMinDegreeOrdering(petsclib::PetscLibType, pc::PC, b::PetscBool) end + +@for_petsc function PCGAMGMISkSetMinDegreeOrdering(petsclib::$UnionPetscLib, pc::PC, b::PetscBool ) + + @chk ccall( + (:PCGAMGMISkSetMinDegreeOrdering, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, b, + ) + + + return nothing +end + +""" + PCGAMGSetLowMemoryFilter(petsclib::PetscLibType,pc::PC, b::PetscBool) +Use low memory graph/matrix filter + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `b` - default false + +Options Database Key: +- `-pc_gamg_low_memory_threshold_filter ` - the flag + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), `PCGAMG`, `PCGAMGSetThreshold()`, `PCGAMGSetAggressiveLevels()`, +`PCGAMGMISkSetAggressive()`, `PCGAMGSetAggressiveSquareGraph()`, `PCGAMGMISkSetMinDegreeOrdering()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetLowMemoryFilter")) +""" +function PCGAMGSetLowMemoryFilter(petsclib::PetscLibType, pc::PC, b::PetscBool) end + +@for_petsc function PCGAMGSetLowMemoryFilter(petsclib::$UnionPetscLib, pc::PC, b::PetscBool ) + + @chk ccall( + (:PCGAMGSetLowMemoryFilter, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, b, + ) + + + return nothing +end + +""" + PCGAMGSetGraphSymmetrize(petsclib::PetscLibType,pc::PC, b::PetscBool) +Symmetrize graph used for coarsening. Defaults to true, but if matrix has symmetric attribute, then not needed since the graph is already known to be symmetric + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `b` - default true + +Options Database Key: +- `-pc_gamg_graph_symmetrize ` - the flag + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), `PCGAMG`, `PCGAMGSetThreshold()`, `PCGAMGSetAggressiveLevels()`, `MatCreateGraph()`, +`PCGAMGMISkSetAggressive()`, `PCGAMGSetAggressiveSquareGraph()`, `PCGAMGMISkSetMinDegreeOrdering()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetGraphSymmetrize")) +""" +function PCGAMGSetGraphSymmetrize(petsclib::PetscLibType, pc::PC, b::PetscBool) end + +@for_petsc function PCGAMGSetGraphSymmetrize(petsclib::$UnionPetscLib, pc::PC, b::PetscBool ) + + @chk ccall( + (:PCGAMGSetGraphSymmetrize, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, b, + ) + + + return nothing +end + +""" + PCGAMGSetProcEqLim(petsclib::PetscLibType,pc::PC, n::PetscInt) +Set number of equations to aim for per process on the coarse grids via processor reduction in `PCGAMG` + +Logically Collective + +Input Parameters: +- `pc` - the preconditioner context +- `n` - the number of equations + +Options Database Key: +- `-pc_gamg_process_eq_limit ` - set the limit + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetCoarseEqLim()`, `PCGAMGSetRankReductionFactors()`, `PCGAMGSetRepartition()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetProcEqLim")) +""" +function PCGAMGSetProcEqLim(petsclib::PetscLibType, pc::PC, n::PetscInt) end + +@for_petsc function PCGAMGSetProcEqLim(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt ) + + @chk ccall( + (:PCGAMGSetProcEqLim, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, n, + ) + + + return nothing +end + +""" + PCGAMGSetCoarseEqLim(petsclib::PetscLibType,pc::PC, n::PetscInt) +Set maximum number of equations on the coarsest grid of `PCGAMG` + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `n` - maximum number of equations to aim for + +Options Database Key: +- `-pc_gamg_coarse_eq_limit ` - set the limit + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetProcEqLim()`, `PCGAMGSetRankReductionFactors()`, `PCGAMGSetRepartition()`, +`PCGAMGSetParallelCoarseGridSolve()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetCoarseEqLim")) +""" +function PCGAMGSetCoarseEqLim(petsclib::PetscLibType, pc::PC, n::PetscInt) end + +@for_petsc function PCGAMGSetCoarseEqLim(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt ) + + @chk ccall( + (:PCGAMGSetCoarseEqLim, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, n, + ) + + + return nothing +end + +""" + PCGAMGSetRepartition(petsclib::PetscLibType,pc::PC, n::PetscBool) +Repartition the degrees of freedom across the processors on the coarser grids when reducing the number of MPI ranks to use + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `n` - `PETSC_TRUE` or `PETSC_FALSE` + +Options Database Key: +- `-pc_gamg_repartition ` - turn on the repartitioning + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetProcEqLim()`, `PCGAMGSetRankReductionFactors()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetRepartition")) +""" +function PCGAMGSetRepartition(petsclib::PetscLibType, pc::PC, n::PetscBool) end + +@for_petsc function PCGAMGSetRepartition(petsclib::$UnionPetscLib, pc::PC, n::PetscBool ) + + @chk ccall( + (:PCGAMGSetRepartition, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, n, + ) + + + return nothing +end + +""" + PCGAMGSetUseSAEstEig(petsclib::PetscLibType,pc::PC, b::PetscBool) +Use the eigen estimate from smoothed aggregation for the Chebyshev smoother during the solution process + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `b` - flag + +Options Database Key: +- `-pc_gamg_use_sa_esteig ` - use the eigen estimate + +Level: advanced + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `KSPChebyshevSetEigenvalues()`, `KSPChebyshevEstEigSet()`, `PCGAMGSetRecomputeEstEig()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetUseSAEstEig")) +""" +function PCGAMGSetUseSAEstEig(petsclib::PetscLibType, pc::PC, b::PetscBool) end + +@for_petsc function PCGAMGSetUseSAEstEig(petsclib::$UnionPetscLib, pc::PC, b::PetscBool ) + + @chk ccall( + (:PCGAMGSetUseSAEstEig, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, b, + ) + + + return nothing +end + +""" + PCGAMGSetRecomputeEstEig(petsclib::PetscLibType,pc::PC, b::PetscBool) +Set flag for Chebyshev smoothers to recompute the eigen estimates when a new matrix is used + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `b` - flag, default is `PETSC_TRUE` + +Options Database Key: +- `-pc_gamg_recompute_esteig ` - use the eigen estimate + +Level: advanced + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `KSPChebyshevSetEigenvalues()`, `KSPChebyshevEstEigSet()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetRecomputeEstEig")) +""" +function PCGAMGSetRecomputeEstEig(petsclib::PetscLibType, pc::PC, b::PetscBool) end + +@for_petsc function PCGAMGSetRecomputeEstEig(petsclib::$UnionPetscLib, pc::PC, b::PetscBool ) + + @chk ccall( + (:PCGAMGSetRecomputeEstEig, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, b, + ) + + + return nothing +end + +""" + PCGAMGSetEigenvalues(petsclib::PetscLibType,pc::PC, emax::PetscReal, emin::PetscReal) +Set WHAT eigenvalues WHY? + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `emax` - max eigenvalue +- `emin` - min eigenvalue + +Options Database Key: +- `-pc_gamg_eigenvalues ` - estimates of the eigenvalues + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetUseSAEstEig()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetEigenvalues")) +""" +function PCGAMGSetEigenvalues(petsclib::PetscLibType, pc::PC, emax::PetscReal, emin::PetscReal) end + +@for_petsc function PCGAMGSetEigenvalues(petsclib::$UnionPetscLib, pc::PC, emax::$PetscReal, emin::$PetscReal ) + + @chk ccall( + (:PCGAMGSetEigenvalues, $petsc_library), + PetscErrorCode, + (PC, $PetscReal, $PetscReal), + pc, emax, emin, + ) + + + return nothing +end + +""" + PCGAMGSetReuseInterpolation(petsclib::PetscLibType,pc::PC, n::PetscBool) +Reuse prolongation when rebuilding a `PCGAMG` algebraic multigrid preconditioner + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `n` - `PETSC_TRUE` or `PETSC_FALSE` + +Options Database Key: +- `-pc_gamg_reuse_interpolation ` - reuse the previous interpolation + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG` + +# External Links +$(_doc_external("Ksp/PCGAMGSetReuseInterpolation")) +""" +function PCGAMGSetReuseInterpolation(petsclib::PetscLibType, pc::PC, n::PetscBool) end + +@for_petsc function PCGAMGSetReuseInterpolation(petsclib::$UnionPetscLib, pc::PC, n::PetscBool ) + + @chk ccall( + (:PCGAMGSetReuseInterpolation, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, n, + ) + + + return nothing +end + +""" + PCGAMGASMSetUseAggs(petsclib::PetscLibType,pc::PC, flg::PetscBool) +Have the `PCGAMG` smoother on each level use `PCASM` where the aggregates defined by the coarsening process are +the subdomains for the additive Schwarz preconditioner used as the smoother + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - `PETSC_TRUE` to use aggregates, `PETSC_FALSE` to not + +Options Database Key: +- `-pc_gamg_asm_use_agg ` - use aggregates to define the additive Schwarz subdomains + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCASM`, `PCSetType` + +# External Links +$(_doc_external("Ksp/PCGAMGASMSetUseAggs")) +""" +function PCGAMGASMSetUseAggs(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCGAMGASMSetUseAggs(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCGAMGASMSetUseAggs, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + PCGAMGSetParallelCoarseGridSolve(petsclib::PetscLibType,pc::PC, flg::PetscBool) +allow a parallel coarse grid solver + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - `PETSC_TRUE` to not force coarse grid onto one processor + +Options Database Key: +- `-pc_gamg_parallel_coarse_grid_solver` - use a parallel coarse grid solver + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetCoarseGridLayoutType()`, `PCGAMGSetCpuPinCoarseGrids()`, `PCGAMGSetRankReductionFactors()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetParallelCoarseGridSolve")) +""" +function PCGAMGSetParallelCoarseGridSolve(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCGAMGSetParallelCoarseGridSolve(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCGAMGSetParallelCoarseGridSolve, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + PCGAMGSetCpuPinCoarseGrids(petsclib::PetscLibType,pc::PC, flg::PetscBool) +pin the coarse grids created in `PCGAMG` to run only on the CPU since the problems may be too small to run efficiently on the GPUs + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - `PETSC_TRUE` to pin coarse grids to the CPU + +Options Database Key: +- `-pc_gamg_cpu_pin_coarse_grids` - pin the coarse grids to the CPU + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetCoarseGridLayoutType()`, `PCGAMGSetParallelCoarseGridSolve()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetCpuPinCoarseGrids")) +""" +function PCGAMGSetCpuPinCoarseGrids(petsclib::PetscLibType, pc::PC, flg::PetscBool) end + +@for_petsc function PCGAMGSetCpuPinCoarseGrids(petsclib::$UnionPetscLib, pc::PC, flg::PetscBool ) + + @chk ccall( + (:PCGAMGSetCpuPinCoarseGrids, $petsc_library), + PetscErrorCode, + (PC, PetscBool), + pc, flg, + ) + + + return nothing +end + +""" + PCGAMGSetCoarseGridLayoutType(petsclib::PetscLibType,pc::PC, flg::PCGAMGLayoutType) +place coarse grids on processors with natural order (compact type) + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `flg` - `PCGAMGLayoutType` type, either `PCGAMG_LAYOUT_COMPACT` or `PCGAMG_LAYOUT_SPREAD` + +Options Database Key: +- `-pc_gamg_coarse_grid_layout_type` - place the coarse grids with natural ordering + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetParallelCoarseGridSolve()`, `PCGAMGSetCpuPinCoarseGrids()`, `PCGAMGLayoutType`, `PCGAMG_LAYOUT_COMPACT`, `PCGAMG_LAYOUT_SPREAD` + +# External Links +$(_doc_external("Ksp/PCGAMGSetCoarseGridLayoutType")) +""" +function PCGAMGSetCoarseGridLayoutType(petsclib::PetscLibType, pc::PC, flg::PCGAMGLayoutType) end + +@for_petsc function PCGAMGSetCoarseGridLayoutType(petsclib::$UnionPetscLib, pc::PC, flg::PCGAMGLayoutType ) + + @chk ccall( + (:PCGAMGSetCoarseGridLayoutType, $petsc_library), + PetscErrorCode, + (PC, PCGAMGLayoutType), + pc, flg, + ) + + + return nothing +end + +""" + PCGAMGSetNlevels(petsclib::PetscLibType,pc::PC, n::PetscInt) +Sets the maximum number of levels `PCGAMG` will use + +Collective + +Input Parameters: +- `pc` - the preconditioner +- `n` - the maximum number of levels to use + +Options Database Key: +- `-pc_mg_levels ` - set the maximum number of levels to allow + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG` + +# External Links +$(_doc_external("Ksp/PCGAMGSetNlevels")) +""" +function PCGAMGSetNlevels(petsclib::PetscLibType, pc::PC, n::PetscInt) end + +@for_petsc function PCGAMGSetNlevels(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt ) + + @chk ccall( + (:PCGAMGSetNlevels, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, n, + ) + + + return nothing +end + +""" + PCGAMGASMSetHEM(petsclib::PetscLibType,pc::PC, n::PetscInt) +Sets the number of HEM matching passed + +Collective + +Input Parameters: +- `pc` - the preconditioner +- `n` - number of HEM matching passed to construct ASM subdomains + +Options Database Key: +- `-pc_gamg_asm_hem ` - set the number of HEM matching passed + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG` + +# External Links +$(_doc_external("Ksp/PCGAMGASMSetHEM")) +""" +function PCGAMGASMSetHEM(petsclib::PetscLibType, pc::PC, n::PetscInt) end + +@for_petsc function PCGAMGASMSetHEM(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt ) + + @chk ccall( + (:PCGAMGASMSetHEM, $petsc_library), + PetscErrorCode, + (PC, $PetscInt), + pc, n, + ) + + + return nothing +end + +""" + PCGAMGSetThreshold(petsclib::PetscLibType,pc::PC, v::Vector{PetscReal}, n::PetscInt) +Relative threshold to use for dropping edges in aggregation graph + +Not Collective + +Input Parameters: +- `pc` - the preconditioner context +- `v` - array of threshold values for finest n levels; 0.0 means keep all nonzero entries in the graph; negative means keep even zero entries in the graph +- `n` - number of threshold values provided in array + +Options Database Key: +- `-pc_gamg_threshold ` - the threshold to drop edges + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetAggressiveLevels()`, `PCGAMGMISkSetAggressive()`, `PCGAMGSetMinDegreeOrderingMISk()`, `PCGAMGSetThresholdScale()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetThreshold")) +""" +function PCGAMGSetThreshold(petsclib::PetscLibType, pc::PC, v::Vector{PetscReal}, n::PetscInt) end + +@for_petsc function PCGAMGSetThreshold(petsclib::$UnionPetscLib, pc::PC, v::Vector{$PetscReal}, n::$PetscInt ) + + @chk ccall( + (:PCGAMGSetThreshold, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscReal}, $PetscInt), + pc, v, n, + ) + + + return nothing +end + +""" + PCGAMGSetRankReductionFactors(petsclib::PetscLibType,pc::PC, v::Vector{PetscInt}, n::PetscInt) +Set a manual schedule for MPI rank reduction on coarse grids + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `v` - array of reduction factors. 0 for first value forces a reduction to one process/device on first level in CUDA +- `n` - number of values provided in array + +Options Database Key: +- `-pc_gamg_rank_reduction_factors ` - provide the schedule + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetProcEqLim()`, `PCGAMGSetCoarseEqLim()`, `PCGAMGSetParallelCoarseGridSolve()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetRankReductionFactors")) +""" +function PCGAMGSetRankReductionFactors(petsclib::PetscLibType, pc::PC, v::Vector{PetscInt}, n::PetscInt) end + +@for_petsc function PCGAMGSetRankReductionFactors(petsclib::$UnionPetscLib, pc::PC, v::Vector{$PetscInt}, n::$PetscInt ) + + @chk ccall( + (:PCGAMGSetRankReductionFactors, $petsc_library), + PetscErrorCode, + (PC, Ptr{$PetscInt}, $PetscInt), + pc, v, n, + ) + + + return nothing +end + +""" + PCGAMGSetThresholdScale(petsclib::PetscLibType,pc::PC, v::PetscReal) +Relative threshold reduction at each level + +Not Collective + +Input Parameters: +- `pc` - the preconditioner context +- `v` - the threshold value reduction, usually < 1.0 + +Options Database Key: +- `-pc_gamg_threshold_scale ` - set the relative threshold reduction on each level + +Level: advanced + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetThreshold()` + +# External Links +$(_doc_external("Ksp/PCGAMGSetThresholdScale")) +""" +function PCGAMGSetThresholdScale(petsclib::PetscLibType, pc::PC, v::PetscReal) end + +@for_petsc function PCGAMGSetThresholdScale(petsclib::$UnionPetscLib, pc::PC, v::$PetscReal ) + + @chk ccall( + (:PCGAMGSetThresholdScale, $petsc_library), + PetscErrorCode, + (PC, $PetscReal), + pc, v, + ) + + + return nothing +end + +""" + PCGAMGSetType(petsclib::PetscLibType,pc::PC, type::PCGAMGType) +Set the type of algorithm `PCGAMG` should use + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - `PCGAMGAGG`, `PCGAMGGEO`, or `PCGAMGCLASSICAL` + +Options Database Key: +- `-pc_gamg_type ` - type of algebraic multigrid to apply - only agg is supported + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMGGetType()`, `PCGAMG`, `PCGAMGType` + +# External Links +$(_doc_external("Ksp/PCGAMGSetType")) +""" +function PCGAMGSetType(petsclib::PetscLibType, pc::PC, type::PCGAMGType) end + +@for_petsc function PCGAMGSetType(petsclib::$UnionPetscLib, pc::PC, type::PCGAMGType ) + + @chk ccall( + (:PCGAMGSetType, $petsc_library), + PetscErrorCode, + (PC, PCGAMGType), + pc, type, + ) + + + return nothing +end + +""" + type::PCGAMGType = PCGAMGGetType(petsclib::PetscLibType,pc::PC) +Get the type of algorithm `PCGAMG` will use + +Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `type` - the type of algorithm used + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), [](ch_ksp), `PCGAMG`, `PCGAMGSetType()`, `PCGAMGType` + +# External Links +$(_doc_external("Ksp/PCGAMGGetType")) +""" +function PCGAMGGetType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCGAMGGetType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{PCGAMGType}() + + @chk ccall( + (:PCGAMGGetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCGAMGType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PCGAMGSetInjectionIndex(petsclib::PetscLibType,pc::PC, n::PetscInt, idx::Vector{PetscInt}) +Array of subset of variables per vertex to inject into coarse grid space + +Logically Collective + +Input Parameters: +- `pc` - the coarsen context +- `n` - number of indices +- `idx` - array of indices + +Options Database Key: +- `-pc_gamg_injection_index` - array of subset of variables per vertex to use for injection coarse grid space + +Level: intermediate + +-seealso: [the Users Manual section on PCGAMG](sec_amg), [the Users Manual section on PCMG](sec_mg), `PCGAMG` + +# External Links +$(_doc_external("Ksp/PCGAMGSetInjectionIndex")) +""" +function PCGAMGSetInjectionIndex(petsclib::PetscLibType, pc::PC, n::PetscInt, idx::Vector{PetscInt}) end + +@for_petsc function PCGAMGSetInjectionIndex(petsclib::$UnionPetscLib, pc::PC, n::$PetscInt, idx::Vector{$PetscInt} ) + + @chk ccall( + (:PCGAMGSetInjectionIndex, $petsc_library), + PetscErrorCode, + (PC, $PetscInt, Ptr{$PetscInt}), + pc, n, idx, + ) + + + return nothing +end + +""" + PCGAMGInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PCGAMG` package. It is called +from `PCInitializePackage()`. + +Level: developer + +-seealso: [](ch_ksp), `PetscInitialize()` + +# External Links +$(_doc_external("Ksp/PCGAMGInitializePackage")) +""" +function PCGAMGInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PCGAMGInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PCGAMGInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PCGAMGFinalizePackage(petsclib::PetscLibType) +This function frees everything from the `PCGAMG` package. It is +called from `PetscFinalize()` automatically. + +Level: developer + +-seealso: [](ch_ksp), `PetscFinalize()` + +# External Links +$(_doc_external("Ksp/PCGAMGFinalizePackage")) +""" +function PCGAMGFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PCGAMGFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PCGAMGFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PCGAMGRegister(petsclib::PetscLibType,type::PCGAMGType, create::external) +Register a `PCGAMG` implementation. + +Input Parameters: +- `type` - string that will be used as the name of the `PCGAMG` type. +- `create` - function for creating the gamg context. + +Level: developer + +-seealso: [](ch_ksp), `PCGAMGType`, `PCGAMG`, `PCGAMGSetType()` + +# External Links +$(_doc_external("Ksp/PCGAMGRegister")) +""" +function PCGAMGRegister(petsclib::PetscLibType, type::PCGAMGType, create::external) end + +@for_petsc function PCGAMGRegister(petsclib::$UnionPetscLib, type::PCGAMGType, create::external ) + + @chk ccall( + (:PCGAMGRegister, $petsc_library), + PetscErrorCode, + (PCGAMGType, external), + type, create, + ) + + + return nothing +end + +""" + G::PetscMat = PCGAMGCreateGraph(petsclib::PetscLibType,pc::PC, A::PetscMat) +Creates a graph that is used by the `PCGAMGType` in the coarsening process + +Input Parameters: +- `pc` - the `PCGAMG` +- `A` - the matrix, for any level + +Output Parameter: +- `G` - the graph + +Level: advanced + +-seealso: [](ch_ksp), `PCGAMGType`, `PCGAMG`, `PCGAMGSetType()` + +# External Links +$(_doc_external("Ksp/PCGAMGCreateGraph")) +""" +function PCGAMGCreateGraph(petsclib::PetscLibType, pc::PC, A::PetscMat) end + +@for_petsc function PCGAMGCreateGraph(petsclib::$UnionPetscLib, pc::PC, A::PetscMat ) + G_ = Ref{CMat}() + + @chk ccall( + (:PCGAMGCreateGraph, $petsc_library), + PetscErrorCode, + (PC, CMat, Ptr{CMat}), + pc, A, G_, + ) + + G = PetscMat(G_[], petsclib) + + return G +end + +""" + PCGAMGClassicalSetType(petsclib::PetscLibType,pc::PC, type::PCGAMGClassicalType) +Sets the type of classical interpolation to use with `PCGAMG` + +Collective + +Input Parameters: +- `pc` - the preconditioner context +- `type` - the interpolation to use, see `PCGAMGClassicalType()` + +Options Database Key: +- `-pc_gamg_classical_type ` - set type of classical AMG prolongation + +Level: intermediate + +-seealso: [](ch_ksp), `PCGAMG`, `PCGAMGClassicalType`, `PCGAMGClassicalGetType()` + +# External Links +$(_doc_external("Ksp/PCGAMGClassicalSetType")) +""" +function PCGAMGClassicalSetType(petsclib::PetscLibType, pc::PC, type::PCGAMGClassicalType) end + +@for_petsc function PCGAMGClassicalSetType(petsclib::$UnionPetscLib, pc::PC, type::PCGAMGClassicalType ) + + @chk ccall( + (:PCGAMGClassicalSetType, $petsc_library), + PetscErrorCode, + (PC, PCGAMGClassicalType), + pc, type, + ) + + + return nothing +end + +""" + type::PCGAMGClassicalType = PCGAMGClassicalGetType(petsclib::PetscLibType,pc::PC) +Gets the type of classical interpolation to use with `PCGAMG` + +Collective + +Input Parameter: +- `pc` - the preconditioner context + +Output Parameter: +- `type` - the type used, see `PCGAMGClassicalType()` + +Level: intermediate + +-seealso: [](ch_ksp), `PCGAMG`, `PCGAMGClassicalType`, `PCGAMGClassicalSetType()` + +# External Links +$(_doc_external("Ksp/PCGAMGClassicalGetType")) +""" +function PCGAMGClassicalGetType(petsclib::PetscLibType, pc::PC) end + +@for_petsc function PCGAMGClassicalGetType(petsclib::$UnionPetscLib, pc::PC ) + type_ = Ref{PCGAMGClassicalType}() + + @chk ccall( + (:PCGAMGClassicalGetType, $petsc_library), + PetscErrorCode, + (PC, Ptr{PCGAMGClassicalType}), + pc, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PCFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the `PC` package. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: [](ch_ksp), `PetscFinalize()`, `PCInitializePackage()` + +# External Links +$(_doc_external("Ksp/PCFinalizePackage")) +""" +function PCFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PCFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PCFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PCInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PC` package. It is called +from `PetscDLLibraryRegister_petscksp()` when using dynamic libraries, and on the first call to `PCCreate()` +when using shared static libraries. + +Level: developer + +-seealso: [](ch_ksp), `PetscInitialize()`, `PCFinalizePackage()` + +# External Links +$(_doc_external("Ksp/PCInitializePackage")) +""" +function PCInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PCInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PCInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PCMPIServerAddressesDestroy(petsclib::PetscLibType,ctx::Cvoid) + +# External Links +$(_doc_external("Sys/PCMPIServerAddressesDestroy")) +""" +function PCMPIServerAddressesDestroy(petsclib::PetscLibType, ctx::Cvoid) end + +@for_petsc function PCMPIServerAddressesDestroy(petsclib::$UnionPetscLib, ctx::Cvoid ) + + @chk ccall( + (:PCMPIServerAddressesDestroy, $petsc_library), + PetscErrorCode, + (Cvoid,), + ctx, + ) + + + return nothing +end + diff --git a/src/autowrapped/PF_wrappers.jl b/src/autowrapped/PF_wrappers.jl new file mode 100644 index 00000000..759fd7dd --- /dev/null +++ b/src/autowrapped/PF_wrappers.jl @@ -0,0 +1,468 @@ +# autodefined type arguments for class ------ +# ------------------------------------------------------- +""" + PFSet(petsclib::PetscLibType,pf::PF, apply::external, applyvec::external, view::external, destroy::external, ctx::Cvoid) +Sets the C/C++/Fortran functions to be used by the PF function + +Collective + +Input Parameters: +- `pf` - the function context +- `apply` - function to apply to an array +- `applyvec` - function to apply to a Vec +- `view` - function that prints information about the `PF` +- `destroy` - function to free the private function context +- `ctx` - private function context + +Level: beginner + +-seealso: `PF`, `PFCreate()`, `PFDestroy()`, `PFSetType()`, `PFApply()`, `PFApplyVec()` + +# External Links +$(_doc_external("Vec/PFSet")) +""" +function PFSet(petsclib::PetscLibType, pf::PF, apply::external, applyvec::external, view::external, destroy::external, ctx::Cvoid) end + +@for_petsc function PFSet(petsclib::$UnionPetscLib, pf::PF, apply::external, applyvec::external, view::external, destroy::external, ctx::Cvoid ) + + @chk ccall( + (:PFSet, $petsc_library), + PetscErrorCode, + (CPF, external, external, external, external, Ptr{Cvoid}), + pf, apply, applyvec, view, destroy, ctx, + ) + + + return nothing +end + +""" + PFDestroy(petsclib::PetscLibType,pf::PF) +Destroys `PF` context that was created with `PFCreate()`. + +Collective + +Input Parameter: +- `pf` - the function context + +Level: beginner + +-seealso: `PF`, `PFCreate()`, `PFSet()`, `PFSetType()` + +# External Links +$(_doc_external("Vec/PFDestroy")) +""" +function PFDestroy(petsclib::PetscLibType, pf::PF) end + +@for_petsc function PFDestroy(petsclib::$UnionPetscLib, pf::PF ) + pf_ = Ref(pf.ptr) + + @chk ccall( + (:PFDestroy, $petsc_library), + PetscErrorCode, + (Ptr{CPF},), + pf_, + ) + + pf.ptr = C_NULL + + return nothing +end + +""" + pf::PF = PFCreate(petsclib::PetscLibType,comm::MPI_Comm, dimin::PetscInt, dimout::PetscInt) +Creates a mathematical function context. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `dimin` - dimension of the space you are mapping from +- `dimout` - dimension of the space you are mapping to + +Output Parameter: +- `pf` - the function context + +Level: developer + +-seealso: `PF`, `PFSet()`, `PFApply()`, `PFDestroy()`, `PFApplyVec()` + +# External Links +$(_doc_external("Vec/PFCreate")) +""" +function PFCreate(petsclib::PetscLibType, comm::MPI_Comm, dimin::PetscInt, dimout::PetscInt) end + +@for_petsc function PFCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, dimin::$PetscInt, dimout::$PetscInt ) + pf_ = Ref{CPF}() + + @chk ccall( + (:PFCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, Ptr{CPF}), + comm, dimin, dimout, pf_, + ) + + pf = PF(pf_[], petsclib) + + return pf +end + +""" + PFApplyVec(petsclib::PetscLibType,pf::PF, x::PetscVec, y::PetscVec) +Applies the mathematical function to a vector + +Collective + +Input Parameters: +- `pf` - the function context +- `x` - input vector (or `NULL` for the vector (0,1, .... N-1) + +Output Parameter: +- `y` - output vector + +Level: beginner + +-seealso: `PF`, `PFApply()`, `PFCreate()`, `PFDestroy()`, `PFSetType()`, `PFSet()` + +# External Links +$(_doc_external("Vec/PFApplyVec")) +""" +function PFApplyVec(petsclib::PetscLibType, pf::PF, x::PetscVec, y::PetscVec) end + +@for_petsc function PFApplyVec(petsclib::$UnionPetscLib, pf::PF, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:PFApplyVec, $petsc_library), + PetscErrorCode, + (CPF, CVec, CVec), + pf, x, y, + ) + + + return nothing +end + +""" + y::PetscScalar = PFApply(petsclib::PetscLibType,pf::PF, n::PetscInt, x::PetscScalar) +Applies the mathematical function to an array of values. + +Collective + +Input Parameters: +- `pf` - the function context +- `n` - number of pointwise function evaluations to perform, each pointwise function evaluation +is a function of dimin variables and computes dimout variables where dimin and dimout are defined +in the call to `PFCreate()` +- `x` - input array + +Output Parameter: +- `y` - output array + +Level: beginner + +-seealso: `PF`, `PFApplyVec()`, `PFCreate()`, `PFDestroy()`, `PFSetType()`, `PFSet()` + +# External Links +$(_doc_external("Vec/PFApply")) +""" +function PFApply(petsclib::PetscLibType, pf::PF, n::PetscInt, x::PetscScalar) end + +@for_petsc function PFApply(petsclib::$UnionPetscLib, pf::PF, n::$PetscInt, x::$PetscScalar ) + y_ = Ref{$PetscScalar}() + + @chk ccall( + (:PFApply, $petsc_library), + PetscErrorCode, + (CPF, $PetscInt, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + pf, n, x, y_, + ) + + y = y_[] + + return y +end + +""" + PFViewFromOptions(petsclib::PetscLibType,A::PF, obj::PetscObject, name::String) +View a `PF` based on options set in the options database + +Collective + +Input Parameters: +- `A` - the `PF` context +- `obj` - Optional object that provides the prefix used to search the options database +- `name` - command line option + +Level: intermediate + +-seealso: `PF`, `PFView`, `PetscObjectViewFromOptions()`, `PFCreate()` + +# External Links +$(_doc_external("Vec/PFViewFromOptions")) +""" +function PFViewFromOptions(petsclib::PetscLibType, A::PF, obj::PetscObject, name::String) end + +@for_petsc function PFViewFromOptions(petsclib::$UnionPetscLib, A::PF, obj::PetscObject, name::String ) + + @chk ccall( + (:PFViewFromOptions, $petsc_library), + PetscErrorCode, + (CPF, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PFView(petsclib::PetscLibType,pf::PF, viewer::PetscViewer) +Prints information about a mathematical function + +Collective unless `viewer` is `PETSC_VIEWER_STDOUT_SELF` + +Input Parameters: +- `pf` - the `PF` context +- `viewer` - optional visualization context + +Level: developer + +-seealso: `PF`, `PetscViewerCreate()`, `PetscViewerASCIIOpen()` + +# External Links +$(_doc_external("Vec/PFView")) +""" +function PFView(petsclib::PetscLibType, pf::PF, viewer::PetscViewer) end + +@for_petsc function PFView(petsclib::$UnionPetscLib, pf::PF, viewer::PetscViewer ) + + @chk ccall( + (:PFView, $petsc_library), + PetscErrorCode, + (CPF, PetscViewer), + pf, viewer, + ) + + + return nothing +end + +""" + PFRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a method to the mathematical function package. + +Not Collective + +Input Parameters: +- `sname` - name of a new user-defined solver +- `function` - routine to create method context + +-seealso: `PF`, `PFRegisterAll()`, `PFRegisterDestroy()` + +# External Links +$(_doc_external("Vec/PFRegister")) +""" +function PFRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PFRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PFRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + type::PFType = PFGetType(petsclib::PetscLibType,pf::PF) +Gets the `PFType` name (as a string) from the `PF` +context. + +Not Collective + +Input Parameter: +- `pf` - the function context + +Output Parameter: +- `type` - name of function + +Level: intermediate + +-seealso: `PF`, `PFSetType()` + +# External Links +$(_doc_external("Vec/PFGetType")) +""" +function PFGetType(petsclib::PetscLibType, pf::PF) end + +@for_petsc function PFGetType(petsclib::$UnionPetscLib, pf::PF ) + type_ = Ref{PFType}() + + @chk ccall( + (:PFGetType, $petsc_library), + PetscErrorCode, + (CPF, Ptr{PFType}), + pf, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PFSetType(petsclib::PetscLibType,pf::PF, type::PFType, ctx::Cvoid) +Builds `PF` for a particular function + +Collective + +Input Parameters: +- `pf` - the function context. +- `type` - a known method +- `ctx` - optional type dependent context + +Options Database Key: +- `-pf_type ` - Sets PF type + +Level: intermediate + +-seealso: `PF`, `PFSet()`, `PFRegister()`, `PFCreate()`, `DMDACreatePF()` + +# External Links +$(_doc_external("Vec/PFSetType")) +""" +function PFSetType(petsclib::PetscLibType, pf::PF, type::PFType, ctx::Cvoid) end + +@for_petsc function PFSetType(petsclib::$UnionPetscLib, pf::PF, type::PFType, ctx::Cvoid ) + + @chk ccall( + (:PFSetType, $petsc_library), + PetscErrorCode, + (CPF, PFType, Ptr{Cvoid}), + pf, type, ctx, + ) + + + return nothing +end + +""" + PFSetFromOptions(petsclib::PetscLibType,pf::PF) +Sets `PF` options from the options database. + +Collective + +Input Parameters: +- `pf` - the mathematical function context + +Level: intermediate + +-seealso: `PF` + +# External Links +$(_doc_external("Vec/PFSetFromOptions")) +""" +function PFSetFromOptions(petsclib::PetscLibType, pf::PF) end + +@for_petsc function PFSetFromOptions(petsclib::$UnionPetscLib, pf::PF ) + + @chk ccall( + (:PFSetFromOptions, $petsc_library), + PetscErrorCode, + (CPF,), + pf, + ) + + + return nothing +end + +""" + PFFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the PETSc `PF` package. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: `PF`, `PetscFinalize()` + +# External Links +$(_doc_external("Vec/PFFinalizePackage")) +""" +function PFFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PFFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PFFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PFInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PF` package. It is called +from PetscDLLibraryRegister_petscvec() when using dynamic libraries, and on the first call to `PFCreate()` +when using shared or static libraries. + +Level: developer + +-seealso: `PF`, `PetscInitialize()` + +# External Links +$(_doc_external("Vec/PFInitializePackage")) +""" +function PFInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PFInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PFInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PFStringSetFunction(petsclib::PetscLibType,pf::PF, string::String) +Creates a function from a string + +Collective + +Input Parameters: +- `pf` - the function object +- `string` - the string that defines the function + +Level: intermediate + +-seealso: `PFSetFromOptions()` + +# External Links +$(_doc_external("Vec/PFStringSetFunction")) +""" +function PFStringSetFunction(petsclib::PetscLibType, pf::PF, string::String) end + +@for_petsc function PFStringSetFunction(petsclib::$UnionPetscLib, pf::PF, string::String ) + + @chk ccall( + (:PFStringSetFunction, $petsc_library), + PetscErrorCode, + (CPF, Ptr{Cchar}), + pf, string, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscBag_wrappers.jl b/src/autowrapped/PetscBag_wrappers.jl new file mode 100644 index 00000000..59b40223 --- /dev/null +++ b/src/autowrapped/PetscBag_wrappers.jl @@ -0,0 +1,765 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscBag end +const PetscBag = Ptr{_n_PetscBag} + +# ------------------------------------------------------- +# autodefined type arguments for class ------ +# ------------------------------------------------------- +""" + PetscBagRegisterEnum(petsclib::PetscLibType,bag::PetscBag, addr::Cvoid, list::Cchar, mdefault::PetscEnum, name::String, help::String) +add an enum value to a `PetscBag` + +Logically Collective + +Input Parameters: +- `bag` - the bag of values +- `addr` - location of enum in struct, for example `¶ms->dt` +- `list` - array of strings containing names of enum values followed by enum name followed by enum prefix +- `mdefault` - the initial value, cast with (`PetscEnum`) +- `name` - the name of the item +- `help` - longer string with more information about the value + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()` + +# External Links +$(_doc_external("Sys/PetscBagRegisterEnum")) +""" +function PetscBagRegisterEnum(petsclib::PetscLibType, bag::PetscBag, addr::Cvoid, list::Cchar, mdefault::PetscEnum, name::String, help::String) end + +@for_petsc function PetscBagRegisterEnum(petsclib::$UnionPetscLib, bag::PetscBag, addr::Cvoid, list::Cchar, mdefault::PetscEnum, name::String, help::String ) + + @chk ccall( + (:PetscBagRegisterEnum, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cvoid}, Cchar, PetscEnum, Ptr{Cchar}, Ptr{Cchar}), + bag, addr, list, mdefault, name, help, + ) + + + return nothing +end + +""" + PetscBagRegisterIntArray(petsclib::PetscLibType,bag::PetscBag, addr::Cvoid, msize::PetscInt, name::String, help::String) +add a `PetscInt` array to a `PetscBag` + +Logically Collective + +Input Parameters: +- `bag` - the bag of values +- `addr` - location of integer in struct, for example `¶ms->i` +- `msize` - number of entries in array +- `name` - name of the array +- `help` - longer string with more information about the value + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagRegisterIntArray")) +""" +function PetscBagRegisterIntArray(petsclib::PetscLibType, bag::PetscBag, addr::Cvoid, msize::PetscInt, name::String, help::String) end + +@for_petsc function PetscBagRegisterIntArray(petsclib::$UnionPetscLib, bag::PetscBag, addr::Cvoid, msize::$PetscInt, name::String, help::String ) + + @chk ccall( + (:PetscBagRegisterIntArray, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cvoid}, $PetscInt, Ptr{Cchar}, Ptr{Cchar}), + bag, addr, msize, name, help, + ) + + + return nothing +end + +""" + PetscBagRegisterRealArray(petsclib::PetscLibType,bag::PetscBag, addr::Cvoid, msize::PetscInt, name::String, help::String) +add a `PetscReal` array to a `PetscBag` + +Logically Collective + +Input Parameters: +- `bag` - the bag of values +- `addr` - location of real array in struct, for example `¶ms->d` +- `msize` - number of entries in the array +- `name` - name of the array +- `help` - longer string with more information about the value + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagRegisterRealArray")) +""" +function PetscBagRegisterRealArray(petsclib::PetscLibType, bag::PetscBag, addr::Cvoid, msize::PetscInt, name::String, help::String) end + +@for_petsc function PetscBagRegisterRealArray(petsclib::$UnionPetscLib, bag::PetscBag, addr::Cvoid, msize::$PetscInt, name::String, help::String ) + + @chk ccall( + (:PetscBagRegisterRealArray, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cvoid}, $PetscInt, Ptr{Cchar}, Ptr{Cchar}), + bag, addr, msize, name, help, + ) + + + return nothing +end + +""" + PetscBagRegisterInt(petsclib::PetscLibType,bag::PetscBag, addr::Cvoid, mdefault::PetscInt, name::String, help::String) +add a `PetscInt` value to a `PetscBag` + +Logically Collective + +Input Parameters: +- `bag` - the bag of values +- `addr` - location of integer in struct, for example `¶ms->i` +- `mdefault` - the initial value +- `name` - name of the integer +- `help` - longer string with more information about the value + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterInt64()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagRegisterInt")) +""" +function PetscBagRegisterInt(petsclib::PetscLibType, bag::PetscBag, addr::Cvoid, mdefault::PetscInt, name::String, help::String) end + +@for_petsc function PetscBagRegisterInt(petsclib::$UnionPetscLib, bag::PetscBag, addr::Cvoid, mdefault::$PetscInt, name::String, help::String ) + + @chk ccall( + (:PetscBagRegisterInt, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cvoid}, $PetscInt, Ptr{Cchar}, Ptr{Cchar}), + bag, addr, mdefault, name, help, + ) + + + return nothing +end + +""" + PetscBagRegisterInt64(petsclib::PetscLibType,bag::PetscBag, addr::Cvoid, mdefault::PetscInt64, name::String, help::String) +add a `PetscInt64` value to a `PetscBag` + +Logically Collective + +Input Parameters: +- `bag` - the bag of values +- `addr` - location of integer in struct, for example `¶ms->i` +- `mdefault` - the initial value +- `name` - name of the integer +- `help` - longer string with more information about the value + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagRegisterInt64")) +""" +function PetscBagRegisterInt64(petsclib::PetscLibType, bag::PetscBag, addr::Cvoid, mdefault::PetscInt64, name::String, help::String) end + +@for_petsc function PetscBagRegisterInt64(petsclib::$UnionPetscLib, bag::PetscBag, addr::Cvoid, mdefault::$PetscInt64, name::String, help::String ) + + @chk ccall( + (:PetscBagRegisterInt64, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cvoid}, $PetscInt64, Ptr{Cchar}, Ptr{Cchar}), + bag, addr, mdefault, name, help, + ) + + + return nothing +end + +""" + PetscBagRegisterBoolArray(petsclib::PetscLibType,bag::PetscBag, addr::Cvoid, msize::PetscInt, name::String, help::String) +add a n `PetscBool` values to a `PetscBag` + +Logically Collective + +Input Parameters: +- `bag` - the bag of values +- `addr` - location of boolean array in struct, for example `¶ms->b` +- `msize` - number of entries in array +- `name` - name of the boolean array +- `help` - longer string with more information about the value + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagRegisterBoolArray")) +""" +function PetscBagRegisterBoolArray(petsclib::PetscLibType, bag::PetscBag, addr::Cvoid, msize::PetscInt, name::String, help::String) end + +@for_petsc function PetscBagRegisterBoolArray(petsclib::$UnionPetscLib, bag::PetscBag, addr::Cvoid, msize::$PetscInt, name::String, help::String ) + + @chk ccall( + (:PetscBagRegisterBoolArray, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cvoid}, $PetscInt, Ptr{Cchar}, Ptr{Cchar}), + bag, addr, msize, name, help, + ) + + + return nothing +end + +""" + PetscBagRegisterString(petsclib::PetscLibType,bag::PetscBag, addr::Cvoid, msize::PetscInt, mdefault::String, name::String, help::String) +add a string value to a `PetscBag` + +Logically Collective + +Input Parameters: +- `bag` - the bag of values +- `addr` - location of start of string in struct, for example `¶ms->mystring` +- `msize` - length of the string space in the struct +- `mdefault` - the initial value +- `name` - name of the string +- `help` - longer string with more information about the value + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagRegisterString")) +""" +function PetscBagRegisterString(petsclib::PetscLibType, bag::PetscBag, addr::Cvoid, msize::PetscInt, mdefault::String, name::String, help::String) end + +@for_petsc function PetscBagRegisterString(petsclib::$UnionPetscLib, bag::PetscBag, addr::Cvoid, msize::$PetscInt, mdefault::String, name::String, help::String ) + + @chk ccall( + (:PetscBagRegisterString, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cvoid}, $PetscInt, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}), + bag, addr, msize, mdefault, name, help, + ) + + + return nothing +end + +""" + PetscBagRegisterReal(petsclib::PetscLibType,bag::PetscBag, addr::Cvoid, mdefault::PetscReal, name::String, help::String) +add a `PetscReal` value to a `PetscBag` + +Logically Collective + +Input Parameters: +- `bag` - the bag of values +- `addr` - location of `PetscReal` in struct, for example `¶ms->r` +- `mdefault` - the initial value +- `name` - name of the variable +- `help` - longer string with more information about the value + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagRegisterReal")) +""" +function PetscBagRegisterReal(petsclib::PetscLibType, bag::PetscBag, addr::Cvoid, mdefault::PetscReal, name::String, help::String) end + +@for_petsc function PetscBagRegisterReal(petsclib::$UnionPetscLib, bag::PetscBag, addr::Cvoid, mdefault::$PetscReal, name::String, help::String ) + + @chk ccall( + (:PetscBagRegisterReal, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cvoid}, $PetscReal, Ptr{Cchar}, Ptr{Cchar}), + bag, addr, mdefault, name, help, + ) + + + return nothing +end + +""" + PetscBagRegisterScalar(petsclib::PetscLibType,bag::PetscBag, addr::Cvoid, mdefault::PetscScalar, name::String, help::String) +add a `PetscScalar` value to a `PetscBag` + +Logically Collective + +Input Parameters: +- `bag` - the bag of values +- `addr` - location of `PetscScalar` in struct, for example `¶ms->c` +- `mdefault` - the initial value +- `name` - name of the variable +- `help` - longer string with more information about the value + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagSetFromOptions()`, +`PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagRegisterScalar")) +""" +function PetscBagRegisterScalar(petsclib::PetscLibType, bag::PetscBag, addr::Cvoid, mdefault::PetscScalar, name::String, help::String) end + +@for_petsc function PetscBagRegisterScalar(petsclib::$UnionPetscLib, bag::PetscBag, addr::Cvoid, mdefault::$PetscScalar, name::String, help::String ) + + @chk ccall( + (:PetscBagRegisterScalar, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cvoid}, $PetscScalar, Ptr{Cchar}, Ptr{Cchar}), + bag, addr, mdefault, name, help, + ) + + + return nothing +end + +""" + PetscBagRegisterBool(petsclib::PetscLibType,bag::PetscBag, addr::Cvoid, mdefault::PetscBool, name::String, help::String) +add a `PetscBool` to a `PetscBag` + +Logically Collective + +Input Parameters: +- `bag` - the bag of values +- `addr` - location of `PetscBool` in struct, for example `¶ms->b` +- `mdefault` - the initial value, either `PETSC_FALSE` or `PETSC_TRUE` +- `name` - name of the variable +- `help` - longer string with more information about the value + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterInt()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagRegisterBool")) +""" +function PetscBagRegisterBool(petsclib::PetscLibType, bag::PetscBag, addr::Cvoid, mdefault::PetscBool, name::String, help::String) end + +@for_petsc function PetscBagRegisterBool(petsclib::$UnionPetscLib, bag::PetscBag, addr::Cvoid, mdefault::PetscBool, name::String, help::String ) + + @chk ccall( + (:PetscBagRegisterBool, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cvoid}, PetscBool, Ptr{Cchar}, Ptr{Cchar}), + bag, addr, mdefault, name, help, + ) + + + return nothing +end + +""" + PetscBagDestroy(petsclib::PetscLibType,bag::PetscBag) +Destroys a `PetscBag` + +Collective + +Input Parameter: +- `bag` - the bag of values + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagDestroy")) +""" +function PetscBagDestroy(petsclib::PetscLibType, bag::PetscBag) end + +@for_petsc function PetscBagDestroy(petsclib::$UnionPetscLib, bag::PetscBag ) + + @chk ccall( + (:PetscBagDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscBag},), + bag, + ) + + + return nothing +end + +""" + PetscBagSetFromOptions(petsclib::PetscLibType,bag::PetscBag) +Allows setting entries to a `PetscBag` using the options database + +Collective + +Input Parameter: +- `bag` - the bag of values + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagDestroy()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagCreate()`, `PetscBagGetName()`, `PetscBagView()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagSetFromOptions")) +""" +function PetscBagSetFromOptions(petsclib::PetscLibType, bag::PetscBag) end + +@for_petsc function PetscBagSetFromOptions(petsclib::$UnionPetscLib, bag::PetscBag ) + + @chk ccall( + (:PetscBagSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscBag,), + bag, + ) + + + return nothing +end + +""" + PetscBagView(petsclib::PetscLibType,bag::PetscBag, view::PetscViewer) +Views a bag of values as either ASCII text or a binary file + +Collective + +Input Parameters: +- `bag` - the bag of values +- `view` - location to view the values + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagDestroy()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()`, `PetscBagRegisterEnum()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()` + +# External Links +$(_doc_external("Sys/PetscBagView")) +""" +function PetscBagView(petsclib::PetscLibType, bag::PetscBag, view::PetscViewer) end + +@for_petsc function PetscBagView(petsclib::$UnionPetscLib, bag::PetscBag, view::PetscViewer ) + + @chk ccall( + (:PetscBagView, $petsc_library), + PetscErrorCode, + (PetscBag, PetscViewer), + bag, view, + ) + + + return nothing +end + +""" + PetscBagViewFromOptions(petsclib::PetscLibType,bag::PetscBag, bobj::PetscObject, optionname::String) +Processes command line options to determine if/how a `PetscBag` is to be viewed. + +Collective + +Input Parameters: +- `bag` - the object +- `bobj` - optional other object that provides prefix (if `NULL` then the prefix in obj is used) +- `optionname` - option to activate viewing + +Level: intermediate + +-seealso: `PetscBagCreate()`, `PetscBag`, `PetscViewer` + +# External Links +$(_doc_external("Sys/PetscBagViewFromOptions")) +""" +function PetscBagViewFromOptions(petsclib::PetscLibType, bag::PetscBag, bobj::PetscObject, optionname::String) end + +@for_petsc function PetscBagViewFromOptions(petsclib::$UnionPetscLib, bag::PetscBag, bobj::PetscObject, optionname::String ) + + @chk ccall( + (:PetscBagViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscBag, PetscObject, Ptr{Cchar}), + bag, bobj, optionname, + ) + + + return nothing +end + +""" + PetscBagLoad(petsclib::PetscLibType,view::PetscViewer, bag::PetscBag) +Loads a bag of values from a binary file + +Collective + +Input Parameters: +- `view` - file to load values from +- `bag` - the bag of values + +Level: beginner + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagDestroy()`, `PetscBagView()`, `PetscBagGetData()` +`PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagLoad")) +""" +function PetscBagLoad(petsclib::PetscLibType, view::PetscViewer, bag::PetscBag) end + +@for_petsc function PetscBagLoad(petsclib::$UnionPetscLib, view::PetscViewer, bag::PetscBag ) + + @chk ccall( + (:PetscBagLoad, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBag), + view, bag, + ) + + + return nothing +end + +""" + bag::PetscBag = PetscBagCreate(petsclib::PetscLibType,comm::MPI_Comm, bagsize::Csize_t) +Create a bag of values. A `PetscBag` is a representation of a C struct that can be saved to and read from files, +can have values set from the options database + +Collective + +Input Parameters: +- `comm` - communicator to share bag +- `bagsize` - size of the C structure holding the values, for example `sizeof(mystruct)` + +Output Parameter: +- `bag` - the bag of values + +Level: intermediate + +-seealso: `PetscBag`, `PetscBagGetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagDestroy()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagCreate")) +""" +function PetscBagCreate(petsclib::PetscLibType, comm::MPI_Comm, bagsize::Csize_t) end + +@for_petsc function PetscBagCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, bagsize::Csize_t ) + bag_ = Ref{PetscBag}() + + @chk ccall( + (:PetscBagCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Csize_t, Ptr{PetscBag}), + comm, bagsize, bag_, + ) + + bag = bag_[] + + return bag +end + +""" + PetscBagSetName(petsclib::PetscLibType,bag::PetscBag, name::String, help::String) +Sets the name of a bag of values + +Not Collective + +Level: intermediate + +Input Parameters: +- `bag` - the bag of values +- `name` - the name assigned to the bag +- `help` - help message for bag + +-seealso: `PetscBag`, `PetscBagGetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagDestroy()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagSetName")) +""" +function PetscBagSetName(petsclib::PetscLibType, bag::PetscBag, name::String, help::String) end + +@for_petsc function PetscBagSetName(petsclib::$UnionPetscLib, bag::PetscBag, name::String, help::String ) + + @chk ccall( + (:PetscBagSetName, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cchar}, Ptr{Cchar}), + bag, name, help, + ) + + + return nothing +end + +""" + PetscBagGetName(petsclib::PetscLibType,bag::PetscBag, name::Cchar) +Gets the name of a bag of values + +Not Collective + +Level: intermediate + +Input Parameter: +- `bag` - the bag of values + +Output Parameter: +- `name` - the name assigned to the bag + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagGetData()` +`PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagDestroy()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagGetName")) +""" +function PetscBagGetName(petsclib::PetscLibType, bag::PetscBag, name::Cchar) end + +@for_petsc function PetscBagGetName(petsclib::$UnionPetscLib, bag::PetscBag, name::Cchar ) + + @chk ccall( + (:PetscBagGetName, $petsc_library), + PetscErrorCode, + (PetscBag, Cchar), + bag, name, + ) + + + return nothing +end + +""" + PetscBagGetData(petsclib::PetscLibType,bag::PetscBag, data::PeCtx) +Gives back the user +can be used for storing user-data-structure + +Not Collective + +Input Parameter: +- `bag` - the bag of values + +Output Parameter: +- `data` - pointer to memory that will have user-data-structure, this can be cast to a pointer of the type the C struct used in +defining the bag + +Level: intermediate + +-seealso: `PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()` +`PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagDestroy()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagGetData")) +""" +function PetscBagGetData(petsclib::PetscLibType, bag::PetscBag, data::PeCtx) end + +@for_petsc function PetscBagGetData(petsclib::$UnionPetscLib, bag::PetscBag, data::PeCtx ) + + @chk ccall( + (:PetscBagGetData, $petsc_library), + PetscErrorCode, + (PetscBag, PeCtx), + bag, data, + ) + + + return nothing +end + +""" + PetscBagSetOptionsPrefix(petsclib::PetscLibType,bag::PetscBag, pre::String) +Sets the prefix used for searching for all +`PetscBag` items in the options database. + +Logically Collective + +Level: intermediate + +Input Parameters: +- `bag` - the bag of values +- `pre` - the prefix to prepend all Bag item names with. + +-seealso: `PetscBag`, `PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()` +`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagDestroy()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagSetOptionsPrefix")) +""" +function PetscBagSetOptionsPrefix(petsclib::PetscLibType, bag::PetscBag, pre::String) end + +@for_petsc function PetscBagSetOptionsPrefix(petsclib::$UnionPetscLib, bag::PetscBag, pre::String ) + + @chk ccall( + (:PetscBagSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Cchar}), + bag, pre, + ) + + + return nothing +end + +""" + PetscBagGetNames(petsclib::PetscLibType,bag::PetscBag, names::String) +Get the names of all entries in the bag + +Not Collective + +Input Parameter: +- `bag` - the bag of values + +Output Parameter: +- `names` - pass in an array of char pointers to hold the names. The array must be as long as the number of items in the bag. + +Level: intermediate + +-seealso: `PetscBag`, `PetscBagGetName()`, `PetscBagSetName()`, `PetscBagCreate()`, `PetscBagGetData()` +`PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()`, `PetscBagRegisterEnum()` + +# External Links +$(_doc_external("Sys/PetscBagGetNames")) +""" +function PetscBagGetNames(petsclib::PetscLibType, bag::PetscBag, names::String) end + +@for_petsc function PetscBagGetNames(petsclib::$UnionPetscLib, bag::PetscBag, names::String ) + names_ = Ref(pointer(names)) + + @chk ccall( + (:PetscBagGetNames, $petsc_library), + PetscErrorCode, + (PetscBag, Ptr{Ptr{Cchar}}), + bag, names_, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscBench_wrappers.jl b/src/autowrapped/PetscBench_wrappers.jl new file mode 100644 index 00000000..a51f9c9e --- /dev/null +++ b/src/autowrapped/PetscBench_wrappers.jl @@ -0,0 +1,500 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscBench end +const PetscBench = Ptr{_n_PetscBench} + +# ------------------------------------------------------- +""" + PetscBenchInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PetscBench` package. + +Level: developer + +-seealso: `PetscInitialize()`, `PetscBenchCreate()`, `PetscBench`, `PetscBenchType` + +# External Links +$(_doc_external("Sys/PetscBenchInitializePackage")) +""" +function PetscBenchInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscBenchInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscBenchInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscBenchRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a benchmark test, `PetscBenchType`, to the `PetscBench` package + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new benchmark +- `function` - routine to create benchmark + +Level: advanced + +-seealso: `PetscBenchInitializePackage()`, `PetscBenchCreate()`, `PetscBench`, `PetscBenchType`, `PetscBenchSetType()`, `PetscBenchGetType()` + +# External Links +$(_doc_external("Sys/PetscBenchRegister")) +""" +function PetscBenchRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscBenchRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscBenchRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscBenchReset(petsclib::PetscLibType,bm::PetscBench) +removes all the intermediate data structures in a `PetscBench` + +Collective + +Input Parameter: +- `bm` - the `PetscBench` + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchView()`, `PetscBenchSetFromOptions()`, `PetscBenchCreate()`, `PetscBenchDestroy()`, `PetscBenchSetUp()`, `PetscBenchSetType()` + +# External Links +$(_doc_external("Sys/PetscBenchReset")) +""" +function PetscBenchReset(petsclib::PetscLibType, bm::PetscBench) end + +@for_petsc function PetscBenchReset(petsclib::$UnionPetscLib, bm::PetscBench ) + + @chk ccall( + (:PetscBenchReset, $petsc_library), + PetscErrorCode, + (PetscBench,), + bm, + ) + + + return nothing +end + +""" + PetscBenchDestroy(petsclib::PetscLibType,bm::PetscBench) +Destroys a `PetscBench` + +Collective + +Input Parameter: +- `bm` - the `PetscBench` + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchView()`, `PetscBenchSetFromOptions()`, `PetscBenchCreate()` + +# External Links +$(_doc_external("Sys/PetscBenchDestroy")) +""" +function PetscBenchDestroy(petsclib::PetscLibType, bm::PetscBench) end + +@for_petsc function PetscBenchDestroy(petsclib::$UnionPetscLib, bm::PetscBench ) + + @chk ccall( + (:PetscBenchDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscBench},), + bm, + ) + + + return nothing +end + +""" + PetscBenchSetUp(petsclib::PetscLibType,bm::PetscBench) +sets up the `PetscBench` + +Collective + +Input Parameter: +- `bm` - the `PetscBench` + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchView()`, `PetscBenchSetFromOptions()`, `PetscBenchCreate()`, `PetscBenchDestroy()`, `PetscBenchSetType()`, +`PetscBenchRun()`, `PetscBenchSetSize()`, `PetscBenchGetSize()` + +# External Links +$(_doc_external("Sys/PetscBenchSetUp")) +""" +function PetscBenchSetUp(petsclib::PetscLibType, bm::PetscBench) end + +@for_petsc function PetscBenchSetUp(petsclib::$UnionPetscLib, bm::PetscBench ) + + @chk ccall( + (:PetscBenchSetUp, $petsc_library), + PetscErrorCode, + (PetscBench,), + bm, + ) + + + return nothing +end + +""" + PetscBenchRun(petsclib::PetscLibType,bm::PetscBench) +runs the `PetscBench` + +Collective + +Input Parameter: +- `bm` - the `PetscBench` + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchView()`, `PetscBenchSetFromOptions()`, `PetscBenchCreate()`, `PetscBenchDestroy()`, `PetscBenchSetUp()`, `PetscBenchSetType()`, +`PetscBenchSetSize()`, `PetscBenchGetSize()` + +# External Links +$(_doc_external("Sys/PetscBenchRun")) +""" +function PetscBenchRun(petsclib::PetscLibType, bm::PetscBench) end + +@for_petsc function PetscBenchRun(petsclib::$UnionPetscLib, bm::PetscBench ) + + @chk ccall( + (:PetscBenchRun, $petsc_library), + PetscErrorCode, + (PetscBench,), + bm, + ) + + + return nothing +end + +""" + PetscBenchSetFromOptions(petsclib::PetscLibType,bm::PetscBench) +Sets options to a `PetscBench` using the options database + +Collective + +Input Parameter: +- `bm` - the `PetscBench` + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchView()`, `PetscBenchRun()`, `PetscBenchCreate()`, `PetscBenchDestroy()`, `PetscBenchSetUp()`, `PetscBenchSetType()`, +`PetscBenchSetSize()`, `PetscBenchGetSize()` + +# External Links +$(_doc_external("Sys/PetscBenchSetFromOptions")) +""" +function PetscBenchSetFromOptions(petsclib::PetscLibType, bm::PetscBench) end + +@for_petsc function PetscBenchSetFromOptions(petsclib::$UnionPetscLib, bm::PetscBench ) + + @chk ccall( + (:PetscBenchSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscBench,), + bm, + ) + + + return nothing +end + +""" + PetscBenchView(petsclib::PetscLibType,bm::PetscBench, viewer::PetscViewer) +Views a PETSc benchmark `PetscBench` + +Collective + +Input Parameters: +- `bm` - the `PetscBench` +- `viewer` - location to view `bm` + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchSetFromOptions()`, `PetscBenchRun()`, `PetscBenchCreate()`, `PetscBenchDestroy()`, `PetscBenchSetUp()`, `PetscBenchSetType()`, +`PetscBenchSetSize()`, `PetscBenchGetSize()`, `PetscBenchViewFromOptions()` + +# External Links +$(_doc_external("Sys/PetscBenchView")) +""" +function PetscBenchView(petsclib::PetscLibType, bm::PetscBench, viewer::PetscViewer) end + +@for_petsc function PetscBenchView(petsclib::$UnionPetscLib, bm::PetscBench, viewer::PetscViewer ) + + @chk ccall( + (:PetscBenchView, $petsc_library), + PetscErrorCode, + (PetscBench, PetscViewer), + bm, viewer, + ) + + + return nothing +end + +""" + PetscBenchViewFromOptions(petsclib::PetscLibType,bm::PetscBench, bobj::PetscObject, optionname::String) +Processes command line options to determine if/how a `PetscBench` is to be viewed. + +Collective + +Input Parameters: +- `bm` - the object +- `bobj` - optional other object that provides prefix (if `NULL` then the prefix in `bm` is used) +- `optionname` - option to activate viewing + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchSetFromOptions()`, `PetscBenchRun()`, `PetscBenchCreate()`, `PetscBenchDestroy()`, `PetscBenchSetUp()`, `PetscBenchSetType()`, +`PetscBenchSetSize()`, `PetscBenchGetSize()` + +# External Links +$(_doc_external("Sys/PetscBenchViewFromOptions")) +""" +function PetscBenchViewFromOptions(petsclib::PetscLibType, bm::PetscBench, bobj::PetscObject, optionname::String) end + +@for_petsc function PetscBenchViewFromOptions(petsclib::$UnionPetscLib, bm::PetscBench, bobj::PetscObject, optionname::String ) + + @chk ccall( + (:PetscBenchViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscBench, PetscObject, Ptr{Cchar}), + bm, bobj, optionname, + ) + + + return nothing +end + +""" + bm::PetscBench = PetscBenchCreate(petsclib::PetscLibType,comm::MPI_Comm) +Create a PETSc benchmark `PetscBench` object + +Collective + +Input Parameter: +- `comm` - communicator to share the `PetscBench` + +Output Parameter: +- `bm` - the `PetscBench` + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchSetFromOptions()`, `PetscBenchRun()`, `PetscBenchViewFromOptions()`, `PetscBenchDestroy()`, `PetscBenchSetUp()`, `PetscBenchSetType()`, +`PetscBenchSetSize()`, `PetscBenchGetSize()` + +# External Links +$(_doc_external("Sys/PetscBenchCreate")) +""" +function PetscBenchCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscBenchCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + bm_ = Ref{PetscBench}() + + @chk ccall( + (:PetscBenchCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscBench}), + comm, bm_, + ) + + bm = bm_[] + + return bm +end + +""" + PetscBenchSetOptionsPrefix(petsclib::PetscLibType,bm::PetscBench, pre::String) +Sets the prefix used for searching for all `PetscBench` items in the options database. + +Logically Collective + +Input Parameters: +- `bm` - the `PetscBench` +- `pre` - the prefix to prepend all `PetscBench` option names + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchSetFromOptions()`, `PetscBenchRun()`, `PetscBenchViewFromOptions()`, `PetscBenchDestroy()`, `PetscBenchSetUp()`, `PetscBenchSetType()`, +`PetscBenchSetSize()`, `PetscBenchGetSize()` + +# External Links +$(_doc_external("Sys/PetscBenchSetOptionsPrefix")) +""" +function PetscBenchSetOptionsPrefix(petsclib::PetscLibType, bm::PetscBench, pre::String) end + +@for_petsc function PetscBenchSetOptionsPrefix(petsclib::$UnionPetscLib, bm::PetscBench, pre::String ) + + @chk ccall( + (:PetscBenchSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscBench, Ptr{Cchar}), + bm, pre, + ) + + + return nothing +end + +""" + PetscBenchSetSize(petsclib::PetscLibType,bm::PetscBench, n::PetscInt) +Sets the size of the `PetscBench` benchmark to run + +Logically Collective + +Input Parameters: +- `bm` - the `PetscBench` +- `n` - the size + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchSetFromOptions()`, `PetscBenchRun()`, `PetscBenchViewFromOptions()`, `PetscBenchDestroy()`, `PetscBenchSetUp()`, `PetscBenchSetType()`, +`PetscBenchSetOptionsPrefix()`, `PetscBenchGetSize()` + +# External Links +$(_doc_external("Sys/PetscBenchSetSize")) +""" +function PetscBenchSetSize(petsclib::PetscLibType, bm::PetscBench, n::PetscInt) end + +@for_petsc function PetscBenchSetSize(petsclib::$UnionPetscLib, bm::PetscBench, n::$PetscInt ) + + @chk ccall( + (:PetscBenchSetSize, $petsc_library), + PetscErrorCode, + (PetscBench, $PetscInt), + bm, n, + ) + + + return nothing +end + +""" + n::PetscInt = PetscBenchGetSize(petsclib::PetscLibType,bm::PetscBench) +Gets the size of the `PetscBench` benchmark to run + +Logically Collective + +Input Parameter: +- `bm` - the `PetscBench` + +Output Parameter: +- `n` - the size + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchSetFromOptions()`, `PetscBenchRun()`, `PetscBenchViewFromOptions()`, `PetscBenchDestroy()`, `PetscBenchSetUp()`, `PetscBenchSetType()`, +`PetscBenchSetOptionsPrefix()`, `PetscBenchSetSize()` + +# External Links +$(_doc_external("Sys/PetscBenchGetSize")) +""" +function PetscBenchGetSize(petsclib::PetscLibType, bm::PetscBench) end + +@for_petsc function PetscBenchGetSize(petsclib::$UnionPetscLib, bm::PetscBench ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscBenchGetSize, $petsc_library), + PetscErrorCode, + (PetscBench, Ptr{$PetscInt}), + bm, n_, + ) + + n = n_[] + + return n +end + +""" + PetscBenchSetType(petsclib::PetscLibType,bm::PetscBench, type::PetscBenchType) +set the type of `PetscBench` benchmark to run + +Collective + +Input Parameters: +- `bm` - the `PetscBench` +- `type` - a known method + +Options Database Key: +- `-bm_type ` - Sets `PetscBench` type + +Level: advanced + +-seealso: `PetscBench`, `PetscBenchSetFromOptions()`, `PetscBenchRun()`, `PetscBenchViewFromOptions()`, `PetscBenchDestroy()`, `PetscBenchSetUp()`, `PetscBenchGetSize()`, +`PetscBenchSetOptionsPrefix()`, `PetscBenchSetSize()`, `PetscBenchGetType()`, `PetscBenchCreate()` + +# External Links +$(_doc_external("Sys/PetscBenchSetType")) +""" +function PetscBenchSetType(petsclib::PetscLibType, bm::PetscBench, type::PetscBenchType) end + +@for_petsc function PetscBenchSetType(petsclib::$UnionPetscLib, bm::PetscBench, type::PetscBenchType ) + + @chk ccall( + (:PetscBenchSetType, $petsc_library), + PetscErrorCode, + (PetscBench, PetscBenchType), + bm, type, + ) + + + return nothing +end + +""" + type::PetscBenchType = PetscBenchGetType(petsclib::PetscLibType,bm::PetscBench) +Gets the `PetscBenchType` (as a string) from the `PetscBench` +context. + +Not Collective + +Input Parameter: +- `bm` - the `PetscBench` + +Output Parameter: +- `type` - name of benchmark method + +Level: intermediate + +-seealso: `PetscBench`, `PetscBenchType`, `PetscBenchSetType()`, `PetscBenchCreate()` + +# External Links +$(_doc_external("Sys/PetscBenchGetType")) +""" +function PetscBenchGetType(petsclib::PetscLibType, bm::PetscBench) end + +@for_petsc function PetscBenchGetType(petsclib::$UnionPetscLib, bm::PetscBench ) + type_ = Ref{PetscBenchType}() + + @chk ccall( + (:PetscBenchGetType, $petsc_library), + PetscErrorCode, + (PetscBench, Ptr{PetscBenchType}), + bm, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + diff --git a/src/autowrapped/PetscContainer_wrappers.jl b/src/autowrapped/PetscContainer_wrappers.jl new file mode 100644 index 00000000..dc721dab --- /dev/null +++ b/src/autowrapped/PetscContainer_wrappers.jl @@ -0,0 +1,174 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscContainer end +const PetscContainer = Ptr{_n_PetscContainer} + +# ------------------------------------------------------- +""" + PetscContainerGetPointer(petsclib::PetscLibType,obj::PetscContainer, ptr::PeCtx) +Gets the pointer value contained in the container that was provided with `PetscContainerSetPointer()` + +Not Collective, No Fortran Support + +Input Parameter: +- `obj` - the object created with `PetscContainerCreate()` + +Output Parameter: +- `ptr` - the pointer value + +Level: advanced + +-seealso: `PetscContainerCreate()`, `PetscContainerDestroy()`, `PetscObject`, +`PetscContainerSetPointer()`, `PetscObjectContainerCompose()`, `PetscObjectContainerQuery()` + +# External Links +$(_doc_external("Sys/PetscContainerGetPointer")) +""" +function PetscContainerGetPointer(petsclib::PetscLibType, obj::PetscContainer, ptr::PeCtx) end + +@for_petsc function PetscContainerGetPointer(petsclib::$UnionPetscLib, obj::PetscContainer, ptr::PeCtx ) + + @chk ccall( + (:PetscContainerGetPointer, $petsc_library), + PetscErrorCode, + (PetscContainer, PeCtx), + obj, ptr, + ) + + + return nothing +end + +""" + PetscContainerSetPointer(petsclib::PetscLibType,obj::PetscContainer, ptr::Cvoid) +Sets the pointer value contained in the container. + +Logically Collective, No Fortran Support + +Input Parameters: +- `obj` - the object created with `PetscContainerCreate()` +- `ptr` - the pointer value + +Level: advanced + +-seealso: `PetscContainerCreate()`, `PetscContainerDestroy()`, `PetscObjectCompose()`, `PetscObjectQuery()`, `PetscObject`, +`PetscContainerGetPointer()`, `PetscObjectContainerCompose()`, `PetscObjectContainerQuery()` + +# External Links +$(_doc_external("Sys/PetscContainerSetPointer")) +""" +function PetscContainerSetPointer(petsclib::PetscLibType, obj::PetscContainer, ptr::Cvoid) end + +@for_petsc function PetscContainerSetPointer(petsclib::$UnionPetscLib, obj::PetscContainer, ptr::Cvoid ) + + @chk ccall( + (:PetscContainerSetPointer, $petsc_library), + PetscErrorCode, + (PetscContainer, Ptr{Cvoid}), + obj, ptr, + ) + + + return nothing +end + +""" + PetscContainerDestroy(petsclib::PetscLibType,obj::PetscContainer) +Destroys a PETSc container object. + +Collective, No Fortran Support + +Input Parameter: +- `obj` - an object that was created with `PetscContainerCreate()` + +Level: advanced + +-seealso: `PetscContainerCreate()`, `PetscContainerSetCtxDestroy()`, `PetscObject`, `PetscObjectContainerCompose()`, `PetscObjectContainerQuery()` + +# External Links +$(_doc_external("Sys/PetscContainerDestroy")) +""" +function PetscContainerDestroy(petsclib::PetscLibType, obj::PetscContainer) end + +@for_petsc function PetscContainerDestroy(petsclib::$UnionPetscLib, obj::PetscContainer ) + + @chk ccall( + (:PetscContainerDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscContainer},), + obj, + ) + + + return nothing +end + +""" + PetscContainerSetCtxDestroy(petsclib::PetscLibType,obj::PetscContainer, des::PetscCtxDestroyFn) +Sets the destroy function for the data provided to the `PetscContainer` with `PetscContainerSetPointer()` + +Logically Collective, No Fortran Support + +Input Parameters: +- `obj` - an object that was created with `PetscContainerCreate()` +- `des` - name of the ctx destroy function, see `PetscCtxDestroyFn` for its calling sequence + +Level: advanced + +-seealso: `PetscContainerDestroy()`, `PetscContainerUserDestroyDefault()`, `PetscMalloc()`, `PetscMalloc1()`, `PetscCalloc()`, `PetscCalloc1()`, `PetscObject`, +`PetscObjectContainerCompose()`, `PetscObjectContainerQuery()` + +# External Links +$(_doc_external("Sys/PetscContainerSetCtxDestroy")) +""" +function PetscContainerSetCtxDestroy(petsclib::PetscLibType, obj::PetscContainer, des::PetscCtxDestroyFn) end + +@for_petsc function PetscContainerSetCtxDestroy(petsclib::$UnionPetscLib, obj::PetscContainer, des::PetscCtxDestroyFn ) + + @chk ccall( + (:PetscContainerSetCtxDestroy, $petsc_library), + PetscErrorCode, + (PetscContainer, Ptr{PetscCtxDestroyFn}), + obj, des, + ) + + + return nothing +end + +""" + container::PetscContainer = PetscContainerCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a PETSc object that has room to hold a single pointer. + +Collective, No Fortran Support + +Input Parameter: +- `comm` - MPI communicator that shares the object + +Output Parameter: +- `container` - the container created + +Level: advanced + +-seealso: `PetscContainerDestroy()`, `PetscContainerSetPointer()`, `PetscContainerGetPointer()`, `PetscObjectCompose()`, `PetscObjectQuery()`, +`PetscContainerSetCtxDestroy()`, `PetscObject`, `PetscObjectContainerCompose()`, `PetscObjectContainerQuery()` + +# External Links +$(_doc_external("Sys/PetscContainerCreate")) +""" +function PetscContainerCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscContainerCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + container_ = Ref{PetscContainer}() + + @chk ccall( + (:PetscContainerCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscContainer}), + comm, container_, + ) + + container = container_[] + + return container +end + diff --git a/src/autowrapped/PetscConvEst_wrappers.jl b/src/autowrapped/PetscConvEst_wrappers.jl new file mode 100644 index 00000000..88d32273 --- /dev/null +++ b/src/autowrapped/PetscConvEst_wrappers.jl @@ -0,0 +1,405 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscConvEst end +const PetscConvEst = Ptr{_n_PetscConvEst} + +# ------------------------------------------------------- +""" + PetscConvEstDestroy(petsclib::PetscLibType,ce::PetscConvEst) +Destroys a PETSc convergence estimator `PetscConvEst` object + +Collective + +Input Parameter: +- `ce` - The `PetscConvEst` object + +Level: beginner + +-seealso: `PetscConvEst`, `PetscConvEstCreate()`, `PetscConvEstGetConvRate()` + +# External Links +$(_doc_external("Snes/PetscConvEstDestroy")) +""" +function PetscConvEstDestroy(petsclib::PetscLibType, ce::PetscConvEst) end + +@for_petsc function PetscConvEstDestroy(petsclib::$UnionPetscLib, ce::PetscConvEst ) + + @chk ccall( + (:PetscConvEstDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscConvEst},), + ce, + ) + + + return nothing +end + +""" + PetscConvEstSetFromOptions(petsclib::PetscLibType,ce::PetscConvEst) +Sets a convergence estimator `PetscConvEst` object based on values in the options database + +Collective + +Input Parameter: +- `ce` - The `PetscConvEst` object + +Level: beginner + +-seealso: `PetscConvEst`, `PetscConvEstCreate()`, `PetscConvEstGetConvRate()` + +# External Links +$(_doc_external("Snes/PetscConvEstSetFromOptions")) +""" +function PetscConvEstSetFromOptions(petsclib::PetscLibType, ce::PetscConvEst) end + +@for_petsc function PetscConvEstSetFromOptions(petsclib::$UnionPetscLib, ce::PetscConvEst ) + + @chk ccall( + (:PetscConvEstSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscConvEst,), + ce, + ) + + + return nothing +end + +""" + PetscConvEstView(petsclib::PetscLibType,ce::PetscConvEst, viewer::PetscViewer) +Views a `PetscConvEst` object + +Collective + +Input Parameters: +- `ce` - The `PetscConvEst` object +- `viewer` - The `PetscViewer` + +Level: beginner + +-seealso: `PetscConvEst`, `PetscViewer`, `PetscConvEstCreate()`, `PetscConvEstGetConvRate()` + +# External Links +$(_doc_external("Snes/PetscConvEstView")) +""" +function PetscConvEstView(petsclib::PetscLibType, ce::PetscConvEst, viewer::PetscViewer) end + +@for_petsc function PetscConvEstView(petsclib::$UnionPetscLib, ce::PetscConvEst, viewer::PetscViewer ) + + @chk ccall( + (:PetscConvEstView, $petsc_library), + PetscErrorCode, + (PetscConvEst, PetscViewer), + ce, viewer, + ) + + + return nothing +end + +""" + PetscConvEstGetSolver(petsclib::PetscLibType,ce::PetscConvEst, solver::PetscObject) +Gets the solver used to produce discrete solutions + +Not Collective + +Input Parameter: +- `ce` - The `PetscConvEst` object + +Output Parameter: +- `solver` - The solver + +Level: intermediate + +-seealso: `PetscConvEst`, `PetscConvEstSetSolver()`, `PetscConvEstCreate()`, `PetscConvEstGetConvRate()` + +# External Links +$(_doc_external("Snes/PetscConvEstGetSolver")) +""" +function PetscConvEstGetSolver(petsclib::PetscLibType, ce::PetscConvEst, solver::PetscObject) end + +@for_petsc function PetscConvEstGetSolver(petsclib::$UnionPetscLib, ce::PetscConvEst, solver::PetscObject ) + + @chk ccall( + (:PetscConvEstGetSolver, $petsc_library), + PetscErrorCode, + (PetscConvEst, Ptr{PetscObject}), + ce, solver, + ) + + + return nothing +end + +""" + PetscConvEstSetSolver(petsclib::PetscLibType,ce::PetscConvEst, solver::PetscObject) +Sets the solver used to produce discrete solutions + +Not Collective + +Input Parameters: +- `ce` - The `PetscConvEst` object +- `solver` - The solver, must be a `KSP`, `SNES`, or `TS` object with an attached `DM`/`DS`, that can compute an exact solution + +Level: intermediate + +-seealso: `PetscConvEst`, `PetscConvEstGetSNES()`, `PetscConvEstCreate()`, `PetscConvEstGetConvRate()` + +# External Links +$(_doc_external("Snes/PetscConvEstSetSolver")) +""" +function PetscConvEstSetSolver(petsclib::PetscLibType, ce::PetscConvEst, solver::PetscObject) end + +@for_petsc function PetscConvEstSetSolver(petsclib::$UnionPetscLib, ce::PetscConvEst, solver::PetscObject ) + + @chk ccall( + (:PetscConvEstSetSolver, $petsc_library), + PetscErrorCode, + (PetscConvEst, PetscObject), + ce, solver, + ) + + + return nothing +end + +""" + PetscConvEstSetUp(petsclib::PetscLibType,ce::PetscConvEst) +After the solver is specified, create data structures needed for estimating convergence + +Collective + +Input Parameter: +- `ce` - The `PetscConvEst` object + +Level: beginner + +-seealso: `PetscConvEst`, `PetscConvEstCreate()`, `PetscConvEstGetConvRate()` + +# External Links +$(_doc_external("Snes/PetscConvEstSetUp")) +""" +function PetscConvEstSetUp(petsclib::PetscLibType, ce::PetscConvEst) end + +@for_petsc function PetscConvEstSetUp(petsclib::$UnionPetscLib, ce::PetscConvEst ) + + @chk ccall( + (:PetscConvEstSetUp, $petsc_library), + PetscErrorCode, + (PetscConvEst,), + ce, + ) + + + return nothing +end + +""" + PetscConvEstComputeInitialGuess(petsclib::PetscLibType,ce::PetscConvEst, r::PetscInt, dm::PetscDM, u::PetscVec) + +# External Links +$(_doc_external("Snes/PetscConvEstComputeInitialGuess")) +""" +function PetscConvEstComputeInitialGuess(petsclib::PetscLibType, ce::PetscConvEst, r::PetscInt, dm::PetscDM, u::PetscVec) end + +@for_petsc function PetscConvEstComputeInitialGuess(petsclib::$UnionPetscLib, ce::PetscConvEst, r::$PetscInt, dm::PetscDM, u::PetscVec ) + + @chk ccall( + (:PetscConvEstComputeInitialGuess, $petsc_library), + PetscErrorCode, + (PetscConvEst, $PetscInt, CDM, CVec), + ce, r, dm, u, + ) + + + return nothing +end + +""" + PetscConvEstComputeError(petsclib::PetscLibType,ce::PetscConvEst, r::PetscInt, dm::PetscDM, u::PetscVec, errors::Vector{PetscReal}) + +# External Links +$(_doc_external("Snes/PetscConvEstComputeError")) +""" +function PetscConvEstComputeError(petsclib::PetscLibType, ce::PetscConvEst, r::PetscInt, dm::PetscDM, u::PetscVec, errors::Vector{PetscReal}) end + +@for_petsc function PetscConvEstComputeError(petsclib::$UnionPetscLib, ce::PetscConvEst, r::$PetscInt, dm::PetscDM, u::PetscVec, errors::Vector{$PetscReal} ) + + @chk ccall( + (:PetscConvEstComputeError, $petsc_library), + PetscErrorCode, + (PetscConvEst, $PetscInt, CDM, CVec, Ptr{$PetscReal}), + ce, r, dm, u, errors, + ) + + + return nothing +end + +""" + PetscConvEstMonitorDefault(petsclib::PetscLibType,ce::PetscConvEst, r::PetscInt) +Monitors the convergence estimation loop + +Collective + +Input Parameters: +- `ce` - The `PetscConvEst` object +- `r` - The refinement level + +Options Database Key: +- `-convest_monitor` - Activate the monitor + +Level: intermediate + +-seealso: `PetscConvEst`, `PetscConvEstCreate()`, `PetscConvEstGetConvRate()`, `SNESSolve()`, `TSSolve()` + +# External Links +$(_doc_external("Snes/PetscConvEstMonitorDefault")) +""" +function PetscConvEstMonitorDefault(petsclib::PetscLibType, ce::PetscConvEst, r::PetscInt) end + +@for_petsc function PetscConvEstMonitorDefault(petsclib::$UnionPetscLib, ce::PetscConvEst, r::$PetscInt ) + + @chk ccall( + (:PetscConvEstMonitorDefault, $petsc_library), + PetscErrorCode, + (PetscConvEst, $PetscInt), + ce, r, + ) + + + return nothing +end + +""" + alpha::Vector{PetscReal} = PetscConvEstGetConvRate(petsclib::PetscLibType,ce::PetscConvEst) +Returns an estimate of the convergence rate for the discretization + +Not Collective + +Input Parameter: +- `ce` - The `PetscConvEst` object + +Output Parameter: +- `alpha` - The convergence rate for each field + +Options Database Keys: +- `-snes_convergence_estimate` - Execute convergence estimation inside `SNESSolve()` and print out the rate +- `-ts_convergence_estimate` - Execute convergence estimation inside `TSSolve()` and print out the rate + +Level: intermediate + +-seealso: `PetscConvEstSetSolver()`, `PetscConvEstCreate()`, `SNESSolve()`, `TSSolve()` + +# External Links +$(_doc_external("Snes/PetscConvEstGetConvRate")) +""" +function PetscConvEstGetConvRate(petsclib::PetscLibType, ce::PetscConvEst) end + +@for_petsc function PetscConvEstGetConvRate(petsclib::$UnionPetscLib, ce::PetscConvEst ) + alpha = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscConvEstGetConvRate, $petsc_library), + PetscErrorCode, + (PetscConvEst, Ptr{$PetscReal}), + ce, alpha, + ) + + + return alpha +end + +""" + PetscConvEstRateView(petsclib::PetscLibType,ce::PetscConvEst, alpha::Vector{PetscReal}, viewer::PetscViewer) +Displays the convergence rate obtained from `PetscConvEstGetConvRate()` using a `PetscViewer` + +Collective + +Input Parameters: +- `ce` - iterative context obtained from `SNESCreate()` +- `alpha` - the convergence rate for each field +- `viewer` - the viewer to display the reason + +Options Database Key: +- `-snes_convergence_estimate` - print the convergence rate + +Level: developer + +-seealso: `PetscConvEst`, `PetscConvEstGetConvRate()` + +# External Links +$(_doc_external("Snes/PetscConvEstRateView")) +""" +function PetscConvEstRateView(petsclib::PetscLibType, ce::PetscConvEst, alpha::Vector{PetscReal}, viewer::PetscViewer) end + +@for_petsc function PetscConvEstRateView(petsclib::$UnionPetscLib, ce::PetscConvEst, alpha::Vector{$PetscReal}, viewer::PetscViewer ) + + @chk ccall( + (:PetscConvEstRateView, $petsc_library), + PetscErrorCode, + (PetscConvEst, Ptr{$PetscReal}, PetscViewer), + ce, alpha, viewer, + ) + + + return nothing +end + +""" + ce::PetscConvEst = PetscConvEstCreate(petsclib::PetscLibType,comm::MPI_Comm) +Create a `PetscConvEst` object. This is used to study the convergence rate of approximations on grids to a continuum solution + +Collective + +Input Parameter: +- `comm` - The communicator for the `PetscConvEst` object + +Output Parameter: +- `ce` - The `PetscConvEst` object + +Level: beginner + +-seealso: `PetscConvEst`, `PetscConvEstDestroy()`, `PetscConvEstGetConvRate()`, `DMAdaptorCreate()`, `DMAdaptor` + +# External Links +$(_doc_external("Snes/PetscConvEstCreate")) +""" +function PetscConvEstCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscConvEstCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + ce_ = Ref{PetscConvEst}() + + @chk ccall( + (:PetscConvEstCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscConvEst}), + comm, ce_, + ) + + ce = ce_[] + + return ce +end + +""" + PetscConvEstUseTS(petsclib::PetscLibType,ce::PetscConvEst, checkTemporal::PetscBool) + +# External Links +$(_doc_external("Ts/PetscConvEstUseTS")) +""" +function PetscConvEstUseTS(petsclib::PetscLibType, ce::PetscConvEst, checkTemporal::PetscBool) end + +@for_petsc function PetscConvEstUseTS(petsclib::$UnionPetscLib, ce::PetscConvEst, checkTemporal::PetscBool ) + + @chk ccall( + (:PetscConvEstUseTS, $petsc_library), + PetscErrorCode, + (PetscConvEst, PetscBool), + ce, checkTemporal, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscDLLibrary_wrappers.jl b/src/autowrapped/PetscDLLibrary_wrappers.jl new file mode 100644 index 00000000..f2d19055 --- /dev/null +++ b/src/autowrapped/PetscDLLibrary_wrappers.jl @@ -0,0 +1,240 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscDLLibrary end +const PetscDLLibrary = Ptr{_n_PetscDLLibrary} + +# ------------------------------------------------------- +""" + PetscDLLibraryPrintPath(petsclib::PetscLibType,libs::PetscDLLibrary) + +# External Links +$(_doc_external("Sys/PetscDLLibraryPrintPath")) +""" +function PetscDLLibraryPrintPath(petsclib::PetscLibType, libs::PetscDLLibrary) end + +@for_petsc function PetscDLLibraryPrintPath(petsclib::$UnionPetscLib, libs::PetscDLLibrary ) + + @chk ccall( + (:PetscDLLibraryPrintPath, $petsc_library), + PetscErrorCode, + (PetscDLLibrary,), + libs, + ) + + + return nothing +end + +""" + found::PetscBool = PetscDLLibraryRetrieve(petsclib::PetscLibType,comm::MPI_Comm, libname::String, lname::String, llen::Csize_t) +Copies a PETSc dynamic library from a remote location +(if it is remote), then indicates if it exits and its local name. + +Collective + +Input Parameters: +- `comm` - MPI processes that will be opening the library +- `libname` - name of the library, can be a relative or absolute path and be a URL +- `llen` - length of the `name` buffer + +Output Parameters: +- `lname` - actual name of the file on local filesystem if `found` +- `found` - true if the file exists + +Level: developer + +-seealso: `PetscFileRetrieve()` + +# External Links +$(_doc_external("Sys/PetscDLLibraryRetrieve")) +""" +function PetscDLLibraryRetrieve(petsclib::PetscLibType, comm::MPI_Comm, libname::String, lname::String, llen::Csize_t) end + +@for_petsc function PetscDLLibraryRetrieve(petsclib::$UnionPetscLib, comm::MPI_Comm, libname::String, lname::String, llen::Csize_t ) + found_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDLLibraryRetrieve, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Csize_t, Ptr{PetscBool}), + comm, libname, lname, llen, found_, + ) + + found = found_[] + + return found +end + +""" + PetscDLLibraryOpen(petsclib::PetscLibType,comm::MPI_Comm, path::String, entry::PetscDLLibrary) +Opens a PETSc dynamic link library + +Collective, No Fortran Support + +Input Parameters: +- `comm` - MPI processes that are opening the library +- `path` - name of the library, can be a relative or absolute path + +Output Parameter: +- `entry` - a PETSc dynamic link library entry + +Level: developer + +-seealso: `PetscDLLibrary`, `PetscLoadDynamicLibrary()`, `PetscDLLibraryAppend()`, `PetscDLLibraryRetrieve()`, `PetscDLLibrarySym()`, `PetscDLLibraryClose()` + +# External Links +$(_doc_external("Sys/PetscDLLibraryOpen")) +""" +function PetscDLLibraryOpen(petsclib::PetscLibType, comm::MPI_Comm, path::String, entry::PetscDLLibrary) end + +@for_petsc function PetscDLLibraryOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, path::String, entry::PetscDLLibrary ) + + @chk ccall( + (:PetscDLLibraryOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{PetscDLLibrary}), + comm, path, entry, + ) + + + return nothing +end + +""" + PetscDLLibrarySym(petsclib::PetscLibType,comm::MPI_Comm, outlist::PetscDLLibrary, path::String, insymbol::String, value::Cvoid) +Load a symbol from a list of dynamic link libraries. + +Collective, No Fortran Support + +Input Parameters: +- `comm` - the MPI communicator that will load the symbol +- `outlist` - list of already open libraries that may contain symbol (can be `NULL` and only the executable is searched for the function) +- `path` - optional complete library name (if provided it checks here before checking `outlist`) +- `insymbol` - name of symbol + +Output Parameter: +- `value` - if symbol not found then this value is set to `NULL` + +Level: developer + +-seealso: `PetscDLLibrary`, `PetscLoadDynamicLibrary()`, `PetscDLLibraryAppend()`, `PetscDLLibraryRetrieve()`, `PetscDLLibraryOpen()`, `PetscDLLibraryClose()` + +# External Links +$(_doc_external("Sys/PetscDLLibrarySym")) +""" +function PetscDLLibrarySym(petsclib::PetscLibType, comm::MPI_Comm, outlist::PetscDLLibrary, path::String, insymbol::String, value::Cvoid) end + +@for_petsc function PetscDLLibrarySym(petsclib::$UnionPetscLib, comm::MPI_Comm, outlist::PetscDLLibrary, path::String, insymbol::String, value::Cvoid ) + + @chk ccall( + (:PetscDLLibrarySym, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscDLLibrary}, Ptr{Cchar}, Ptr{Cchar}, Cvoid), + comm, outlist, path, insymbol, value, + ) + + + return nothing +end + +""" + PetscDLLibraryAppend(petsclib::PetscLibType,comm::MPI_Comm, outlist::PetscDLLibrary, path::String) +Appends another dynamic link library to the end of the search list + +Collective, No Fortran Support + +Input Parameters: +- `comm` - MPI communicator +- `path` - name of the library + +Output Parameter: +- `outlist` - list of libraries + +Level: developer + +-seealso: `PetscDLLibrary`, `PetscDLLibraryOpen()`, `PetscLoadDynamicLibrary()`, `PetscDLLibraryRetrieve()`, `PetscDLLibraryPrepend()` + +# External Links +$(_doc_external("Sys/PetscDLLibraryAppend")) +""" +function PetscDLLibraryAppend(petsclib::PetscLibType, comm::MPI_Comm, outlist::PetscDLLibrary, path::String) end + +@for_petsc function PetscDLLibraryAppend(petsclib::$UnionPetscLib, comm::MPI_Comm, outlist::PetscDLLibrary, path::String ) + + @chk ccall( + (:PetscDLLibraryAppend, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscDLLibrary}, Ptr{Cchar}), + comm, outlist, path, + ) + + + return nothing +end + +""" + PetscDLLibraryPrepend(petsclib::PetscLibType,comm::MPI_Comm, outlist::PetscDLLibrary, path::String) +Add another dynamic library to search for symbols to the beginning of the search list + +Collective, No Fortran Support + +Input Parameters: +- `comm` - MPI communicator +- `path` - name of the library + +Output Parameter: +- `outlist` - list of libraries + +Level: developer + +-seealso: `PetscDLLibrary`, `PetscDLLibraryOpen()`, `PetscLoadDynamicLibrary()`, `PetscDLLibraryRetrieve()`, `PetscDLLibraryAppend()` + +# External Links +$(_doc_external("Sys/PetscDLLibraryPrepend")) +""" +function PetscDLLibraryPrepend(petsclib::PetscLibType, comm::MPI_Comm, outlist::PetscDLLibrary, path::String) end + +@for_petsc function PetscDLLibraryPrepend(petsclib::$UnionPetscLib, comm::MPI_Comm, outlist::PetscDLLibrary, path::String ) + + @chk ccall( + (:PetscDLLibraryPrepend, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscDLLibrary}, Ptr{Cchar}), + comm, outlist, path, + ) + + + return nothing +end + +""" + PetscDLLibraryClose(petsclib::PetscLibType,list::PetscDLLibrary) +Destroys the search path of dynamic libraries and closes the libraries. + +Collective, No Fortran Support + +Input Parameter: +- `list` - library list + +Level: developer + +-seealso: `PetscDLLibrary`, `PetscDLLibraryOpen()`, `PetscLoadDynamicLibrary()`, `PetscDLLibraryRetrieve()`, `PetscDLLibraryAppend()`, +`PetscDLLibraryPrepend()` + +# External Links +$(_doc_external("Sys/PetscDLLibraryClose")) +""" +function PetscDLLibraryClose(petsclib::PetscLibType, list::PetscDLLibrary) end + +@for_petsc function PetscDLLibraryClose(petsclib::$UnionPetscLib, list::PetscDLLibrary ) + + @chk ccall( + (:PetscDLLibraryClose, $petsc_library), + PetscErrorCode, + (PetscDLLibrary,), + list, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscDS_wrappers.jl b/src/autowrapped/PetscDS_wrappers.jl new file mode 100644 index 00000000..ce5f4f96 --- /dev/null +++ b/src/autowrapped/PetscDS_wrappers.jl @@ -0,0 +1,3798 @@ +# autodefined type arguments for class ------ +mutable struct PetscPoCintJacFn end + +mutable struct PetscRiemannFn end + +mutable struct PetscBdPoCintFn end + +mutable struct PetscBdPoCintJacFn end + +mutable struct PetscPoCintExactSolutionFn end + +mutable struct PetscPoCintBoundFn end + +mutable struct _n_PetscTabulation end +const PetscTabulation = Ptr{_n_PetscTabulation} + +#mutable struct _n_PetscDS end +#const PetscDS = Ptr{_n_PetscDS} +# +#mutable struct _n_PetscWeakForm end +#const PetscWeakForm = Ptr{_n_PetscWeakForm} +# +#mutable struct PetscPoCintFn end +# ------------------------------------------------------- +""" + PetscDSFinalizePackage(petsclib::PetscLibType) +This function finalizes everything in the `PetscDS` package. It is called +from `PetscFinalize()`. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("Dm/PetscDSFinalizePackage")) +""" +function PetscDSFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscDSFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscDSFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscDSInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PetscDS` package. It is called +from `PetscDLLibraryRegister()` when using dynamic libraries, and on the first call to `PetscDSCreate()` +when using static libraries. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("Dm/PetscDSInitializePackage")) +""" +function PetscDSInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscDSInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscDSInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscDSRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new `PetscDS` implementation + +Not Collective; No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine itself + +-seealso: `PetscDSType`, `PetscDS`, `PetscDSRegisterAll()`, `PetscDSRegisterDestroy()` + +# External Links +$(_doc_external("Dm/PetscDSRegister")) +""" +function PetscDSRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscDSRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscDSRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscDSSetType(petsclib::PetscLibType,prob::PetscDS, name::PetscDSType) +Builds a particular `PetscDS` + +Collective; No Fortran Support + +Input Parameters: +- `prob` - The `PetscDS` object +- `name` - The `PetscDSType` + +Options Database Key: +- `-petscds_type ` - Sets the PetscDS type; use -help for a list of available types + +Level: intermediate + +-seealso: `PetscDSType`, `PetscDS`, `PetscDSGetType()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetType")) +""" +function PetscDSSetType(petsclib::PetscLibType, prob::PetscDS, name::PetscDSType) end + +@for_petsc function PetscDSSetType(petsclib::$UnionPetscLib, prob::PetscDS, name::PetscDSType ) + + @chk ccall( + (:PetscDSSetType, $petsc_library), + PetscErrorCode, + (PetscDS, PetscDSType), + prob, name, + ) + + + return nothing +end + +""" + name::PetscDSType = PetscDSGetType(petsclib::PetscLibType,prob::PetscDS) +Gets the `PetscDSType` name (as a string) from the `PetscDS` + +Not Collective; No Fortran Support + +Input Parameter: +- `prob` - The `PetscDS` + +Output Parameter: +- `name` - The `PetscDSType` name + +Level: intermediate + +-seealso: `PetscDSType`, `PetscDS`, `PetscDSSetType()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetType")) +""" +function PetscDSGetType(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetType(petsclib::$UnionPetscLib, prob::PetscDS ) + name_ = Ref{PetscDSType}() + + @chk ccall( + (:PetscDSGetType, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{PetscDSType}), + prob, name_, + ) + + name = unsafe_string(name_[]) + + return name +end + +""" + PetscDSViewFromOptions(petsclib::PetscLibType,A::PetscDS, obj::PetscObject, name::String) +View a `PetscDS` based on values in the options database + +Collective + +Input Parameters: +- `A` - the `PetscDS` object +- `obj` - Optional object that provides the options prefix used in the search of the options database +- `name` - command line option + +Level: intermediate + +-seealso: `PetscDSType`, `PetscDS`, `PetscDSView()`, `PetscObjectViewFromOptions()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSViewFromOptions")) +""" +function PetscDSViewFromOptions(petsclib::PetscLibType, A::PetscDS, obj::PetscObject, name::String) end + +@for_petsc function PetscDSViewFromOptions(petsclib::$UnionPetscLib, A::PetscDS, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscDSViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscDS, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscDSView(petsclib::PetscLibType,prob::PetscDS, v::PetscViewer) +Views a `PetscDS` + +Collective + +Input Parameters: +- `prob` - the `PetscDS` object to view +- `v` - the viewer + +Level: developer + +-seealso: `PetscDSType`, `PetscDS`, `PetscViewer`, `PetscDSDestroy()`, `PetscDSViewFromOptions()` + +# External Links +$(_doc_external("Dm/PetscDSView")) +""" +function PetscDSView(petsclib::PetscLibType, prob::PetscDS, v::PetscViewer) end + +@for_petsc function PetscDSView(petsclib::$UnionPetscLib, prob::PetscDS, v::PetscViewer ) + + @chk ccall( + (:PetscDSView, $petsc_library), + PetscErrorCode, + (PetscDS, PetscViewer), + prob, v, + ) + + + return nothing +end + +""" + PetscDSSetFromOptions(petsclib::PetscLibType,prob::PetscDS) +sets parameters in a `PetscDS` from the options database + +Collective + +Input Parameter: +- `prob` - the `PetscDS` object to set options for + +Options Database Keys: +- `-petscds_type ` - Set the `PetscDS` type +- `-petscds_view ` - View the `PetscDS` +- `-petscds_jac_pre` - Turn formation of a separate Jacobian preconditioner on or off +- `-bc_ ` - Specify a list of label ids for a boundary condition +- `-bc__comp ` - Specify a list of field components to constrain for a boundary condition + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSView()` + +# External Links +$(_doc_external("Dm/PetscDSSetFromOptions")) +""" +function PetscDSSetFromOptions(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSSetFromOptions(petsclib::$UnionPetscLib, prob::PetscDS ) + + @chk ccall( + (:PetscDSSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscDS,), + prob, + ) + + + return nothing +end + +""" + PetscDSSetUp(petsclib::PetscLibType,prob::PetscDS) +Construct data structures for the `PetscDS` + +Collective + +Input Parameter: +- `prob` - the `PetscDS` object to setup + +Level: developer + +-seealso: `PetscDS`, `PetscDSView()`, `PetscDSDestroy()` + +# External Links +$(_doc_external("Dm/PetscDSSetUp")) +""" +function PetscDSSetUp(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSSetUp(petsclib::$UnionPetscLib, prob::PetscDS ) + + @chk ccall( + (:PetscDSSetUp, $petsc_library), + PetscErrorCode, + (PetscDS,), + prob, + ) + + + return nothing +end + +""" + PetscDSDestroy(petsclib::PetscLibType,ds::PetscDS) +Destroys a `PetscDS` object + +Collective + +Input Parameter: +- `ds` - the `PetscDS` object to destroy + +Level: developer + +-seealso: `PetscDSView()` + +# External Links +$(_doc_external("Dm/PetscDSDestroy")) +""" +function PetscDSDestroy(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSDestroy(petsclib::$UnionPetscLib, ds::PetscDS ) + + @chk ccall( + (:PetscDSDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDS},), + ds, + ) + + + return nothing +end + +""" + ds::PetscDS = PetscDSCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty `PetscDS` object. The type can then be set with `PetscDSSetType()`. + +Collective + +Input Parameter: +- `comm` - The communicator for the `PetscDS` object + +Output Parameter: +- `ds` - The `PetscDS` object + +Level: beginner + +-seealso: `PetscDS`, `PetscDSSetType()`, `PETSCDSBASIC`, `PetscDSType`, `PetscDSDestroy()` + +# External Links +$(_doc_external("Dm/PetscDSCreate")) +""" +function PetscDSCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscDSCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + ds_ = Ref{PetscDS}() + + @chk ccall( + (:PetscDSCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscDS}), + comm, ds_, + ) + + ds = ds_[] + + return ds +end + +""" + Nf::PetscInt = PetscDSGetNumFields(petsclib::PetscLibType,prob::PetscDS) +Returns the number of fields in the `PetscDS` + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `Nf` - The number of fields + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetSpatialDimension()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetNumFields")) +""" +function PetscDSGetNumFields(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetNumFields(petsclib::$UnionPetscLib, prob::PetscDS ) + Nf_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetNumFields, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{$PetscInt}), + prob, Nf_, + ) + + Nf = Nf_[] + + return Nf +end + +""" + dim::PetscInt = PetscDSGetSpatialDimension(petsclib::PetscLibType,prob::PetscDS) +Returns the spatial dimension of the `PetscDS`, meaning the topological dimension of the discretizations + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `dim` - The spatial dimension + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetCoordinateDimension()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetSpatialDimension")) +""" +function PetscDSGetSpatialDimension(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetSpatialDimension(petsclib::$UnionPetscLib, prob::PetscDS ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetSpatialDimension, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{$PetscInt}), + prob, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + dimEmbed::PetscInt = PetscDSGetCoordinateDimension(petsclib::PetscLibType,prob::PetscDS) +Returns the coordinate dimension of the `PetscDS`, meaning the dimension of the space into which the discretiaztions are embedded + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `dimEmbed` - The coordinate dimension + +Level: beginner + +-seealso: `PetscDS`, `PetscDSSetCoordinateDimension()`, `PetscDSGetSpatialDimension()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetCoordinateDimension")) +""" +function PetscDSGetCoordinateDimension(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetCoordinateDimension(petsclib::$UnionPetscLib, prob::PetscDS ) + dimEmbed_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetCoordinateDimension, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{$PetscInt}), + prob, dimEmbed_, + ) + + dimEmbed = dimEmbed_[] + + return dimEmbed +end + +""" + PetscDSSetCoordinateDimension(petsclib::PetscLibType,prob::PetscDS, dimEmbed::PetscInt) +Set the coordinate dimension of the `PetscDS`, meaning the dimension of the space into which the discretiaztions are embedded + +Logically Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `dimEmbed` - The coordinate dimension + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetCoordinateDimension()`, `PetscDSGetSpatialDimension()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetCoordinateDimension")) +""" +function PetscDSSetCoordinateDimension(petsclib::PetscLibType, prob::PetscDS, dimEmbed::PetscInt) end + +@for_petsc function PetscDSSetCoordinateDimension(petsclib::$UnionPetscLib, prob::PetscDS, dimEmbed::$PetscInt ) + + @chk ccall( + (:PetscDSSetCoordinateDimension, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt), + prob, dimEmbed, + ) + + + return nothing +end + +""" + forceQuad::PetscBool = PetscDSGetForceQuad(petsclib::PetscLibType,ds::PetscDS) +Returns the flag to force matching quadratures among the field discretizations + +Not collective + +Input Parameter: +- `ds` - The `PetscDS` object + +Output Parameter: +- `forceQuad` - The flag + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSSetForceQuad()`, `PetscDSGetDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetForceQuad")) +""" +function PetscDSGetForceQuad(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSGetForceQuad(petsclib::$UnionPetscLib, ds::PetscDS ) + forceQuad_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDSGetForceQuad, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{PetscBool}), + ds, forceQuad_, + ) + + forceQuad = forceQuad_[] + + return forceQuad +end + +""" + PetscDSSetForceQuad(petsclib::PetscLibType,ds::PetscDS, forceQuad::PetscBool) +Set the flag to force matching quadratures among the field discretizations + +Logically collective on ds + +Input Parameters: +- `ds` - The `PetscDS` object +- `forceQuad` - The flag + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSGetForceQuad()`, `PetscDSGetDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetForceQuad")) +""" +function PetscDSSetForceQuad(petsclib::PetscLibType, ds::PetscDS, forceQuad::PetscBool) end + +@for_petsc function PetscDSSetForceQuad(petsclib::$UnionPetscLib, ds::PetscDS, forceQuad::PetscBool ) + + @chk ccall( + (:PetscDSSetForceQuad, $petsc_library), + PetscErrorCode, + (PetscDS, PetscBool), + ds, forceQuad, + ) + + + return nothing +end + +""" + isCohesive::PetscBool = PetscDSIsCohesive(petsclib::PetscLibType,ds::PetscDS) +Returns the flag indicating that this `PetscDS` is for a cohesive cell + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` object + +Output Parameter: +- `isCohesive` - The flag + +Level: developer + +-seealso: `PetscDS`, `PetscDSGetNumCohesive()`, `PetscDSGetCohesive()`, `PetscDSSetCohesive()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSIsCohesive")) +""" +function PetscDSIsCohesive(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSIsCohesive(petsclib::$UnionPetscLib, ds::PetscDS ) + isCohesive_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDSIsCohesive, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{PetscBool}), + ds, isCohesive_, + ) + + isCohesive = isCohesive_[] + + return isCohesive +end + +""" + numCohesive::PetscInt = PetscDSGetNumCohesive(petsclib::PetscLibType,ds::PetscDS) +Returns the number of cohesive fields, meaning those defined on the interior of a cohesive cell + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` object + +Output Parameter: +- `numCohesive` - The number of cohesive fields + +Level: developer + +-seealso: `PetscDS`, `PetscDSSetCohesive()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetNumCohesive")) +""" +function PetscDSGetNumCohesive(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSGetNumCohesive(petsclib::$UnionPetscLib, ds::PetscDS ) + numCohesive_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetNumCohesive, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{$PetscInt}), + ds, numCohesive_, + ) + + numCohesive = numCohesive_[] + + return numCohesive +end + +""" + isCohesive::PetscBool = PetscDSGetCohesive(petsclib::PetscLibType,ds::PetscDS, f::PetscInt) +Returns the flag indicating that a field is cohesive, meaning it is defined on the interior of a cohesive cell + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `f` - The field index + +Output Parameter: +- `isCohesive` - The flag + +Level: developer + +-seealso: `PetscDS`, `PetscDSSetCohesive()`, `PetscDSIsCohesive()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetCohesive")) +""" +function PetscDSGetCohesive(petsclib::PetscLibType, ds::PetscDS, f::PetscInt) end + +@for_petsc function PetscDSGetCohesive(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt ) + isCohesive_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDSGetCohesive, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscBool}), + ds, f, isCohesive_, + ) + + isCohesive = isCohesive_[] + + return isCohesive +end + +""" + PetscDSSetCohesive(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, isCohesive::PetscBool) +Set the flag indicating that a field is cohesive, meaning it is defined on the interior of a cohesive cell + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `f` - The field index +- `isCohesive` - The flag for a cohesive field + +Level: developer + +-seealso: `PetscDS`, `PetscDSGetCohesive()`, `PetscDSIsCohesive()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetCohesive")) +""" +function PetscDSSetCohesive(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, isCohesive::PetscBool) end + +@for_petsc function PetscDSSetCohesive(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, isCohesive::PetscBool ) + + @chk ccall( + (:PetscDSSetCohesive, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscBool), + ds, f, isCohesive, + ) + + + return nothing +end + +""" + dim::PetscInt = PetscDSGetTotalDimension(petsclib::PetscLibType,prob::PetscDS) +Returns the total size of the approximation space for this system + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `dim` - The total problem dimension + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetTotalDimension")) +""" +function PetscDSGetTotalDimension(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetTotalDimension(petsclib::$UnionPetscLib, prob::PetscDS ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetTotalDimension, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{$PetscInt}), + prob, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + Nc::PetscInt = PetscDSGetTotalComponents(petsclib::PetscLibType,prob::PetscDS) +Returns the total number of components in this system + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `Nc` - The total number of components + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetTotalComponents")) +""" +function PetscDSGetTotalComponents(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetTotalComponents(petsclib::$UnionPetscLib, prob::PetscDS ) + Nc_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetTotalComponents, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{$PetscInt}), + prob, Nc_, + ) + + Nc = Nc_[] + + return Nc +end + +""" + PetscDSGetDiscretization(petsclib::PetscLibType,prob::PetscDS, f::PetscInt, disc::PetscObject) +Returns the discretization object for the given field + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `f` - The field number + +Output Parameter: +- `disc` - The discretization object, this can be a `PetscFE` or a `PetscFV` + +Level: beginner + +-seealso: `PetscDS`, `PetscFE`, `PetscFV`, `PetscDSSetDiscretization()`, `PetscDSAddDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetDiscretization")) +""" +function PetscDSGetDiscretization(petsclib::PetscLibType, prob::PetscDS, f::PetscInt, disc::PetscObject) end + +@for_petsc function PetscDSGetDiscretization(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt, disc::PetscObject ) + + @chk ccall( + (:PetscDSGetDiscretization, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscObject}), + prob, f, disc, + ) + + + return nothing +end + +""" + PetscDSSetDiscretization(petsclib::PetscLibType,prob::PetscDS, f::PetscInt, disc::PetscObject) +Sets the discretization object for the given field + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `f` - The field number +- `disc` - The discretization object, this can be a `PetscFE` or a `PetscFV` + +Level: beginner + +-seealso: `PetscDS`, `PetscFE`, `PetscFV`, `PetscDSGetDiscretization()`, `PetscDSAddDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetDiscretization")) +""" +function PetscDSSetDiscretization(petsclib::PetscLibType, prob::PetscDS, f::PetscInt, disc::PetscObject) end + +@for_petsc function PetscDSSetDiscretization(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt, disc::PetscObject ) + + @chk ccall( + (:PetscDSSetDiscretization, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscObject), + prob, f, disc, + ) + + + return nothing +end + +""" + PetscDSGetWeakForm(petsclib::PetscLibType,ds::PetscDS, wf::PetscWeakForm) +Returns the weak form object from within the `PetscDS` + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` object + +Output Parameter: +- `wf` - The weak form object + +Level: beginner + +-seealso: `PetscWeakForm`, `PetscDSSetWeakForm()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetWeakForm")) +""" +function PetscDSGetWeakForm(petsclib::PetscLibType, ds::PetscDS, wf::PetscWeakForm) end + +@for_petsc function PetscDSGetWeakForm(petsclib::$UnionPetscLib, ds::PetscDS, wf::PetscWeakForm ) + + @chk ccall( + (:PetscDSGetWeakForm, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{PetscWeakForm}), + ds, wf, + ) + + + return nothing +end + +""" + PetscDSSetWeakForm(petsclib::PetscLibType,ds::PetscDS, wf::PetscWeakForm) +Sets the weak form object to be used by the `PetscDS` + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `wf` - The weak form object + +Level: beginner + +-seealso: `PetscWeakForm`, `PetscDSGetWeakForm()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetWeakForm")) +""" +function PetscDSSetWeakForm(petsclib::PetscLibType, ds::PetscDS, wf::PetscWeakForm) end + +@for_petsc function PetscDSSetWeakForm(petsclib::$UnionPetscLib, ds::PetscDS, wf::PetscWeakForm ) + + @chk ccall( + (:PetscDSSetWeakForm, $petsc_library), + PetscErrorCode, + (PetscDS, PetscWeakForm), + ds, wf, + ) + + + return nothing +end + +""" + PetscDSAddDiscretization(petsclib::PetscLibType,prob::PetscDS, disc::PetscObject) +Adds a discretization object + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `disc` - The discretization object, this can be a `PetscFE` or `PetscFV` + +Level: beginner + +-seealso: `PetscWeakForm`, `PetscFE`, `PetscFV`, `PetscDSGetDiscretization()`, `PetscDSSetDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSAddDiscretization")) +""" +function PetscDSAddDiscretization(petsclib::PetscLibType, prob::PetscDS, disc::PetscObject) end + +@for_petsc function PetscDSAddDiscretization(petsclib::$UnionPetscLib, prob::PetscDS, disc::PetscObject ) + + @chk ccall( + (:PetscDSAddDiscretization, $petsc_library), + PetscErrorCode, + (PetscDS, PetscObject), + prob, disc, + ) + + + return nothing +end + +""" + PetscDSGetQuadrature(petsclib::PetscLibType,prob::PetscDS, q::PetscQuadrature) +Returns the quadrature, which must agree for all fields in the `PetscDS` + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `q` - The quadrature object + +Level: intermediate + +-seealso: `PetscDS`, `PetscQuadrature`, `PetscDSSetImplicit()`, `PetscDSSetDiscretization()`, `PetscDSAddDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetQuadrature")) +""" +function PetscDSGetQuadrature(petsclib::PetscLibType, prob::PetscDS, q::PetscQuadrature) end + +@for_petsc function PetscDSGetQuadrature(petsclib::$UnionPetscLib, prob::PetscDS, q::PetscQuadrature ) + + @chk ccall( + (:PetscDSGetQuadrature, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{PetscQuadrature}), + prob, q, + ) + + + return nothing +end + +""" + implicit::PetscBool = PetscDSGetImplicit(petsclib::PetscLibType,prob::PetscDS, f::PetscInt) +Returns the flag for implicit solve for this field. This is just a guide for `TSARKIMEX` + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `f` - The field number + +Output Parameter: +- `implicit` - The flag indicating what kind of solve to use for this field + +Level: developer + +-seealso: `TSARKIMEX`, `PetscDS`, `PetscDSSetImplicit()`, `PetscDSSetDiscretization()`, `PetscDSAddDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetImplicit")) +""" +function PetscDSGetImplicit(petsclib::PetscLibType, prob::PetscDS, f::PetscInt) end + +@for_petsc function PetscDSGetImplicit(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt ) + implicit_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDSGetImplicit, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscBool}), + prob, f, implicit_, + ) + + implicit = implicit_[] + + return implicit +end + +""" + PetscDSSetImplicit(petsclib::PetscLibType,prob::PetscDS, f::PetscInt, implicit::PetscBool) +Set the flag for implicit solve for this field. This is just a guide for `TSARKIMEX` + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `f` - The field number +- `implicit` - The flag indicating what kind of solve to use for this field + +Level: developer + +-seealso: `TSARKIMEX`, `PetscDSGetImplicit()`, `PetscDSSetDiscretization()`, `PetscDSAddDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetImplicit")) +""" +function PetscDSSetImplicit(petsclib::PetscLibType, prob::PetscDS, f::PetscInt, implicit::PetscBool) end + +@for_petsc function PetscDSSetImplicit(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt, implicit::PetscBool ) + + @chk ccall( + (:PetscDSSetImplicit, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscBool), + prob, f, implicit, + ) + + + return nothing +end + +""" + k::PetscInt = PetscDSGetJetDegree(petsclib::PetscLibType,ds::PetscDS, f::PetscInt) +Returns the highest derivative for this field equation, or the k + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `f` - The field number + +Output Parameter: +- `k` - The highest derivative we need to tabulate + +Level: developer + +-seealso: `PetscDS`, `PetscDSSetJetDegree()`, `PetscDSSetDiscretization()`, `PetscDSAddDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetJetDegree")) +""" +function PetscDSGetJetDegree(petsclib::PetscLibType, ds::PetscDS, f::PetscInt) end + +@for_petsc function PetscDSGetJetDegree(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt ) + k_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetJetDegree, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{$PetscInt}), + ds, f, k_, + ) + + k = k_[] + + return k +end + +""" + PetscDSSetJetDegree(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, k::PetscInt) +Set the highest derivative for this field equation, or the k + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `f` - The field number +- `k` - The highest derivative we need to tabulate + +Level: developer + +-seealso: `PetscDS`, `PetscDSGetJetDegree()`, `PetscDSSetDiscretization()`, `PetscDSAddDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetJetDegree")) +""" +function PetscDSSetJetDegree(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, k::PetscInt) end + +@for_petsc function PetscDSSetJetDegree(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, k::$PetscInt ) + + @chk ccall( + (:PetscDSSetJetDegree, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt), + ds, f, k, + ) + + + return nothing +end + +""" + PetscDSGetObjective(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, obj::PetscPoCintFn) +Get the pointwise objective function for a given test field that was provided with `PetscDSSetObjective()` + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number + +Output Parameter: +- `obj` - integrand for the test function term, see `PetscPointFn` + +Level: intermediate + +-seealso: `PetscPointFn`, `PetscDS`, `PetscDSSetObjective()`, `PetscDSGetResidual()` + +# External Links +$(_doc_external("Dm/PetscDSGetObjective")) +""" +function PetscDSGetObjective(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, obj::PetscPoCintFn) end + +@for_petsc function PetscDSGetObjective(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, obj::PetscPoCintFn ) + + @chk ccall( + (:PetscDSGetObjective, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscPoCintFn), + ds, f, obj, + ) + + + return nothing +end + +""" + PetscDSSetObjective(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, obj::PetscPoCintFn) +Set the pointwise objective function for a given test field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `obj` - integrand for the test function term, see `PetscPointFn` + +Level: intermediate + +-seealso: `PetscPointFn`, `PetscDS`, `PetscDSGetObjective()`, `PetscDSSetResidual()` + +# External Links +$(_doc_external("Dm/PetscDSSetObjective")) +""" +function PetscDSSetObjective(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, obj::PetscPoCintFn) end + +@for_petsc function PetscDSSetObjective(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, obj::PetscPoCintFn ) + + @chk ccall( + (:PetscDSSetObjective, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscPoCintFn}), + ds, f, obj, + ) + + + return nothing +end + +""" + PetscDSGetResidual(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn) +Get the pointwise residual function for a given test field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number + +Output Parameters: +- `f0` - integrand for the test function term, see `PetscPointFn` +- `f1` - integrand for the test function gradient term, see `PetscPointFn` + +Level: intermediate + +-seealso: `PetscPointFn`, `PetscDS`, `PetscDSSetResidual()` + +# External Links +$(_doc_external("Dm/PetscDSGetResidual")) +""" +function PetscDSGetResidual(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn) end + +@for_petsc function PetscDSGetResidual(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn ) + + @chk ccall( + (:PetscDSGetResidual, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscPoCintFn, PetscPoCintFn), + ds, f, f0, f1, + ) + + + return nothing +end + +""" + PetscDSSetResidual(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn) +Set the pointwise residual function for a given test field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `f0` - integrand for the test function term, see `PetscPointFn` +- `f1` - integrand for the test function gradient term, see `PetscPointFn` + +Level: intermediate + +-seealso: `PetscPointFn`, `PetscDS`, `PetscDSGetResidual()` + +# External Links +$(_doc_external("Dm/PetscDSSetResidual")) +""" +function PetscDSSetResidual(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn) end + +@for_petsc function PetscDSSetResidual(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn ) + + @chk ccall( + (:PetscDSSetResidual, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscPoCintFn}, Ptr{PetscPoCintFn}), + ds, f, f0, f1, + ) + + + return nothing +end + +""" + PetscDSGetRHSResidual(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn) +Get the pointwise RHS residual function for explicit timestepping for a given test field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number + +Output Parameters: +- `f0` - integrand for the test function term, see `PetscPointFn` +- `f1` - integrand for the test function gradient term, see `PetscPointFn` + +Level: intermediate + +-seealso: `PetscPointFn`, `PetscDS`, `PetscDSSetRHSResidual()` + +# External Links +$(_doc_external("Dm/PetscDSGetRHSResidual")) +""" +function PetscDSGetRHSResidual(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn) end + +@for_petsc function PetscDSGetRHSResidual(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn ) + + @chk ccall( + (:PetscDSGetRHSResidual, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscPoCintFn, PetscPoCintFn), + ds, f, f0, f1, + ) + + + return nothing +end + +""" + PetscDSSetRHSResidual(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn) +Set the pointwise residual function for explicit timestepping for a given test field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `f0` - integrand for the test function term, see `PetscPointFn` +- `f1` - integrand for the test function gradient term, see `PetscPointFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSGetResidual()` + +# External Links +$(_doc_external("Dm/PetscDSSetRHSResidual")) +""" +function PetscDSSetRHSResidual(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn) end + +@for_petsc function PetscDSSetRHSResidual(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, f0::PetscPoCintFn, f1::PetscPoCintFn ) + + @chk ccall( + (:PetscDSSetRHSResidual, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscPoCintFn}, Ptr{PetscPoCintFn}), + ds, f, f0, f1, + ) + + + return nothing +end + +""" + hasJac::PetscBool = PetscDSHasJacobian(petsclib::PetscLibType,ds::PetscDS) +Checks that the Jacobian functions have been set + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` + +Output Parameter: +- `hasJac` - flag that indicates the pointwise function for the Jacobian has been set + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSGetJacobianPreconditioner()`, `PetscDSSetJacobianPreconditioner()`, `PetscDSGetJacobian()` + +# External Links +$(_doc_external("Dm/PetscDSHasJacobian")) +""" +function PetscDSHasJacobian(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSHasJacobian(petsclib::$UnionPetscLib, ds::PetscDS ) + hasJac_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDSHasJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{PetscBool}), + ds, hasJac_, + ) + + hasJac = hasJac_[] + + return hasJac +end + +""" + PetscDSGetJacobian(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) +Get the pointwise Jacobian function for given test and basis field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `g` - The field number + +Output Parameters: +- `g0` - integrand for the test and basis function term, see `PetscPointJacFn` +- `g1` - integrand for the test function and basis function gradient term, see `PetscPointJacFn` +- `g2` - integrand for the test function gradient and basis function term, see `PetscPointJacFn` +- `g3` - integrand for the test function gradient and basis function gradient term, see `PetscPointJacFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSSetJacobian()`, `PetscPointJacFn` + +# External Links +$(_doc_external("Dm/PetscDSGetJacobian")) +""" +function PetscDSGetJacobian(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) end + +@for_petsc function PetscDSGetJacobian(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, g::$PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn ) + + @chk ccall( + (:PetscDSGetJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, PetscPoCintJacFn, PetscPoCintJacFn, PetscPoCintJacFn, PetscPoCintJacFn), + ds, f, g, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscDSSetJacobian(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) +Set the pointwise Jacobian function for given test and basis fields + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `g` - The field number +- `g0` - integrand for the test and basis function term, see `PetscPointJacFn` +- `g1` - integrand for the test function and basis function gradient term, see `PetscPointJacFn` +- `g2` - integrand for the test function gradient and basis function term, see `PetscPointJacFn` +- `g3` - integrand for the test function gradient and basis function gradient term, see `PetscPointJacFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSGetJacobian()`, `PetscPointJacFn` + +# External Links +$(_doc_external("Dm/PetscDSSetJacobian")) +""" +function PetscDSSetJacobian(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) end + +@for_petsc function PetscDSSetJacobian(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, g::$PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn ) + + @chk ccall( + (:PetscDSSetJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, Ptr{PetscPoCintJacFn}, Ptr{PetscPoCintJacFn}, Ptr{PetscPoCintJacFn}, Ptr{PetscPoCintJacFn}), + ds, f, g, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscDSUseJacobianPreconditioner(petsclib::PetscLibType,prob::PetscDS, useJacPre::PetscBool) +Set whether to construct a Jacobian preconditioner + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` +- `useJacPre` - flag that enables construction of a Jacobian preconditioner + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSGetJacobianPreconditioner()`, `PetscDSSetJacobianPreconditioner()`, `PetscDSGetJacobian()` + +# External Links +$(_doc_external("Dm/PetscDSUseJacobianPreconditioner")) +""" +function PetscDSUseJacobianPreconditioner(petsclib::PetscLibType, prob::PetscDS, useJacPre::PetscBool) end + +@for_petsc function PetscDSUseJacobianPreconditioner(petsclib::$UnionPetscLib, prob::PetscDS, useJacPre::PetscBool ) + + @chk ccall( + (:PetscDSUseJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscDS, PetscBool), + prob, useJacPre, + ) + + + return nothing +end + +""" + hasJacPre::PetscBool = PetscDSHasJacobianPreconditioner(petsclib::PetscLibType,ds::PetscDS) +Checks if a Jacobian matrix for constructing a preconditioner has been set + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` + +Output Parameter: +- `hasJacPre` - the flag + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSGetJacobianPreconditioner()`, `PetscDSSetJacobianPreconditioner()`, `PetscDSGetJacobian()` + +# External Links +$(_doc_external("Dm/PetscDSHasJacobianPreconditioner")) +""" +function PetscDSHasJacobianPreconditioner(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSHasJacobianPreconditioner(petsclib::$UnionPetscLib, ds::PetscDS ) + hasJacPre_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDSHasJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{PetscBool}), + ds, hasJacPre_, + ) + + hasJacPre = hasJacPre_[] + + return hasJacPre +end + +""" + PetscDSGetJacobianPreconditioner(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) +Get the pointwise Jacobian function for given test and basis field that constructs the matrix used +to compute the preconditioner. If this is missing, the system matrix is used to build the preconditioner. + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `g` - The field number + +Output Parameters: +- `g0` - integrand for the test and basis function term, see `PetscPointJacFn` +- `g1` - integrand for the test function and basis function gradient term, see `PetscPointJacFn` +- `g2` - integrand for the test function gradient and basis function term, see `PetscPointJacFn` +- `g3` - integrand for the test function gradient and basis function gradient term, see `PetscPointJacFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSSetJacobianPreconditioner()`, `PetscDSGetJacobian()`, `PetscPointJacFn` + +# External Links +$(_doc_external("Dm/PetscDSGetJacobianPreconditioner")) +""" +function PetscDSGetJacobianPreconditioner(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) end + +@for_petsc function PetscDSGetJacobianPreconditioner(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, g::$PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn ) + + @chk ccall( + (:PetscDSGetJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, PetscPoCintJacFn, PetscPoCintJacFn, PetscPoCintJacFn, PetscPoCintJacFn), + ds, f, g, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscDSSetJacobianPreconditioner(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) +Set the pointwise Jacobian function for given test and basis fields that constructs the matrix used +to compute the preconditioner. If this is missing, the system matrix is used to build the preconditioner. + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `g` - The field number +- `g0` - integrand for the test and basis function term, see `PetscPointJacFn` +- `g1` - integrand for the test function and basis function gradient term, see `PetscPointJacFn` +- `g2` - integrand for the test function gradient and basis function term, see `PetscPointJacFn` +- `g3` - integrand for the test function gradient and basis function gradient term, see `PetscPointJacFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSGetJacobianPreconditioner()`, `PetscDSSetJacobian()`, `PetscPointJacFn` + +# External Links +$(_doc_external("Dm/PetscDSSetJacobianPreconditioner")) +""" +function PetscDSSetJacobianPreconditioner(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) end + +@for_petsc function PetscDSSetJacobianPreconditioner(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, g::$PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn ) + + @chk ccall( + (:PetscDSSetJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, Ptr{PetscPoCintJacFn}, Ptr{PetscPoCintJacFn}, Ptr{PetscPoCintJacFn}, Ptr{PetscPoCintJacFn}), + ds, f, g, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + hasDynJac::PetscBool = PetscDSHasDynamicJacobian(petsclib::PetscLibType,ds::PetscDS) +Signals that a dynamic Jacobian, dF/du_t, has been set + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` + +Output Parameter: +- `hasDynJac` - flag that pointwise function for dynamic Jacobian has been set + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSGetDynamicJacobian()`, `PetscDSSetDynamicJacobian()`, `PetscDSGetJacobian()` + +# External Links +$(_doc_external("Dm/PetscDSHasDynamicJacobian")) +""" +function PetscDSHasDynamicJacobian(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSHasDynamicJacobian(petsclib::$UnionPetscLib, ds::PetscDS ) + hasDynJac_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDSHasDynamicJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{PetscBool}), + ds, hasDynJac_, + ) + + hasDynJac = hasDynJac_[] + + return hasDynJac +end + +""" + PetscDSGetDynamicJacobian(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) +Get the pointwise dynamic Jacobian, dF/du_t, function for given test and basis field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `g` - The field number + +Output Parameters: +- `g0` - integrand for the test and basis function term, see `PetscPointJacFn` +- `g1` - integrand for the test function and basis function gradient term, see `PetscPointJacFn` +- `g2` - integrand for the test function gradient and basis function term, see `PetscPointJacFn` +- `g3` - integrand for the test function gradient and basis function gradient term, see `PetscPointJacFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSSetJacobian()`, `PetscDSSetDynamicJacobian()`, `PetscPointJacFn` + +# External Links +$(_doc_external("Dm/PetscDSGetDynamicJacobian")) +""" +function PetscDSGetDynamicJacobian(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) end + +@for_petsc function PetscDSGetDynamicJacobian(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, g::$PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn ) + + @chk ccall( + (:PetscDSGetDynamicJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, PetscPoCintJacFn, PetscPoCintJacFn, PetscPoCintJacFn, PetscPoCintJacFn), + ds, f, g, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscDSSetDynamicJacobian(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) +Set the pointwise dynamic Jacobian, dF/du_t, function for given test and basis fields + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `g` - The field number +- `g0` - integrand for the test and basis function term, see `PetscPointJacFn` +- `g1` - integrand for the test function and basis function gradient term, see `PetscPointJacFn` +- `g2` - integrand for the test function gradient and basis function term, see `PetscPointJacFn` +- `g3` - integrand for the test function gradient and basis function gradient term, see `PetscPointJacFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSGetDynamicJacobian()`, `PetscDSGetJacobian()`, `PetscPointJacFn` + +# External Links +$(_doc_external("Dm/PetscDSSetDynamicJacobian")) +""" +function PetscDSSetDynamicJacobian(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn) end + +@for_petsc function PetscDSSetDynamicJacobian(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, g::$PetscInt, g0::PetscPoCintJacFn, g1::PetscPoCintJacFn, g2::PetscPoCintJacFn, g3::PetscPoCintJacFn ) + + @chk ccall( + (:PetscDSSetDynamicJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, Ptr{PetscPoCintJacFn}, Ptr{PetscPoCintJacFn}, Ptr{PetscPoCintJacFn}, Ptr{PetscPoCintJacFn}), + ds, f, g, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscDSGetRiemannSolver(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, r::PetscRiemannFn) +Returns the Riemann solver for the given field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `f` - The field number + +Output Parameter: +- `r` - Riemann solver, see `PetscRiemannFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscRiemannFn`, `PetscDSSetRiemannSolver()` + +# External Links +$(_doc_external("Dm/PetscDSGetRiemannSolver")) +""" +function PetscDSGetRiemannSolver(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, r::PetscRiemannFn) end + +@for_petsc function PetscDSGetRiemannSolver(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, r::PetscRiemannFn ) + + @chk ccall( + (:PetscDSGetRiemannSolver, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscRiemannFn), + ds, f, r, + ) + + + return nothing +end + +""" + PetscDSSetRiemannSolver(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, r::PetscRiemannFn) +Sets the Riemann solver for the given field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `f` - The field number +- `r` - Riemann solver, see `PetscRiemannFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscRiemannFn`, `PetscDSGetRiemannSolver()` + +# External Links +$(_doc_external("Dm/PetscDSSetRiemannSolver")) +""" +function PetscDSSetRiemannSolver(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, r::PetscRiemannFn) end + +@for_petsc function PetscDSSetRiemannSolver(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, r::PetscRiemannFn ) + + @chk ccall( + (:PetscDSSetRiemannSolver, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscRiemannFn}), + ds, f, r, + ) + + + return nothing +end + +""" + PetscDSGetUpdate(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, update::PetscPoCintFn) +Get the pointwise update function for a given field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The field number + +Output Parameter: +- `update` - update function, see `PetscPointFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointFn`, `PetscDSSetUpdate()`, `PetscDSSetResidual()` + +# External Links +$(_doc_external("Dm/PetscDSGetUpdate")) +""" +function PetscDSGetUpdate(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, update::PetscPoCintFn) end + +@for_petsc function PetscDSGetUpdate(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, update::PetscPoCintFn ) + + @chk ccall( + (:PetscDSGetUpdate, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscPoCintFn), + ds, f, update, + ) + + + return nothing +end + +""" + PetscDSSetUpdate(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, update::PetscPoCintFn) +Set the pointwise update function for a given field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The field number +- `update` - update function, see `PetscPointFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointFn`, `PetscDSGetResidual()` + +# External Links +$(_doc_external("Dm/PetscDSSetUpdate")) +""" +function PetscDSSetUpdate(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, update::PetscPoCintFn) end + +@for_petsc function PetscDSSetUpdate(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, update::PetscPoCintFn ) + + @chk ccall( + (:PetscDSSetUpdate, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscPoCintFn}), + ds, f, update, + ) + + + return nothing +end + +""" + PetscDSGetContext(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, ctx::Cvoid) +Returns the context that was passed by `PetscDSSetContext()` + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The field number +- `ctx` - the context + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointFn`, `PetscDSSetContext()` + +# External Links +$(_doc_external("Dm/PetscDSGetContext")) +""" +function PetscDSGetContext(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, ctx::Cvoid) end + +@for_petsc function PetscDSGetContext(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, ctx::Cvoid ) + + @chk ccall( + (:PetscDSGetContext, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{Cvoid}), + ds, f, ctx, + ) + + + return nothing +end + +""" + PetscDSSetContext(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, ctx::Cvoid) +Sets the context that is passed back to some of the pointwise function callbacks used by this `PetscDS` + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The field number +- `ctx` - the context + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointFn`, `PetscDSGetContext()` + +# External Links +$(_doc_external("Dm/PetscDSSetContext")) +""" +function PetscDSSetContext(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, ctx::Cvoid) end + +@for_petsc function PetscDSSetContext(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, ctx::Cvoid ) + + @chk ccall( + (:PetscDSSetContext, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{Cvoid}), + ds, f, ctx, + ) + + + return nothing +end + +""" + PetscDSGetBdResidual(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, f0::PetscBdPoCintFn, f1::PetscBdPoCintFn) +Get the pointwise boundary residual function for a given test field + +Not Collective + +Input Parameters: +- `ds` - The PetscDS +- `f` - The test field number + +Output Parameters: +- `f0` - boundary integrand for the test function term, see `PetscBdPointFn` +- `f1` - boundary integrand for the test function gradient term, see `PetscBdPointFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscBdPointFn`, `PetscDSSetBdResidual()` + +# External Links +$(_doc_external("Dm/PetscDSGetBdResidual")) +""" +function PetscDSGetBdResidual(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, f0::PetscBdPoCintFn, f1::PetscBdPoCintFn) end + +@for_petsc function PetscDSGetBdResidual(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, f0::PetscBdPoCintFn, f1::PetscBdPoCintFn ) + + @chk ccall( + (:PetscDSGetBdResidual, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscBdPoCintFn, PetscBdPoCintFn), + ds, f, f0, f1, + ) + + + return nothing +end + +""" + PetscDSSetBdResidual(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, f0::PetscBdPoCintFn, f1::PetscBdPoCintFn) +Get the pointwise boundary residual function for a given test field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `f0` - boundary integrand for the test function term, see `PetscBdPointFn` +- `f1` - boundary integrand for the test function gradient term, see `PetscBdPointFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscBdPointFn`, `PetscDSGetBdResidual()` + +# External Links +$(_doc_external("Dm/PetscDSSetBdResidual")) +""" +function PetscDSSetBdResidual(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, f0::PetscBdPoCintFn, f1::PetscBdPoCintFn) end + +@for_petsc function PetscDSSetBdResidual(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, f0::PetscBdPoCintFn, f1::PetscBdPoCintFn ) + + @chk ccall( + (:PetscDSSetBdResidual, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscBdPoCintFn}, Ptr{PetscBdPoCintFn}), + ds, f, f0, f1, + ) + + + return nothing +end + +""" + hasBdJac::PetscBool = PetscDSHasBdJacobian(petsclib::PetscLibType,ds::PetscDS) +Indicates that boundary Jacobian functions have been set + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` + +Output Parameter: +- `hasBdJac` - flag that pointwise function for the boundary Jacobian has been set + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSHasJacobian()`, `PetscDSSetBdJacobian()`, `PetscDSGetBdJacobian()` + +# External Links +$(_doc_external("Dm/PetscDSHasBdJacobian")) +""" +function PetscDSHasBdJacobian(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSHasBdJacobian(petsclib::$UnionPetscLib, ds::PetscDS ) + hasBdJac_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDSHasBdJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{PetscBool}), + ds, hasBdJac_, + ) + + hasBdJac = hasBdJac_[] + + return hasBdJac +end + +""" + PetscDSGetBdJacobian(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn) +Get the pointwise boundary Jacobian function for given test and basis field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `g` - The field number + +Output Parameters: +- `g0` - integrand for the test and basis function term, see `PetscBdPointJacFn` +- `g1` - integrand for the test function and basis function gradient term, see `PetscBdPointJacFn` +- `g2` - integrand for the test function gradient and basis function term, see `PetscBdPointJacFn` +- `g3` - integrand for the test function gradient and basis function gradient term, see `PetscBdPointJacFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscBdPointJacFn`, `PetscDSSetBdJacobian()` + +# External Links +$(_doc_external("Dm/PetscDSGetBdJacobian")) +""" +function PetscDSGetBdJacobian(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn) end + +@for_petsc function PetscDSGetBdJacobian(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, g::$PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn ) + + @chk ccall( + (:PetscDSGetBdJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, PetscBdPoCintJacFn, PetscBdPoCintJacFn, PetscBdPoCintJacFn, PetscBdPoCintJacFn), + ds, f, g, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscDSSetBdJacobian(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn) +Set the pointwise boundary Jacobian function for given test and basis field + +Not Collective + +Input Parameters: +- `ds` - The PetscDS +- `f` - The test field number +- `g` - The field number +- `g0` - integrand for the test and basis function term, see `PetscBdPointJacFn` +- `g1` - integrand for the test function and basis function gradient term, see `PetscBdPointJacFn` +- `g2` - integrand for the test function gradient and basis function term, see `PetscBdPointJacFn` +- `g3` - integrand for the test function gradient and basis function gradient term, see `PetscBdPointJacFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscBdPointJacFn`, `PetscDSGetBdJacobian()` + +# External Links +$(_doc_external("Dm/PetscDSSetBdJacobian")) +""" +function PetscDSSetBdJacobian(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn) end + +@for_petsc function PetscDSSetBdJacobian(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, g::$PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn ) + + @chk ccall( + (:PetscDSSetBdJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, Ptr{PetscBdPoCintJacFn}, Ptr{PetscBdPoCintJacFn}, Ptr{PetscBdPoCintJacFn}, Ptr{PetscBdPoCintJacFn}), + ds, f, g, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + hasBdJacPre::PetscBool = PetscDSHasBdJacobianPreconditioner(petsclib::PetscLibType,ds::PetscDS) +Signals that boundary Jacobian preconditioner functions have been set with `PetscDSSetBdJacobianPreconditioner()` + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` + +Output Parameter: +- `hasBdJacPre` - flag that pointwise function for the boundary Jacobian matrix to construct the preconditioner has been set + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSHasJacobian()`, `PetscDSSetBdJacobian()`, `PetscDSGetBdJacobian()` + +# External Links +$(_doc_external("Dm/PetscDSHasBdJacobianPreconditioner")) +""" +function PetscDSHasBdJacobianPreconditioner(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSHasBdJacobianPreconditioner(petsclib::$UnionPetscLib, ds::PetscDS ) + hasBdJacPre_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDSHasBdJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{PetscBool}), + ds, hasBdJacPre_, + ) + + hasBdJacPre = hasBdJacPre_[] + + return hasBdJacPre +end + +""" + PetscDSGetBdJacobianPreconditioner(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn) +Get the pointwise boundary Jacobian function for given test and basis field that constructs the +matrix used to construct the preconditioner + +Not Collective; No Fortran Support + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `g` - The field number + +Output Parameters: +- `g0` - integrand for the test and basis function term, see `PetscBdPointJacFn` +- `g1` - integrand for the test function and basis function gradient term, see `PetscBdPointJacFn` +- `g2` - integrand for the test function gradient and basis function term, see `PetscBdPointJacFn` +- `g3` - integrand for the test function gradient and basis function gradient term, see `PetscBdPointJacFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscBdPointJacFn`, `PetscDSSetBdJacobianPreconditioner()` + +# External Links +$(_doc_external("Dm/PetscDSGetBdJacobianPreconditioner")) +""" +function PetscDSGetBdJacobianPreconditioner(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn) end + +@for_petsc function PetscDSGetBdJacobianPreconditioner(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, g::$PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn ) + + @chk ccall( + (:PetscDSGetBdJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, PetscBdPoCintJacFn, PetscBdPoCintJacFn, PetscBdPoCintJacFn, PetscBdPoCintJacFn), + ds, f, g, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscDSSetBdJacobianPreconditioner(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn) +Set the pointwise boundary Jacobian preconditioner function for given test and basis field that constructs the +matrix used to construct the preconditioner + +Not Collective; No Fortran Support + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The test field number +- `g` - The field number +- `g0` - integrand for the test and basis function term, see `PetscBdPointJacFn` +- `g1` - integrand for the test function and basis function gradient term, see `PetscBdPointJacFn` +- `g2` - integrand for the test function gradient and basis function term, see `PetscBdPointJacFn` +- `g3` - integrand for the test function gradient and basis function gradient term, see `PetscBdPointJacFn` + +Level: intermediate + +-seealso: `PetscDS`, `PetscBdPointJacFn`, `PetscDSGetBdJacobianPreconditioner()` + +# External Links +$(_doc_external("Dm/PetscDSSetBdJacobianPreconditioner")) +""" +function PetscDSSetBdJacobianPreconditioner(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, g::PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn) end + +@for_petsc function PetscDSSetBdJacobianPreconditioner(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, g::$PetscInt, g0::PetscBdPoCintJacFn, g1::PetscBdPoCintJacFn, g2::PetscBdPoCintJacFn, g3::PetscBdPoCintJacFn ) + + @chk ccall( + (:PetscDSSetBdJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, Ptr{PetscBdPoCintJacFn}, Ptr{PetscBdPoCintJacFn}, Ptr{PetscBdPoCintJacFn}, Ptr{PetscBdPoCintJacFn}), + ds, f, g, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscDSGetExactSolution(petsclib::PetscLibType,prob::PetscDS, f::PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid) +Get the pointwise exact solution function for a given test field + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` +- `f` - The test field number + +Output Parameters: +- `sol` - exact solution function for the test field, see `PetscPointExactSolutionFn` +- `ctx` - exact solution context + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointExactSolutionFn`, `PetscDSSetExactSolution()`, `PetscDSGetExactSolutionTimeDerivative()` + +# External Links +$(_doc_external("Dm/PetscDSGetExactSolution")) +""" +function PetscDSGetExactSolution(petsclib::PetscLibType, prob::PetscDS, f::PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid) end + +@for_petsc function PetscDSGetExactSolution(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid ) + + @chk ccall( + (:PetscDSGetExactSolution, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscPoCintExactSolutionFn, Cvoid), + prob, f, sol, ctx, + ) + + + return nothing +end + +""" + PetscDSSetExactSolution(petsclib::PetscLibType,prob::PetscDS, f::PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid) +Set the pointwise exact solution function for a given test field + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` +- `f` - The test field number +- `sol` - solution function for the test fields, see `PetscPointExactSolutionFn` +- `ctx` - solution context or `NULL` + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointExactSolutionFn`, `PetscDSGetExactSolution()` + +# External Links +$(_doc_external("Dm/PetscDSSetExactSolution")) +""" +function PetscDSSetExactSolution(petsclib::PetscLibType, prob::PetscDS, f::PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid) end + +@for_petsc function PetscDSSetExactSolution(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid ) + + @chk ccall( + (:PetscDSSetExactSolution, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscPoCintExactSolutionFn}, Ptr{Cvoid}), + prob, f, sol, ctx, + ) + + + return nothing +end + +""" + PetscDSGetExactSolutionTimeDerivative(petsclib::PetscLibType,prob::PetscDS, f::PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid) +Get the pointwise time derivative of the exact solution function for a given test field + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` +- `f` - The test field number + +Output Parameters: +- `sol` - time derivative of the exact solution for the test field, see `PetscPointExactSolutionFn` +- `ctx` - the exact solution context + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointExactSolutionFn`, `PetscDSSetExactSolutionTimeDerivative()`, `PetscDSGetExactSolution()` + +# External Links +$(_doc_external("Dm/PetscDSGetExactSolutionTimeDerivative")) +""" +function PetscDSGetExactSolutionTimeDerivative(petsclib::PetscLibType, prob::PetscDS, f::PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid) end + +@for_petsc function PetscDSGetExactSolutionTimeDerivative(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid ) + + @chk ccall( + (:PetscDSGetExactSolutionTimeDerivative, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscPoCintExactSolutionFn, Cvoid), + prob, f, sol, ctx, + ) + + + return nothing +end + +""" + PetscDSSetExactSolutionTimeDerivative(petsclib::PetscLibType,prob::PetscDS, f::PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid) +Set the pointwise time derivative of the exact solution function for a given test field + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` +- `f` - The test field number +- `sol` - time derivative of the solution function for the test fields, see `PetscPointExactSolutionFn` +- `ctx` - the solution context or `NULL` + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointExactSolutionFn`, `PetscDSGetExactSolutionTimeDerivative()`, `PetscDSSetExactSolution()` + +# External Links +$(_doc_external("Dm/PetscDSSetExactSolutionTimeDerivative")) +""" +function PetscDSSetExactSolutionTimeDerivative(petsclib::PetscLibType, prob::PetscDS, f::PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid) end + +@for_petsc function PetscDSSetExactSolutionTimeDerivative(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt, sol::PetscPoCintExactSolutionFn, ctx::Cvoid ) + + @chk ccall( + (:PetscDSSetExactSolutionTimeDerivative, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscPoCintExactSolutionFn}, Ptr{Cvoid}), + prob, f, sol, ctx, + ) + + + return nothing +end + +""" + PetscDSGetLowerBound(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, lb::PetscPoCintBoundFn, ctx::Cvoid) +Get the pointwise lower bound function for a given field + +Not Collective + +Input Parameters: +- `ds` - The PetscDS +- `f` - The field number + +Output Parameters: +- `lb` - lower bound function for the field, see `PetscPointBoundFn` +- `ctx` - lower bound context that was set with `PetscDSSetLowerBound()` + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointBoundFn`, `PetscDSSetLowerBound()`, `PetscDSGetUpperBound()`, `PetscDSGetExactSolution()` + +# External Links +$(_doc_external("Dm/PetscDSGetLowerBound")) +""" +function PetscDSGetLowerBound(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, lb::PetscPoCintBoundFn, ctx::Cvoid) end + +@for_petsc function PetscDSGetLowerBound(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, lb::PetscPoCintBoundFn, ctx::Cvoid ) + + @chk ccall( + (:PetscDSGetLowerBound, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscPoCintBoundFn, Cvoid), + ds, f, lb, ctx, + ) + + + return nothing +end + +""" + PetscDSSetLowerBound(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, lb::PetscPoCintBoundFn, ctx::Cvoid) +Set the pointwise lower bound function for a given field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The field number +- `lb` - lower bound function for the test fields, see `PetscPointBoundFn` +- `ctx` - lower bound context or `NULL` which will be passed to `lb` + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointBoundFn`, `PetscDSGetLowerBound()`, `PetscDSGetUpperBound()`, `PetscDSGetExactSolution()` + +# External Links +$(_doc_external("Dm/PetscDSSetLowerBound")) +""" +function PetscDSSetLowerBound(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, lb::PetscPoCintBoundFn, ctx::Cvoid) end + +@for_petsc function PetscDSSetLowerBound(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, lb::PetscPoCintBoundFn, ctx::Cvoid ) + + @chk ccall( + (:PetscDSSetLowerBound, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscPoCintBoundFn}, Ptr{Cvoid}), + ds, f, lb, ctx, + ) + + + return nothing +end + +""" + PetscDSGetUpperBound(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, ub::PetscPoCintBoundFn, ctx::Cvoid) +Get the pointwise upper bound function for a given field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The field number + +Output Parameters: +- `ub` - upper bound function for the field, see `PetscPointBoundFn` +- `ctx` - upper bound context that was set with `PetscDSSetUpperBound()` + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointBoundFn`, `PetscDSSetUpperBound()`, `PetscDSGetLowerBound()`, `PetscDSGetExactSolution()` + +# External Links +$(_doc_external("Dm/PetscDSGetUpperBound")) +""" +function PetscDSGetUpperBound(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, ub::PetscPoCintBoundFn, ctx::Cvoid) end + +@for_petsc function PetscDSGetUpperBound(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, ub::PetscPoCintBoundFn, ctx::Cvoid ) + + @chk ccall( + (:PetscDSGetUpperBound, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, PetscPoCintBoundFn, Cvoid), + ds, f, ub, ctx, + ) + + + return nothing +end + +""" + PetscDSSetUpperBound(petsclib::PetscLibType,ds::PetscDS, f::PetscInt, ub::PetscPoCintBoundFn, ctx::Cvoid) +Set the pointwise upper bound function for a given field + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` +- `f` - The field number +- `ub` - upper bound function for the test fields, see `PetscPointBoundFn` +- `ctx` - context or `NULL` that will be passed to `ub` + +Level: intermediate + +-seealso: `PetscDS`, `PetscPointBoundFn`, `PetscDSGetUpperBound()`, `PetscDSGetLowerBound()`, `PetscDSGetExactSolution()` + +# External Links +$(_doc_external("Dm/PetscDSSetUpperBound")) +""" +function PetscDSSetUpperBound(petsclib::PetscLibType, ds::PetscDS, f::PetscInt, ub::PetscPoCintBoundFn, ctx::Cvoid) end + +@for_petsc function PetscDSSetUpperBound(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt, ub::PetscPoCintBoundFn, ctx::Cvoid ) + + @chk ccall( + (:PetscDSSetUpperBound, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscPoCintBoundFn}, Ptr{Cvoid}), + ds, f, ub, ctx, + ) + + + return nothing +end + +""" + numConstants::PetscInt,constants::Vector{PetscScalar} = PetscDSGetConstants(petsclib::PetscLibType,ds::PetscDS) +Returns the array of constants passed to point functions from a `PetscDS` object + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` object + +Output Parameters: +- `numConstants` - The number of constants, or pass in `NULL` if not required +- `constants` - The array of constants, `NULL` if there are none + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSSetConstants()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetConstants")) +""" +function PetscDSGetConstants(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSGetConstants(petsclib::$UnionPetscLib, ds::PetscDS ) + numConstants_ = Ref{$PetscInt}() + constants_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:PetscDSGetConstants, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{$PetscInt}, Ptr{Ptr{$PetscScalar}}), + ds, numConstants_, constants_, + ) + + numConstants = numConstants_[] + constants = unsafe_wrap(Array, constants_[], VecGetLocalSize(petsclib, x); own = false) + + return numConstants,constants +end + +""" + PetscDSSetConstants(petsclib::PetscLibType,ds::PetscDS, numConstants::PetscInt, constants::Vector{PetscScalar}) +Set the array of constants passed to point functions from a `PetscDS` + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `numConstants` - The number of constants +- `constants` - The array of constants, `NULL` if there are none + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSGetConstants()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetConstants")) +""" +function PetscDSSetConstants(petsclib::PetscLibType, ds::PetscDS, numConstants::PetscInt, constants::Vector{PetscScalar}) end + +@for_petsc function PetscDSSetConstants(petsclib::$UnionPetscLib, ds::PetscDS, numConstants::$PetscInt, constants::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscDSSetConstants, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{$PetscScalar}), + ds, numConstants, constants, + ) + + + return nothing +end + +""" + PetscDSSetIntegrationParameters(petsclib::PetscLibType,ds::PetscDS, fieldI::PetscInt, fieldJ::PetscInt) +Set the parameters for a particular integration + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `fieldI` - The test field for a given point function, or `PETSC_DETERMINE` +- `fieldJ` - The basis field for a given point function, or `PETSC_DETERMINE` + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSSetConstants()`, `PetscDSGetConstants()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetIntegrationParameters")) +""" +function PetscDSSetIntegrationParameters(petsclib::PetscLibType, ds::PetscDS, fieldI::PetscInt, fieldJ::PetscInt) end + +@for_petsc function PetscDSSetIntegrationParameters(petsclib::$UnionPetscLib, ds::PetscDS, fieldI::$PetscInt, fieldJ::$PetscInt ) + + @chk ccall( + (:PetscDSSetIntegrationParameters, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt), + ds, fieldI, fieldJ, + ) + + + return nothing +end + +""" + PetscDSSetCellParameters(petsclib::PetscLibType,ds::PetscDS, volume::PetscReal) +Set the parameters for a particular cell + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `volume` - The cell volume + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSSetConstants()`, `PetscDSGetConstants()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSetCellParameters")) +""" +function PetscDSSetCellParameters(petsclib::PetscLibType, ds::PetscDS, volume::PetscReal) end + +@for_petsc function PetscDSSetCellParameters(petsclib::$UnionPetscLib, ds::PetscDS, volume::$PetscReal ) + + @chk ccall( + (:PetscDSSetCellParameters, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscReal), + ds, volume, + ) + + + return nothing +end + +""" + f::PetscInt = PetscDSGetFieldIndex(petsclib::PetscLibType,prob::PetscDS, disc::PetscObject) +Returns the index of the given field + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `disc` - The discretization object + +Output Parameter: +- `f` - The field number + +Level: beginner + +-seealso: `PetscDS`, `PetscGetDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetFieldIndex")) +""" +function PetscDSGetFieldIndex(petsclib::PetscLibType, prob::PetscDS, disc::PetscObject) end + +@for_petsc function PetscDSGetFieldIndex(petsclib::$UnionPetscLib, prob::PetscDS, disc::PetscObject ) + f_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetFieldIndex, $petsc_library), + PetscErrorCode, + (PetscDS, PetscObject, Ptr{$PetscInt}), + prob, disc, f_, + ) + + f = f_[] + + return f +end + +""" + size::PetscInt = PetscDSGetFieldSize(petsclib::PetscLibType,prob::PetscDS, f::PetscInt) +Returns the size of the given field in the full space basis + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `f` - The field number + +Output Parameter: +- `size` - The size + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetFieldOffset()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetFieldSize")) +""" +function PetscDSGetFieldSize(petsclib::PetscLibType, prob::PetscDS, f::PetscInt) end + +@for_petsc function PetscDSGetFieldSize(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetFieldSize, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{$PetscInt}), + prob, f, size_, + ) + + size = size_[] + + return size +end + +""" + off::PetscInt = PetscDSGetFieldOffset(petsclib::PetscLibType,prob::PetscDS, f::PetscInt) +Returns the offset of the given field in the full space basis + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `f` - The field number + +Output Parameter: +- `off` - The offset + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetFieldSize()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetFieldOffset")) +""" +function PetscDSGetFieldOffset(petsclib::PetscLibType, prob::PetscDS, f::PetscInt) end + +@for_petsc function PetscDSGetFieldOffset(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt ) + off_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetFieldOffset, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{$PetscInt}), + prob, f, off_, + ) + + off = off_[] + + return off +end + +""" + off::PetscInt = PetscDSGetFieldOffsetCohesive(petsclib::PetscLibType,ds::PetscDS, f::PetscInt) +Returns the offset of the given field in the full space basis on a cohesive cell + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `f` - The field number + +Output Parameter: +- `off` - The offset + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetFieldSize()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetFieldOffsetCohesive")) +""" +function PetscDSGetFieldOffsetCohesive(petsclib::PetscLibType, ds::PetscDS, f::PetscInt) end + +@for_petsc function PetscDSGetFieldOffsetCohesive(petsclib::$UnionPetscLib, ds::PetscDS, f::$PetscInt ) + off_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetFieldOffsetCohesive, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{$PetscInt}), + ds, f, off_, + ) + + off = off_[] + + return off +end + +""" + dimensions::Vector{PetscInt} = PetscDSGetDimensions(petsclib::PetscLibType,prob::PetscDS) +Returns the size of the approximation space for each field on an evaluation point + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `dimensions` - The number of dimensions + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetComponentOffsets()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetDimensions")) +""" +function PetscDSGetDimensions(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetDimensions(petsclib::$UnionPetscLib, prob::PetscDS ) + dimensions_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscDSGetDimensions, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{Ptr{$PetscInt}}), + prob, dimensions_, + ) + + dimensions = unsafe_wrap(Array, dimensions_[], VecGetLocalSize(petsclib, x); own = false) + + return dimensions +end + +""" + components::Vector{PetscInt} = PetscDSGetComponents(petsclib::PetscLibType,prob::PetscDS) +Returns the number of components for each field on an evaluation point + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `components` - The number of components + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetComponentOffsets()`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetComponents")) +""" +function PetscDSGetComponents(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetComponents(petsclib::$UnionPetscLib, prob::PetscDS ) + components_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscDSGetComponents, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{Ptr{$PetscInt}}), + prob, components_, + ) + + components = unsafe_wrap(Array, components_[], VecGetLocalSize(petsclib, x); own = false) + + return components +end + +""" + off::PetscInt = PetscDSGetComponentOffset(petsclib::PetscLibType,prob::PetscDS, f::PetscInt) +Returns the offset of the given field on an evaluation point + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `f` - The field number + +Output Parameter: +- `off` - The offset + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetComponentOffset")) +""" +function PetscDSGetComponentOffset(petsclib::PetscLibType, prob::PetscDS, f::PetscInt) end + +@for_petsc function PetscDSGetComponentOffset(petsclib::$UnionPetscLib, prob::PetscDS, f::$PetscInt ) + off_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetComponentOffset, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{$PetscInt}), + prob, f, off_, + ) + + off = off_[] + + return off +end + +""" + offsets::Vector{PetscInt} = PetscDSGetComponentOffsets(petsclib::PetscLibType,prob::PetscDS) +Returns the offset of each field on an evaluation point + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `offsets` - The offsets + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetComponentOffsets")) +""" +function PetscDSGetComponentOffsets(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetComponentOffsets(petsclib::$UnionPetscLib, prob::PetscDS ) + offsets_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscDSGetComponentOffsets, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{Ptr{$PetscInt}}), + prob, offsets_, + ) + + offsets = unsafe_wrap(Array, offsets_[], VecGetLocalSize(petsclib, x); own = false) + + return offsets +end + +""" + offsets::Vector{PetscInt} = PetscDSGetComponentDerivativeOffsets(petsclib::PetscLibType,prob::PetscDS) +Returns the offset of each field derivative on an evaluation point + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `offsets` - The offsets + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetComponentDerivativeOffsets")) +""" +function PetscDSGetComponentDerivativeOffsets(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetComponentDerivativeOffsets(petsclib::$UnionPetscLib, prob::PetscDS ) + offsets_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscDSGetComponentDerivativeOffsets, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{Ptr{$PetscInt}}), + prob, offsets_, + ) + + offsets = unsafe_wrap(Array, offsets_[], VecGetLocalSize(petsclib, x); own = false) + + return offsets +end + +""" + offsets::Vector{PetscInt} = PetscDSGetComponentOffsetsCohesive(petsclib::PetscLibType,ds::PetscDS, s::PetscInt) +Returns the offset of each field on an evaluation point + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `s` - The cohesive side, 0 for negative, 1 for positive, 2 for cohesive + +Output Parameter: +- `offsets` - The offsets + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetComponentOffsetsCohesive")) +""" +function PetscDSGetComponentOffsetsCohesive(petsclib::PetscLibType, ds::PetscDS, s::PetscInt) end + +@for_petsc function PetscDSGetComponentOffsetsCohesive(petsclib::$UnionPetscLib, ds::PetscDS, s::$PetscInt ) + offsets_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscDSGetComponentOffsetsCohesive, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{Ptr{$PetscInt}}), + ds, s, offsets_, + ) + + offsets = unsafe_wrap(Array, offsets_[], VecGetLocalSize(petsclib, x); own = false) + + return offsets +end + +""" + offsets::Vector{PetscInt} = PetscDSGetComponentDerivativeOffsetsCohesive(petsclib::PetscLibType,ds::PetscDS, s::PetscInt) +Returns the offset of each field derivative on an evaluation point + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `s` - The cohesive side, 0 for negative, 1 for positive, 2 for cohesive + +Output Parameter: +- `offsets` - The offsets + +Level: beginner + +-seealso: `PetscDS`, `PetscDSGetNumFields()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetComponentDerivativeOffsetsCohesive")) +""" +function PetscDSGetComponentDerivativeOffsetsCohesive(petsclib::PetscLibType, ds::PetscDS, s::PetscInt) end + +@for_petsc function PetscDSGetComponentDerivativeOffsetsCohesive(petsclib::$UnionPetscLib, ds::PetscDS, s::$PetscInt ) + offsets_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscDSGetComponentDerivativeOffsetsCohesive, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{Ptr{$PetscInt}}), + ds, s, offsets_, + ) + + offsets = unsafe_wrap(Array, offsets_[], VecGetLocalSize(petsclib, x); own = false) + + return offsets +end + +""" + PetscDSGetTabulation(petsclib::PetscLibType,prob::PetscDS, T::Vector{PetscTabulation}) +Return the basis tabulation at quadrature points for the volume discretization + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `T` - The basis function and derivatives tabulation at quadrature points for each field, see `PetscTabulation` for its details + +Level: intermediate + +-seealso: `PetscDS`, `PetscTabulation`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetTabulation")) +""" +function PetscDSGetTabulation(petsclib::PetscLibType, prob::PetscDS, T::Vector{PetscTabulation}) end + +@for_petsc function PetscDSGetTabulation(petsclib::$UnionPetscLib, prob::PetscDS, T::Vector{PetscTabulation} ) + T_ = Ref(pointer(T)) + + @chk ccall( + (:PetscDSGetTabulation, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{Ptr{PetscTabulation}}), + prob, T_, + ) + + + return nothing +end + +""" + PetscDSGetFaceTabulation(petsclib::PetscLibType,prob::PetscDS, Tf::Vector{PetscTabulation}) +Return the basis tabulation at quadrature points on the faces + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `Tf` - The basis function and derivative tabulation on each local face at quadrature points for each field + +Level: intermediate + +-seealso: `PetscTabulation`, `PetscDS`, `PetscDSGetTabulation()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSGetFaceTabulation")) +""" +function PetscDSGetFaceTabulation(petsclib::PetscLibType, prob::PetscDS, Tf::Vector{PetscTabulation}) end + +@for_petsc function PetscDSGetFaceTabulation(petsclib::$UnionPetscLib, prob::PetscDS, Tf::Vector{PetscTabulation} ) + Tf_ = Ref(pointer(Tf)) + + @chk ccall( + (:PetscDSGetFaceTabulation, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{Ptr{PetscTabulation}}), + prob, Tf_, + ) + + + return nothing +end + +""" + u::Vector{PetscScalar},u_t::Vector{PetscScalar},u_x::Vector{PetscScalar} = PetscDSGetEvaluationArrays(petsclib::PetscLibType,prob::PetscDS) + +# External Links +$(_doc_external("Dm/PetscDSGetEvaluationArrays")) +""" +function PetscDSGetEvaluationArrays(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetEvaluationArrays(petsclib::$UnionPetscLib, prob::PetscDS ) + u_ = Ref{Ptr{$PetscScalar}}() + u_t_ = Ref{Ptr{$PetscScalar}}() + u_x_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:PetscDSGetEvaluationArrays, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}), + prob, u_, u_t_, u_x_, + ) + + u = unsafe_wrap(Array, u_[], VecGetLocalSize(petsclib, x); own = false) + u_t = unsafe_wrap(Array, u_t_[], VecGetLocalSize(petsclib, x); own = false) + u_x = unsafe_wrap(Array, u_x_[], VecGetLocalSize(petsclib, x); own = false) + + return u,u_t,u_x +end + +""" + f0::Vector{PetscScalar},f1::Vector{PetscScalar},g0::Vector{PetscScalar},g1::Vector{PetscScalar},g2::Vector{PetscScalar},g3::Vector{PetscScalar} = PetscDSGetWeakFormArrays(petsclib::PetscLibType,prob::PetscDS) + +# External Links +$(_doc_external("Dm/PetscDSGetWeakFormArrays")) +""" +function PetscDSGetWeakFormArrays(petsclib::PetscLibType, prob::PetscDS) end + +@for_petsc function PetscDSGetWeakFormArrays(petsclib::$UnionPetscLib, prob::PetscDS ) + f0_ = Ref{Ptr{$PetscScalar}}() + f1_ = Ref{Ptr{$PetscScalar}}() + g0_ = Ref{Ptr{$PetscScalar}}() + g1_ = Ref{Ptr{$PetscScalar}}() + g2_ = Ref{Ptr{$PetscScalar}}() + g3_ = Ref{Ptr{$PetscScalar}}() + + @chk ccall( + (:PetscDSGetWeakFormArrays, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}, Ptr{Ptr{$PetscScalar}}), + prob, f0_, f1_, g0_, g1_, g2_, g3_, + ) + + f0 = unsafe_wrap(Array, f0_[], VecGetLocalSize(petsclib, x); own = false) + f1 = unsafe_wrap(Array, f1_[], VecGetLocalSize(petsclib, x); own = false) + g0 = unsafe_wrap(Array, g0_[], VecGetLocalSize(petsclib, x); own = false) + g1 = unsafe_wrap(Array, g1_[], VecGetLocalSize(petsclib, x); own = false) + g2 = unsafe_wrap(Array, g2_[], VecGetLocalSize(petsclib, x); own = false) + g3 = unsafe_wrap(Array, g3_[], VecGetLocalSize(petsclib, x); own = false) + + return f0,f1,g0,g1,g2,g3 +end + +""" + PetscDSGetWorkspace(petsclib::PetscLibType,prob::PetscDS, x::PetscReal, basisReal::PetscScalar, basisDerReal::PetscScalar, testReal::PetscScalar, testDerReal::PetscScalar) + +# External Links +$(_doc_external("Dm/PetscDSGetWorkspace")) +""" +function PetscDSGetWorkspace(petsclib::PetscLibType, prob::PetscDS, x::PetscReal, basisReal::PetscScalar, basisDerReal::PetscScalar, testReal::PetscScalar, testDerReal::PetscScalar) end + +@for_petsc function PetscDSGetWorkspace(petsclib::$UnionPetscLib, prob::PetscDS, x::$PetscReal, basisReal::$PetscScalar, basisDerReal::$PetscScalar, testReal::$PetscScalar, testDerReal::$PetscScalar ) + + @chk ccall( + (:PetscDSGetWorkspace, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscReal, $PetscScalar, $PetscScalar, $PetscScalar, $PetscScalar), + prob, x, basisReal, basisDerReal, testReal, testDerReal, + ) + + + return nothing +end + +""" + bd::PetscInt = PetscDSAddBoundary(petsclib::PetscLibType,ds::PetscDS, type::DMBoundaryConditionType, name::String, label::DMLabel, Nv::PetscInt, values::Vector{PetscInt}, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid) +Add a boundary condition to the model. + +Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `type` - The type of condition, e.g. `DM_BC_ESSENTIAL`/`DM_BC_ESSENTIAL_FIELD` (Dirichlet), or `DM_BC_NATURAL` (Neumann) +- `name` - The name for the boundary condition +- `label` - The label defining constrained points +- `Nv` - The number of `DMLabel` values for constrained points +- `values` - An array of label values for constrained points +- `field` - The field to constrain +- `Nc` - The number of constrained field components (0 will constrain all fields) +- `comps` - An array of constrained component numbers +- `bcFunc` - A pointwise function giving boundary values +- `bcFunc_t` - A pointwise function giving the time derivative of the boundary values, or `NULL` +- `ctx` - An optional user context for `bcFunc` + +Output Parameter: +- `bd` - The boundary number + +Options Database Keys: +- `-bc_ ` - Overrides the boundary ids +- `-bc__comp ` - Overrides the boundary components + +Level: developer + +-seealso: `PetscDS`, `PetscWeakForm`, `DMLabel`, `DMBoundaryConditionType`, `PetscDSAddBoundaryByName()`, `PetscDSGetBoundary()`, `PetscDSSetResidual()`, `PetscDSSetBdResidual()` + +# External Links +$(_doc_external("Dm/PetscDSAddBoundary")) +""" +function PetscDSAddBoundary(petsclib::PetscLibType, ds::PetscDS, type::DMBoundaryConditionType, name::String, label::DMLabel, Nv::PetscInt, values::Vector{PetscInt}, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid) end + +@for_petsc function PetscDSAddBoundary(petsclib::$UnionPetscLib, ds::PetscDS, type::DMBoundaryConditionType, name::String, label::DMLabel, Nv::$PetscInt, values::Vector{$PetscInt}, field::$PetscInt, Nc::$PetscInt, comps::Vector{$PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid ) + bd_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSAddBoundary, $petsc_library), + PetscErrorCode, + (PetscDS, DMBoundaryConditionType, Ptr{Cchar}, DMLabel, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{PetscVoidFn}, Ptr{PetscVoidFn}, Ptr{Cvoid}, Ptr{$PetscInt}), + ds, type, name, label, Nv, values, field, Nc, comps, bcFunc, bcFunc_t, ctx, bd_, + ) + + bd = bd_[] + + return bd +end + +""" + bd::PetscInt = PetscDSAddBoundaryByName(petsclib::PetscLibType,ds::PetscDS, type::DMBoundaryConditionType, name::String, lname::String, Nv::PetscInt, values::Vector{PetscInt}, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid) +Add a boundary condition to the model. + +Collective + +Input Parameters: +- `ds` - The `PetscDS` object +- `type` - The type of condition, e.g. `DM_BC_ESSENTIAL`/`DM_BC_ESSENTIAL_FIELD` (Dirichlet), or `DM_BC_NATURAL` (Neumann) +- `name` - The boundary condition name +- `lname` - The name of the label defining constrained points +- `Nv` - The number of `DMLabel` values for constrained points +- `values` - An array of label values for constrained points +- `field` - The field to constrain +- `Nc` - The number of constrained field components (0 will constrain all fields) +- `comps` - An array of constrained component numbers +- `bcFunc` - A pointwise function giving boundary values +- `bcFunc_t` - A pointwise function giving the time derivative of the boundary values, or `NULL` +- `ctx` - An optional user context for `bcFunc` + +Output Parameter: +- `bd` - The boundary number + +Options Database Keys: +- `-bc_ ` - Overrides the boundary ids +- `-bc__comp ` - Overrides the boundary components + +Calling Sequence of `bcFunc` and `bcFunc_t`: +If the type is `DM_BC_ESSENTIAL` +-seealso: `PetscDS`, `PetscWeakForm`, `DMLabel`, `DMBoundaryConditionType`, `PetscDSAddBoundary()`, `PetscDSGetBoundary()`, `PetscDSSetResidual()`, `PetscDSSetBdResidual()` + +# External Links +$(_doc_external("Dm/PetscDSAddBoundaryByName")) +""" +function PetscDSAddBoundaryByName(petsclib::PetscLibType, ds::PetscDS, type::DMBoundaryConditionType, name::String, lname::String, Nv::PetscInt, values::Vector{PetscInt}, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid) end + +@for_petsc function PetscDSAddBoundaryByName(petsclib::$UnionPetscLib, ds::PetscDS, type::DMBoundaryConditionType, name::String, lname::String, Nv::$PetscInt, values::Vector{$PetscInt}, field::$PetscInt, Nc::$PetscInt, comps::Vector{$PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid ) + bd_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSAddBoundaryByName, $petsc_library), + PetscErrorCode, + (PetscDS, DMBoundaryConditionType, Ptr{Cchar}, Ptr{Cchar}, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{PetscVoidFn}, Ptr{PetscVoidFn}, Ptr{Cvoid}, Ptr{$PetscInt}), + ds, type, name, lname, Nv, values, field, Nc, comps, bcFunc, bcFunc_t, ctx, bd_, + ) + + bd = bd_[] + + return bd +end + +""" + PetscDSUpdateBoundary(petsclib::PetscLibType,ds::PetscDS, bd::PetscInt, type::DMBoundaryConditionType, name::String, label::DMLabel, Nv::PetscInt, values::Vector{PetscInt}, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid) +Change a boundary condition for the model. + +Input Parameters: +- `ds` - The `PetscDS` object +- `bd` - The boundary condition number +- `type` - The type of condition, e.g. `DM_BC_ESSENTIAL`/`DM_BC_ESSENTIAL_FIELD` (Dirichlet), or `DM_BC_NATURAL` (Neumann) +- `name` - The boundary condition name +- `label` - The label defining constrained points +- `Nv` - The number of `DMLabel` ids for constrained points +- `values` - An array of ids for constrained points +- `field` - The field to constrain +- `Nc` - The number of constrained field components +- `comps` - An array of constrained component numbers +- `bcFunc` - A pointwise function giving boundary values +- `bcFunc_t` - A pointwise function giving the time derivative of the boundary values, or `NULL` +- `ctx` - An optional user context for `bcFunc` + +Level: developer + +-seealso: `PetscDS`, `PetscWeakForm`, `DMBoundaryConditionType`, `PetscDSAddBoundary()`, `PetscDSGetBoundary()`, `PetscDSGetNumBoundary()`, `DMLabel` + +# External Links +$(_doc_external("Dm/PetscDSUpdateBoundary")) +""" +function PetscDSUpdateBoundary(petsclib::PetscLibType, ds::PetscDS, bd::PetscInt, type::DMBoundaryConditionType, name::String, label::DMLabel, Nv::PetscInt, values::Vector{PetscInt}, field::PetscInt, Nc::PetscInt, comps::Vector{PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid) end + +@for_petsc function PetscDSUpdateBoundary(petsclib::$UnionPetscLib, ds::PetscDS, bd::$PetscInt, type::DMBoundaryConditionType, name::String, label::DMLabel, Nv::$PetscInt, values::Vector{$PetscInt}, field::$PetscInt, Nc::$PetscInt, comps::Vector{$PetscInt}, bcFunc::PetscVoidFn, bcFunc_t::PetscVoidFn, ctx::Cvoid ) + + @chk ccall( + (:PetscDSUpdateBoundary, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, DMBoundaryConditionType, Ptr{Cchar}, DMLabel, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{PetscVoidFn}, Ptr{PetscVoidFn}, Ptr{Cvoid}), + ds, bd, type, name, label, Nv, values, field, Nc, comps, bcFunc, bcFunc_t, ctx, + ) + + + return nothing +end + +""" + numBd::PetscInt = PetscDSGetNumBoundary(petsclib::PetscLibType,ds::PetscDS) +Get the number of registered boundary conditions + +Input Parameter: +- `ds` - The `PetscDS` object + +Output Parameter: +- `numBd` - The number of boundary conditions + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSAddBoundary()`, `PetscDSGetBoundary()` + +# External Links +$(_doc_external("Dm/PetscDSGetNumBoundary")) +""" +function PetscDSGetNumBoundary(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSGetNumBoundary(petsclib::$UnionPetscLib, ds::PetscDS ) + numBd_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSGetNumBoundary, $petsc_library), + PetscErrorCode, + (PetscDS, Ptr{$PetscInt}), + ds, numBd_, + ) + + numBd = numBd_[] + + return numBd +end + +""" + Nv::PetscInt,values::Vector{PetscInt},field::PetscInt,Nc::PetscInt,comps::Vector{PetscInt} = PetscDSGetBoundary(petsclib::PetscLibType,ds::PetscDS, bd::PetscInt, wf::PetscWeakForm, type::DMBoundaryConditionType, name::String, label::DMLabel, func::PetscVoidFn, func_t::PetscVoidFn, ctx::Cvoid) +Gets a boundary condition from the model + +Input Parameters: +- `ds` - The `PetscDS` object +- `bd` - The boundary condition number + +Output Parameters: +- `wf` - The `PetscWeakForm` holding the pointwise functions +- `type` - The type of condition, e.g. `DM_BC_ESSENTIAL`/`DM_BC_ESSENTIAL_FIELD` (Dirichlet), or `DM_BC_NATURAL` (Neumann) +- `name` - The boundary condition name +- `label` - The label defining constrained points +- `Nv` - The number of `DMLabel` ids for constrained points +- `values` - An array of ids for constrained points +- `field` - The field to constrain +- `Nc` - The number of constrained field components +- `comps` - An array of constrained component numbers +- `func` - A pointwise function giving boundary values +- `func_t` - A pointwise function giving the time derivative of the boundary values +- `ctx` - An optional user context for `bcFunc` + +Options Database Keys: +- `-bc_ ` - Overrides the boundary ids +- `-bc__comp ` - Overrides the boundary components + +Level: developer + +-seealso: `PetscDS`, `PetscWeakForm`, `DMBoundaryConditionType`, `PetscDSAddBoundary()`, `DMLabel` + +# External Links +$(_doc_external("Dm/PetscDSGetBoundary")) +""" +function PetscDSGetBoundary(petsclib::PetscLibType, ds::PetscDS, bd::PetscInt, wf::PetscWeakForm, type::DMBoundaryConditionType, name::String, label::DMLabel, func::PetscVoidFn, func_t::PetscVoidFn, ctx::Cvoid) end + +@for_petsc function PetscDSGetBoundary(petsclib::$UnionPetscLib, ds::PetscDS, bd::$PetscInt, wf::PetscWeakForm, type::DMBoundaryConditionType, name::String, label::DMLabel, func::PetscVoidFn, func_t::PetscVoidFn, ctx::Cvoid ) + name_ = Ref(pointer(name)) + Nv_ = Ref{$PetscInt}() + values_ = Ref{Ptr{$PetscInt}}() + field_ = Ref{$PetscInt}() + Nc_ = Ref{$PetscInt}() + comps_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscDSGetBoundary, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscWeakForm}, Ptr{DMBoundaryConditionType}, Ptr{Ptr{Cchar}}, Ptr{DMLabel}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, PetscVoidFn, PetscVoidFn, Cvoid), + ds, bd, wf, type, name_, label, Nv_, values_, field_, Nc_, comps_, func, func_t, ctx, + ) + + Nv = Nv_[] + values = unsafe_wrap(Array, values_[], VecGetLocalSize(petsclib, x); own = false) + field = field_[] + Nc = Nc_[] + comps = unsafe_wrap(Array, comps_[], VecGetLocalSize(petsclib, x); own = false) + + return Nv,values,field,Nc,comps +end + +""" + PetscDSUpdateBoundaryLabels(petsclib::PetscLibType,ds::PetscDS, dm::PetscDM) +Update `DMLabel` in each boundary condition using the label name and the input `DM` + +Not Collective + +Input Parameters: +- `ds` - The source `PetscDS` object +- `dm` - The `DM` holding labels + +Level: intermediate + +-seealso: `PetscDS`, `DMBoundary`, `DM`, `PetscDSCopyBoundary()`, `PetscDSCreate()`, `DMGetLabel()` + +# External Links +$(_doc_external("Dm/PetscDSUpdateBoundaryLabels")) +""" +function PetscDSUpdateBoundaryLabels(petsclib::PetscLibType, ds::PetscDS, dm::PetscDM) end + +@for_petsc function PetscDSUpdateBoundaryLabels(petsclib::$UnionPetscLib, ds::PetscDS, dm::PetscDM ) + + @chk ccall( + (:PetscDSUpdateBoundaryLabels, $petsc_library), + PetscErrorCode, + (PetscDS, CDM), + ds, dm, + ) + + + return nothing +end + +""" + PetscDSCopyBoundary(petsclib::PetscLibType,ds::PetscDS, numFields::PetscInt, fields::Vector{PetscInt}, newds::PetscDS) +Copy all boundary condition objects to the new `PetscDS` + +Not Collective + +Input Parameters: +- `ds` - The source `PetscDS` object +- `numFields` - The number of selected fields, or `PETSC_DEFAULT` for all fields +- `fields` - The selected fields, or `NULL` for all fields + +Output Parameter: +- `newds` - The target `PetscDS`, now with a copy of the boundary conditions + +Level: intermediate + +-seealso: `PetscDS`, `DMBoundary`, `PetscDSCopyEquations()`, `PetscDSSetResidual()`, `PetscDSSetJacobian()`, `PetscDSSetRiemannSolver()`, `PetscDSSetBdResidual()`, `PetscDSSetBdJacobian()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSCopyBoundary")) +""" +function PetscDSCopyBoundary(petsclib::PetscLibType, ds::PetscDS, numFields::PetscInt, fields::Vector{PetscInt}, newds::PetscDS) end + +@for_petsc function PetscDSCopyBoundary(petsclib::$UnionPetscLib, ds::PetscDS, numFields::$PetscInt, fields::Vector{$PetscInt}, newds::PetscDS ) + + @chk ccall( + (:PetscDSCopyBoundary, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{$PetscInt}, PetscDS), + ds, numFields, fields, newds, + ) + + + return nothing +end + +""" + PetscDSDestroyBoundary(petsclib::PetscLibType,ds::PetscDS) +Remove all `DMBoundary` objects from the `PetscDS` + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` object + +Level: intermediate + +-seealso: `PetscDS`, `DMBoundary`, `PetscDSCopyBoundary()`, `PetscDSCopyEquations()` + +# External Links +$(_doc_external("Dm/PetscDSDestroyBoundary")) +""" +function PetscDSDestroyBoundary(petsclib::PetscLibType, ds::PetscDS) end + +@for_petsc function PetscDSDestroyBoundary(petsclib::$UnionPetscLib, ds::PetscDS ) + + @chk ccall( + (:PetscDSDestroyBoundary, $petsc_library), + PetscErrorCode, + (PetscDS,), + ds, + ) + + + return nothing +end + +""" + PetscDSSelectDiscretizations(petsclib::PetscLibType,prob::PetscDS, numFields::PetscInt, fields::Vector{PetscInt}, minDegree::PetscInt, maxDegree::PetscInt, newprob::PetscDS) +Copy discretizations to the new `PetscDS` with different field layout + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `numFields` - Number of new fields +- `fields` - Old field number for each new field +- `minDegree` - Minimum degree for a discretization, or `PETSC_DETERMINE` for no limit +- `maxDegree` - Maximum degree for a discretization, or `PETSC_DETERMINE` for no limit + +Output Parameter: +- `newprob` - The `PetscDS` copy + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSSelectEquations()`, `PetscDSCopyBoundary()`, `PetscDSSetResidual()`, `PetscDSSetJacobian()`, `PetscDSSetRiemannSolver()`, `PetscDSSetBdResidual()`, `PetscDSSetBdJacobian()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSelectDiscretizations")) +""" +function PetscDSSelectDiscretizations(petsclib::PetscLibType, prob::PetscDS, numFields::PetscInt, fields::Vector{PetscInt}, minDegree::PetscInt, maxDegree::PetscInt, newprob::PetscDS) end + +@for_petsc function PetscDSSelectDiscretizations(petsclib::$UnionPetscLib, prob::PetscDS, numFields::$PetscInt, fields::Vector{$PetscInt}, minDegree::$PetscInt, maxDegree::$PetscInt, newprob::PetscDS ) + + @chk ccall( + (:PetscDSSelectDiscretizations, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscInt, PetscDS), + prob, numFields, fields, minDegree, maxDegree, newprob, + ) + + + return nothing +end + +""" + PetscDSSelectEquations(petsclib::PetscLibType,prob::PetscDS, numFields::PetscInt, fields::Vector{PetscInt}, newprob::PetscDS) +Copy pointwise function pointers to the new `PetscDS` with different field layout + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` object +- `numFields` - Number of new fields +- `fields` - Old field number for each new field + +Output Parameter: +- `newprob` - The `PetscDS` copy + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSSelectDiscretizations()`, `PetscDSCopyBoundary()`, `PetscDSSetResidual()`, `PetscDSSetJacobian()`, `PetscDSSetRiemannSolver()`, `PetscDSSetBdResidual()`, `PetscDSSetBdJacobian()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSSelectEquations")) +""" +function PetscDSSelectEquations(petsclib::PetscLibType, prob::PetscDS, numFields::PetscInt, fields::Vector{PetscInt}, newprob::PetscDS) end + +@for_petsc function PetscDSSelectEquations(petsclib::$UnionPetscLib, prob::PetscDS, numFields::$PetscInt, fields::Vector{$PetscInt}, newprob::PetscDS ) + + @chk ccall( + (:PetscDSSelectEquations, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{$PetscInt}, PetscDS), + prob, numFields, fields, newprob, + ) + + + return nothing +end + +""" + PetscDSCopyEquations(petsclib::PetscLibType,prob::PetscDS, newprob::PetscDS) +Copy all pointwise function pointers to another `PetscDS` + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `newprob` - The `PetscDS` copy + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSCopyBoundary()`, `PetscDSSetResidual()`, `PetscDSSetJacobian()`, `PetscDSSetRiemannSolver()`, `PetscDSSetBdResidual()`, `PetscDSSetBdJacobian()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSCopyEquations")) +""" +function PetscDSCopyEquations(petsclib::PetscLibType, prob::PetscDS, newprob::PetscDS) end + +@for_petsc function PetscDSCopyEquations(petsclib::$UnionPetscLib, prob::PetscDS, newprob::PetscDS ) + + @chk ccall( + (:PetscDSCopyEquations, $petsc_library), + PetscErrorCode, + (PetscDS, PetscDS), + prob, newprob, + ) + + + return nothing +end + +""" + PetscDSCopyConstants(petsclib::PetscLibType,prob::PetscDS, newprob::PetscDS) +Copy all constants set with `PetscDSSetConstants()` to another `PetscDS` + +Not Collective + +Input Parameter: +- `prob` - The `PetscDS` object + +Output Parameter: +- `newprob` - The `PetscDS` copy + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSCopyBoundary()`, `PetscDSCopyEquations()`, `PetscDSSetResidual()`, `PetscDSSetJacobian()`, `PetscDSSetRiemannSolver()`, `PetscDSSetBdResidual()`, `PetscDSSetBdJacobian()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSCopyConstants")) +""" +function PetscDSCopyConstants(petsclib::PetscLibType, prob::PetscDS, newprob::PetscDS) end + +@for_petsc function PetscDSCopyConstants(petsclib::$UnionPetscLib, prob::PetscDS, newprob::PetscDS ) + + @chk ccall( + (:PetscDSCopyConstants, $petsc_library), + PetscErrorCode, + (PetscDS, PetscDS), + prob, newprob, + ) + + + return nothing +end + +""" + PetscDSCopyExactSolutions(petsclib::PetscLibType,ds::PetscDS, newds::PetscDS) +Copy all exact solutions set with `PetscDSSetExactSolution()` and `PetscDSSetExactSolutionTimeDerivative()` to another `PetscDS` + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` object + +Output Parameter: +- `newds` - The `PetscDS` copy + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSCopyBoundary()`, `PetscDSCopyEquations()`, `PetscDSCopyBounds()`, `PetscDSSetResidual()`, `PetscDSSetJacobian()`, `PetscDSSetRiemannSolver()`, `PetscDSSetBdResidual()`, `PetscDSSetBdJacobian()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSCopyExactSolutions")) +""" +function PetscDSCopyExactSolutions(petsclib::PetscLibType, ds::PetscDS, newds::PetscDS) end + +@for_petsc function PetscDSCopyExactSolutions(petsclib::$UnionPetscLib, ds::PetscDS, newds::PetscDS ) + + @chk ccall( + (:PetscDSCopyExactSolutions, $petsc_library), + PetscErrorCode, + (PetscDS, PetscDS), + ds, newds, + ) + + + return nothing +end + +""" + PetscDSCopyBounds(petsclib::PetscLibType,ds::PetscDS, newds::PetscDS) +Copy lower and upper solution bounds set with `PetscDSSetLowerBound()` and `PetscDSSetLowerBound()` to another `PetscDS` + +Not Collective + +Input Parameter: +- `ds` - The `PetscDS` object + +Output Parameter: +- `newds` - The `PetscDS` copy + +Level: intermediate + +-seealso: `PetscDS`, `PetscDSCopyBoundary()`, `PetscDSCopyEquations()`, `PetscDSCopyExactSolutions()`, `PetscDSSetResidual()`, `PetscDSSetJacobian()`, `PetscDSSetRiemannSolver()`, `PetscDSSetBdResidual()`, `PetscDSSetBdJacobian()`, `PetscDSCreate()` + +# External Links +$(_doc_external("Dm/PetscDSCopyBounds")) +""" +function PetscDSCopyBounds(petsclib::PetscLibType, ds::PetscDS, newds::PetscDS) end + +@for_petsc function PetscDSCopyBounds(petsclib::$UnionPetscLib, ds::PetscDS, newds::PetscDS ) + + @chk ccall( + (:PetscDSCopyBounds, $petsc_library), + PetscErrorCode, + (PetscDS, PetscDS), + ds, newds, + ) + + + return nothing +end + +""" + PetscDSCopy(petsclib::PetscLibType,ds::PetscDS, minDegree::PetscInt, maxDegree::PetscInt, dmNew::PetscDM, dsNew::PetscDS) + +# External Links +$(_doc_external("Dm/PetscDSCopy")) +""" +function PetscDSCopy(petsclib::PetscLibType, ds::PetscDS, minDegree::PetscInt, maxDegree::PetscInt, dmNew::PetscDM, dsNew::PetscDS) end + +@for_petsc function PetscDSCopy(petsclib::$UnionPetscLib, ds::PetscDS, minDegree::$PetscInt, maxDegree::$PetscInt, dmNew::PetscDM, dsNew::PetscDS ) + + @chk ccall( + (:PetscDSCopy, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, CDM, PetscDS), + ds, minDegree, maxDegree, dmNew, dsNew, + ) + + + return nothing +end + +""" + PetscDSGetHeightSubspace(petsclib::PetscLibType,prob::PetscDS, height::PetscInt, subprob::PetscDS) + +# External Links +$(_doc_external("Dm/PetscDSGetHeightSubspace")) +""" +function PetscDSGetHeightSubspace(petsclib::PetscLibType, prob::PetscDS, height::PetscInt, subprob::PetscDS) end + +@for_petsc function PetscDSGetHeightSubspace(petsclib::$UnionPetscLib, prob::PetscDS, height::$PetscInt, subprob::PetscDS ) + + @chk ccall( + (:PetscDSGetHeightSubspace, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{PetscDS}), + prob, height, subprob, + ) + + + return nothing +end + +""" + qperm::PetscInt = PetscDSPermuteQuadPoint(petsclib::PetscLibType,ds::PetscDS, ornt::PetscInt, field::PetscInt, q::PetscInt) + +# External Links +$(_doc_external("Dm/PetscDSPermuteQuadPoint")) +""" +function PetscDSPermuteQuadPoint(petsclib::PetscLibType, ds::PetscDS, ornt::PetscInt, field::PetscInt, q::PetscInt) end + +@for_petsc function PetscDSPermuteQuadPoint(petsclib::$UnionPetscLib, ds::PetscDS, ornt::$PetscInt, field::$PetscInt, q::$PetscInt ) + qperm_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDSPermuteQuadPoint, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}), + ds, ornt, field, q, qperm_, + ) + + qperm = qperm_[] + + return qperm +end + diff --git a/src/autowrapped/PetscDevice_wrappers.jl b/src/autowrapped/PetscDevice_wrappers.jl new file mode 100644 index 00000000..878c18fb --- /dev/null +++ b/src/autowrapped/PetscDevice_wrappers.jl @@ -0,0 +1,727 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscDevice end +const PetscDevice = Ptr{_n_PetscDevice} + +mutable struct _n_PetscDeviceContext end +const PetscDeviceContext = Ptr{_n_PetscDeviceContext} +# ------------------------------------------------------- + +""" + device::PetscDevice = PetscDeviceCreate(petsclib::PetscLibType,type::PetscDeviceType, devid::PetscInt) + +# External Links +$(_doc_external("Sys/PetscDeviceCreate")) +""" +function PetscDeviceCreate(petsclib::PetscLibType, type::PetscDeviceType, devid::PetscInt) end + +@for_petsc function PetscDeviceCreate(petsclib::$UnionPetscLib, type::PetscDeviceType, devid::$PetscInt ) + device_ = Ref{PetscDevice}() + + @chk ccall( + (:PetscDeviceCreate, $petsc_library), + PetscErrorCode, + (PetscDeviceType, $PetscInt, Ptr{PetscDevice}), + type, devid, device_, + ) + + device = device_[] + + return device +end + +""" + PetscDeviceDestroy(petsclib::PetscLibType,device::PetscDevice) + +# External Links +$(_doc_external("Sys/PetscDeviceDestroy")) +""" +function PetscDeviceDestroy(petsclib::PetscLibType, device::PetscDevice) end + +@for_petsc function PetscDeviceDestroy(petsclib::$UnionPetscLib, device::PetscDevice ) + + @chk ccall( + (:PetscDeviceDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDevice},), + device, + ) + + + return nothing +end + +""" + PetscDeviceConfigure(petsclib::PetscLibType,device::PetscDevice) + +# External Links +$(_doc_external("Sys/PetscDeviceConfigure")) +""" +function PetscDeviceConfigure(petsclib::PetscLibType, device::PetscDevice) end + +@for_petsc function PetscDeviceConfigure(petsclib::$UnionPetscLib, device::PetscDevice ) + + @chk ccall( + (:PetscDeviceConfigure, $petsc_library), + PetscErrorCode, + (PetscDevice,), + device, + ) + + + return nothing +end + +""" + PetscDeviceView(petsclib::PetscLibType,device::PetscDevice, viewer::PetscViewer) + +# External Links +$(_doc_external("Sys/PetscDeviceView")) +""" +function PetscDeviceView(petsclib::PetscLibType, device::PetscDevice, viewer::PetscViewer) end + +@for_petsc function PetscDeviceView(petsclib::$UnionPetscLib, device::PetscDevice, viewer::PetscViewer ) + + @chk ccall( + (:PetscDeviceView, $petsc_library), + PetscErrorCode, + (PetscDevice, PetscViewer), + device, viewer, + ) + + + return nothing +end + +""" + type::PetscDeviceType = PetscDeviceGetType(petsclib::PetscLibType,device::PetscDevice) + +# External Links +$(_doc_external("Sys/PetscDeviceGetType")) +""" +function PetscDeviceGetType(petsclib::PetscLibType, device::PetscDevice) end + +@for_petsc function PetscDeviceGetType(petsclib::$UnionPetscLib, device::PetscDevice ) + type_ = Ref{PetscDeviceType}() + + @chk ccall( + (:PetscDeviceGetType, $petsc_library), + PetscErrorCode, + (PetscDevice, Ptr{PetscDeviceType}), + device, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + id::PetscInt = PetscDeviceGetDeviceId(petsclib::PetscLibType,device::PetscDevice) + +# External Links +$(_doc_external("Sys/PetscDeviceGetDeviceId")) +""" +function PetscDeviceGetDeviceId(petsclib::PetscLibType, device::PetscDevice) end + +@for_petsc function PetscDeviceGetDeviceId(petsclib::$UnionPetscLib, device::PetscDevice ) + id_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDeviceGetDeviceId, $petsc_library), + PetscErrorCode, + (PetscDevice, Ptr{$PetscInt}), + device, id_, + ) + + id = id_[] + + return id +end + +""" + PetscDeviceSetDefaultDeviceType(petsclib::PetscLibType,type::PetscDeviceType) + +# External Links +$(_doc_external("Sys/PetscDeviceSetDefaultDeviceType")) +""" +function PetscDeviceSetDefaultDeviceType(petsclib::PetscLibType, type::PetscDeviceType) end + +@for_petsc function PetscDeviceSetDefaultDeviceType(petsclib::$UnionPetscLib, type::PetscDeviceType ) + + @chk ccall( + (:PetscDeviceSetDefaultDeviceType, $petsc_library), + PetscErrorCode, + (PetscDeviceType,), + type, + ) + + + return nothing +end + +""" + PetscDeviceInitialize(petsclib::PetscLibType,type::PetscDeviceType) + +# External Links +$(_doc_external("Sys/PetscDeviceInitialize")) +""" +function PetscDeviceInitialize(petsclib::PetscLibType, type::PetscDeviceType) end + +@for_petsc function PetscDeviceInitialize(petsclib::$UnionPetscLib, type::PetscDeviceType ) + + @chk ccall( + (:PetscDeviceInitialize, $petsc_library), + PetscErrorCode, + (PetscDeviceType,), + type, + ) + + + return nothing +end + +""" + PetscDeviceMemcpy(petsclib::PetscLibType,dctx::PetscDeviceContext, dest::Cvoid, src::Cvoid, n_std::Csize_t) + +# External Links +$(_doc_external("Sys/PetscDeviceMemcpy")) +""" +function PetscDeviceMemcpy(petsclib::PetscLibType, dctx::PetscDeviceContext, dest::Cvoid, src::Cvoid, n_std::Csize_t) end + +@for_petsc function PetscDeviceMemcpy(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, dest::Cvoid, src::Cvoid, n_std::Csize_t ) + + @chk ccall( + (:PetscDeviceMemcpy, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), + dctx, dest, src, n_std, + ) + + + return nothing +end + +""" + PetscDeviceMemset(petsclib::PetscLibType,dctx::PetscDeviceContext, ptr::Cvoid, v::PetscInt, n_std::Csize_t) + +# External Links +$(_doc_external("Sys/PetscDeviceMemset")) +""" +function PetscDeviceMemset(petsclib::PetscLibType, dctx::PetscDeviceContext, ptr::Cvoid, v::PetscInt, n_std::Csize_t) end + +@for_petsc function PetscDeviceMemset(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, ptr::Cvoid, v::$PetscInt, n_std::Csize_t ) + + @chk ccall( + (:PetscDeviceMemset, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, Ptr{Cvoid}, $PetscInt, Csize_t), + dctx, ptr, v, n_std, + ) + + + return nothing +end + +""" + PetscDeviceFinalizePackage(petsclib::PetscLibType) +This function cleans up all components of the `PetscDevice` +package. It is called from `PetscFinalize()`. + +-seealso: `PetscFinalize()`, `PetscDeviceInitializePackage()` + +# External Links +$(_doc_external("Sys/PetscDeviceFinalizePackage")) +""" +function PetscDeviceFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscDeviceFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscDeviceFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscDeviceInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PetscDevice` +package. It is called on the first call to `PetscDeviceContextCreate()` or +`PetscDeviceCreate()` when using shared or static libraries. + +Level: developer + +-seealso: `PetscInitialize()`, `PetscDeviceFinalizePackage()`, `PetscDeviceContextCreate()`, +`PetscDeviceCreate()` + +# External Links +$(_doc_external("Sys/PetscDeviceInitializePackage")) +""" +function PetscDeviceInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscDeviceInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscDeviceInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscDeviceContextGetCurrentContext(petsclib::PetscLibType,dctx::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextGetCurrentContext")) +""" +function PetscDeviceContextGetCurrentContext(petsclib::PetscLibType, dctx::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextGetCurrentContext(petsclib::$UnionPetscLib, dctx::PetscDeviceContext ) + + @chk ccall( + (:PetscDeviceContextGetCurrentContext, $petsc_library), + PetscErrorCode, + (Ptr{PetscDeviceContext},), + dctx, + ) + + + return nothing +end + +""" + PetscDeviceContextSetCurrentContext(petsclib::PetscLibType,dctx::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextSetCurrentContext")) +""" +function PetscDeviceContextSetCurrentContext(petsclib::PetscLibType, dctx::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextSetCurrentContext(petsclib::$UnionPetscLib, dctx::PetscDeviceContext ) + + @chk ccall( + (:PetscDeviceContextSetCurrentContext, $petsc_library), + PetscErrorCode, + (PetscDeviceContext,), + dctx, + ) + + + return nothing +end + +""" + dctx::PetscDeviceContext = PetscDeviceContextCreate(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscDeviceContextCreate")) +""" +function PetscDeviceContextCreate(petsclib::PetscLibType) end + +@for_petsc function PetscDeviceContextCreate(petsclib::$UnionPetscLib) + dctx_ = Ref{PetscDeviceContext}() + + @chk ccall( + (:PetscDeviceContextCreate, $petsc_library), + PetscErrorCode, + (Ptr{PetscDeviceContext},), + dctx_, + ) + + dctx = dctx_[] + + return dctx +end + +""" + PetscDeviceContextDestroy(petsclib::PetscLibType,dctx::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextDestroy")) +""" +function PetscDeviceContextDestroy(petsclib::PetscLibType, dctx::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextDestroy(petsclib::$UnionPetscLib, dctx::PetscDeviceContext ) + + @chk ccall( + (:PetscDeviceContextDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDeviceContext},), + dctx, + ) + + + return nothing +end + +""" + PetscDeviceContextSetStreamType(petsclib::PetscLibType,dctx::PetscDeviceContext, type::PetscStreamType) + +# External Links +$(_doc_external("Sys/PetscDeviceContextSetStreamType")) +""" +function PetscDeviceContextSetStreamType(petsclib::PetscLibType, dctx::PetscDeviceContext, type::PetscStreamType) end + +@for_petsc function PetscDeviceContextSetStreamType(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, type::PetscStreamType ) + + @chk ccall( + (:PetscDeviceContextSetStreamType, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, PetscStreamType), + dctx, type, + ) + + + return nothing +end + +""" + type::PetscStreamType = PetscDeviceContextGetStreamType(petsclib::PetscLibType,dctx::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextGetStreamType")) +""" +function PetscDeviceContextGetStreamType(petsclib::PetscLibType, dctx::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextGetStreamType(petsclib::$UnionPetscLib, dctx::PetscDeviceContext ) + type_ = Ref{PetscStreamType}() + + @chk ccall( + (:PetscDeviceContextGetStreamType, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, Ptr{PetscStreamType}), + dctx, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PetscDeviceContextSetDevice(petsclib::PetscLibType,dctx::PetscDeviceContext, device::PetscDevice) + +# External Links +$(_doc_external("Sys/PetscDeviceContextSetDevice")) +""" +function PetscDeviceContextSetDevice(petsclib::PetscLibType, dctx::PetscDeviceContext, device::PetscDevice) end + +@for_petsc function PetscDeviceContextSetDevice(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, device::PetscDevice ) + + @chk ccall( + (:PetscDeviceContextSetDevice, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, PetscDevice), + dctx, device, + ) + + + return nothing +end + +""" + PetscDeviceContextGetDevice(petsclib::PetscLibType,dctx::PetscDeviceContext, device::PetscDevice) + +# External Links +$(_doc_external("Sys/PetscDeviceContextGetDevice")) +""" +function PetscDeviceContextGetDevice(petsclib::PetscLibType, dctx::PetscDeviceContext, device::PetscDevice) end + +@for_petsc function PetscDeviceContextGetDevice(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, device::PetscDevice ) + + @chk ccall( + (:PetscDeviceContextGetDevice, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, Ptr{PetscDevice}), + dctx, device, + ) + + + return nothing +end + +""" + type::PetscDeviceType = PetscDeviceContextGetDeviceType(petsclib::PetscLibType,dctx::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextGetDeviceType")) +""" +function PetscDeviceContextGetDeviceType(petsclib::PetscLibType, dctx::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextGetDeviceType(petsclib::$UnionPetscLib, dctx::PetscDeviceContext ) + type_ = Ref{PetscDeviceType}() + + @chk ccall( + (:PetscDeviceContextGetDeviceType, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, Ptr{PetscDeviceType}), + dctx, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PetscDeviceContextSetUp(petsclib::PetscLibType,dctx::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextSetUp")) +""" +function PetscDeviceContextSetUp(petsclib::PetscLibType, dctx::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextSetUp(petsclib::$UnionPetscLib, dctx::PetscDeviceContext ) + + @chk ccall( + (:PetscDeviceContextSetUp, $petsc_library), + PetscErrorCode, + (PetscDeviceContext,), + dctx, + ) + + + return nothing +end + +""" + dctxdup::PetscDeviceContext = PetscDeviceContextDuplicate(petsclib::PetscLibType,dctx::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextDuplicate")) +""" +function PetscDeviceContextDuplicate(petsclib::PetscLibType, dctx::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextDuplicate(petsclib::$UnionPetscLib, dctx::PetscDeviceContext ) + dctxdup_ = Ref{PetscDeviceContext}() + + @chk ccall( + (:PetscDeviceContextDuplicate, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, Ptr{PetscDeviceContext}), + dctx, dctxdup_, + ) + + dctxdup = dctxdup_[] + + return dctxdup +end + +""" + idle::PetscBool = PetscDeviceContextQueryIdle(petsclib::PetscLibType,dctx::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextQueryIdle")) +""" +function PetscDeviceContextQueryIdle(petsclib::PetscLibType, dctx::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextQueryIdle(petsclib::$UnionPetscLib, dctx::PetscDeviceContext ) + idle_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDeviceContextQueryIdle, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, Ptr{PetscBool}), + dctx, idle_, + ) + + idle = idle_[] + + return idle +end + +""" + PetscDeviceContextWaitForContext(petsclib::PetscLibType,dctxa::PetscDeviceContext, dctxb::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextWaitForContext")) +""" +function PetscDeviceContextWaitForContext(petsclib::PetscLibType, dctxa::PetscDeviceContext, dctxb::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextWaitForContext(petsclib::$UnionPetscLib, dctxa::PetscDeviceContext, dctxb::PetscDeviceContext ) + + @chk ccall( + (:PetscDeviceContextWaitForContext, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, PetscDeviceContext), + dctxa, dctxb, + ) + + + return nothing +end + +""" + PetscDeviceContextForkWithStreamType(petsclib::PetscLibType,dctx::PetscDeviceContext, stype::PetscStreamType, n::PetscInt, dsub::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextForkWithStreamType")) +""" +function PetscDeviceContextForkWithStreamType(petsclib::PetscLibType, dctx::PetscDeviceContext, stype::PetscStreamType, n::PetscInt, dsub::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextForkWithStreamType(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, stype::PetscStreamType, n::$PetscInt, dsub::PetscDeviceContext ) + + @chk ccall( + (:PetscDeviceContextForkWithStreamType, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, PetscStreamType, $PetscInt, PetscDeviceContext), + dctx, stype, n, dsub, + ) + + + return nothing +end + +""" + PetscDeviceContextFork(petsclib::PetscLibType,dctx::PetscDeviceContext, n::PetscInt, dsub::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextFork")) +""" +function PetscDeviceContextFork(petsclib::PetscLibType, dctx::PetscDeviceContext, n::PetscInt, dsub::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextFork(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, n::$PetscInt, dsub::PetscDeviceContext ) + + @chk ccall( + (:PetscDeviceContextFork, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, $PetscInt, PetscDeviceContext), + dctx, n, dsub, + ) + + + return nothing +end + +""" + PetscDeviceContextJoin(petsclib::PetscLibType,dctx::PetscDeviceContext, n::PetscInt, joinMode::PetscDeviceContextJoinMode, dsub::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextJoin")) +""" +function PetscDeviceContextJoin(petsclib::PetscLibType, dctx::PetscDeviceContext, n::PetscInt, joinMode::PetscDeviceContextJoinMode, dsub::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextJoin(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, n::$PetscInt, joinMode::PetscDeviceContextJoinMode, dsub::PetscDeviceContext ) + + @chk ccall( + (:PetscDeviceContextJoin, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, $PetscInt, PetscDeviceContextJoinMode, PetscDeviceContext), + dctx, n, joinMode, dsub, + ) + + + return nothing +end + +""" + PetscDeviceContextSynchronize(petsclib::PetscLibType,dctx::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextSynchronize")) +""" +function PetscDeviceContextSynchronize(petsclib::PetscLibType, dctx::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextSynchronize(petsclib::$UnionPetscLib, dctx::PetscDeviceContext ) + + @chk ccall( + (:PetscDeviceContextSynchronize, $petsc_library), + PetscErrorCode, + (PetscDeviceContext,), + dctx, + ) + + + return nothing +end + +""" + PetscDeviceContextSetFromOptions(petsclib::PetscLibType,comm::MPI_Comm, dctx::PetscDeviceContext) + +# External Links +$(_doc_external("Sys/PetscDeviceContextSetFromOptions")) +""" +function PetscDeviceContextSetFromOptions(petsclib::PetscLibType, comm::MPI_Comm, dctx::PetscDeviceContext) end + +@for_petsc function PetscDeviceContextSetFromOptions(petsclib::$UnionPetscLib, comm::MPI_Comm, dctx::PetscDeviceContext ) + + @chk ccall( + (:PetscDeviceContextSetFromOptions, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscDeviceContext), + comm, dctx, + ) + + + return nothing +end + +""" + PetscDeviceContextView(petsclib::PetscLibType,dctx::PetscDeviceContext, viewer::PetscViewer) + +# External Links +$(_doc_external("Sys/PetscDeviceContextView")) +""" +function PetscDeviceContextView(petsclib::PetscLibType, dctx::PetscDeviceContext, viewer::PetscViewer) end + +@for_petsc function PetscDeviceContextView(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, viewer::PetscViewer ) + + @chk ccall( + (:PetscDeviceContextView, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, PetscViewer), + dctx, viewer, + ) + + + return nothing +end + +""" + PetscDeviceContextViewFromOptions(petsclib::PetscLibType,dctx::PetscDeviceContext, obj::PetscObject, name::String) + +# External Links +$(_doc_external("Sys/PetscDeviceContextViewFromOptions")) +""" +function PetscDeviceContextViewFromOptions(petsclib::PetscLibType, dctx::PetscDeviceContext, obj::PetscObject, name::String) end + +@for_petsc function PetscDeviceContextViewFromOptions(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscDeviceContextViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, PetscObject, Ptr{Cchar}), + dctx, obj, name, + ) + + + return nothing +end + +""" + PetscDeviceContextGetStreamHandle(petsclib::PetscLibType,dctx::PetscDeviceContext, handle::Cvoid) + +# External Links +$(_doc_external("Sys/PetscDeviceContextGetStreamHandle")) +""" +function PetscDeviceContextGetStreamHandle(petsclib::PetscLibType, dctx::PetscDeviceContext, handle::Cvoid) end + +@for_petsc function PetscDeviceContextGetStreamHandle(petsclib::$UnionPetscLib, dctx::PetscDeviceContext, handle::Cvoid ) + + @chk ccall( + (:PetscDeviceContextGetStreamHandle, $petsc_library), + PetscErrorCode, + (PetscDeviceContext, Cvoid), + dctx, handle, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscDraw_wrappers.jl b/src/autowrapped/PetscDraw_wrappers.jl new file mode 100644 index 00000000..333fff15 --- /dev/null +++ b/src/autowrapped/PetscDraw_wrappers.jl @@ -0,0 +1,5204 @@ +# ------------------------------------------------------- +# autodefined type arguments for class ------ + +mutable struct _n_PetscDrawAxis end +const PetscDrawAxis = Ptr{_n_PetscDrawAxis} + +mutable struct _n_PetscDrawLG end +const PetscDrawLG = Ptr{_n_PetscDrawLG} + +mutable struct _n_PetscDrawSP end +const PetscDrawSP = Ptr{_n_PetscDrawSP} + +mutable struct _n_PetscDrawHG end +const PetscDrawHG = Ptr{_n_PetscDrawHG} + +mutable struct _n_PetscDrawBar end +const PetscDrawBar = Ptr{_n_PetscDrawBar} + +# ------------------------------------------------------- +""" + PetscDrawSetSave(petsclib::PetscLibType,draw::PetscDraw, filename::String) +Saves images produced in a `PetscDraw` into a file + +Collective + +Input Parameters: +- `draw` - the graphics context +- `filename` - name of the file, if .ext then uses name of draw object plus .ext using .ext to determine the image type + +Options Database Keys: +- `-draw_save ` - filename could be name.ext or .ext (where .ext determines the type of graphics file to save, for example .png) +- `-draw_save_final_image [optional filename]` - saves the final image displayed in a window +- `-draw_save_single_file` - saves each new image in the same file, normally each new image is saved in a new file with filename/filename_%d.ext + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawOpenX()`, `PetscDrawOpenImage()`, `PetscDrawSetFromOptions()`, `PetscDrawCreate()`, `PetscDrawDestroy()`, `PetscDrawSetSaveFinalImage()` + +# External Links +$(_doc_external("Sys/PetscDrawSetSave")) +""" +function PetscDrawSetSave(petsclib::PetscLibType, draw::PetscDraw, filename::String) end + +@for_petsc function PetscDrawSetSave(petsclib::$UnionPetscLib, draw::PetscDraw, filename::String ) + + @chk ccall( + (:PetscDrawSetSave, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{Cchar}), + draw, filename, + ) + + + return nothing +end + +""" + PetscDrawSetSaveMovie(petsclib::PetscLibType,draw::PetscDraw, movieext::String) +Saves a movie produced from a `PetscDraw` into a file + +Collective + +Input Parameters: +- `draw` - the graphics context +- `movieext` - optional extension defining the movie format + +Options Database Key: +- `-draw_save_movie <.ext>` - saves a movie with extension .ext + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawSetSave()`, `PetscDrawSetFromOptions()`, `PetscDrawCreate()`, `PetscDrawDestroy()` + +# External Links +$(_doc_external("Sys/PetscDrawSetSaveMovie")) +""" +function PetscDrawSetSaveMovie(petsclib::PetscLibType, draw::PetscDraw, movieext::String) end + +@for_petsc function PetscDrawSetSaveMovie(petsclib::$UnionPetscLib, draw::PetscDraw, movieext::String ) + + @chk ccall( + (:PetscDrawSetSaveMovie, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{Cchar}), + draw, movieext, + ) + + + return nothing +end + +""" + PetscDrawSetSaveFinalImage(petsclib::PetscLibType,draw::PetscDraw, filename::String) +Saves the final image produced in a `PetscDraw` into a file + +Collective + +Input Parameters: +- `draw` - the graphics context +- `filename` - name of the file, if NULL or empty uses name set with `PetscDrawSetSave()` or the name of the draw object + +Options Database Key: +- `-draw_save_final_image ` - filename could be name.ext or .ext (where .ext determines the type of graphics file to save, for example .png) + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawSetSave()`, `PetscDrawSetFromOptions()`, `PetscDrawCreate()`, `PetscDrawDestroy()` + +# External Links +$(_doc_external("Sys/PetscDrawSetSaveFinalImage")) +""" +function PetscDrawSetSaveFinalImage(petsclib::PetscLibType, draw::PetscDraw, filename::String) end + +@for_petsc function PetscDrawSetSaveFinalImage(petsclib::$UnionPetscLib, draw::PetscDraw, filename::String ) + + @chk ccall( + (:PetscDrawSetSaveFinalImage, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{Cchar}), + draw, filename, + ) + + + return nothing +end + +""" + PetscDrawSave(petsclib::PetscLibType,draw::PetscDraw) +Saves a drawn image + +Collective + +Input Parameter: +- `draw` - the drawing context + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawSetSave()` + +# External Links +$(_doc_external("Sys/PetscDrawSave")) +""" +function PetscDrawSave(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawSave(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawSave, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + PetscDrawSaveMovie(petsclib::PetscLibType,draw::PetscDraw) +Saves a movie from previously saved images + +Collective + +Input Parameter: +- `draw` - the drawing context + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawSetSave()`, `PetscDrawSetSaveMovie()` + +# External Links +$(_doc_external("Sys/PetscDrawSaveMovie")) +""" +function PetscDrawSaveMovie(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawSaveMovie(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawSaveMovie, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + PetscDrawEllipse(petsclib::PetscLibType,draw::PetscDraw, x::PetscReal, y::PetscReal, a::PetscReal, b::PetscReal, c::Cint) +Draws an ellipse onto a drawable. + +Not Collective + +Input Parameters: +- `draw` - The drawing context +- `x` - The x coordinate of the center +- `y` - The y coordinate of the center +- `a` - The major axes length +- `b` - The minor axes length +- `c` - The color + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawRectangle()`, `PetscDrawTriangle()`, `PetscDrawMarker()`, `PetscDrawPoint()`, `PetscDrawString()`, `PetscDrawArrow()` + +# External Links +$(_doc_external("Sys/PetscDrawEllipse")) +""" +function PetscDrawEllipse(petsclib::PetscLibType, draw::PetscDraw, x::PetscReal, y::PetscReal, a::PetscReal, b::PetscReal, c::Cint) end + +@for_petsc function PetscDrawEllipse(petsclib::$UnionPetscLib, draw::PetscDraw, x::$PetscReal, y::$PetscReal, a::$PetscReal, b::$PetscReal, c::Cint ) + + @chk ccall( + (:PetscDrawEllipse, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, $PetscReal, $PetscReal, Cint), + draw, x, y, a, b, c, + ) + + + return nothing +end + +""" + PetscDrawFlush(petsclib::PetscLibType,draw::PetscDraw) +Flushes graphical output. + +Collective + +Input Parameter: +- `draw` - the drawing context + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawClear()` + +# External Links +$(_doc_external("Sys/PetscDrawFlush")) +""" +function PetscDrawFlush(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawFlush(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawFlush, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + x_user::PetscReal,y_user::PetscReal,x_phys::PetscReal,y_phys::PetscReal = PetscDrawGetMouseButton(petsclib::PetscLibType,draw::PetscDraw, button::PetscDrawButton) +Returns location of mouse and which button was +pressed. Waits for button to be pressed. + +Collective + +Input Parameter: +- `draw` - the window to be used + +Output Parameters: +- `button` - one of `PETSC_BUTTON_LEFT`, `PETSC_BUTTON_CENTER`, `PETSC_BUTTON_RIGHT`, `PETSC_BUTTON_WHEEL_UP`, `PETSC_BUTTON_WHEEL_DOWN` +- `x_user` - horizontal user coordinate of location (user may pass in NULL). +- `y_user` - vertical user coordinate of location (user may pass in NULL). +- `x_phys` - horizontal window coordinate (user may pass in NULL). +- `y_phys` - vertical window coordinate (user may pass in NULL). + +-seealso: `PetscDraw`, `PetscDrawButton` + +# External Links +$(_doc_external("Sys/PetscDrawGetMouseButton")) +""" +function PetscDrawGetMouseButton(petsclib::PetscLibType, draw::PetscDraw, button::PetscDrawButton) end + +@for_petsc function PetscDrawGetMouseButton(petsclib::$UnionPetscLib, draw::PetscDraw, button::PetscDrawButton ) + x_user_ = Ref{$PetscReal}() + y_user_ = Ref{$PetscReal}() + x_phys_ = Ref{$PetscReal}() + y_phys_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDrawGetMouseButton, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{PetscDrawButton}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + draw, button, x_user_, y_user_, x_phys_, y_phys_, + ) + + x_user = x_user_[] + y_user = y_user_[] + x_phys = x_phys_[] + y_phys = y_phys_[] + + return x_user,y_user,x_phys,y_phys +end + +""" + PetscDrawView(petsclib::PetscLibType,indraw::PetscDraw, viewer::PetscViewer) +Prints the `PetscDraw` data structure. + +Collective + +Input Parameters: +- `indraw` - the `PetscDraw` context +- `viewer` - visualization context + +See PetscDrawSetFromOptions() for options database keys + +-seealso: `PetscDraw`, `PetscViewerASCIIOpen()`, `PetscViewer` + +# External Links +$(_doc_external("Sys/PetscDrawView")) +""" +function PetscDrawView(petsclib::PetscLibType, indraw::PetscDraw, viewer::PetscViewer) end + +@for_petsc function PetscDrawView(petsclib::$UnionPetscLib, indraw::PetscDraw, viewer::PetscViewer ) + + @chk ccall( + (:PetscDrawView, $petsc_library), + PetscErrorCode, + (PetscDraw, PetscViewer), + indraw, viewer, + ) + + + return nothing +end + +""" + PetscDrawViewFromOptions(petsclib::PetscLibType,A::PetscDraw, obj::PetscObject, name::String) +View a `PetscDraw` from the option database + +Collective + +Input Parameters: +- `A` - the `PetscDraw` context +- `obj` - Optional object +- `name` - command line option + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawView`, `PetscObjectViewFromOptions()`, `PetscDrawCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawViewFromOptions")) +""" +function PetscDrawViewFromOptions(petsclib::PetscLibType, A::PetscDraw, obj::PetscObject, name::String) end + +@for_petsc function PetscDrawViewFromOptions(petsclib::$UnionPetscLib, A::PetscDraw, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscDrawViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscDraw, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + indraw::PetscDraw = PetscDrawCreate(petsclib::PetscLibType,comm::MPI_Comm, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint) +Creates a graphics context. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `display` - X display when using X Windows +- `title` - optional title added to top of window +- `x` - horizonatl coordinate of lower left corner of window or `PETSC_DECIDE` +- `y` - vertical coordinate of lower left corner of window or `PETSC_DECIDE` +- `w` - width of window, `PETSC_DECIDE`, `PETSC_DRAW_HALF_SIZE`, `PETSC_DRAW_FULL_SIZE`, `PETSC_DRAW_THIRD_SIZE` or `PETSC_DRAW_QUARTER_SIZE` +- `h` - height of window, `PETSC_DECIDE`, `PETSC_DRAW_HALF_SIZE`, `PETSC_DRAW_FULL_SIZE`, `PETSC_DRAW_THIRD_SIZE` or `PETSC_DRAW_QUARTER_SIZE` + +Output Parameter: +- `indraw` - location to put the `PetscDraw` context + +Level: beginner + +-seealso: `PetscDrawSetType()`, `PetscDrawSetFromOptions()`, `PetscDrawDestroy()`, `PetscDrawLGCreate()`, `PetscDrawSPCreate()`, +`PetscDrawViewPortsCreate()`, `PetscDrawViewPortsSet()`, `PetscDrawAxisCreate()`, `PetscDrawHGCreate()`, `PetscDrawBarCreate()`, +`PetscViewerDrawGetDraw()`, `PetscDrawSetSave()`, `PetscDrawSetSaveMovie()`, `PetscDrawSetSaveFinalImage()`, +`PetscDrawOpenX()`, `PetscDrawOpenImage()`, `PetscDrawIsNull()`, `PetscDrawGetPopup()`, `PetscDrawCheckResizedWindow()`, `PetscDrawResizeWindow()`, +`PetscDrawGetWindowSize()`, `PetscDrawLine()`, `PetscDrawArrow()`, `PetscDrawLineSetWidth()`, `PetscDrawLineGetWidth()`, `PetscDrawMarker()`, +`PetscDrawPoint()`, `PetscDrawRectangle()`, `PetscDrawTriangle()`, `PetscDrawEllipse()`, `PetscDrawString()`, `PetscDrawStringCentered()`, +`PetscDrawStringBoxed()`, `PetscDrawStringVertical()`, `PetscDrawSetViewPort()`, `PetscDrawGetViewPort()`, +`PetscDrawSplitViewPort()`, `PetscDrawSetTitle()`, `PetscDrawAppendTitle()`, `PetscDrawGetTitle()`, `PetscDrawSetPause()`, `PetscDrawGetPause()`, +`PetscDrawPause()`, `PetscDrawSetDoubleBuffer()`, `PetscDrawClear()`, `PetscDrawFlush()`, `PetscDrawGetSingleton()`, `PetscDrawGetMouseButton()`, +`PetscDrawZoom()`, `PetscDrawGetBoundingBox()` + +# External Links +$(_doc_external("Sys/PetscDrawCreate")) +""" +function PetscDrawCreate(petsclib::PetscLibType, comm::MPI_Comm, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint) end + +@for_petsc function PetscDrawCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint ) + indraw_ = Ref{PetscDraw}() + + @chk ccall( + (:PetscDrawCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Cint, Cint, Cint, Cint, Ptr{PetscDraw}), + comm, display, title, x, y, w, h, indraw_, + ) + + indraw = indraw_[] + + return indraw +end + +""" + PetscDrawSetType(petsclib::PetscLibType,draw::PetscDraw, type::PetscDrawType) +Builds graphics object for a particular implementation + +Collective + +Input Parameters: +- `draw` - the graphics context +- `type` - for example, `PETSC_DRAW_X` + +Options Database Key: +- `-draw_type ` - Sets the type; use -help for a list of available methods (for instance, x) + +Level: intermediate + +-seealso: `PetscDraw`, `PETSC_DRAW_X`, `PETSC_DRAW_TIKZ`, `PETSC_DRAW_IMAGE`, `PetscDrawSetFromOptions()`, `PetscDrawCreate()`, `PetscDrawDestroy()`, `PetscDrawType` + +# External Links +$(_doc_external("Sys/PetscDrawSetType")) +""" +function PetscDrawSetType(petsclib::PetscLibType, draw::PetscDraw, type::PetscDrawType) end + +@for_petsc function PetscDrawSetType(petsclib::$UnionPetscLib, draw::PetscDraw, type::PetscDrawType ) + + @chk ccall( + (:PetscDrawSetType, $petsc_library), + PetscErrorCode, + (PetscDraw, PetscDrawType), + draw, type, + ) + + + return nothing +end + +""" + type::PetscDrawType = PetscDrawGetType(petsclib::PetscLibType,draw::PetscDraw) +Gets the `PetscDraw` type as a string from the `PetscDraw` object. + +Not Collective + +Input Parameter: +- `draw` - Krylov context + +Output Parameter: +- `type` - name of PetscDraw method + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawType`, `PetscDrawSetType()`, `PetscDrawCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawGetType")) +""" +function PetscDrawGetType(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawGetType(petsclib::$UnionPetscLib, draw::PetscDraw ) + type_ = Ref{PetscDrawType}() + + @chk ccall( + (:PetscDrawGetType, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{PetscDrawType}), + draw, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PetscDrawRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a method to the graphics package. + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined graphics class +- `function` - routine to create method context + +Level: developer + +-seealso: `PetscDraw`, `PetscDrawRegisterAll()`, `PetscDrawRegisterDestroy()`, `PetscDrawType`, `PetscDrawSetType()` + +# External Links +$(_doc_external("Sys/PetscDrawRegister")) +""" +function PetscDrawRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscDrawRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscDrawRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscDrawSetOptionsPrefix(petsclib::PetscLibType,draw::PetscDraw, prefix::String) +Sets the prefix used for searching for all +`PetscDraw` options in the database. + +Logically Collective + +Input Parameters: +- `draw` - the draw context +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawSetFromOptions()`, `PetscDrawCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawSetOptionsPrefix")) +""" +function PetscDrawSetOptionsPrefix(petsclib::PetscLibType, draw::PetscDraw, prefix::String) end + +@for_petsc function PetscDrawSetOptionsPrefix(petsclib::$UnionPetscLib, draw::PetscDraw, prefix::String ) + + @chk ccall( + (:PetscDrawSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{Cchar}), + draw, prefix, + ) + + + return nothing +end + +""" + PetscDrawSetFromOptions(petsclib::PetscLibType,draw::PetscDraw) +Sets the graphics type from the options database. +Defaults to a PETSc X Windows graphics. + +Collective + +Input Parameter: +- `draw` - the graphics context + +Options Database Keys: +- `-nox` - do not use X graphics (ignore graphics calls, but run program correctly) +- `-nox_warning` - when X Windows support is not installed this prevents the warning message from being printed +- `-draw_pause ` - - -1 indicates wait for mouse input, -2 indicates pause when window is to be destroyed +- `-draw_marker_type` - +- `-draw_save [optional filename]` - (X Windows only) saves each image before it is cleared to a file +- `-draw_save_final_image [optional filename]` - (X Windows only) saves the final image displayed in a window +- `-draw_save_movie` - converts image files to a movie at the end of the run. See PetscDrawSetSave() +- `-draw_save_single_file` - saves each new image in the same file, normally each new image is saved in a new file with 'filename/filename_%d.ext' +- `-draw_save_on_clear` - saves an image on each clear, mainly for debugging +- `-draw_save_on_flush` - saves an image on each flush, mainly for debugging + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawCreate()`, `PetscDrawSetType()`, `PetscDrawSetSave()`, `PetscDrawSetSaveFinalImage()`, `PetscDrawPause()`, `PetscDrawSetPause()` + +# External Links +$(_doc_external("Sys/PetscDrawSetFromOptions")) +""" +function PetscDrawSetFromOptions(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawSetFromOptions(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + PetscDrawSetViewPort(petsclib::PetscLibType,draw::PetscDraw, xl::PetscReal, yl::PetscReal, xr::PetscReal, yr::PetscReal) +Sets the portion of the window (page) to which draw +routines will write. + +Collective + +Input Parameters: +- `xl` - the horizontal coordinate of the lower left corner of the subwindow. +- `yl` - the vertical coordinate of the lower left corner of the subwindow. +- `xr` - the horizontal coordinate of the upper right corner of the subwindow. +- `yr` - the vertical coordinate of the upper right corner of the subwindow. +- `draw` - the drawing context + +Level: advanced + +-seealso: `PetscDrawGetViewPort()`, `PetscDraw`, `PetscDrawSplitViewPort()`, `PetscDrawViewPortsCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawSetViewPort")) +""" +function PetscDrawSetViewPort(petsclib::PetscLibType, draw::PetscDraw, xl::PetscReal, yl::PetscReal, xr::PetscReal, yr::PetscReal) end + +@for_petsc function PetscDrawSetViewPort(petsclib::$UnionPetscLib, draw::PetscDraw, xl::$PetscReal, yl::$PetscReal, xr::$PetscReal, yr::$PetscReal ) + + @chk ccall( + (:PetscDrawSetViewPort, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + draw, xl, yl, xr, yr, + ) + + + return nothing +end + +""" + xl::PetscReal,yl::PetscReal,xr::PetscReal,yr::PetscReal = PetscDrawGetViewPort(petsclib::PetscLibType,draw::PetscDraw) +Gets the portion of the window (page) to which draw +routines will write. + +Collective + +Input Parameter: +- `draw` - the drawing context + +Output Parameters: +- `xl` - the horizontal coordinate of the lower left corner of the subwindow. +- `yl` - the vertical coordinate of the lower left corner of the subwindow. +- `xr` - the horizontal coordinate of the upper right corner of the subwindow. +- `yr` - the vertical coordinate of the upper right corner of the subwindow. + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawSplitViewPort()`, `PetscDrawSetViewPort()` + +# External Links +$(_doc_external("Sys/PetscDrawGetViewPort")) +""" +function PetscDrawGetViewPort(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawGetViewPort(petsclib::$UnionPetscLib, draw::PetscDraw ) + xl_ = Ref{$PetscReal}() + yl_ = Ref{$PetscReal}() + xr_ = Ref{$PetscReal}() + yr_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDrawGetViewPort, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + draw, xl_, yl_, xr_, yr_, + ) + + xl = xl_[] + yl = yl_[] + xr = xr_[] + yr = yr_[] + + return xl,yl,xr,yr +end + +""" + newports::Vector{PetscDrawViewPorts} = PetscDrawViewPortsCreate(petsclib::PetscLibType,draw::PetscDraw, nports::PetscInt) +Splits a window into smaller view ports. Each processor shares all the viewports. + +Collective + +Input Parameters: +- `draw` - the drawing context +- `nports` - the number of ports + +Output Parameter: +- `newports` - a `PetscDrawViewPorts` context (C structure) + +Options Database Key: +- `-draw_ports` - display multiple fields in the same window with PetscDrawPorts() instead of in separate windows + +Level: advanced + +-seealso: `PetscDrawSplitViewPort()`, `PetscDrawSetViewPort()`, `PetscDrawViewPortsSet()`, `PetscDrawViewPortsDestroy()` + +# External Links +$(_doc_external("Sys/PetscDrawViewPortsCreate")) +""" +function PetscDrawViewPortsCreate(petsclib::PetscLibType, draw::PetscDraw, nports::PetscInt) end + +@for_petsc function PetscDrawViewPortsCreate(petsclib::$UnionPetscLib, draw::PetscDraw, nports::$PetscInt ) + newports_ = Ref{Ptr{PetscDrawViewPorts}}() + + @chk ccall( + (:PetscDrawViewPortsCreate, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscInt, Ptr{Ptr{PetscDrawViewPorts}}), + draw, nports, newports_, + ) + + newports = unsafe_wrap(Array, newports_[], VecGetLocalSize(petsclib, x); own = false) + + return newports +end + +""" + newports::Vector{PetscDrawViewPorts} = PetscDrawViewPortsCreateRect(petsclib::PetscLibType,draw::PetscDraw, nx::PetscInt, ny::PetscInt) +Splits a window into smaller +view ports. Each processor shares all the viewports. The number +of views in the x- and y-directions is specified. + +Collective + +Input Parameters: +- `draw` - the drawing context +- `nx` - the number of x divisions +- `ny` - the number of y divisions + +Output Parameter: +- `newports` - a `PetscDrawViewPorts` context (C structure) + +Level: advanced + +-seealso: `PetscDrawSplitViewPort()`, `PetscDrawSetViewPort()`, `PetscDrawViewPortsSet()`, `PetscDrawViewPortsDestroy()`, `PetscDrawViewPorts` + +# External Links +$(_doc_external("Sys/PetscDrawViewPortsCreateRect")) +""" +function PetscDrawViewPortsCreateRect(petsclib::PetscLibType, draw::PetscDraw, nx::PetscInt, ny::PetscInt) end + +@for_petsc function PetscDrawViewPortsCreateRect(petsclib::$UnionPetscLib, draw::PetscDraw, nx::$PetscInt, ny::$PetscInt ) + newports_ = Ref{Ptr{PetscDrawViewPorts}}() + + @chk ccall( + (:PetscDrawViewPortsCreateRect, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscInt, $PetscInt, Ptr{Ptr{PetscDrawViewPorts}}), + draw, nx, ny, newports_, + ) + + newports = unsafe_wrap(Array, newports_[], VecGetLocalSize(petsclib, x); own = false) + + return newports +end + +""" + PetscDrawViewPortsDestroy(petsclib::PetscLibType,ports::PetscDrawViewPorts) +frees a `PetscDrawViewPorts` object + +Collective on the `PetscDraw` inside `ports` + +Input Parameter: +- `ports` - the `PetscDrawViewPorts` object + +Level: advanced + +-seealso: `PetscDrawViewPorts`, `PetscDrawSplitViewPort()`, `PetscDrawSetViewPort()`, `PetscDrawViewPortsSet()`, `PetscDrawViewPortsCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawViewPortsDestroy")) +""" +function PetscDrawViewPortsDestroy(petsclib::PetscLibType, ports::PetscDrawViewPorts) end + +@for_petsc function PetscDrawViewPortsDestroy(petsclib::$UnionPetscLib, ports::PetscDrawViewPorts ) + + @chk ccall( + (:PetscDrawViewPortsDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDrawViewPorts},), + ports, + ) + + + return nothing +end + +""" + PetscDrawViewPortsSet(petsclib::PetscLibType,ports::PetscDrawViewPorts, port::PetscInt) +sets a draw object to use a particular subport + +Logically Collective on the `PetscDraw` inside `ports` + +Input Parameters: +- `ports` - the `PetscDrawViewPorts` object +- `port` - the port number, from 0 to nports-1 + +Level: advanced + +-seealso: `PetscDrawViewPorts`, `PetscDrawSplitViewPort()`, `PetscDrawSetViewPort()`, `PetscDrawViewPortsDestroy()`, `PetscDrawViewPortsCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawViewPortsSet")) +""" +function PetscDrawViewPortsSet(petsclib::PetscLibType, ports::PetscDrawViewPorts, port::PetscInt) end + +@for_petsc function PetscDrawViewPortsSet(petsclib::$UnionPetscLib, ports::PetscDrawViewPorts, port::$PetscInt ) + + @chk ccall( + (:PetscDrawViewPortsSet, $petsc_library), + PetscErrorCode, + (Ptr{PetscDrawViewPorts}, $PetscInt), + ports, port, + ) + + + return nothing +end + +""" + PetscDrawString(petsclib::PetscLibType,draw::PetscDraw, xl::PetscReal, yl::PetscReal, cl::Cint, text::String) +draws text onto a drawable. + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `xl` - coordinate of lower left corner of text +- `yl` - coordinate of lower left corner of text +- `cl` - the color of the text +- `text` - the text to draw + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawStringVertical()`, `PetscDrawStringCentered()`, `PetscDrawStringBoxed()`, `PetscDrawStringSetSize()`, +`PetscDrawStringGetSize()`, `PetscDrawLine()`, `PetscDrawRectangle()`, `PetscDrawTriangle()`, `PetscDrawEllipse()`, +`PetscDrawMarker()`, `PetscDrawPoint()` + +# External Links +$(_doc_external("Sys/PetscDrawString")) +""" +function PetscDrawString(petsclib::PetscLibType, draw::PetscDraw, xl::PetscReal, yl::PetscReal, cl::Cint, text::String) end + +@for_petsc function PetscDrawString(petsclib::$UnionPetscLib, draw::PetscDraw, xl::$PetscReal, yl::$PetscReal, cl::Cint, text::String ) + + @chk ccall( + (:PetscDrawString, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, Cint, Ptr{Cchar}), + draw, xl, yl, cl, text, + ) + + + return nothing +end + +""" + PetscDrawStringVertical(petsclib::PetscLibType,draw::PetscDraw, xl::PetscReal, yl::PetscReal, cl::Cint, text::String) +draws text onto a drawable. + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `xl` - coordinate of upper left corner of text +- `yl` - coordinate of upper left corner of text +- `cl` - the color of the text +- `text` - the text to draw + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawString()`, `PetscDrawStringCentered()`, `PetscDrawStringBoxed()`, `PetscDrawStringSetSize()`, +`PetscDrawStringGetSize()` + +# External Links +$(_doc_external("Sys/PetscDrawStringVertical")) +""" +function PetscDrawStringVertical(petsclib::PetscLibType, draw::PetscDraw, xl::PetscReal, yl::PetscReal, cl::Cint, text::String) end + +@for_petsc function PetscDrawStringVertical(petsclib::$UnionPetscLib, draw::PetscDraw, xl::$PetscReal, yl::$PetscReal, cl::Cint, text::String ) + + @chk ccall( + (:PetscDrawStringVertical, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, Cint, Ptr{Cchar}), + draw, xl, yl, cl, text, + ) + + + return nothing +end + +""" + PetscDrawStringCentered(petsclib::PetscLibType,draw::PetscDraw, xc::PetscReal, yl::PetscReal, cl::Cint, text::String) +draws text onto a drawable centered at a point + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `xc` - the coordinates of right-left center of text +- `yl` - the coordinates of lower edge of text +- `cl` - the color of the text +- `text` - the text to draw + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawStringVertical()`, `PetscDrawString()`, `PetscDrawStringBoxed()`, `PetscDrawStringSetSize()`, +`PetscDrawStringGetSize()` + +# External Links +$(_doc_external("Sys/PetscDrawStringCentered")) +""" +function PetscDrawStringCentered(petsclib::PetscLibType, draw::PetscDraw, xc::PetscReal, yl::PetscReal, cl::Cint, text::String) end + +@for_petsc function PetscDrawStringCentered(petsclib::$UnionPetscLib, draw::PetscDraw, xc::$PetscReal, yl::$PetscReal, cl::Cint, text::String ) + + @chk ccall( + (:PetscDrawStringCentered, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, Cint, Ptr{Cchar}), + draw, xc, yl, cl, text, + ) + + + return nothing +end + +""" + w::PetscReal,h::PetscReal = PetscDrawStringBoxed(petsclib::PetscLibType,draw::PetscDraw, sxl::PetscReal, syl::PetscReal, sc::Cint, bc::Cint, text::String) +Draws a string with a box around it + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `sxl` - the coordinates of center of the box +- `syl` - the coordinates of top line of box +- `sc` - the color of the text +- `bc` - the color of the bounding box +- `text` - the text to draw + +Output Parameters: +- `w` - the width of the resulting box (optional) +- `h` - the height of resulting box (optional) + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawStringVertical()`, `PetscDrawString()`, `PetscDrawStringCentered()`, `PetscDrawStringSetSize()`, +`PetscDrawStringGetSize()` + +# External Links +$(_doc_external("Sys/PetscDrawStringBoxed")) +""" +function PetscDrawStringBoxed(petsclib::PetscLibType, draw::PetscDraw, sxl::PetscReal, syl::PetscReal, sc::Cint, bc::Cint, text::String) end + +@for_petsc function PetscDrawStringBoxed(petsclib::$UnionPetscLib, draw::PetscDraw, sxl::$PetscReal, syl::$PetscReal, sc::Cint, bc::Cint, text::String ) + w_ = Ref{$PetscReal}() + h_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDrawStringBoxed, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, Cint, Cint, Ptr{Cchar}, Ptr{$PetscReal}, Ptr{$PetscReal}), + draw, sxl, syl, sc, bc, text, w_, h_, + ) + + w = w_[] + h = h_[] + + return w,h +end + +""" + PetscDrawStringSetSize(petsclib::PetscLibType,draw::PetscDraw, width::PetscReal, height::PetscReal) +Sets the size for character text. + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `width` - the width in user coordinates +- `height` - the character height in user coordinates + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawStringVertical()`, `PetscDrawString()`, `PetscDrawStringCentered()`, `PetscDrawStringBoxed()`, +`PetscDrawStringGetSize()` + +# External Links +$(_doc_external("Sys/PetscDrawStringSetSize")) +""" +function PetscDrawStringSetSize(petsclib::PetscLibType, draw::PetscDraw, width::PetscReal, height::PetscReal) end + +@for_petsc function PetscDrawStringSetSize(petsclib::$UnionPetscLib, draw::PetscDraw, width::$PetscReal, height::$PetscReal ) + + @chk ccall( + (:PetscDrawStringSetSize, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal), + draw, width, height, + ) + + + return nothing +end + +""" + PetscDrawStringGetSize(petsclib::PetscLibType,draw::PetscDraw, width::PetscReal, height::PetscReal) +Gets the size for character text. The width is +relative to the user coordinates of the window. + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `width` - the width in user coordinates +- `height` - the character height + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawStringVertical()`, `PetscDrawString()`, `PetscDrawStringCentered()`, `PetscDrawStringBoxed()`, +`PetscDrawStringSetSize()` + +# External Links +$(_doc_external("Sys/PetscDrawStringGetSize")) +""" +function PetscDrawStringGetSize(petsclib::PetscLibType, draw::PetscDraw, width::PetscReal, height::PetscReal) end + +@for_petsc function PetscDrawStringGetSize(petsclib::$UnionPetscLib, draw::PetscDraw, width::$PetscReal, height::$PetscReal ) + + @chk ccall( + (:PetscDrawStringGetSize, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{$PetscReal}, Ptr{$PetscReal}), + draw, width, height, + ) + + + return nothing +end + +""" + PetscDrawFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the PETSc interface to the `PetscDraw` package. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: `PetscDraw`, `PetscFinalize()` + +# External Links +$(_doc_external("Sys/PetscDrawFinalizePackage")) +""" +function PetscDrawFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscDrawFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscDrawFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscDrawInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PetscDraw` package. It is called +from PetscDLLibraryRegister_petsc() when using dynamic libraries, and on the call to `PetscInitialize()` +when using shared or static libraries. + +Level: developer + +-seealso: `PetscDraw`, `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscDrawInitializePackage")) +""" +function PetscDrawInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscDrawInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscDrawInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscDrawResizeWindow(petsclib::PetscLibType,draw::PetscDraw, w::Cint, h::Cint) +Allows one to resize a window from a program. + +Collective + +Input Parameters: +- `draw` - the window +- `w` - the new width of the window +- `h` - the new height of the window + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawCheckResizedWindow()` + +# External Links +$(_doc_external("Sys/PetscDrawResizeWindow")) +""" +function PetscDrawResizeWindow(petsclib::PetscLibType, draw::PetscDraw, w::Cint, h::Cint) end + +@for_petsc function PetscDrawResizeWindow(petsclib::$UnionPetscLib, draw::PetscDraw, w::Cint, h::Cint ) + + @chk ccall( + (:PetscDrawResizeWindow, $petsc_library), + PetscErrorCode, + (PetscDraw, Cint, Cint), + draw, w, h, + ) + + + return nothing +end + +""" + PetscDrawGetWindowSize(petsclib::PetscLibType,draw::PetscDraw, w::Cint, h::Cint) +Gets the size of the window. + +Not Collective + +Input Parameter: +- `draw` - the window + +Output Parameters: +- `w` - the window width +- `h` - the window height + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawResizeWindow()`, `PetscDrawCheckResizedWindow()` + +# External Links +$(_doc_external("Sys/PetscDrawGetWindowSize")) +""" +function PetscDrawGetWindowSize(petsclib::PetscLibType, draw::PetscDraw, w::Cint, h::Cint) end + +@for_petsc function PetscDrawGetWindowSize(petsclib::$UnionPetscLib, draw::PetscDraw, w::Cint, h::Cint ) + + @chk ccall( + (:PetscDrawGetWindowSize, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{Cint}, Ptr{Cint}), + draw, w, h, + ) + + + return nothing +end + +""" + PetscDrawCheckResizedWindow(petsclib::PetscLibType,draw::PetscDraw) +Checks if the user has resized the window. + +Collective + +Input Parameter: +- `draw` - the window + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawResizeWindow()` + +# External Links +$(_doc_external("Sys/PetscDrawCheckResizedWindow")) +""" +function PetscDrawCheckResizedWindow(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawCheckResizedWindow(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawCheckResizedWindow, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + PetscDrawGetTitle(petsclib::PetscLibType,draw::PetscDraw, title::String) +Gets pointer to title of a `PetscDraw` context. + +Not Collective + +Input Parameter: +- `draw` - the graphics context + +Output Parameter: +- `title` - the title + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawSetTitle()` + +# External Links +$(_doc_external("Sys/PetscDrawGetTitle")) +""" +function PetscDrawGetTitle(petsclib::PetscLibType, draw::PetscDraw, title::String) end + +@for_petsc function PetscDrawGetTitle(petsclib::$UnionPetscLib, draw::PetscDraw, title::String ) + title_ = Ref(pointer(title)) + + @chk ccall( + (:PetscDrawGetTitle, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{Ptr{Cchar}}), + draw, title_, + ) + + + return nothing +end + +""" + PetscDrawSetTitle(petsclib::PetscLibType,draw::PetscDraw, title::String) +Sets the title of a `PetscDraw` context. + +Collective + +Input Parameters: +- `draw` - the graphics context +- `title` - the title + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawGetTitle()`, `PetscDrawAppendTitle()` + +# External Links +$(_doc_external("Sys/PetscDrawSetTitle")) +""" +function PetscDrawSetTitle(petsclib::PetscLibType, draw::PetscDraw, title::String) end + +@for_petsc function PetscDrawSetTitle(petsclib::$UnionPetscLib, draw::PetscDraw, title::String ) + + @chk ccall( + (:PetscDrawSetTitle, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{Cchar}), + draw, title, + ) + + + return nothing +end + +""" + PetscDrawAppendTitle(petsclib::PetscLibType,draw::PetscDraw, title::String) +Appends to the title of a `PetscDraw` context. + +Collective + +Input Parameters: +- `draw` - the graphics context +- `title` - the title + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawSetTitle()`, `PetscDrawGetTitle()` + +# External Links +$(_doc_external("Sys/PetscDrawAppendTitle")) +""" +function PetscDrawAppendTitle(petsclib::PetscLibType, draw::PetscDraw, title::String) end + +@for_petsc function PetscDrawAppendTitle(petsclib::$UnionPetscLib, draw::PetscDraw, title::String ) + + @chk ccall( + (:PetscDrawAppendTitle, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{Cchar}), + draw, title, + ) + + + return nothing +end + +""" + PetscDrawDestroy(petsclib::PetscLibType,draw::PetscDraw) +Deletes a draw context. + +Collective + +Input Parameter: +- `draw` - the drawing context + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawDestroy")) +""" +function PetscDrawDestroy(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawDestroy(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDraw},), + draw, + ) + + + return nothing +end + +""" + PetscDrawGetPopup(petsclib::PetscLibType,draw::PetscDraw, popup::PetscDraw) +Creates a popup window associated with a `PetscDraw` window. + +Collective + +Input Parameter: +- `draw` - the original window + +Output Parameter: +- `popup` - the new popup window + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawScalePopup()`, `PetscDrawCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawGetPopup")) +""" +function PetscDrawGetPopup(petsclib::PetscLibType, draw::PetscDraw, popup::PetscDraw) end + +@for_petsc function PetscDrawGetPopup(petsclib::$UnionPetscLib, draw::PetscDraw, popup::PetscDraw ) + + @chk ccall( + (:PetscDrawGetPopup, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{PetscDraw}), + draw, popup, + ) + + + return nothing +end + +""" + PetscDrawSetDisplay(petsclib::PetscLibType,draw::PetscDraw, display::String) +Sets the display where a `PetscDraw` object will be displayed + +Input Parameters: +- `draw` - the drawing context +- `display` - the X windows display + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawOpenX()`, `PetscDrawCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawSetDisplay")) +""" +function PetscDrawSetDisplay(petsclib::PetscLibType, draw::PetscDraw, display::String) end + +@for_petsc function PetscDrawSetDisplay(petsclib::$UnionPetscLib, draw::PetscDraw, display::String ) + + @chk ccall( + (:PetscDrawSetDisplay, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{Cchar}), + draw, display, + ) + + + return nothing +end + +""" + PetscDrawSetDoubleBuffer(petsclib::PetscLibType,draw::PetscDraw) +Sets a window to be double buffered. + +Logically Collective + +Input Parameter: +- `draw` - the drawing context + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawOpenX()`, `PetscDrawCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawSetDoubleBuffer")) +""" +function PetscDrawSetDoubleBuffer(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawSetDoubleBuffer(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawSetDoubleBuffer, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + PetscDrawGetSingleton(petsclib::PetscLibType,draw::PetscDraw, sdraw::PetscDraw) +Gain access to a `PetscDraw` object as if it were owned +by the one process. + +Collective + +Input Parameter: +- `draw` - the original window + +Output Parameter: +- `sdraw` - the singleton window + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawRestoreSingleton()`, `PetscViewerGetSingleton()`, `PetscViewerRestoreSingleton()` + +# External Links +$(_doc_external("Sys/PetscDrawGetSingleton")) +""" +function PetscDrawGetSingleton(petsclib::PetscLibType, draw::PetscDraw, sdraw::PetscDraw) end + +@for_petsc function PetscDrawGetSingleton(petsclib::$UnionPetscLib, draw::PetscDraw, sdraw::PetscDraw ) + + @chk ccall( + (:PetscDrawGetSingleton, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{PetscDraw}), + draw, sdraw, + ) + + + return nothing +end + +""" + PetscDrawRestoreSingleton(petsclib::PetscLibType,draw::PetscDraw, sdraw::PetscDraw) +Remove access to a `PetscDraw` object obtained with `PetscDrawGetSingleton()` +by the one process. + +Collective + +Input Parameters: +- `draw` - the original window +- `sdraw` - the singleton window + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawGetSingleton()`, `PetscViewerGetSingleton()`, `PetscViewerRestoreSingleton()` + +# External Links +$(_doc_external("Sys/PetscDrawRestoreSingleton")) +""" +function PetscDrawRestoreSingleton(petsclib::PetscLibType, draw::PetscDraw, sdraw::PetscDraw) end + +@for_petsc function PetscDrawRestoreSingleton(petsclib::$UnionPetscLib, draw::PetscDraw, sdraw::PetscDraw ) + + @chk ccall( + (:PetscDrawRestoreSingleton, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{PetscDraw}), + draw, sdraw, + ) + + + return nothing +end + +""" + PetscDrawSetVisible(petsclib::PetscLibType,draw::PetscDraw, visible::PetscBool) +Sets if the drawing surface (the 'window') is visible on its display. + +Input Parameters: +- `draw` - the drawing window +- `visible` - if the surface should be visible + +Level: intermediate + +-seealso: `PetscDraw` + +# External Links +$(_doc_external("Sys/PetscDrawSetVisible")) +""" +function PetscDrawSetVisible(petsclib::PetscLibType, draw::PetscDraw, visible::PetscBool) end + +@for_petsc function PetscDrawSetVisible(petsclib::$UnionPetscLib, draw::PetscDraw, visible::PetscBool ) + + @chk ccall( + (:PetscDrawSetVisible, $petsc_library), + PetscErrorCode, + (PetscDraw, PetscBool), + draw, visible, + ) + + + return nothing +end + +""" + PetscDrawSetCoordinates(petsclib::PetscLibType,draw::PetscDraw, xl::PetscReal, yl::PetscReal, xr::PetscReal, yr::PetscReal) +Sets the application coordinates of the corners of +the window (or page). + +Not Collective + +Input Parameters: +- `draw` - the drawing object +- `xl` - the lower left x coordinate +- `yl` - the lower left y coordinate +- `xr` - the upper right x coordinate +- `yr` - the upper right y coordinate + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawGetCoordinates()` + +# External Links +$(_doc_external("Sys/PetscDrawSetCoordinates")) +""" +function PetscDrawSetCoordinates(petsclib::PetscLibType, draw::PetscDraw, xl::PetscReal, yl::PetscReal, xr::PetscReal, yr::PetscReal) end + +@for_petsc function PetscDrawSetCoordinates(petsclib::$UnionPetscLib, draw::PetscDraw, xl::$PetscReal, yl::$PetscReal, xr::$PetscReal, yr::$PetscReal ) + + @chk ccall( + (:PetscDrawSetCoordinates, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + draw, xl, yl, xr, yr, + ) + + + return nothing +end + +""" + xl::PetscReal,yl::PetscReal,xr::PetscReal,yr::PetscReal = PetscDrawGetCoordinates(petsclib::PetscLibType,draw::PetscDraw) +Gets the application coordinates of the corners of +the window (or page). + +Not Collective + +Input Parameter: +- `draw` - the drawing object + +Output Parameters: +- `xl` - the horizontal coordinate of the lower left corner of the drawing region. +- `yl` - the vertical coordinate of the lower left corner of the drawing region. +- `xr` - the horizontal coordinate of the upper right corner of the drawing region. +- `yr` - the vertical coordinate of the upper right corner of the drawing region. + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawSetCoordinates()` + +# External Links +$(_doc_external("Sys/PetscDrawGetCoordinates")) +""" +function PetscDrawGetCoordinates(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawGetCoordinates(petsclib::$UnionPetscLib, draw::PetscDraw ) + xl_ = Ref{$PetscReal}() + yl_ = Ref{$PetscReal}() + xr_ = Ref{$PetscReal}() + yr_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDrawGetCoordinates, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + draw, xl_, yl_, xr_, yr_, + ) + + xl = xl_[] + yl = yl_[] + xr = xr_[] + yr = yr_[] + + return xl,yl,xr,yr +end + +""" + xl::PetscReal,yl::PetscReal,xr::PetscReal,yr::PetscReal = PetscDrawGetBoundingBox(petsclib::PetscLibType,draw::PetscDraw) +Gets the bounding box of all `PetscDrawStringBoxed()` commands + +Not Collective + +Input Parameter: +- `draw` - the drawing context + +Output Parameters: +- `xl` - horizontal coordinate of lower left corner of bounding box +- `yl` - vertical coordinate of lower left corner of bounding box +- `xr` - horizontal coordinate of upper right corner of bounding box +- `yr` - vertical coordinate of upper right corner of bounding box + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawPushCurrentPoint()`, `PetscDrawPopCurrentPoint()`, `PetscDrawSetCurrentPoint()` + +# External Links +$(_doc_external("Sys/PetscDrawGetBoundingBox")) +""" +function PetscDrawGetBoundingBox(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawGetBoundingBox(petsclib::$UnionPetscLib, draw::PetscDraw ) + xl_ = Ref{$PetscReal}() + yl_ = Ref{$PetscReal}() + xr_ = Ref{$PetscReal}() + yr_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDrawGetBoundingBox, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + draw, xl_, yl_, xr_, yr_, + ) + + xl = xl_[] + yl = yl_[] + xr = xr_[] + yr = yr_[] + + return xl,yl,xr,yr +end + +""" + x::PetscReal,y::PetscReal = PetscDrawGetCurrentPoint(petsclib::PetscLibType,draw::PetscDraw) +Gets the current draw point, some codes use this point to determine where to draw next + +Not Collective + +Input Parameter: +- `draw` - the drawing context + +Output Parameters: +- `x` - horizontal coordinate of the current point +- `y` - vertical coordinate of the current point + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawPushCurrentPoint()`, `PetscDrawPopCurrentPoint()`, `PetscDrawSetCurrentPoint()` + +# External Links +$(_doc_external("Sys/PetscDrawGetCurrentPoint")) +""" +function PetscDrawGetCurrentPoint(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawGetCurrentPoint(petsclib::$UnionPetscLib, draw::PetscDraw ) + x_ = Ref{$PetscReal}() + y_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDrawGetCurrentPoint, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{$PetscReal}, Ptr{$PetscReal}), + draw, x_, y_, + ) + + x = x_[] + y = y_[] + + return x,y +end + +""" + PetscDrawSetCurrentPoint(petsclib::PetscLibType,draw::PetscDraw, x::PetscReal, y::PetscReal) +Sets the current draw point, some codes use this point to determine where to draw next + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `x` - horizontal coordinate of the current point +- `y` - vertical coordinate of the current point + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawPushCurrentPoint()`, `PetscDrawPopCurrentPoint()`, `PetscDrawGetCurrentPoint()` + +# External Links +$(_doc_external("Sys/PetscDrawSetCurrentPoint")) +""" +function PetscDrawSetCurrentPoint(petsclib::PetscLibType, draw::PetscDraw, x::PetscReal, y::PetscReal) end + +@for_petsc function PetscDrawSetCurrentPoint(petsclib::$UnionPetscLib, draw::PetscDraw, x::$PetscReal, y::$PetscReal ) + + @chk ccall( + (:PetscDrawSetCurrentPoint, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal), + draw, x, y, + ) + + + return nothing +end + +""" + PetscDrawPushCurrentPoint(petsclib::PetscLibType,draw::PetscDraw, x::PetscReal, y::PetscReal) +Pushes a new current draw point, retaining the old one, some codes use this point to determine where to draw next + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `x` - horizontal coordinate of the current point +- `y` - vertical coordinate of the current point + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawPopCurrentPoint()`, `PetscDrawGetCurrentPoint()` + +# External Links +$(_doc_external("Sys/PetscDrawPushCurrentPoint")) +""" +function PetscDrawPushCurrentPoint(petsclib::PetscLibType, draw::PetscDraw, x::PetscReal, y::PetscReal) end + +@for_petsc function PetscDrawPushCurrentPoint(petsclib::$UnionPetscLib, draw::PetscDraw, x::$PetscReal, y::$PetscReal ) + + @chk ccall( + (:PetscDrawPushCurrentPoint, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal), + draw, x, y, + ) + + + return nothing +end + +""" + PetscDrawPopCurrentPoint(petsclib::PetscLibType,draw::PetscDraw) +Pops a current draw point (discarding it) + +Not Collective + +Input Parameter: +- `draw` - the drawing context + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawPushCurrentPoint()`, `PetscDrawSetCurrentPoint()`, `PetscDrawGetCurrentPoint()` + +# External Links +$(_doc_external("Sys/PetscDrawPopCurrentPoint")) +""" +function PetscDrawPopCurrentPoint(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawPopCurrentPoint(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawPopCurrentPoint, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + PetscDrawLine(petsclib::PetscLibType,draw::PetscDraw, xl::PetscReal, yl::PetscReal, xr::PetscReal, yr::PetscReal, cl::Cint) +draws a line onto a drawable. + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `xl` - horizontal coordinate of first end point +- `yl` - vertical coordinate of first end point +- `xr` - horizontal coordinate of second end point +- `yr` - vertical coordinate of second end point +- `cl` - the colors of the endpoints + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawArrow()`, `PetscDrawLineSetWidth()`, `PetscDrawLineGetWidth()`, `PetscDrawRectangle()`, `PetscDrawTriangle()`, `PetscDrawEllipse()`, +`PetscDrawMarker()`, `PetscDrawPoint()` + +# External Links +$(_doc_external("Sys/PetscDrawLine")) +""" +function PetscDrawLine(petsclib::PetscLibType, draw::PetscDraw, xl::PetscReal, yl::PetscReal, xr::PetscReal, yr::PetscReal, cl::Cint) end + +@for_petsc function PetscDrawLine(petsclib::$UnionPetscLib, draw::PetscDraw, xl::$PetscReal, yl::$PetscReal, xr::$PetscReal, yr::$PetscReal, cl::Cint ) + + @chk ccall( + (:PetscDrawLine, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, $PetscReal, $PetscReal, Cint), + draw, xl, yl, xr, yr, cl, + ) + + + return nothing +end + +""" + PetscDrawArrow(petsclib::PetscLibType,draw::PetscDraw, xl::PetscReal, yl::PetscReal, xr::PetscReal, yr::PetscReal, cl::Cint) +draws a line with arrow head at end if the line is long enough + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `xl` - horizontal coordinate of first end point +- `yl` - vertical coordinate of first end point +- `xr` - horizontal coordinate of second end point +- `yr` - vertical coordinate of second end point +- `cl` - the colors of the endpoints + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawLine()`, `PetscDrawLineSetWidth()`, `PetscDrawLineGetWidth()`, `PetscDrawRectangle()`, `PetscDrawTriangle()`, `PetscDrawEllipse()`, +`PetscDrawMarker()`, `PetscDrawPoint()` + +# External Links +$(_doc_external("Sys/PetscDrawArrow")) +""" +function PetscDrawArrow(petsclib::PetscLibType, draw::PetscDraw, xl::PetscReal, yl::PetscReal, xr::PetscReal, yr::PetscReal, cl::Cint) end + +@for_petsc function PetscDrawArrow(petsclib::$UnionPetscLib, draw::PetscDraw, xl::$PetscReal, yl::$PetscReal, xr::$PetscReal, yr::$PetscReal, cl::Cint ) + + @chk ccall( + (:PetscDrawArrow, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, $PetscReal, $PetscReal, Cint), + draw, xl, yl, xr, yr, cl, + ) + + + return nothing +end + +""" + PetscDrawLineSetWidth(petsclib::PetscLibType,draw::PetscDraw, width::PetscReal) +Sets the line width for future draws. The width is +relative to the user coordinates of the window; 0.0 denotes the natural +width; 1.0 denotes the entire viewport. + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `width` - the width in user coordinates + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawLineGetWidth()`, `PetscDrawLine()`, `PetscDrawArrow()` + +# External Links +$(_doc_external("Sys/PetscDrawLineSetWidth")) +""" +function PetscDrawLineSetWidth(petsclib::PetscLibType, draw::PetscDraw, width::PetscReal) end + +@for_petsc function PetscDrawLineSetWidth(petsclib::$UnionPetscLib, draw::PetscDraw, width::$PetscReal ) + + @chk ccall( + (:PetscDrawLineSetWidth, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal), + draw, width, + ) + + + return nothing +end + +""" + width::PetscReal = PetscDrawLineGetWidth(petsclib::PetscLibType,draw::PetscDraw) +Gets the line width for future draws. The width is +relative to the user coordinates of the window; 0.0 denotes the natural +width; 1.0 denotes the interior viewport. + +Not Collective + +Input Parameter: +- `draw` - the drawing context + +Output Parameter: +- `width` - the width in user coordinates + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawLineSetWidth()`, `PetscDrawLine()`, `PetscDrawArrow()` + +# External Links +$(_doc_external("Sys/PetscDrawLineGetWidth")) +""" +function PetscDrawLineGetWidth(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawLineGetWidth(petsclib::$UnionPetscLib, draw::PetscDraw ) + width_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDrawLineGetWidth, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{$PetscReal}), + draw, width_, + ) + + width = width_[] + + return width +end + +""" + PetscDrawTriangle(petsclib::PetscLibType,draw::PetscDraw, x1::PetscReal, y_1::PetscReal, x2::PetscReal, y2::PetscReal, x3::PetscReal, y3::PetscReal, c1::Cint, c2::Cint, c3::Cint) +draws a triangle onto a drawable. + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `x1` - coordinate of the first vertex +- `y_1` - coordinate of the first vertex +- `x2` - coordinate of the second vertex +- `y2` - coordinate of the second vertex +- `x3` - coordinate of the third vertex +- `y3` - coordinate of the third vertex +- `c1` - color of the first vertex +- `c2` - color of the second vertex +- `c3` - color of the third vertext + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawLine()`, `PetscDrawRectangle()`, `PetscDrawEllipse()`, `PetscDrawMarker()`, `PetscDrawPoint()`, `PetscDrawArrow()` + +# External Links +$(_doc_external("Sys/PetscDrawTriangle")) +""" +function PetscDrawTriangle(petsclib::PetscLibType, draw::PetscDraw, x1::PetscReal, y_1::PetscReal, x2::PetscReal, y2::PetscReal, x3::PetscReal, y3::PetscReal, c1::Cint, c2::Cint, c3::Cint) end + +@for_petsc function PetscDrawTriangle(petsclib::$UnionPetscLib, draw::PetscDraw, x1::$PetscReal, y_1::$PetscReal, x2::$PetscReal, y2::$PetscReal, x3::$PetscReal, y3::$PetscReal, c1::Cint, c2::Cint, c3::Cint ) + + @chk ccall( + (:PetscDrawTriangle, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal, Cint, Cint, Cint), + draw, x1, y_1, x2, y2, x3, y3, c1, c2, c3, + ) + + + return nothing +end + +""" + PetscDrawScalePopup(petsclib::PetscLibType,popup::PetscDraw, min::PetscReal, max::PetscReal) +draws a contour scale window. + +Collective + +Input Parameters: +- `popup` - the window (often a window obtained via `PetscDrawGetPopup()` +- `min` - minimum value being plotted +- `max` - maximum value being plotted + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawGetPopup()`, `PetscDrawTensorContour()` + +# External Links +$(_doc_external("Sys/PetscDrawScalePopup")) +""" +function PetscDrawScalePopup(petsclib::PetscLibType, popup::PetscDraw, min::PetscReal, max::PetscReal) end + +@for_petsc function PetscDrawScalePopup(petsclib::$UnionPetscLib, popup::PetscDraw, min::$PetscReal, max::$PetscReal ) + + @chk ccall( + (:PetscDrawScalePopup, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal), + popup, min, max, + ) + + + return nothing +end + +""" + PetscDrawTensorContour(petsclib::PetscLibType,draw::PetscDraw, m::Cint, n::Cint, xi::Vector{PetscReal}, yi::Vector{PetscReal}, v::Vector{PetscReal}) +draws a contour plot for a two + +Collective, but `draw` must be sequential + +Input Parameters: +- `draw` - the draw context +- `m` - the number of local mesh points in the x direction +- `n` - the number of local mesh points in the y direction +- `xi` - the locations of the global mesh points in the horizontal direction (optional, use `NULL` to indicate uniform spacing on [0,1]) +- `yi` - the locations of the global mesh points in the vertical direction (optional, use `NULL` to indicate uniform spacing on [0,1]) +- `v` - the values + +Options Database Keys: +- `-draw_x_shared_colormap` - Indicates use of private colormap +- `-draw_contour_grid` - draws grid contour + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawTensorContourPatch()`, `PetscDrawScalePopup()` + +# External Links +$(_doc_external("Sys/PetscDrawTensorContour")) +""" +function PetscDrawTensorContour(petsclib::PetscLibType, draw::PetscDraw, m::Cint, n::Cint, xi::Vector{PetscReal}, yi::Vector{PetscReal}, v::Vector{PetscReal}) end + +@for_petsc function PetscDrawTensorContour(petsclib::$UnionPetscLib, draw::PetscDraw, m::Cint, n::Cint, xi::Vector{$PetscReal}, yi::Vector{$PetscReal}, v::Vector{$PetscReal} ) + + @chk ccall( + (:PetscDrawTensorContour, $petsc_library), + PetscErrorCode, + (PetscDraw, Cint, Cint, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + draw, m, n, xi, yi, v, + ) + + + return nothing +end + +""" + PetscDrawTensorContourPatch(petsclib::PetscLibType,draw::PetscDraw, m::Cint, n::Cint, x::PetscReal, y::PetscReal, min::PetscReal, max::PetscReal, v::PetscReal) +draws a rectangular patch of a contour plot +for a two-dimensional array. + +Not Collective + +Input Parameters: +- `draw` - the draw context +- `m` - the number of local mesh points in the x direction +- `n` - the number of local mesh points in the y direction +- `x` - the horizontal locations of the local mesh points +- `y` - the vertical locations of the local mesh points +- `min` - the minimum value in the entire contour +- `max` - the maximum value in the entire contour +- `v` - the data + +Options Database Key: +- `-draw_x_shared_colormap` - Activates private colormap + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawTensorContour()` + +# External Links +$(_doc_external("Sys/PetscDrawTensorContourPatch")) +""" +function PetscDrawTensorContourPatch(petsclib::PetscLibType, draw::PetscDraw, m::Cint, n::Cint, x::PetscReal, y::PetscReal, min::PetscReal, max::PetscReal, v::PetscReal) end + +@for_petsc function PetscDrawTensorContourPatch(petsclib::$UnionPetscLib, draw::PetscDraw, m::Cint, n::Cint, x::$PetscReal, y::$PetscReal, min::$PetscReal, max::$PetscReal, v::$PetscReal ) + + @chk ccall( + (:PetscDrawTensorContourPatch, $petsc_library), + PetscErrorCode, + (PetscDraw, Cint, Cint, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscReal, $PetscReal, Ptr{$PetscReal}), + draw, m, n, x, y, min, max, v, + ) + + + return nothing +end + +""" + PetscDrawPoint(petsclib::PetscLibType,draw::PetscDraw, xl::PetscReal, yl::PetscReal, cl::Cint) +draws a point onto a drawable. + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `xl` - horizatonal coordinate of the point +- `yl` - vertical coordinate of the point +- `cl` - the color of the point + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawPointPixel()`, `PetscDrawPointSetSize()`, `PetscDrawLine()`, `PetscDrawRectangle()`, `PetscDrawTriangle()`, `PetscDrawEllipse()`, +`PetscDrawMarker()`, `PetscDrawString()`, `PetscDrawArrow()` + +# External Links +$(_doc_external("Sys/PetscDrawPoint")) +""" +function PetscDrawPoint(petsclib::PetscLibType, draw::PetscDraw, xl::PetscReal, yl::PetscReal, cl::Cint) end + +@for_petsc function PetscDrawPoint(petsclib::$UnionPetscLib, draw::PetscDraw, xl::$PetscReal, yl::$PetscReal, cl::Cint ) + + @chk ccall( + (:PetscDrawPoint, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, Cint), + draw, xl, yl, cl, + ) + + + return nothing +end + +""" + PetscDrawPointPixel(petsclib::PetscLibType,draw::PetscDraw, x::Cint, y::Cint, c::Cint) +draws a point onto a drawable, in pixel coordinates + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `x` - horizontal pixel coordinates of the point +- `y` - vertical pixel coordinates of the point +- `c` - the color of the point + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawPoint()`, `PetscDrawPointSetSize()` + +# External Links +$(_doc_external("Sys/PetscDrawPointPixel")) +""" +function PetscDrawPointPixel(petsclib::PetscLibType, draw::PetscDraw, x::Cint, y::Cint, c::Cint) end + +@for_petsc function PetscDrawPointPixel(petsclib::$UnionPetscLib, draw::PetscDraw, x::Cint, y::Cint, c::Cint ) + + @chk ccall( + (:PetscDrawPointPixel, $petsc_library), + PetscErrorCode, + (PetscDraw, Cint, Cint, Cint), + draw, x, y, c, + ) + + + return nothing +end + +""" + PetscDrawPointSetSize(petsclib::PetscLibType,draw::PetscDraw, width::PetscReal) +Sets the point size for future draws. The size is +relative to the user coordinates of the window; 0.0 denotes the natural +width, 1.0 denotes the entire viewport. + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `width` - the width in user coordinates + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawPoint()`, `PetscDrawMarker()` + +# External Links +$(_doc_external("Sys/PetscDrawPointSetSize")) +""" +function PetscDrawPointSetSize(petsclib::PetscLibType, draw::PetscDraw, width::PetscReal) end + +@for_petsc function PetscDrawPointSetSize(petsclib::$UnionPetscLib, draw::PetscDraw, width::$PetscReal ) + + @chk ccall( + (:PetscDrawPointSetSize, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal), + draw, width, + ) + + + return nothing +end + +""" + PetscDrawClear(petsclib::PetscLibType,draw::PetscDraw) +Clears graphical output. All processors must call this routine. +Does not return until the draw in context is clear. + +Collective + +Input Parameter: +- `draw` - the drawing context + +Level: intermediate + +-seealso: `PetscDrawBOP()`, `PetscDrawEOP()` + +# External Links +$(_doc_external("Sys/PetscDrawClear")) +""" +function PetscDrawClear(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawClear(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawClear, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + PetscDrawBOP(petsclib::PetscLibType,draw::PetscDraw) +Begins a new page or frame on the selected graphical device. + +Logically Collective + +Input Parameter: +- `draw` - the drawing context + +Level: advanced + +-seealso: `PetscDrawEOP()`, `PetscDrawClear()` + +# External Links +$(_doc_external("Sys/PetscDrawBOP")) +""" +function PetscDrawBOP(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawBOP(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawBOP, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + PetscDrawEOP(petsclib::PetscLibType,draw::PetscDraw) +Ends a page or frame on the selected graphical device. + +Logically Collective + +Input Parameter: +- `draw` - the drawing context + +Level: advanced + +-seealso: `PetscDrawBOP()`, `PetscDrawClear()` + +# External Links +$(_doc_external("Sys/PetscDrawEOP")) +""" +function PetscDrawEOP(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawEOP(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawEOP, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + PetscDrawPause(petsclib::PetscLibType,draw::PetscDraw) +Waits n seconds or until user input, depending on input +to `PetscDrawSetPause()`. + +Collective + +Input Parameter: +- `draw` - the drawing context + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawSetPause()`, `PetscDrawGetPause()` + +# External Links +$(_doc_external("Sys/PetscDrawPause")) +""" +function PetscDrawPause(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawPause(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawPause, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + PetscDrawSetPause(petsclib::PetscLibType,draw::PetscDraw, lpause::PetscReal) +Sets the amount of time that program pauses after +a `PetscDrawPause()` is called. + +Logically Collective + +Input Parameters: +- `draw` - the drawing object +- `lpause` - number of seconds to pause, -1 implies until user input, -2 pauses only on the `PetscDrawDestroy()` + +Options Database Key: +- `-draw_pause value` - set the time to pause + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawGetPause()`, `PetscDrawPause()` + +# External Links +$(_doc_external("Sys/PetscDrawSetPause")) +""" +function PetscDrawSetPause(petsclib::PetscLibType, draw::PetscDraw, lpause::PetscReal) end + +@for_petsc function PetscDrawSetPause(petsclib::$UnionPetscLib, draw::PetscDraw, lpause::$PetscReal ) + + @chk ccall( + (:PetscDrawSetPause, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal), + draw, lpause, + ) + + + return nothing +end + +""" + PetscDrawGetPause(petsclib::PetscLibType,draw::PetscDraw, lpause::PetscReal) +Gets the amount of time that program pauses after +a `PetscDrawPause()` is called. + +Not Collective + +Input Parameters: +- `draw` - the drawing object +- `lpause` - number of seconds to pause, -1 implies until user input + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawSetPause()`, `PetscDrawPause()` + +# External Links +$(_doc_external("Sys/PetscDrawGetPause")) +""" +function PetscDrawGetPause(petsclib::PetscLibType, draw::PetscDraw, lpause::PetscReal) end + +@for_petsc function PetscDrawGetPause(petsclib::$UnionPetscLib, draw::PetscDraw, lpause::$PetscReal ) + + @chk ccall( + (:PetscDrawGetPause, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{$PetscReal}), + draw, lpause, + ) + + + return nothing +end + +""" + PetscDrawMarker(petsclib::PetscLibType,draw::PetscDraw, xl::PetscReal, yl::PetscReal, cl::Cint) +draws a marker onto a drawable. + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `xl` - horizontal coordinate of the marker +- `yl` - vertical coordinate of the marker +- `cl` - the color of the marker + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawPoint()`, `PetscDrawString()`, `PetscDrawSetMarkerType()`, `PetscDrawGetMarkerType()` + +# External Links +$(_doc_external("Sys/PetscDrawMarker")) +""" +function PetscDrawMarker(petsclib::PetscLibType, draw::PetscDraw, xl::PetscReal, yl::PetscReal, cl::Cint) end + +@for_petsc function PetscDrawMarker(petsclib::$UnionPetscLib, draw::PetscDraw, xl::$PetscReal, yl::$PetscReal, cl::Cint ) + + @chk ccall( + (:PetscDrawMarker, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, Cint), + draw, xl, yl, cl, + ) + + + return nothing +end + +""" + PetscDrawSetMarkerType(petsclib::PetscLibType,draw::PetscDraw, mtype::PetscDrawMarkerType) +sets the type of marker to display with `PetscDrawMarker()` + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `mtype` - either `PETSC_DRAW_MARKER_CROSS` (default) or `PETSC_DRAW_MARKER_POINT` + +Options Database Key: +- `-draw_marker_type` - x or point + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawPoint()`, `PetscDrawMarker()`, `PetscDrawGetMarkerType()`, `PetscDrawMarkerType` + +# External Links +$(_doc_external("Sys/PetscDrawSetMarkerType")) +""" +function PetscDrawSetMarkerType(petsclib::PetscLibType, draw::PetscDraw, mtype::PetscDrawMarkerType) end + +@for_petsc function PetscDrawSetMarkerType(petsclib::$UnionPetscLib, draw::PetscDraw, mtype::PetscDrawMarkerType ) + + @chk ccall( + (:PetscDrawSetMarkerType, $petsc_library), + PetscErrorCode, + (PetscDraw, PetscDrawMarkerType), + draw, mtype, + ) + + + return nothing +end + +""" + PetscDrawGetMarkerType(petsclib::PetscLibType,draw::PetscDraw, mtype::PetscDrawMarkerType) +gets the type of marker to display with `PetscDrawMarker()` + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `mtype` - either `PETSC_DRAW_MARKER_CROSS` (default) or `PETSC_DRAW_MARKER_POINT` + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawPoint()`, `PetscDrawMarker()`, `PetscDrawSetMarkerType()`, `PetscDrawMarkerType` + +# External Links +$(_doc_external("Sys/PetscDrawGetMarkerType")) +""" +function PetscDrawGetMarkerType(petsclib::PetscLibType, draw::PetscDraw, mtype::PetscDrawMarkerType) end + +@for_petsc function PetscDrawGetMarkerType(petsclib::$UnionPetscLib, draw::PetscDraw, mtype::PetscDrawMarkerType ) + + @chk ccall( + (:PetscDrawGetMarkerType, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{PetscDrawMarkerType}), + draw, mtype, + ) + + + return nothing +end + +""" + PetscDrawIndicatorFunction(petsclib::PetscLibType,draw::PetscDraw, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, c::Cint, indicator::external, ctx::Cvoid) +Draws an indicator function (where a relationship is true) on a `PetscDraw` + +Not Collective + +Input Parameters: +- `draw` - a `PetscDraw` +- `xmin` - region to draw indicator function +- `xmax` - region to draw indicator function +- `ymin` - region to draw indicator function +- `ymax` - region to draw indicator function +- `c` - the color of the region +- `indicator` - the indicator function +- `ctx` - the context to pass to the indicator function + +Level: developer + +-seealso: `PetscDraw` + +# External Links +$(_doc_external("Sys/PetscDrawIndicatorFunction")) +""" +function PetscDrawIndicatorFunction(petsclib::PetscLibType, draw::PetscDraw, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, c::Cint, indicator::external, ctx::Cvoid) end + +@for_petsc function PetscDrawIndicatorFunction(petsclib::$UnionPetscLib, draw::PetscDraw, xmin::$PetscReal, xmax::$PetscReal, ymin::$PetscReal, ymax::$PetscReal, c::Cint, indicator::external, ctx::Cvoid ) + + @chk ccall( + (:PetscDrawIndicatorFunction, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, $PetscReal, $PetscReal, Cint, external, Ptr{Cvoid}), + draw, xmin, xmax, ymin, ymax, c, indicator, ctx, + ) + + + return nothing +end + +""" + PetscDrawCoordinateToPixel(petsclib::PetscLibType,draw::PetscDraw, x::PetscReal, y::PetscReal, i::Cint, j::Cint) +given a coordinate in a `PetscDraw` returns the pixel location + +Not Collective + +Input Parameters: +- `draw` - the draw where the coordinates are defined +- `x` - the horizontal coordinate +- `y` - the vertical coordinate + +Output Parameters: +- `i` - the horizontal pixel location +- `j` - the vertical pixel location + +Level: developer + +-seealso: `PetscDraw` + +# External Links +$(_doc_external("Sys/PetscDrawCoordinateToPixel")) +""" +function PetscDrawCoordinateToPixel(petsclib::PetscLibType, draw::PetscDraw, x::PetscReal, y::PetscReal, i::Cint, j::Cint) end + +@for_petsc function PetscDrawCoordinateToPixel(petsclib::$UnionPetscLib, draw::PetscDraw, x::$PetscReal, y::$PetscReal, i::Cint, j::Cint ) + + @chk ccall( + (:PetscDrawCoordinateToPixel, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, Ptr{Cint}, Ptr{Cint}), + draw, x, y, i, j, + ) + + + return nothing +end + +""" + x::PetscReal,y::PetscReal = PetscDrawPixelToCoordinate(petsclib::PetscLibType,draw::PetscDraw, i::Cint, j::Cint) +given a pixel in a `PetscDraw` returns the coordinate + +Not Collective + +Input Parameters: +- `draw` - the draw where the coordinates are defined +- `i` - the horizontal pixel location +- `j` - the vertical pixel location + +Output Parameters: +- `x` - the horizontal coordinate +- `y` - the vertical coordinate + +Level: developer + +-seealso: `PetscDraw` + +# External Links +$(_doc_external("Sys/PetscDrawPixelToCoordinate")) +""" +function PetscDrawPixelToCoordinate(petsclib::PetscLibType, draw::PetscDraw, i::Cint, j::Cint) end + +@for_petsc function PetscDrawPixelToCoordinate(petsclib::$UnionPetscLib, draw::PetscDraw, i::Cint, j::Cint ) + x_ = Ref{$PetscReal}() + y_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDrawPixelToCoordinate, $petsc_library), + PetscErrorCode, + (PetscDraw, Cint, Cint, Ptr{$PetscReal}, Ptr{$PetscReal}), + draw, i, j, x_, y_, + ) + + x = x_[] + y = y_[] + + return x,y +end + +""" + PetscDrawRectangle(petsclib::PetscLibType,draw::PetscDraw, xl::PetscReal, yl::PetscReal, xr::PetscReal, yr::PetscReal, c1::Cint, c2::Cint, c3::Cint, c4::Cint) +draws a rectangle onto a `PetscDraw` object + +Not Collective + +Input Parameters: +- `draw` - the drawing context +- `xl` - coordinates of the lower left corner +- `yl` - coordinates of the lower left corner +- `xr` - coordinate of the upper right corner +- `yr` - coordinate of the upper right corner +- `c1` - the color of the first corner +- `c2` - the color of the second corner +- `c3` - the color of the third corner +- `c4` - the color of the fourth corner + +Level: beginner + +-seealso: `PetscDraw`, `PetscDrawLine()`, `PetscDrawTriangle()`, `PetscDrawEllipse()`, +`PetscDrawMarker()`, `PetscDrawPoint()`, `PetscDrawString()`, `PetscDrawArrow()` + +# External Links +$(_doc_external("Sys/PetscDrawRectangle")) +""" +function PetscDrawRectangle(petsclib::PetscLibType, draw::PetscDraw, xl::PetscReal, yl::PetscReal, xr::PetscReal, yr::PetscReal, c1::Cint, c2::Cint, c3::Cint, c4::Cint) end + +@for_petsc function PetscDrawRectangle(petsclib::$UnionPetscLib, draw::PetscDraw, xl::$PetscReal, yl::$PetscReal, xr::$PetscReal, yr::$PetscReal, c1::Cint, c2::Cint, c3::Cint, c4::Cint ) + + @chk ccall( + (:PetscDrawRectangle, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscReal, $PetscReal, $PetscReal, $PetscReal, Cint, Cint, Cint, Cint), + draw, xl, yl, xr, yr, c1, c2, c3, c4, + ) + + + return nothing +end + +""" + PetscDrawOpenImage(petsclib::PetscLibType,comm::MPI_Comm, filename::String, w::Cint, h::Cint, draw::PetscDraw) +Opens an image for use with the `PetscDraw` routines. + +Collective + +Input Parameters: +- `comm` - the communicator that will share image +- `filename` - optional name of the file where the image will be stored +- `w` - the image width in pixels +- `h` - the image height in pixels + +Output Parameter: +- `draw` - the drawing context. + +Level: beginner + +-seealso: `PetscDraw`, `PETSC_DRAW_IMAGE`, `PETSC_DRAW_X`, `PetscDrawSetSave()`, `PetscDrawSetFromOptions()`, `PetscDrawCreate()`, `PetscDrawDestroy()` + +# External Links +$(_doc_external("Sys/PetscDrawOpenImage")) +""" +function PetscDrawOpenImage(petsclib::PetscLibType, comm::MPI_Comm, filename::String, w::Cint, h::Cint, draw::PetscDraw) end + +@for_petsc function PetscDrawOpenImage(petsclib::$UnionPetscLib, comm::MPI_Comm, filename::String, w::Cint, h::Cint, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawOpenImage, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Cint, Cint, Ptr{PetscDraw}), + comm, filename, w, h, draw, + ) + + + return nothing +end + +""" + PetscDrawOpenNull(petsclib::PetscLibType,comm::MPI_Comm, win::PetscDraw) +Opens a null drawing context. All draw commands to +it are ignored. + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `win` - the drawing context + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawIsNull()`, `PETSC_DRAW_NULL`, `PetscDrawOpenX()` + +# External Links +$(_doc_external("Sys/PetscDrawOpenNull")) +""" +function PetscDrawOpenNull(petsclib::PetscLibType, comm::MPI_Comm, win::PetscDraw) end + +@for_petsc function PetscDrawOpenNull(petsclib::$UnionPetscLib, comm::MPI_Comm, win::PetscDraw ) + + @chk ccall( + (:PetscDrawOpenNull, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscDraw}), + comm, win, + ) + + + return nothing +end + +""" + yes::PetscBool = PetscDrawIsNull(petsclib::PetscLibType,draw::PetscDraw) +Returns `PETSC_TRUE` if draw is a null draw object. + +Not Collective + +Input Parameter: +- `draw` - the draw context + +Output Parameter: +- `yes` - `PETSC_TRUE` if it is a null draw object; otherwise `PETSC_FALSE` + +Level: advanced + +-seealso: `PetscDraw`, `PETSC_DRAW_NULL`, `PetscDrawOpenX()` + +# External Links +$(_doc_external("Sys/PetscDrawIsNull")) +""" +function PetscDrawIsNull(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawIsNull(petsclib::$UnionPetscLib, draw::PetscDraw ) + yes_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDrawIsNull, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{PetscBool}), + draw, yes_, + ) + + yes = yes_[] + + return yes +end + +""" + PetscDrawOpenX(petsclib::PetscLibType,comm::MPI_Comm, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint, draw::PetscDraw) +Opens an X + +Collective + +Input Parameters: +- `comm` - the communicator that will share X-window +- `display` - the X display on which to open, or `NULL` for the local machine +- `title` - the title to put in the title bar, or `NULL` for no title +- `x` - the x screen coordinates of the upper left corner of window (or `PETSC_DECIDE`) +- `y` - the y screen coordinates of the upper left corner of window (or `PETSC_DECIDE`) +- `w` - the screen width in pixels of (or `PETSC_DRAW_HALF_SIZE`, `PETSC_DRAW_FULL_SIZE`, or `PETSC_DRAW_THIRD_SIZE` or `PETSC_DRAW_QUARTER_SIZE`) +- `h` - the screen height in pixels of (or `PETSC_DRAW_HALF_SIZE`, `PETSC_DRAW_FULL_SIZE`, or `PETSC_DRAW_THIRD_SIZE` or `PETSC_DRAW_QUARTER_SIZE`) + +Output Parameter: +- `draw` - the drawing context. + +Options Database Keys: +- `-nox` - Disables all x-windows output +- `-display ` - Sets name of machine for the X display +- `-draw_pause ` - Sets time (in seconds) that the program pauses after `PetscDrawPause()` has been called +(0 is default, -1 implies until user input). +- `-draw_cmap ` - Sets the colormap to use. +- `-draw_cmap_reverse` - Reverses the colormap. +- `-draw_cmap_brighten` - Brighten (0 < beta < 1) or darken (-1 < beta < 0) the colormap. +- `-draw_x_shared_colormap` - Causes PETSc to use a shared colormap. By default PETSc creates a separate color +for its windows, you must put the mouse into the graphics +window to see the correct colors. This options forces +PETSc to use the default colormap which will usually result +in bad contour plots. +- `-draw_fast` - Does not create colormap for contour plots. +- `-draw_double_buffer` - Uses double buffering for smooth animation. +- `-geometry` - Indicates location and size of window. + +Level: beginner + +-seealso: `PetscDrawFlush()`, `PetscDrawDestroy()`, `PetscDrawCreate()`, `PetscDrawOpnOpenGL()` + +# External Links +$(_doc_external("Sys/PetscDrawOpenX")) +""" +function PetscDrawOpenX(petsclib::PetscLibType, comm::MPI_Comm, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint, draw::PetscDraw) end + +@for_petsc function PetscDrawOpenX(petsclib::$UnionPetscLib, comm::MPI_Comm, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawOpenX, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Cint, Cint, Cint, Cint, Ptr{PetscDraw}), + comm, display, title, x, y, w, h, draw, + ) + + + return nothing +end + +""" + PetscDrawZoom(petsclib::PetscLibType,draw::PetscDraw, func::external, ctx::Cvoid) +Allows one to provide a function that gets called for zooming in on a drawing using the mouse buttons + +Collective draw + +Input Parameters: +- `draw` - the window where the graph will be made. +- `func` - users function that draws the graphic +- `ctx` - pointer to any user required data + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawZoom")) +""" +function PetscDrawZoom(petsclib::PetscLibType, draw::PetscDraw, func::external, ctx::Cvoid) end + +@for_petsc function PetscDrawZoom(petsclib::$UnionPetscLib, draw::PetscDraw, func::external, ctx::Cvoid ) + + @chk ccall( + (:PetscDrawZoom, $petsc_library), + PetscErrorCode, + (PetscDraw, external, Ptr{Cvoid}), + draw, func, ctx, + ) + + + return nothing +end + +""" + PetscDrawUtilitySetGamma(petsclib::PetscLibType,g::PetscReal) + +# External Links +$(_doc_external("Sys/PetscDrawUtilitySetGamma")) +""" +function PetscDrawUtilitySetGamma(petsclib::PetscLibType, g::PetscReal) end + +@for_petsc function PetscDrawUtilitySetGamma(petsclib::$UnionPetscLib, g::$PetscReal ) + + @chk ccall( + (:PetscDrawUtilitySetGamma, $petsc_library), + PetscErrorCode, + ($PetscReal,), + g, + ) + + + return nothing +end + +#= +""" + PetscDrawUtilitySetCmap(petsclib::PetscLibType,colormap::String, mapsize::Cint, char::Vector{unsigned}, char::Vector{unsigned}, char::Vector{unsigned}) + +# External Links +$(_doc_external("Sys/PetscDrawUtilitySetCmap")) +""" +function PetscDrawUtilitySetCmap(petsclib::PetscLibType, colormap::String, mapsize::Cint, char::Vector{unsigned}, char::Vector{unsigned}, char::Vector{unsigned}) end + +@for_petsc function PetscDrawUtilitySetCmap(petsclib::$UnionPetscLib, colormap::String, mapsize::Cint, char::Vector{unsigned}, char::Vector{unsigned}, char::Vector{unsigned} ) + + @chk ccall( + (:PetscDrawUtilitySetCmap, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cint, Ptr{unsigned}, Ptr{unsigned}, Ptr{unsigned}), + colormap, mapsize, char, char, char, + ) + + + return nothing +end +=# + +""" + axis::PetscDrawAxis = PetscDrawAxisCreate(petsclib::PetscLibType,draw::PetscDraw) +Generate the axis data structure. + +Collective + +Input Parameter: +- `draw` - `PetscDraw` object where axis to be made + +Output Parameter: +- `axis` - the axis datastructure + +-seealso: `PetscDrawLGCreate()`, `PetscDrawLG`, `PetscDrawSPCreate()`, `PetscDrawSP`, `PetscDrawHGCreate()`, `PetscDrawHG`, `PetscDrawBarCreate()`, `PetscDrawBar`, `PetscDrawLGGetAxis()`, `PetscDrawSPGetAxis()`, +`PetscDrawHGGetAxis()`, `PetscDrawBarGetAxis()`, `PetscDrawAxis`, `PetscDrawAxisDestroy()`, `PetscDrawAxisSetColors()`, `PetscDrawAxisSetLabels()`, `PetscDrawAxisSetLimits()`, `PetscDrawAxisGetLimits()`, `PetscDrawAxisSetHoldLimits()`, +`PetscDrawAxisDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawAxisCreate")) +""" +function PetscDrawAxisCreate(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawAxisCreate(petsclib::$UnionPetscLib, draw::PetscDraw ) + axis_ = Ref{PetscDrawAxis}() + + @chk ccall( + (:PetscDrawAxisCreate, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{PetscDrawAxis}), + draw, axis_, + ) + + axis = axis_[] + + return axis +end + +""" + PetscDrawAxisDestroy(petsclib::PetscLibType,axis::PetscDrawAxis) +Frees the space used by an axis structure. + +Collective + +Input Parameter: +- `axis` - the axis context + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawAxisCreate()`, `PetscDrawAxis` + +# External Links +$(_doc_external("Sys/PetscDrawAxisDestroy")) +""" +function PetscDrawAxisDestroy(petsclib::PetscLibType, axis::PetscDrawAxis) end + +@for_petsc function PetscDrawAxisDestroy(petsclib::$UnionPetscLib, axis::PetscDrawAxis ) + + @chk ccall( + (:PetscDrawAxisDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDrawAxis},), + axis, + ) + + + return nothing +end + +""" + PetscDrawAxisSetColors(petsclib::PetscLibType,axis::PetscDrawAxis, ac::Cint, tc::Cint, cc::Cint) +Sets the colors to be used for the axis, +tickmarks, and text. + +Logically Collective + +Input Parameters: +- `axis` - the axis +- `ac` - the color of the axis lines +- `tc` - the color of the tick marks +- `cc` - the color of the text strings + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawAxisCreate()`, `PetscDrawAxis`, `PetscDrawAxisSetLabels()`, `PetscDrawAxisDraw()`, `PetscDrawAxisSetLimits()` + +# External Links +$(_doc_external("Sys/PetscDrawAxisSetColors")) +""" +function PetscDrawAxisSetColors(petsclib::PetscLibType, axis::PetscDrawAxis, ac::Cint, tc::Cint, cc::Cint) end + +@for_petsc function PetscDrawAxisSetColors(petsclib::$UnionPetscLib, axis::PetscDrawAxis, ac::Cint, tc::Cint, cc::Cint ) + + @chk ccall( + (:PetscDrawAxisSetColors, $petsc_library), + PetscErrorCode, + (PetscDrawAxis, Cint, Cint, Cint), + axis, ac, tc, cc, + ) + + + return nothing +end + +""" + PetscDrawAxisSetLabels(petsclib::PetscLibType,axis::PetscDrawAxis, top::String, xlabel::String, ylabel::String) +Sets the x and y axis labels. + +Logically Collective + +Input Parameters: +- `axis` - the axis +- `top` - the label at the top of the image +- `xlabel` - the x axis label +- `ylabel` - the y axis label + +Level: advanced + +-seealso: `PetscDraw`, `PetscDrawAxisCreate()`, `PetscDrawAxis`, `PetscDrawAxisSetColors()`, `PetscDrawAxisDraw()`, `PetscDrawAxisSetLimits()` + +# External Links +$(_doc_external("Sys/PetscDrawAxisSetLabels")) +""" +function PetscDrawAxisSetLabels(petsclib::PetscLibType, axis::PetscDrawAxis, top::String, xlabel::String, ylabel::String) end + +@for_petsc function PetscDrawAxisSetLabels(petsclib::$UnionPetscLib, axis::PetscDrawAxis, top::String, xlabel::String, ylabel::String ) + + @chk ccall( + (:PetscDrawAxisSetLabels, $petsc_library), + PetscErrorCode, + (PetscDrawAxis, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}), + axis, top, xlabel, ylabel, + ) + + + return nothing +end + +""" + PetscDrawAxisSetLimits(petsclib::PetscLibType,axis::PetscDrawAxis, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal) +Sets the limits (in user coords) of the axis + +Logically Collective + +Input Parameters: +- `axis` - the axis +- `xmin` - the lower x limit +- `xmax` - the upper x limit +- `ymin` - the lower y limit +- `ymax` - the upper y limit + +Options Database Key: +- `-drawaxis_hold` - hold the initial set of axis limits for future plotting + +Level: advanced + +-seealso: `PetscDrawAxisSetHoldLimits()`, `PetscDrawAxisGetLimits()`, `PetscDrawAxisSetLabels()`, `PetscDrawAxisSetColors()` + +# External Links +$(_doc_external("Sys/PetscDrawAxisSetLimits")) +""" +function PetscDrawAxisSetLimits(petsclib::PetscLibType, axis::PetscDrawAxis, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal) end + +@for_petsc function PetscDrawAxisSetLimits(petsclib::$UnionPetscLib, axis::PetscDrawAxis, xmin::$PetscReal, xmax::$PetscReal, ymin::$PetscReal, ymax::$PetscReal ) + + @chk ccall( + (:PetscDrawAxisSetLimits, $petsc_library), + PetscErrorCode, + (PetscDrawAxis, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + axis, xmin, xmax, ymin, ymax, + ) + + + return nothing +end + +""" + PetscDrawAxisGetLimits(petsclib::PetscLibType,axis::PetscDrawAxis, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal) +Gets the limits (in user coords) of the axis + +Not Collective + +Input Parameters: +- `axis` - the axis +- `xmin` - the lower x limit +- `xmax` - the upper x limit +- `ymin` - the lower y limit +- `ymax` - the upper y limit + +Level: advanced + +-seealso: `PetscDrawAxisCreate()`, `PetscDrawAxis`, `PetscDrawAxisSetHoldLimits()`, `PetscDrawAxisSetLimits()`, `PetscDrawAxisSetLabels()`, `PetscDrawAxisSetColors()` + +# External Links +$(_doc_external("Sys/PetscDrawAxisGetLimits")) +""" +function PetscDrawAxisGetLimits(petsclib::PetscLibType, axis::PetscDrawAxis, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal) end + +@for_petsc function PetscDrawAxisGetLimits(petsclib::$UnionPetscLib, axis::PetscDrawAxis, xmin::$PetscReal, xmax::$PetscReal, ymin::$PetscReal, ymax::$PetscReal ) + + @chk ccall( + (:PetscDrawAxisGetLimits, $petsc_library), + PetscErrorCode, + (PetscDrawAxis, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + axis, xmin, xmax, ymin, ymax, + ) + + + return nothing +end + +""" + PetscDrawAxisSetHoldLimits(petsclib::PetscLibType,axis::PetscDrawAxis, hold::PetscBool) +Causes an axis to keep the same limits until this is called +again + +Logically Collective + +Input Parameters: +- `axis` - the axis +- `hold` - `PETSC_TRUE` - hold current limits, `PETSC_FALSE` allow limits to be changed + +Level: advanced + +-seealso: `PetscDrawAxisCreate()`, `PetscDrawAxis`, `PetscDrawAxisGetLimits()`, `PetscDrawAxisSetLimits()`, `PetscDrawAxisSetLabels()`, `PetscDrawAxisSetColors()` + +# External Links +$(_doc_external("Sys/PetscDrawAxisSetHoldLimits")) +""" +function PetscDrawAxisSetHoldLimits(petsclib::PetscLibType, axis::PetscDrawAxis, hold::PetscBool) end + +@for_petsc function PetscDrawAxisSetHoldLimits(petsclib::$UnionPetscLib, axis::PetscDrawAxis, hold::PetscBool ) + + @chk ccall( + (:PetscDrawAxisSetHoldLimits, $petsc_library), + PetscErrorCode, + (PetscDrawAxis, PetscBool), + axis, hold, + ) + + + return nothing +end + +""" + PetscDrawAxisDraw(petsclib::PetscLibType,axis::PetscDrawAxis) +draws an axis. + +Collective + +Input Parameter: +- `axis` - `PetscDrawAxis` structure + +Level: advanced + +-seealso: `PetscDrawAxisCreate()`, `PetscDrawAxis`, `PetscDrawAxisGetLimits()`, `PetscDrawAxisSetLimits()`, `PetscDrawAxisSetLabels()`, `PetscDrawAxisSetColors()` + +# External Links +$(_doc_external("Sys/PetscDrawAxisDraw")) +""" +function PetscDrawAxisDraw(petsclib::PetscLibType, axis::PetscDrawAxis) end + +@for_petsc function PetscDrawAxisDraw(petsclib::$UnionPetscLib, axis::PetscDrawAxis ) + + @chk ccall( + (:PetscDrawAxisDraw, $petsc_library), + PetscErrorCode, + (PetscDrawAxis,), + axis, + ) + + + return nothing +end + +""" + PetscDrawLGGetAxis(petsclib::PetscLibType,lg::PetscDrawLG, axis::PetscDrawAxis) +Gets the axis context associated with a line graph. +This is useful if one wants to change some axis property, such as +labels, color, etc. The axis context should not be destroyed by the +application code. + +Not Collective, if lg is parallel then axis is parallel + +Input Parameter: +- `lg` - the line graph context + +Output Parameter: +- `axis` - the axis context + +Level: advanced + +-seealso: `PetscDrawLGCreate()`, `PetscDrawAxis`, `PetscDrawLG` + +# External Links +$(_doc_external("Sys/PetscDrawLGGetAxis")) +""" +function PetscDrawLGGetAxis(petsclib::PetscLibType, lg::PetscDrawLG, axis::PetscDrawAxis) end + +@for_petsc function PetscDrawLGGetAxis(petsclib::$UnionPetscLib, lg::PetscDrawLG, axis::PetscDrawAxis ) + + @chk ccall( + (:PetscDrawLGGetAxis, $petsc_library), + PetscErrorCode, + (PetscDrawLG, Ptr{PetscDrawAxis}), + lg, axis, + ) + + + return nothing +end + +""" + PetscDrawLGGetDraw(petsclib::PetscLibType,lg::PetscDrawLG, draw::PetscDraw) +Gets the draw context associated with a line graph. + +Not Collective, if lg is parallel then draw is parallel + +Input Parameter: +- `lg` - the line graph context + +Output Parameter: +- `draw` - the draw context + +Level: intermediate + +-seealso: `PetscDrawLGCreate()`, `PetscDraw`, `PetscDrawLG` + +# External Links +$(_doc_external("Sys/PetscDrawLGGetDraw")) +""" +function PetscDrawLGGetDraw(petsclib::PetscLibType, lg::PetscDrawLG, draw::PetscDraw) end + +@for_petsc function PetscDrawLGGetDraw(petsclib::$UnionPetscLib, lg::PetscDrawLG, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawLGGetDraw, $petsc_library), + PetscErrorCode, + (PetscDrawLG, Ptr{PetscDraw}), + lg, draw, + ) + + + return nothing +end + +""" + PetscDrawLGSPDraw(petsclib::PetscLibType,lg::PetscDrawLG, spin::PetscDrawSP) +Redraws a line graph and a scatter plot on the same `PetscDraw` they must share + +Collective + +Input Parameters: +- `lg` - the line graph context +- `spin` - the scatter plot + +Level: intermediate + +-seealso: `PetscDrawLGDraw()`, `PetscDrawSPDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawLGSPDraw")) +""" +function PetscDrawLGSPDraw(petsclib::PetscLibType, lg::PetscDrawLG, spin::PetscDrawSP) end + +@for_petsc function PetscDrawLGSPDraw(petsclib::$UnionPetscLib, lg::PetscDrawLG, spin::PetscDrawSP ) + + @chk ccall( + (:PetscDrawLGSPDraw, $petsc_library), + PetscErrorCode, + (PetscDrawLG, PetscDrawSP), + lg, spin, + ) + + + return nothing +end + +""" + outlg::PetscDrawLG = PetscDrawLGCreate(petsclib::PetscLibType,draw::PetscDraw, dim::PetscInt) +Creates a line graph data structure. + +Collective + +Input Parameters: +- `draw` - the window where the graph will be made. +- `dim` - the number of curves which will be drawn + +Output Parameter: +- `outlg` - the line graph context + +Level: intermediate + +-seealso: `PetscDrawLGDestroy()`, `PetscDrawLGAddPoint()`, `PetscDrawLGAddCommonPoint()`, `PetscDrawLGAddPoints()`, `PetscDrawLGDraw()`, `PetscDrawLGSave()`, +`PetscDrawLGView()`, `PetscDrawLGReset()`, `PetscDrawLGSetDimension()`, `PetscDrawLGGetDimension()`, `PetscDrawLGSetLegend()`, `PetscDrawLGGetAxis()`, +`PetscDrawLGGetDraw()`, `PetscDrawLGSetUseMarkers()`, `PetscDrawLGSetLimits()`, `PetscDrawLGSetColors()`, `PetscDrawLGSetOptionsPrefix()`, `PetscDrawLGSetFromOptions()` + +# External Links +$(_doc_external("Sys/PetscDrawLGCreate")) +""" +function PetscDrawLGCreate(petsclib::PetscLibType, draw::PetscDraw, dim::PetscInt) end + +@for_petsc function PetscDrawLGCreate(petsclib::$UnionPetscLib, draw::PetscDraw, dim::$PetscInt ) + outlg_ = Ref{PetscDrawLG}() + + @chk ccall( + (:PetscDrawLGCreate, $petsc_library), + PetscErrorCode, + (PetscDraw, $PetscInt, Ptr{PetscDrawLG}), + draw, dim, outlg_, + ) + + outlg = outlg_[] + + return outlg +end + +""" + PetscDrawLGSetColors(petsclib::PetscLibType,lg::PetscDrawLG, colors::Vector{Cint}) +Sets the color of each line graph drawn + +Logically Collective + +Input Parameters: +- `lg` - the line graph context. +- `colors` - the colors, an array of length the value set with `PetscDrawLGSetDimension()` + +Level: intermediate + +-seealso: `PetscDrawLG`, `PetscDrawLGCreate()`, `PetscDrawLGSetDimension()`, `PetscDrawLGGetDimension()` + +# External Links +$(_doc_external("Sys/PetscDrawLGSetColors")) +""" +function PetscDrawLGSetColors(petsclib::PetscLibType, lg::PetscDrawLG, colors::Vector{Cint}) end + +@for_petsc function PetscDrawLGSetColors(petsclib::$UnionPetscLib, lg::PetscDrawLG, colors::Vector{Cint} ) + + @chk ccall( + (:PetscDrawLGSetColors, $petsc_library), + PetscErrorCode, + (PetscDrawLG, Ptr{Cint}), + lg, colors, + ) + + + return nothing +end + +""" + PetscDrawLGSetLegend(petsclib::PetscLibType,lg::PetscDrawLG, names::String) +sets the names of each curve plotted + +Logically Collective + +Input Parameters: +- `lg` - the line graph context. +- `names` - the names for each curve + +Level: intermediate + +-seealso: `PetscDrawLGGetAxis()`, `PetscDrawAxis`, `PetscDrawAxisSetColors()`, `PetscDrawAxisSetLabels()`, `PetscDrawAxisSetHoldLimits()` + +# External Links +$(_doc_external("Sys/PetscDrawLGSetLegend")) +""" +function PetscDrawLGSetLegend(petsclib::PetscLibType, lg::PetscDrawLG, names::String) end + +@for_petsc function PetscDrawLGSetLegend(petsclib::$UnionPetscLib, lg::PetscDrawLG, names::String ) + names_ = Ref(pointer(names)) + + @chk ccall( + (:PetscDrawLGSetLegend, $petsc_library), + PetscErrorCode, + (PetscDrawLG, Ptr{Ptr{Cchar}}), + lg, names_, + ) + + + return nothing +end + +""" + dim::PetscInt = PetscDrawLGGetDimension(petsclib::PetscLibType,lg::PetscDrawLG) +Get the number of curves that are to be drawn. + +Not Collective + +Input Parameter: +- `lg` - the line graph context. + +Output Parameter: +- `dim` - the number of curves. + +Level: intermediate + +-seealso: `PetscDrawLGC`, `PetscDrawLGCreate()`, `PetscDrawLGSetDimension()` + +# External Links +$(_doc_external("Sys/PetscDrawLGGetDimension")) +""" +function PetscDrawLGGetDimension(petsclib::PetscLibType, lg::PetscDrawLG) end + +@for_petsc function PetscDrawLGGetDimension(petsclib::$UnionPetscLib, lg::PetscDrawLG ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDrawLGGetDimension, $petsc_library), + PetscErrorCode, + (PetscDrawLG, Ptr{$PetscInt}), + lg, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + PetscDrawLGSetDimension(petsclib::PetscLibType,lg::PetscDrawLG, dim::PetscInt) +Change the number of curves that are to be drawn. + +Logically Collective + +Input Parameters: +- `lg` - the line graph context. +- `dim` - the number of curves. + +Level: intermediate + +-seealso: `PetscDrawLGCreate()`, `PetscDrawLGGetDimension()` + +# External Links +$(_doc_external("Sys/PetscDrawLGSetDimension")) +""" +function PetscDrawLGSetDimension(petsclib::PetscLibType, lg::PetscDrawLG, dim::PetscInt) end + +@for_petsc function PetscDrawLGSetDimension(petsclib::$UnionPetscLib, lg::PetscDrawLG, dim::$PetscInt ) + + @chk ccall( + (:PetscDrawLGSetDimension, $petsc_library), + PetscErrorCode, + (PetscDrawLG, $PetscInt), + lg, dim, + ) + + + return nothing +end + +""" + dim::PetscInt,n::PetscInt,x::Vector{PetscReal},y::Vector{PetscReal} = PetscDrawLGGetData(petsclib::PetscLibType,lg::PetscDrawLG) +Get the data being plotted. + +Not Collective + +Input Parameter: +- `lg` - the line graph context + +Output Parameters: +- `dim` - the number of curves +- `n` - the number of points on each line +- `x` - The x-value of each point, x[p * dim + c] +- `y` - The y-value of each point, y[p * dim + c] + +Level: intermediate + +-seealso: `PetscDrawLGC`, `PetscDrawLGCreate()`, `PetscDrawLGGetDimension()` + +# External Links +$(_doc_external("Sys/PetscDrawLGGetData")) +""" +function PetscDrawLGGetData(petsclib::PetscLibType, lg::PetscDrawLG) end + +@for_petsc function PetscDrawLGGetData(petsclib::$UnionPetscLib, lg::PetscDrawLG ) + dim_ = Ref{$PetscInt}() + n_ = Ref{$PetscInt}() + x_ = Ref{Ptr{$PetscReal}}() + y_ = Ref{Ptr{$PetscReal}}() + + @chk ccall( + (:PetscDrawLGGetData, $petsc_library), + PetscErrorCode, + (PetscDrawLG, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}), + lg, dim_, n_, x_, y_, + ) + + dim = dim_[] + n = n_[] + x = unsafe_wrap(Array, x_[], VecGetLocalSize(petsclib, x); own = false) + y = unsafe_wrap(Array, y_[], VecGetLocalSize(petsclib, x); own = false) + + return dim,n,x,y +end + +""" + PetscDrawLGSetLimits(petsclib::PetscLibType,lg::PetscDrawLG, x_min::PetscReal, x_max::PetscReal, y_min::PetscReal, y_max::PetscReal) +Sets the axis limits for a line graph. If more +points are added after this call, the limits will be adjusted to +include those additional points. + +Logically Collective + +Input Parameters: +- `lg` - the line graph context +- `x_min` - the horizontal lower limit +- `x_max` - the horizontal upper limit +- `y_min` - the vertical lower limit +- `y_max` - the vertical upper limit + +Level: intermediate + +-seealso: `PetscDrawLGCreate()`, `PetscDrawLG`, `PetscDrawAxis` + +# External Links +$(_doc_external("Sys/PetscDrawLGSetLimits")) +""" +function PetscDrawLGSetLimits(petsclib::PetscLibType, lg::PetscDrawLG, x_min::PetscReal, x_max::PetscReal, y_min::PetscReal, y_max::PetscReal) end + +@for_petsc function PetscDrawLGSetLimits(petsclib::$UnionPetscLib, lg::PetscDrawLG, x_min::$PetscReal, x_max::$PetscReal, y_min::$PetscReal, y_max::$PetscReal ) + + @chk ccall( + (:PetscDrawLGSetLimits, $petsc_library), + PetscErrorCode, + (PetscDrawLG, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + lg, x_min, x_max, y_min, y_max, + ) + + + return nothing +end + +""" + PetscDrawLGReset(petsclib::PetscLibType,lg::PetscDrawLG) +Clears line graph to allow for reuse with new data. + +Logically Collective + +Input Parameter: +- `lg` - the line graph context. + +Level: intermediate + +-seealso: `PetscDrawLG`, `PetscDrawLGCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawLGReset")) +""" +function PetscDrawLGReset(petsclib::PetscLibType, lg::PetscDrawLG) end + +@for_petsc function PetscDrawLGReset(petsclib::$UnionPetscLib, lg::PetscDrawLG ) + + @chk ccall( + (:PetscDrawLGReset, $petsc_library), + PetscErrorCode, + (PetscDrawLG,), + lg, + ) + + + return nothing +end + +""" + PetscDrawLGDestroy(petsclib::PetscLibType,lg::PetscDrawLG) +Frees all space taken up by line graph data structure. + +Collective + +Input Parameter: +- `lg` - the line graph context + +Level: intermediate + +-seealso: `PetscDrawLG`, `PetscDrawLGCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawLGDestroy")) +""" +function PetscDrawLGDestroy(petsclib::PetscLibType, lg::PetscDrawLG) end + +@for_petsc function PetscDrawLGDestroy(petsclib::$UnionPetscLib, lg::PetscDrawLG ) + + @chk ccall( + (:PetscDrawLGDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDrawLG},), + lg, + ) + + + return nothing +end + +""" + PetscDrawLGSetUseMarkers(petsclib::PetscLibType,lg::PetscDrawLG, flg::PetscBool) +Causes the line graph object to draw a marker for each data + +Logically Collective + +Input Parameters: +- `lg` - the linegraph context +- `flg` - should mark each data point + +Options Database Key: +- `-lg_use_markers ` - true means it draws a marker for each point + +Level: intermediate + +-seealso: `PetscDrawLG`, `PetscDrawLGCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawLGSetUseMarkers")) +""" +function PetscDrawLGSetUseMarkers(petsclib::PetscLibType, lg::PetscDrawLG, flg::PetscBool) end + +@for_petsc function PetscDrawLGSetUseMarkers(petsclib::$UnionPetscLib, lg::PetscDrawLG, flg::PetscBool ) + + @chk ccall( + (:PetscDrawLGSetUseMarkers, $petsc_library), + PetscErrorCode, + (PetscDrawLG, PetscBool), + lg, flg, + ) + + + return nothing +end + +""" + PetscDrawLGDraw(petsclib::PetscLibType,lg::PetscDrawLG) +Redraws a line graph. + +Collective + +Input Parameter: +- `lg` - the line graph context + +Level: intermediate + +-seealso: `PetscDrawLG`, `PetscDrawSPDraw()`, `PetscDrawLGSPDraw()`, `PetscDrawLGReset()` + +# External Links +$(_doc_external("Sys/PetscDrawLGDraw")) +""" +function PetscDrawLGDraw(petsclib::PetscLibType, lg::PetscDrawLG) end + +@for_petsc function PetscDrawLGDraw(petsclib::$UnionPetscLib, lg::PetscDrawLG ) + + @chk ccall( + (:PetscDrawLGDraw, $petsc_library), + PetscErrorCode, + (PetscDrawLG,), + lg, + ) + + + return nothing +end + +""" + PetscDrawLGSave(petsclib::PetscLibType,lg::PetscDrawLG) +Saves a drawn image + +Collective + +Input Parameter: +- `lg` - The line graph context + +Level: intermediate + +-seealso: `PetscDrawLG`, `PetscDrawSave()`, `PetscDrawLGCreate()`, `PetscDrawLGGetDraw()`, `PetscDrawSetSave()` + +# External Links +$(_doc_external("Sys/PetscDrawLGSave")) +""" +function PetscDrawLGSave(petsclib::PetscLibType, lg::PetscDrawLG) end + +@for_petsc function PetscDrawLGSave(petsclib::$UnionPetscLib, lg::PetscDrawLG ) + + @chk ccall( + (:PetscDrawLGSave, $petsc_library), + PetscErrorCode, + (PetscDrawLG,), + lg, + ) + + + return nothing +end + +""" + PetscDrawLGView(petsclib::PetscLibType,lg::PetscDrawLG, viewer::PetscViewer) +Prints a line graph. + +Collective + +Input Parameters: +- `lg` - the line graph context +- `viewer` - the viewer to view it with + +Level: beginner + +-seealso: `PetscDrawLG`, `PetscDrawLGCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawLGView")) +""" +function PetscDrawLGView(petsclib::PetscLibType, lg::PetscDrawLG, viewer::PetscViewer) end + +@for_petsc function PetscDrawLGView(petsclib::$UnionPetscLib, lg::PetscDrawLG, viewer::PetscViewer ) + + @chk ccall( + (:PetscDrawLGView, $petsc_library), + PetscErrorCode, + (PetscDrawLG, PetscViewer), + lg, viewer, + ) + + + return nothing +end + +""" + PetscDrawLGSetOptionsPrefix(petsclib::PetscLibType,lg::PetscDrawLG, prefix::String) +Sets the prefix used for searching for all +`PetscDrawLG` options in the database. + +Logically Collective + +Input Parameters: +- `lg` - the line graph context +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: `PetscDrawLG`, `PetscDrawLGSetFromOptions()`, `PetscDrawLGCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawLGSetOptionsPrefix")) +""" +function PetscDrawLGSetOptionsPrefix(petsclib::PetscLibType, lg::PetscDrawLG, prefix::String) end + +@for_petsc function PetscDrawLGSetOptionsPrefix(petsclib::$UnionPetscLib, lg::PetscDrawLG, prefix::String ) + + @chk ccall( + (:PetscDrawLGSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscDrawLG, Ptr{Cchar}), + lg, prefix, + ) + + + return nothing +end + +""" + PetscDrawLGSetFromOptions(petsclib::PetscLibType,lg::PetscDrawLG) +Sets options related to the line graph object + +Collective + +Input Parameters: +- `lg` - the line graph context + +Options Database Key: +- `-lg_use_markers ` - true means it draws a marker for each point + +Level: intermediate + +-seealso: `PetscDrawLG`, `PetscDrawLGDestroy()`, `PetscDrawLGCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawLGSetFromOptions")) +""" +function PetscDrawLGSetFromOptions(petsclib::PetscLibType, lg::PetscDrawLG) end + +@for_petsc function PetscDrawLGSetFromOptions(petsclib::$UnionPetscLib, lg::PetscDrawLG ) + + @chk ccall( + (:PetscDrawLGSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscDrawLG,), + lg, + ) + + + return nothing +end + +""" + PetscDrawLGAddCommonPoint(petsclib::PetscLibType,lg::PetscDrawLG, x::PetscReal, y::PetscReal) +Adds another point to each of the line graphs. All the points share +the same new X coordinate. The new point must have an X coordinate larger than the old points. + +Logically Collective + +Input Parameters: +- `lg` - the line graph context +- `x` - the common x coordinate point +- `y` - the new y coordinate point for each curve. + +Level: intermediate + +-seealso: `PetscDrawLG`, `PetscDrawLGCreate()`, `PetscDrawLGAddPoints()`, `PetscDrawLGAddPoint()`, `PetscDrawLGReset()`, `PetscDrawLGDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawLGAddCommonPoint")) +""" +function PetscDrawLGAddCommonPoint(petsclib::PetscLibType, lg::PetscDrawLG, x::PetscReal, y::PetscReal) end + +@for_petsc function PetscDrawLGAddCommonPoint(petsclib::$UnionPetscLib, lg::PetscDrawLG, x::$PetscReal, y::$PetscReal ) + + @chk ccall( + (:PetscDrawLGAddCommonPoint, $petsc_library), + PetscErrorCode, + (PetscDrawLG, $PetscReal, Ptr{$PetscReal}), + lg, x, y, + ) + + + return nothing +end + +""" + PetscDrawLGAddPoint(petsclib::PetscLibType,lg::PetscDrawLG, x::PetscReal, y::PetscReal) +Adds another point to each of the line graphs. +The new point must have an X coordinate larger than the old points. + +Logically Collective + +Input Parameters: +- `lg` - the line graph context +- `x` - array containing the x coordinate for the point on each curve +- `y` - array containing the y coordinate for the point on each curve + +Level: intermediate + +-seealso: `PetscDrawLG`, `PetscDrawLGCreate()`, `PetscDrawLGAddPoints()`, `PetscDrawLGAddCommonPoint()`, `PetscDrawLGReset()`, `PetscDrawLGDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawLGAddPoint")) +""" +function PetscDrawLGAddPoint(petsclib::PetscLibType, lg::PetscDrawLG, x::PetscReal, y::PetscReal) end + +@for_petsc function PetscDrawLGAddPoint(petsclib::$UnionPetscLib, lg::PetscDrawLG, x::$PetscReal, y::$PetscReal ) + + @chk ccall( + (:PetscDrawLGAddPoint, $petsc_library), + PetscErrorCode, + (PetscDrawLG, Ptr{$PetscReal}, Ptr{$PetscReal}), + lg, x, y, + ) + + + return nothing +end + +""" + PetscDrawLGAddPoints(petsclib::PetscLibType,lg::PetscDrawLG, n::PetscInt, xx::Vector{PetscReal}, yy::Vector{PetscReal}) +Adds several points to each of the line graphs. +The new points must have an X coordinate larger than the old points. + +Logically Collective + +Input Parameters: +- `lg` - the line graph context +- `xx` - array of pointers that point to arrays containing the new x coordinates for each curve. +- `yy` - array of pointers that point to arrays containing the new y points for each curve. +- `n` - number of points being added + +Level: intermediate + +-seealso: `PetscDrawLG`, `PetscDrawLGCreate()`, `PetscDrawLGAddPoint()`, `PetscDrawLGAddCommonPoint()`, `PetscDrawLGReset()`, `PetscDrawLGDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawLGAddPoints")) +""" +function PetscDrawLGAddPoints(petsclib::PetscLibType, lg::PetscDrawLG, n::PetscInt, xx::Vector{PetscReal}, yy::Vector{PetscReal}) end + +@for_petsc function PetscDrawLGAddPoints(petsclib::$UnionPetscLib, lg::PetscDrawLG, n::$PetscInt, xx::Vector{$PetscReal}, yy::Vector{$PetscReal} ) + xx_ = Ref(pointer(xx)) + yy_ = Ref(pointer(yy)) + + @chk ccall( + (:PetscDrawLGAddPoints, $petsc_library), + PetscErrorCode, + (PetscDrawLG, $PetscInt, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}), + lg, n, xx_, yy_, + ) + + + return nothing +end + +""" + PetscDrawSplitViewPort(petsclib::PetscLibType,draw::PetscDraw) +Splits a window shared by several processes into smaller +view ports. One for each process. + +Collective + +Input Parameter: +- `draw` - the drawing context + +Level: advanced + +-seealso: `PetscDrawDivideViewPort()`, `PetscDrawSetViewPort()` + +# External Links +$(_doc_external("Sys/PetscDrawSplitViewPort")) +""" +function PetscDrawSplitViewPort(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawSplitViewPort(petsclib::$UnionPetscLib, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawSplitViewPort, $petsc_library), + PetscErrorCode, + (PetscDraw,), + draw, + ) + + + return nothing +end + +""" + drawsp::PetscDrawSP = PetscDrawSPCreate(petsclib::PetscLibType,draw::PetscDraw, dim::Cint) +Creates a scatter plot data structure. + +Collective + +Input Parameters: +- `draw` - the window where the graph will be made. +- `dim` - the number of sets of points which will be drawn + +Output Parameter: +- `drawsp` - the scatter plot context + +Level: intermediate + +-seealso: `PetscDrawLGCreate()`, `PetscDrawLG`, `PetscDrawBarCreate()`, `PetscDrawBar`, `PetscDrawHGCreate()`, `PetscDrawHG`, `PetscDrawSPDestroy()`, `PetscDraw`, `PetscDrawSP`, `PetscDrawSPSetDimension()`, `PetscDrawSPReset()`, +`PetscDrawSPAddPoint()`, `PetscDrawSPAddPoints()`, `PetscDrawSPDraw()`, `PetscDrawSPSave()`, `PetscDrawSPSetLimits()`, `PetscDrawSPGetAxis()`, `PetscDrawAxis`, `PetscDrawSPGetDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawSPCreate")) +""" +function PetscDrawSPCreate(petsclib::PetscLibType, draw::PetscDraw, dim::Cint) end + +@for_petsc function PetscDrawSPCreate(petsclib::$UnionPetscLib, draw::PetscDraw, dim::Cint ) + drawsp_ = Ref{PetscDrawSP}() + + @chk ccall( + (:PetscDrawSPCreate, $petsc_library), + PetscErrorCode, + (PetscDraw, Cint, Ptr{PetscDrawSP}), + draw, dim, drawsp_, + ) + + drawsp = drawsp_[] + + return drawsp +end + +""" + PetscDrawSPSetDimension(petsclib::PetscLibType,sp::PetscDrawSP, dim::Cint) +Change the number of points that are added at each `PetscDrawSPAddPoint()` + +Not Collective + +Input Parameters: +- `sp` - the scatter plot context. +- `dim` - the number of point curves on this process + +Level: intermediate + +-seealso: `PetscDrawSP`, `PetscDrawSPCreate()`, `PetscDrawSPAddPoint()`, `PetscDrawSPAddPoints()` + +# External Links +$(_doc_external("Sys/PetscDrawSPSetDimension")) +""" +function PetscDrawSPSetDimension(petsclib::PetscLibType, sp::PetscDrawSP, dim::Cint) end + +@for_petsc function PetscDrawSPSetDimension(petsclib::$UnionPetscLib, sp::PetscDrawSP, dim::Cint ) + + @chk ccall( + (:PetscDrawSPSetDimension, $petsc_library), + PetscErrorCode, + (PetscDrawSP, Cint), + sp, dim, + ) + + + return nothing +end + +""" + PetscDrawSPGetDimension(petsclib::PetscLibType,sp::PetscDrawSP, dim::Cint) +Get the number of sets of points that are to be drawn at each `PetscDrawSPAddPoint()` + +Not Collective + +Input Parameter: +- `sp` - the scatter plot context. + +Output Parameter: +- `dim` - the number of point curves on this process + +Level: intermediate + +-seealso: `PetscDrawSP`, `PetscDrawSPCreate()`, `PetscDrawSPAddPoint()`, `PetscDrawSPAddPoints()` + +# External Links +$(_doc_external("Sys/PetscDrawSPGetDimension")) +""" +function PetscDrawSPGetDimension(petsclib::PetscLibType, sp::PetscDrawSP, dim::Cint) end + +@for_petsc function PetscDrawSPGetDimension(petsclib::$UnionPetscLib, sp::PetscDrawSP, dim::Cint ) + + @chk ccall( + (:PetscDrawSPGetDimension, $petsc_library), + PetscErrorCode, + (PetscDrawSP, Ptr{Cint}), + sp, dim, + ) + + + return nothing +end + +""" + PetscDrawSPReset(petsclib::PetscLibType,sp::PetscDrawSP) +Clears scatter plot to allow for reuse with new data. + +Not Collective + +Input Parameter: +- `sp` - the scatter plot context. + +Level: intermediate + +-seealso: `PetscDrawSP`, `PetscDrawSPCreate()`, `PetscDrawSPAddPoint()`, `PetscDrawSPAddPoints()`, `PetscDrawSPDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawSPReset")) +""" +function PetscDrawSPReset(petsclib::PetscLibType, sp::PetscDrawSP) end + +@for_petsc function PetscDrawSPReset(petsclib::$UnionPetscLib, sp::PetscDrawSP ) + + @chk ccall( + (:PetscDrawSPReset, $petsc_library), + PetscErrorCode, + (PetscDrawSP,), + sp, + ) + + + return nothing +end + +""" + PetscDrawSPDestroy(petsclib::PetscLibType,sp::PetscDrawSP) +Frees all space taken up by scatter plot data structure. + +Collective + +Input Parameter: +- `sp` - the scatter plot context + +Level: intermediate + +-seealso: `PetscDrawSPCreate()`, `PetscDrawSP`, `PetscDrawSPReset()` + +# External Links +$(_doc_external("Sys/PetscDrawSPDestroy")) +""" +function PetscDrawSPDestroy(petsclib::PetscLibType, sp::PetscDrawSP) end + +@for_petsc function PetscDrawSPDestroy(petsclib::$UnionPetscLib, sp::PetscDrawSP ) + + @chk ccall( + (:PetscDrawSPDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDrawSP},), + sp, + ) + + + return nothing +end + +""" + PetscDrawSPAddPoint(petsclib::PetscLibType,sp::PetscDrawSP, x::PetscReal, y::PetscReal) +Adds another point to each of the scatter plot point curves. + +Not Collective + +Input Parameters: +- `sp` - the scatter plot data structure +- `x` - the x coordinate values (of length dim) for the points of the curve +- `y` - the y coordinate values (of length dim) for the points of the curve + +Level: intermediate + +-seealso: `PetscDrawSPAddPoints()`, `PetscDrawSP`, `PetscDrawSPCreate()`, `PetscDrawSPReset()`, `PetscDrawSPDraw()`, `PetscDrawSPAddPointColorized()` + +# External Links +$(_doc_external("Sys/PetscDrawSPAddPoint")) +""" +function PetscDrawSPAddPoint(petsclib::PetscLibType, sp::PetscDrawSP, x::PetscReal, y::PetscReal) end + +@for_petsc function PetscDrawSPAddPoint(petsclib::$UnionPetscLib, sp::PetscDrawSP, x::$PetscReal, y::$PetscReal ) + + @chk ccall( + (:PetscDrawSPAddPoint, $petsc_library), + PetscErrorCode, + (PetscDrawSP, Ptr{$PetscReal}, Ptr{$PetscReal}), + sp, x, y, + ) + + + return nothing +end + +""" + PetscDrawSPAddPoints(petsclib::PetscLibType,sp::PetscDrawSP, n::Cint, xx::Vector{PetscReal}, yy::Vector{PetscReal}) +Adds several points to each of the scatter plot point curves. + +Not Collective + +Input Parameters: +- `sp` - the scatter plot context +- `xx` - array of pointers that point to arrays containing the new x coordinates for each curve. +- `yy` - array of pointers that point to arrays containing the new y points for each curve. +- `n` - number of points being added, each represents a subarray of length dim where dim is the value from `PetscDrawSPGetDimension()` + +Level: intermediate + +-seealso: `PetscDrawSPAddPoint()`, `PetscDrawSP`, `PetscDrawSPCreate()`, `PetscDrawSPReset()`, `PetscDrawSPDraw()`, `PetscDrawSPAddPointColorized()` + +# External Links +$(_doc_external("Sys/PetscDrawSPAddPoints")) +""" +function PetscDrawSPAddPoints(petsclib::PetscLibType, sp::PetscDrawSP, n::Cint, xx::Vector{PetscReal}, yy::Vector{PetscReal}) end + +@for_petsc function PetscDrawSPAddPoints(petsclib::$UnionPetscLib, sp::PetscDrawSP, n::Cint, xx::Vector{$PetscReal}, yy::Vector{$PetscReal} ) + xx_ = Ref(pointer(xx)) + yy_ = Ref(pointer(yy)) + + @chk ccall( + (:PetscDrawSPAddPoints, $petsc_library), + PetscErrorCode, + (PetscDrawSP, Cint, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}), + sp, n, xx_, yy_, + ) + + + return nothing +end + +""" + PetscDrawSPAddPointColorized(petsclib::PetscLibType,sp::PetscDrawSP, x::PetscReal, y::PetscReal, z::PetscReal) +Adds another point to each of the scatter plots as well as a numeric value to be used to colorize the scatter point. + +Not Collective + +Input Parameters: +- `sp` - the scatter plot data structure +- `x` - array of length dim containing the new x coordinate values for each of the point curves. +- `y` - array of length dim containing the new y coordinate values for each of the point curves. +- `z` - array of length dim containing the numeric values that will be mapped to [0,255] and used for scatter point colors. + +Level: intermediate + +-seealso: `PetscDrawSPAddPoints()`, `PetscDrawSP`, `PetscDrawSPCreate()`, `PetscDrawSPReset()`, `PetscDrawSPDraw()`, `PetscDrawSPAddPoint()` + +# External Links +$(_doc_external("Sys/PetscDrawSPAddPointColorized")) +""" +function PetscDrawSPAddPointColorized(petsclib::PetscLibType, sp::PetscDrawSP, x::PetscReal, y::PetscReal, z::PetscReal) end + +@for_petsc function PetscDrawSPAddPointColorized(petsclib::$UnionPetscLib, sp::PetscDrawSP, x::$PetscReal, y::$PetscReal, z::$PetscReal ) + + @chk ccall( + (:PetscDrawSPAddPointColorized, $petsc_library), + PetscErrorCode, + (PetscDrawSP, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + sp, x, y, z, + ) + + + return nothing +end + +""" + PetscDrawSPDraw(petsclib::PetscLibType,sp::PetscDrawSP, clear::PetscBool) +Redraws a scatter plot. + +Collective + +Input Parameters: +- `sp` - the scatter plot context +- `clear` - clear the window before drawing the new plot + +Level: intermediate + +-seealso: `PetscDrawLGDraw()`, `PetscDrawLGSPDraw()`, `PetscDrawSP`, `PetscDrawSPCreate()`, `PetscDrawSPReset()`, `PetscDrawSPAddPoint()`, `PetscDrawSPAddPoints()` + +# External Links +$(_doc_external("Sys/PetscDrawSPDraw")) +""" +function PetscDrawSPDraw(petsclib::PetscLibType, sp::PetscDrawSP, clear::PetscBool) end + +@for_petsc function PetscDrawSPDraw(petsclib::$UnionPetscLib, sp::PetscDrawSP, clear::PetscBool ) + + @chk ccall( + (:PetscDrawSPDraw, $petsc_library), + PetscErrorCode, + (PetscDrawSP, PetscBool), + sp, clear, + ) + + + return nothing +end + +""" + PetscDrawSPSave(petsclib::PetscLibType,sp::PetscDrawSP) +Saves a drawn image + +Collective + +Input Parameter: +- `sp` - the scatter plot context + +Level: intermediate + +-seealso: `PetscDrawSPCreate()`, `PetscDrawSPGetDraw()`, `PetscDrawSetSave()`, `PetscDrawSave()` + +# External Links +$(_doc_external("Sys/PetscDrawSPSave")) +""" +function PetscDrawSPSave(petsclib::PetscLibType, sp::PetscDrawSP) end + +@for_petsc function PetscDrawSPSave(petsclib::$UnionPetscLib, sp::PetscDrawSP ) + + @chk ccall( + (:PetscDrawSPSave, $petsc_library), + PetscErrorCode, + (PetscDrawSP,), + sp, + ) + + + return nothing +end + +""" + PetscDrawSPSetLimits(petsclib::PetscLibType,sp::PetscDrawSP, x_min::PetscReal, x_max::PetscReal, y_min::PetscReal, y_max::PetscReal) +Sets the axis limits for a scatter plot. If more points are added after this call, the limits will be adjusted to include those additional points. + +Not Collective + +Input Parameters: +- `sp` - the line graph context +- `x_min` - the horizontal lower limit +- `x_max` - the horizontal upper limit +- `y_min` - the vertical lower limit +- `y_max` - the vertical upper limit + +Level: intermediate + +-seealso: `PetscDrawSP`, `PetscDrawAxis`, `PetscDrawSPCreate()`, `PetscDrawSPDraw()`, `PetscDrawSPAddPoint()`, `PetscDrawSPAddPoints()`, `PetscDrawSPGetAxis()` + +# External Links +$(_doc_external("Sys/PetscDrawSPSetLimits")) +""" +function PetscDrawSPSetLimits(petsclib::PetscLibType, sp::PetscDrawSP, x_min::PetscReal, x_max::PetscReal, y_min::PetscReal, y_max::PetscReal) end + +@for_petsc function PetscDrawSPSetLimits(petsclib::$UnionPetscLib, sp::PetscDrawSP, x_min::$PetscReal, x_max::$PetscReal, y_min::$PetscReal, y_max::$PetscReal ) + + @chk ccall( + (:PetscDrawSPSetLimits, $petsc_library), + PetscErrorCode, + (PetscDrawSP, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + sp, x_min, x_max, y_min, y_max, + ) + + + return nothing +end + +""" + PetscDrawSPGetAxis(petsclib::PetscLibType,sp::PetscDrawSP, axis::PetscDrawAxis) +Gets the axis context associated with a scatter plot + +Not Collective + +Input Parameter: +- `sp` - the scatter plot context + +Output Parameter: +- `axis` - the axis context + +Level: intermediate + +-seealso: `PetscDrawSP`, `PetscDrawSPCreate()`, `PetscDrawSPDraw()`, `PetscDrawSPAddPoint()`, `PetscDrawSPAddPoints()`, `PetscDrawAxis`, `PetscDrawAxisCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawSPGetAxis")) +""" +function PetscDrawSPGetAxis(petsclib::PetscLibType, sp::PetscDrawSP, axis::PetscDrawAxis) end + +@for_petsc function PetscDrawSPGetAxis(petsclib::$UnionPetscLib, sp::PetscDrawSP, axis::PetscDrawAxis ) + + @chk ccall( + (:PetscDrawSPGetAxis, $petsc_library), + PetscErrorCode, + (PetscDrawSP, Ptr{PetscDrawAxis}), + sp, axis, + ) + + + return nothing +end + +""" + PetscDrawSPGetDraw(petsclib::PetscLibType,sp::PetscDrawSP, draw::PetscDraw) +Gets the draw context associated with a scatter plot + +Not Collective + +Input Parameter: +- `sp` - the scatter plot context + +Output Parameter: +- `draw` - the draw context + +Level: intermediate + +-seealso: `PetscDrawSP`, `PetscDrawSPCreate()`, `PetscDrawSPDraw()`, `PetscDraw` + +# External Links +$(_doc_external("Sys/PetscDrawSPGetDraw")) +""" +function PetscDrawSPGetDraw(petsclib::PetscLibType, sp::PetscDrawSP, draw::PetscDraw) end + +@for_petsc function PetscDrawSPGetDraw(petsclib::$UnionPetscLib, sp::PetscDrawSP, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawSPGetDraw, $petsc_library), + PetscErrorCode, + (PetscDrawSP, Ptr{PetscDraw}), + sp, draw, + ) + + + return nothing +end + +""" + hist::PetscDrawHG = PetscDrawHGCreate(petsclib::PetscLibType,draw::PetscDraw, bins::Cint) +Creates a histogram data structure. + +Collective + +Input Parameters: +- `draw` - The window where the graph will be made +- `bins` - The number of bins to use + +Output Parameter: +- `hist` - The histogram context + +Level: intermediate + +-seealso: `PetscDrawHGDestroy()`, `PetscDrawHG`, `PetscDrawBarCreate()`, `PetscDrawBar`, `PetscDrawLGCreate()`, `PetscDrawLG`, `PetscDrawSPCreate()`, `PetscDrawSP`, +`PetscDrawHGSetNumberBins()`, `PetscDrawHGReset()`, `PetscDrawHGAddValue()`, `PetscDrawHGDraw()`, `PetscDrawHGSave()`, `PetscDrawHGView()`, `PetscDrawHGSetColor()`, +`PetscDrawHGSetLimits()`, `PetscDrawHGCalcStats()`, `PetscDrawHGIntegerBins()`, `PetscDrawHGGetAxis()`, `PetscDrawAxis`, `PetscDrawHGGetDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawHGCreate")) +""" +function PetscDrawHGCreate(petsclib::PetscLibType, draw::PetscDraw, bins::Cint) end + +@for_petsc function PetscDrawHGCreate(petsclib::$UnionPetscLib, draw::PetscDraw, bins::Cint ) + hist_ = Ref{PetscDrawHG}() + + @chk ccall( + (:PetscDrawHGCreate, $petsc_library), + PetscErrorCode, + (PetscDraw, Cint, Ptr{PetscDrawHG}), + draw, bins, hist_, + ) + + hist = hist_[] + + return hist +end + +""" + PetscDrawHGSetNumberBins(petsclib::PetscLibType,hist::PetscDrawHG, bins::Cint) +Change the number of bins that are to be drawn in the histogram + +Logically Collective + +Input Parameters: +- `hist` - The histogram context. +- `bins` - The number of bins. + +Level: intermediate + +-seealso: `PetscDrawHGCreate()`, `PetscDrawHG`, `PetscDrawHGDraw()`, `PetscDrawHGIntegerBins()` + +# External Links +$(_doc_external("Sys/PetscDrawHGSetNumberBins")) +""" +function PetscDrawHGSetNumberBins(petsclib::PetscLibType, hist::PetscDrawHG, bins::Cint) end + +@for_petsc function PetscDrawHGSetNumberBins(petsclib::$UnionPetscLib, hist::PetscDrawHG, bins::Cint ) + + @chk ccall( + (:PetscDrawHGSetNumberBins, $petsc_library), + PetscErrorCode, + (PetscDrawHG, Cint), + hist, bins, + ) + + + return nothing +end + +""" + PetscDrawHGReset(petsclib::PetscLibType,hist::PetscDrawHG) +Clears histogram to allow for reuse with new data. + +Logically Collective + +Input Parameter: +- `hist` - The histogram context. + +Level: intermediate + +-seealso: `PetscDrawHGCreate()`, `PetscDrawHG`, `PetscDrawHGDraw()`, `PetscDrawHGAddValue()` + +# External Links +$(_doc_external("Sys/PetscDrawHGReset")) +""" +function PetscDrawHGReset(petsclib::PetscLibType, hist::PetscDrawHG) end + +@for_petsc function PetscDrawHGReset(petsclib::$UnionPetscLib, hist::PetscDrawHG ) + + @chk ccall( + (:PetscDrawHGReset, $petsc_library), + PetscErrorCode, + (PetscDrawHG,), + hist, + ) + + + return nothing +end + +""" + PetscDrawHGDestroy(petsclib::PetscLibType,hist::PetscDrawHG) +Frees all space taken up by histogram data structure. + +Collective + +Input Parameter: +- `hist` - The histogram context + +Level: intermediate + +-seealso: `PetscDrawHGCreate()`, `PetscDrawHG` + +# External Links +$(_doc_external("Sys/PetscDrawHGDestroy")) +""" +function PetscDrawHGDestroy(petsclib::PetscLibType, hist::PetscDrawHG) end + +@for_petsc function PetscDrawHGDestroy(petsclib::$UnionPetscLib, hist::PetscDrawHG ) + + @chk ccall( + (:PetscDrawHGDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDrawHG},), + hist, + ) + + + return nothing +end + +""" + PetscDrawHGAddValue(petsclib::PetscLibType,hist::PetscDrawHG, value::PetscReal) +Adds another value to the histogram. + +Logically Collective + +Input Parameters: +- `hist` - The histogram +- `value` - The value + +Level: intermediate + +-seealso: `PetscDrawHGCreate()`, `PetscDrawHG`, `PetscDrawHGDraw()`, `PetscDrawHGReset()`, `PetscDrawHGAddWeightedValue()` + +# External Links +$(_doc_external("Sys/PetscDrawHGAddValue")) +""" +function PetscDrawHGAddValue(petsclib::PetscLibType, hist::PetscDrawHG, value::PetscReal) end + +@for_petsc function PetscDrawHGAddValue(petsclib::$UnionPetscLib, hist::PetscDrawHG, value::$PetscReal ) + + @chk ccall( + (:PetscDrawHGAddValue, $petsc_library), + PetscErrorCode, + (PetscDrawHG, $PetscReal), + hist, value, + ) + + + return nothing +end + +""" + PetscDrawHGAddWeightedValue(petsclib::PetscLibType,hist::PetscDrawHG, value::PetscReal, weight::PetscReal) +Adds another value to the histogram with a weight. + +Logically Collective + +Input Parameters: +- `hist` - The histogram +- `value` - The value +- `weight` - The value weight + +Level: intermediate + +-seealso: `PetscDrawHGCreate()`, `PetscDrawHG`, `PetscDrawHGDraw()`, `PetscDrawHGReset()`, `PetscDrawHGAddValue()` + +# External Links +$(_doc_external("Sys/PetscDrawHGAddWeightedValue")) +""" +function PetscDrawHGAddWeightedValue(petsclib::PetscLibType, hist::PetscDrawHG, value::PetscReal, weight::PetscReal) end + +@for_petsc function PetscDrawHGAddWeightedValue(petsclib::$UnionPetscLib, hist::PetscDrawHG, value::$PetscReal, weight::$PetscReal ) + + @chk ccall( + (:PetscDrawHGAddWeightedValue, $petsc_library), + PetscErrorCode, + (PetscDrawHG, $PetscReal, $PetscReal), + hist, value, weight, + ) + + + return nothing +end + +""" + PetscDrawHGDraw(petsclib::PetscLibType,hist::PetscDrawHG) +Redraws a histogram. + +Collective + +Input Parameter: +- `hist` - The histogram context + +Level: intermediate + +-seealso: `PetscDrawHGCreate()`, `PetscDrawHG`, `PetscDrawHGAddValue()`, `PetscDrawHGReset()` + +# External Links +$(_doc_external("Sys/PetscDrawHGDraw")) +""" +function PetscDrawHGDraw(petsclib::PetscLibType, hist::PetscDrawHG) end + +@for_petsc function PetscDrawHGDraw(petsclib::$UnionPetscLib, hist::PetscDrawHG ) + + @chk ccall( + (:PetscDrawHGDraw, $petsc_library), + PetscErrorCode, + (PetscDrawHG,), + hist, + ) + + + return nothing +end + +""" + PetscDrawHGSave(petsclib::PetscLibType,hg::PetscDrawHG) +Saves a drawn image + +Collective + +Input Parameter: +- `hg` - The histogram context + +Level: intermediate + +-seealso: `PetscDrawSave()`, `PetscDrawHGCreate()`, `PetscDrawHGGetDraw()`, `PetscDrawSetSave()`, `PetscDrawHGDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawHGSave")) +""" +function PetscDrawHGSave(petsclib::PetscLibType, hg::PetscDrawHG) end + +@for_petsc function PetscDrawHGSave(petsclib::$UnionPetscLib, hg::PetscDrawHG ) + + @chk ccall( + (:PetscDrawHGSave, $petsc_library), + PetscErrorCode, + (PetscDrawHG,), + hg, + ) + + + return nothing +end + +""" + PetscDrawHGView(petsclib::PetscLibType,hist::PetscDrawHG, viewer::PetscViewer) +Prints the histogram information to a viewer + +Not Collective + +Input Parameters: +- `hist` - The histogram context +- `viewer` - The viewer to view it with + +Level: beginner + +-seealso: `PetscDrawHG`, `PetscViewer`, `PetscDrawHGCreate()`, `PetscDrawHGGetDraw()`, `PetscDrawSetSave()`, `PetscDrawSave()`, `PetscDrawHGDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawHGView")) +""" +function PetscDrawHGView(petsclib::PetscLibType, hist::PetscDrawHG, viewer::PetscViewer) end + +@for_petsc function PetscDrawHGView(petsclib::$UnionPetscLib, hist::PetscDrawHG, viewer::PetscViewer ) + + @chk ccall( + (:PetscDrawHGView, $petsc_library), + PetscErrorCode, + (PetscDrawHG, PetscViewer), + hist, viewer, + ) + + + return nothing +end + +""" + PetscDrawHGSetColor(petsclib::PetscLibType,hist::PetscDrawHG, color::Cint) +Sets the color the bars will be drawn with. + +Logically Collective + +Input Parameters: +- `hist` - The histogram context +- `color` - one of the colors defined in petscdraw.h or `PETSC_DRAW_ROTATE` to make each bar a different color + +Level: intermediate + +-seealso: `PetscDrawHG`, `PetscDrawHGCreate()`, `PetscDrawHGGetDraw()`, `PetscDrawSetSave()`, `PetscDrawSave()`, `PetscDrawHGDraw()`, `PetscDrawHGGetAxis()` + +# External Links +$(_doc_external("Sys/PetscDrawHGSetColor")) +""" +function PetscDrawHGSetColor(petsclib::PetscLibType, hist::PetscDrawHG, color::Cint) end + +@for_petsc function PetscDrawHGSetColor(petsclib::$UnionPetscLib, hist::PetscDrawHG, color::Cint ) + + @chk ccall( + (:PetscDrawHGSetColor, $petsc_library), + PetscErrorCode, + (PetscDrawHG, Cint), + hist, color, + ) + + + return nothing +end + +""" + PetscDrawHGSetLimits(petsclib::PetscLibType,hist::PetscDrawHG, x_min::PetscReal, x_max::PetscReal, y_min::Cint, y_max::Cint) +Sets the axis limits for a histogram. If more +points are added after this call, the limits will be adjusted to +include those additional points. + +Logically Collective + +Input Parameters: +- `hist` - The histogram context +- `x_min` - the horizontal lower limit +- `x_max` - the horizontal upper limit +- `y_min` - the vertical lower limit +- `y_max` - the vertical upper limit + +Level: intermediate + +-seealso: `PetscDrawHG`, `PetscDrawHGCreate()`, `PetscDrawHGGetDraw()`, `PetscDrawSetSave()`, `PetscDrawSave()`, `PetscDrawHGDraw()`, `PetscDrawHGGetAxis()` + +# External Links +$(_doc_external("Sys/PetscDrawHGSetLimits")) +""" +function PetscDrawHGSetLimits(petsclib::PetscLibType, hist::PetscDrawHG, x_min::PetscReal, x_max::PetscReal, y_min::Cint, y_max::Cint) end + +@for_petsc function PetscDrawHGSetLimits(petsclib::$UnionPetscLib, hist::PetscDrawHG, x_min::$PetscReal, x_max::$PetscReal, y_min::Cint, y_max::Cint ) + + @chk ccall( + (:PetscDrawHGSetLimits, $petsc_library), + PetscErrorCode, + (PetscDrawHG, $PetscReal, $PetscReal, Cint, Cint), + hist, x_min, x_max, y_min, y_max, + ) + + + return nothing +end + +""" + PetscDrawHGCalcStats(petsclib::PetscLibType,hist::PetscDrawHG, calc::PetscBool) +Turns on calculation of descriptive statistics associated with the histogram + +Not Collective + +Input Parameters: +- `hist` - The histogram context +- `calc` - Flag for calculation + +Level: intermediate + +-seealso: `PetscDrawHG`, `PetscDrawHGCreate()`, `PetscDrawHGAddValue()`, `PetscDrawHGView()`, `PetscDrawHGDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawHGCalcStats")) +""" +function PetscDrawHGCalcStats(petsclib::PetscLibType, hist::PetscDrawHG, calc::PetscBool) end + +@for_petsc function PetscDrawHGCalcStats(petsclib::$UnionPetscLib, hist::PetscDrawHG, calc::PetscBool ) + + @chk ccall( + (:PetscDrawHGCalcStats, $petsc_library), + PetscErrorCode, + (PetscDrawHG, PetscBool), + hist, calc, + ) + + + return nothing +end + +""" + PetscDrawHGIntegerBins(petsclib::PetscLibType,hist::PetscDrawHG, ints::PetscBool) +Turns on integer width bins + +Not Collective + +Input Parameters: +- `hist` - The histogram context +- `ints` - Flag for integer width bins + +Level: intermediate + +-seealso: `PetscDrawHG`, `PetscDrawHGCreate()`, `PetscDrawHGAddValue()`, `PetscDrawHGView()`, `PetscDrawHGDraw()`, `PetscDrawHGSetColor()` + +# External Links +$(_doc_external("Sys/PetscDrawHGIntegerBins")) +""" +function PetscDrawHGIntegerBins(petsclib::PetscLibType, hist::PetscDrawHG, ints::PetscBool) end + +@for_petsc function PetscDrawHGIntegerBins(petsclib::$UnionPetscLib, hist::PetscDrawHG, ints::PetscBool ) + + @chk ccall( + (:PetscDrawHGIntegerBins, $petsc_library), + PetscErrorCode, + (PetscDrawHG, PetscBool), + hist, ints, + ) + + + return nothing +end + +""" + PetscDrawHGGetAxis(petsclib::PetscLibType,hist::PetscDrawHG, axis::PetscDrawAxis) +Gets the axis context associated with a histogram. +This is useful if one wants to change some axis property, such as +labels, color, etc. The axis context should not be destroyed by the +application code. + +Not Collective, axis is parallel if hist is parallel + +Input Parameter: +- `hist` - The histogram context + +Output Parameter: +- `axis` - The axis context + +Level: intermediate + +-seealso: `PetscDrawHG`, `PetscDrawAxis`, `PetscDrawHGCreate()`, `PetscDrawHGAddValue()`, `PetscDrawHGView()`, `PetscDrawHGDraw()`, `PetscDrawHGSetColor()`, `PetscDrawHGSetLimits()` + +# External Links +$(_doc_external("Sys/PetscDrawHGGetAxis")) +""" +function PetscDrawHGGetAxis(petsclib::PetscLibType, hist::PetscDrawHG, axis::PetscDrawAxis) end + +@for_petsc function PetscDrawHGGetAxis(petsclib::$UnionPetscLib, hist::PetscDrawHG, axis::PetscDrawAxis ) + + @chk ccall( + (:PetscDrawHGGetAxis, $petsc_library), + PetscErrorCode, + (PetscDrawHG, Ptr{PetscDrawAxis}), + hist, axis, + ) + + + return nothing +end + +""" + PetscDrawHGGetDraw(petsclib::PetscLibType,hist::PetscDrawHG, draw::PetscDraw) +Gets the draw context associated with a histogram. + +Not Collective, draw is parallel if hist is parallel + +Input Parameter: +- `hist` - The histogram context + +Output Parameter: +- `draw` - The draw context + +Level: intermediate + +-seealso: `PetscDraw`, `PetscDrawHG`, `PetscDrawHGCreate()`, `PetscDrawHGAddValue()`, `PetscDrawHGView()`, `PetscDrawHGDraw()`, `PetscDrawHGSetColor()`, `PetscDrawAxis`, `PetscDrawHGSetLimits()` + +# External Links +$(_doc_external("Sys/PetscDrawHGGetDraw")) +""" +function PetscDrawHGGetDraw(petsclib::PetscLibType, hist::PetscDrawHG, draw::PetscDraw) end + +@for_petsc function PetscDrawHGGetDraw(petsclib::$UnionPetscLib, hist::PetscDrawHG, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawHGGetDraw, $petsc_library), + PetscErrorCode, + (PetscDrawHG, Ptr{PetscDraw}), + hist, draw, + ) + + + return nothing +end + +""" + bar::PetscDrawBar = PetscDrawBarCreate(petsclib::PetscLibType,draw::PetscDraw) +Creates a bar graph data structure. + +Collective + +Input Parameter: +- `draw` - The window where the graph will be made + +Output Parameter: +- `bar` - The bar graph context + +-seealso: `PetscDrawBar`, `PetscDrawLGCreate()`, `PetscDrawLG`, `PetscDrawSPCreate()`, `PetscDrawSP`, `PetscDrawHGCreate()`, `PetscDrawHG`, `PetscDrawBarDestroy()`, `PetscDrawBarSetData()`, +`PetscDrawBarDraw()`, `PetscDrawBarSave()`, `PetscDrawBarSetColor()`, `PetscDrawBarSort()`, `PetscDrawBarSetLimits()`, `PetscDrawBarGetAxis()`, `PetscDrawAxis`, +`PetscDrawBarGetDraw()`, `PetscDrawBarSetFromOptions()` + +# External Links +$(_doc_external("Sys/PetscDrawBarCreate")) +""" +function PetscDrawBarCreate(petsclib::PetscLibType, draw::PetscDraw) end + +@for_petsc function PetscDrawBarCreate(petsclib::$UnionPetscLib, draw::PetscDraw ) + bar_ = Ref{PetscDrawBar}() + + @chk ccall( + (:PetscDrawBarCreate, $petsc_library), + PetscErrorCode, + (PetscDraw, Ptr{PetscDrawBar}), + draw, bar_, + ) + + bar = bar_[] + + return bar +end + +""" + PetscDrawBarSetData(petsclib::PetscLibType,bar::PetscDrawBar, bins::PetscInt, data::Vector{PetscReal}, labels::String) +Set the data for a bar graph + +Logically Collective + +Input Parameters: +- `bar` - The bar graph context. +- `bins` - number of items +- `data` - values of each item +- `labels` - optional label for each bar, `NULL` terminated array of strings + +Level: intermediate + +-seealso: `PetscDrawBar`, `PetscDrawBarCreate()`, `PetscDrawBarDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawBarSetData")) +""" +function PetscDrawBarSetData(petsclib::PetscLibType, bar::PetscDrawBar, bins::PetscInt, data::Vector{PetscReal}, labels::String) end + +@for_petsc function PetscDrawBarSetData(petsclib::$UnionPetscLib, bar::PetscDrawBar, bins::$PetscInt, data::Vector{$PetscReal}, labels::String ) + labels_ = Ref(pointer(labels)) + + @chk ccall( + (:PetscDrawBarSetData, $petsc_library), + PetscErrorCode, + (PetscDrawBar, $PetscInt, Ptr{$PetscReal}, Ptr{Ptr{Cchar}}), + bar, bins, data, labels_, + ) + + + return nothing +end + +""" + PetscDrawBarDestroy(petsclib::PetscLibType,bar::PetscDrawBar) +Frees all space taken up by bar graph data structure. + +Collective + +Input Parameter: +- `bar` - The bar graph context + +Level: intermediate + +-seealso: `PetscDrawBar`, `PetscDrawBarCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawBarDestroy")) +""" +function PetscDrawBarDestroy(petsclib::PetscLibType, bar::PetscDrawBar) end + +@for_petsc function PetscDrawBarDestroy(petsclib::$UnionPetscLib, bar::PetscDrawBar ) + + @chk ccall( + (:PetscDrawBarDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDrawBar},), + bar, + ) + + + return nothing +end + +""" + PetscDrawBarDraw(petsclib::PetscLibType,bar::PetscDrawBar) +Redraws a bar graph. + +Collective + +Input Parameter: +- `bar` - The bar graph context + +Level: intermediate + +-seealso: `PetscDrawBar`, `PetscDrawBarCreate()`, `PetscDrawBarSetData()` + +# External Links +$(_doc_external("Sys/PetscDrawBarDraw")) +""" +function PetscDrawBarDraw(petsclib::PetscLibType, bar::PetscDrawBar) end + +@for_petsc function PetscDrawBarDraw(petsclib::$UnionPetscLib, bar::PetscDrawBar ) + + @chk ccall( + (:PetscDrawBarDraw, $petsc_library), + PetscErrorCode, + (PetscDrawBar,), + bar, + ) + + + return nothing +end + +""" + PetscDrawBarSave(petsclib::PetscLibType,bar::PetscDrawBar) +Saves a drawn bar graph + +Collective + +Input Parameter: +- `bar` - The bar graph context + +Level: intermediate + +-seealso: `PetscDrawSave()`, `PetscDrawBar`, `PetscDrawBarCreate()`, `PetscDrawBarGetDraw()`, `PetscDrawSetSave()`, `PetscDrawBarSetData()` + +# External Links +$(_doc_external("Sys/PetscDrawBarSave")) +""" +function PetscDrawBarSave(petsclib::PetscLibType, bar::PetscDrawBar) end + +@for_petsc function PetscDrawBarSave(petsclib::$UnionPetscLib, bar::PetscDrawBar ) + + @chk ccall( + (:PetscDrawBarSave, $petsc_library), + PetscErrorCode, + (PetscDrawBar,), + bar, + ) + + + return nothing +end + +""" + PetscDrawBarSetColor(petsclib::PetscLibType,bar::PetscDrawBar, color::Cint) +Sets the color the bars will be drawn with. + +Logically Collective + +Input Parameters: +- `bar` - The bar graph context +- `color` - one of the colors defined in petscdraw.h or `PETSC_DRAW_ROTATE` to make each bar a +different color + +Level: intermediate + +-seealso: `PetscDrawBarCreate()`, `PetscDrawBar`, `PetscDrawBarSetData()`, `PetscDrawBarDraw()`, `PetscDrawBarGetAxis()` + +# External Links +$(_doc_external("Sys/PetscDrawBarSetColor")) +""" +function PetscDrawBarSetColor(petsclib::PetscLibType, bar::PetscDrawBar, color::Cint) end + +@for_petsc function PetscDrawBarSetColor(petsclib::$UnionPetscLib, bar::PetscDrawBar, color::Cint ) + + @chk ccall( + (:PetscDrawBarSetColor, $petsc_library), + PetscErrorCode, + (PetscDrawBar, Cint), + bar, color, + ) + + + return nothing +end + +""" + PetscDrawBarSort(petsclib::PetscLibType,bar::PetscDrawBar, sort::PetscBool, tolerance::PetscReal) +Sorts the values before drawing the bar chart, the bars will be in ascending order from left to right + +Logically Collective + +Input Parameters: +- `bar` - The bar graph context +- `sort` - `PETSC_TRUE` to sort the values +- `tolerance` - discard values less than tolerance + +Level: intermediate + +-seealso: `PetscDrawBar`, `PetscDrawBarCreate()`, `PetscDrawBarSetData()`, `PetscDrawBarSetColor()`, `PetscDrawBarDraw()`, `PetscDrawBarGetAxis()` + +# External Links +$(_doc_external("Sys/PetscDrawBarSort")) +""" +function PetscDrawBarSort(petsclib::PetscLibType, bar::PetscDrawBar, sort::PetscBool, tolerance::PetscReal) end + +@for_petsc function PetscDrawBarSort(petsclib::$UnionPetscLib, bar::PetscDrawBar, sort::PetscBool, tolerance::$PetscReal ) + + @chk ccall( + (:PetscDrawBarSort, $petsc_library), + PetscErrorCode, + (PetscDrawBar, PetscBool, $PetscReal), + bar, sort, tolerance, + ) + + + return nothing +end + +""" + PetscDrawBarSetLimits(petsclib::PetscLibType,bar::PetscDrawBar, y_min::PetscReal, y_max::PetscReal) +Sets the axis limits for a bar graph. If more +points are added after this call, the limits will be adjusted to +include those additional points. + +Logically Collective + +Input Parameters: +- `bar` - The bar graph context +- `y_min` - The lower limit +- `y_max` - The upper limit + +Level: intermediate + +-seealso: `PetscDrawBar`, `PetscDrawBarCreate()`, `PetscDrawBarGetAxis()`, `PetscDrawBarSetData()`, `PetscDrawBarDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawBarSetLimits")) +""" +function PetscDrawBarSetLimits(petsclib::PetscLibType, bar::PetscDrawBar, y_min::PetscReal, y_max::PetscReal) end + +@for_petsc function PetscDrawBarSetLimits(petsclib::$UnionPetscLib, bar::PetscDrawBar, y_min::$PetscReal, y_max::$PetscReal ) + + @chk ccall( + (:PetscDrawBarSetLimits, $petsc_library), + PetscErrorCode, + (PetscDrawBar, $PetscReal, $PetscReal), + bar, y_min, y_max, + ) + + + return nothing +end + +""" + PetscDrawBarGetAxis(petsclib::PetscLibType,bar::PetscDrawBar, axis::PetscDrawAxis) +Gets the axis context associated with a bar graph. +This is useful if one wants to change some axis property, such as +labels, color, etc. The axis context should not be destroyed by the +application code. + +Not Collective, axis is parallel if bar is parallel + +Input Parameter: +- `bar` - The bar graph context + +Output Parameter: +- `axis` - The axis context + +Level: intermediate + +-seealso: `PetscDrawBar`, `PetscDrawBarCreate()`, `PetscDrawAxis`, `PetscDrawAxisCreate()` + +# External Links +$(_doc_external("Sys/PetscDrawBarGetAxis")) +""" +function PetscDrawBarGetAxis(petsclib::PetscLibType, bar::PetscDrawBar, axis::PetscDrawAxis) end + +@for_petsc function PetscDrawBarGetAxis(petsclib::$UnionPetscLib, bar::PetscDrawBar, axis::PetscDrawAxis ) + + @chk ccall( + (:PetscDrawBarGetAxis, $petsc_library), + PetscErrorCode, + (PetscDrawBar, Ptr{PetscDrawAxis}), + bar, axis, + ) + + + return nothing +end + +""" + PetscDrawBarGetDraw(petsclib::PetscLibType,bar::PetscDrawBar, draw::PetscDraw) +Gets the draw context associated with a bar graph. + +Not Collective, draw is parallel if bar is parallel + +Input Parameter: +- `bar` - The bar graph context + +Output Parameter: +- `draw` - The draw context + +Level: intermediate + +-seealso: `PetscDrawBar`, `PetscDraw`, `PetscDrawBarCreate()`, `PetscDrawBarDraw()` + +# External Links +$(_doc_external("Sys/PetscDrawBarGetDraw")) +""" +function PetscDrawBarGetDraw(petsclib::PetscLibType, bar::PetscDrawBar, draw::PetscDraw) end + +@for_petsc function PetscDrawBarGetDraw(petsclib::$UnionPetscLib, bar::PetscDrawBar, draw::PetscDraw ) + + @chk ccall( + (:PetscDrawBarGetDraw, $petsc_library), + PetscErrorCode, + (PetscDrawBar, Ptr{PetscDraw}), + bar, draw, + ) + + + return nothing +end + +""" + PetscDrawBarSetFromOptions(petsclib::PetscLibType,bar::PetscDrawBar) +Sets options related to the display of the `PetscDrawBar` + +Collective + +Input Parameter: +- `bar` - the bar graph context + +Options Database Key: +- `-bar_sort` - sort the entries before drawing the bar graph + +Level: intermediate + +-seealso: `PetscDrawBar`, `PetscDrawBarDestroy()`, `PetscDrawBarCreate()`, `PetscDrawBarSort()` + +# External Links +$(_doc_external("Sys/PetscDrawBarSetFromOptions")) +""" +function PetscDrawBarSetFromOptions(petsclib::PetscLibType, bar::PetscDrawBar) end + +@for_petsc function PetscDrawBarSetFromOptions(petsclib::$UnionPetscLib, bar::PetscDrawBar ) + + @chk ccall( + (:PetscDrawBarSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscDrawBar,), + bar, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscDualSpace_wrappers.jl b/src/autowrapped/PetscDualSpace_wrappers.jl new file mode 100644 index 00000000..ef73e5c3 --- /dev/null +++ b/src/autowrapped/PetscDualSpace_wrappers.jl @@ -0,0 +1,2545 @@ +""" + PetscDualSpaceRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new `PetscDualSpaceType` + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine + +-seealso: `PetscDualSpace`, `PetscDualSpaceType`, `PetscDualSpaceRegisterAll()`, `PetscDualSpaceRegisterDestroy()` + +# External Links +$(_doc_external("DM/PetscDualSpaceRegister")) +""" +function PetscDualSpaceRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscDualSpaceRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscDualSpaceRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscDualSpaceSetType(petsclib::PetscLibType,sp::PetscDualSpace, name::PetscDualSpaceType) +Builds a particular `PetscDualSpace` based on its `PetscDualSpaceType` + +Collective + +Input Parameters: +- `sp` - The `PetscDualSpace` object +- `name` - The kind of space + +Options Database Key: +- `-petscdualspace_type ` - Sets the PetscDualSpace type; use -help for a list of available types + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceType`, `PetscDualSpaceGetType()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSetType")) +""" +function PetscDualSpaceSetType(petsclib::PetscLibType, sp::PetscDualSpace, name::PetscDualSpaceType) end + +@for_petsc function PetscDualSpaceSetType(petsclib::$UnionPetscLib, sp::PetscDualSpace, name::PetscDualSpaceType ) + + @chk ccall( + (:PetscDualSpaceSetType, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscDualSpaceType), + sp, name, + ) + + + return nothing +end + +""" + name::PetscDualSpaceType = PetscDualSpaceGetType(petsclib::PetscLibType,sp::PetscDualSpace) +Gets the `PetscDualSpaceType` name (as a string) from the object. + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `name` - The `PetscDualSpaceType` name + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceType`, `PetscDualSpaceSetType()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetType")) +""" +function PetscDualSpaceGetType(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetType(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + name_ = Ref{PetscDualSpaceType}() + + @chk ccall( + (:PetscDualSpaceGetType, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscDualSpaceType}), + sp, name_, + ) + + name = unsafe_string(name_[]) + + return name +end + +""" + PetscDualSpaceViewFromOptions(petsclib::PetscLibType,A::PetscDualSpace, obj::PetscObject, name::String) +View a `PetscDualSpace` based on values in the options database + +Collective + +Input Parameters: +- `A` - the `PetscDualSpace` object +- `obj` - Optional object, provides the options prefix +- `name` - command line option name + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceView()`, `PetscObjectViewFromOptions()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceViewFromOptions")) +""" +function PetscDualSpaceViewFromOptions(petsclib::PetscLibType, A::PetscDualSpace, obj::PetscObject, name::String) end + +@for_petsc function PetscDualSpaceViewFromOptions(petsclib::$UnionPetscLib, A::PetscDualSpace, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscDualSpaceViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscDualSpaceView(petsclib::PetscLibType,sp::PetscDualSpace, v::PetscViewer) +Views a `PetscDualSpace` + +Collective + +Input Parameters: +- `sp` - the `PetscDualSpace` object to view +- `v` - the viewer + +Level: beginner + +-seealso: `PetscViewer`, `PetscDualSpaceDestroy()`, `PetscDualSpace` + +# External Links +$(_doc_external("DM/PetscDualSpaceView")) +""" +function PetscDualSpaceView(petsclib::PetscLibType, sp::PetscDualSpace, v::PetscViewer) end + +@for_petsc function PetscDualSpaceView(petsclib::$UnionPetscLib, sp::PetscDualSpace, v::PetscViewer ) + + @chk ccall( + (:PetscDualSpaceView, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscViewer), + sp, v, + ) + + + return nothing +end + +""" + PetscDualSpaceSetFromOptions(petsclib::PetscLibType,sp::PetscDualSpace) +sets parameters in a `PetscDualSpace` from the options database + +Collective + +Input Parameter: +- `sp` - the `PetscDualSpace` object to set options for + +Options Database Keys: +- `-petscdualspace_order ` - the approximation order of the space +- `-petscdualspace_form_degree ` - the form degree, say 0 for point evaluations, or 2 for area integrals +- `-petscdualspace_components ` - the number of components, say d for a vector field +- `-petscdualspace_refcell ` - Reference cell type name +- `-petscdualspace_lagrange_continuity` - Flag for continuous element +- `-petscdualspace_lagrange_tensor` - Flag for tensor dual space +- `-petscdualspace_lagrange_trimmed` - Flag for trimmed dual space +- `-petscdualspace_lagrange_node_type ` - Lagrange node location type +- `-petscdualspace_lagrange_node_endpoints` - Flag for nodes that include endpoints +- `-petscdualspace_lagrange_node_exponent` - Gauss-Jacobi weight function exponent +- `-petscdualspace_lagrange_use_moments` - Use moments (where appropriate) for functionals +- `-petscdualspace_lagrange_moment_order ` - Quadrature order for moment functionals + +Level: intermediate + +-seealso: `PetscDualSpaceView()`, `PetscDualSpace`, `PetscObjectSetFromOptions()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSetFromOptions")) +""" +function PetscDualSpaceSetFromOptions(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceSetFromOptions(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + + @chk ccall( + (:PetscDualSpaceSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscDualSpace,), + sp, + ) + + + return nothing +end + +""" + PetscDualSpaceSetUp(petsclib::PetscLibType,sp::PetscDualSpace) +Construct a basis for a `PetscDualSpace` + +Collective + +Input Parameter: +- `sp` - the `PetscDualSpace` object to setup + +Level: intermediate + +-seealso: `PetscDualSpaceView()`, `PetscDualSpaceDestroy()`, `PetscDualSpace` + +# External Links +$(_doc_external("DM/PetscDualSpaceSetUp")) +""" +function PetscDualSpaceSetUp(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceSetUp(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + + @chk ccall( + (:PetscDualSpaceSetUp, $petsc_library), + PetscErrorCode, + (PetscDualSpace,), + sp, + ) + + + return nothing +end + +""" + PetscDualSpaceDestroy(petsclib::PetscLibType,sp::PetscDualSpace) +Destroys a `PetscDualSpace` object + +Collective + +Input Parameter: +- `sp` - the `PetscDualSpace` object to destroy + +Level: beginner + +-seealso: `PetscDualSpace`, `PetscDualSpaceView()`, `PetscDualSpace()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceDestroy")) +""" +function PetscDualSpaceDestroy(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceDestroy(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + + @chk ccall( + (:PetscDualSpaceDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscDualSpace},), + sp, + ) + + + return nothing +end + +""" + sp::PetscDualSpace = PetscDualSpaceCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty `PetscDualSpace` object. The type can then be set with `PetscDualSpaceSetType()`. + +Collective + +Input Parameter: +- `comm` - The communicator for the `PetscDualSpace` object + +Output Parameter: +- `sp` - The `PetscDualSpace` object + +Level: beginner + +-seealso: `PetscDualSpace`, `PetscDualSpaceSetType()`, `PETSCDUALSPACELAGRANGE` + +# External Links +$(_doc_external("DM/PetscDualSpaceCreate")) +""" +function PetscDualSpaceCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscDualSpaceCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + sp_ = Ref{PetscDualSpace}() + + @chk ccall( + (:PetscDualSpaceCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscDualSpace}), + comm, sp_, + ) + + sp = sp_[] + + return sp +end + +""" + spNew::PetscDualSpace = PetscDualSpaceDuplicate(petsclib::PetscLibType,sp::PetscDualSpace) +Creates a duplicate `PetscDualSpace` object that is not setup. + +Collective + +Input Parameter: +- `sp` - The original `PetscDualSpace` + +Output Parameter: +- `spNew` - The duplicate `PetscDualSpace` + +Level: beginner + +-seealso: `PetscDualSpace`, `PetscDualSpaceCreate()`, `PetscDualSpaceSetType()` + +# External Links +$(_doc_external("DM/PetscDualSpaceDuplicate")) +""" +function PetscDualSpaceDuplicate(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceDuplicate(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + spNew_ = Ref{PetscDualSpace}() + + @chk ccall( + (:PetscDualSpaceDuplicate, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscDualSpace}), + sp, spNew_, + ) + + spNew = spNew_[] + + return spNew +end + +""" + PetscDualSpaceGetDM(petsclib::PetscLibType,sp::PetscDualSpace, dm::PetscDM) +Get the `DM` representing the reference cell of a `PetscDualSpace` + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `dm` - The reference cell, that is a `DM` that consists of a single cell + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceSetDM()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetDM")) +""" +function PetscDualSpaceGetDM(petsclib::PetscLibType, sp::PetscDualSpace, dm::PetscDM) end + +@for_petsc function PetscDualSpaceGetDM(petsclib::$UnionPetscLib, sp::PetscDualSpace, dm::PetscDM ) + dm_ = Ref(dm.ptr) + + @chk ccall( + (:PetscDualSpaceGetDM, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{CDM}), + sp, dm_, + ) + + dm.ptr = C_NULL + + return nothing +end + +""" + PetscDualSpaceSetDM(petsclib::PetscLibType,sp::PetscDualSpace, dm::PetscDM) +Get the `DM` representing the reference cell + +Not Collective + +Input Parameters: +- `sp` - The `PetscDual`Space +- `dm` - The reference cell + +Level: intermediate + +-seealso: `PetscDualSpace`, `DM`, `PetscDualSpaceGetDM()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSetDM")) +""" +function PetscDualSpaceSetDM(petsclib::PetscLibType, sp::PetscDualSpace, dm::PetscDM) end + +@for_petsc function PetscDualSpaceSetDM(petsclib::$UnionPetscLib, sp::PetscDualSpace, dm::PetscDM ) + + @chk ccall( + (:PetscDualSpaceSetDM, $petsc_library), + PetscErrorCode, + (PetscDualSpace, CDM), + sp, dm, + ) + + + return nothing +end + +""" + order::PetscInt = PetscDualSpaceGetOrder(petsclib::PetscLibType,sp::PetscDualSpace) +Get the order of the dual space + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `order` - The order + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceSetOrder()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetOrder")) +""" +function PetscDualSpaceGetOrder(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetOrder(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + order_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDualSpaceGetOrder, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscInt}), + sp, order_, + ) + + order = order_[] + + return order +end + +""" + PetscDualSpaceSetOrder(petsclib::PetscLibType,sp::PetscDualSpace, order::PetscInt) +Set the order of the dual space + +Not Collective + +Input Parameters: +- `sp` - The `PetscDualSpace` +- `order` - The order + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceGetOrder()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSetOrder")) +""" +function PetscDualSpaceSetOrder(petsclib::PetscLibType, sp::PetscDualSpace, order::PetscInt) end + +@for_petsc function PetscDualSpaceSetOrder(petsclib::$UnionPetscLib, sp::PetscDualSpace, order::$PetscInt ) + + @chk ccall( + (:PetscDualSpaceSetOrder, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt), + sp, order, + ) + + + return nothing +end + +""" + Nc::PetscInt = PetscDualSpaceGetNumComponents(petsclib::PetscLibType,sp::PetscDualSpace) +Return the number of components for this space + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `Nc` - The number of components + +Level: intermediate + +-seealso: `PetscDualSpaceSetNumComponents()`, `PetscDualSpaceGetDimension()`, `PetscDualSpaceCreate()`, `PetscDualSpace` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetNumComponents")) +""" +function PetscDualSpaceGetNumComponents(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetNumComponents(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + Nc_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDualSpaceGetNumComponents, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscInt}), + sp, Nc_, + ) + + Nc = Nc_[] + + return Nc +end + +""" + PetscDualSpaceSetNumComponents(petsclib::PetscLibType,sp::PetscDualSpace, Nc::PetscInt) +Set the number of components for this space + +Input Parameters: +- `sp` - The `PetscDualSpace` +- `Nc` - The number of components + +Level: intermediate + +-seealso: `PetscDualSpaceGetNumComponents()`, `PetscDualSpaceCreate()`, `PetscDualSpace` + +# External Links +$(_doc_external("DM/PetscDualSpaceSetNumComponents")) +""" +function PetscDualSpaceSetNumComponents(petsclib::PetscLibType, sp::PetscDualSpace, Nc::PetscInt) end + +@for_petsc function PetscDualSpaceSetNumComponents(petsclib::$UnionPetscLib, sp::PetscDualSpace, Nc::$PetscInt ) + + @chk ccall( + (:PetscDualSpaceSetNumComponents, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt), + sp, Nc, + ) + + + return nothing +end + +""" + PetscDualSpaceGetFunctional(petsclib::PetscLibType,sp::PetscDualSpace, i::PetscInt, fncal::PetscQuadrature) +Get the i + +Not Collective + +Input Parameters: +- `sp` - The `PetscDualSpace` +- `i` - The basis number + +Output Parameter: +- `functional` - The basis functional + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscQuadrature`, `PetscDualSpaceGetDimension()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetFunctional")) +""" +function PetscDualSpaceGetFunctional(petsclib::PetscLibType, sp::PetscDualSpace, i::PetscInt, fncal::PetscQuadrature) end + +@for_petsc function PetscDualSpaceGetFunctional(petsclib::$UnionPetscLib, sp::PetscDualSpace, i::$PetscInt, fncal::PetscQuadrature ) + + @chk ccall( + (:PetscDualSpaceGetFunctional, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt, Ptr{PetscQuadrature}), + sp, i, fncal, + ) + + + return nothing +end + +""" + dim::PetscInt = PetscDualSpaceGetDimension(petsclib::PetscLibType,sp::PetscDualSpace) +Get the dimension of the dual space, i.e. the number of basis functionals + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `dim` - The dimension + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceGetFunctional()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetDimension")) +""" +function PetscDualSpaceGetDimension(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetDimension(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDualSpaceGetDimension, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscInt}), + sp, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + intdim::PetscInt = PetscDualSpaceGetInteriorDimension(petsclib::PetscLibType,sp::PetscDualSpace) +Get the interior dimension of the dual space, i.e. the number of basis functionals assigned to the interior of the reference domain + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `intdim` - The dimension + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceGetFunctional()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetInteriorDimension")) +""" +function PetscDualSpaceGetInteriorDimension(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetInteriorDimension(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + intdim_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDualSpaceGetInteriorDimension, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscInt}), + sp, intdim_, + ) + + intdim = intdim_[] + + return intdim +end + +""" + uniform::PetscBool = PetscDualSpaceGetUniform(petsclib::PetscLibType,sp::PetscDualSpace) +Whether this dual space is uniform + +Not Collective + +Input Parameter: +- `sp` - A dual space + +Output Parameter: +- `uniform` - `PETSC_TRUE` if (a) the dual space is the same for each point in a stratum of the reference `DMPLEX`, and +(b) every symmetry of each point in the reference `DMPLEX` is also a symmetry of the point's dual space. + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpaceGetPointSubspace()`, `PetscDualSpaceGetSymmetries()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetUniform")) +""" +function PetscDualSpaceGetUniform(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetUniform(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + uniform_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDualSpaceGetUniform, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscBool}), + sp, uniform_, + ) + + uniform = uniform_[] + + return uniform +end + +""" + numDof::Vector{PetscInt} = PetscDualSpaceGetNumDof(petsclib::PetscLibType,sp::PetscDualSpace) +Get the number of degrees of freedom for each spatial (topological) dimension + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `numDof` - An array of length dim+1 which holds the number of dofs for each dimension + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceGetFunctional()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetNumDof")) +""" +function PetscDualSpaceGetNumDof(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetNumDof(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + numDof_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscDualSpaceGetNumDof, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{Ptr{$PetscInt}}), + sp, numDof_, + ) + + numDof = unsafe_wrap(Array, numDof_[], VecGetLocalSize(petsclib, x); own = false) + + return numDof +end + +""" + PetscDualSpaceGetSection(petsclib::PetscLibType,sp::PetscDualSpace, section::PetscSection) +Create a `PetscSection` over the reference cell with the layout from this space + +Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `section` - The section + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscSection`, `PetscDualSpaceCreate()`, `DMPLEX` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetSection")) +""" +function PetscDualSpaceGetSection(petsclib::PetscLibType, sp::PetscDualSpace, section::PetscSection) end + +@for_petsc function PetscDualSpaceGetSection(petsclib::$UnionPetscLib, sp::PetscDualSpace, section::PetscSection ) + + @chk ccall( + (:PetscDualSpaceGetSection, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscSection}), + sp, section, + ) + + + return nothing +end + +""" + PetscDualSpaceGetInteriorSection(petsclib::PetscLibType,sp::PetscDualSpace, section::PetscSection) +Create a `PetscSection` over the reference cell with the layout from this space +for interior degrees of freedom + +Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `section` - The interior section + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscSection`, `PetscDualSpaceCreate()`, `DMPLEX` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetInteriorSection")) +""" +function PetscDualSpaceGetInteriorSection(petsclib::PetscLibType, sp::PetscDualSpace, section::PetscSection) end + +@for_petsc function PetscDualSpaceGetInteriorSection(petsclib::$UnionPetscLib, sp::PetscDualSpace, section::PetscSection ) + + @chk ccall( + (:PetscDualSpaceGetInteriorSection, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscSection}), + sp, section, + ) + + + return nothing +end + +""" + value::PetscScalar = PetscDualSpaceApply(petsclib::PetscLibType,sp::PetscDualSpace, f::PetscInt, time::PetscReal, cgeom::PetscFEGeom, numComp::PetscInt, func::external, ctx::Cvoid) +Apply a functional from the dual space basis to an input function + +Input Parameters: +- `sp` - The `PetscDualSpace` object +- `f` - The basis functional index +- `time` - The time +- `cgeom` - A context with geometric information for this cell, we use v0 (the initial vertex) and J (the Jacobian) (or evaluated at the coordinates of the functional) +- `numComp` - The number of components for the function +- `func` - The input function +- `ctx` - A context for the function + +Output Parameter: +- `value` - numComp output values + +Calling sequence: +-seealso: `PetscDualSpace`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceApply")) +""" +function PetscDualSpaceApply(petsclib::PetscLibType, sp::PetscDualSpace, f::PetscInt, time::PetscReal, cgeom::PetscFEGeom, numComp::PetscInt, func::external, ctx::Cvoid) end + +@for_petsc function PetscDualSpaceApply(petsclib::$UnionPetscLib, sp::PetscDualSpace, f::$PetscInt, time::$PetscReal, cgeom::PetscFEGeom, numComp::$PetscInt, func::external, ctx::Cvoid ) + value_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscDualSpaceApply, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt, $PetscReal, Ptr{PetscFEGeom}, $PetscInt, external, Ptr{Cvoid}, Ptr{$PetscScalar}), + sp, f, time, cgeom, numComp, func, ctx, value_, + ) + + value = value_[] + + return value +end + +""" + spValue::PetscScalar = PetscDualSpaceApplyAll(petsclib::PetscLibType,sp::PetscDualSpace, pointEval::PetscScalar) +Apply all functionals from the dual space basis to the result of an evaluation at the points returned by `PetscDualSpaceGetAllData()` + +Input Parameters: +- `sp` - The `PetscDualSpace` object +- `pointEval` - Evaluation at the points returned by `PetscDualSpaceGetAllData()` + +Output Parameter: +- `spValue` - The values of all dual space functionals + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceApplyAll")) +""" +function PetscDualSpaceApplyAll(petsclib::PetscLibType, sp::PetscDualSpace, pointEval::PetscScalar) end + +@for_petsc function PetscDualSpaceApplyAll(petsclib::$UnionPetscLib, sp::PetscDualSpace, pointEval::$PetscScalar ) + spValue_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscDualSpaceApplyAll, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + sp, pointEval, spValue_, + ) + + spValue = spValue_[] + + return spValue +end + +""" + spValue::PetscScalar = PetscDualSpaceApplyInterior(petsclib::PetscLibType,sp::PetscDualSpace, pointEval::PetscScalar) +Apply interior functionals from the dual space basis to the result of an evaluation at the points returned by `PetscDualSpaceGetInteriorData()` + +Input Parameters: +- `sp` - The `PetscDualSpace` object +- `pointEval` - Evaluation at the points returned by `PetscDualSpaceGetInteriorData()` + +Output Parameter: +- `spValue` - The values of interior dual space functionals + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceApplyInterior")) +""" +function PetscDualSpaceApplyInterior(petsclib::PetscLibType, sp::PetscDualSpace, pointEval::PetscScalar) end + +@for_petsc function PetscDualSpaceApplyInterior(petsclib::$UnionPetscLib, sp::PetscDualSpace, pointEval::$PetscScalar ) + spValue_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscDualSpaceApplyInterior, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + sp, pointEval, spValue_, + ) + + spValue = spValue_[] + + return spValue +end + +""" + value::PetscScalar = PetscDualSpaceApplyDefault(petsclib::PetscLibType,sp::PetscDualSpace, f::PetscInt, time::PetscReal, cgeom::PetscFEGeom, Nc::PetscInt, func::external, ctx::Cvoid) +Apply a functional from the dual space basis to an input function by assuming a point evaluation functional. + +Input Parameters: +- `sp` - The `PetscDualSpace` object +- `f` - The basis functional index +- `time` - The time +- `cgeom` - A context with geometric information for this cell, we use v0 (the initial vertex) and J (the Jacobian) +- `Nc` - The number of components for the function +- `func` - The input function +- `ctx` - A context for the function + +Output Parameter: +- `value` - The output value + +Calling sequence: +-seealso: `PetscDualSpace`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceApplyDefault")) +""" +function PetscDualSpaceApplyDefault(petsclib::PetscLibType, sp::PetscDualSpace, f::PetscInt, time::PetscReal, cgeom::PetscFEGeom, Nc::PetscInt, func::external, ctx::Cvoid) end + +@for_petsc function PetscDualSpaceApplyDefault(petsclib::$UnionPetscLib, sp::PetscDualSpace, f::$PetscInt, time::$PetscReal, cgeom::PetscFEGeom, Nc::$PetscInt, func::external, ctx::Cvoid ) + value_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscDualSpaceApplyDefault, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt, $PetscReal, Ptr{PetscFEGeom}, $PetscInt, external, Ptr{Cvoid}, Ptr{$PetscScalar}), + sp, f, time, cgeom, Nc, func, ctx, value_, + ) + + value = value_[] + + return value +end + +""" + spValue::PetscScalar = PetscDualSpaceApplyAllDefault(petsclib::PetscLibType,sp::PetscDualSpace, pointEval::PetscScalar) +Apply all functionals from the dual space basis to the result of an evaluation at the points returned by `PetscDualSpaceGetAllData()` + +Input Parameters: +- `sp` - The `PetscDualSpace` object +- `pointEval` - Evaluation at the points returned by `PetscDualSpaceGetAllData()` + +Output Parameter: +- `spValue` - The values of all dual space functionals + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceApplyAllDefault")) +""" +function PetscDualSpaceApplyAllDefault(petsclib::PetscLibType, sp::PetscDualSpace, pointEval::PetscScalar) end + +@for_petsc function PetscDualSpaceApplyAllDefault(petsclib::$UnionPetscLib, sp::PetscDualSpace, pointEval::$PetscScalar ) + spValue_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscDualSpaceApplyAllDefault, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + sp, pointEval, spValue_, + ) + + spValue = spValue_[] + + return spValue +end + +""" + spValue::PetscScalar = PetscDualSpaceApplyInteriorDefault(petsclib::PetscLibType,sp::PetscDualSpace, pointEval::PetscScalar) +Apply interior functionals from the dual space basis to the result of an evaluation at the points returned by `PetscDualSpaceGetInteriorData()` + +Input Parameters: +- `sp` - The `PetscDualSpace` object +- `pointEval` - Evaluation at the points returned by `PetscDualSpaceGetInteriorData()` + +Output Parameter: +- `spValue` - The values of interior dual space functionals + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceApplyInteriorDefault")) +""" +function PetscDualSpaceApplyInteriorDefault(petsclib::PetscLibType, sp::PetscDualSpace, pointEval::PetscScalar) end + +@for_petsc function PetscDualSpaceApplyInteriorDefault(petsclib::$UnionPetscLib, sp::PetscDualSpace, pointEval::$PetscScalar ) + spValue_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscDualSpaceApplyInteriorDefault, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + sp, pointEval, spValue_, + ) + + spValue = spValue_[] + + return spValue +end + +""" + PetscDualSpaceGetAllData(petsclib::PetscLibType,sp::PetscDualSpace, allNodes::PetscQuadrature, allMat::PetscMat) +Get all quadrature nodes from this space, and the matrix that sends quadrature node values to degree + +Input Parameter: +- `sp` - The dualspace + +Output Parameters: +- `allNodes` - A `PetscQuadrature` object containing all evaluation nodes, pass `NULL` if not needed +- `allMat` - A `Mat` for the node-to-dof transformation, pass `NULL` if not needed + +Level: advanced + +-seealso: `PetscQuadrature`, `PetscDualSpace`, `PetscDualSpaceCreate()`, `Mat` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetAllData")) +""" +function PetscDualSpaceGetAllData(petsclib::PetscLibType, sp::PetscDualSpace, allNodes::PetscQuadrature, allMat::PetscMat) end + +@for_petsc function PetscDualSpaceGetAllData(petsclib::$UnionPetscLib, sp::PetscDualSpace, allNodes::PetscQuadrature, allMat::PetscMat ) + allMat_ = Ref(allMat.ptr) + + @chk ccall( + (:PetscDualSpaceGetAllData, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscQuadrature}, Ptr{CMat}), + sp, allNodes, allMat_, + ) + + allMat.ptr = C_NULL + + return nothing +end + +""" + allNodes::PetscQuadrature,allMat::PetscMat = PetscDualSpaceCreateAllDataDefault(petsclib::PetscLibType,sp::PetscDualSpace) +Create all evaluation nodes and the node + +Input Parameter: +- `sp` - The dualspace + +Output Parameters: +- `allNodes` - A `PetscQuadrature` object containing all evaluation nodes +- `allMat` - A `Mat` for the node-to-dof transformation + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpaceCreate()`, `Mat`, `PetscQuadrature` + +# External Links +$(_doc_external("DM/PetscDualSpaceCreateAllDataDefault")) +""" +function PetscDualSpaceCreateAllDataDefault(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceCreateAllDataDefault(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + allNodes_ = Ref{PetscQuadrature}() + allMat_ = Ref{CMat}() + + @chk ccall( + (:PetscDualSpaceCreateAllDataDefault, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscQuadrature}, Ptr{CMat}), + sp, allNodes_, allMat_, + ) + + allNodes = allNodes_[] + allMat = PetscMat(allMat_[], petsclib) + + return allNodes,allMat +end + +""" + PetscDualSpaceGetInteriorData(petsclib::PetscLibType,sp::PetscDualSpace, intNodes::PetscQuadrature, intMat::PetscMat) +Get all quadrature points necessary to compute the interior degrees of freedom from +this space, as well as the matrix that computes the degrees of freedom from the quadrature +values. + +Input Parameter: +- `sp` - The dualspace + +Output Parameters: +- `intNodes` - A `PetscQuadrature` object containing all evaluation points needed to evaluate interior degrees of freedom, +pass `NULL` if not needed +- `intMat` - A matrix that computes dual space values from point values: size [spdim0 x (npoints * nc)], where spdim0 is +the size of the constrained layout (`PetscSectionGetConstrainStorageSize()`) of the dual space section, +npoints is the number of points in intNodes and nc is `PetscDualSpaceGetNumComponents()`. +Pass `NULL` if not needed + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscQuadrature`, `Mat`, `PetscDualSpaceCreate()`, `PetscDualSpaceGetDimension()`, `PetscDualSpaceGetNumComponents()`, `PetscQuadratureGetData()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetInteriorData")) +""" +function PetscDualSpaceGetInteriorData(petsclib::PetscLibType, sp::PetscDualSpace, intNodes::PetscQuadrature, intMat::PetscMat) end + +@for_petsc function PetscDualSpaceGetInteriorData(petsclib::$UnionPetscLib, sp::PetscDualSpace, intNodes::PetscQuadrature, intMat::PetscMat ) + intMat_ = Ref(intMat.ptr) + + @chk ccall( + (:PetscDualSpaceGetInteriorData, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscQuadrature}, Ptr{CMat}), + sp, intNodes, intMat_, + ) + + intMat.ptr = C_NULL + + return nothing +end + +""" + intNodes::PetscQuadrature,intMat::PetscMat = PetscDualSpaceCreateInteriorDataDefault(petsclib::PetscLibType,sp::PetscDualSpace) +Create quadrature points by examining interior functionals and create the matrix mapping quadrature point values to interior dual space values + +Input Parameter: +- `sp` - The dualspace + +Output Parameters: +- `intNodes` - A `PetscQuadrature` object containing all evaluation points needed to evaluate interior degrees of freedom +- `intMat` - A matrix that computes dual space values from point values: size [spdim0 x (npoints * nc)], where spdim0 is +the size of the constrained layout (`PetscSectionGetConstrainStorageSize()`) of the dual space section, +npoints is the number of points in allNodes and nc is `PetscDualSpaceGetNumComponents()`. + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscQuadrature`, `Mat`, `PetscDualSpaceCreate()`, `PetscDualSpaceGetInteriorData()` + +# External Links +$(_doc_external("DM/PetscDualSpaceCreateInteriorDataDefault")) +""" +function PetscDualSpaceCreateInteriorDataDefault(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceCreateInteriorDataDefault(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + intNodes_ = Ref{PetscQuadrature}() + intMat_ = Ref{CMat}() + + @chk ccall( + (:PetscDualSpaceCreateInteriorDataDefault, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscQuadrature}, Ptr{CMat}), + sp, intNodes_, intMat_, + ) + + intNodes = intNodes_[] + intMat = PetscMat(intMat_[], petsclib) + + return intNodes,intMat +end + +""" + equal::PetscBool = PetscDualSpaceEqual(petsclib::PetscLibType,A::PetscDualSpace, B::PetscDualSpace) +Determine if two dual spaces are equivalent + +Input Parameters: +- `A` - A `PetscDualSpace` object +- `B` - Another `PetscDualSpace` object + +Output Parameter: +- `equal` - `PETSC_TRUE` if the dual spaces are equivalent + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceEqual")) +""" +function PetscDualSpaceEqual(petsclib::PetscLibType, A::PetscDualSpace, B::PetscDualSpace) end + +@for_petsc function PetscDualSpaceEqual(petsclib::$UnionPetscLib, A::PetscDualSpace, B::PetscDualSpace ) + equal_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDualSpaceEqual, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscDualSpace, Ptr{PetscBool}), + A, B, equal_, + ) + + equal = equal_[] + + return equal +end + +""" + value::PetscScalar = PetscDualSpaceApplyFVM(petsclib::PetscLibType,sp::PetscDualSpace, f::PetscInt, time::PetscReal, cgeom::PetscFVCellGeom, Nc::PetscInt, func::external, ctx::Cvoid) +Apply a functional from the dual space basis to an input function by assuming a point evaluation functional at the cell centroid. + +Input Parameters: +- `sp` - The `PetscDualSpace` object +- `f` - The basis functional index +- `time` - The time +- `cgeom` - A context with geometric information for this cell, we currently just use the centroid +- `Nc` - The number of components for the function +- `func` - The input function +- `ctx` - A context for the function + +Output Parameter: +- `value` - The output value (scalar) + +Calling sequence: +-seealso: `PetscDualSpace`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceApplyFVM")) +""" +function PetscDualSpaceApplyFVM(petsclib::PetscLibType, sp::PetscDualSpace, f::PetscInt, time::PetscReal, cgeom::PetscFVCellGeom, Nc::PetscInt, func::external, ctx::Cvoid) end + +@for_petsc function PetscDualSpaceApplyFVM(petsclib::$UnionPetscLib, sp::PetscDualSpace, f::$PetscInt, time::$PetscReal, cgeom::PetscFVCellGeom, Nc::$PetscInt, func::external, ctx::Cvoid ) + value_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscDualSpaceApplyFVM, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt, $PetscReal, Ptr{PetscFVCellGeom}, $PetscInt, external, Ptr{Cvoid}, Ptr{$PetscScalar}), + sp, f, time, cgeom, Nc, func, ctx, value_, + ) + + value = value_[] + + return value +end + +""" + PetscDualSpaceGetHeightSubspace(petsclib::PetscLibType,sp::PetscDualSpace, height::PetscInt, subsp::PetscDualSpace) +Get the subset of the dual space basis that is supported on a mesh point of a +given height. This assumes that the reference cell is symmetric over points of this height. + +Not Collective + +Input Parameters: +- `sp` - the `PetscDualSpace` object +- `height` - the height of the mesh point for which the subspace is desired + +Output Parameter: +- `subsp` - the subspace. Note that the functionals in the subspace are with respect to the intrinsic geometry of the +point, which will be of lesser dimension if height > 0. + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscSpaceGetHeightSubspace()`, `PetscDualSpaceGetPointSubspace()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetHeightSubspace")) +""" +function PetscDualSpaceGetHeightSubspace(petsclib::PetscLibType, sp::PetscDualSpace, height::PetscInt, subsp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetHeightSubspace(petsclib::$UnionPetscLib, sp::PetscDualSpace, height::$PetscInt, subsp::PetscDualSpace ) + + @chk ccall( + (:PetscDualSpaceGetHeightSubspace, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt, Ptr{PetscDualSpace}), + sp, height, subsp, + ) + + + return nothing +end + +""" + PetscDualSpaceGetPointSubspace(petsclib::PetscLibType,sp::PetscDualSpace, point::PetscInt, bdsp::PetscDualSpace) +Get the subset of the dual space basis that is supported on a particular mesh point. + +Not Collective + +Input Parameters: +- `sp` - the `PetscDualSpace` object +- `point` - the point (in the dual space's DM) for which the subspace is desired + +Output Parameter: +- `bdsp` - the subspace. + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpaceGetHeightSubspace()` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetPointSubspace")) +""" +function PetscDualSpaceGetPointSubspace(petsclib::PetscLibType, sp::PetscDualSpace, point::PetscInt, bdsp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetPointSubspace(petsclib::$UnionPetscLib, sp::PetscDualSpace, point::$PetscInt, bdsp::PetscDualSpace ) + + @chk ccall( + (:PetscDualSpaceGetPointSubspace, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt, Ptr{PetscDualSpace}), + sp, point, bdsp, + ) + + + return nothing +end + +""" + perms::PetscInt,flips::PetscScalar = PetscDualSpaceGetSymmetries(petsclib::PetscLibType,sp::PetscDualSpace) +Returns a description of the symmetries of this basis + +Not Collective + +Input Parameter: +- `sp` - the `PetscDualSpace` object + +Output Parameters: +- `perms` - Permutations of the interior degrees of freedom, parameterized by the point orientation +- `flips` - Sign reversal of the interior degrees of freedom, parameterized by the point orientation + +Level: developer + +-seealso: `PetscDualSpace` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetSymmetries")) +""" +function PetscDualSpaceGetSymmetries(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetSymmetries(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + perms_ = Ref{$PetscInt}() + flips_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscDualSpaceGetSymmetries, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt, $PetscScalar), + sp, perms_, flips_, + ) + + perms = perms_[] + flips = flips_[] + + return perms,flips +end + +""" + k::PetscInt = PetscDualSpaceGetFormDegree(petsclib::PetscLibType,dsp::PetscDualSpace) +Get the form degree k for the k +dual space's functionals. + +Input Parameter: +- `dsp` - The `PetscDualSpace` + +Output Parameter: +- `k` - The *signed* degree k of the k. If k >= 0, this means that the degrees of freedom are k-forms, and are stored +in lexicographic order according to the basis of k-forms constructed from the wedge product of 1-forms. So for example, +the 1-form basis in 3-D is (dx, dy, dz), and the 2-form basis in 3-D is (dx wedge dy, dx wedge dz, dy wedge dz). +If k < 0, this means that the degrees transform as k-forms, but are stored as (N-k) forms according to the +Hodge star map. So for example if k = -2 and N = 3, this means that the degrees of freedom transform as 2-forms +but are stored as 1-forms. + +Level: developer + +-seealso: `PetscDualSpace`, `PetscDTAltV`, `PetscDualSpacePullback()`, `PetscDualSpacePushforward()`, `PetscDualSpaceTransform()`, `PetscDualSpaceTransformType` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetFormDegree")) +""" +function PetscDualSpaceGetFormDegree(petsclib::PetscLibType, dsp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetFormDegree(petsclib::$UnionPetscLib, dsp::PetscDualSpace ) + k_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDualSpaceGetFormDegree, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscInt}), + dsp, k_, + ) + + k = k_[] + + return k +end + +""" + PetscDualSpaceSetFormDegree(petsclib::PetscLibType,dsp::PetscDualSpace, k::PetscInt) +Set the form degree k for the k +dual space's functionals. + +Input Parameters: +- `dsp` - The `PetscDualSpace` +- `k` - The *signed* degree k of the k. If k >= 0, this means that the degrees of freedom are k-forms, and are stored +in lexicographic order according to the basis of k-forms constructed from the wedge product of 1-forms. So for example, +the 1-form basis in 3-D is (dx, dy, dz), and the 2-form basis in 3-D is (dx wedge dy, dx wedge dz, dy wedge dz). +If k < 0, this means that the degrees transform as k-forms, but are stored as (N-k) forms according to the +Hodge star map. So for example if k = -2 and N = 3, this means that the degrees of freedom transform as 2-forms +but are stored as 1-forms. + +Level: developer + +-seealso: `PetscDualSpace`, `PetscDTAltV`, `PetscDualSpacePullback()`, `PetscDualSpacePushforward()`, `PetscDualSpaceTransform()`, `PetscDualSpaceTransformType` + +# External Links +$(_doc_external("DM/PetscDualSpaceSetFormDegree")) +""" +function PetscDualSpaceSetFormDegree(petsclib::PetscLibType, dsp::PetscDualSpace, k::PetscInt) end + +@for_petsc function PetscDualSpaceSetFormDegree(petsclib::$UnionPetscLib, dsp::PetscDualSpace, k::$PetscInt ) + + @chk ccall( + (:PetscDualSpaceSetFormDegree, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt), + dsp, k, + ) + + + return nothing +end + +""" + k::PetscInt = PetscDualSpaceGetDeRahm(petsclib::PetscLibType,dsp::PetscDualSpace) +Get the k + +Input Parameter: +- `dsp` - The `PetscDualSpace` + +Output Parameter: +- `k` - The simplex dimension + +Level: developer + +-seealso: `PetscDualSpace`, `PetscDualSpacePullback()`, `PetscDualSpacePushforward()`, `PetscDualSpaceTransform()`, `PetscDualSpaceTransformType` + +# External Links +$(_doc_external("DM/PetscDualSpaceGetDeRahm")) +""" +function PetscDualSpaceGetDeRahm(petsclib::PetscLibType, dsp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceGetDeRahm(petsclib::$UnionPetscLib, dsp::PetscDualSpace ) + k_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDualSpaceGetDeRahm, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscInt}), + dsp, k_, + ) + + k = k_[] + + return k +end + +""" + PetscDualSpaceTransform(petsclib::PetscLibType,dsp::PetscDualSpace, trans::PetscDualSpaceTransformType, isInverse::PetscBool, fegeom::PetscFEGeom, Nv::PetscInt, Nc::PetscInt, vals::Vector{PetscScalar}) +Transform the function values + +Input Parameters: +- `dsp` - The `PetscDualSpace` +- `trans` - The type of transform +- `isInverse` - Flag to invert the transform +- `fegeom` - The cell geometry +- `Nv` - The number of function samples +- `Nc` - The number of function components +- `vals` - The function values + +Output Parameter: +- `vals` - The transformed function values + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceTransformGradient()`, `PetscDualSpaceTransformHessian()`, `PetscDualSpacePullback()`, `PetscDualSpacePushforward()`, `PetscDualSpaceTransformType` + +# External Links +$(_doc_external("DM/PetscDualSpaceTransform")) +""" +function PetscDualSpaceTransform(petsclib::PetscLibType, dsp::PetscDualSpace, trans::PetscDualSpaceTransformType, isInverse::PetscBool, fegeom::PetscFEGeom, Nv::PetscInt, Nc::PetscInt, vals::Vector{PetscScalar}) end + +@for_petsc function PetscDualSpaceTransform(petsclib::$UnionPetscLib, dsp::PetscDualSpace, trans::PetscDualSpaceTransformType, isInverse::PetscBool, fegeom::PetscFEGeom, Nv::$PetscInt, Nc::$PetscInt, vals::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscDualSpaceTransform, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscDualSpaceTransformType, PetscBool, Ptr{PetscFEGeom}, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + dsp, trans, isInverse, fegeom, Nv, Nc, vals, + ) + + + return nothing +end + +""" + PetscDualSpaceTransformGradient(petsclib::PetscLibType,dsp::PetscDualSpace, trans::PetscDualSpaceTransformType, isInverse::PetscBool, fegeom::PetscFEGeom, Nv::PetscInt, Nc::PetscInt, vals::Vector{PetscScalar}) +Transform the function gradient values + +Input Parameters: +- `dsp` - The `PetscDualSpace` +- `trans` - The type of transform +- `isInverse` - Flag to invert the transform +- `fegeom` - The cell geometry +- `Nv` - The number of function gradient samples +- `Nc` - The number of function components +- `vals` - The function gradient values + +Output Parameter: +- `vals` - The transformed function gradient values + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceTransform()`, `PetscDualSpacePullback()`, `PetscDualSpacePushforward()`, `PetscDualSpaceTransformType` + +# External Links +$(_doc_external("DM/PetscDualSpaceTransformGradient")) +""" +function PetscDualSpaceTransformGradient(petsclib::PetscLibType, dsp::PetscDualSpace, trans::PetscDualSpaceTransformType, isInverse::PetscBool, fegeom::PetscFEGeom, Nv::PetscInt, Nc::PetscInt, vals::Vector{PetscScalar}) end + +@for_petsc function PetscDualSpaceTransformGradient(petsclib::$UnionPetscLib, dsp::PetscDualSpace, trans::PetscDualSpaceTransformType, isInverse::PetscBool, fegeom::PetscFEGeom, Nv::$PetscInt, Nc::$PetscInt, vals::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscDualSpaceTransformGradient, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscDualSpaceTransformType, PetscBool, Ptr{PetscFEGeom}, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + dsp, trans, isInverse, fegeom, Nv, Nc, vals, + ) + + + return nothing +end + +""" + PetscDualSpaceTransformHessian(petsclib::PetscLibType,dsp::PetscDualSpace, trans::PetscDualSpaceTransformType, isInverse::PetscBool, fegeom::PetscFEGeom, Nv::PetscInt, Nc::PetscInt, vals::Vector{PetscScalar}) +Transform the function Hessian values + +Input Parameters: +- `dsp` - The `PetscDualSpace` +- `trans` - The type of transform +- `isInverse` - Flag to invert the transform +- `fegeom` - The cell geometry +- `Nv` - The number of function Hessian samples +- `Nc` - The number of function components +- `vals` - The function gradient values + +Output Parameter: +- `vals` - The transformed function Hessian values + +Level: intermediate + +-seealso: `PetscDualSpace`, `PetscDualSpaceTransform()`, `PetscDualSpacePullback()`, `PetscDualSpacePushforward()`, `PetscDualSpaceTransformType` + +# External Links +$(_doc_external("DM/PetscDualSpaceTransformHessian")) +""" +function PetscDualSpaceTransformHessian(petsclib::PetscLibType, dsp::PetscDualSpace, trans::PetscDualSpaceTransformType, isInverse::PetscBool, fegeom::PetscFEGeom, Nv::PetscInt, Nc::PetscInt, vals::Vector{PetscScalar}) end + +@for_petsc function PetscDualSpaceTransformHessian(petsclib::$UnionPetscLib, dsp::PetscDualSpace, trans::PetscDualSpaceTransformType, isInverse::PetscBool, fegeom::PetscFEGeom, Nv::$PetscInt, Nc::$PetscInt, vals::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscDualSpaceTransformHessian, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscDualSpaceTransformType, PetscBool, Ptr{PetscFEGeom}, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + dsp, trans, isInverse, fegeom, Nv, Nc, vals, + ) + + + return nothing +end + +""" + PetscDualSpacePullback(petsclib::PetscLibType,dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::PetscInt, Nc::PetscInt, pointEval::Vector{PetscScalar}) +Transform the given functional so that it operates on real space, rather than the reference element. Operationally, this means that we map the function evaluations depending on continuity requirements of our finite element method. + +Input Parameters: +- `dsp` - The `PetscDualSpace` +- `fegeom` - The geometry for this cell +- `Nq` - The number of function samples +- `Nc` - The number of function components +- `pointEval` - The function values + +Output Parameter: +- `pointEval` - The transformed function values + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpacePushforward()`, `PetscDualSpaceTransform()`, `PetscDualSpaceGetDeRahm()` + +# External Links +$(_doc_external("DM/PetscDualSpacePullback")) +""" +function PetscDualSpacePullback(petsclib::PetscLibType, dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::PetscInt, Nc::PetscInt, pointEval::Vector{PetscScalar}) end + +@for_petsc function PetscDualSpacePullback(petsclib::$UnionPetscLib, dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::$PetscInt, Nc::$PetscInt, pointEval::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscDualSpacePullback, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscFEGeom}, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + dsp, fegeom, Nq, Nc, pointEval, + ) + + + return nothing +end + +""" + PetscDualSpacePushforward(petsclib::PetscLibType,dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::PetscInt, Nc::PetscInt, pointEval::Vector{PetscScalar}) +Transform the given function so that it operates on real space, rather than the reference element. Operationally, this means that we map the function evaluations depending on continuity requirements of our finite element method. + +Input Parameters: +- `dsp` - The `PetscDualSpace` +- `fegeom` - The geometry for this cell +- `Nq` - The number of function samples +- `Nc` - The number of function components +- `pointEval` - The function values + +Output Parameter: +- `pointEval` - The transformed function values + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpacePullback()`, `PetscDualSpaceTransform()`, `PetscDualSpaceGetDeRahm()` + +# External Links +$(_doc_external("DM/PetscDualSpacePushforward")) +""" +function PetscDualSpacePushforward(petsclib::PetscLibType, dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::PetscInt, Nc::PetscInt, pointEval::Vector{PetscScalar}) end + +@for_petsc function PetscDualSpacePushforward(petsclib::$UnionPetscLib, dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::$PetscInt, Nc::$PetscInt, pointEval::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscDualSpacePushforward, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscFEGeom}, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + dsp, fegeom, Nq, Nc, pointEval, + ) + + + return nothing +end + +""" + PetscDualSpacePushforwardGradient(petsclib::PetscLibType,dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::PetscInt, Nc::PetscInt, pointEval::Vector{PetscScalar}) +Transform the given function gradient so that it operates on real space, rather than the reference element. Operationally, this means that we map the function evaluations depending on continuity requirements of our finite element method. + +Input Parameters: +- `dsp` - The `PetscDualSpace` +- `fegeom` - The geometry for this cell +- `Nq` - The number of function gradient samples +- `Nc` - The number of function components +- `pointEval` - The function gradient values + +Output Parameter: +- `pointEval` - The transformed function gradient values + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpacePushforward()`, `PetscDualSpacePullback()`, `PetscDualSpaceTransform()`, `PetscDualSpaceGetDeRahm()` + +# External Links +$(_doc_external("DM/PetscDualSpacePushforwardGradient")) +""" +function PetscDualSpacePushforwardGradient(petsclib::PetscLibType, dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::PetscInt, Nc::PetscInt, pointEval::Vector{PetscScalar}) end + +@for_petsc function PetscDualSpacePushforwardGradient(petsclib::$UnionPetscLib, dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::$PetscInt, Nc::$PetscInt, pointEval::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscDualSpacePushforwardGradient, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscFEGeom}, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + dsp, fegeom, Nq, Nc, pointEval, + ) + + + return nothing +end + +""" + PetscDualSpacePushforwardHessian(petsclib::PetscLibType,dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::PetscInt, Nc::PetscInt, pointEval::Vector{PetscScalar}) +Transform the given function Hessian so that it operates on real space, rather than the reference element. Operationally, this means that we map the function evaluations depending on continuity requirements of our finite element method. + +Input Parameters: +- `dsp` - The `PetscDualSpace` +- `fegeom` - The geometry for this cell +- `Nq` - The number of function Hessian samples +- `Nc` - The number of function components +- `pointEval` - The function gradient values + +Output Parameter: +- `pointEval` - The transformed function Hessian values + +Level: advanced + +-seealso: `PetscDualSpace`, `PetscDualSpacePushforward()`, `PetscDualSpacePullback()`, `PetscDualSpaceTransform()`, `PetscDualSpaceGetDeRahm()` + +# External Links +$(_doc_external("DM/PetscDualSpacePushforwardHessian")) +""" +function PetscDualSpacePushforwardHessian(petsclib::PetscLibType, dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::PetscInt, Nc::PetscInt, pointEval::Vector{PetscScalar}) end + +@for_petsc function PetscDualSpacePushforwardHessian(petsclib::$UnionPetscLib, dsp::PetscDualSpace, fegeom::PetscFEGeom, Nq::$PetscInt, Nc::$PetscInt, pointEval::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscDualSpacePushforwardHessian, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscFEGeom}, $PetscInt, $PetscInt, Ptr{$PetscScalar}), + dsp, fegeom, Nq, Nc, pointEval, + ) + + + return nothing +end + +""" + PetscDualSpaceSimpleSetDimension(petsclib::PetscLibType,sp::PetscDualSpace, dim::PetscInt) +Set the number of functionals in the dual space basis + +Logically Collective + +Input Parameters: +- `sp` - the `PetscDualSpace` +- `dim` - the basis dimension + +Level: intermediate + +-seealso: `PETSCDUALSPACESIMPLE`, `PetscDualSpace`, `PetscDualSpaceSimpleSetFunctional()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSimpleSetDimension")) +""" +function PetscDualSpaceSimpleSetDimension(petsclib::PetscLibType, sp::PetscDualSpace, dim::PetscInt) end + +@for_petsc function PetscDualSpaceSimpleSetDimension(petsclib::$UnionPetscLib, sp::PetscDualSpace, dim::$PetscInt ) + + @chk ccall( + (:PetscDualSpaceSimpleSetDimension, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt), + sp, dim, + ) + + + return nothing +end + +""" + PetscDualSpaceSimpleSetFunctional(petsclib::PetscLibType,sp::PetscDualSpace, func::PetscInt, q::PetscQuadrature) +Set the given basis functional for this dual space + +Not Collective + +Input Parameters: +- `sp` - the `PetscDualSpace` +- `func` - the basis index +- `q` - the basis functional + +Level: intermediate + +-seealso: `PETSCDUALSPACESIMPLE`, `PetscDualSpace`, `PetscDualSpaceSimpleSetDimension()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSimpleSetFunctional")) +""" +function PetscDualSpaceSimpleSetFunctional(petsclib::PetscLibType, sp::PetscDualSpace, func::PetscInt, q::PetscQuadrature) end + +@for_petsc function PetscDualSpaceSimpleSetFunctional(petsclib::$UnionPetscLib, sp::PetscDualSpace, func::$PetscInt, q::PetscQuadrature ) + + @chk ccall( + (:PetscDualSpaceSimpleSetFunctional, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt, PetscQuadrature), + sp, func, q, + ) + + + return nothing +end + +""" + continuous::PetscBool = PetscDualSpaceLagrangeGetContinuity(petsclib::PetscLibType,sp::PetscDualSpace) +Retrieves the flag for element continuity + +Not Collective + +Input Parameter: +- `sp` - the `PetscDualSpace` + +Output Parameter: +- `continuous` - flag for element continuity + +Level: intermediate + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDualSpaceLagrangeSetContinuity()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeGetContinuity")) +""" +function PetscDualSpaceLagrangeGetContinuity(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceLagrangeGetContinuity(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + continuous_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDualSpaceLagrangeGetContinuity, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscBool}), + sp, continuous_, + ) + + continuous = continuous_[] + + return continuous +end + +""" + PetscDualSpaceLagrangeSetContinuity(petsclib::PetscLibType,sp::PetscDualSpace, continuous::PetscBool) +Indicate whether the element is continuous + +Logically Collective + +Input Parameters: +- `sp` - the `PetscDualSpace` +- `continuous` - flag for element continuity + +Options Database Key: +- `-petscdualspace_lagrange_continuity ` - use a continuous element + +Level: intermediate + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDualSpaceLagrangeGetContinuity()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeSetContinuity")) +""" +function PetscDualSpaceLagrangeSetContinuity(petsclib::PetscLibType, sp::PetscDualSpace, continuous::PetscBool) end + +@for_petsc function PetscDualSpaceLagrangeSetContinuity(petsclib::$UnionPetscLib, sp::PetscDualSpace, continuous::PetscBool ) + + @chk ccall( + (:PetscDualSpaceLagrangeSetContinuity, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscBool), + sp, continuous, + ) + + + return nothing +end + +""" + tensor::PetscBool = PetscDualSpaceLagrangeGetTensor(petsclib::PetscLibType,sp::PetscDualSpace) +Get the tensor nature of the dual space + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `tensor` - Whether the dual space has tensor layout (vs. simplicial) + +Level: intermediate + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDualSpaceLagrangeSetTensor()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeGetTensor")) +""" +function PetscDualSpaceLagrangeGetTensor(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceLagrangeGetTensor(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + tensor_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDualSpaceLagrangeGetTensor, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscBool}), + sp, tensor_, + ) + + tensor = tensor_[] + + return tensor +end + +""" + PetscDualSpaceLagrangeSetTensor(petsclib::PetscLibType,sp::PetscDualSpace, tensor::PetscBool) +Set the tensor nature of the dual space + +Not Collective + +Input Parameters: +- `sp` - The `PetscDualSpace` +- `tensor` - Whether the dual space has tensor layout (vs. simplicial) + +Level: intermediate + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDualSpaceLagrangeGetTensor()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeSetTensor")) +""" +function PetscDualSpaceLagrangeSetTensor(petsclib::PetscLibType, sp::PetscDualSpace, tensor::PetscBool) end + +@for_petsc function PetscDualSpaceLagrangeSetTensor(petsclib::$UnionPetscLib, sp::PetscDualSpace, tensor::PetscBool ) + + @chk ccall( + (:PetscDualSpaceLagrangeSetTensor, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscBool), + sp, tensor, + ) + + + return nothing +end + +""" + trimmed::PetscBool = PetscDualSpaceLagrangeGetTrimmed(petsclib::PetscLibType,sp::PetscDualSpace) +Get the trimmed nature of the dual space + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `trimmed` - Whether the dual space represents to dual basis of a trimmed polynomial space (e.g. Raviart-Thomas and higher order / other form degree variants) + +Level: intermediate + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDualSpaceLagrangeSetTrimmed()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeGetTrimmed")) +""" +function PetscDualSpaceLagrangeGetTrimmed(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceLagrangeGetTrimmed(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + trimmed_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDualSpaceLagrangeGetTrimmed, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscBool}), + sp, trimmed_, + ) + + trimmed = trimmed_[] + + return trimmed +end + +""" + PetscDualSpaceLagrangeSetTrimmed(petsclib::PetscLibType,sp::PetscDualSpace, trimmed::PetscBool) +Set the trimmed nature of the dual space + +Not Collective + +Input Parameters: +- `sp` - The `PetscDualSpace` +- `trimmed` - Whether the dual space represents to dual basis of a trimmed polynomial space (e.g. Raviart-Thomas and higher order / other form degree variants) + +Level: intermediate + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDualSpaceLagrangeGetTrimmed()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeSetTrimmed")) +""" +function PetscDualSpaceLagrangeSetTrimmed(petsclib::PetscLibType, sp::PetscDualSpace, trimmed::PetscBool) end + +@for_petsc function PetscDualSpaceLagrangeSetTrimmed(petsclib::$UnionPetscLib, sp::PetscDualSpace, trimmed::PetscBool ) + + @chk ccall( + (:PetscDualSpaceLagrangeSetTrimmed, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscBool), + sp, trimmed, + ) + + + return nothing +end + +""" + nodeType::PetscDTNodeType,boundary::PetscBool,exponent::PetscReal = PetscDualSpaceLagrangeGetNodeType(petsclib::PetscLibType,sp::PetscDualSpace) +Get a description of how nodes are laid out for Lagrange polynomials in this +dual space + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameters: +- `nodeType` - The type of nodes +- `boundary` - Whether the node type is one that includes endpoints (if nodeType is `PETSCDTNODES_GAUSSJACOBI`, nodes that +include the boundary are Gauss-Lobatto-Jacobi nodes) +- `exponent` - If nodeType is `PETSCDTNODES_GAUSSJACOBI`, indicates the exponent used for both ends of the 1D Jacobi weight function +'0' is Gauss-Legendre, '-0.5' is Gauss-Chebyshev of the first type, '0.5' is Gauss-Chebyshev of the second type + +Level: advanced + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDTNodeType`, `PetscDualSpaceLagrangeSetNodeType()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeGetNodeType")) +""" +function PetscDualSpaceLagrangeGetNodeType(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceLagrangeGetNodeType(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + nodeType_ = Ref{PetscDTNodeType}() + boundary_ = Ref{PetscBool}() + exponent_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDualSpaceLagrangeGetNodeType, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscDTNodeType}, Ptr{PetscBool}, Ptr{$PetscReal}), + sp, nodeType_, boundary_, exponent_, + ) + + nodeType = unsafe_string(nodeType_[]) + boundary = boundary_[] + exponent = exponent_[] + + return nodeType,boundary,exponent +end + +""" + PetscDualSpaceLagrangeSetNodeType(petsclib::PetscLibType,sp::PetscDualSpace, nodeType::PetscDTNodeType, boundary::PetscBool, exponent::PetscReal) +Set a description of how nodes are laid out for Lagrange polynomials in this +dual space + +Logically Collective + +Input Parameters: +- `sp` - The `PetscDualSpace` +- `nodeType` - The type of nodes +- `boundary` - Whether the node type is one that includes endpoints (if nodeType is `PETSCDTNODES_GAUSSJACOBI`, nodes that +include the boundary are Gauss-Lobatto-Jacobi nodes) +- `exponent` - If nodeType is `PETSCDTNODES_GAUSSJACOBI`, indicates the exponent used for both ends of the 1D Jacobi weight function +'0' is Gauss-Legendre, '-0.5' is Gauss-Chebyshev of the first type, '0.5' is Gauss-Chebyshev of the second type + +Level: advanced + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDTNodeType`, `PetscDualSpaceLagrangeGetNodeType()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeSetNodeType")) +""" +function PetscDualSpaceLagrangeSetNodeType(petsclib::PetscLibType, sp::PetscDualSpace, nodeType::PetscDTNodeType, boundary::PetscBool, exponent::PetscReal) end + +@for_petsc function PetscDualSpaceLagrangeSetNodeType(petsclib::$UnionPetscLib, sp::PetscDualSpace, nodeType::PetscDTNodeType, boundary::PetscBool, exponent::$PetscReal ) + + @chk ccall( + (:PetscDualSpaceLagrangeSetNodeType, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscDTNodeType, PetscBool, $PetscReal), + sp, nodeType, boundary, exponent, + ) + + + return nothing +end + +""" + useMoments::PetscBool = PetscDualSpaceLagrangeGetUseMoments(petsclib::PetscLibType,sp::PetscDualSpace) +Get the flag for using moment functionals + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `useMoments` - Moment flag + +Level: advanced + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDualSpaceLagrangeSetUseMoments()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeGetUseMoments")) +""" +function PetscDualSpaceLagrangeGetUseMoments(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceLagrangeGetUseMoments(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + useMoments_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDualSpaceLagrangeGetUseMoments, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscBool}), + sp, useMoments_, + ) + + useMoments = useMoments_[] + + return useMoments +end + +""" + PetscDualSpaceLagrangeSetUseMoments(petsclib::PetscLibType,sp::PetscDualSpace, useMoments::PetscBool) +Set the flag for moment functionals + +Logically Collective + +Input Parameters: +- `sp` - The `PetscDualSpace` +- `useMoments` - The flag for moment functionals + +Level: advanced + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDualSpaceLagrangeGetUseMoments()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeSetUseMoments")) +""" +function PetscDualSpaceLagrangeSetUseMoments(petsclib::PetscLibType, sp::PetscDualSpace, useMoments::PetscBool) end + +@for_petsc function PetscDualSpaceLagrangeSetUseMoments(petsclib::$UnionPetscLib, sp::PetscDualSpace, useMoments::PetscBool ) + + @chk ccall( + (:PetscDualSpaceLagrangeSetUseMoments, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscBool), + sp, useMoments, + ) + + + return nothing +end + +""" + order::PetscInt = PetscDualSpaceLagrangeGetMomentOrder(petsclib::PetscLibType,sp::PetscDualSpace) +Get the order for moment integration + +Not Collective + +Input Parameter: +- `sp` - The `PetscDualSpace` + +Output Parameter: +- `order` - Moment integration order + +Level: advanced + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDualSpaceLagrangeSetMomentOrder()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeGetMomentOrder")) +""" +function PetscDualSpaceLagrangeGetMomentOrder(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceLagrangeGetMomentOrder(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + order_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDualSpaceLagrangeGetMomentOrder, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscInt}), + sp, order_, + ) + + order = order_[] + + return order +end + +""" + PetscDualSpaceLagrangeSetMomentOrder(petsclib::PetscLibType,sp::PetscDualSpace, order::PetscInt) +Set the order for moment integration + +Logically Collective + +Input Parameters: +- `sp` - The `PetscDualSpace` +- `order` - The order for moment integration + +Level: advanced + +-seealso: `PETSCDUALSPACELAGRANGE`, `PetscDualSpace`, `PetscDualSpaceLagrangeGetMomentOrder()` + +# External Links +$(_doc_external("DM/PetscDualSpaceLagrangeSetMomentOrder")) +""" +function PetscDualSpaceLagrangeSetMomentOrder(petsclib::PetscLibType, sp::PetscDualSpace, order::PetscInt) end + +@for_petsc function PetscDualSpaceLagrangeSetMomentOrder(petsclib::$UnionPetscLib, sp::PetscDualSpace, order::$PetscInt ) + + @chk ccall( + (:PetscDualSpaceLagrangeSetMomentOrder, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt), + sp, order, + ) + + + return nothing +end + +""" + numSumSpaces::PetscInt = PetscDualSpaceSumGetNumSubspaces(petsclib::PetscLibType,sp::PetscDualSpace) +Get the number of spaces in the sum space + +Input Parameter: +- `sp` - the dual space object + +Output Parameter: +- `numSumSpaces` - the number of spaces + +Level: intermediate + +-seealso: `PETSCDUALSPACESUM`, `PetscDualSpace`, `PetscDualSpaceSumSetNumSubspaces()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSumGetNumSubspaces")) +""" +function PetscDualSpaceSumGetNumSubspaces(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceSumGetNumSubspaces(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + numSumSpaces_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDualSpaceSumGetNumSubspaces, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{$PetscInt}), + sp, numSumSpaces_, + ) + + numSumSpaces = numSumSpaces_[] + + return numSumSpaces +end + +""" + PetscDualSpaceSumSetNumSubspaces(petsclib::PetscLibType,sp::PetscDualSpace, numSumSpaces::PetscInt) +Set the number of spaces in the sum space + +Input Parameters: +- `sp` - the dual space object +- `numSumSpaces` - the number of spaces + +Level: intermediate + +-seealso: `PETSCDUALSPACESUM`, `PetscDualSpace`, `PetscDualSpaceSumGetNumSubspaces()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSumSetNumSubspaces")) +""" +function PetscDualSpaceSumSetNumSubspaces(petsclib::PetscLibType, sp::PetscDualSpace, numSumSpaces::PetscInt) end + +@for_petsc function PetscDualSpaceSumSetNumSubspaces(petsclib::$UnionPetscLib, sp::PetscDualSpace, numSumSpaces::$PetscInt ) + + @chk ccall( + (:PetscDualSpaceSumSetNumSubspaces, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt), + sp, numSumSpaces, + ) + + + return nothing +end + +""" + concatenate::PetscBool = PetscDualSpaceSumGetConcatenate(petsclib::PetscLibType,sp::PetscDualSpace) +Get the concatenate flag for this space. + +Input Parameter: +- `sp` - the dual space object + +Output Parameter: +- `concatenate` - flag indicating whether subspaces are concatenated. + +Level: intermediate + +-seealso: `PETSCDUALSPACESUM`, `PetscDualSpace`, `PetscDualSpaceSumSetConcatenate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSumGetConcatenate")) +""" +function PetscDualSpaceSumGetConcatenate(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceSumGetConcatenate(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + concatenate_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDualSpaceSumGetConcatenate, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscBool}), + sp, concatenate_, + ) + + concatenate = concatenate_[] + + return concatenate +end + +""" + PetscDualSpaceSumSetConcatenate(petsclib::PetscLibType,sp::PetscDualSpace, concatenate::PetscBool) +Sets the concatenate flag for this space. + +Input Parameters: +- `sp` - the dual space object +- `concatenate` - are subspaces concatenated components (true) or direct summands (false) + +Level: intermediate + +-seealso: `PETSCDUALSPACESUM`, `PetscDualSpace`, `PetscDualSpaceSumGetConcatenate()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSumSetConcatenate")) +""" +function PetscDualSpaceSumSetConcatenate(petsclib::PetscLibType, sp::PetscDualSpace, concatenate::PetscBool) end + +@for_petsc function PetscDualSpaceSumSetConcatenate(petsclib::$UnionPetscLib, sp::PetscDualSpace, concatenate::PetscBool ) + + @chk ccall( + (:PetscDualSpaceSumSetConcatenate, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscBool), + sp, concatenate, + ) + + + return nothing +end + +""" + PetscDualSpaceSumGetSubspace(petsclib::PetscLibType,sp::PetscDualSpace, s::PetscInt, subsp::PetscDualSpace) +Get a space in the sum space + +Input Parameters: +- `sp` - the dual space object +- `s` - The space number + +Output Parameter: +- `subsp` - the `PetscDualSpace` + +Level: intermediate + +-seealso: `PETSCDUALSPACESUM`, `PetscDualSpace`, `PetscDualSpaceSumSetSubspace()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSumGetSubspace")) +""" +function PetscDualSpaceSumGetSubspace(petsclib::PetscLibType, sp::PetscDualSpace, s::PetscInt, subsp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceSumGetSubspace(petsclib::$UnionPetscLib, sp::PetscDualSpace, s::$PetscInt, subsp::PetscDualSpace ) + + @chk ccall( + (:PetscDualSpaceSumGetSubspace, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt, Ptr{PetscDualSpace}), + sp, s, subsp, + ) + + + return nothing +end + +""" + PetscDualSpaceSumSetSubspace(petsclib::PetscLibType,sp::PetscDualSpace, s::PetscInt, subsp::PetscDualSpace) +Set a space in the sum space + +Input Parameters: +- `sp` - the dual space object +- `s` - The space number +- `subsp` - the number of spaces + +Level: intermediate + +-seealso: `PETSCDUALSPACESUM`, `PetscDualSpace`, `PetscDualSpaceSumGetSubspace()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSumSetSubspace")) +""" +function PetscDualSpaceSumSetSubspace(petsclib::PetscLibType, sp::PetscDualSpace, s::PetscInt, subsp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceSumSetSubspace(petsclib::$UnionPetscLib, sp::PetscDualSpace, s::$PetscInt, subsp::PetscDualSpace ) + + @chk ccall( + (:PetscDualSpaceSumSetSubspace, $petsc_library), + PetscErrorCode, + (PetscDualSpace, $PetscInt, PetscDualSpace), + sp, s, subsp, + ) + + + return nothing +end + +""" + PetscDualSpaceSumSetInterleave(petsclib::PetscLibType,sp::PetscDualSpace, interleave_basis::PetscBool, interleave_components::PetscBool) +Set whether the basis functions and components of a uniform sum are interleaved + +Logically collective + +Input Parameters: +- `sp` - a `PetscDualSpace` of type `PETSCDUALSPACESUM` +- `interleave_basis` - if `PETSC_TRUE`, the basis vectors of the subspaces are interleaved +- `interleave_components` - if `PETSC_TRUE` and the space concatenates components (`PetscDualSpaceSumGetConcatenate()`), +interleave the concatenated components + +Level: developer + +-seealso: `PetscDualSpace`, `PETSCDUALSPACESUM`, `PETSCFEVECTOR`, `PetscDualSpaceSumGetInterleave()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSumSetInterleave")) +""" +function PetscDualSpaceSumSetInterleave(petsclib::PetscLibType, sp::PetscDualSpace, interleave_basis::PetscBool, interleave_components::PetscBool) end + +@for_petsc function PetscDualSpaceSumSetInterleave(petsclib::$UnionPetscLib, sp::PetscDualSpace, interleave_basis::PetscBool, interleave_components::PetscBool ) + + @chk ccall( + (:PetscDualSpaceSumSetInterleave, $petsc_library), + PetscErrorCode, + (PetscDualSpace, PetscBool, PetscBool), + sp, interleave_basis, interleave_components, + ) + + + return nothing +end + +""" + interleave_basis::PetscBool,interleave_components::PetscBool = PetscDualSpaceSumGetInterleave(petsclib::PetscLibType,sp::PetscDualSpace) +Get whether the basis functions and components of a uniform sum are interleaved + +Logically collective + +Input Parameter: +- `sp` - a `PetscDualSpace` of type `PETSCDUALSPACESUM` + +Output Parameters: +- `interleave_basis` - if `PETSC_TRUE`, the basis vectors of the subspaces are interleaved +- `interleave_components` - if `PETSC_TRUE` and the space concatenates components (`PetscDualSpaceSumGetConcatenate()`), +interleave the concatenated components + +Level: developer + +-seealso: `PetscDualSpace`, `PETSCDUALSPACESUM`, `PETSCFEVECTOR`, `PetscDualSpaceSumSetInterleave()` + +# External Links +$(_doc_external("DM/PetscDualSpaceSumGetInterleave")) +""" +function PetscDualSpaceSumGetInterleave(petsclib::PetscLibType, sp::PetscDualSpace) end + +@for_petsc function PetscDualSpaceSumGetInterleave(petsclib::$UnionPetscLib, sp::PetscDualSpace ) + interleave_basis_ = Ref{PetscBool}() + interleave_components_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDualSpaceSumGetInterleave, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscBool}, Ptr{PetscBool}), + sp, interleave_basis_, interleave_components_, + ) + + interleave_basis = interleave_basis_[] + interleave_components = interleave_components_[] + + return interleave_basis,interleave_components +end + +""" + sumSpace::PetscDualSpace = PetscDualSpaceCreateSum(petsclib::PetscLibType,numSubspaces::PetscInt, subspaces::Vector{PetscDualSpace}, concatenate::PetscBool) +Create a finite element dual basis that is the sum of other dual bases + +Collective + +Input Parameters: +- `numSubspaces` - the number of spaces that will be added together +- `subspaces` - an array of length `numSubspaces` of spaces +- `concatenate` - if `PETSC_FALSE`, the sum-space has the same components as the individual dual spaces (`PetscDualSpaceGetNumComponents()`); if `PETSC_TRUE`, the individual components are concatenated to create a dual space with more components + +Output Parameter: +- `sumSpace` - a `PetscDualSpace` of type `PETSCDUALSPACESUM` + +Level: advanced + +-seealso: `PetscDualSpace`, `PETSCDUALSPACESUM`, `PETSCSPACESUM` + +# External Links +$(_doc_external("DM/PetscDualSpaceCreateSum")) +""" +function PetscDualSpaceCreateSum(petsclib::PetscLibType, numSubspaces::PetscInt, subspaces::Vector{PetscDualSpace}, concatenate::PetscBool) end + +@for_petsc function PetscDualSpaceCreateSum(petsclib::$UnionPetscLib, numSubspaces::$PetscInt, subspaces::Vector{PetscDualSpace}, concatenate::PetscBool ) + sumSpace_ = Ref{PetscDualSpace}() + + @chk ccall( + (:PetscDualSpaceCreateSum, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{PetscDualSpace}, PetscBool, Ptr{PetscDualSpace}), + numSubspaces, subspaces, concatenate, sumSpace_, + ) + + sumSpace = sumSpace_[] + + return sumSpace +end + +""" + PetscDualSpaceRefinedSetCellSpaces(petsclib::PetscLibType,sp::PetscDualSpace, cellSpaces::Vector{PetscDualSpace}) +Set the dual spaces for the closures of each of the cells +in the multicell `DM` of a `PetscDualSpace` + +Collective + +Input Parameters: +- `sp` - a `PetscDualSpace` +- `cellSpaces` - one `PetscDualSpace` for each of the cells. The reference count of each cell space will be incremented, +so the user is still responsible for these spaces afterwards + +Level: intermediate + +-seealso: `PETSCDUALSPACEREFINED`, `PetscDualSpace`, `PetscFERefine()` + +# External Links +$(_doc_external("DM/PetscDualSpaceRefinedSetCellSpaces")) +""" +function PetscDualSpaceRefinedSetCellSpaces(petsclib::PetscLibType, sp::PetscDualSpace, cellSpaces::Vector{PetscDualSpace}) end + +@for_petsc function PetscDualSpaceRefinedSetCellSpaces(petsclib::$UnionPetscLib, sp::PetscDualSpace, cellSpaces::Vector{PetscDualSpace} ) + + @chk ccall( + (:PetscDualSpaceRefinedSetCellSpaces, $petsc_library), + PetscErrorCode, + (PetscDualSpace, Ptr{PetscDualSpace}), + sp, cellSpaces, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscFE_wrappers.jl b/src/autowrapped/PetscFE_wrappers.jl new file mode 100644 index 00000000..c9e0bb44 --- /dev/null +++ b/src/autowrapped/PetscFE_wrappers.jl @@ -0,0 +1,4230 @@ +""" + PetscFEFinalizePackage(petsclib::PetscLibType) +This function finalizes everything in the `PetscFE` package. It is called +from `PetscFinalize()`. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("DM/PetscFEFinalizePackage")) +""" +function PetscFEFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscFEFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscFEFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscFEInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PetscFE` package. It is called +from `PetscDLLibraryRegister()` when using dynamic libraries, and on the first call to `PetscSpaceCreate()` +when using static libraries. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("DM/PetscFEInitializePackage")) +""" +function PetscFEInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscFEInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscFEInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscFERegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new `PetscFEType` + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine + +-seealso: `PetscFE`, `PetscFEType`, `PetscFERegisterAll()`, `PetscFERegisterDestroy()` + +# External Links +$(_doc_external("DM/PetscFERegister")) +""" +function PetscFERegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscFERegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscFERegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscFESetType(petsclib::PetscLibType,fem::PetscFE, name::PetscFEType) +Builds a particular `PetscFE` + +Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `name` - The kind of FEM space + +Options Database Key: +- `-petscfe_type ` - Sets the `PetscFE` type; use -help for a list of available types + +Level: intermediate + +-seealso: `PetscFEType`, `PetscFE`, `PetscFEGetType()`, `PetscFECreate()` + +# External Links +$(_doc_external("DM/PetscFESetType")) +""" +function PetscFESetType(petsclib::PetscLibType, fem::PetscFE, name::PetscFEType) end + +@for_petsc function PetscFESetType(petsclib::$UnionPetscLib, fem::PetscFE, name::PetscFEType ) + + @chk ccall( + (:PetscFESetType, $petsc_library), + PetscErrorCode, + (PetscFE, PetscFEType), + fem, name, + ) + + + return nothing +end + +""" + name::PetscFEType = PetscFEGetType(petsclib::PetscLibType,fem::PetscFE) +Gets the `PetscFEType` (as a string) from the `PetscFE` object. + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` + +Output Parameter: +- `name` - The `PetscFEType` name + +Level: intermediate + +-seealso: `PetscFEType`, `PetscFE`, `PetscFESetType()`, `PetscFECreate()` + +# External Links +$(_doc_external("DM/PetscFEGetType")) +""" +function PetscFEGetType(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFEGetType(petsclib::$UnionPetscLib, fem::PetscFE ) + name_ = Ref{PetscFEType}() + + @chk ccall( + (:PetscFEGetType, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscFEType}), + fem, name_, + ) + + name = unsafe_string(name_[]) + + return name +end + +""" + PetscFEViewFromOptions(petsclib::PetscLibType,A::PetscFE, obj::PetscObject, name::String) +View from a `PetscFE` based on values in the options database + +Collective + +Input Parameters: +- `A` - the `PetscFE` object +- `obj` - Optional object that provides the options prefix, pass `NULL` to use the options prefix of `A` +- `name` - command line option name + +Level: intermediate + +-seealso: `PetscFE`, `PetscFEView()`, `PetscObjectViewFromOptions()`, `PetscFECreate()` + +# External Links +$(_doc_external("DM/PetscFEViewFromOptions")) +""" +function PetscFEViewFromOptions(petsclib::PetscLibType, A::PetscFE, obj::PetscObject, name::String) end + +@for_petsc function PetscFEViewFromOptions(petsclib::$UnionPetscLib, A::PetscFE, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscFEViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscFE, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscFEView(petsclib::PetscLibType,fem::PetscFE, viewer::PetscViewer) +Views a `PetscFE` + +Collective + +Input Parameters: +- `fem` - the `PetscFE` object to view +- `viewer` - the viewer + +Level: beginner + +-seealso: `PetscFE`, `PetscViewer`, `PetscFEDestroy()`, `PetscFEViewFromOptions()` + +# External Links +$(_doc_external("DM/PetscFEView")) +""" +function PetscFEView(petsclib::PetscLibType, fem::PetscFE, viewer::PetscViewer) end + +@for_petsc function PetscFEView(petsclib::$UnionPetscLib, fem::PetscFE, viewer::PetscViewer ) + + @chk ccall( + (:PetscFEView, $petsc_library), + PetscErrorCode, + (PetscFE, PetscViewer), + fem, viewer, + ) + + + return nothing +end + +""" + PetscFESetFromOptions(petsclib::PetscLibType,fem::PetscFE) +sets parameters in a `PetscFE` from the options database + +Collective + +Input Parameter: +- `fem` - the `PetscFE` object to set options for + +Options Database Keys: +- `-petscfe_num_blocks` - the number of cell blocks to integrate concurrently +- `-petscfe_num_batches` - the number of cell batches to integrate serially + +Level: intermediate + +-seealso: `PetscFE`, `PetscFEView()` + +# External Links +$(_doc_external("DM/PetscFESetFromOptions")) +""" +function PetscFESetFromOptions(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFESetFromOptions(petsclib::$UnionPetscLib, fem::PetscFE ) + + @chk ccall( + (:PetscFESetFromOptions, $petsc_library), + PetscErrorCode, + (PetscFE,), + fem, + ) + + + return nothing +end + +""" + PetscFESetUp(petsclib::PetscLibType,fem::PetscFE) +Construct data structures for the `PetscFE` after the `PetscFEType` has been set + +Collective + +Input Parameter: +- `fem` - the `PetscFE` object to setup + +Level: intermediate + +-seealso: `PetscFE`, `PetscFEView()`, `PetscFEDestroy()` + +# External Links +$(_doc_external("DM/PetscFESetUp")) +""" +function PetscFESetUp(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFESetUp(petsclib::$UnionPetscLib, fem::PetscFE ) + + @chk ccall( + (:PetscFESetUp, $petsc_library), + PetscErrorCode, + (PetscFE,), + fem, + ) + + + return nothing +end + +""" + PetscFEDestroy(petsclib::PetscLibType,fem::PetscFE) +Destroys a `PetscFE` object + +Collective + +Input Parameter: +- `fem` - the `PetscFE` object to destroy + +Level: beginner + +-seealso: `PetscFE`, `PetscFEView()` + +# External Links +$(_doc_external("DM/PetscFEDestroy")) +""" +function PetscFEDestroy(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFEDestroy(petsclib::$UnionPetscLib, fem::PetscFE ) + + @chk ccall( + (:PetscFEDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscFE},), + fem, + ) + + + return nothing +end + +""" + fem::PetscFE = PetscFECreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty `PetscFE` object. The type can then be set with `PetscFESetType()`. + +Collective + +Input Parameter: +- `comm` - The communicator for the `PetscFE` object + +Output Parameter: +- `fem` - The `PetscFE` object + +Level: beginner + +-seealso: `PetscFE`, `PetscFEType`, `PetscFESetType()`, `PetscFECreateDefault()`, `PETSCFEGALERKIN` + +# External Links +$(_doc_external("DM/PetscFECreate")) +""" +function PetscFECreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscFECreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + fem_ = Ref{PetscFE}() + + @chk ccall( + (:PetscFECreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscFE}), + comm, fem_, + ) + + fem = fem_[] + + return fem +end + +""" + dim::PetscInt = PetscFEGetSpatialDimension(petsclib::PetscLibType,fem::PetscFE) +Returns the spatial dimension of the element + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` object + +Output Parameter: +- `dim` - The spatial dimension + +Level: intermediate + +-seealso: `PetscFE`, `PetscFECreate()` + +# External Links +$(_doc_external("DM/PetscFEGetSpatialDimension")) +""" +function PetscFEGetSpatialDimension(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFEGetSpatialDimension(petsclib::$UnionPetscLib, fem::PetscFE ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscFEGetSpatialDimension, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{$PetscInt}), + fem, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + PetscFESetNumComponents(petsclib::PetscLibType,fem::PetscFE, comp::PetscInt) +Sets the number of field components in the element + +Not Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `comp` - The number of field components + +Level: intermediate + +-seealso: `PetscFE`, `PetscFECreate()`, `PetscFEGetSpatialDimension()`, `PetscFEGetNumComponents()` + +# External Links +$(_doc_external("DM/PetscFESetNumComponents")) +""" +function PetscFESetNumComponents(petsclib::PetscLibType, fem::PetscFE, comp::PetscInt) end + +@for_petsc function PetscFESetNumComponents(petsclib::$UnionPetscLib, fem::PetscFE, comp::$PetscInt ) + + @chk ccall( + (:PetscFESetNumComponents, $petsc_library), + PetscErrorCode, + (PetscFE, $PetscInt), + fem, comp, + ) + + + return nothing +end + +""" + comp::PetscInt = PetscFEGetNumComponents(petsclib::PetscLibType,fem::PetscFE) +Returns the number of components in the element + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` object + +Output Parameter: +- `comp` - The number of field components + +Level: intermediate + +-seealso: `PetscFE`, `PetscFECreate()`, `PetscFEGetSpatialDimension()` + +# External Links +$(_doc_external("DM/PetscFEGetNumComponents")) +""" +function PetscFEGetNumComponents(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFEGetNumComponents(petsclib::$UnionPetscLib, fem::PetscFE ) + comp_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscFEGetNumComponents, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{$PetscInt}), + fem, comp_, + ) + + comp = comp_[] + + return comp +end + +""" + PetscFESetTileSizes(petsclib::PetscLibType,fem::PetscFE, blockSize::PetscInt, numBlocks::PetscInt, batchSize::PetscInt, numBatches::PetscInt) +Sets the tile sizes for evaluation + +Not Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `blockSize` - The number of elements in a block +- `numBlocks` - The number of blocks in a batch +- `batchSize` - The number of elements in a batch +- `numBatches` - The number of batches in a chunk + +Level: intermediate + +-seealso: `PetscFE`, `PetscFECreate()`, `PetscFEGetTileSizes()` + +# External Links +$(_doc_external("DM/PetscFESetTileSizes")) +""" +function PetscFESetTileSizes(petsclib::PetscLibType, fem::PetscFE, blockSize::PetscInt, numBlocks::PetscInt, batchSize::PetscInt, numBatches::PetscInt) end + +@for_petsc function PetscFESetTileSizes(petsclib::$UnionPetscLib, fem::PetscFE, blockSize::$PetscInt, numBlocks::$PetscInt, batchSize::$PetscInt, numBatches::$PetscInt ) + + @chk ccall( + (:PetscFESetTileSizes, $petsc_library), + PetscErrorCode, + (PetscFE, $PetscInt, $PetscInt, $PetscInt, $PetscInt), + fem, blockSize, numBlocks, batchSize, numBatches, + ) + + + return nothing +end + +""" + blockSize::PetscInt,numBlocks::PetscInt,batchSize::PetscInt,numBatches::PetscInt = PetscFEGetTileSizes(petsclib::PetscLibType,fem::PetscFE) +Returns the tile sizes for evaluation + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` object + +Output Parameters: +- `blockSize` - The number of elements in a block, pass `NULL` if not needed +- `numBlocks` - The number of blocks in a batch, pass `NULL` if not needed +- `batchSize` - The number of elements in a batch, pass `NULL` if not needed +- `numBatches` - The number of batches in a chunk, pass `NULL` if not needed + +Level: intermediate + +-seealso: `PetscFE`, `PetscFECreate()`, `PetscFESetTileSizes()` + +# External Links +$(_doc_external("DM/PetscFEGetTileSizes")) +""" +function PetscFEGetTileSizes(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFEGetTileSizes(petsclib::$UnionPetscLib, fem::PetscFE ) + blockSize_ = Ref{$PetscInt}() + numBlocks_ = Ref{$PetscInt}() + batchSize_ = Ref{$PetscInt}() + numBatches_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscFEGetTileSizes, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + fem, blockSize_, numBlocks_, batchSize_, numBatches_, + ) + + blockSize = blockSize_[] + numBlocks = numBlocks_[] + batchSize = batchSize_[] + numBatches = numBatches_[] + + return blockSize,numBlocks,batchSize,numBatches +end + +""" + PetscFEGetBasisSpace(petsclib::PetscLibType,fem::PetscFE, sp::PetscSpace) +Returns the `PetscSpace` used for the approximation of the solution for the `PetscFE` + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` object + +Output Parameter: +- `sp` - The `PetscSpace` object + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscFECreate()` + +# External Links +$(_doc_external("DM/PetscFEGetBasisSpace")) +""" +function PetscFEGetBasisSpace(petsclib::PetscLibType, fem::PetscFE, sp::PetscSpace) end + +@for_petsc function PetscFEGetBasisSpace(petsclib::$UnionPetscLib, fem::PetscFE, sp::PetscSpace ) + + @chk ccall( + (:PetscFEGetBasisSpace, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscSpace}), + fem, sp, + ) + + + return nothing +end + +""" + PetscFESetBasisSpace(petsclib::PetscLibType,fem::PetscFE, sp::PetscSpace) +Sets the `PetscSpace` used for the approximation of the solution + +Not Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `sp` - The `PetscSpace` object + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscFECreate()`, `PetscFESetDualSpace()` + +# External Links +$(_doc_external("DM/PetscFESetBasisSpace")) +""" +function PetscFESetBasisSpace(petsclib::PetscLibType, fem::PetscFE, sp::PetscSpace) end + +@for_petsc function PetscFESetBasisSpace(petsclib::$UnionPetscLib, fem::PetscFE, sp::PetscSpace ) + + @chk ccall( + (:PetscFESetBasisSpace, $petsc_library), + PetscErrorCode, + (PetscFE, PetscSpace), + fem, sp, + ) + + + return nothing +end + +""" + PetscFEGetDualSpace(petsclib::PetscLibType,fem::PetscFE, sp::PetscDualSpace) +Returns the `PetscDualSpace` used to define the inner product for a `PetscFE` + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` object + +Output Parameter: +- `sp` - The `PetscDualSpace` object + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscFECreate()` + +# External Links +$(_doc_external("DM/PetscFEGetDualSpace")) +""" +function PetscFEGetDualSpace(petsclib::PetscLibType, fem::PetscFE, sp::PetscDualSpace) end + +@for_petsc function PetscFEGetDualSpace(petsclib::$UnionPetscLib, fem::PetscFE, sp::PetscDualSpace ) + + @chk ccall( + (:PetscFEGetDualSpace, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscDualSpace}), + fem, sp, + ) + + + return nothing +end + +""" + PetscFESetDualSpace(petsclib::PetscLibType,fem::PetscFE, sp::PetscDualSpace) +Sets the `PetscDualSpace` used to define the inner product + +Not Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `sp` - The `PetscDualSpace` object + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscFECreate()`, `PetscFESetBasisSpace()` + +# External Links +$(_doc_external("DM/PetscFESetDualSpace")) +""" +function PetscFESetDualSpace(petsclib::PetscLibType, fem::PetscFE, sp::PetscDualSpace) end + +@for_petsc function PetscFESetDualSpace(petsclib::$UnionPetscLib, fem::PetscFE, sp::PetscDualSpace ) + + @chk ccall( + (:PetscFESetDualSpace, $petsc_library), + PetscErrorCode, + (PetscFE, PetscDualSpace), + fem, sp, + ) + + + return nothing +end + +""" + PetscFEGetQuadrature(petsclib::PetscLibType,fem::PetscFE, q::PetscQuadrature) +Returns the `PetscQuadrature` used to calculate inner products + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` object + +Output Parameter: +- `q` - The `PetscQuadrature` object + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscQuadrature`, `PetscFECreate()` + +# External Links +$(_doc_external("DM/PetscFEGetQuadrature")) +""" +function PetscFEGetQuadrature(petsclib::PetscLibType, fem::PetscFE, q::PetscQuadrature) end + +@for_petsc function PetscFEGetQuadrature(petsclib::$UnionPetscLib, fem::PetscFE, q::PetscQuadrature ) + + @chk ccall( + (:PetscFEGetQuadrature, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscQuadrature}), + fem, q, + ) + + + return nothing +end + +""" + PetscFESetQuadrature(petsclib::PetscLibType,fem::PetscFE, q::PetscQuadrature) +Sets the `PetscQuadrature` used to calculate inner products + +Not Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `q` - The `PetscQuadrature` object + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscQuadrature`, `PetscFECreate()`, `PetscFEGetFaceQuadrature()` + +# External Links +$(_doc_external("DM/PetscFESetQuadrature")) +""" +function PetscFESetQuadrature(petsclib::PetscLibType, fem::PetscFE, q::PetscQuadrature) end + +@for_petsc function PetscFESetQuadrature(petsclib::$UnionPetscLib, fem::PetscFE, q::PetscQuadrature ) + + @chk ccall( + (:PetscFESetQuadrature, $petsc_library), + PetscErrorCode, + (PetscFE, PetscQuadrature), + fem, q, + ) + + + return nothing +end + +""" + PetscFEGetFaceQuadrature(petsclib::PetscLibType,fem::PetscFE, q::PetscQuadrature) +Returns the `PetscQuadrature` used to calculate inner products on faces + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` object + +Output Parameter: +- `q` - The `PetscQuadrature` object + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscQuadrature`, `PetscFECreate()`, `PetscFESetQuadrature()`, `PetscFESetFaceQuadrature()` + +# External Links +$(_doc_external("DM/PetscFEGetFaceQuadrature")) +""" +function PetscFEGetFaceQuadrature(petsclib::PetscLibType, fem::PetscFE, q::PetscQuadrature) end + +@for_petsc function PetscFEGetFaceQuadrature(petsclib::$UnionPetscLib, fem::PetscFE, q::PetscQuadrature ) + + @chk ccall( + (:PetscFEGetFaceQuadrature, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscQuadrature}), + fem, q, + ) + + + return nothing +end + +""" + PetscFESetFaceQuadrature(petsclib::PetscLibType,fem::PetscFE, q::PetscQuadrature) +Sets the `PetscQuadrature` used to calculate inner products on faces + +Not Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `q` - The `PetscQuadrature` object + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscQuadrature`, `PetscFECreate()`, `PetscFESetQuadrature()` + +# External Links +$(_doc_external("DM/PetscFESetFaceQuadrature")) +""" +function PetscFESetFaceQuadrature(petsclib::PetscLibType, fem::PetscFE, q::PetscQuadrature) end + +@for_petsc function PetscFESetFaceQuadrature(petsclib::$UnionPetscLib, fem::PetscFE, q::PetscQuadrature ) + + @chk ccall( + (:PetscFESetFaceQuadrature, $petsc_library), + PetscErrorCode, + (PetscFE, PetscQuadrature), + fem, q, + ) + + + return nothing +end + +""" + PetscFECopyQuadrature(petsclib::PetscLibType,sfe::PetscFE, tfe::PetscFE) +Copy both volumetric and surface quadrature to a new `PetscFE` + +Not Collective + +Input Parameters: +- `sfe` - The `PetscFE` source for the quadratures +- `tfe` - The `PetscFE` target for the quadratures + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscQuadrature`, `PetscFECreate()`, `PetscFESetQuadrature()`, `PetscFESetFaceQuadrature()` + +# External Links +$(_doc_external("DM/PetscFECopyQuadrature")) +""" +function PetscFECopyQuadrature(petsclib::PetscLibType, sfe::PetscFE, tfe::PetscFE) end + +@for_petsc function PetscFECopyQuadrature(petsclib::$UnionPetscLib, sfe::PetscFE, tfe::PetscFE ) + + @chk ccall( + (:PetscFECopyQuadrature, $petsc_library), + PetscErrorCode, + (PetscFE, PetscFE), + sfe, tfe, + ) + + + return nothing +end + +""" + numDof::Vector{PetscInt} = PetscFEGetNumDof(petsclib::PetscLibType,fem::PetscFE) +Returns the number of dofs (dual basis vectors) associated to mesh points on the reference cell of a given dimension + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` object + +Output Parameter: +- `numDof` - Array of length `dim` with the number of dofs in each dimension + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscFECreate()` + +# External Links +$(_doc_external("DM/PetscFEGetNumDof")) +""" +function PetscFEGetNumDof(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFEGetNumDof(petsclib::$UnionPetscLib, fem::PetscFE ) + numDof_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscFEGetNumDof, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{Ptr{$PetscInt}}), + fem, numDof_, + ) + + numDof = unsafe_wrap(Array, numDof_[], VecGetLocalSize(petsclib, x); own = false) + + return numDof +end + +""" + PetscFEGetCellTabulation(petsclib::PetscLibType,fem::PetscFE, k::PetscInt, T::PetscTabulation) +Returns the tabulation of the basis functions at the quadrature points on the reference cell + +Not Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `k` - The highest derivative we need to tabulate, very often 1 + +Output Parameter: +- `T` - The basis function values and derivatives at quadrature points + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscTabulation`, `PetscFECreateTabulation()`, `PetscTabulationDestroy()` + +# External Links +$(_doc_external("DM/PetscFEGetCellTabulation")) +""" +function PetscFEGetCellTabulation(petsclib::PetscLibType, fem::PetscFE, k::PetscInt, T::PetscTabulation) end + +@for_petsc function PetscFEGetCellTabulation(petsclib::$UnionPetscLib, fem::PetscFE, k::$PetscInt, T::PetscTabulation ) + + @chk ccall( + (:PetscFEGetCellTabulation, $petsc_library), + PetscErrorCode, + (PetscFE, $PetscInt, Ptr{PetscTabulation}), + fem, k, T, + ) + + + return nothing +end + +""" + PetscFEExpandFaceQuadrature(petsclib::PetscLibType,fe::PetscFE, fq::PetscQuadrature, efq::PetscQuadrature) + +# External Links +$(_doc_external("DM/PetscFEExpandFaceQuadrature")) +""" +function PetscFEExpandFaceQuadrature(petsclib::PetscLibType, fe::PetscFE, fq::PetscQuadrature, efq::PetscQuadrature) end + +@for_petsc function PetscFEExpandFaceQuadrature(petsclib::$UnionPetscLib, fe::PetscFE, fq::PetscQuadrature, efq::PetscQuadrature ) + + @chk ccall( + (:PetscFEExpandFaceQuadrature, $petsc_library), + PetscErrorCode, + (PetscFE, PetscQuadrature, Ptr{PetscQuadrature}), + fe, fq, efq, + ) + + + return nothing +end + +""" + PetscFEGetFaceTabulation(petsclib::PetscLibType,fem::PetscFE, k::PetscInt, Tf::PetscTabulation) +Returns the tabulation of the basis functions at the face quadrature points for each face of the reference cell + +Not Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `k` - The highest derivative we need to tabulate, very often 1 + +Output Parameter: +- `Tf` - The basis function values and derivatives at face quadrature points + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscTabulation`, `PetscFEGetCellTabulation()`, `PetscFECreateTabulation()`, `PetscTabulationDestroy()` + +# External Links +$(_doc_external("DM/PetscFEGetFaceTabulation")) +""" +function PetscFEGetFaceTabulation(petsclib::PetscLibType, fem::PetscFE, k::PetscInt, Tf::PetscTabulation) end + +@for_petsc function PetscFEGetFaceTabulation(petsclib::$UnionPetscLib, fem::PetscFE, k::$PetscInt, Tf::PetscTabulation ) + + @chk ccall( + (:PetscFEGetFaceTabulation, $petsc_library), + PetscErrorCode, + (PetscFE, $PetscInt, Ptr{PetscTabulation}), + fem, k, Tf, + ) + + + return nothing +end + +""" + PetscFEGetFaceCentroidTabulation(petsclib::PetscLibType,fem::PetscFE, Tc::PetscTabulation) +Returns the tabulation of the basis functions at the face centroid points + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` object + +Output Parameter: +- `Tc` - The basis function values at face centroid points + +Level: intermediate + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscTabulation`, `PetscFEGetFaceTabulation()`, `PetscFEGetCellTabulation()`, `PetscFECreateTabulation()`, `PetscTabulationDestroy()` + +# External Links +$(_doc_external("DM/PetscFEGetFaceCentroidTabulation")) +""" +function PetscFEGetFaceCentroidTabulation(petsclib::PetscLibType, fem::PetscFE, Tc::PetscTabulation) end + +@for_petsc function PetscFEGetFaceCentroidTabulation(petsclib::$UnionPetscLib, fem::PetscFE, Tc::PetscTabulation ) + + @chk ccall( + (:PetscFEGetFaceCentroidTabulation, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscTabulation}), + fem, Tc, + ) + + + return nothing +end + +""" + T::PetscTabulation = PetscFECreateTabulation(petsclib::PetscLibType,fem::PetscFE, nrepl::PetscInt, npoints::PetscInt, points::Vector{PetscReal}, K::PetscInt) +Tabulates the basis functions, and perhaps derivatives, at the points provided. + +Not Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `nrepl` - The number of replicas +- `npoints` - The number of tabulation points in a replica +- `points` - The tabulation point coordinates +- `K` - The number of derivatives calculated + +Output Parameter: +- `T` - The basis function values and derivatives at tabulation points + +Level: intermediate + +-seealso: `PetscTabulation`, `PetscFEGetCellTabulation()`, `PetscTabulationDestroy()` + +# External Links +$(_doc_external("DM/PetscFECreateTabulation")) +""" +function PetscFECreateTabulation(petsclib::PetscLibType, fem::PetscFE, nrepl::PetscInt, npoints::PetscInt, points::Vector{PetscReal}, K::PetscInt) end + +@for_petsc function PetscFECreateTabulation(petsclib::$UnionPetscLib, fem::PetscFE, nrepl::$PetscInt, npoints::$PetscInt, points::Vector{$PetscReal}, K::$PetscInt ) + T_ = Ref{PetscTabulation}() + + @chk ccall( + (:PetscFECreateTabulation, $petsc_library), + PetscErrorCode, + (PetscFE, $PetscInt, $PetscInt, Ptr{$PetscReal}, $PetscInt, Ptr{PetscTabulation}), + fem, nrepl, npoints, points, K, T_, + ) + + T = T_[] + + return T +end + +""" + PetscFEComputeTabulation(petsclib::PetscLibType,fem::PetscFE, npoints::PetscInt, points::Vector{PetscReal}, K::PetscInt, T::PetscTabulation) +Tabulates the basis functions, and perhaps derivatives, at the points provided. + +Not Collective + +Input Parameters: +- `fem` - The `PetscFE` object +- `npoints` - The number of tabulation points +- `points` - The tabulation point coordinates +- `K` - The number of derivatives calculated +- `T` - An existing tabulation object with enough allocated space + +Output Parameter: +- `T` - The basis function values and derivatives at tabulation points + +Level: intermediate + +-seealso: `PetscTabulation`, `PetscFEGetCellTabulation()`, `PetscTabulationDestroy()` + +# External Links +$(_doc_external("DM/PetscFEComputeTabulation")) +""" +function PetscFEComputeTabulation(petsclib::PetscLibType, fem::PetscFE, npoints::PetscInt, points::Vector{PetscReal}, K::PetscInt, T::PetscTabulation) end + +@for_petsc function PetscFEComputeTabulation(petsclib::$UnionPetscLib, fem::PetscFE, npoints::$PetscInt, points::Vector{$PetscReal}, K::$PetscInt, T::PetscTabulation ) + + @chk ccall( + (:PetscFEComputeTabulation, $petsc_library), + PetscErrorCode, + (PetscFE, $PetscInt, Ptr{$PetscReal}, $PetscInt, PetscTabulation), + fem, npoints, points, K, T, + ) + + + return nothing +end + +""" + trFE::PetscFE = PetscFECreateHeightTrace(petsclib::PetscLibType,fe::PetscFE, height::PetscInt) + +# External Links +$(_doc_external("DM/PetscFECreateHeightTrace")) +""" +function PetscFECreateHeightTrace(petsclib::PetscLibType, fe::PetscFE, height::PetscInt) end + +@for_petsc function PetscFECreateHeightTrace(petsclib::$UnionPetscLib, fe::PetscFE, height::$PetscInt ) + trFE_ = Ref{PetscFE}() + + @chk ccall( + (:PetscFECreateHeightTrace, $petsc_library), + PetscErrorCode, + (PetscFE, $PetscInt, Ptr{PetscFE}), + fe, height, trFE_, + ) + + trFE = trFE_[] + + return trFE +end + +""" + dim::PetscInt = PetscFEGetDimension(petsclib::PetscLibType,fem::PetscFE) +Get the dimension of the finite element space on a cell + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` + +Output Parameter: +- `dim` - The dimension + +Level: intermediate + +-seealso: `PetscFE`, `PetscFECreate()`, `PetscSpaceGetDimension()`, `PetscDualSpaceGetDimension()` + +# External Links +$(_doc_external("DM/PetscFEGetDimension")) +""" +function PetscFEGetDimension(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFEGetDimension(petsclib::$UnionPetscLib, fem::PetscFE ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscFEGetDimension, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{$PetscInt}), + fem, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + PetscFEPushforward(petsclib::PetscLibType,fe::PetscFE, fegeom::PetscFEGeom, Nv::PetscInt, vals::Vector{PetscScalar}) +Map the reference element function to real space + +Input Parameters: +- `fe` - The `PetscFE` +- `fegeom` - The cell geometry +- `Nv` - The number of function values +- `vals` - The function values + +Output Parameter: +- `vals` - The transformed function values + +Level: advanced + +-seealso: `PetscFE`, `PetscFEGeom`, `PetscDualSpace`, `PetscDualSpacePushforward()` + +# External Links +$(_doc_external("DM/PetscFEPushforward")) +""" +function PetscFEPushforward(petsclib::PetscLibType, fe::PetscFE, fegeom::PetscFEGeom, Nv::PetscInt, vals::Vector{PetscScalar}) end + +@for_petsc function PetscFEPushforward(petsclib::$UnionPetscLib, fe::PetscFE, fegeom::PetscFEGeom, Nv::$PetscInt, vals::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscFEPushforward, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscFEGeom}, $PetscInt, Ptr{$PetscScalar}), + fe, fegeom, Nv, vals, + ) + + + return nothing +end + +""" + PetscFEPushforwardGradient(petsclib::PetscLibType,fe::PetscFE, fegeom::PetscFEGeom, Nv::PetscInt, vals::Vector{PetscScalar}) +Map the reference element function gradient to real space + +Input Parameters: +- `fe` - The `PetscFE` +- `fegeom` - The cell geometry +- `Nv` - The number of function gradient values +- `vals` - The function gradient values + +Output Parameter: +- `vals` - The transformed function gradient values + +Level: advanced + +-seealso: `PetscFE`, `PetscFEGeom`, `PetscDualSpace`, `PetscFEPushforward()`, `PetscDualSpacePushforwardGradient()`, `PetscDualSpacePushforward()` + +# External Links +$(_doc_external("DM/PetscFEPushforwardGradient")) +""" +function PetscFEPushforwardGradient(petsclib::PetscLibType, fe::PetscFE, fegeom::PetscFEGeom, Nv::PetscInt, vals::Vector{PetscScalar}) end + +@for_petsc function PetscFEPushforwardGradient(petsclib::$UnionPetscLib, fe::PetscFE, fegeom::PetscFEGeom, Nv::$PetscInt, vals::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscFEPushforwardGradient, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscFEGeom}, $PetscInt, Ptr{$PetscScalar}), + fe, fegeom, Nv, vals, + ) + + + return nothing +end + +""" + PetscFEPushforwardHessian(petsclib::PetscLibType,fe::PetscFE, fegeom::PetscFEGeom, Nv::PetscInt, vals::Vector{PetscScalar}) +Map the reference element function Hessian to real space + +Input Parameters: +- `fe` - The `PetscFE` +- `fegeom` - The cell geometry +- `Nv` - The number of function Hessian values +- `vals` - The function Hessian values + +Output Parameter: +- `vals` - The transformed function Hessian values + +Level: advanced + +-seealso: `PetscFE`, `PetscFEGeom`, `PetscDualSpace`, `PetscFEPushforward()`, `PetscDualSpacePushforwardHessian()`, `PetscDualSpacePushforward()` + +# External Links +$(_doc_external("DM/PetscFEPushforwardHessian")) +""" +function PetscFEPushforwardHessian(petsclib::PetscLibType, fe::PetscFE, fegeom::PetscFEGeom, Nv::PetscInt, vals::Vector{PetscScalar}) end + +@for_petsc function PetscFEPushforwardHessian(petsclib::$UnionPetscLib, fe::PetscFE, fegeom::PetscFEGeom, Nv::$PetscInt, vals::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscFEPushforwardHessian, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscFEGeom}, $PetscInt, Ptr{$PetscScalar}), + fe, fegeom, Nv, vals, + ) + + + return nothing +end + +""" + integral::Vector{PetscScalar} = PetscFEIntegrate(petsclib::PetscLibType,prob::PetscDS, field::PetscInt, Ne::PetscInt, cgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}) +Produce the integral for the given field for a chunk of elements by quadrature integration + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` specifying the discretizations and continuum functions +- `field` - The field being integrated +- `Ne` - The number of elements in the chunk +- `cgeom` - The cell geometry for each cell in the chunk +- `coefficients` - The array of FEM basis coefficients for the elements +- `probAux` - The `PetscDS` specifying the auxiliary discretizations +- `coefficientsAux` - The array of FEM auxiliary basis coefficients for the elements + +Output Parameter: +- `integral` - the integral for this field + +Level: intermediate + +-seealso: `PetscFE`, `PetscDS`, `PetscFEIntegrateResidual()`, `PetscFEIntegrateBd()` + +# External Links +$(_doc_external("DM/PetscFEIntegrate")) +""" +function PetscFEIntegrate(petsclib::PetscLibType, prob::PetscDS, field::PetscInt, Ne::PetscInt, cgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}) end + +@for_petsc function PetscFEIntegrate(petsclib::$UnionPetscLib, prob::PetscDS, field::$PetscInt, Ne::$PetscInt, cgeom::PetscFEGeom, coefficients::Vector{$PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{$PetscScalar} ) + integral = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscFEIntegrate, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, $PetscInt, Ptr{PetscFEGeom}, Ptr{$PetscScalar}, PetscDS, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + prob, field, Ne, cgeom, coefficients, probAux, coefficientsAux, integral, + ) + + + return integral +end + +#= +""" + PetscFEIntegrateBd(petsclib::PetscLibType,prob::PetscDS, field::PetscInt, ::Cvoid(obj_func) +Produce the integral for the given field for a chunk of elements by quadrature integration + +Not Collective + +Input Parameters: +- `prob` - The `PetscDS` specifying the discretizations and continuum functions +- `field` - The field being integrated +- `obj_func` - The function to be integrated +- `Ne` - The number of elements in the chunk +- `geom` - The face geometry for each face in the chunk +- `coefficients` - The array of FEM basis coefficients for the elements +- `probAux` - The `PetscDS` specifying the auxiliary discretizations +- `coefficientsAux` - The array of FEM auxiliary basis coefficients for the elements + +Output Parameter: +- `integral` - the integral for this field + +Level: intermediate + +-seealso: `PetscFE`, `PetscDS`, `PetscFEIntegrateResidual()`, `PetscFEIntegrate()` + +# External Links +$(_doc_external("DM/PetscFEIntegrateBd")) +""" +function PetscFEIntegrateBd(petsclib::PetscLibType, prob::PetscDS, field::PetscInt, ::Cvoid(obj_func) end + +@for_petsc function PetscFEIntegrateBd(petsclib::$UnionPetscLib, prob::PetscDS, field::$PetscInt, ::Cvoid(obj_func ) + + @chk ccall( + (:PetscFEIntegrateBd, $petsc_library), + PetscErrorCode, + (PetscDS, $PetscInt, Ptr{Cvoid(obj_func}), + prob, field, g0, + ) + + + return nothing +end +=# + +""" + elemVec::Vector{PetscScalar} = PetscFEIntegrateResidual(petsclib::PetscLibType,ds::PetscDS, key::PetscFormKey, Ne::PetscInt, cgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal) +Produce the element residual vector for a chunk of elements by quadrature integration + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` specifying the discretizations and continuum functions +- `key` - The (label+value, field) being integrated +- `Ne` - The number of elements in the chunk +- `cgeom` - The cell geometry for each cell in the chunk +- `coefficients` - The array of FEM basis coefficients for the elements +- `coefficients_t` - The array of FEM basis time derivative coefficients for the elements +- `probAux` - The `PetscDS` specifying the auxiliary discretizations +- `coefficientsAux` - The array of FEM auxiliary basis coefficients for the elements +- `t` - The time + +Output Parameter: +- `elemVec` - the element residual vectors from each element + +Level: intermediate + +-seealso: `PetscFEIntegrateBdResidual()` + +# External Links +$(_doc_external("DM/PetscFEIntegrateResidual")) +""" +function PetscFEIntegrateResidual(petsclib::PetscLibType, ds::PetscDS, key::PetscFormKey, Ne::PetscInt, cgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal) end + +@for_petsc function PetscFEIntegrateResidual(petsclib::$UnionPetscLib, ds::PetscDS, key::PetscFormKey, Ne::$PetscInt, cgeom::PetscFEGeom, coefficients::Vector{$PetscScalar}, coefficients_t::Vector{$PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{$PetscScalar}, t::$PetscReal ) + elemVec = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscFEIntegrateResidual, $petsc_library), + PetscErrorCode, + (PetscDS, PetscFormKey, $PetscInt, Ptr{PetscFEGeom}, Ptr{$PetscScalar}, Ptr{$PetscScalar}, PetscDS, Ptr{$PetscScalar}, $PetscReal, Ptr{$PetscScalar}), + ds, key, Ne, cgeom, coefficients, coefficients_t, probAux, coefficientsAux, t, elemVec, + ) + + + return elemVec +end + +""" + elemVec::Vector{PetscScalar} = PetscFEIntegrateBdResidual(petsclib::PetscLibType,ds::PetscDS, wf::PetscWeakForm, key::PetscFormKey, Ne::PetscInt, fgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal) +Produce the element residual vector for a chunk of elements by quadrature integration over a boundary + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` specifying the discretizations and continuum functions +- `wf` - The PetscWeakForm object holding the pointwise functions +- `key` - The (label+value, field) being integrated +- `Ne` - The number of elements in the chunk +- `fgeom` - The face geometry for each cell in the chunk +- `coefficients` - The array of FEM basis coefficients for the elements +- `coefficients_t` - The array of FEM basis time derivative coefficients for the elements +- `probAux` - The `PetscDS` specifying the auxiliary discretizations +- `coefficientsAux` - The array of FEM auxiliary basis coefficients for the elements +- `t` - The time + +Output Parameter: +- `elemVec` - the element residual vectors from each element + +Level: intermediate + +-seealso: `PetscFEIntegrateResidual()` + +# External Links +$(_doc_external("DM/PetscFEIntegrateBdResidual")) +""" +function PetscFEIntegrateBdResidual(petsclib::PetscLibType, ds::PetscDS, wf::PetscWeakForm, key::PetscFormKey, Ne::PetscInt, fgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal) end + +@for_petsc function PetscFEIntegrateBdResidual(petsclib::$UnionPetscLib, ds::PetscDS, wf::PetscWeakForm, key::PetscFormKey, Ne::$PetscInt, fgeom::PetscFEGeom, coefficients::Vector{$PetscScalar}, coefficients_t::Vector{$PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{$PetscScalar}, t::$PetscReal ) + elemVec = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscFEIntegrateBdResidual, $petsc_library), + PetscErrorCode, + (PetscDS, PetscWeakForm, PetscFormKey, $PetscInt, Ptr{PetscFEGeom}, Ptr{$PetscScalar}, Ptr{$PetscScalar}, PetscDS, Ptr{$PetscScalar}, $PetscReal, Ptr{$PetscScalar}), + ds, wf, key, Ne, fgeom, coefficients, coefficients_t, probAux, coefficientsAux, t, elemVec, + ) + + + return elemVec +end + +""" + elemVec::Vector{PetscScalar} = PetscFEIntegrateHybridResidual(petsclib::PetscLibType,ds::PetscDS, dsIn::PetscDS, key::PetscFormKey, s::PetscInt, Ne::PetscInt, fgeom::PetscFEGeom, cgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal) +Produce the element residual vector for a chunk of hybrid element faces by quadrature integration + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` specifying the discretizations and continuum functions +- `dsIn` - The `PetscDS` specifying the discretizations and continuum functions for input +- `key` - The (label+value, field) being integrated +- `s` - The side of the cell being integrated, 0 for negative and 1 for positive +- `Ne` - The number of elements in the chunk +- `fgeom` - The face geometry for each cell in the chunk +- `cgeom` - The cell geometry for each neighbor cell in the chunk +- `coefficients` - The array of FEM basis coefficients for the elements +- `coefficients_t` - The array of FEM basis time derivative coefficients for the elements +- `probAux` - The `PetscDS` specifying the auxiliary discretizations +- `coefficientsAux` - The array of FEM auxiliary basis coefficients for the elements +- `t` - The time + +Output Parameter: +- `elemVec` - the element residual vectors from each element + +Level: developer + +-seealso: `PetscFEIntegrateResidual()` + +# External Links +$(_doc_external("DM/PetscFEIntegrateHybridResidual")) +""" +function PetscFEIntegrateHybridResidual(petsclib::PetscLibType, ds::PetscDS, dsIn::PetscDS, key::PetscFormKey, s::PetscInt, Ne::PetscInt, fgeom::PetscFEGeom, cgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal) end + +@for_petsc function PetscFEIntegrateHybridResidual(petsclib::$UnionPetscLib, ds::PetscDS, dsIn::PetscDS, key::PetscFormKey, s::$PetscInt, Ne::$PetscInt, fgeom::PetscFEGeom, cgeom::PetscFEGeom, coefficients::Vector{$PetscScalar}, coefficients_t::Vector{$PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{$PetscScalar}, t::$PetscReal ) + elemVec = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscFEIntegrateHybridResidual, $petsc_library), + PetscErrorCode, + (PetscDS, PetscDS, PetscFormKey, $PetscInt, $PetscInt, Ptr{PetscFEGeom}, Ptr{PetscFEGeom}, Ptr{$PetscScalar}, Ptr{$PetscScalar}, PetscDS, Ptr{$PetscScalar}, $PetscReal, Ptr{$PetscScalar}), + ds, dsIn, key, s, Ne, fgeom, cgeom, coefficients, coefficients_t, probAux, coefficientsAux, t, elemVec, + ) + + + return elemVec +end + +""" + elemMat::Vector{PetscScalar} = PetscFEIntegrateJacobian(petsclib::PetscLibType,rds::PetscDS, cds::PetscDS, jtype::PetscFEJacobianType, key::PetscFormKey, Ne::PetscInt, cgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, dsAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal, u_tshift::PetscReal) +Produce the element Jacobian for a chunk of elements by quadrature integration + +Not Collective + +Input Parameters: +- `rds` - The `PetscDS` specifying the row discretizations and continuum functions +- `cds` - The `PetscDS` specifying the column discretizations +- `jtype` - The type of matrix pointwise functions that should be used +- `key` - The (label+value, fieldI*Nf + fieldJ) being integrated +- `Ne` - The number of elements in the chunk +- `cgeom` - The cell geometry for each cell in the chunk +- `coefficients` - The array of FEM basis coefficients for the elements for the Jacobian evaluation point +- `coefficients_t` - The array of FEM basis time derivative coefficients for the elements +- `dsAux` - The `PetscDS` specifying the auxiliary discretizations +- `coefficientsAux` - The array of FEM auxiliary basis coefficients for the elements +- `t` - The time +- `u_tshift` - A multiplier for the dF/du_t term (as opposed to the dF/du term) + +Output Parameter: +- `elemMat` - the element matrices for the Jacobian from each element + +Level: intermediate + +-seealso: `PetscFEIntegrateResidual()` + +# External Links +$(_doc_external("DM/PetscFEIntegrateJacobian")) +""" +function PetscFEIntegrateJacobian(petsclib::PetscLibType, rds::PetscDS, cds::PetscDS, jtype::PetscFEJacobianType, key::PetscFormKey, Ne::PetscInt, cgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, dsAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal, u_tshift::PetscReal) end + +@for_petsc function PetscFEIntegrateJacobian(petsclib::$UnionPetscLib, rds::PetscDS, cds::PetscDS, jtype::PetscFEJacobianType, key::PetscFormKey, Ne::$PetscInt, cgeom::PetscFEGeom, coefficients::Vector{$PetscScalar}, coefficients_t::Vector{$PetscScalar}, dsAux::PetscDS, coefficientsAux::Vector{$PetscScalar}, t::$PetscReal, u_tshift::$PetscReal ) + elemMat = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscFEIntegrateJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, PetscDS, PetscFEJacobianType, PetscFormKey, $PetscInt, Ptr{PetscFEGeom}, Ptr{$PetscScalar}, Ptr{$PetscScalar}, PetscDS, Ptr{$PetscScalar}, $PetscReal, $PetscReal, Ptr{$PetscScalar}), + rds, cds, jtype, key, Ne, cgeom, coefficients, coefficients_t, dsAux, coefficientsAux, t, u_tshift, elemMat, + ) + + + return elemMat +end + +""" + elemMat::Vector{PetscScalar} = PetscFEIntegrateBdJacobian(petsclib::PetscLibType,ds::PetscDS, wf::PetscWeakForm, jtype::PetscFEJacobianType, key::PetscFormKey, Ne::PetscInt, fgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal, u_tshift::PetscReal) +Produce the boundary element Jacobian for a chunk of elements by quadrature integration + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` specifying the discretizations and continuum functions +- `wf` - The PetscWeakForm holding the pointwise functions +- `jtype` - The type of matrix pointwise functions that should be used +- `key` - The (label+value, fieldI*Nf + fieldJ) being integrated +- `Ne` - The number of elements in the chunk +- `fgeom` - The face geometry for each cell in the chunk +- `coefficients` - The array of FEM basis coefficients for the elements for the Jacobian evaluation point +- `coefficients_t` - The array of FEM basis time derivative coefficients for the elements +- `probAux` - The `PetscDS` specifying the auxiliary discretizations +- `coefficientsAux` - The array of FEM auxiliary basis coefficients for the elements +- `t` - The time +- `u_tshift` - A multiplier for the dF/du_t term (as opposed to the dF/du term) + +Output Parameter: +- `elemMat` - the element matrices for the Jacobian from each element + +Level: intermediate + +-seealso: `PetscFEIntegrateJacobian()`, `PetscFEIntegrateResidual()` + +# External Links +$(_doc_external("DM/PetscFEIntegrateBdJacobian")) +""" +function PetscFEIntegrateBdJacobian(petsclib::PetscLibType, ds::PetscDS, wf::PetscWeakForm, jtype::PetscFEJacobianType, key::PetscFormKey, Ne::PetscInt, fgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal, u_tshift::PetscReal) end + +@for_petsc function PetscFEIntegrateBdJacobian(petsclib::$UnionPetscLib, ds::PetscDS, wf::PetscWeakForm, jtype::PetscFEJacobianType, key::PetscFormKey, Ne::$PetscInt, fgeom::PetscFEGeom, coefficients::Vector{$PetscScalar}, coefficients_t::Vector{$PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{$PetscScalar}, t::$PetscReal, u_tshift::$PetscReal ) + elemMat = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscFEIntegrateBdJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, PetscWeakForm, PetscFEJacobianType, PetscFormKey, $PetscInt, Ptr{PetscFEGeom}, Ptr{$PetscScalar}, Ptr{$PetscScalar}, PetscDS, Ptr{$PetscScalar}, $PetscReal, $PetscReal, Ptr{$PetscScalar}), + ds, wf, jtype, key, Ne, fgeom, coefficients, coefficients_t, probAux, coefficientsAux, t, u_tshift, elemMat, + ) + + + return elemMat +end + +""" + elemMat::Vector{PetscScalar} = PetscFEIntegrateHybridJacobian(petsclib::PetscLibType,ds::PetscDS, dsIn::PetscDS, jtype::PetscFEJacobianType, key::PetscFormKey, s::PetscInt, Ne::PetscInt, fgeom::PetscFEGeom, cgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal, u_tshift::PetscReal) +Produce the boundary element Jacobian for a chunk of hybrid elements by quadrature integration + +Not Collective + +Input Parameters: +- `ds` - The `PetscDS` specifying the discretizations and continuum functions for the output +- `dsIn` - The `PetscDS` specifying the discretizations and continuum functions for the input +- `jtype` - The type of matrix pointwise functions that should be used +- `key` - The (label+value, fieldI*Nf + fieldJ) being integrated +- `s` - The side of the cell being integrated, 0 for negative and 1 for positive +- `Ne` - The number of elements in the chunk +- `fgeom` - The face geometry for each cell in the chunk +- `cgeom` - The cell geometry for each neighbor cell in the chunk +- `coefficients` - The array of FEM basis coefficients for the elements for the Jacobian evaluation point +- `coefficients_t` - The array of FEM basis time derivative coefficients for the elements +- `probAux` - The `PetscDS` specifying the auxiliary discretizations +- `coefficientsAux` - The array of FEM auxiliary basis coefficients for the elements +- `t` - The time +- `u_tshift` - A multiplier for the dF/du_t term (as opposed to the dF/du term) + +Output Parameter: +- `elemMat` - the element matrices for the Jacobian from each element + +Level: developer + +-seealso: `PetscFEIntegrateJacobian()`, `PetscFEIntegrateResidual()` + +# External Links +$(_doc_external("DM/PetscFEIntegrateHybridJacobian")) +""" +function PetscFEIntegrateHybridJacobian(petsclib::PetscLibType, ds::PetscDS, dsIn::PetscDS, jtype::PetscFEJacobianType, key::PetscFormKey, s::PetscInt, Ne::PetscInt, fgeom::PetscFEGeom, cgeom::PetscFEGeom, coefficients::Vector{PetscScalar}, coefficients_t::Vector{PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{PetscScalar}, t::PetscReal, u_tshift::PetscReal) end + +@for_petsc function PetscFEIntegrateHybridJacobian(petsclib::$UnionPetscLib, ds::PetscDS, dsIn::PetscDS, jtype::PetscFEJacobianType, key::PetscFormKey, s::$PetscInt, Ne::$PetscInt, fgeom::PetscFEGeom, cgeom::PetscFEGeom, coefficients::Vector{$PetscScalar}, coefficients_t::Vector{$PetscScalar}, probAux::PetscDS, coefficientsAux::Vector{$PetscScalar}, t::$PetscReal, u_tshift::$PetscReal ) + elemMat = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscFEIntegrateHybridJacobian, $petsc_library), + PetscErrorCode, + (PetscDS, PetscDS, PetscFEJacobianType, PetscFormKey, $PetscInt, $PetscInt, Ptr{PetscFEGeom}, Ptr{PetscFEGeom}, Ptr{$PetscScalar}, Ptr{$PetscScalar}, PetscDS, Ptr{$PetscScalar}, $PetscReal, $PetscReal, Ptr{$PetscScalar}), + ds, dsIn, jtype, key, s, Ne, fgeom, cgeom, coefficients, coefficients_t, probAux, coefficientsAux, t, u_tshift, elemMat, + ) + + + return elemMat +end + +""" + PetscFEGetHeightSubspace(petsclib::PetscLibType,fe::PetscFE, height::PetscInt, subfe::PetscFE) +Get the subspace of this space for a mesh point of a given height + +Input Parameters: +- `fe` - The finite element space +- `height` - The height of the `DMPLEX` point + +Output Parameter: +- `subfe` - The subspace of this `PetscFE` space + +Level: advanced + +-seealso: `PetscFECreateDefault()` + +# External Links +$(_doc_external("DM/PetscFEGetHeightSubspace")) +""" +function PetscFEGetHeightSubspace(petsclib::PetscLibType, fe::PetscFE, height::PetscInt, subfe::PetscFE) end + +@for_petsc function PetscFEGetHeightSubspace(petsclib::$UnionPetscLib, fe::PetscFE, height::$PetscInt, subfe::PetscFE ) + + @chk ccall( + (:PetscFEGetHeightSubspace, $petsc_library), + PetscErrorCode, + (PetscFE, $PetscInt, Ptr{PetscFE}), + fe, height, subfe, + ) + + + return nothing +end + +""" + PetscFERefine(petsclib::PetscLibType,fe::PetscFE, feRef::PetscFE) +Create a "refined" `PetscFE` object that refines the reference cell into +smaller copies. + +Collective + +Input Parameter: +- `fe` - The initial `PetscFE` + +Output Parameter: +- `feRef` - The refined `PetscFE` + +Level: advanced + +-seealso: `PetscFEType`, `PetscFECreate()`, `PetscFESetType()` + +# External Links +$(_doc_external("DM/PetscFERefine")) +""" +function PetscFERefine(petsclib::PetscLibType, fe::PetscFE, feRef::PetscFE) end + +@for_petsc function PetscFERefine(petsclib::$UnionPetscLib, fe::PetscFE, feRef::PetscFE ) + + @chk ccall( + (:PetscFERefine, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscFE}), + fe, feRef, + ) + + + return nothing +end + +""" + fem::PetscFE = PetscFECreateFromSpaces(petsclib::PetscLibType,P::PetscSpace, Q::PetscDualSpace, q::PetscQuadrature, fq::PetscQuadrature) +Create a `PetscFE` from the basis and dual spaces + +Collective + +Input Parameters: +- `P` - The basis space +- `Q` - The dual space +- `q` - The cell quadrature +- `fq` - The face quadrature + +Output Parameter: +- `fem` - The `PetscFE` object + +Level: beginner + +-seealso: `PetscFE`, `PetscSpace`, `PetscDualSpace`, `PetscQuadrature`, +`PetscFECreateLagrangeByCell()`, `PetscFECreateDefault()`, `PetscFECreateByCell()`, `PetscFECreate()`, `PetscSpaceCreate()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscFECreateFromSpaces")) +""" +function PetscFECreateFromSpaces(petsclib::PetscLibType, P::PetscSpace, Q::PetscDualSpace, q::PetscQuadrature, fq::PetscQuadrature) end + +@for_petsc function PetscFECreateFromSpaces(petsclib::$UnionPetscLib, P::PetscSpace, Q::PetscDualSpace, q::PetscQuadrature, fq::PetscQuadrature ) + fem_ = Ref{PetscFE}() + + @chk ccall( + (:PetscFECreateFromSpaces, $petsc_library), + PetscErrorCode, + (PetscSpace, PetscDualSpace, PetscQuadrature, PetscQuadrature, Ptr{PetscFE}), + P, Q, q, fq, fem_, + ) + + fem = fem_[] + + return fem +end + +""" + fem::PetscFE = PetscFECreateDefault(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, Nc::PetscInt, isSimplex::PetscBool, prefix::String, qorder::PetscInt) +Create a `PetscFE` for basic FEM computation + +Collective + +Input Parameters: +- `comm` - The MPI comm +- `dim` - The spatial dimension +- `Nc` - The number of components +- `isSimplex` - Flag for simplex reference cell, otherwise its a tensor product +- `prefix` - The options prefix, or `NULL` +- `qorder` - The quadrature order or `PETSC_DETERMINE` to use `PetscSpace` polynomial degree + +Output Parameter: +- `fem` - The `PetscFE` object + +Level: beginner + +-seealso: `PetscFECreateLagrange()`, `PetscFECreateByCell()`, `PetscSpaceSetFromOptions()`, `PetscDualSpaceSetFromOptions()`, `PetscFESetFromOptions()`, `PetscFECreate()`, `PetscSpaceCreate()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscFECreateDefault")) +""" +function PetscFECreateDefault(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, Nc::PetscInt, isSimplex::PetscBool, prefix::String, qorder::PetscInt) end + +@for_petsc function PetscFECreateDefault(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, Nc::$PetscInt, isSimplex::PetscBool, prefix::String, qorder::$PetscInt ) + fem_ = Ref{PetscFE}() + + @chk ccall( + (:PetscFECreateDefault, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, PetscBool, Ptr{Cchar}, $PetscInt, Ptr{PetscFE}), + comm, dim, Nc, isSimplex, prefix, qorder, fem_, + ) + + fem = fem_[] + + return fem +end + +""" + fem::PetscFE = PetscFECreateByCell(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, Nc::PetscInt, ct::DMPolytopeType, prefix::String, qorder::PetscInt) +Create a `PetscFE` for basic FEM computation + +Collective + +Input Parameters: +- `comm` - The MPI comm +- `dim` - The spatial dimension +- `Nc` - The number of components +- `ct` - The celltype of the reference cell +- `prefix` - The options prefix, or `NULL` +- `qorder` - The quadrature order or `PETSC_DETERMINE` to use `PetscSpace` polynomial degree + +Output Parameter: +- `fem` - The `PetscFE` object + +Level: beginner + +-seealso: `PetscFECreateDefault()`, `PetscFECreateLagrange()`, `PetscSpaceSetFromOptions()`, `PetscDualSpaceSetFromOptions()`, `PetscFESetFromOptions()`, `PetscFECreate()`, `PetscSpaceCreate()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscFECreateByCell")) +""" +function PetscFECreateByCell(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, Nc::PetscInt, ct::DMPolytopeType, prefix::String, qorder::PetscInt) end + +@for_petsc function PetscFECreateByCell(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, Nc::$PetscInt, ct::DMPolytopeType, prefix::String, qorder::$PetscInt ) + fem_ = Ref{PetscFE}() + + @chk ccall( + (:PetscFECreateByCell, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, DMPolytopeType, Ptr{Cchar}, $PetscInt, Ptr{PetscFE}), + comm, dim, Nc, ct, prefix, qorder, fem_, + ) + + fem = fem_[] + + return fem +end + +""" + fem::PetscFE = PetscFECreateLagrange(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, Nc::PetscInt, isSimplex::PetscBool, k::PetscInt, qorder::PetscInt) +Create a `PetscFE` for the basic Lagrange space of degree k + +Collective + +Input Parameters: +- `comm` - The MPI comm +- `dim` - The spatial dimension +- `Nc` - The number of components +- `isSimplex` - Flag for simplex reference cell, otherwise its a tensor product +- `k` - The degree k of the space +- `qorder` - The quadrature order or `PETSC_DETERMINE` to use `PetscSpace` polynomial degree + +Output Parameter: +- `fem` - The `PetscFE` object + +Level: beginner + +-seealso: `PetscFECreateLagrangeByCell()`, `PetscFECreateDefault()`, `PetscFECreateByCell()`, `PetscFECreate()`, `PetscSpaceCreate()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscFECreateLagrange")) +""" +function PetscFECreateLagrange(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, Nc::PetscInt, isSimplex::PetscBool, k::PetscInt, qorder::PetscInt) end + +@for_petsc function PetscFECreateLagrange(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, Nc::$PetscInt, isSimplex::PetscBool, k::$PetscInt, qorder::$PetscInt ) + fem_ = Ref{PetscFE}() + + @chk ccall( + (:PetscFECreateLagrange, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, PetscBool, $PetscInt, $PetscInt, Ptr{PetscFE}), + comm, dim, Nc, isSimplex, k, qorder, fem_, + ) + + fem = fem_[] + + return fem +end + +""" + fem::PetscFE = PetscFECreateLagrangeByCell(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, Nc::PetscInt, ct::DMPolytopeType, k::PetscInt, qorder::PetscInt) +Create a `PetscFE` for the basic Lagrange space of degree k + +Collective + +Input Parameters: +- `comm` - The MPI comm +- `dim` - The spatial dimension +- `Nc` - The number of components +- `ct` - The celltype of the reference cell +- `k` - The degree k of the space +- `qorder` - The quadrature order or `PETSC_DETERMINE` to use `PetscSpace` polynomial degree + +Output Parameter: +- `fem` - The `PetscFE` object + +Level: beginner + +-seealso: `PetscFECreateLagrange()`, `PetscFECreateDefault()`, `PetscFECreateByCell()`, `PetscFECreate()`, `PetscSpaceCreate()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscFECreateLagrangeByCell")) +""" +function PetscFECreateLagrangeByCell(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, Nc::PetscInt, ct::DMPolytopeType, k::PetscInt, qorder::PetscInt) end + +@for_petsc function PetscFECreateLagrangeByCell(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, Nc::$PetscInt, ct::DMPolytopeType, k::$PetscInt, qorder::$PetscInt ) + fem_ = Ref{PetscFE}() + + @chk ccall( + (:PetscFECreateLagrangeByCell, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, DMPolytopeType, $PetscInt, $PetscInt, Ptr{PetscFE}), + comm, dim, Nc, ct, k, qorder, fem_, + ) + + fem = fem_[] + + return fem +end + +""" + PetscFELimitDegree(petsclib::PetscLibType,fe::PetscFE, minDegree::PetscInt, maxDegree::PetscInt, newfe::PetscFE) +Copy a `PetscFE` but limit the degree to be in the given range + +Collective + +Input Parameters: +- `fe` - The `PetscFE` +- `minDegree` - The minimum degree, or `PETSC_DETERMINE` for no limit +- `maxDegree` - The maximum degree, or `PETSC_DETERMINE` for no limit + +Output Parameter: +- `newfe` - The `PetscFE` object + +Level: advanced + +-seealso: `PetscFECreateLagrange()`, `PetscFECreateDefault()`, `PetscFECreateByCell()`, `PetscFECreate()`, `PetscSpaceCreate()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscFELimitDegree")) +""" +function PetscFELimitDegree(petsclib::PetscLibType, fe::PetscFE, minDegree::PetscInt, maxDegree::PetscInt, newfe::PetscFE) end + +@for_petsc function PetscFELimitDegree(petsclib::$UnionPetscLib, fe::PetscFE, minDegree::$PetscInt, maxDegree::$PetscInt, newfe::PetscFE ) + + @chk ccall( + (:PetscFELimitDegree, $petsc_library), + PetscErrorCode, + (PetscFE, $PetscInt, $PetscInt, Ptr{PetscFE}), + fe, minDegree, maxDegree, newfe, + ) + + + return nothing +end + +""" + dgfe::PetscFE = PetscFECreateBrokenElement(petsclib::PetscLibType,cgfe::PetscFE) +Create a discontinuous version of the input `PetscFE` + +Collective + +Input Parameters: +- `cgfe` - The continuous `PetscFE` object + +Output Parameter: +- `dgfe` - The discontinuous `PetscFE` object + +Level: advanced + +-seealso: `PetscFECreate()`, `PetscSpaceCreate()`, `PetscDualSpaceCreate()`, `PetscFECreateLagrange()`, `PetscFECreateLagrangeByCell()`, `PetscDualSpaceLagrangeSetContinuity()` + +# External Links +$(_doc_external("DM/PetscFECreateBrokenElement")) +""" +function PetscFECreateBrokenElement(petsclib::PetscLibType, cgfe::PetscFE) end + +@for_petsc function PetscFECreateBrokenElement(petsclib::$UnionPetscLib, cgfe::PetscFE ) + dgfe_ = Ref{PetscFE}() + + @chk ccall( + (:PetscFECreateBrokenElement, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscFE}), + cgfe, dgfe_, + ) + + dgfe = dgfe_[] + + return dgfe +end + +""" + PetscFESetName(petsclib::PetscLibType,fe::PetscFE, name::String) +Names the `PetscFE` and its subobjects + +Not Collective + +Input Parameters: +- `fe` - The `PetscFE` +- `name` - The name + +Level: intermediate + +-seealso: `PetscFECreate()`, `PetscSpaceCreate()`, `PetscDualSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscFESetName")) +""" +function PetscFESetName(petsclib::PetscLibType, fe::PetscFE, name::String) end + +@for_petsc function PetscFESetName(petsclib::$UnionPetscLib, fe::PetscFE, name::String ) + + @chk ccall( + (:PetscFESetName, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{Cchar}), + fe, name, + ) + + + return nothing +end + +""" + cgeom::PetscFEGeom = PetscFECreateCellGeometry(petsclib::PetscLibType,fe::PetscFE, quad::PetscQuadrature) + +# External Links +$(_doc_external("DM/PetscFECreateCellGeometry")) +""" +function PetscFECreateCellGeometry(petsclib::PetscLibType, fe::PetscFE, quad::PetscQuadrature) end + +@for_petsc function PetscFECreateCellGeometry(petsclib::$UnionPetscLib, fe::PetscFE, quad::PetscQuadrature ) + cgeom_ = Ref{PetscFEGeom}() + + @chk ccall( + (:PetscFECreateCellGeometry, $petsc_library), + PetscErrorCode, + (PetscFE, PetscQuadrature, Ptr{PetscFEGeom}), + fe, quad, cgeom_, + ) + + cgeom = cgeom_[] + + return cgeom +end + +""" + PetscFEDestroyCellGeometry(petsclib::PetscLibType,fe::PetscFE, cgeom::PetscFEGeom) + +# External Links +$(_doc_external("DM/PetscFEDestroyCellGeometry")) +""" +function PetscFEDestroyCellGeometry(petsclib::PetscLibType, fe::PetscFE, cgeom::PetscFEGeom) end + +@for_petsc function PetscFEDestroyCellGeometry(petsclib::$UnionPetscLib, fe::PetscFE, cgeom::PetscFEGeom ) + + @chk ccall( + (:PetscFEDestroyCellGeometry, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscFEGeom}), + fe, cgeom, + ) + + + return nothing +end + +""" + geom::PetscFEGeom = PetscFEGeomCreate(petsclib::PetscLibType,quad::PetscQuadrature, numCells::PetscInt, dimEmbed::PetscInt, mode::PetscFEGeomMode) +Create a `PetscFEGeom` object to manage geometry for a group of cells + +Input Parameters: +- `quad` - A `PetscQuadrature` determining the tabulation +- `numCells` - The number of cells in the group +- `dimEmbed` - The coordinate dimension +- `mode` - Type of geometry data to store + +Output Parameter: +- `geom` - The `PetscFEGeom` object, which is a struct not a `PetscObject` + +Level: beginner + +-seealso: `PetscFEGeom`, `PetscQuadrature`, `PetscFEGeomDestroy()`, `PetscFEGeomComplete()` + +# External Links +$(_doc_external("DM/PetscFEGeomCreate")) +""" +function PetscFEGeomCreate(petsclib::PetscLibType, quad::PetscQuadrature, numCells::PetscInt, dimEmbed::PetscInt, mode::PetscFEGeomMode) end + +@for_petsc function PetscFEGeomCreate(petsclib::$UnionPetscLib, quad::PetscQuadrature, numCells::$PetscInt, dimEmbed::$PetscInt, mode::PetscFEGeomMode ) + geom_ = Ref{PetscFEGeom}() + + @chk ccall( + (:PetscFEGeomCreate, $petsc_library), + PetscErrorCode, + (PetscQuadrature, $PetscInt, $PetscInt, PetscFEGeomMode, PetscFEGeom), + quad, numCells, dimEmbed, mode, geom_, + ) + + geom = geom_[] + + return geom +end + +""" + PetscFEGeomDestroy(petsclib::PetscLibType,geom::PetscFEGeom) +Destroy a `PetscFEGeom` object + +Input Parameter: +- `geom` - `PetscFEGeom` object + +Level: beginner + +-seealso: `PetscFEGeom`, `PetscFEGeomCreate()` + +# External Links +$(_doc_external("DM/PetscFEGeomDestroy")) +""" +function PetscFEGeomDestroy(petsclib::PetscLibType, geom::PetscFEGeom) end + +@for_petsc function PetscFEGeomDestroy(petsclib::$UnionPetscLib, geom::PetscFEGeom ) + + @chk ccall( + (:PetscFEGeomDestroy, $petsc_library), + PetscErrorCode, + (PetscFEGeom,), + geom, + ) + + + return nothing +end + +""" + PetscFEGeomGetChunk(petsclib::PetscLibType,geom::PetscFEGeom, cStart::PetscInt, cEnd::PetscInt, chunkGeom::Vector{PetscFEGeom}) +Get a chunk of cells in the group as a `PetscFEGeom` + +Input Parameters: +- `geom` - `PetscFEGeom` object +- `cStart` - The first cell in the chunk +- `cEnd` - The first cell not in the chunk + +Output Parameter: +- `chunkGeom` - an array of cells of length `cEnd` - `cStart` + +Level: intermediate + +-seealso: `PetscFEGeom`, `PetscFEGeomRestoreChunk()`, `PetscFEGeomCreate()` + +# External Links +$(_doc_external("DM/PetscFEGeomGetChunk")) +""" +function PetscFEGeomGetChunk(petsclib::PetscLibType, geom::PetscFEGeom, cStart::PetscInt, cEnd::PetscInt, chunkGeom::Vector{PetscFEGeom}) end + +@for_petsc function PetscFEGeomGetChunk(petsclib::$UnionPetscLib, geom::PetscFEGeom, cStart::$PetscInt, cEnd::$PetscInt, chunkGeom::Vector{PetscFEGeom} ) + chunkGeom_ = Ref(pointer(chunkGeom)) + + @chk ccall( + (:PetscFEGeomGetChunk, $petsc_library), + PetscErrorCode, + (Ptr{PetscFEGeom}, $PetscInt, $PetscInt, Ptr{Ptr{PetscFEGeom}}), + geom, cStart, cEnd, chunkGeom_, + ) + + + return nothing +end + +""" + PetscFEGeomRestoreChunk(petsclib::PetscLibType,geom::PetscFEGeom, cStart::PetscInt, cEnd::PetscInt, chunkGeom::PetscFEGeom) +Restore the chunk obtained with `PetscFEGeomCreateChunk()` + +Input Parameters: +- `geom` - `PetscFEGeom` object +- `cStart` - The first cell in the chunk +- `cEnd` - The first cell not in the chunk +- `chunkGeom` - The chunk of cells + +Level: intermediate + +-seealso: `PetscFEGeom`, `PetscFEGeomGetChunk()`, `PetscFEGeomCreate()` + +# External Links +$(_doc_external("DM/PetscFEGeomRestoreChunk")) +""" +function PetscFEGeomRestoreChunk(petsclib::PetscLibType, geom::PetscFEGeom, cStart::PetscInt, cEnd::PetscInt, chunkGeom::PetscFEGeom) end + +@for_petsc function PetscFEGeomRestoreChunk(petsclib::$UnionPetscLib, geom::PetscFEGeom, cStart::$PetscInt, cEnd::$PetscInt, chunkGeom::PetscFEGeom ) + + @chk ccall( + (:PetscFEGeomRestoreChunk, $petsc_library), + PetscErrorCode, + (Ptr{PetscFEGeom}, $PetscInt, $PetscInt, PetscFEGeom), + geom, cStart, cEnd, chunkGeom, + ) + + + return nothing +end + +""" + PetscFEGeomGetPoint(petsclib::PetscLibType,geom::PetscFEGeom, c::PetscInt, p::PetscInt, pcoords::Vector{PetscReal}, pgeom::PetscFEGeom) +Get the geometry for cell `c` at point `p` as a `PetscFEGeom` + +Input Parameters: +- `geom` - `PetscFEGeom` object +- `c` - The cell +- `p` - The point +- `pcoords` - The reference coordinates of point `p`, or `NULL` + +Output Parameter: +- `pgeom` - The geometry of cell `c` at point `p` + +Level: intermediate + +-seealso: `PetscFEGeom`, `PetscFEGeomRestoreChunk()`, `PetscFEGeomCreate()` + +# External Links +$(_doc_external("DM/PetscFEGeomGetPoint")) +""" +function PetscFEGeomGetPoint(petsclib::PetscLibType, geom::PetscFEGeom, c::PetscInt, p::PetscInt, pcoords::Vector{PetscReal}, pgeom::PetscFEGeom) end + +@for_petsc function PetscFEGeomGetPoint(petsclib::$UnionPetscLib, geom::PetscFEGeom, c::$PetscInt, p::$PetscInt, pcoords::Vector{$PetscReal}, pgeom::PetscFEGeom ) + + @chk ccall( + (:PetscFEGeomGetPoint, $petsc_library), + PetscErrorCode, + (Ptr{PetscFEGeom}, $PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{PetscFEGeom}), + geom, c, p, pcoords, pgeom, + ) + + + return nothing +end + +""" + PetscFEGeomGetCellPoint(petsclib::PetscLibType,geom::PetscFEGeom, c::PetscInt, p::PetscInt, pgeom::PetscFEGeom) +Get the cell geometry for cell `c` at point `p` as a `PetscFEGeom` + +Input Parameters: +- `geom` - `PetscFEGeom` object +- `c` - The cell +- `p` - The point + +Output Parameter: +- `pgeom` - The cell geometry of cell `c` at point `p` + +Level: intermediate + +-seealso: `PetscFEGeom`, `PetscFEGeomMode`, `PetscFEGeomRestoreChunk()`, `PetscFEGeomCreate()` + +# External Links +$(_doc_external("DM/PetscFEGeomGetCellPoint")) +""" +function PetscFEGeomGetCellPoint(petsclib::PetscLibType, geom::PetscFEGeom, c::PetscInt, p::PetscInt, pgeom::PetscFEGeom) end + +@for_petsc function PetscFEGeomGetCellPoint(petsclib::$UnionPetscLib, geom::PetscFEGeom, c::$PetscInt, p::$PetscInt, pgeom::PetscFEGeom ) + + @chk ccall( + (:PetscFEGeomGetCellPoint, $petsc_library), + PetscErrorCode, + (Ptr{PetscFEGeom}, $PetscInt, $PetscInt, Ptr{PetscFEGeom}), + geom, c, p, pgeom, + ) + + + return nothing +end + +""" + PetscFEGeomComplete(petsclib::PetscLibType,geom::PetscFEGeom) +Calculate derived quantities from a base geometry specification + +Input Parameter: +- `geom` - `PetscFEGeom` object + +Level: intermediate + +-seealso: `PetscFEGeom`, `PetscFEGeomCreate()` + +# External Links +$(_doc_external("DM/PetscFEGeomComplete")) +""" +function PetscFEGeomComplete(petsclib::PetscLibType, geom::PetscFEGeom) end + +@for_petsc function PetscFEGeomComplete(petsclib::$UnionPetscLib, geom::PetscFEGeom ) + + @chk ccall( + (:PetscFEGeomComplete, $petsc_library), + PetscErrorCode, + (Ptr{PetscFEGeom},), + geom, + ) + + + return nothing +end + +""" + numSubelements::PetscInt,v0::Vector{PetscReal},jac::Vector{PetscReal},invjac::Vector{PetscReal} = PetscFECompositeGetMapping(petsclib::PetscLibType,fem::PetscFE) +Returns the mappings from the reference element to each subelement + +Not Collective + +Input Parameter: +- `fem` - The `PetscFE` object + +Output Parameters: +- `numSubelements` - The number of sub elements +- `v0` - The affine transformation for each element, an array of length dim * Nc. Pass `NULL` to ignore. +- `jac` - The Jacobian for each element, an array of length dim^2 * Nc. Pass `NULL` to ignore. +- `invjac` - The inverse of the Jacobian, an array of length dim^2 * Nc. Pass `NULL` to ignore. + +Level: intermediate + +-seealso: `PetscFE`, `PetscFECreate()` + +# External Links +$(_doc_external("DM/PetscFECompositeGetMapping")) +""" +function PetscFECompositeGetMapping(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFECompositeGetMapping(petsclib::$UnionPetscLib, fem::PetscFE ) + numSubelements_ = Ref{$PetscInt}() + v0_ = Ref{Ptr{$PetscReal}}() + jac_ = Ref{Ptr{$PetscReal}}() + invjac_ = Ref{Ptr{$PetscReal}}() + + @chk ccall( + (:PetscFECompositeGetMapping, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{$PetscInt}, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}), + fem, numSubelements_, v0_, jac_, invjac_, + ) + + numSubelements = numSubelements_[] + v0 = unsafe_wrap(Array, v0_[], VecGetLocalSize(petsclib, x); own = false) + jac = unsafe_wrap(Array, jac_[], VecGetLocalSize(petsclib, x); own = false) + invjac = unsafe_wrap(Array, invjac_[], VecGetLocalSize(petsclib, x); own = false) + + return numSubelements,v0,jac,invjac +end + +""" + PetscFEOpenCLSetRealType(petsclib::PetscLibType,fem::PetscFE, realType::PetscDataType) +Set the scalar type for running on the OpenCL accelerator + +Input Parameters: +- `fem` - The `PetscFE` +- `realType` - The scalar type + +Level: developer + +-seealso: `PetscFE`, `PetscFEOpenCLGetRealType()` + +# External Links +$(_doc_external("DM/PetscFEOpenCLSetRealType")) +""" +function PetscFEOpenCLSetRealType(petsclib::PetscLibType, fem::PetscFE, realType::PetscDataType) end + +@for_petsc function PetscFEOpenCLSetRealType(petsclib::$UnionPetscLib, fem::PetscFE, realType::PetscDataType ) + + @chk ccall( + (:PetscFEOpenCLSetRealType, $petsc_library), + PetscErrorCode, + (PetscFE, PetscDataType), + fem, realType, + ) + + + return nothing +end + +""" + realType::PetscDataType = PetscFEOpenCLGetRealType(petsclib::PetscLibType,fem::PetscFE) +Get the scalar type for running on the OpenCL accelerator + +Input Parameter: +- `fem` - The `PetscFE` + +Output Parameter: +- `realType` - The scalar type + +Level: developer + +-seealso: `PetscFE`, `PetscFEOpenCLSetRealType()` + +# External Links +$(_doc_external("DM/PetscFEOpenCLGetRealType")) +""" +function PetscFEOpenCLGetRealType(petsclib::PetscLibType, fem::PetscFE) end + +@for_petsc function PetscFEOpenCLGetRealType(petsclib::$UnionPetscLib, fem::PetscFE ) + realType_ = Ref{PetscDataType}() + + @chk ccall( + (:PetscFEOpenCLGetRealType, $petsc_library), + PetscErrorCode, + (PetscFE, Ptr{PetscDataType}), + fem, realType_, + ) + + realType = unsafe_string(realType_[]) + + return realType +end + +""" + vector_fe::PetscFE = PetscFECreateVector(petsclib::PetscLibType,scalar_fe::PetscFE, num_copies::PetscInt, interleave_basis::PetscBool, interleave_components::PetscBool) +Create a vector +`PetscFE`. + +Collective + +Input Parameters: +- `scalar_fe` - a `PetscFE` finite element +- `num_copies` - a positive integer +- `interleave_basis` - if `PETSC_TRUE`, the first `num_copies` basis vectors +of the output finite element will be copies of the +first basis vector of `scalar_fe`, and so on for the +other basis vectors; otherwise all of the first-copy +basis vectors will come first, followed by all of the +second-copy, and so on. +- `interleave_components` - if `PETSC_TRUE`, the first `num_copies` components +of the output finite element will be copies of the +first component of `scalar_fe`, and so on for the +other components; otherwise all of the first-copy +components will come first, followed by all of the +second-copy, and so on. + +Output Parameter: +- `vector_fe` - a `PetscFE` of type `PETSCFEVECTOR` that represent a discretization space with `num_copies` copies of `scalar_fe` + +Level: intermediate + +-seealso: `PetscFE`, `PetscFEType`, `PetscFECreate()`, `PetscFESetType()`, `PETSCFEBASIC`, `PETSCFEVECTOR` + +# External Links +$(_doc_external("DM/PetscFECreateVector")) +""" +function PetscFECreateVector(petsclib::PetscLibType, scalar_fe::PetscFE, num_copies::PetscInt, interleave_basis::PetscBool, interleave_components::PetscBool) end + +@for_petsc function PetscFECreateVector(petsclib::$UnionPetscLib, scalar_fe::PetscFE, num_copies::$PetscInt, interleave_basis::PetscBool, interleave_components::PetscBool ) + vector_fe_ = Ref{PetscFE}() + + @chk ccall( + (:PetscFECreateVector, $petsc_library), + PetscErrorCode, + (PetscFE, $PetscInt, PetscBool, PetscBool, Ptr{PetscFE}), + scalar_fe, num_copies, interleave_basis, interleave_components, vector_fe_, + ) + + vector_fe = vector_fe_[] + + return vector_fe +end + +""" + q::PetscQuadrature = PetscQuadratureCreate(petsclib::PetscLibType,comm::MPI_Comm) +Create a `PetscQuadrature` object + +Collective + +Input Parameter: +- `comm` - The communicator for the `PetscQuadrature` object + +Output Parameter: +- `q` - The `PetscQuadrature` object + +Level: beginner + +-seealso: `PetscQuadrature`, `Petscquadraturedestroy()`, `PetscQuadratureGetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureCreate")) +""" +function PetscQuadratureCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscQuadratureCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + q_ = Ref{PetscQuadrature}() + + @chk ccall( + (:PetscQuadratureCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscQuadrature}), + comm, q_, + ) + + q = q_[] + + return q +end + +""" + r::PetscQuadrature = PetscQuadratureDuplicate(petsclib::PetscLibType,q::PetscQuadrature) +Create a deep copy of the `PetscQuadrature` object + +Collective + +Input Parameter: +- `q` - The `PetscQuadrature` object + +Output Parameter: +- `r` - The new `PetscQuadrature` object + +Level: beginner + +-seealso: `PetscQuadrature`, `PetscQuadratureCreate()`, `PetscQuadratureDestroy()`, `PetscQuadratureGetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureDuplicate")) +""" +function PetscQuadratureDuplicate(petsclib::PetscLibType, q::PetscQuadrature) end + +@for_petsc function PetscQuadratureDuplicate(petsclib::$UnionPetscLib, q::PetscQuadrature ) + r_ = Ref{PetscQuadrature}() + + @chk ccall( + (:PetscQuadratureDuplicate, $petsc_library), + PetscErrorCode, + (PetscQuadrature, Ptr{PetscQuadrature}), + q, r_, + ) + + r = r_[] + + return r +end + +""" + PetscQuadratureDestroy(petsclib::PetscLibType,q::PetscQuadrature) +Destroys a `PetscQuadrature` object + +Collective + +Input Parameter: +- `q` - The `PetscQuadrature` object + +Level: beginner + +-seealso: `PetscQuadrature`, `PetscQuadratureCreate()`, `PetscQuadratureGetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureDestroy")) +""" +function PetscQuadratureDestroy(petsclib::PetscLibType, q::PetscQuadrature) end + +@for_petsc function PetscQuadratureDestroy(petsclib::$UnionPetscLib, q::PetscQuadrature ) + + @chk ccall( + (:PetscQuadratureDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscQuadrature},), + q, + ) + + + return nothing +end + +""" + ct::DMPolytopeType = PetscQuadratureGetCellType(petsclib::PetscLibType,q::PetscQuadrature) +Return the cell type of the integration domain + +Not Collective + +Input Parameter: +- `q` - The `PetscQuadrature` object + +Output Parameter: +- `ct` - The cell type of the integration domain + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscQuadratureSetCellType()`, `PetscQuadratureGetData()`, `PetscQuadratureSetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureGetCellType")) +""" +function PetscQuadratureGetCellType(petsclib::PetscLibType, q::PetscQuadrature) end + +@for_petsc function PetscQuadratureGetCellType(petsclib::$UnionPetscLib, q::PetscQuadrature ) + ct_ = Ref{DMPolytopeType}() + + @chk ccall( + (:PetscQuadratureGetCellType, $petsc_library), + PetscErrorCode, + (PetscQuadrature, Ptr{DMPolytopeType}), + q, ct_, + ) + + ct = unsafe_string(ct_[]) + + return ct +end + +""" + PetscQuadratureSetCellType(petsclib::PetscLibType,q::PetscQuadrature, ct::DMPolytopeType) +Set the cell type of the integration domain + +Not Collective + +Input Parameters: +- `q` - The `PetscQuadrature` object +- `ct` - The cell type of the integration domain + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscQuadratureGetCellType()`, `PetscQuadratureGetData()`, `PetscQuadratureSetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureSetCellType")) +""" +function PetscQuadratureSetCellType(petsclib::PetscLibType, q::PetscQuadrature, ct::DMPolytopeType) end + +@for_petsc function PetscQuadratureSetCellType(petsclib::$UnionPetscLib, q::PetscQuadrature, ct::DMPolytopeType ) + + @chk ccall( + (:PetscQuadratureSetCellType, $petsc_library), + PetscErrorCode, + (PetscQuadrature, DMPolytopeType), + q, ct, + ) + + + return nothing +end + +""" + order::PetscInt = PetscQuadratureGetOrder(petsclib::PetscLibType,q::PetscQuadrature) +Return the order of the method in the `PetscQuadrature` + +Not Collective + +Input Parameter: +- `q` - The `PetscQuadrature` object + +Output Parameter: +- `order` - The order of the quadrature, i.e. the highest degree polynomial that is exactly integrated + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscQuadratureSetOrder()`, `PetscQuadratureGetData()`, `PetscQuadratureSetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureGetOrder")) +""" +function PetscQuadratureGetOrder(petsclib::PetscLibType, q::PetscQuadrature) end + +@for_petsc function PetscQuadratureGetOrder(petsclib::$UnionPetscLib, q::PetscQuadrature ) + order_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscQuadratureGetOrder, $petsc_library), + PetscErrorCode, + (PetscQuadrature, Ptr{$PetscInt}), + q, order_, + ) + + order = order_[] + + return order +end + +""" + PetscQuadratureSetOrder(petsclib::PetscLibType,q::PetscQuadrature, order::PetscInt) +Set the order of the method in the `PetscQuadrature` + +Not Collective + +Input Parameters: +- `q` - The `PetscQuadrature` object +- `order` - The order of the quadrature, i.e. the highest degree polynomial that is exactly integrated + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscQuadratureGetOrder()`, `PetscQuadratureGetData()`, `PetscQuadratureSetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureSetOrder")) +""" +function PetscQuadratureSetOrder(petsclib::PetscLibType, q::PetscQuadrature, order::PetscInt) end + +@for_petsc function PetscQuadratureSetOrder(petsclib::$UnionPetscLib, q::PetscQuadrature, order::$PetscInt ) + + @chk ccall( + (:PetscQuadratureSetOrder, $petsc_library), + PetscErrorCode, + (PetscQuadrature, $PetscInt), + q, order, + ) + + + return nothing +end + +""" + Nc::PetscInt = PetscQuadratureGetNumComponents(petsclib::PetscLibType,q::PetscQuadrature) +Return the number of components for functions to be integrated + +Not Collective + +Input Parameter: +- `q` - The `PetscQuadrature` object + +Output Parameter: +- `Nc` - The number of components + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscQuadratureSetNumComponents()`, `PetscQuadratureGetData()`, `PetscQuadratureSetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureGetNumComponents")) +""" +function PetscQuadratureGetNumComponents(petsclib::PetscLibType, q::PetscQuadrature) end + +@for_petsc function PetscQuadratureGetNumComponents(petsclib::$UnionPetscLib, q::PetscQuadrature ) + Nc_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscQuadratureGetNumComponents, $petsc_library), + PetscErrorCode, + (PetscQuadrature, Ptr{$PetscInt}), + q, Nc_, + ) + + Nc = Nc_[] + + return Nc +end + +""" + PetscQuadratureSetNumComponents(petsclib::PetscLibType,q::PetscQuadrature, Nc::PetscInt) +Sets the number of components for functions to be integrated + +Not Collective + +Input Parameters: +- `q` - The `PetscQuadrature` object +- `Nc` - The number of components + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscQuadratureGetNumComponents()`, `PetscQuadratureGetData()`, `PetscQuadratureSetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureSetNumComponents")) +""" +function PetscQuadratureSetNumComponents(petsclib::PetscLibType, q::PetscQuadrature, Nc::PetscInt) end + +@for_petsc function PetscQuadratureSetNumComponents(petsclib::$UnionPetscLib, q::PetscQuadrature, Nc::$PetscInt ) + + @chk ccall( + (:PetscQuadratureSetNumComponents, $petsc_library), + PetscErrorCode, + (PetscQuadrature, $PetscInt), + q, Nc, + ) + + + return nothing +end + +""" + dim::PetscInt,Nc::PetscInt,npoints::PetscInt,points::Vector{PetscReal},weights::Vector{PetscReal} = PetscQuadratureGetData(petsclib::PetscLibType,q::PetscQuadrature) +Returns the data defining the `PetscQuadrature` + +Not Collective + +Input Parameter: +- `q` - The `PetscQuadrature` object + +Output Parameters: +- `dim` - The spatial dimension +- `Nc` - The number of components +- `npoints` - The number of quadrature points +- `points` - The coordinates of each quadrature point +- `weights` - The weight of each quadrature point + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscQuadratureCreate()`, `PetscQuadratureSetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureGetData")) +""" +function PetscQuadratureGetData(petsclib::PetscLibType, q::PetscQuadrature) end + +@for_petsc function PetscQuadratureGetData(petsclib::$UnionPetscLib, q::PetscQuadrature ) + dim_ = Ref{$PetscInt}() + Nc_ = Ref{$PetscInt}() + npoints_ = Ref{$PetscInt}() + points_ = Ref{Ptr{$PetscReal}}() + weights_ = Ref{Ptr{$PetscReal}}() + + @chk ccall( + (:PetscQuadratureGetData, $petsc_library), + PetscErrorCode, + (PetscQuadrature, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscReal}}), + q, dim_, Nc_, npoints_, points_, weights_, + ) + + dim = dim_[] + Nc = Nc_[] + npoints = npoints_[] + points = unsafe_wrap(Array, points_[], VecGetLocalSize(petsclib, x); own = false) + weights = unsafe_wrap(Array, weights_[], VecGetLocalSize(petsclib, x); own = false) + + return dim,Nc,npoints,points,weights +end + +""" + equal::PetscBool = PetscQuadratureEqual(petsclib::PetscLibType,A::PetscQuadrature, B::PetscQuadrature) +determine whether two quadratures are equivalent + +Input Parameters: +- `A` - A `PetscQuadrature` object +- `B` - Another `PetscQuadrature` object + +Output Parameter: +- `equal` - `PETSC_TRUE` if the quadratures are the same + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscQuadratureCreate()` + +# External Links +$(_doc_external("DM/PetscQuadratureEqual")) +""" +function PetscQuadratureEqual(petsclib::PetscLibType, A::PetscQuadrature, B::PetscQuadrature) end + +@for_petsc function PetscQuadratureEqual(petsclib::$UnionPetscLib, A::PetscQuadrature, B::PetscQuadrature ) + equal_ = Ref{PetscBool}() + + @chk ccall( + (:PetscQuadratureEqual, $petsc_library), + PetscErrorCode, + (PetscQuadrature, PetscQuadrature, Ptr{PetscBool}), + A, B, equal_, + ) + + equal = equal_[] + + return equal +end + +""" + PetscQuadraturePushForward(petsclib::PetscLibType,q::PetscQuadrature, imageDim::PetscInt, origin::Vector{PetscReal}, originImage::Vector{PetscReal}, J::Vector{PetscReal}, formDegree::PetscInt, Jinvstarq::PetscQuadrature) +Push forward a quadrature functional under an affine transformation. + +Collective + +Input Parameters: +- `q` - the quadrature functional +- `imageDim` - the dimension of the image of the transformation +- `origin` - a point in the original space +- `originImage` - the image of the origin under the transformation +- `J` - the Jacobian of the image: an [imageDim x dim] matrix in row major order +- `formDegree` - transform the quadrature weights as k-forms of this form degree (if the number of components is a multiple of (dim choose `formDegree`), +it is assumed that they represent multiple k-forms) [see `PetscDTAltVPullback()` for interpretation of `formDegree`] + +Output Parameter: +- `Jinvstarq` - a quadrature rule where each point is the image of a point in the original quadrature rule, and where the k-form weights have +been pulled-back by the pseudoinverse of `J` to the k-form weights in the image space. + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscDTAltVPullback()`, `PetscDTAltVPullbackMatrix()` + +# External Links +$(_doc_external("DM/PetscQuadraturePushForward")) +""" +function PetscQuadraturePushForward(petsclib::PetscLibType, q::PetscQuadrature, imageDim::PetscInt, origin::Vector{PetscReal}, originImage::Vector{PetscReal}, J::Vector{PetscReal}, formDegree::PetscInt, Jinvstarq::PetscQuadrature) end + +@for_petsc function PetscQuadraturePushForward(petsclib::$UnionPetscLib, q::PetscQuadrature, imageDim::$PetscInt, origin::Vector{$PetscReal}, originImage::Vector{$PetscReal}, J::Vector{$PetscReal}, formDegree::$PetscInt, Jinvstarq::PetscQuadrature ) + + @chk ccall( + (:PetscQuadraturePushForward, $petsc_library), + PetscErrorCode, + (PetscQuadrature, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscInt, Ptr{PetscQuadrature}), + q, imageDim, origin, originImage, J, formDegree, Jinvstarq, + ) + + + return nothing +end + +""" + PetscQuadratureSetData(petsclib::PetscLibType,q::PetscQuadrature, dim::PetscInt, Nc::PetscInt, npoints::PetscInt, points::Vector{PetscReal}, weights::Vector{PetscReal}) +Sets the data defining the quadrature + +Not Collective + +Input Parameters: +- `q` - The `PetscQuadrature` object +- `dim` - The spatial dimension +- `Nc` - The number of components +- `npoints` - The number of quadrature points +- `points` - The coordinates of each quadrature point +- `weights` - The weight of each quadrature point + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscQuadratureCreate()`, `PetscQuadratureGetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureSetData")) +""" +function PetscQuadratureSetData(petsclib::PetscLibType, q::PetscQuadrature, dim::PetscInt, Nc::PetscInt, npoints::PetscInt, points::Vector{PetscReal}, weights::Vector{PetscReal}) end + +@for_petsc function PetscQuadratureSetData(petsclib::$UnionPetscLib, q::PetscQuadrature, dim::$PetscInt, Nc::$PetscInt, npoints::$PetscInt, points::Vector{$PetscReal}, weights::Vector{$PetscReal} ) + + @chk ccall( + (:PetscQuadratureSetData, $petsc_library), + PetscErrorCode, + (PetscQuadrature, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}), + q, dim, Nc, npoints, points, weights, + ) + + + return nothing +end + +""" + PetscQuadratureView(petsclib::PetscLibType,quad::PetscQuadrature, viewer::PetscViewer) +View a `PetscQuadrature` object + +Collective + +Input Parameters: +- `quad` - The `PetscQuadrature` object +- `viewer` - The `PetscViewer` object + +Level: beginner + +-seealso: `PetscQuadrature`, `PetscViewer`, `PetscQuadratureCreate()`, `PetscQuadratureGetData()` + +# External Links +$(_doc_external("DM/PetscQuadratureView")) +""" +function PetscQuadratureView(petsclib::PetscLibType, quad::PetscQuadrature, viewer::PetscViewer) end + +@for_petsc function PetscQuadratureView(petsclib::$UnionPetscLib, quad::PetscQuadrature, viewer::PetscViewer ) + + @chk ccall( + (:PetscQuadratureView, $petsc_library), + PetscErrorCode, + (PetscQuadrature, PetscViewer), + quad, viewer, + ) + + + return nothing +end + +""" + PetscQuadratureExpandComposite(petsclib::PetscLibType,q::PetscQuadrature, numSubelements::PetscInt, v0::Vector{PetscReal}, jac::Vector{PetscReal}, qref::PetscQuadrature) +Return a quadrature over the composite element, which has the original quadrature in each subelement + +Not Collective; No Fortran Support + +Input Parameters: +- `q` - The original `PetscQuadrature` +- `numSubelements` - The number of subelements the original element is divided into +- `v0` - An array of the initial points for each subelement +- `jac` - An array of the Jacobian mappings from the reference to each subelement + +Output Parameter: +- `qref` - The dimension + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscFECreate()`, `PetscSpaceGetDimension()`, `PetscDualSpaceGetDimension()` + +# External Links +$(_doc_external("DM/PetscQuadratureExpandComposite")) +""" +function PetscQuadratureExpandComposite(petsclib::PetscLibType, q::PetscQuadrature, numSubelements::PetscInt, v0::Vector{PetscReal}, jac::Vector{PetscReal}, qref::PetscQuadrature) end + +@for_petsc function PetscQuadratureExpandComposite(petsclib::$UnionPetscLib, q::PetscQuadrature, numSubelements::$PetscInt, v0::Vector{$PetscReal}, jac::Vector{$PetscReal}, qref::PetscQuadrature ) + + @chk ccall( + (:PetscQuadratureExpandComposite, $petsc_library), + PetscErrorCode, + (PetscQuadrature, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{PetscQuadrature}), + q, numSubelements, v0, jac, qref, + ) + + + return nothing +end + +""" + Np::PetscInt = PetscQuadratureComputePermutations(petsclib::PetscLibType,quad::PetscQuadrature, perm::Vector{IS}) +Compute permutations of quadrature points corresponding to domain orientations + +Input Parameter: +- `quad` - The `PetscQuadrature` + +Output Parameters: +- `Np` - The number of domain orientations +- `perm` - An array of `IS` permutations, one for ech orientation, + +Level: developer + +-seealso: `PetscQuadratureSetCellType()`, `PetscQuadrature` + +# External Links +$(_doc_external("DM/PetscQuadratureComputePermutations")) +""" +function PetscQuadratureComputePermutations(petsclib::PetscLibType, quad::PetscQuadrature, perm::Vector{IS}) end + +@for_petsc function PetscQuadratureComputePermutations(petsclib::$UnionPetscLib, quad::PetscQuadrature, perm::Vector{IS} ) + Np_ = Ref{$PetscInt}() + perm_ = Ref(pointer(perm)) + + @chk ccall( + (:PetscQuadratureComputePermutations, $petsc_library), + PetscErrorCode, + (PetscQuadrature, Ptr{$PetscInt}, Ptr{Ptr{CIS}}), + quad, Np_, perm_, + ) + + Np = Np_[] + + return Np +end + +""" + PetscTabulationDestroy(petsclib::PetscLibType,T::PetscTabulation) +Frees memory from the associated tabulation. + +Not Collective + +Input Parameter: +- `T` - The tabulation + +Level: intermediate + +-seealso: `PetscTabulation`, `PetscFECreateTabulation()`, `PetscFEGetCellTabulation()` + +# External Links +$(_doc_external("DM/PetscTabulationDestroy")) +""" +function PetscTabulationDestroy(petsclib::PetscLibType, T::PetscTabulation) end + +@for_petsc function PetscTabulationDestroy(petsclib::$UnionPetscLib, T::PetscTabulation ) + + @chk ccall( + (:PetscTabulationDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscTabulation},), + T, + ) + + + return nothing +end + +""" + PetscWeakFormCopy(petsclib::PetscLibType,wf::PetscWeakForm, wfNew::PetscWeakForm) +Copy the pointwise functions to another `PetscWeakForm` + +Not Collective + +Input Parameter: +- `wf` - The original `PetscWeakForm` + +Output Parameter: +- `wfNew` - The copy of the `PetscWeakForm` + +Level: intermediate + +-seealso: `PetscWeakForm`, `PetscWeakFormCreate()`, `PetscWeakFormDestroy()` + +# External Links +$(_doc_external("DM/PetscWeakFormCopy")) +""" +function PetscWeakFormCopy(petsclib::PetscLibType, wf::PetscWeakForm, wfNew::PetscWeakForm) end + +@for_petsc function PetscWeakFormCopy(petsclib::$UnionPetscLib, wf::PetscWeakForm, wfNew::PetscWeakForm ) + + @chk ccall( + (:PetscWeakFormCopy, $petsc_library), + PetscErrorCode, + (PetscWeakForm, PetscWeakForm), + wf, wfNew, + ) + + + return nothing +end + +""" + PetscWeakFormClear(petsclib::PetscLibType,wf::PetscWeakForm) +Clear all functions from the `PetscWeakForm` + +Not Collective + +Input Parameter: +- `wf` - The original `PetscWeakForm` + +Level: intermediate + +-seealso: `PetscWeakForm`, `PetscWeakFormCopy()`, `PetscWeakFormCreate()`, `PetscWeakFormDestroy()` + +# External Links +$(_doc_external("DM/PetscWeakFormClear")) +""" +function PetscWeakFormClear(petsclib::PetscLibType, wf::PetscWeakForm) end + +@for_petsc function PetscWeakFormClear(petsclib::$UnionPetscLib, wf::PetscWeakForm ) + + @chk ccall( + (:PetscWeakFormClear, $petsc_library), + PetscErrorCode, + (PetscWeakForm,), + wf, + ) + + + return nothing +end + +""" + PetscWeakFormRewriteKeys(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, Nv::PetscInt, values::Vector{PetscInt}) +Change any key on the given label to use the new set of label values + +Not Collective + +Input Parameters: +- `wf` - The original `PetscWeakForm` +- `label` - The label to change keys for +- `Nv` - The number of new label values +- `values` - The set of new values to relabel keys with + +Level: intermediate + +-seealso: `PetscWeakForm`, `DMLabel`, `PetscWeakFormReplaceLabel()`, `PetscWeakFormCreate()`, `PetscWeakFormDestroy()` + +# External Links +$(_doc_external("DM/PetscWeakFormRewriteKeys")) +""" +function PetscWeakFormRewriteKeys(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, Nv::PetscInt, values::Vector{PetscInt}) end + +@for_petsc function PetscWeakFormRewriteKeys(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, Nv::$PetscInt, values::Vector{$PetscInt} ) + + @chk ccall( + (:PetscWeakFormRewriteKeys, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, Ptr{$PetscInt}), + wf, label, Nv, values, + ) + + + return nothing +end + +""" + PetscWeakFormReplaceLabel(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel) +Change any key on a label of the same name to use the new label + +Not Collective + +Input Parameters: +- `wf` - The original `PetscWeakForm` +- `label` - The label to change keys for + +Level: intermediate + +-seealso: `PetscWeakForm`, `DMLabel`, `PetscWeakFormRewriteKeys()`, `PetscWeakFormCreate()`, `PetscWeakFormDestroy()` + +# External Links +$(_doc_external("DM/PetscWeakFormReplaceLabel")) +""" +function PetscWeakFormReplaceLabel(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel) end + +@for_petsc function PetscWeakFormReplaceLabel(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel ) + + @chk ccall( + (:PetscWeakFormReplaceLabel, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel), + wf, label, + ) + + + return nothing +end + +""" + PetscWeakFormClearIndex(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, kind::PetscWeakFormKind, ind::PetscInt) + +# External Links +$(_doc_external("DM/PetscWeakFormClearIndex")) +""" +function PetscWeakFormClearIndex(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, kind::PetscWeakFormKind, ind::PetscInt) end + +@for_petsc function PetscWeakFormClearIndex(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, kind::PetscWeakFormKind, ind::$PetscInt ) + + @chk ccall( + (:PetscWeakFormClearIndex, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, PetscWeakFormKind, $PetscInt), + wf, label, val, f, part, kind, ind, + ) + + + return nothing +end + +#= +""" + n::PetscInt = PetscWeakFormGetObjective(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, ::Cvoid(obj) + +# External Links +$(_doc_external("DM/PetscWeakFormGetObjective")) +""" +function PetscWeakFormGetObjective(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, ::Cvoid(obj) end + +@for_petsc function PetscWeakFormGetObjective(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, ::Cvoid(obj ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscWeakFormGetObjective, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Cvoid(obj), + wf, label, val, f, part, n_, g0, + ) + + n = n_[] + + return n +end + + +""" + PetscWeakFormSetObjective(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, n::PetscInt, ::Cvoid(obj) + +# External Links +$(_doc_external("DM/PetscWeakFormSetObjective")) +""" +function PetscWeakFormSetObjective(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, n::PetscInt, ::Cvoid(obj) end + +@for_petsc function PetscWeakFormSetObjective(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, n::$PetscInt, ::Cvoid(obj ) + + @chk ccall( + (:PetscWeakFormSetObjective, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Cvoid(obj), + wf, label, val, f, part, n, g0, + ) + + + return nothing +end +=# + +""" + PetscWeakFormAddObjective(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, obj::external) + +# External Links +$(_doc_external("DM/PetscWeakFormAddObjective")) +""" +function PetscWeakFormAddObjective(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, obj::external) end + +@for_petsc function PetscWeakFormAddObjective(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, obj::external ) + + @chk ccall( + (:PetscWeakFormAddObjective, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, external), + wf, label, val, f, part, obj, + ) + + + return nothing +end + +#= +""" + PetscWeakFormGetIndexObjective(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, ind::PetscInt, ::Cvoid(obj) + +# External Links +$(_doc_external("DM/PetscWeakFormGetIndexObjective")) +""" +function PetscWeakFormGetIndexObjective(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, ind::PetscInt, ::Cvoid(obj) end + +@for_petsc function PetscWeakFormGetIndexObjective(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, ind::$PetscInt, ::Cvoid(obj ) + + @chk ccall( + (:PetscWeakFormGetIndexObjective, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Cvoid(obj), + wf, label, val, f, part, ind, g0, + ) + + + return nothing +end +=# +""" + PetscWeakFormSetIndexObjective(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, ind::PetscInt, obj::external) + +# External Links +$(_doc_external("DM/PetscWeakFormSetIndexObjective")) +""" +function PetscWeakFormSetIndexObjective(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, ind::PetscInt, obj::external) end + +@for_petsc function PetscWeakFormSetIndexObjective(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, ind::$PetscInt, obj::external ) + + @chk ccall( + (:PetscWeakFormSetIndexObjective, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external), + wf, label, val, f, part, ind, obj, + ) + + + return nothing +end + +#= +""" + n0::PetscInt = PetscWeakFormGetResidual(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, ::Cvoid(f0) + +# External Links +$(_doc_external("DM/PetscWeakFormGetResidual")) +""" +function PetscWeakFormGetResidual(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, ::Cvoid(f0) end + +@for_petsc function PetscWeakFormGetResidual(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, ::Cvoid(f0 ) + n0_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscWeakFormGetResidual, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Cvoid(f0), + wf, label, val, f, part, n0_, g0, + ) + + n0 = n0_[] + + return n0 +end +=# +""" + PetscWeakFormAddResidual(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, f0::external, f1::external) + +# External Links +$(_doc_external("DM/PetscWeakFormAddResidual")) +""" +function PetscWeakFormAddResidual(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, f0::external, f1::external) end + +@for_petsc function PetscWeakFormAddResidual(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, f0::external, f1::external ) + + @chk ccall( + (:PetscWeakFormAddResidual, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, external, external), + wf, label, val, f, part, f0, f1, + ) + + + return nothing +end + +#= +""" + PetscWeakFormSetResidual(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, n0::PetscInt, ::Cvoid(f0) + +# External Links +$(_doc_external("DM/PetscWeakFormSetResidual")) +""" +function PetscWeakFormSetResidual(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, n0::PetscInt, ::Cvoid(f0) end + +@for_petsc function PetscWeakFormSetResidual(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, n0::$PetscInt, ::Cvoid(f0 ) + + @chk ccall( + (:PetscWeakFormSetResidual, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Cvoid(f0), + wf, label, val, f, part, n0, g0, + ) + + + return nothing +end +=# +""" + PetscWeakFormSetIndexResidual(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, i0::PetscInt, f0::external, i1::PetscInt, f1::external) + +# External Links +$(_doc_external("DM/PetscWeakFormSetIndexResidual")) +""" +function PetscWeakFormSetIndexResidual(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, i0::PetscInt, f0::external, i1::PetscInt, f1::external) end + +@for_petsc function PetscWeakFormSetIndexResidual(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, i0::$PetscInt, f0::external, i1::$PetscInt, f1::external ) + + @chk ccall( + (:PetscWeakFormSetIndexResidual, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, $PetscInt, external), + wf, label, val, f, part, i0, f0, i1, f1, + ) + + + return nothing +end + +#= +""" + n0::PetscInt = PetscWeakFormGetBdResidual(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, ::Cvoid(f0) + +# External Links +$(_doc_external("DM/PetscWeakFormGetBdResidual")) +""" +function PetscWeakFormGetBdResidual(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, ::Cvoid(f0) end + +@for_petsc function PetscWeakFormGetBdResidual(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, ::Cvoid(f0 ) + n0_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscWeakFormGetBdResidual, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Cvoid(f0), + wf, label, val, f, part, n0_, g0, + ) + + n0 = n0_[] + + return n0 +end +=# +""" + PetscWeakFormAddBdResidual(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, f0::external, f1::external) + +# External Links +$(_doc_external("DM/PetscWeakFormAddBdResidual")) +""" +function PetscWeakFormAddBdResidual(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, f0::external, f1::external) end + +@for_petsc function PetscWeakFormAddBdResidual(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, f0::external, f1::external ) + + @chk ccall( + (:PetscWeakFormAddBdResidual, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, external, external), + wf, label, val, f, part, f0, f1, + ) + + + return nothing +end + +#= +""" + PetscWeakFormSetBdResidual(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, n0::PetscInt, ::Cvoid(f0) + +# External Links +$(_doc_external("DM/PetscWeakFormSetBdResidual")) +""" +function PetscWeakFormSetBdResidual(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, n0::PetscInt, ::Cvoid(f0) end + +@for_petsc function PetscWeakFormSetBdResidual(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, n0::$PetscInt, ::Cvoid(f0 ) + + @chk ccall( + (:PetscWeakFormSetBdResidual, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Cvoid(f0), + wf, label, val, f, part, n0, g0, + ) + + + return nothing +end +=# + +""" + PetscWeakFormSetIndexBdResidual(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, i0::PetscInt, f0::external, i1::PetscInt, f1::external) + +# External Links +$(_doc_external("DM/PetscWeakFormSetIndexBdResidual")) +""" +function PetscWeakFormSetIndexBdResidual(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, i0::PetscInt, f0::external, i1::PetscInt, f1::external) end + +@for_petsc function PetscWeakFormSetIndexBdResidual(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, i0::$PetscInt, f0::external, i1::$PetscInt, f1::external ) + + @chk ccall( + (:PetscWeakFormSetIndexBdResidual, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, $PetscInt, external), + wf, label, val, f, part, i0, f0, i1, f1, + ) + + + return nothing +end + +""" + hasJac::PetscBool = PetscWeakFormHasJacobian(petsclib::PetscLibType,wf::PetscWeakForm) + +# External Links +$(_doc_external("DM/PetscWeakFormHasJacobian")) +""" +function PetscWeakFormHasJacobian(petsclib::PetscLibType, wf::PetscWeakForm) end + +@for_petsc function PetscWeakFormHasJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm ) + hasJac_ = Ref{PetscBool}() + + @chk ccall( + (:PetscWeakFormHasJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, Ptr{PetscBool}), + wf, hasJac_, + ) + + hasJac = hasJac_[] + + return hasJac +end + +#= +""" + n0::PetscInt = PetscWeakFormGetJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormGetJacobian")) +""" +function PetscWeakFormGetJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::Cvoid) end + +@for_petsc function PetscWeakFormGetJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, g0::Cvoid ) + n0_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscWeakFormGetJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Cvoid), + wf, label, val, f, g, part, n0_, g0, + ) + + n0 = n0_[] + + return n0 +end +=# + +""" + PetscWeakFormAddJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::external, g1::external, g2::external, g3::external) + +# External Links +$(_doc_external("DM/PetscWeakFormAddJacobian")) +""" +function PetscWeakFormAddJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::external, g1::external, g2::external, g3::external) end + +@for_petsc function PetscWeakFormAddJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, g0::external, g1::external, g2::external, g3::external ) + + @chk ccall( + (:PetscWeakFormAddJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, external, external, external), + wf, label, val, f, g, part, g0, g1, g2, g3, + ) + + + return nothing +end + +#= +""" + PetscWeakFormSetJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, n0::PetscInt, g0::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormSetJacobian")) +""" +function PetscWeakFormSetJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, n0::PetscInt, g0::Cvoid) end + +@for_petsc function PetscWeakFormSetJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, n0::$PetscInt, g0::Cvoid ) + + @chk ccall( + (:PetscWeakFormSetJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Cvoid), + wf, label, val, f, g, part, n0, g0, + ) + + + return nothing +end +=# + +""" + PetscWeakFormSetIndexJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, i0::PetscInt, g0::external, i1::PetscInt, g1::external, i2::PetscInt, g2::external, i3::PetscInt, g3::external) + +# External Links +$(_doc_external("DM/PetscWeakFormSetIndexJacobian")) +""" +function PetscWeakFormSetIndexJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, i0::PetscInt, g0::external, i1::PetscInt, g1::external, i2::PetscInt, g2::external, i3::PetscInt, g3::external) end + +@for_petsc function PetscWeakFormSetIndexJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, i0::$PetscInt, g0::external, i1::$PetscInt, g1::external, i2::$PetscInt, g2::external, i3::$PetscInt, g3::external ) + + @chk ccall( + (:PetscWeakFormSetIndexJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, $PetscInt, external, $PetscInt, external, $PetscInt, external), + wf, label, val, f, g, part, i0, g0, i1, g1, i2, g2, i3, g3, + ) + + + return nothing +end + +""" + hasJacPre::PetscBool = PetscWeakFormHasJacobianPreconditioner(petsclib::PetscLibType,wf::PetscWeakForm) + +# External Links +$(_doc_external("DM/PetscWeakFormHasJacobianPreconditioner")) +""" +function PetscWeakFormHasJacobianPreconditioner(petsclib::PetscLibType, wf::PetscWeakForm) end + +@for_petsc function PetscWeakFormHasJacobianPreconditioner(petsclib::$UnionPetscLib, wf::PetscWeakForm ) + hasJacPre_ = Ref{PetscBool}() + + @chk ccall( + (:PetscWeakFormHasJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscWeakForm, Ptr{PetscBool}), + wf, hasJacPre_, + ) + + hasJacPre = hasJacPre_[] + + return hasJacPre +end + +#= +""" + n0::PetscInt = PetscWeakFormGetJacobianPreconditioner(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormGetJacobianPreconditioner")) +""" +function PetscWeakFormGetJacobianPreconditioner(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::Cvoid) end + +@for_petsc function PetscWeakFormGetJacobianPreconditioner(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, g0::Cvoid ) + n0_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscWeakFormGetJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Cvoid), + wf, label, val, f, g, part, n0_, g0, + ) + + n0 = n0_[] + + return n0 +end +=# + +""" + PetscWeakFormAddJacobianPreconditioner(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::external, g1::external, g2::external, g3::external) + +# External Links +$(_doc_external("DM/PetscWeakFormAddJacobianPreconditioner")) +""" +function PetscWeakFormAddJacobianPreconditioner(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::external, g1::external, g2::external, g3::external) end + +@for_petsc function PetscWeakFormAddJacobianPreconditioner(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, g0::external, g1::external, g2::external, g3::external ) + + @chk ccall( + (:PetscWeakFormAddJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, external, external, external), + wf, label, val, f, g, part, g0, g1, g2, g3, + ) + + + return nothing +end + +#= +""" + PetscWeakFormSetJacobianPreconditioner(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, n0::PetscInt, g0::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormSetJacobianPreconditioner")) +""" +function PetscWeakFormSetJacobianPreconditioner(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, n0::PetscInt, g0::Cvoid) end + +@for_petsc function PetscWeakFormSetJacobianPreconditioner(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, n0::$PetscInt, g0::Cvoid ) + + @chk ccall( + (:PetscWeakFormSetJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Cvoid), + wf, label, val, f, g, part, n0, g0, + ) + + + return nothing +end +=# + +""" + PetscWeakFormSetIndexJacobianPreconditioner(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, i0::PetscInt, g0::external, i1::PetscInt, g1::external, i2::PetscInt, g2::external, i3::PetscInt, g3::external) + +# External Links +$(_doc_external("DM/PetscWeakFormSetIndexJacobianPreconditioner")) +""" +function PetscWeakFormSetIndexJacobianPreconditioner(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, i0::PetscInt, g0::external, i1::PetscInt, g1::external, i2::PetscInt, g2::external, i3::PetscInt, g3::external) end + +@for_petsc function PetscWeakFormSetIndexJacobianPreconditioner(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, i0::$PetscInt, g0::external, i1::$PetscInt, g1::external, i2::$PetscInt, g2::external, i3::$PetscInt, g3::external ) + + @chk ccall( + (:PetscWeakFormSetIndexJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, $PetscInt, external, $PetscInt, external, $PetscInt, external), + wf, label, val, f, g, part, i0, g0, i1, g1, i2, g2, i3, g3, + ) + + + return nothing +end + +""" + hasJac::PetscBool = PetscWeakFormHasBdJacobian(petsclib::PetscLibType,wf::PetscWeakForm) + +# External Links +$(_doc_external("DM/PetscWeakFormHasBdJacobian")) +""" +function PetscWeakFormHasBdJacobian(petsclib::PetscLibType, wf::PetscWeakForm) end + +@for_petsc function PetscWeakFormHasBdJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm ) + hasJac_ = Ref{PetscBool}() + + @chk ccall( + (:PetscWeakFormHasBdJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, Ptr{PetscBool}), + wf, hasJac_, + ) + + hasJac = hasJac_[] + + return hasJac +end + +""" + n0::PetscInt = PetscWeakFormGetBdJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormGetBdJacobian")) +""" +function PetscWeakFormGetBdJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::Cvoid) end + +@for_petsc function PetscWeakFormGetBdJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, g0::Cvoid ) + n0_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscWeakFormGetBdJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Cvoid), + wf, label, val, f, g, part, n0_, g0 + ) + + n0 = n0_[] + + return n0 +end + +""" + PetscWeakFormAddBdJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::external, g1::external, g2::external, g3::external) + +# External Links +$(_doc_external("DM/PetscWeakFormAddBdJacobian")) +""" +function PetscWeakFormAddBdJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::external, g1::external, g2::external, g3::external) end + +@for_petsc function PetscWeakFormAddBdJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, g0::external, g1::external, g2::external, g3::external ) + + @chk ccall( + (:PetscWeakFormAddBdJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, external, external, external), + wf, label, val, f, g, part, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscWeakFormSetBdJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, n0::PetscInt, g0::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormSetBdJacobian")) +""" +function PetscWeakFormSetBdJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, n0::PetscInt, g0::Cvoid) end + +@for_petsc function PetscWeakFormSetBdJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, n0::$PetscInt, g0::Cvoid ) + + @chk ccall( + (:PetscWeakFormSetBdJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Cvoid), + wf, label, val, f, g, part, n0, g0, + ) + + + return nothing +end + +""" + PetscWeakFormSetIndexBdJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, i0::PetscInt, g0::external, i1::PetscInt, g1::external, i2::PetscInt, g2::external, i3::PetscInt, g3::external) + +# External Links +$(_doc_external("DM/PetscWeakFormSetIndexBdJacobian")) +""" +function PetscWeakFormSetIndexBdJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, i0::PetscInt, g0::external, i1::PetscInt, g1::external, i2::PetscInt, g2::external, i3::PetscInt, g3::external) end + +@for_petsc function PetscWeakFormSetIndexBdJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, i0::$PetscInt, g0::external, i1::$PetscInt, g1::external, i2::$PetscInt, g2::external, i3::$PetscInt, g3::external ) + + @chk ccall( + (:PetscWeakFormSetIndexBdJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, $PetscInt, external, $PetscInt, external, $PetscInt, external), + wf, label, val, f, g, part, i0, g0, i1, g1, i2, g2, i3, g3, + ) + + + return nothing +end + +""" + hasJacPre::PetscBool = PetscWeakFormHasBdJacobianPreconditioner(petsclib::PetscLibType,wf::PetscWeakForm) + +# External Links +$(_doc_external("DM/PetscWeakFormHasBdJacobianPreconditioner")) +""" +function PetscWeakFormHasBdJacobianPreconditioner(petsclib::PetscLibType, wf::PetscWeakForm) end + +@for_petsc function PetscWeakFormHasBdJacobianPreconditioner(petsclib::$UnionPetscLib, wf::PetscWeakForm ) + hasJacPre_ = Ref{PetscBool}() + + @chk ccall( + (:PetscWeakFormHasBdJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscWeakForm, Ptr{PetscBool}), + wf, hasJacPre_, + ) + + hasJacPre = hasJacPre_[] + + return hasJacPre +end + +""" + n0::PetscInt = PetscWeakFormGetBdJacobianPreconditioner(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormGetBdJacobianPreconditioner")) +""" +function PetscWeakFormGetBdJacobianPreconditioner(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::Cvoid) end + +@for_petsc function PetscWeakFormGetBdJacobianPreconditioner(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, g0::Cvoid ) + n0_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscWeakFormGetBdJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Cvoid), + wf, label, val, f, g, part, n0_, g0, + ) + + n0 = n0_[] + + return n0 +end + +""" + PetscWeakFormAddBdJacobianPreconditioner(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::external, g1::external, g2::external, g3::external) + +# External Links +$(_doc_external("DM/PetscWeakFormAddBdJacobianPreconditioner")) +""" +function PetscWeakFormAddBdJacobianPreconditioner(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::external, g1::external, g2::external, g3::external) end + +@for_petsc function PetscWeakFormAddBdJacobianPreconditioner(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, g0::external, g1::external, g2::external, g3::external ) + + @chk ccall( + (:PetscWeakFormAddBdJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, external, external, external), + wf, label, val, f, g, part, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscWeakFormSetBdJacobianPreconditioner(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, n0::PetscInt, g0::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormSetBdJacobianPreconditioner")) +""" +function PetscWeakFormSetBdJacobianPreconditioner(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, n0::PetscInt, g0::Cvoid) end + +@for_petsc function PetscWeakFormSetBdJacobianPreconditioner(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, n0::$PetscInt, g0::Cvoid ) + + @chk ccall( + (:PetscWeakFormSetBdJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Cvoid), + wf, label, val, f, g, part, n0, g0, + ) + + + return nothing +end + +""" + PetscWeakFormSetIndexBdJacobianPreconditioner(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, i0::PetscInt, g0::external, i1::PetscInt, g1::external, i2::PetscInt, g2::external, i3::PetscInt, g3::external) + +# External Links +$(_doc_external("DM/PetscWeakFormSetIndexBdJacobianPreconditioner")) +""" +function PetscWeakFormSetIndexBdJacobianPreconditioner(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, i0::PetscInt, g0::external, i1::PetscInt, g1::external, i2::PetscInt, g2::external, i3::PetscInt, g3::external) end + +@for_petsc function PetscWeakFormSetIndexBdJacobianPreconditioner(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, i0::$PetscInt, g0::external, i1::$PetscInt, g1::external, i2::$PetscInt, g2::external, i3::$PetscInt, g3::external ) + + @chk ccall( + (:PetscWeakFormSetIndexBdJacobianPreconditioner, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, $PetscInt, external, $PetscInt, external, $PetscInt, external), + wf, label, val, f, g, part, i0, g0, i1, g1, i2, g2, i3, g3, + ) + + + return nothing +end + +""" + hasDynJac::PetscBool = PetscWeakFormHasDynamicJacobian(petsclib::PetscLibType,wf::PetscWeakForm) + +# External Links +$(_doc_external("DM/PetscWeakFormHasDynamicJacobian")) +""" +function PetscWeakFormHasDynamicJacobian(petsclib::PetscLibType, wf::PetscWeakForm) end + +@for_petsc function PetscWeakFormHasDynamicJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm ) + hasDynJac_ = Ref{PetscBool}() + + @chk ccall( + (:PetscWeakFormHasDynamicJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, Ptr{PetscBool}), + wf, hasDynJac_, + ) + + hasDynJac = hasDynJac_[] + + return hasDynJac +end + +""" + n0::PetscInt = PetscWeakFormGetDynamicJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormGetDynamicJacobian")) +""" +function PetscWeakFormGetDynamicJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::Cvoid) end + +@for_petsc function PetscWeakFormGetDynamicJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, g0::Cvoid ) + n0_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscWeakFormGetDynamicJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Cvoid), + wf, label, val, f, g, part, n0_, g0, + ) + + n0 = n0_[] + + return n0 +end + +""" + PetscWeakFormAddDynamicJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::external, g1::external, g2::external, g3::external) + +# External Links +$(_doc_external("DM/PetscWeakFormAddDynamicJacobian")) +""" +function PetscWeakFormAddDynamicJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, g0::external, g1::external, g2::external, g3::external) end + +@for_petsc function PetscWeakFormAddDynamicJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, g0::external, g1::external, g2::external, g3::external ) + + @chk ccall( + (:PetscWeakFormAddDynamicJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, external, external, external), + wf, label, val, f, g, part, g0, g1, g2, g3, + ) + + + return nothing +end + +""" + PetscWeakFormSetDynamicJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, n0::PetscInt, g0::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormSetDynamicJacobian")) +""" +function PetscWeakFormSetDynamicJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, n0::PetscInt, g0::Cvoid) end + +@for_petsc function PetscWeakFormSetDynamicJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, n0::$PetscInt, g0::Cvoid ) + + @chk ccall( + (:PetscWeakFormSetDynamicJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Cvoid), + wf, label, val, f, g, part, n0, g0 + ) + + + return nothing +end + +""" + PetscWeakFormSetIndexDynamicJacobian(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, i0::PetscInt, g0::external, i1::PetscInt, g1::external, i2::PetscInt, g2::external, i3::PetscInt, g3::external) + +# External Links +$(_doc_external("DM/PetscWeakFormSetIndexDynamicJacobian")) +""" +function PetscWeakFormSetIndexDynamicJacobian(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, g::PetscInt, part::PetscInt, i0::PetscInt, g0::external, i1::PetscInt, g1::external, i2::PetscInt, g2::external, i3::PetscInt, g3::external) end + +@for_petsc function PetscWeakFormSetIndexDynamicJacobian(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, g::$PetscInt, part::$PetscInt, i0::$PetscInt, g0::external, i1::$PetscInt, g1::external, i2::$PetscInt, g2::external, i3::$PetscInt, g3::external ) + + @chk ccall( + (:PetscWeakFormSetIndexDynamicJacobian, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external, $PetscInt, external, $PetscInt, external, $PetscInt, external), + wf, label, val, f, g, part, i0, g0, i1, g1, i2, g2, i3, g3, + ) + + + return nothing +end + +""" + n::PetscInt = PetscWeakFormGetRiemannSolver(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, r::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormGetRiemannSolver")) +""" +function PetscWeakFormGetRiemannSolver(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, r::Cvoid) end + +@for_petsc function PetscWeakFormGetRiemannSolver(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, r::Cvoid) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscWeakFormGetRiemannSolver, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Cvoid), + wf, label, val, f, part, n_, r, + ) + + n = n_[] + + return n +end + +""" + PetscWeakFormSetRiemannSolver(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, n::PetscInt, r::Cvoid) + +# External Links +$(_doc_external("DM/PetscWeakFormSetRiemannSolver")) +""" +function PetscWeakFormSetRiemannSolver(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, n::PetscInt, r::Cvoid) end + +@for_petsc function PetscWeakFormSetRiemannSolver(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, n::$PetscInt, r::Cvoid ) + + @chk ccall( + (:PetscWeakFormSetRiemannSolver, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, Cvoid), + wf, label, val, f, part, n, r, + ) + + + return nothing +end + +""" + PetscWeakFormSetIndexRiemannSolver(petsclib::PetscLibType,wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, i::PetscInt, r::external) + +# External Links +$(_doc_external("DM/PetscWeakFormSetIndexRiemannSolver")) +""" +function PetscWeakFormSetIndexRiemannSolver(petsclib::PetscLibType, wf::PetscWeakForm, label::DMLabel, val::PetscInt, f::PetscInt, part::PetscInt, i::PetscInt, r::external) end + +@for_petsc function PetscWeakFormSetIndexRiemannSolver(petsclib::$UnionPetscLib, wf::PetscWeakForm, label::DMLabel, val::$PetscInt, f::$PetscInt, part::$PetscInt, i::$PetscInt, r::external ) + + @chk ccall( + (:PetscWeakFormSetIndexRiemannSolver, $petsc_library), + PetscErrorCode, + (PetscWeakForm, DMLabel, $PetscInt, $PetscInt, $PetscInt, $PetscInt, external), + wf, label, val, f, part, i, r, + ) + + + return nothing +end + +""" + Nf::PetscInt = PetscWeakFormGetNumFields(petsclib::PetscLibType,wf::PetscWeakForm) +Returns the number of fields in a `PetscWeakForm` + +Not Collective + +Input Parameter: +- `wf` - The `PetscWeakForm` object + +Output Parameter: +- `Nf` - The number of fields + +Level: beginner + +-seealso: `PetscWeakForm`, `PetscWeakFormSetNumFields()`, `PetscWeakFormCreate()` + +# External Links +$(_doc_external("DM/PetscWeakFormGetNumFields")) +""" +function PetscWeakFormGetNumFields(petsclib::PetscLibType, wf::PetscWeakForm) end + +@for_petsc function PetscWeakFormGetNumFields(petsclib::$UnionPetscLib, wf::PetscWeakForm ) + Nf_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscWeakFormGetNumFields, $petsc_library), + PetscErrorCode, + (PetscWeakForm, Ptr{$PetscInt}), + wf, Nf_, + ) + + Nf = Nf_[] + + return Nf +end + +""" + PetscWeakFormSetNumFields(petsclib::PetscLibType,wf::PetscWeakForm, Nf::PetscInt) +Sets the number of fields + +Not Collective + +Input Parameters: +- `wf` - The `PetscWeakForm` object +- `Nf` - The number of fields + +Level: beginner + +-seealso: `PetscWeakForm`, `PetscWeakFormGetNumFields()`, `PetscWeakFormCreate()` + +# External Links +$(_doc_external("DM/PetscWeakFormSetNumFields")) +""" +function PetscWeakFormSetNumFields(petsclib::PetscLibType, wf::PetscWeakForm, Nf::PetscInt) end + +@for_petsc function PetscWeakFormSetNumFields(petsclib::$UnionPetscLib, wf::PetscWeakForm, Nf::$PetscInt ) + + @chk ccall( + (:PetscWeakFormSetNumFields, $petsc_library), + PetscErrorCode, + (PetscWeakForm, $PetscInt), + wf, Nf, + ) + + + return nothing +end + +""" + PetscWeakFormDestroy(petsclib::PetscLibType,wf::PetscWeakForm) +Destroys a `PetscWeakForm` object + +Collective + +Input Parameter: +- `wf` - the `PetscWeakForm` object to destroy + +Level: developer + +-seealso: `PetscWeakForm`, `PetscWeakFormCreate()`, `PetscWeakFormView()` + +# External Links +$(_doc_external("DM/PetscWeakFormDestroy")) +""" +function PetscWeakFormDestroy(petsclib::PetscLibType, wf::PetscWeakForm) end + +@for_petsc function PetscWeakFormDestroy(petsclib::$UnionPetscLib, wf::PetscWeakForm ) + + @chk ccall( + (:PetscWeakFormDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscWeakForm},), + wf, + ) + + + return nothing +end + +""" + PetscWeakFormView(petsclib::PetscLibType,wf::PetscWeakForm, v::PetscViewer) +Views a `PetscWeakForm` + +Collective + +Input Parameters: +- `wf` - the `PetscWeakForm` object to view +- `v` - the viewer + +Level: developer + +-seealso: `PetscViewer`, `PetscWeakForm`, `PetscWeakFormDestroy()`, `PetscWeakFormCreate()` + +# External Links +$(_doc_external("DM/PetscWeakFormView")) +""" +function PetscWeakFormView(petsclib::PetscLibType, wf::PetscWeakForm, v::PetscViewer) end + +@for_petsc function PetscWeakFormView(petsclib::$UnionPetscLib, wf::PetscWeakForm, v::PetscViewer ) + + @chk ccall( + (:PetscWeakFormView, $petsc_library), + PetscErrorCode, + (PetscWeakForm, PetscViewer), + wf, v, + ) + + + return nothing +end + +""" + wf::PetscWeakForm = PetscWeakFormCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty `PetscWeakForm` object. + +Collective + +Input Parameter: +- `comm` - The communicator for the `PetscWeakForm` object + +Output Parameter: +- `wf` - The `PetscWeakForm` object + +Level: beginner + +-seealso: `PetscWeakForm`, `PetscDS`, `PetscWeakFormDestroy()` + +# External Links +$(_doc_external("DM/PetscWeakFormCreate")) +""" +function PetscWeakFormCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscWeakFormCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + wf_ = Ref{PetscWeakForm}() + + @chk ccall( + (:PetscWeakFormCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscWeakForm}), + comm, wf_, + ) + + wf = wf_[] + + return wf +end + diff --git a/src/autowrapped/PetscFV_wrappers.jl b/src/autowrapped/PetscFV_wrappers.jl new file mode 100644 index 00000000..533ca848 --- /dev/null +++ b/src/autowrapped/PetscFV_wrappers.jl @@ -0,0 +1,1105 @@ +# ------------------------------------------------------- +""" + PetscFVFinalizePackage(petsclib::PetscLibType) +This function finalizes everything in the `PetscFV` package. It is called +from `PetscFinalize()`. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("DM/PetscFVFinalizePackage")) +""" +function PetscFVFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscFVFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscFVFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscFVInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PetscFV` package. It is called +from `PetscDLLibraryRegister()` when using dynamic libraries, and on the first call to `PetscFVCreate()` +when using static libraries. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("DM/PetscFVInitializePackage")) +""" +function PetscFVInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscFVInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscFVInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscFVRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new `PetscFV` implementation + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine itself + +-seealso: `PetscFV`, `PetscFVType`, `PetscFVRegisterAll()`, `PetscFVRegisterDestroy()` + +# External Links +$(_doc_external("DM/PetscFVRegister")) +""" +function PetscFVRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscFVRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscFVRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscFVSetType(petsclib::PetscLibType,fvm::PetscFV, name::PetscFVType) +Builds a particular `PetscFV` + +Collective + +Input Parameters: +- `fvm` - The `PetscFV` object +- `name` - The type of FVM space + +Options Database Key: +- `-petscfv_type ` - Sets the `PetscFVType`; use -help for a list of available types + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVType`, `PetscFVGetType()`, `PetscFVCreate()` + +# External Links +$(_doc_external("DM/PetscFVSetType")) +""" +function PetscFVSetType(petsclib::PetscLibType, fvm::PetscFV, name::PetscFVType) end + +@for_petsc function PetscFVSetType(petsclib::$UnionPetscLib, fvm::PetscFV, name::PetscFVType ) + + @chk ccall( + (:PetscFVSetType, $petsc_library), + PetscErrorCode, + (PetscFV, PetscFVType), + fvm, name, + ) + + + return nothing +end + +""" + name::PetscFVType = PetscFVGetType(petsclib::PetscLibType,fvm::PetscFV) +Gets the `PetscFVType` (as a string) from a `PetscFV`. + +Not Collective + +Input Parameter: +- `fvm` - The `PetscFV` + +Output Parameter: +- `name` - The `PetscFVType` name + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVType`, `PetscFVSetType()`, `PetscFVCreate()` + +# External Links +$(_doc_external("DM/PetscFVGetType")) +""" +function PetscFVGetType(petsclib::PetscLibType, fvm::PetscFV) end + +@for_petsc function PetscFVGetType(petsclib::$UnionPetscLib, fvm::PetscFV ) + name_ = Ref{PetscFVType}() + + @chk ccall( + (:PetscFVGetType, $petsc_library), + PetscErrorCode, + (PetscFV, Ptr{PetscFVType}), + fvm, name_, + ) + + name = unsafe_string(name_[]) + + return name +end + +""" + PetscFVViewFromOptions(petsclib::PetscLibType,A::PetscFV, obj::PetscObject, name::String) +View a `PetscFV` based on values in the options database + +Collective + +Input Parameters: +- `A` - the `PetscFV` object +- `obj` - Optional object that provides the options prefix +- `name` - command line option name + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVView()`, `PetscObjectViewFromOptions()`, `PetscFVCreate()` + +# External Links +$(_doc_external("DM/PetscFVViewFromOptions")) +""" +function PetscFVViewFromOptions(petsclib::PetscLibType, A::PetscFV, obj::PetscObject, name::String) end + +@for_petsc function PetscFVViewFromOptions(petsclib::$UnionPetscLib, A::PetscFV, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscFVViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscFV, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscFVView(petsclib::PetscLibType,fvm::PetscFV, v::PetscViewer) +Views a `PetscFV` + +Collective + +Input Parameters: +- `fvm` - the `PetscFV` object to view +- `v` - the viewer + +Level: beginner + +-seealso: `PetscFV`, `PetscViewer`, `PetscFVDestroy()` + +# External Links +$(_doc_external("DM/PetscFVView")) +""" +function PetscFVView(petsclib::PetscLibType, fvm::PetscFV, v::PetscViewer) end + +@for_petsc function PetscFVView(petsclib::$UnionPetscLib, fvm::PetscFV, v::PetscViewer ) + + @chk ccall( + (:PetscFVView, $petsc_library), + PetscErrorCode, + (PetscFV, PetscViewer), + fvm, v, + ) + + + return nothing +end + +""" + PetscFVSetFromOptions(petsclib::PetscLibType,fvm::PetscFV) +sets parameters in a `PetscFV` from the options database + +Collective + +Input Parameter: +- `fvm` - the `PetscFV` object to set options for + +Options Database Key: +- `-petscfv_compute_gradients ` - Determines whether cell gradients are calculated + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVView()` + +# External Links +$(_doc_external("DM/PetscFVSetFromOptions")) +""" +function PetscFVSetFromOptions(petsclib::PetscLibType, fvm::PetscFV) end + +@for_petsc function PetscFVSetFromOptions(petsclib::$UnionPetscLib, fvm::PetscFV ) + + @chk ccall( + (:PetscFVSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscFV,), + fvm, + ) + + + return nothing +end + +""" + PetscFVSetUp(petsclib::PetscLibType,fvm::PetscFV) +Setup the data structures for the `PetscFV` based on the `PetscFVType` provided by `PetscFVSetType()` + +Collective + +Input Parameter: +- `fvm` - the `PetscFV` object to setup + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVView()`, `PetscFVDestroy()` + +# External Links +$(_doc_external("DM/PetscFVSetUp")) +""" +function PetscFVSetUp(petsclib::PetscLibType, fvm::PetscFV) end + +@for_petsc function PetscFVSetUp(petsclib::$UnionPetscLib, fvm::PetscFV ) + + @chk ccall( + (:PetscFVSetUp, $petsc_library), + PetscErrorCode, + (PetscFV,), + fvm, + ) + + + return nothing +end + +""" + PetscFVDestroy(petsclib::PetscLibType,fvm::PetscFV) +Destroys a `PetscFV` object + +Collective + +Input Parameter: +- `fvm` - the `PetscFV` object to destroy + +Level: beginner + +-seealso: `PetscFV`, `PetscFVCreate()`, `PetscFVView()` + +# External Links +$(_doc_external("DM/PetscFVDestroy")) +""" +function PetscFVDestroy(petsclib::PetscLibType, fvm::PetscFV) end + +@for_petsc function PetscFVDestroy(petsclib::$UnionPetscLib, fvm::PetscFV ) + + @chk ccall( + (:PetscFVDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscFV},), + fvm, + ) + + + return nothing +end + +""" + fvm::PetscFV = PetscFVCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty `PetscFV` object. The type can then be set with `PetscFVSetType()`. + +Collective + +Input Parameter: +- `comm` - The communicator for the `PetscFV` object + +Output Parameter: +- `fvm` - The `PetscFV` object + +Level: beginner + +-seealso: `PetscFVSetUp()`, `PetscFVSetType()`, `PETSCFVUPWIND`, `PetscFVDestroy()` + +# External Links +$(_doc_external("DM/PetscFVCreate")) +""" +function PetscFVCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscFVCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + fvm_ = Ref{PetscFV}() + + @chk ccall( + (:PetscFVCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscFV}), + comm, fvm_, + ) + + fvm = fvm_[] + + return fvm +end + +""" + PetscFVSetLimiter(petsclib::PetscLibType,fvm::PetscFV, lim::PetscLimiter) +Set the `PetscLimiter` to the `PetscFV` + +Logically Collective + +Input Parameters: +- `fvm` - the `PetscFV` object +- `lim` - The `PetscLimiter` + +Level: intermediate + +-seealso: `PetscFV`, `PetscLimiter`, `PetscFVGetLimiter()` + +# External Links +$(_doc_external("DM/PetscFVSetLimiter")) +""" +function PetscFVSetLimiter(petsclib::PetscLibType, fvm::PetscFV, lim::PetscLimiter) end + +@for_petsc function PetscFVSetLimiter(petsclib::$UnionPetscLib, fvm::PetscFV, lim::PetscLimiter ) + + @chk ccall( + (:PetscFVSetLimiter, $petsc_library), + PetscErrorCode, + (PetscFV, PetscLimiter), + fvm, lim, + ) + + + return nothing +end + +""" + PetscFVGetLimiter(petsclib::PetscLibType,fvm::PetscFV, lim::PetscLimiter) +Get the `PetscLimiter` object from the `PetscFV` + +Not Collective + +Input Parameter: +- `fvm` - the `PetscFV` object + +Output Parameter: +- `lim` - The `PetscLimiter` + +Level: intermediate + +-seealso: `PetscFV`, `PetscLimiter`, `PetscFVSetLimiter()` + +# External Links +$(_doc_external("DM/PetscFVGetLimiter")) +""" +function PetscFVGetLimiter(petsclib::PetscLibType, fvm::PetscFV, lim::PetscLimiter) end + +@for_petsc function PetscFVGetLimiter(petsclib::$UnionPetscLib, fvm::PetscFV, lim::PetscLimiter ) + + @chk ccall( + (:PetscFVGetLimiter, $petsc_library), + PetscErrorCode, + (PetscFV, Ptr{PetscLimiter}), + fvm, lim, + ) + + + return nothing +end + +""" + PetscFVSetNumComponents(petsclib::PetscLibType,fvm::PetscFV, comp::PetscInt) +Set the number of field components in a `PetscFV` + +Logically Collective + +Input Parameters: +- `fvm` - the `PetscFV` object +- `comp` - The number of components + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVGetNumComponents()` + +# External Links +$(_doc_external("DM/PetscFVSetNumComponents")) +""" +function PetscFVSetNumComponents(petsclib::PetscLibType, fvm::PetscFV, comp::PetscInt) end + +@for_petsc function PetscFVSetNumComponents(petsclib::$UnionPetscLib, fvm::PetscFV, comp::$PetscInt ) + + @chk ccall( + (:PetscFVSetNumComponents, $petsc_library), + PetscErrorCode, + (PetscFV, $PetscInt), + fvm, comp, + ) + + + return nothing +end + +""" + comp::PetscInt = PetscFVGetNumComponents(petsclib::PetscLibType,fvm::PetscFV) +Get the number of field components in a `PetscFV` + +Not Collective + +Input Parameter: +- `fvm` - the `PetscFV` object + +Output Parameter: +- `comp` - The number of components + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVSetNumComponents()`, `PetscFVSetComponentName()` + +# External Links +$(_doc_external("DM/PetscFVGetNumComponents")) +""" +function PetscFVGetNumComponents(petsclib::PetscLibType, fvm::PetscFV) end + +@for_petsc function PetscFVGetNumComponents(petsclib::$UnionPetscLib, fvm::PetscFV ) + comp_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscFVGetNumComponents, $petsc_library), + PetscErrorCode, + (PetscFV, Ptr{$PetscInt}), + fvm, comp_, + ) + + comp = comp_[] + + return comp +end + +""" + PetscFVSetComponentName(petsclib::PetscLibType,fvm::PetscFV, comp::PetscInt, name::String) +Set the name of a component (used in output and viewing) in a `PetscFV` + +Logically Collective + +Input Parameters: +- `fvm` - the `PetscFV` object +- `comp` - the component number +- `name` - the component name + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVGetComponentName()` + +# External Links +$(_doc_external("DM/PetscFVSetComponentName")) +""" +function PetscFVSetComponentName(petsclib::PetscLibType, fvm::PetscFV, comp::PetscInt, name::String) end + +@for_petsc function PetscFVSetComponentName(petsclib::$UnionPetscLib, fvm::PetscFV, comp::$PetscInt, name::String ) + + @chk ccall( + (:PetscFVSetComponentName, $petsc_library), + PetscErrorCode, + (PetscFV, $PetscInt, Ptr{Cchar}), + fvm, comp, name, + ) + + + return nothing +end + +""" + PetscFVGetComponentName(petsclib::PetscLibType,fvm::PetscFV, comp::PetscInt, name::String) +Get the name of a component (used in output and viewing) in a `PetscFV` + +Logically Collective + +Input Parameters: +- `fvm` - the `PetscFV` object +- `comp` - the component number + +Output Parameter: +- `name` - the component name + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVSetComponentName()` + +# External Links +$(_doc_external("DM/PetscFVGetComponentName")) +""" +function PetscFVGetComponentName(petsclib::PetscLibType, fvm::PetscFV, comp::PetscInt, name::String) end + +@for_petsc function PetscFVGetComponentName(petsclib::$UnionPetscLib, fvm::PetscFV, comp::$PetscInt, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PetscFVGetComponentName, $petsc_library), + PetscErrorCode, + (PetscFV, $PetscInt, Ptr{Ptr{Cchar}}), + fvm, comp, name_, + ) + + + return nothing +end + +""" + PetscFVSetSpatialDimension(petsclib::PetscLibType,fvm::PetscFV, dim::PetscInt) +Set the spatial dimension of a `PetscFV` + +Logically Collective + +Input Parameters: +- `fvm` - the `PetscFV` object +- `dim` - The spatial dimension + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVGetSpatialDimension()` + +# External Links +$(_doc_external("DM/PetscFVSetSpatialDimension")) +""" +function PetscFVSetSpatialDimension(petsclib::PetscLibType, fvm::PetscFV, dim::PetscInt) end + +@for_petsc function PetscFVSetSpatialDimension(petsclib::$UnionPetscLib, fvm::PetscFV, dim::$PetscInt ) + + @chk ccall( + (:PetscFVSetSpatialDimension, $petsc_library), + PetscErrorCode, + (PetscFV, $PetscInt), + fvm, dim, + ) + + + return nothing +end + +""" + dim::PetscInt = PetscFVGetSpatialDimension(petsclib::PetscLibType,fvm::PetscFV) +Get the spatial dimension of a `PetscFV` + +Not Collective + +Input Parameter: +- `fvm` - the `PetscFV` object + +Output Parameter: +- `dim` - The spatial dimension + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVSetSpatialDimension()` + +# External Links +$(_doc_external("DM/PetscFVGetSpatialDimension")) +""" +function PetscFVGetSpatialDimension(petsclib::PetscLibType, fvm::PetscFV) end + +@for_petsc function PetscFVGetSpatialDimension(petsclib::$UnionPetscLib, fvm::PetscFV ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscFVGetSpatialDimension, $petsc_library), + PetscErrorCode, + (PetscFV, Ptr{$PetscInt}), + fvm, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + PetscFVSetComputeGradients(petsclib::PetscLibType,fvm::PetscFV, computeGradients::PetscBool) +Toggle computation of cell gradients on a `PetscFV` + +Logically Collective + +Input Parameters: +- `fvm` - the `PetscFV` object +- `computeGradients` - Flag to compute cell gradients + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVGetComputeGradients()` + +# External Links +$(_doc_external("DM/PetscFVSetComputeGradients")) +""" +function PetscFVSetComputeGradients(petsclib::PetscLibType, fvm::PetscFV, computeGradients::PetscBool) end + +@for_petsc function PetscFVSetComputeGradients(petsclib::$UnionPetscLib, fvm::PetscFV, computeGradients::PetscBool ) + + @chk ccall( + (:PetscFVSetComputeGradients, $petsc_library), + PetscErrorCode, + (PetscFV, PetscBool), + fvm, computeGradients, + ) + + + return nothing +end + +""" + computeGradients::PetscBool = PetscFVGetComputeGradients(petsclib::PetscLibType,fvm::PetscFV) +Return flag for computation of cell gradients on a `PetscFV` + +Not Collective + +Input Parameter: +- `fvm` - the `PetscFV` object + +Output Parameter: +- `computeGradients` - Flag to compute cell gradients + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVSetComputeGradients()` + +# External Links +$(_doc_external("DM/PetscFVGetComputeGradients")) +""" +function PetscFVGetComputeGradients(petsclib::PetscLibType, fvm::PetscFV) end + +@for_petsc function PetscFVGetComputeGradients(petsclib::$UnionPetscLib, fvm::PetscFV ) + computeGradients_ = Ref{PetscBool}() + + @chk ccall( + (:PetscFVGetComputeGradients, $petsc_library), + PetscErrorCode, + (PetscFV, Ptr{PetscBool}), + fvm, computeGradients_, + ) + + computeGradients = computeGradients_[] + + return computeGradients +end + +""" + PetscFVSetQuadrature(petsclib::PetscLibType,fvm::PetscFV, q::PetscQuadrature) +Set the `PetscQuadrature` object for a `PetscFV` + +Logically Collective + +Input Parameters: +- `fvm` - the `PetscFV` object +- `q` - The `PetscQuadrature` + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscFV`, `PetscFVGetQuadrature()` + +# External Links +$(_doc_external("DM/PetscFVSetQuadrature")) +""" +function PetscFVSetQuadrature(petsclib::PetscLibType, fvm::PetscFV, q::PetscQuadrature) end + +@for_petsc function PetscFVSetQuadrature(petsclib::$UnionPetscLib, fvm::PetscFV, q::PetscQuadrature ) + + @chk ccall( + (:PetscFVSetQuadrature, $petsc_library), + PetscErrorCode, + (PetscFV, PetscQuadrature), + fvm, q, + ) + + + return nothing +end + +""" + PetscFVGetQuadrature(petsclib::PetscLibType,fvm::PetscFV, q::PetscQuadrature) +Get the `PetscQuadrature` from a `PetscFV` + +Not Collective + +Input Parameter: +- `fvm` - the `PetscFV` object + +Output Parameter: +- `q` - The `PetscQuadrature` + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscFV`, `PetscFVSetQuadrature()` + +# External Links +$(_doc_external("DM/PetscFVGetQuadrature")) +""" +function PetscFVGetQuadrature(petsclib::PetscLibType, fvm::PetscFV, q::PetscQuadrature) end + +@for_petsc function PetscFVGetQuadrature(petsclib::$UnionPetscLib, fvm::PetscFV, q::PetscQuadrature ) + + @chk ccall( + (:PetscFVGetQuadrature, $petsc_library), + PetscErrorCode, + (PetscFV, Ptr{PetscQuadrature}), + fvm, q, + ) + + + return nothing +end + +""" + PetscFVCreateDualSpace(petsclib::PetscLibType,fvm::PetscFV, ct::DMPolytopeType) +Creates a `PetscDualSpace` appropriate for the `PetscFV` + +Not Collective + +Input Parameters: +- `fvm` - The `PetscFV` object +- `ct` - The `DMPolytopeType` for the cell + +Level: intermediate + +-seealso: `PetscFVGetDualSpace()`, `PetscFVSetDualSpace()`, `PetscDualSpace`, `PetscFV`, `PetscFVCreate()` + +# External Links +$(_doc_external("DM/PetscFVCreateDualSpace")) +""" +function PetscFVCreateDualSpace(petsclib::PetscLibType, fvm::PetscFV, ct::DMPolytopeType) end + +@for_petsc function PetscFVCreateDualSpace(petsclib::$UnionPetscLib, fvm::PetscFV, ct::DMPolytopeType ) + + @chk ccall( + (:PetscFVCreateDualSpace, $petsc_library), + PetscErrorCode, + (PetscFV, DMPolytopeType), + fvm, ct, + ) + + + return nothing +end + +""" + PetscFVGetDualSpace(petsclib::PetscLibType,fvm::PetscFV, sp::PetscDualSpace) +Returns the `PetscDualSpace` used to define the inner product on a `PetscFV` + +Not Collective + +Input Parameter: +- `fvm` - The `PetscFV` object + +Output Parameter: +- `sp` - The `PetscDualSpace` object + +Level: intermediate + +-seealso: `PetscFVSetDualSpace()`, `PetscFVCreateDualSpace()`, `PetscDualSpace`, `PetscFV`, `PetscFVCreate()` + +# External Links +$(_doc_external("DM/PetscFVGetDualSpace")) +""" +function PetscFVGetDualSpace(petsclib::PetscLibType, fvm::PetscFV, sp::PetscDualSpace) end + +@for_petsc function PetscFVGetDualSpace(petsclib::$UnionPetscLib, fvm::PetscFV, sp::PetscDualSpace ) + + @chk ccall( + (:PetscFVGetDualSpace, $petsc_library), + PetscErrorCode, + (PetscFV, Ptr{PetscDualSpace}), + fvm, sp, + ) + + + return nothing +end + +""" + PetscFVSetDualSpace(petsclib::PetscLibType,fvm::PetscFV, sp::PetscDualSpace) +Sets the `PetscDualSpace` used to define the inner product + +Not Collective + +Input Parameters: +- `fvm` - The `PetscFV` object +- `sp` - The `PetscDualSpace` object + +Level: intermediate + +-seealso: `PetscFVGetDualSpace()`, `PetscFVCreateDualSpace()`, `PetscDualSpace`, `PetscFV`, `PetscFVCreate()` + +# External Links +$(_doc_external("DM/PetscFVSetDualSpace")) +""" +function PetscFVSetDualSpace(petsclib::PetscLibType, fvm::PetscFV, sp::PetscDualSpace) end + +@for_petsc function PetscFVSetDualSpace(petsclib::$UnionPetscLib, fvm::PetscFV, sp::PetscDualSpace ) + + @chk ccall( + (:PetscFVSetDualSpace, $petsc_library), + PetscErrorCode, + (PetscFV, PetscDualSpace), + fvm, sp, + ) + + + return nothing +end + +""" + PetscFVGetCellTabulation(petsclib::PetscLibType,fvm::PetscFV, T::PetscTabulation) +Returns the tabulation of the basis functions at the quadrature points + +Not Collective + +Input Parameter: +- `fvm` - The `PetscFV` object + +Output Parameter: +- `T` - The basis function values and derivatives at quadrature points + +Level: intermediate + +-seealso: `PetscFV`, `PetscTabulation`, `PetscFEGetCellTabulation()`, `PetscFVCreateTabulation()`, `PetscFVGetQuadrature()`, `PetscQuadratureGetData()` + +# External Links +$(_doc_external("DM/PetscFVGetCellTabulation")) +""" +function PetscFVGetCellTabulation(petsclib::PetscLibType, fvm::PetscFV, T::PetscTabulation) end + +@for_petsc function PetscFVGetCellTabulation(petsclib::$UnionPetscLib, fvm::PetscFV, T::PetscTabulation ) + + @chk ccall( + (:PetscFVGetCellTabulation, $petsc_library), + PetscErrorCode, + (PetscFV, Ptr{PetscTabulation}), + fvm, T, + ) + + + return nothing +end + +""" + T::PetscTabulation = PetscFVCreateTabulation(petsclib::PetscLibType,fvm::PetscFV, nrepl::PetscInt, npoints::PetscInt, points::Vector{PetscReal}, K::PetscInt) +Tabulates the basis functions, and perhaps derivatives, at the points provided. + +Not Collective + +Input Parameters: +- `fvm` - The `PetscFV` object +- `nrepl` - The number of replicas +- `npoints` - The number of tabulation points in a replica +- `points` - The tabulation point coordinates +- `K` - The order of derivative to tabulate + +Output Parameter: +- `T` - The basis function values and derivative at tabulation points + +Level: intermediate + +-seealso: `PetscFV`, `PetscTabulation`, `PetscFECreateTabulation()`, `PetscTabulationDestroy()`, `PetscFEGetCellTabulation()` + +# External Links +$(_doc_external("DM/PetscFVCreateTabulation")) +""" +function PetscFVCreateTabulation(petsclib::PetscLibType, fvm::PetscFV, nrepl::PetscInt, npoints::PetscInt, points::Vector{PetscReal}, K::PetscInt) end + +@for_petsc function PetscFVCreateTabulation(petsclib::$UnionPetscLib, fvm::PetscFV, nrepl::$PetscInt, npoints::$PetscInt, points::Vector{$PetscReal}, K::$PetscInt ) + T_ = Ref{PetscTabulation}() + + @chk ccall( + (:PetscFVCreateTabulation, $petsc_library), + PetscErrorCode, + (PetscFV, $PetscInt, $PetscInt, Ptr{$PetscReal}, $PetscInt, Ptr{PetscTabulation}), + fvm, nrepl, npoints, points, K, T_, + ) + + T = T_[] + + return T +end + +""" + grad::Vector{PetscScalar} = PetscFVComputeGradient(petsclib::PetscLibType,fvm::PetscFV, numFaces::PetscInt, dx::Vector{PetscScalar}) +Compute the gradient reconstruction matrix for a given cell + +Input Parameters: +- `fvm` - The `PetscFV` object +- `numFaces` - The number of cell faces which are not constrained +- `dx` - The vector from the cell centroid to the neighboring cell centroid for each face + +Output Parameter: +- `grad` - the gradient + +Level: advanced + +-seealso: `PetscFV`, `PetscFVCreate()` + +# External Links +$(_doc_external("DM/PetscFVComputeGradient")) +""" +function PetscFVComputeGradient(petsclib::PetscLibType, fvm::PetscFV, numFaces::PetscInt, dx::Vector{PetscScalar}) end + +@for_petsc function PetscFVComputeGradient(petsclib::$UnionPetscLib, fvm::PetscFV, numFaces::$PetscInt, dx::Vector{$PetscScalar} ) + grad = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscFVComputeGradient, $petsc_library), + PetscErrorCode, + (PetscFV, $PetscInt, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + fvm, numFaces, dx, grad, + ) + + + return grad +end + +""" + fluxL::Vector{PetscScalar},fluxR::Vector{PetscScalar} = PetscFVIntegrateRHSFunction(petsclib::PetscLibType,fvm::PetscFV, prob::PetscDS, field::PetscInt, Nf::PetscInt, fgeom::PetscFVFaceGeom, neighborVol::PetscReal, uL::Vector{PetscScalar}, uR::Vector{PetscScalar}) +Produce the cell residual vector for a chunk of elements by quadrature integration + +Not Collective + +Input Parameters: +- `fvm` - The `PetscFV` object for the field being integrated +- `prob` - The `PetscDS` specifying the discretizations and continuum functions +- `field` - The field being integrated +- `Nf` - The number of faces in the chunk +- `fgeom` - The face geometry for each face in the chunk +- `neighborVol` - The volume for each pair of cells in the chunk +- `uL` - The state from the cell on the left +- `uR` - The state from the cell on the right + +Output Parameters: +- `fluxL` - the left fluxes for each face +- `fluxR` - the right fluxes for each face + +Level: developer + +-seealso: `PetscFV`, `PetscDS`, `PetscFVFaceGeom`, `PetscFVCreate()` + +# External Links +$(_doc_external("DM/PetscFVIntegrateRHSFunction")) +""" +function PetscFVIntegrateRHSFunction(petsclib::PetscLibType, fvm::PetscFV, prob::PetscDS, field::PetscInt, Nf::PetscInt, fgeom::PetscFVFaceGeom, neighborVol::PetscReal, uL::Vector{PetscScalar}, uR::Vector{PetscScalar}) end + +@for_petsc function PetscFVIntegrateRHSFunction(petsclib::$UnionPetscLib, fvm::PetscFV, prob::PetscDS, field::$PetscInt, Nf::$PetscInt, fgeom::PetscFVFaceGeom, neighborVol::$PetscReal, uL::Vector{$PetscScalar}, uR::Vector{$PetscScalar} ) + fluxL = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + fluxR = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscFVIntegrateRHSFunction, $petsc_library), + PetscErrorCode, + (PetscFV, PetscDS, $PetscInt, $PetscInt, Ptr{PetscFVFaceGeom}, Ptr{$PetscReal}, Ptr{$PetscScalar}, Ptr{$PetscScalar}, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + fvm, prob, field, Nf, fgeom, neighborVol, uL, uR, fluxL, fluxR, + ) + + + return fluxL,fluxR +end + +""" + PetscFVClone(petsclib::PetscLibType,fv::PetscFV, fvNew::PetscFV) +Create a shallow copy of a `PetscFV` object that just references the internal objects. + +Input Parameter: +- `fv` - The initial `PetscFV` + +Output Parameter: +- `fvNew` - A clone of the `PetscFV` + +Level: advanced + +-seealso: `PetscFV`, `PetscFVType`, `PetscFVCreate()`, `PetscFVSetType()` + +# External Links +$(_doc_external("DM/PetscFVClone")) +""" +function PetscFVClone(petsclib::PetscLibType, fv::PetscFV, fvNew::PetscFV) end + +@for_petsc function PetscFVClone(petsclib::$UnionPetscLib, fv::PetscFV, fvNew::PetscFV ) + + @chk ccall( + (:PetscFVClone, $petsc_library), + PetscErrorCode, + (PetscFV, Ptr{PetscFV}), + fv, fvNew, + ) + + + return nothing +end + +""" + PetscFVRefine(petsclib::PetscLibType,fv::PetscFV, fvRef::PetscFV) +Create a "refined" `PetscFV` object that refines the reference cell into +smaller copies. + +Input Parameter: +- `fv` - The initial `PetscFV` + +Output Parameter: +- `fvRef` - The refined `PetscFV` + +Level: advanced + +-seealso: `PetscFV`, `PetscFVType`, `PetscFVCreate()`, `PetscFVSetType()` + +# External Links +$(_doc_external("DM/PetscFVRefine")) +""" +function PetscFVRefine(petsclib::PetscLibType, fv::PetscFV, fvRef::PetscFV) end + +@for_petsc function PetscFVRefine(petsclib::$UnionPetscLib, fv::PetscFV, fvRef::PetscFV ) + + @chk ccall( + (:PetscFVRefine, $petsc_library), + PetscErrorCode, + (PetscFV, Ptr{PetscFV}), + fv, fvRef, + ) + + + return nothing +end + +""" + PetscFVLeastSquaresSetMaxFaces(petsclib::PetscLibType,fvm::PetscFV, maxFaces::PetscInt) +Set the maximum number of cell faces for gradient reconstruction + +Not Collective + +Input Parameters: +- `fvm` - The `PetscFV` object +- `maxFaces` - The maximum number of cell faces + +Level: intermediate + +-seealso: `PetscFV`, `PetscFVCreate()`, `PETSCFVLEASTSQUARES`, `PetscFVComputeGradient()` + +# External Links +$(_doc_external("DM/PetscFVLeastSquaresSetMaxFaces")) +""" +function PetscFVLeastSquaresSetMaxFaces(petsclib::PetscLibType, fvm::PetscFV, maxFaces::PetscInt) end + +@for_petsc function PetscFVLeastSquaresSetMaxFaces(petsclib::$UnionPetscLib, fvm::PetscFV, maxFaces::$PetscInt ) + + @chk ccall( + (:PetscFVLeastSquaresSetMaxFaces, $petsc_library), + PetscErrorCode, + (PetscFV, $PetscInt), + fvm, maxFaces, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscFunctionList_wrappers.jl b/src/autowrapped/PetscFunctionList_wrappers.jl new file mode 100644 index 00000000..5b414325 --- /dev/null +++ b/src/autowrapped/PetscFunctionList_wrappers.jl @@ -0,0 +1,252 @@ +""" + PetscFunctionListDestroy(petsclib::PetscLibType,fl::PetscFunctionList) +Destroys a list of registered routines. + +Input Parameter: +- `fl` - pointer to list + +Level: developer + +-seealso: `PetscFunctionListAdd()`, `PetscFunctionList`, `PetscFunctionListClear()` + +# External Links +$(_doc_external("Sys/PetscFunctionListDestroy")) +""" +function PetscFunctionListDestroy(petsclib::PetscLibType, fl::PetscFunctionList) end + +@for_petsc function PetscFunctionListDestroy(petsclib::$UnionPetscLib, fl::PetscFunctionList ) + + @chk ccall( + (:PetscFunctionListDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscFunctionList},), + fl, + ) + + + return nothing +end + +""" + PetscFunctionListClear(petsclib::PetscLibType,fl::PetscFunctionList) +Clear a `PetscFunctionList` + +Not Collective + +Input Parameter: +- `fl` - The `PetscFunctionList` to clear + +Level: developer + +-seealso: `PetscFunctionList`, `PetscFunctionListDestroy()`, `PetscFunctionListAdd()` + +# External Links +$(_doc_external("Sys/PetscFunctionListClear")) +""" +function PetscFunctionListClear(petsclib::PetscLibType, fl::PetscFunctionList) end + +@for_petsc function PetscFunctionListClear(petsclib::$UnionPetscLib, fl::PetscFunctionList ) + + @chk ccall( + (:PetscFunctionListClear, $petsc_library), + PetscErrorCode, + (PetscFunctionList,), + fl, + ) + + + return nothing +end + +""" + PetscFunctionListPrintAll(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscFunctionListPrintAll")) +""" +function PetscFunctionListPrintAll(petsclib::PetscLibType) end + +@for_petsc function PetscFunctionListPrintAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscFunctionListPrintAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscFunctionListPrintNonEmpty(petsclib::PetscLibType,fl::PetscFunctionList) +Print composed names for non `NULL` function pointers + +Logically Collective, No Fortran Support + +Input Parameter: +- `fl` - the function list + +Level: developer + +-seealso: `PetscFunctionListAdd()`, `PetscFunctionList`, `PetscObjectQueryFunction()` + +# External Links +$(_doc_external("Sys/PetscFunctionListPrintNonEmpty")) +""" +function PetscFunctionListPrintNonEmpty(petsclib::PetscLibType, fl::PetscFunctionList) end + +@for_petsc function PetscFunctionListPrintNonEmpty(petsclib::$UnionPetscLib, fl::PetscFunctionList ) + + @chk ccall( + (:PetscFunctionListPrintNonEmpty, $petsc_library), + PetscErrorCode, + (PetscFunctionList,), + fl, + ) + + + return nothing +end + +""" + PetscFunctionListView(petsclib::PetscLibType,list::PetscFunctionList, viewer::PetscViewer) +prints out contents of a `PetscFunctionList` + +Collective + +Input Parameters: +- `list` - the list of functions +- `viewer` - the `PetscViewer` used to view the `PetscFunctionList` + +Level: developer + +-seealso: `PetscFunctionListAdd()`, `PetscFunctionListPrintTypes()`, `PetscFunctionList` + +# External Links +$(_doc_external("Sys/PetscFunctionListView")) +""" +function PetscFunctionListView(petsclib::PetscLibType, list::PetscFunctionList, viewer::PetscViewer) end + +@for_petsc function PetscFunctionListView(petsclib::$UnionPetscLib, list::PetscFunctionList, viewer::PetscViewer ) + + @chk ccall( + (:PetscFunctionListView, $petsc_library), + PetscErrorCode, + (PetscFunctionList, PetscViewer), + list, viewer, + ) + + + return nothing +end + +""" + PetscFunctionListGet(petsclib::PetscLibType,list::PetscFunctionList, array::Cchar, n::Cint) +Gets an array the contains the entries in `PetscFunctionList`, this is used +by help etc. + +Not Collective, No Fortran Support + +Input Parameter: +- `list` - list of types + +Output Parameters: +- `array` - array of names +- `n` - length of `array` + +Level: developer + +-seealso: `PetscFunctionListAdd()`, `PetscFunctionList` + +# External Links +$(_doc_external("Sys/PetscFunctionListGet")) +""" +function PetscFunctionListGet(petsclib::PetscLibType, list::PetscFunctionList, array::Cchar, n::Cint) end + +@for_petsc function PetscFunctionListGet(petsclib::$UnionPetscLib, list::PetscFunctionList, array::Cchar, n::Cint ) + + @chk ccall( + (:PetscFunctionListGet, $petsc_library), + PetscErrorCode, + (PetscFunctionList, Cchar, Ptr{Cint}), + list, array, n, + ) + + + return nothing +end + +""" + PetscFunctionListPrintTypes(petsclib::PetscLibType,comm::MPI_Comm, fd::Libc.FILE, prefix::String, name::String, text::String, man::String, list::PetscFunctionList, def::String, newv::String) +Prints the methods available in a list of functions + +Collective, No Fortran Support + +Input Parameters: +- `comm` - the communicator (usually `MPI_COMM_WORLD`) +- `fd` - file to print to, usually `stdout` +- `prefix` - prefix to prepend to name (optional) +- `name` - option string (for example, `-ksp_type`) +- `text` - short description of the object (for example, "Krylov solvers") +- `man` - name of manual page that discusses the object (for example, `KSPCreate`) +- `list` - list of types +- `def` - default (current) value +- `newv` - new value + +Level: developer + +-seealso: `PetscFunctionListAdd()`, `PetscFunctionList` + +# External Links +$(_doc_external("Sys/PetscFunctionListPrintTypes")) +""" +function PetscFunctionListPrintTypes(petsclib::PetscLibType, comm::MPI_Comm, fd::Libc.FILE, prefix::String, name::String, text::String, man::String, list::PetscFunctionList, def::String, newv::String) end + +@for_petsc function PetscFunctionListPrintTypes(petsclib::$UnionPetscLib, comm::MPI_Comm, fd::Libc.FILE, prefix::String, name::String, text::String, man::String, list::PetscFunctionList, def::String, newv::String ) + + @chk ccall( + (:PetscFunctionListPrintTypes, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Libc.FILE}, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, PetscFunctionList, Ptr{Cchar}, Ptr{Cchar}), + comm, fd, prefix, name, text, man, list, def, newv, + ) + + + return nothing +end + +""" + nl::PetscFunctionList = PetscFunctionListDuplicate(petsclib::PetscLibType,fl::PetscFunctionList) +Creates a new list from a given function list `PetscFunctionList`. + +Input Parameter: +- `fl` - pointer to list + +Output Parameter: +- `nl` - the new list (should point to `NULL` to start, otherwise appends) + +Level: developer + +-seealso: `PetscFunctionList`, `PetscFunctionListAdd()`, `PetscFlistDestroy()` + +# External Links +$(_doc_external("Sys/PetscFunctionListDuplicate")) +""" +function PetscFunctionListDuplicate(petsclib::PetscLibType, fl::PetscFunctionList) end + +@for_petsc function PetscFunctionListDuplicate(petsclib::$UnionPetscLib, fl::PetscFunctionList ) + nl_ = Ref{PetscFunctionList}() + + @chk ccall( + (:PetscFunctionListDuplicate, $petsc_library), + PetscErrorCode, + (PetscFunctionList, Ptr{PetscFunctionList}), + fl, nl_, + ) + + nl = nl_[] + + return nl +end + diff --git a/src/autowrapped/PetscGridHash_wrappers.jl b/src/autowrapped/PetscGridHash_wrappers.jl new file mode 100644 index 00000000..da886223 --- /dev/null +++ b/src/autowrapped/PetscGridHash_wrappers.jl @@ -0,0 +1,142 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscGridHash end +const PetscGridHash = Ptr{_n_PetscGridHash} + +# ------------------------------------------------------- +""" + box::PetscGridHash = PetscGridHashCreate(petsclib::PetscLibType,comm::MPI_Comm, dim::PetscInt, point::Vector{PetscScalar}) + +# External Links +$(_doc_external("DM/PetscGridHashCreate")) +""" +function PetscGridHashCreate(petsclib::PetscLibType, comm::MPI_Comm, dim::PetscInt, point::Vector{PetscScalar}) end + +@for_petsc function PetscGridHashCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, dim::$PetscInt, point::Vector{$PetscScalar} ) + box_ = Ref{PetscGridHash}() + + @chk ccall( + (:PetscGridHashCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{$PetscScalar}, Ptr{PetscGridHash}), + comm, dim, point, box_, + ) + + box = box_[] + + return box +end + +""" + PetscGridHashEnlarge(petsclib::PetscLibType,box::PetscGridHash, point::Vector{PetscScalar}) + +# External Links +$(_doc_external("DM/PetscGridHashEnlarge")) +""" +function PetscGridHashEnlarge(petsclib::PetscLibType, box::PetscGridHash, point::Vector{PetscScalar}) end + +@for_petsc function PetscGridHashEnlarge(petsclib::$UnionPetscLib, box::PetscGridHash, point::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscGridHashEnlarge, $petsc_library), + PetscErrorCode, + (PetscGridHash, Ptr{$PetscScalar}), + box, point, + ) + + + return nothing +end + +""" + PetscGridHashSetGrid(petsclib::PetscLibType,box::PetscGridHash, n::Vector{PetscInt}, h::Vector{PetscReal}) +Divide the grid into boxes + +Not Collective + +Input Parameters: +- `box` - The grid hash object +- `n` - The number of boxes in each dimension, may use `PETSC_DETERMINE` for the entries +- `h` - The box size in each dimension, only used if n[d] == `PETSC_DETERMINE`, if not needed you can pass in `NULL` + +Level: developer + +-seealso: `DMPLEX`, `PetscGridHashCreate()` + +# External Links +$(_doc_external("DM/PetscGridHashSetGrid")) +""" +function PetscGridHashSetGrid(petsclib::PetscLibType, box::PetscGridHash, n::Vector{PetscInt}, h::Vector{PetscReal}) end + +@for_petsc function PetscGridHashSetGrid(petsclib::$UnionPetscLib, box::PetscGridHash, n::Vector{$PetscInt}, h::Vector{$PetscReal} ) + + @chk ccall( + (:PetscGridHashSetGrid, $petsc_library), + PetscErrorCode, + (PetscGridHash, Ptr{$PetscInt}, Ptr{$PetscReal}), + box, n, h, + ) + + + return nothing +end + +""" + dboxes::Vector{PetscInt},boxes::Vector{PetscInt} = PetscGridHashGetEnclosingBox(petsclib::PetscLibType,box::PetscGridHash, numPoints::PetscInt, points::Vector{PetscScalar}) +Find the grid boxes containing each input point + +Not Collective + +Input Parameters: +- `box` - The grid hash object +- `numPoints` - The number of input points +- `points` - The input point coordinates + +Output Parameters: +- `dboxes` - An array of `numPoints` x `dim` integers expressing the enclosing box as (i_0, i_1, ..., i_dim) +- `boxes` - An array of `numPoints` integers expressing the enclosing box as single number, or `NULL` + +Level: developer + +-seealso: `DMPLEX`, `PetscGridHashCreate()` + +# External Links +$(_doc_external("DM/PetscGridHashGetEnclosingBox")) +""" +function PetscGridHashGetEnclosingBox(petsclib::PetscLibType, box::PetscGridHash, numPoints::PetscInt, points::Vector{PetscScalar}) end + +@for_petsc function PetscGridHashGetEnclosingBox(petsclib::$UnionPetscLib, box::PetscGridHash, numPoints::$PetscInt, points::Vector{$PetscScalar} ) + dboxes = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + boxes = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscGridHashGetEnclosingBox, $petsc_library), + PetscErrorCode, + (PetscGridHash, $PetscInt, Ptr{$PetscScalar}, Ptr{$PetscInt}, Ptr{$PetscInt}), + box, numPoints, points, dboxes, boxes, + ) + + + return dboxes,boxes +end + +""" + PetscGridHashDestroy(petsclib::PetscLibType,box::PetscGridHash) + +# External Links +$(_doc_external("DM/PetscGridHashDestroy")) +""" +function PetscGridHashDestroy(petsclib::PetscLibType, box::PetscGridHash) end + +@for_petsc function PetscGridHashDestroy(petsclib::$UnionPetscLib, box::PetscGridHash ) + + @chk ccall( + (:PetscGridHashDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscGridHash},), + box, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscHeap_wrappers.jl b/src/autowrapped/PetscHeap_wrappers.jl new file mode 100644 index 00000000..063b74df --- /dev/null +++ b/src/autowrapped/PetscHeap_wrappers.jl @@ -0,0 +1,183 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscHeap end +const PetscHeap = Ptr{_n_PetscHeap} + +# ------------------------------------------------------- +""" + heap::PetscHeap = PetscHeapCreate(petsclib::PetscLibType,maxsize::PetscInt) + +# External Links +$(_doc_external("Mat/PetscHeapCreate")) +""" +function PetscHeapCreate(petsclib::PetscLibType, maxsize::PetscInt) end + +@for_petsc function PetscHeapCreate(petsclib::$UnionPetscLib, maxsize::$PetscInt ) + heap_ = Ref{PetscHeap}() + + @chk ccall( + (:PetscHeapCreate, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{PetscHeap}), + maxsize, heap_, + ) + + heap = heap_[] + + return heap +end + +""" + PetscHeapAdd(petsclib::PetscLibType,h::PetscHeap, id::PetscInt, val::PetscInt) + +# External Links +$(_doc_external("Mat/PetscHeapAdd")) +""" +function PetscHeapAdd(petsclib::PetscLibType, h::PetscHeap, id::PetscInt, val::PetscInt) end + +@for_petsc function PetscHeapAdd(petsclib::$UnionPetscLib, h::PetscHeap, id::$PetscInt, val::$PetscInt ) + + @chk ccall( + (:PetscHeapAdd, $petsc_library), + PetscErrorCode, + (PetscHeap, $PetscInt, $PetscInt), + h, id, val, + ) + + + return nothing +end + +""" + id::PetscInt,val::PetscInt = PetscHeapPop(petsclib::PetscLibType,h::PetscHeap) + +# External Links +$(_doc_external("Mat/PetscHeapPop")) +""" +function PetscHeapPop(petsclib::PetscLibType, h::PetscHeap) end + +@for_petsc function PetscHeapPop(petsclib::$UnionPetscLib, h::PetscHeap ) + id_ = Ref{$PetscInt}() + val_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscHeapPop, $petsc_library), + PetscErrorCode, + (PetscHeap, Ptr{$PetscInt}, Ptr{$PetscInt}), + h, id_, val_, + ) + + id = id_[] + val = val_[] + + return id,val +end + +""" + id::PetscInt,val::PetscInt = PetscHeapPeek(petsclib::PetscLibType,h::PetscHeap) + +# External Links +$(_doc_external("Mat/PetscHeapPeek")) +""" +function PetscHeapPeek(petsclib::PetscLibType, h::PetscHeap) end + +@for_petsc function PetscHeapPeek(petsclib::$UnionPetscLib, h::PetscHeap ) + id_ = Ref{$PetscInt}() + val_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscHeapPeek, $petsc_library), + PetscErrorCode, + (PetscHeap, Ptr{$PetscInt}, Ptr{$PetscInt}), + h, id_, val_, + ) + + id = id_[] + val = val_[] + + return id,val +end + +""" + PetscHeapStash(petsclib::PetscLibType,h::PetscHeap, id::PetscInt, val::PetscInt) + +# External Links +$(_doc_external("Mat/PetscHeapStash")) +""" +function PetscHeapStash(petsclib::PetscLibType, h::PetscHeap, id::PetscInt, val::PetscInt) end + +@for_petsc function PetscHeapStash(petsclib::$UnionPetscLib, h::PetscHeap, id::$PetscInt, val::$PetscInt ) + + @chk ccall( + (:PetscHeapStash, $petsc_library), + PetscErrorCode, + (PetscHeap, $PetscInt, $PetscInt), + h, id, val, + ) + + + return nothing +end + +""" + PetscHeapUnstash(petsclib::PetscLibType,h::PetscHeap) + +# External Links +$(_doc_external("Mat/PetscHeapUnstash")) +""" +function PetscHeapUnstash(petsclib::PetscLibType, h::PetscHeap) end + +@for_petsc function PetscHeapUnstash(petsclib::$UnionPetscLib, h::PetscHeap ) + + @chk ccall( + (:PetscHeapUnstash, $petsc_library), + PetscErrorCode, + (PetscHeap,), + h, + ) + + + return nothing +end + +""" + PetscHeapDestroy(petsclib::PetscLibType,heap::PetscHeap) + +# External Links +$(_doc_external("Mat/PetscHeapDestroy")) +""" +function PetscHeapDestroy(petsclib::PetscLibType, heap::PetscHeap) end + +@for_petsc function PetscHeapDestroy(petsclib::$UnionPetscLib, heap::PetscHeap ) + + @chk ccall( + (:PetscHeapDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscHeap},), + heap, + ) + + + return nothing +end + +""" + PetscHeapView(petsclib::PetscLibType,h::PetscHeap, viewer::PetscViewer) + +# External Links +$(_doc_external("Mat/PetscHeapView")) +""" +function PetscHeapView(petsclib::PetscLibType, h::PetscHeap, viewer::PetscViewer) end + +@for_petsc function PetscHeapView(petsclib::$UnionPetscLib, h::PetscHeap, viewer::PetscViewer ) + + @chk ccall( + (:PetscHeapView, $petsc_library), + PetscErrorCode, + (PetscHeap, PetscViewer), + h, viewer, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscIntStack_wrappers.jl b/src/autowrapped/PetscIntStack_wrappers.jl new file mode 100644 index 00000000..c0af4769 --- /dev/null +++ b/src/autowrapped/PetscIntStack_wrappers.jl @@ -0,0 +1,201 @@ + +""" + PetscIntStackDestroy(petsclib::PetscLibType,stack::PetscIntStack) +This function destroys a stack. + +Not Collective, No Fortran Support + +Input Parameter: +- `stack` - The stack + +Level: developer + +-seealso: `PetscIntStackCreate()`, `PetscIntStackEmpty()`, `PetscIntStackPush()`, `PetscIntStackPop()`, `PetscIntStackTop()` + +# External Links +$(_doc_external("Sys/PetscIntStackDestroy")) +""" +function PetscIntStackDestroy(petsclib::PetscLibType, stack::PetscIntStack) end + +@for_petsc function PetscIntStackDestroy(petsclib::$UnionPetscLib, stack::$PetscIntStack ) + + @chk ccall( + (:PetscIntStackDestroy, $petsc_library), + PetscErrorCode, + ($PetscIntStack,), + stack, + ) + + + return nothing +end + +""" + empty::PetscBool = PetscIntStackEmpty(petsclib::PetscLibType,stack::PetscIntStack) +This function determines whether any items have been pushed. + +Not Collective, No Fortran Support + +Input Parameter: +- `stack` - The stack + +Output Parameter: +- `empty` - `PETSC_TRUE` if the stack is empty + +Level: developer + +-seealso: `PetscIntStackCreate()`, `PetscIntStackDestroy()`, `PetscIntStackPush()`, `PetscIntStackPop()`, `PetscIntStackTop()` + +# External Links +$(_doc_external("Sys/PetscIntStackEmpty")) +""" +function PetscIntStackEmpty(petsclib::PetscLibType, stack::PetscIntStack) end + +@for_petsc function PetscIntStackEmpty(petsclib::$UnionPetscLib, stack::$PetscIntStack ) + empty_ = Ref{PetscBool}() + + @chk ccall( + (:PetscIntStackEmpty, $petsc_library), + PetscErrorCode, + ($PetscIntStack, Ptr{PetscBool}), + stack, empty_, + ) + + empty = empty_[] + + return empty +end + +""" + PetscIntStackTop(petsclib::PetscLibType,stack::PetscIntStack, top::Cint) +This function returns the top of the stack. + +Not Collective, No Fortran Support + +Input Parameter: +- `stack` - The stack + +Output Parameter: +- `top` - The integer on top of the stack + +Level: developer + +-seealso: `PetscIntStackCreate()`, `PetscIntStackDestroy()`, `PetscIntStackEmpty()`, `PetscIntStackPush()`, `PetscIntStackPop()` + +# External Links +$(_doc_external("Sys/PetscIntStackTop")) +""" +function PetscIntStackTop(petsclib::PetscLibType, stack::PetscIntStack, top::Cint) end + +@for_petsc function PetscIntStackTop(petsclib::$UnionPetscLib, stack::$PetscIntStack, top::Cint ) + + @chk ccall( + (:PetscIntStackTop, $petsc_library), + PetscErrorCode, + ($PetscIntStack, Ptr{Cint}), + stack, top, + ) + + + return nothing +end + +""" + PetscIntStackPush(petsclib::PetscLibType,stack::PetscIntStack, item::Cint) +This function pushes an integer on the stack. + +Not Collective, No Fortran Support + +Input Parameters: +- `stack` - The stack +- `item` - The integer to push + +Level: developer + +-seealso: `PetscIntStackCreate()`, `PetscIntStackDestroy()`, `PetscIntStackEmpty()`, `PetscIntStackPop()`, `PetscIntStackTop()` + +# External Links +$(_doc_external("Sys/PetscIntStackPush")) +""" +function PetscIntStackPush(petsclib::PetscLibType, stack::PetscIntStack, item::Cint) end + +@for_petsc function PetscIntStackPush(petsclib::$UnionPetscLib, stack::$PetscIntStack, item::Cint ) + + @chk ccall( + (:PetscIntStackPush, $petsc_library), + PetscErrorCode, + ($PetscIntStack, Cint), + stack, item, + ) + + + return nothing +end + +""" + PetscIntStackPop(petsclib::PetscLibType,stack::PetscIntStack, item::Cint) +This function pops an integer from the stack. + +Not Collective, No Fortran Support + +Input Parameter: +- `stack` - The stack + +Output Parameter: +- `item` - The integer popped + +Level: developer + +-seealso: `PetscIntStackCreate()`, `PetscIntStackDestroy()`, `PetscIntStackEmpty()`, `PetscIntStackPush()`, `PetscIntStackTop()` + +# External Links +$(_doc_external("Sys/PetscIntStackPop")) +""" +function PetscIntStackPop(petsclib::PetscLibType, stack::PetscIntStack, item::Cint) end + +@for_petsc function PetscIntStackPop(petsclib::$UnionPetscLib, stack::$PetscIntStack, item::Cint ) + + @chk ccall( + (:PetscIntStackPop, $petsc_library), + PetscErrorCode, + ($PetscIntStack, Ptr{Cint}), + stack, item, + ) + + + return nothing +end + +""" + stack::PetscIntStack = PetscIntStackCreate(petsclib::PetscLibType) +This function creates a stack. + +Not Collective, No Fortran Support + +Output Parameter: +- `stack` - The stack + +Level: developer + +-seealso: `PetscIntStackDestroy()`, `PetscIntStackEmpty()`, `PetscIntStackPush()`, `PetscIntStackPop()`, `PetscIntStackTop()` + +# External Links +$(_doc_external("Sys/PetscIntStackCreate")) +""" +function PetscIntStackCreate(petsclib::PetscLibType) end + +@for_petsc function PetscIntStackCreate(petsclib::$UnionPetscLib) + stack_ = Ref{$PetscIntStack}() + + @chk ccall( + (:PetscIntStackCreate, $petsc_library), + PetscErrorCode, + (Ptr{$PetscIntStack},), + stack_, + ) + + stack = stack_[] + + return stack +end + diff --git a/src/autowrapped/PetscKDTree_wrappers.jl b/src/autowrapped/PetscKDTree_wrappers.jl new file mode 100644 index 00000000..05e9fd52 --- /dev/null +++ b/src/autowrapped/PetscKDTree_wrappers.jl @@ -0,0 +1,147 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscKDTree end +const PetscKDTree = Ptr{_n_PetscKDTree} + +# ------------------------------------------------------- +""" + PetscKDTreeDestroy(petsclib::PetscLibType,tree::PetscKDTree) +destroy a `PetscKDTree` + +Not Collective, No Fortran Support + +Input Parameters: +- `tree` - tree to destroy + +Level: advanced + +-seealso: `PetscKDTree`, `PetscKDTreeCreate()` + +# External Links +$(_doc_external("Vec/PetscKDTreeDestroy")) +""" +function PetscKDTreeDestroy(petsclib::PetscLibType, tree::PetscKDTree) end + +@for_petsc function PetscKDTreeDestroy(petsclib::$UnionPetscLib, tree::PetscKDTree ) + + @chk ccall( + (:PetscKDTreeDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscKDTree},), + tree, + ) + + + return nothing +end + +""" + new_tree::PetscKDTree = PetscKDTreeCreate(petsclib::PetscLibType,num_coords::PetscCount, dim::PetscInt, coords::Vector{PetscReal}, copy_mode::PetscCopyMode, max_bucket_size::PetscInt) +create a `PetscKDTree` + +Not Collective, No Fortran Support + +Input Parameters: +- `num_coords` - number of coordinate points to build the `PetscKDTree` +- `dim` - the dimension of the coordinates +- `coords` - array of the coordinates, in point-major order +- `copy_mode` - behavior handling `coords`, `PETSC_COPY_VALUES` generally more performant +- `max_bucket_size` - maximum number of points stored at each leaf + +Output Parameter: +- `new_tree` - the resulting `PetscKDTree` + +Level: advanced + +-seealso: `PetscKDTree`, `PetscKDTreeDestroy()`, `PetscKDTreeQueryPointsNearestNeighbor()` + +# External Links +$(_doc_external("Vec/PetscKDTreeCreate")) +""" +function PetscKDTreeCreate(petsclib::PetscLibType, num_coords::PetscCount, dim::PetscInt, coords::Vector{PetscReal}, copy_mode::PetscCopyMode, max_bucket_size::PetscInt) end + +@for_petsc function PetscKDTreeCreate(petsclib::$UnionPetscLib, num_coords::PetscCount, dim::$PetscInt, coords::Vector{$PetscReal}, copy_mode::PetscCopyMode, max_bucket_size::$PetscInt ) + new_tree_ = Ref{PetscKDTree}() + + @chk ccall( + (:PetscKDTreeCreate, $petsc_library), + PetscErrorCode, + (PetscCount, $PetscInt, Ptr{$PetscReal}, PetscCopyMode, $PetscInt, Ptr{PetscKDTree}), + num_coords, dim, coords, copy_mode, max_bucket_size, new_tree_, + ) + + new_tree = new_tree_[] + + return new_tree +end + +""" + distances::Vector{PetscReal} = PetscKDTreeQueryPointsNearestNeighbor(petsclib::PetscLibType,tree::PetscKDTree, num_points::PetscCount, points::Vector{PetscReal}, tolerance::PetscReal, indices::Vector{PetscCount}) +find the nearest neighbor in a `PetscKDTree` + +Not Collective, No Fortran Support + +Input Parameters: +- `tree` - tree to query +- `num_points` - number of points to query +- `points` - array of the coordinates, in point-major order +- `tolerance` - tolerance for nearest neighbor + +Output Parameters: +- `indices` - indices of the nearest neighbor to the query point +- `distances` - distance between the queried point and the nearest neighbor + +Level: advanced + +-seealso: `PetscKDTree`, `PetscKDTreeCreate()` + +# External Links +$(_doc_external("Vec/PetscKDTreeQueryPointsNearestNeighbor")) +""" +function PetscKDTreeQueryPointsNearestNeighbor(petsclib::PetscLibType, tree::PetscKDTree, num_points::PetscCount, points::Vector{PetscReal}, tolerance::PetscReal, indices::Vector{PetscCount}) end + +@for_petsc function PetscKDTreeQueryPointsNearestNeighbor(petsclib::$UnionPetscLib, tree::PetscKDTree, num_points::PetscCount, points::Vector{$PetscReal}, tolerance::$PetscReal, indices::Vector{PetscCount} ) + distances = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscKDTreeQueryPointsNearestNeighbor, $petsc_library), + PetscErrorCode, + (PetscKDTree, PetscCount, Ptr{$PetscReal}, $PetscReal, Ptr{PetscCount}, Ptr{$PetscReal}), + tree, num_points, points, tolerance, indices, distances, + ) + + + return distances +end + +""" + PetscKDTreeView(petsclib::PetscLibType,tree::PetscKDTree, viewer::PetscViewer) +view a `PetscKDTree` + +Not Collective, No Fortran Support + +Input Parameters: +- `tree` - tree to view +- `viewer` - visualization context + +Level: advanced + +-seealso: `PetscKDTree`, `PetscKDTreeCreate()`, `PetscViewer` + +# External Links +$(_doc_external("Vec/PetscKDTreeView")) +""" +function PetscKDTreeView(petsclib::PetscLibType, tree::PetscKDTree, viewer::PetscViewer) end + +@for_petsc function PetscKDTreeView(petsclib::$UnionPetscLib, tree::PetscKDTree, viewer::PetscViewer ) + + @chk ccall( + (:PetscKDTreeView, $petsc_library), + PetscErrorCode, + (PetscKDTree, PetscViewer), + tree, viewer, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscLayout_wrappers.jl b/src/autowrapped/PetscLayout_wrappers.jl new file mode 100644 index 00000000..239e930a --- /dev/null +++ b/src/autowrapped/PetscLayout_wrappers.jl @@ -0,0 +1,718 @@ +# autodefined type arguments for class ------ +# ------------------------------------------------------- +""" + map::PetscLayout = PetscLayoutCreate(petsclib::PetscLibType,comm::MPI_Comm) +Allocates `PetscLayout` object + +Collective + +Input Parameter: +- `comm` - the MPI communicator + +Output Parameter: +- `map` - the new `PetscLayout` + +Level: advanced + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutSetLocalSize()`, `PetscLayoutSetSize()`, `PetscLayoutGetSize()`, `PetscLayoutGetLocalSize()`, +`PetscLayout`, `PetscLayoutDestroy()`, +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetBlockSize()`, `PetscLayoutSetUp()`, +`PetscLayoutCreateFromSizes()` + +# External Links +$(_doc_external("Vec/PetscLayoutCreate")) +""" +function PetscLayoutCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscLayoutCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + map_ = Ref{PetscLayout}() + + @chk ccall( + (:PetscLayoutCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscLayout}), + comm, map_, + ) + + map = map_[] + + return map +end + +""" + map::PetscLayout = PetscLayoutCreateFromSizes(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt, bs::PetscInt) +Allocates `PetscLayout` object and sets the layout sizes, and sets the layout up. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `n` - the local size (or `PETSC_DECIDE`) +- `N` - the global size (or `PETSC_DECIDE`) +- `bs` - the block size (or `PETSC_DECIDE`) + +Output Parameter: +- `map` - the new `PetscLayout` + +Level: advanced + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetLocalSize()`, `PetscLayoutSetSize()`, `PetscLayoutGetSize()`, `PetscLayoutGetLocalSize()`, `PetscLayout`, `PetscLayoutDestroy()`, +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetBlockSize()`, `PetscLayoutSetUp()`, `PetscLayoutCreateFromRanges()` + +# External Links +$(_doc_external("Vec/PetscLayoutCreateFromSizes")) +""" +function PetscLayoutCreateFromSizes(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt, bs::PetscInt) end + +@for_petsc function PetscLayoutCreateFromSizes(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt, bs::$PetscInt ) + map_ = Ref{PetscLayout}() + + @chk ccall( + (:PetscLayoutCreateFromSizes, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, $PetscInt, $PetscInt, Ptr{PetscLayout}), + comm, n, N, bs, map_, + ) + + map = map_[] + + return map +end + +""" + PetscLayoutDestroy(petsclib::PetscLibType,map::PetscLayout) +Frees a `PetscLayout` object and frees its range if that exists. + +Collective + +Input Parameter: +- `map` - the `PetscLayout` + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutSetLocalSize()`, `PetscLayoutSetSize()`, `PetscLayoutGetSize()`, `PetscLayoutGetLocalSize()`, +`PetscLayout`, `PetscLayoutCreate()`, +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetBlockSize()`, `PetscLayoutSetUp()` + +# External Links +$(_doc_external("Vec/PetscLayoutDestroy")) +""" +function PetscLayoutDestroy(petsclib::PetscLibType, map::PetscLayout) end + +@for_petsc function PetscLayoutDestroy(petsclib::$UnionPetscLib, map::PetscLayout ) + + @chk ccall( + (:PetscLayoutDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscLayout},), + map, + ) + + + return nothing +end + +""" + newmap::PetscLayout = PetscLayoutCreateFromRanges(petsclib::PetscLibType,comm::MPI_Comm, range::Vector{PetscInt}, mode::PetscCopyMode, bs::PetscInt) +Creates a new `PetscLayout` with the given ownership ranges and sets it up. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `range` - the array of ownership ranges for each rank with length commsize+1 +- `mode` - the copy mode for range +- `bs` - the block size (or `PETSC_DECIDE`) + +Output Parameter: +- `newmap` - the new `PetscLayout` + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetLocalSize()`, `PetscLayoutSetSize()`, `PetscLayoutGetSize()`, +`PetscLayoutGetLocalSize()`, `PetscLayout`, `PetscLayoutDestroy()`, +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetBlockSize()`, `PetscLayoutSetUp()`, `PetscLayoutCreateFromSizes()` + +# External Links +$(_doc_external("Vec/PetscLayoutCreateFromRanges")) +""" +function PetscLayoutCreateFromRanges(petsclib::PetscLibType, comm::MPI_Comm, range::Vector{PetscInt}, mode::PetscCopyMode, bs::PetscInt) end + +@for_petsc function PetscLayoutCreateFromRanges(petsclib::$UnionPetscLib, comm::MPI_Comm, range::Vector{$PetscInt}, mode::PetscCopyMode, bs::$PetscInt ) + newmap_ = Ref{PetscLayout}() + + @chk ccall( + (:PetscLayoutCreateFromRanges, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{$PetscInt}, PetscCopyMode, $PetscInt, Ptr{PetscLayout}), + comm, range, mode, bs, newmap_, + ) + + newmap = newmap_[] + + return newmap +end + +""" + PetscLayoutSetUp(petsclib::PetscLibType,map::PetscLayout) +given a map where you have set either the global or local +size sets up the map so that it may be used. + +Collective + +Input Parameter: +- `map` - pointer to the map + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutSetLocalSize()`, `PetscLayoutSetSize()`, `PetscLayoutGetSize()`, `PetscLayoutGetLocalSize()`, +`PetscLayout`, `PetscLayoutDestroy()`, +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetBlockSize()`, `PetscLayoutCreate()`, `PetscSplitOwnership()` + +# External Links +$(_doc_external("Vec/PetscLayoutSetUp")) +""" +function PetscLayoutSetUp(petsclib::PetscLibType, map::PetscLayout) end + +@for_petsc function PetscLayoutSetUp(petsclib::$UnionPetscLib, map::PetscLayout ) + + @chk ccall( + (:PetscLayoutSetUp, $petsc_library), + PetscErrorCode, + (PetscLayout,), + map, + ) + + + return nothing +end + +""" + out::PetscLayout = PetscLayoutDuplicate(petsclib::PetscLibType,in::PetscLayout) +creates a new `PetscLayout` with the same information as a given one. If the `PetscLayout` already exists it is destroyed first. + +Collective + +Input Parameter: +- `in` - input `PetscLayout` to be duplicated + +Output Parameter: +- `out` - the copy + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutDestroy()`, `PetscLayoutSetUp()`, `PetscLayoutReference()` + +# External Links +$(_doc_external("Vec/PetscLayoutDuplicate")) +""" +function PetscLayoutDuplicate(petsclib::PetscLibType, in::PetscLayout) end + +@for_petsc function PetscLayoutDuplicate(petsclib::$UnionPetscLib, in::PetscLayout ) + out_ = Ref{PetscLayout}() + + @chk ccall( + (:PetscLayoutDuplicate, $petsc_library), + PetscErrorCode, + (PetscLayout, Ptr{PetscLayout}), + in, out_, + ) + + out = out_[] + + return out +end + +""" + PetscLayoutReference(petsclib::PetscLibType,in::PetscLayout, out::PetscLayout) +Causes a PETSc `Vec` or `Mat` to share a `PetscLayout` with one that already exists. + +Collective + +Input Parameter: +- `in` - input `PetscLayout` to be copied + +Output Parameter: +- `out` - the reference location + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutDestroy()`, `PetscLayoutSetUp()`, `PetscLayoutDuplicate()` + +# External Links +$(_doc_external("Vec/PetscLayoutReference")) +""" +function PetscLayoutReference(petsclib::PetscLibType, in::PetscLayout, out::PetscLayout) end + +@for_petsc function PetscLayoutReference(petsclib::$UnionPetscLib, in::PetscLayout, out::PetscLayout ) + + @chk ccall( + (:PetscLayoutReference, $petsc_library), + PetscErrorCode, + (PetscLayout, Ptr{PetscLayout}), + in, out, + ) + + + return nothing +end + +""" + PetscLayoutSetISLocalToGlobalMapping(petsclib::PetscLibType,in::PetscLayout, ltog::ISLocalToGlobalMapping) +sets a `ISLocalGlobalMapping` into a `PetscLayout` + +Collective + +Input Parameters: +- `in` - input `PetscLayout` +- `ltog` - the local to global mapping + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutDestroy()`, `PetscLayoutSetUp()`, `PetscLayoutDuplicate()` + +# External Links +$(_doc_external("Vec/PetscLayoutSetISLocalToGlobalMapping")) +""" +function PetscLayoutSetISLocalToGlobalMapping(petsclib::PetscLibType, in::PetscLayout, ltog::ISLocalToGlobalMapping) end + +@for_petsc function PetscLayoutSetISLocalToGlobalMapping(petsclib::$UnionPetscLib, in::PetscLayout, ltog::ISLocalToGlobalMapping ) + + @chk ccall( + (:PetscLayoutSetISLocalToGlobalMapping, $petsc_library), + PetscErrorCode, + (PetscLayout, ISLocalToGlobalMapping), + in, ltog, + ) + + + return nothing +end + +""" + PetscLayoutSetLocalSize(petsclib::PetscLibType,map::PetscLayout, n::PetscInt) +Sets the local size for a `PetscLayout` object. + +Collective + +Input Parameters: +- `map` - pointer to the map +- `n` - the local size, pass `PETSC_DECIDE` (the default) to have this value determined by the global size set with `PetscLayoutSetSize()` + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetSize()`, `PetscLayoutGetSize()`, `PetscLayoutGetLocalSize()`, `PetscLayoutSetUp()` +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetBlockSize()` + +# External Links +$(_doc_external("Vec/PetscLayoutSetLocalSize")) +""" +function PetscLayoutSetLocalSize(petsclib::PetscLibType, map::PetscLayout, n::PetscInt) end + +@for_petsc function PetscLayoutSetLocalSize(petsclib::$UnionPetscLib, map::PetscLayout, n::$PetscInt ) + + @chk ccall( + (:PetscLayoutSetLocalSize, $petsc_library), + PetscErrorCode, + (PetscLayout, $PetscInt), + map, n, + ) + + + return nothing +end + +""" + n::PetscInt = PetscLayoutGetLocalSize(petsclib::PetscLibType,map::PetscLayout) +Gets the local size for a `PetscLayout` object. + +Not Collective + +Input Parameter: +- `map` - pointer to the map + +Output Parameter: +- `n` - the local size + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetSize()`, `PetscLayoutGetSize()`, `PetscLayoutSetUp()` +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetBlockSize()` + +# External Links +$(_doc_external("Vec/PetscLayoutGetLocalSize")) +""" +function PetscLayoutGetLocalSize(petsclib::PetscLibType, map::PetscLayout) end + +@for_petsc function PetscLayoutGetLocalSize(petsclib::$UnionPetscLib, map::PetscLayout ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscLayoutGetLocalSize, $petsc_library), + PetscErrorCode, + (PetscLayout, Ptr{$PetscInt}), + map, n_, + ) + + n = n_[] + + return n +end + +""" + PetscLayoutSetSize(petsclib::PetscLibType,map::PetscLayout, n::PetscInt) +Sets the global size for a `PetscLayout` object. + +Logically Collective + +Input Parameters: +- `map` - pointer to the map +- `n` - the global size, use `PETSC_DETERMINE` (the default) to have this value computed as the sum of the local sizes set with `PetscLayoutSetLocalSize()` + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetLocalSize()`, `PetscLayoutGetLocalSize()`, `PetscLayoutGetSize()`, `PetscLayoutSetUp()` +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetBlockSize()` + +# External Links +$(_doc_external("Vec/PetscLayoutSetSize")) +""" +function PetscLayoutSetSize(petsclib::PetscLibType, map::PetscLayout, n::PetscInt) end + +@for_petsc function PetscLayoutSetSize(petsclib::$UnionPetscLib, map::PetscLayout, n::$PetscInt ) + + @chk ccall( + (:PetscLayoutSetSize, $petsc_library), + PetscErrorCode, + (PetscLayout, $PetscInt), + map, n, + ) + + + return nothing +end + +""" + n::PetscInt = PetscLayoutGetSize(petsclib::PetscLibType,map::PetscLayout) +Gets the global size for a `PetscLayout` object. + +Not Collective + +Input Parameter: +- `map` - pointer to the map + +Output Parameter: +- `n` - the global size + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetLocalSize()`, `PetscLayoutGetLocalSize()`, `PetscLayoutSetSize()`, `PetscLayoutSetUp()` +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetBlockSize()` + +# External Links +$(_doc_external("Vec/PetscLayoutGetSize")) +""" +function PetscLayoutGetSize(petsclib::PetscLibType, map::PetscLayout) end + +@for_petsc function PetscLayoutGetSize(petsclib::$UnionPetscLib, map::PetscLayout ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscLayoutGetSize, $petsc_library), + PetscErrorCode, + (PetscLayout, Ptr{$PetscInt}), + map, n_, + ) + + n = n_[] + + return n +end + +""" + PetscLayoutSetBlockSize(petsclib::PetscLibType,map::PetscLayout, bs::PetscInt) +Sets the block size for a `PetscLayout` object. + +Logically Collective + +Input Parameters: +- `map` - pointer to the map +- `bs` - the size + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetLocalSize()`, `PetscLayoutGetLocalSize()`, `PetscLayoutGetBlockSize()`, +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetSize()`, `PetscLayoutGetSize()`, `PetscLayoutSetUp()` + +# External Links +$(_doc_external("Vec/PetscLayoutSetBlockSize")) +""" +function PetscLayoutSetBlockSize(petsclib::PetscLibType, map::PetscLayout, bs::PetscInt) end + +@for_petsc function PetscLayoutSetBlockSize(petsclib::$UnionPetscLib, map::PetscLayout, bs::$PetscInt ) + + @chk ccall( + (:PetscLayoutSetBlockSize, $petsc_library), + PetscErrorCode, + (PetscLayout, $PetscInt), + map, bs, + ) + + + return nothing +end + +""" + bs::PetscInt = PetscLayoutGetBlockSize(petsclib::PetscLibType,map::PetscLayout) +Gets the block size for a `PetscLayout` object. + +Not Collective + +Input Parameter: +- `map` - pointer to the map + +Output Parameter: +- `bs` - the size + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetLocalSize()`, `PetscLayoutGetLocalSize()`, `PetscLayoutSetSize()`, `PetscLayoutSetUp()` +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetSize()` + +# External Links +$(_doc_external("Vec/PetscLayoutGetBlockSize")) +""" +function PetscLayoutGetBlockSize(petsclib::PetscLibType, map::PetscLayout) end + +@for_petsc function PetscLayoutGetBlockSize(petsclib::$UnionPetscLib, map::PetscLayout ) + bs_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscLayoutGetBlockSize, $petsc_library), + PetscErrorCode, + (PetscLayout, Ptr{$PetscInt}), + map, bs_, + ) + + bs = bs_[] + + return bs +end + +""" + rstart::PetscInt,rend_::PetscInt = PetscLayoutGetRange(petsclib::PetscLibType,map::PetscLayout) +gets the range of values owned by this process + +Not Collective + +Input Parameter: +- `map` - pointer to the map + +Output Parameters: +- `rstart` - first index owned by this process +- `rend` - one more than the last index owned by this process + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetLocalSize()`, `PetscLayoutGetLocalSize()`, `PetscLayoutSetSize()`, +`PetscLayoutGetSize()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutSetUp()` + +# External Links +$(_doc_external("Vec/PetscLayoutGetRange")) +""" +function PetscLayoutGetRange(petsclib::PetscLibType, map::PetscLayout) end + +@for_petsc function PetscLayoutGetRange(petsclib::$UnionPetscLib, map::PetscLayout ) + rstart_ = Ref{$PetscInt}() + rend__ = Ref{$PetscInt}() + + @chk ccall( + (:PetscLayoutGetRange, $petsc_library), + PetscErrorCode, + (PetscLayout, Ptr{$PetscInt}, Ptr{$PetscInt}), + map, rstart_, rend__, + ) + + rstart = rstart_[] + rend_ = rend__[] + + return rstart,rend_ +end + +""" + range::Vector{PetscInt} = PetscLayoutGetRanges(petsclib::PetscLibType,map::PetscLayout) +gets the ranges of values owned by all processes + +Not Collective + +Input Parameter: +- `map` - pointer to the map + +Output Parameter: +- `range` - start of each processors range of indices (the final entry is one more than the +last index on the last process). The length of the array is one more than the number of processes in the MPI +communicator owned by `map` + +Level: developer + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetLocalSize()`, `PetscLayoutGetLocalSize()`, `PetscLayoutSetSize()`, +`PetscLayoutGetSize()`, `PetscLayoutGetRange()`, `PetscLayoutSetBlockSize()`, `PetscLayoutSetUp()` + +# External Links +$(_doc_external("Vec/PetscLayoutGetRanges")) +""" +function PetscLayoutGetRanges(petsclib::PetscLibType, map::PetscLayout) end + +@for_petsc function PetscLayoutGetRanges(petsclib::$UnionPetscLib, map::PetscLayout ) + range_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscLayoutGetRanges, $petsc_library), + PetscErrorCode, + (PetscLayout, Ptr{Ptr{$PetscInt}}), + map, range_, + ) + + range = unsafe_wrap(Array, range_[], VecGetLocalSize(petsclib, x); own = false) + + return range +end + +""" + congruent::PetscBool = PetscLayoutCompare(petsclib::PetscLibType,mapa::PetscLayout, mapb::PetscLayout) +Compares two layouts + +Not Collective + +Input Parameters: +- `mapa` - pointer to the first map +- `mapb` - pointer to the second map + +Output Parameter: +- `congruent` - `PETSC_TRUE` if the two layouts are congruent, `PETSC_FALSE` otherwise + +Level: beginner + +-seealso: [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetLocalSize()`, `PetscLayoutGetLocalSize()`, `PetscLayoutGetBlockSize()`, +`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetSize()`, `PetscLayoutGetSize()`, `PetscLayoutSetUp()` + +# External Links +$(_doc_external("Vec/PetscLayoutCompare")) +""" +function PetscLayoutCompare(petsclib::PetscLibType, mapa::PetscLayout, mapb::PetscLayout) end + +@for_petsc function PetscLayoutCompare(petsclib::$UnionPetscLib, mapa::PetscLayout, mapb::PetscLayout ) + congruent_ = Ref{PetscBool}() + + @chk ccall( + (:PetscLayoutCompare, $petsc_library), + PetscErrorCode, + (PetscLayout, PetscLayout, Ptr{PetscBool}), + mapa, mapb, congruent_, + ) + + congruent = congruent_[] + + return congruent +end + +""" + PetscLayoutFindOwner(petsclib::PetscLibType,map::PetscLayout, idx::PetscInt, owner::PetscMPIInt) +Find the owning MPI process for a global index + +Not Collective; No Fortran Support + +Input Parameters: +- `map` - the layout +- `idx` - global index to find the owner of + +Output Parameter: +- `owner` - the owning rank + +Level: developer + +-seealso: `PetscLayout`, `PetscLayoutFindOwnerIndex()` + +# External Links +$(_doc_external("Vec/PetscLayoutFindOwner")) +""" +function PetscLayoutFindOwner(petsclib::PetscLibType, map::PetscLayout, idx::PetscInt, owner::PetscMPIInt) end + +@for_petsc function PetscLayoutFindOwner(petsclib::$UnionPetscLib, map::PetscLayout, idx::$PetscInt, owner::PetscMPIInt ) + + @chk ccall( + (:PetscLayoutFindOwner, $petsc_library), + PetscErrorCode, + (PetscLayout, $PetscInt, Ptr{PetscMPIInt}), + map, idx, owner, + ) + + + return nothing +end + +""" + lidx::PetscInt = PetscLayoutFindOwnerIndex(petsclib::PetscLibType,map::PetscLayout, idx::PetscInt, owner::PetscMPIInt) +Find the owning MPI process and the local index on that process for a global index + +Not Collective; No Fortran Support + +Input Parameters: +- `map` - the layout +- `idx` - global index to find the owner of + +Output Parameters: +- `owner` - the owning rank +- `lidx` - local index used by the owner for `idx` + +Level: developer + +-seealso: `PetscLayout`, `PetscLayoutFindOwner()` + +# External Links +$(_doc_external("Vec/PetscLayoutFindOwnerIndex")) +""" +function PetscLayoutFindOwnerIndex(petsclib::PetscLibType, map::PetscLayout, idx::PetscInt, owner::PetscMPIInt) end + +@for_petsc function PetscLayoutFindOwnerIndex(petsclib::$UnionPetscLib, map::PetscLayout, idx::$PetscInt, owner::PetscMPIInt ) + lidx_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscLayoutFindOwnerIndex, $petsc_library), + PetscErrorCode, + (PetscLayout, $PetscInt, Ptr{PetscMPIInt}, Ptr{$PetscInt}), + map, idx, owner, lidx_, + ) + + lidx = lidx_[] + + return lidx +end + +""" + on::PetscInt,oidxs::Vector{PetscInt},ogidxs::Vector{PetscInt} = PetscLayoutMapLocal(petsclib::PetscLibType,map::PetscLayout, N::PetscInt, idxs::Vector{PetscInt}) + +# External Links +$(_doc_external("Vec/PetscLayoutMapLocal")) +""" +function PetscLayoutMapLocal(petsclib::PetscLibType, map::PetscLayout, N::PetscInt, idxs::Vector{PetscInt}) end + +@for_petsc function PetscLayoutMapLocal(petsclib::$UnionPetscLib, map::PetscLayout, N::$PetscInt, idxs::Vector{$PetscInt} ) + on_ = Ref{$PetscInt}() + oidxs_ = Ref{Ptr{$PetscInt}}() + ogidxs_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscLayoutMapLocal, $petsc_library), + PetscErrorCode, + (PetscLayout, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + map, N, idxs, on_, oidxs_, ogidxs_, + ) + + on = on_[] + oidxs = unsafe_wrap(Array, oidxs_[], VecGetLocalSize(petsclib, x); own = false) + ogidxs = unsafe_wrap(Array, ogidxs_[], VecGetLocalSize(petsclib, x); own = false) + + return on,oidxs,ogidxs +end + diff --git a/src/autowrapped/PetscLimiter_wrappers.jl b/src/autowrapped/PetscLimiter_wrappers.jl new file mode 100644 index 00000000..0eb2ccb2 --- /dev/null +++ b/src/autowrapped/PetscLimiter_wrappers.jl @@ -0,0 +1,335 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscLimiter end +const PetscLimiter = Ptr{_n_PetscLimiter} + +# ------------------------------------------------------- +""" + PetscLimiterRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new `PetscLimiter` implementation + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine + +-seealso: `PetscLimiter`, `PetscLimiterType`, `PetscLimiterRegisterAll()`, `PetscLimiterRegisterDestroy()` + +# External Links +$(_doc_external("DM/PetscLimiterRegister")) +""" +function PetscLimiterRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscLimiterRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscLimiterRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscLimiterSetType(petsclib::PetscLibType,lim::PetscLimiter, name::PetscLimiterType) +Builds a `PetscLimiter` for a given `PetscLimiterType` + +Collective + +Input Parameters: +- `lim` - The `PetscLimiter` object +- `name` - The kind of limiter + +Options Database Key: +- `-petsclimiter_type ` - Sets the PetscLimiter type; use -help for a list of available types + +Level: intermediate + +-seealso: `PetscLimiter`, `PetscLimiterType`, `PetscLimiterGetType()`, `PetscLimiterCreate()` + +# External Links +$(_doc_external("DM/PetscLimiterSetType")) +""" +function PetscLimiterSetType(petsclib::PetscLibType, lim::PetscLimiter, name::PetscLimiterType) end + +@for_petsc function PetscLimiterSetType(petsclib::$UnionPetscLib, lim::PetscLimiter, name::PetscLimiterType ) + + @chk ccall( + (:PetscLimiterSetType, $petsc_library), + PetscErrorCode, + (PetscLimiter, PetscLimiterType), + lim, name, + ) + + + return nothing +end + +""" + name::PetscLimiterType = PetscLimiterGetType(petsclib::PetscLibType,lim::PetscLimiter) +Gets the `PetscLimiterType` name (as a string) from the `PetscLimiter`. + +Not Collective + +Input Parameter: +- `lim` - The `PetscLimiter` + +Output Parameter: +- `name` - The `PetscLimiterType` + +Level: intermediate + +-seealso: `PetscLimiter`, `PetscLimiterType`, `PetscLimiterSetType()`, `PetscLimiterCreate()` + +# External Links +$(_doc_external("DM/PetscLimiterGetType")) +""" +function PetscLimiterGetType(petsclib::PetscLibType, lim::PetscLimiter) end + +@for_petsc function PetscLimiterGetType(petsclib::$UnionPetscLib, lim::PetscLimiter ) + name_ = Ref{PetscLimiterType}() + + @chk ccall( + (:PetscLimiterGetType, $petsc_library), + PetscErrorCode, + (PetscLimiter, Ptr{PetscLimiterType}), + lim, name_, + ) + + name = unsafe_string(name_[]) + + return name +end + +""" + PetscLimiterViewFromOptions(petsclib::PetscLibType,A::PetscLimiter, obj::PetscObject, name::String) +View a `PetscLimiter` based on values in the options database + +Collective + +Input Parameters: +- `A` - the `PetscLimiter` object to view +- `obj` - Optional object that provides the options prefix to use +- `name` - command line option name + +Level: intermediate + +-seealso: `PetscLimiter`, `PetscLimiterView()`, `PetscObjectViewFromOptions()`, `PetscLimiterCreate()` + +# External Links +$(_doc_external("DM/PetscLimiterViewFromOptions")) +""" +function PetscLimiterViewFromOptions(petsclib::PetscLibType, A::PetscLimiter, obj::PetscObject, name::String) end + +@for_petsc function PetscLimiterViewFromOptions(petsclib::$UnionPetscLib, A::PetscLimiter, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscLimiterViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscLimiter, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscLimiterView(petsclib::PetscLibType,lim::PetscLimiter, v::PetscViewer) +Views a `PetscLimiter` + +Collective + +Input Parameters: +- `lim` - the `PetscLimiter` object to view +- `v` - the viewer + +Level: beginner + +-seealso: `PetscLimiter`, `PetscViewer`, `PetscLimiterDestroy()`, `PetscLimiterViewFromOptions()` + +# External Links +$(_doc_external("DM/PetscLimiterView")) +""" +function PetscLimiterView(petsclib::PetscLibType, lim::PetscLimiter, v::PetscViewer) end + +@for_petsc function PetscLimiterView(petsclib::$UnionPetscLib, lim::PetscLimiter, v::PetscViewer ) + + @chk ccall( + (:PetscLimiterView, $petsc_library), + PetscErrorCode, + (PetscLimiter, PetscViewer), + lim, v, + ) + + + return nothing +end + +""" + PetscLimiterSetFromOptions(petsclib::PetscLibType,lim::PetscLimiter) +sets parameters in a `PetscLimiter` from the options database + +Collective + +Input Parameter: +- `lim` - the `PetscLimiter` object to set options for + +Level: intermediate + +-seealso: `PetscLimiter`, `PetscLimiterView()` + +# External Links +$(_doc_external("DM/PetscLimiterSetFromOptions")) +""" +function PetscLimiterSetFromOptions(petsclib::PetscLibType, lim::PetscLimiter) end + +@for_petsc function PetscLimiterSetFromOptions(petsclib::$UnionPetscLib, lim::PetscLimiter ) + + @chk ccall( + (:PetscLimiterSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscLimiter,), + lim, + ) + + + return nothing +end + +""" + PetscLimiterSetUp(petsclib::PetscLibType,lim::PetscLimiter) +Construct data structures for the `PetscLimiter` + +Collective + +Input Parameter: +- `lim` - the `PetscLimiter` object to setup + +Level: intermediate + +-seealso: `PetscLimiter`, `PetscLimiterView()`, `PetscLimiterDestroy()` + +# External Links +$(_doc_external("DM/PetscLimiterSetUp")) +""" +function PetscLimiterSetUp(petsclib::PetscLibType, lim::PetscLimiter) end + +@for_petsc function PetscLimiterSetUp(petsclib::$UnionPetscLib, lim::PetscLimiter ) + + @chk ccall( + (:PetscLimiterSetUp, $petsc_library), + PetscErrorCode, + (PetscLimiter,), + lim, + ) + + + return nothing +end + +""" + PetscLimiterDestroy(petsclib::PetscLibType,lim::PetscLimiter) +Destroys a `PetscLimiter` object + +Collective + +Input Parameter: +- `lim` - the `PetscLimiter` object to destroy + +Level: beginner + +-seealso: `PetscLimiter`, `PetscLimiterView()` + +# External Links +$(_doc_external("DM/PetscLimiterDestroy")) +""" +function PetscLimiterDestroy(petsclib::PetscLibType, lim::PetscLimiter) end + +@for_petsc function PetscLimiterDestroy(petsclib::$UnionPetscLib, lim::PetscLimiter ) + + @chk ccall( + (:PetscLimiterDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscLimiter},), + lim, + ) + + + return nothing +end + +""" + lim::PetscLimiter = PetscLimiterCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty `PetscLimiter` object. The type can then be set with `PetscLimiterSetType()`. + +Collective + +Input Parameter: +- `comm` - The communicator for the `PetscLimiter` object + +Output Parameter: +- `lim` - The `PetscLimiter` object + +Level: beginner + +-seealso: `PetscLimiter`, `PetscLimiterType`, `PetscLimiterSetType()`, `PETSCLIMITERSIN` + +# External Links +$(_doc_external("DM/PetscLimiterCreate")) +""" +function PetscLimiterCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscLimiterCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + lim_ = Ref{PetscLimiter}() + + @chk ccall( + (:PetscLimiterCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscLimiter}), + comm, lim_, + ) + + lim = lim_[] + + return lim +end + +""" + phi::PetscReal = PetscLimiterLimit(petsclib::PetscLibType,lim::PetscLimiter, flim::PetscReal) +Limit the flux + +Input Parameters: +- `lim` - The `PetscLimiter` +- `flim` - The input field + +Output Parameter: +- `phi` - The limited field + +Level: beginner + +-seealso: `PetscLimiter`, `PetscLimiterType`, `PetscLimiterSetType()`, `PetscLimiterCreate()` + +# External Links +$(_doc_external("DM/PetscLimiterLimit")) +""" +function PetscLimiterLimit(petsclib::PetscLibType, lim::PetscLimiter, flim::PetscReal) end + +@for_petsc function PetscLimiterLimit(petsclib::$UnionPetscLib, lim::PetscLimiter, flim::$PetscReal ) + phi_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscLimiterLimit, $petsc_library), + PetscErrorCode, + (PetscLimiter, $PetscReal, Ptr{$PetscReal}), + lim, flim, phi_, + ) + + phi = phi_[] + + return phi +end + diff --git a/src/autowrapped/PetscLog_wrappers.jl b/src/autowrapped/PetscLog_wrappers.jl new file mode 100644 index 00000000..2efe94a3 --- /dev/null +++ b/src/autowrapped/PetscLog_wrappers.jl @@ -0,0 +1,1965 @@ + +""" + PetscLogHandlerStart(petsclib::PetscLibType,h::PetscLogHandler) +Connect a log handler to PETSc's global logging stream and state. + +Logically collective + +Input Parameters: +- `h` - a `PetscLogHandler` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogState`, `PetscLogHandlerStop()`, `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerStart")) +""" +function PetscLogHandlerStart(petsclib::PetscLibType, h::PetscLogHandler) end + +@for_petsc function PetscLogHandlerStart(petsclib::$UnionPetscLib, h::PetscLogHandler ) + + @chk ccall( + (:PetscLogHandlerStart, $petsc_library), + PetscErrorCode, + (PetscLogHandler,), + h, + ) + + + return nothing +end + +""" + PetscLogHandlerStop(petsclib::PetscLibType,h::PetscLogHandler) +Disconnect a log handler from PETSc's global logging stream. + +Logically collective + +Input Parameters: +- `h` - a `PetscLogHandler` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogState`, `PetscLogHandlerStart()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerStop")) +""" +function PetscLogHandlerStop(petsclib::PetscLibType, h::PetscLogHandler) end + +@for_petsc function PetscLogHandlerStop(petsclib::$UnionPetscLib, h::PetscLogHandler ) + + @chk ccall( + (:PetscLogHandlerStop, $petsc_library), + PetscErrorCode, + (PetscLogHandler,), + h, + ) + + + return nothing +end + +""" + PetscLogHandlerRegister(petsclib::PetscLibType,sname::String, fnc::external) +Register a new `PetscLogHandler` + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogHandlerCreate()`, `PetscLogHandlerSetType()`, `PetscLogHandlerGetType()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerRegister")) +""" +function PetscLogHandlerRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscLogHandlerRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscLogHandlerRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscLogHandlerSetType(petsclib::PetscLibType,handler::PetscLogHandler, name::PetscLogHandlerType) +Set the type of a `PetscLogHandler` + +Input Parameters: +- `handler` - the `PetscLogHandler` +- `name` - The kind of log handler + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogHandlerCreate()`, `PetscLogHandlerRegister()`, `PetscLogHandlerGetType()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerSetType")) +""" +function PetscLogHandlerSetType(petsclib::PetscLibType, handler::PetscLogHandler, name::PetscLogHandlerType) end + +@for_petsc function PetscLogHandlerSetType(petsclib::$UnionPetscLib, handler::PetscLogHandler, name::PetscLogHandlerType ) + + @chk ccall( + (:PetscLogHandlerSetType, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogHandlerType), + handler, name, + ) + + + return nothing +end + +""" + name::PetscLogHandlerType = PetscLogHandlerGetType(petsclib::PetscLibType,handler::PetscLogHandler) +Gets the `PetscLoagHandlerType` (as a string) from the `PetscLogHandler` object. + +Not collective + +Input Parameter: +- `handler` - the `PetscLogHandler` + +Output Parameter: +- `name` - The `PetscLogHandlerType` name + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogHandlerCreate()`, `PetscLogHandlerRegister()`, `PetscLogHandlerSetType()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerGetType")) +""" +function PetscLogHandlerGetType(petsclib::PetscLibType, handler::PetscLogHandler) end + +@for_petsc function PetscLogHandlerGetType(petsclib::$UnionPetscLib, handler::PetscLogHandler ) + name_ = Ref{PetscLogHandlerType}() + + @chk ccall( + (:PetscLogHandlerGetType, $petsc_library), + PetscErrorCode, + (PetscLogHandler, Ptr{PetscLogHandlerType}), + handler, name_, + ) + + name = unsafe_string(name_[]) + + return name +end + +""" + handler::PetscLogHandler = PetscLogHandlerCreate(petsclib::PetscLibType,comm::MPI_Comm) +Create a log handler for profiling events and stages. PETSc +provides several implementations of `PetscLogHandler` that interface to different ways to +summarize or visualize profiling data: see `PetscLogHandlerType` for a list. + +Collective + +Input Parameter: +- `comm` - the communicator for synchronizing and viewing events with this handler + +Output Parameter: +- `handler` - the `PetscLogHandler` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogHandlerSetType()`, `PetscLogHandlerStart()`, `PetscLogHandlerStop()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerCreate")) +""" +function PetscLogHandlerCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscLogHandlerCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + handler_ = Ref{PetscLogHandler}() + + @chk ccall( + (:PetscLogHandlerCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscLogHandler}), + comm, handler_, + ) + + handler = handler_[] + + return handler +end + +""" + PetscLogHandlerDestroy(petsclib::PetscLibType,handler::PetscLogHandler) +Destroy a `PetscLogHandler` + +Logically collective + +Input Parameter: +- `handler` - handler to be destroyed + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogHandlerCreate()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerDestroy")) +""" +function PetscLogHandlerDestroy(petsclib::PetscLibType, handler::PetscLogHandler) end + +@for_petsc function PetscLogHandlerDestroy(petsclib::$UnionPetscLib, handler::PetscLogHandler ) + + @chk ccall( + (:PetscLogHandlerDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogHandler},), + handler, + ) + + + return nothing +end + +""" + PetscLogHandlerSetState(petsclib::PetscLibType,h::PetscLogHandler, state::PetscLogState) +Set the logging state that provides the stream of events and stages for a log handler. + +Logically collective + +Input Parameters: +- `h` - the `PetscLogHandler` +- `state` - the `PetscLogState` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogState`, `PetscLogEventBegin()`, `PetscLogHandlerStart()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerSetState")) +""" +function PetscLogHandlerSetState(petsclib::PetscLibType, h::PetscLogHandler, state::PetscLogState) end + +@for_petsc function PetscLogHandlerSetState(petsclib::$UnionPetscLib, h::PetscLogHandler, state::PetscLogState ) + + @chk ccall( + (:PetscLogHandlerSetState, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogState), + h, state, + ) + + + return nothing +end + +""" + PetscLogHandlerGetState(petsclib::PetscLibType,h::PetscLogHandler, state::PetscLogState) +Get the logging state that provides the stream of events and stages for a log handler. + +Logically collective + +Input Parameter: +- `h` - the `PetscLogHandler` + +Output Parameter: +- `state` - the `PetscLogState` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogState`, `PetscLogEventBegin()`, `PetscLogHandlerStart()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerGetState")) +""" +function PetscLogHandlerGetState(petsclib::PetscLibType, h::PetscLogHandler, state::PetscLogState) end + +@for_petsc function PetscLogHandlerGetState(petsclib::$UnionPetscLib, h::PetscLogHandler, state::PetscLogState ) + + @chk ccall( + (:PetscLogHandlerGetState, $petsc_library), + PetscErrorCode, + (PetscLogHandler, Ptr{PetscLogState}), + h, state, + ) + + + return nothing +end + +""" + PetscLogHandlerEventBegin(petsclib::PetscLibType,h::PetscLogHandler, e::PetscLogEvent, o1::PetscObject, o2::PetscObject, o3::PetscObject, o4::PetscObject) +Record the beginning of an event in a log handler + +Not collective + +Input Parameters: +- `h` - the `PetscLogHandler` +- `e` - a registered `PetscLogEvent` +- `o1` - `PetscObject` associated with the event (may be `NULL`) +- `o2` - `PetscObject` associated with the event (may be `NULL`) +- `o3` - `PetscObject` associated with the event (may be `NULL`) +- `o4` - `PetscObject` associated with the event (may be `NULL`) + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscLogEventSync()`, `PetscLogHandlerEventEnd()`, `PetscLogHandlerEventSync()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerEventBegin")) +""" +function PetscLogHandlerEventBegin(petsclib::PetscLibType, h::PetscLogHandler, e::PetscLogEvent, o1::PetscObject, o2::PetscObject, o3::PetscObject, o4::PetscObject) end + +@for_petsc function PetscLogHandlerEventBegin(petsclib::$UnionPetscLib, h::PetscLogHandler, e::PetscLogEvent, o1::PetscObject, o2::PetscObject, o3::PetscObject, o4::PetscObject ) + + @chk ccall( + (:PetscLogHandlerEventBegin, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogEvent, PetscObject, PetscObject, PetscObject, PetscObject), + h, e, o1, o2, o3, o4, + ) + + + return nothing +end + +""" + PetscLogHandlerEventEnd(petsclib::PetscLibType,h::PetscLogHandler, e::PetscLogEvent, o1::PetscObject, o2::PetscObject, o3::PetscObject, o4::PetscObject) +Record the end of an event in a log handler + +Not collective + +Input Parameters: +- `h` - the `PetscLogHandler` +- `e` - a registered `PetscLogEvent` +- `o1` - `PetscObject` associated with the event (may be `NULL`) +- `o2` - `PetscObject` associated with the event (may be `NULL`) +- `o3` - `PetscObject` associated with the event (may be `NULL`) +- `o4` - `PetscObject` associated with the event (may be `NULL`) + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscLogEventSync()`, `PetscLogHandlerEventBegin()`, `PetscLogHandlerEventSync()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerEventEnd")) +""" +function PetscLogHandlerEventEnd(petsclib::PetscLibType, h::PetscLogHandler, e::PetscLogEvent, o1::PetscObject, o2::PetscObject, o3::PetscObject, o4::PetscObject) end + +@for_petsc function PetscLogHandlerEventEnd(petsclib::$UnionPetscLib, h::PetscLogHandler, e::PetscLogEvent, o1::PetscObject, o2::PetscObject, o3::PetscObject, o4::PetscObject ) + + @chk ccall( + (:PetscLogHandlerEventEnd, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogEvent, PetscObject, PetscObject, PetscObject, PetscObject), + h, e, o1, o2, o3, o4, + ) + + + return nothing +end + +""" + PetscLogHandlerEventSync(petsclib::PetscLibType,h::PetscLogHandler, e::PetscLogEvent, comm::MPI_Comm) +Synchronize a logging event + +Collective + +Input Parameters: +- `h` - the `PetscLogHandler` +- `e` - a registered `PetscLogEvent` +- `comm` - the communicator over which to synchronize `e` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscLogEventSync()`, `PetscLogHandlerEventBegin()`, `PetscLogHandlerEventEnd()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerEventSync")) +""" +function PetscLogHandlerEventSync(petsclib::PetscLibType, h::PetscLogHandler, e::PetscLogEvent, comm::MPI_Comm) end + +@for_petsc function PetscLogHandlerEventSync(petsclib::$UnionPetscLib, h::PetscLogHandler, e::PetscLogEvent, comm::MPI_Comm ) + + @chk ccall( + (:PetscLogHandlerEventSync, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogEvent, MPI_Comm), + h, e, comm, + ) + + + return nothing +end + +""" + PetscLogHandlerObjectCreate(petsclib::PetscLibType,h::PetscLogHandler, obj::PetscObject) +Record the creation of an object in a log handler. + +Not collective + +Input Parameters: +- `h` - the `PetscLogHandler` +- `obj` - a newly created `PetscObject` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogObjectCreate()`, `PetscLogObjectDestroy()`, `PetscLogHandlerObjectDestroy()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerObjectCreate")) +""" +function PetscLogHandlerObjectCreate(petsclib::PetscLibType, h::PetscLogHandler, obj::PetscObject) end + +@for_petsc function PetscLogHandlerObjectCreate(petsclib::$UnionPetscLib, h::PetscLogHandler, obj::PetscObject ) + + @chk ccall( + (:PetscLogHandlerObjectCreate, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscObject), + h, obj, + ) + + + return nothing +end + +""" + PetscLogHandlerObjectDestroy(petsclib::PetscLibType,h::PetscLogHandler, obj::PetscObject) +Record the destruction of an object in a log handler. + +Not collective + +Input Parameters: +- `h` - the `PetscLogHandler` +- `obj` - a newly created `PetscObject` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogObjectCreate()`, `PetscLogObjectDestroy()`, `PetscLogHandlerObjectCreate()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerObjectDestroy")) +""" +function PetscLogHandlerObjectDestroy(petsclib::PetscLibType, h::PetscLogHandler, obj::PetscObject) end + +@for_petsc function PetscLogHandlerObjectDestroy(petsclib::$UnionPetscLib, h::PetscLogHandler, obj::PetscObject ) + + @chk ccall( + (:PetscLogHandlerObjectDestroy, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscObject), + h, obj, + ) + + + return nothing +end + +""" + PetscLogHandlerStagePush(petsclib::PetscLibType,h::PetscLogHandler, stage::PetscLogStage) +Begin a new logging stage in a log handler. + +Not collective + +Input Parameters: +- `h` - the `PetscLogHandler` +- `stage` - a registered `PetscLogStage` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscLogHandlerStagePop()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerStagePush")) +""" +function PetscLogHandlerStagePush(petsclib::PetscLibType, h::PetscLogHandler, stage::PetscLogStage) end + +@for_petsc function PetscLogHandlerStagePush(petsclib::$UnionPetscLib, h::PetscLogHandler, stage::PetscLogStage ) + + @chk ccall( + (:PetscLogHandlerStagePush, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogStage), + h, stage, + ) + + + return nothing +end + +""" + PetscLogHandlerStagePop(petsclib::PetscLibType,h::PetscLogHandler, stage::PetscLogStage) +End the current logging stage in a log handler. + +Not collective + +Input Parameters: +- `h` - the `PetscLogHandler` +- `stage` - a registered `PetscLogStage` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscLogHandlerStagePush()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerStagePop")) +""" +function PetscLogHandlerStagePop(petsclib::PetscLibType, h::PetscLogHandler, stage::PetscLogStage) end + +@for_petsc function PetscLogHandlerStagePop(petsclib::$UnionPetscLib, h::PetscLogHandler, stage::PetscLogStage ) + + @chk ccall( + (:PetscLogHandlerStagePop, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogStage), + h, stage, + ) + + + return nothing +end + +""" + PetscLogHandlerView(petsclib::PetscLibType,h::PetscLogHandler, viewer::PetscViewer) +View the data recorded in a log handler. + +Collective + +Input Parameters: +- `h` - the `PetscLogHandler` +- `viewer` - the `PetscViewer` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogView()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerView")) +""" +function PetscLogHandlerView(petsclib::PetscLibType, h::PetscLogHandler, viewer::PetscViewer) end + +@for_petsc function PetscLogHandlerView(petsclib::$UnionPetscLib, h::PetscLogHandler, viewer::PetscViewer ) + + @chk ccall( + (:PetscLogHandlerView, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscViewer), + h, viewer, + ) + + + return nothing +end + +""" + PetscLogHandlerGetEventPerfInfo(petsclib::PetscLibType,handler::PetscLogHandler, stage::PetscLogStage, event::PetscLogEvent, event_info::PetscEventPerfInfo) +Get a direct reference to the `PetscEventPerfInfo` of a stage and event + +Not collective, No Fortran Support + +Input Parameters: +- `handler` - a `PetscLogHandler` +- `stage` - a `PetscLogStage` (or `PETSC_DEFAULT` for the current stage) +- `event` - a `PetscLogEvent` + +Output Parameter: +- `event_info` - a pointer to a performance log for `event` during `stage` (or `NULL` if this handler does not use +`PetscEventPerfInfo` to record performance data); writing to `event_info` will change the record in +`handler` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogEventGetPerfInfo()`, `PETSCLOGHANDLERDEFAULT` + +# External Links +$(_doc_external("Sys/PetscLogHandlerGetEventPerfInfo")) +""" +function PetscLogHandlerGetEventPerfInfo(petsclib::PetscLibType, handler::PetscLogHandler, stage::PetscLogStage, event::PetscLogEvent, event_info::PetscEventPerfInfo) end + +@for_petsc function PetscLogHandlerGetEventPerfInfo(petsclib::$UnionPetscLib, handler::PetscLogHandler, stage::PetscLogStage, event::PetscLogEvent, event_info::PetscEventPerfInfo ) + + @chk ccall( + (:PetscLogHandlerGetEventPerfInfo, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogStage, PetscLogEvent, PetscEventPerfInfo), + handler, stage, event, event_info, + ) + + + return nothing +end + +""" + PetscLogHandlerGetStagePerfInfo(petsclib::PetscLibType,handler::PetscLogHandler, stage::PetscLogStage, stage_info::PetscEventPerfInfo) +Get a direct reference to the `PetscEventPerfInfo` of a stage + +Not collective, No Fortran Support + +Input Parameters: +- `handler` - a `PetscLogHandler` +- `stage` - a `PetscLogStage` (or `PETSC_DEFAULT` for the current stage) + +Output Parameter: +- `stage_info` - a pointer to a performance log for `stage` (or `NULL` if this handler does not use `PetscEventPerfInfo` +to record performance data); writing to `stage_info` will change the record in `handler` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogEventGetPerfInfo()`, `PETSCLOGHANDLERDEFAULT` + +# External Links +$(_doc_external("Sys/PetscLogHandlerGetStagePerfInfo")) +""" +function PetscLogHandlerGetStagePerfInfo(petsclib::PetscLibType, handler::PetscLogHandler, stage::PetscLogStage, stage_info::PetscEventPerfInfo) end + +@for_petsc function PetscLogHandlerGetStagePerfInfo(petsclib::$UnionPetscLib, handler::PetscLogHandler, stage::PetscLogStage, stage_info::PetscEventPerfInfo ) + + @chk ccall( + (:PetscLogHandlerGetStagePerfInfo, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogStage, PetscEventPerfInfo), + handler, stage, stage_info, + ) + + + return nothing +end + +""" + PetscLogHandlerSetLogActions(petsclib::PetscLibType,handler::PetscLogHandler, flag::PetscBool) +Determines whether actions are logged for a log handler. + +Not Collective + +Input Parameters: +- `handler` - a `PetscLogHandler` +- `flag` - `PETSC_TRUE` if actions are to be logged (ignored if `handler` does not log actions) + +Level: developer + +-seealso: [](ch_profiling), `PetscLogSetLogActions()`, `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerSetLogActions")) +""" +function PetscLogHandlerSetLogActions(petsclib::PetscLibType, handler::PetscLogHandler, flag::PetscBool) end + +@for_petsc function PetscLogHandlerSetLogActions(petsclib::$UnionPetscLib, handler::PetscLogHandler, flag::PetscBool ) + + @chk ccall( + (:PetscLogHandlerSetLogActions, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscBool), + handler, flag, + ) + + + return nothing +end + +""" + PetscLogHandlerSetLogObjects(petsclib::PetscLibType,handler::PetscLogHandler, flag::PetscBool) +Determines whether objects are logged for a log handler. + +Not Collective + +Input Parameters: +- `handler` - a `PetscLogHandler` +- `flag` - `PETSC_TRUE` if objects are to be logged (ignored if `handler` does not log objects) + +Level: developer + +-seealso: [](ch_profiling), `PetscLogSetLogObjects()`, `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerSetLogObjects")) +""" +function PetscLogHandlerSetLogObjects(petsclib::PetscLibType, handler::PetscLogHandler, flag::PetscBool) end + +@for_petsc function PetscLogHandlerSetLogObjects(petsclib::$UnionPetscLib, handler::PetscLogHandler, flag::PetscBool ) + + @chk ccall( + (:PetscLogHandlerSetLogObjects, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscBool), + handler, flag, + ) + + + return nothing +end + +""" + num_objects::PetscInt = PetscLogHandlerGetNumObjects(petsclib::PetscLibType,handler::PetscLogHandler) +Get the number of objects that were logged with a log handler + +Not Collective + +Input Parameter: +- `handler` - a `PetscLogHandler` + +Output Parameter: +- `num_objects` - the number of objects whose creations and destructions were logged with `handler` +(`PetscLogHandlerObjectCreate()` / `PetscLogHandlerObjectDestroy()`), or -1 +if the handler does not keep track of this number. + +Level: developer + +-seealso: [](ch_profiling) + +# External Links +$(_doc_external("Sys/PetscLogHandlerGetNumObjects")) +""" +function PetscLogHandlerGetNumObjects(petsclib::PetscLibType, handler::PetscLogHandler) end + +@for_petsc function PetscLogHandlerGetNumObjects(petsclib::$UnionPetscLib, handler::PetscLogHandler ) + num_objects_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscLogHandlerGetNumObjects, $petsc_library), + PetscErrorCode, + (PetscLogHandler, Ptr{$PetscInt}), + handler, num_objects_, + ) + + num_objects = num_objects_[] + + return num_objects +end + +""" + PetscLogHandlerEventDeactivatePush(petsclib::PetscLibType,handler::PetscLogHandler, stage::PetscLogStage, event::PetscLogEvent) +Temporarily deactivate a logging event for a log handler + +Not collective + +Input Parameters: +- `handler` - a `PetscLogHandler` +- `stage` - a `PetscLogStage` (or `PETSC_DEFAULT` for the current stage) +- `event` - a `PetscLogEvent` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandlerEventDeactivatePop()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerEventDeactivatePush")) +""" +function PetscLogHandlerEventDeactivatePush(petsclib::PetscLibType, handler::PetscLogHandler, stage::PetscLogStage, event::PetscLogEvent) end + +@for_petsc function PetscLogHandlerEventDeactivatePush(petsclib::$UnionPetscLib, handler::PetscLogHandler, stage::PetscLogStage, event::PetscLogEvent ) + + @chk ccall( + (:PetscLogHandlerEventDeactivatePush, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogStage, PetscLogEvent), + handler, stage, event, + ) + + + return nothing +end + +""" + PetscLogHandlerEventDeactivatePop(petsclib::PetscLibType,handler::PetscLogHandler, stage::PetscLogStage, event::PetscLogEvent) +Undo temporary deactivation a logging event for a log handler + +Not collective + +Input Parameters: +- `handler` - a `PetscLogHandler` +- `stage` - a `PetscLogStage` (or `PETSC_DEFAULT` for the current stage) +- `event` - a `PetscLogEvent` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandlerEventDeactivatePush()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerEventDeactivatePop")) +""" +function PetscLogHandlerEventDeactivatePop(petsclib::PetscLibType, handler::PetscLogHandler, stage::PetscLogStage, event::PetscLogEvent) end + +@for_petsc function PetscLogHandlerEventDeactivatePop(petsclib::$UnionPetscLib, handler::PetscLogHandler, stage::PetscLogStage, event::PetscLogEvent ) + + @chk ccall( + (:PetscLogHandlerEventDeactivatePop, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogStage, PetscLogEvent), + handler, stage, event, + ) + + + return nothing +end + +""" + PetscLogHandlerEventsPause(petsclib::PetscLibType,handler::PetscLogHandler) +Put event logging into "paused" mode (see `PetscLogEventsPause()` for details.) for a log handler + +Not collective + +Input Parameter: +- `handler` - a `PetscLogHandler` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandlerEventsResume()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerEventsPause")) +""" +function PetscLogHandlerEventsPause(petsclib::PetscLibType, handler::PetscLogHandler) end + +@for_petsc function PetscLogHandlerEventsPause(petsclib::$UnionPetscLib, handler::PetscLogHandler ) + + @chk ccall( + (:PetscLogHandlerEventsPause, $petsc_library), + PetscErrorCode, + (PetscLogHandler,), + handler, + ) + + + return nothing +end + +""" + PetscLogHandlerEventsResume(petsclib::PetscLibType,handler::PetscLogHandler) +Resume event logging that had been put into "paused" mode (see `PetscLogEventsPause()` for details.) for a log handler + +Not collective + +Input Parameter: +- `handler` - a `PetscLogHandler` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandlerEventsPause()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerEventsResume")) +""" +function PetscLogHandlerEventsResume(petsclib::PetscLibType, handler::PetscLogHandler) end + +@for_petsc function PetscLogHandlerEventsResume(petsclib::$UnionPetscLib, handler::PetscLogHandler ) + + @chk ccall( + (:PetscLogHandlerEventsResume, $petsc_library), + PetscErrorCode, + (PetscLogHandler,), + handler, + ) + + + return nothing +end + +""" + PetscLogHandlerDump(petsclib::PetscLibType,handler::PetscLogHandler, sname::String) +Dump the records of a log handler to file + +Not collective + +Input Parameters: +- `handler` - a `PetscLogHandler` +- `sname` - the name of the file to dump log data to + +Level: developer + +-seealso: [](ch_profiling) + +# External Links +$(_doc_external("Sys/PetscLogHandlerDump")) +""" +function PetscLogHandlerDump(petsclib::PetscLibType, handler::PetscLogHandler, sname::String) end + +@for_petsc function PetscLogHandlerDump(petsclib::$UnionPetscLib, handler::PetscLogHandler, sname::String ) + + @chk ccall( + (:PetscLogHandlerDump, $petsc_library), + PetscErrorCode, + (PetscLogHandler, Ptr{Cchar}), + handler, sname, + ) + + + return nothing +end + +""" + PetscLogHandlerStageSetVisible(petsclib::PetscLibType,handler::PetscLogHandler, stage::PetscLogStage, isVisible::PetscBool) +Set the visibility of logging stage in `PetscLogHandlerView()` for a log handler + +Not collective + +Input Parameters: +- `handler` - a `PetscLogHandler` +- `stage` - a `PetscLogStage` +- `isVisible` - the visibility flag, `PETSC_TRUE` to print, else `PETSC_FALSE` (defaults to `PETSC_TRUE`) + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandlerStageGetVisible()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerStageSetVisible")) +""" +function PetscLogHandlerStageSetVisible(petsclib::PetscLibType, handler::PetscLogHandler, stage::PetscLogStage, isVisible::PetscBool) end + +@for_petsc function PetscLogHandlerStageSetVisible(petsclib::$UnionPetscLib, handler::PetscLogHandler, stage::PetscLogStage, isVisible::PetscBool ) + + @chk ccall( + (:PetscLogHandlerStageSetVisible, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogStage, PetscBool), + handler, stage, isVisible, + ) + + + return nothing +end + +""" + isVisible::PetscBool = PetscLogHandlerStageGetVisible(petsclib::PetscLibType,handler::PetscLogHandler, stage::PetscLogStage) +Get the visibility of logging stage in `PetscLogHandlerView()` for a log handler + +Not collective + +Input Parameters: +- `handler` - a `PetscLogHandler` +- `stage` - a `PetscLogStage` + +Output Parameter: +- `isVisible` - the visibility flag, `PETSC_TRUE` to print, else `PETSC_FALSE` (defaults to `PETSC_TRUE`) + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandlerStageSetVisible()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerStageGetVisible")) +""" +function PetscLogHandlerStageGetVisible(petsclib::PetscLibType, handler::PetscLogHandler, stage::PetscLogStage) end + +@for_petsc function PetscLogHandlerStageGetVisible(petsclib::$UnionPetscLib, handler::PetscLogHandler, stage::PetscLogStage ) + isVisible_ = Ref{PetscBool}() + + @chk ccall( + (:PetscLogHandlerStageGetVisible, $petsc_library), + PetscErrorCode, + (PetscLogHandler, PetscLogStage, Ptr{PetscBool}), + handler, stage, isVisible_, + ) + + isVisible = isVisible_[] + + return isVisible +end + +""" + handler::PetscLogHandler = PetscLogHandlerCreateTrace(petsclib::PetscLibType,comm::MPI_Comm, file::Libc.FILE) +Create a logger that traces events and stages to a given file descriptor + +Collective, No Fortran Support + +Input Parameters: +- `comm` - an MPI communicator +- `file` - a file descriptor + +Output Parameters: +- `handler` - a `PetscLogHandler of type `PETSCLOGHANDLERTRACE` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogHandlerTraceBegin()` + +# External Links +$(_doc_external("Sys/PetscLogHandlerCreateTrace")) +""" +function PetscLogHandlerCreateTrace(petsclib::PetscLibType, comm::MPI_Comm, file::Libc.FILE) end + +@for_petsc function PetscLogHandlerCreateTrace(petsclib::$UnionPetscLib, comm::MPI_Comm, file::Libc.FILE ) + handler_ = Ref{PetscLogHandler}() + + @chk ccall( + (:PetscLogHandlerCreateTrace, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Libc.FILE}, Ptr{PetscLogHandler}), + comm, file, handler_, + ) + + handler = handler_[] + + return handler +end + +""" + handler::PetscLogHandler = PetscLogHandlerCreateLegacy(petsclib::PetscLibType,comm::MPI_Comm, PetscLogPLB::external, PetscLogPLE::external, PetscLogPHC::external, PetscLogPHD::external) +Create a `PetscLogHandler` from callbacks matching PETSc's legacy log handler callbacks + +Collective + +Input Parameters: +- `comm` - an MPI communicator +- `PetscLogPLB` - a function to call during `PetscLogHandlerEventBegin()` (or `NULL`) +- `PetscLogPLE` - a function to call during `PetscLogHandlerEventEnd()` (or `NULL`) +- `PetscLogPHC` - a function to call during `PetscLogHandlerObjectCreate()` (or `NULL`) +- `PetscLogPHD` - a function to call during `PetscLogHandlerObjectDestroy()` (or `NULL`) + +Output Parameter: +- `handler` - a `PetscLogHandler` + +Calling sequence of `PetscLogPLB`: +- `e` - a `PetscLogEvent` that is beginning +- `_i` - deprecated, unused +- `o1` - a `PetscObject` associated with `e` (or `NULL`) +- `o2` - a `PetscObject` associated with `e` (or `NULL`) +- `o3` - a `PetscObject` associated with `e` (or `NULL`) +- `o4` - a `PetscObject` associated with `e` (or `NULL`) + +Calling sequence of `PetscLogPLE`: +- `e` - a `PetscLogEvent` that is beginning +- `_i` - deprecated, unused +- `o1` - a `PetscObject` associated with `e` (or `NULL`) +- `o2` - a `PetscObject` associated with `e` (or `NULL`) +- `o3` - a `PetscObject` associated with `e` (or `NULL`) +- `o4` - a `PetscObject` associated with `e` (or `NULL`) + +Calling sequence of `PetscLogPHC`: +- `o` - a `PetscObject` that has just been created + +Calling sequence of `PetscLogPHD`: +- `o` - a `PetscObject` that is about to be destroyed + +Level: developer + +-seealso: [](ch_profiling) + +# External Links +$(_doc_external("Sys/PetscLogHandlerCreateLegacy")) +""" +function PetscLogHandlerCreateLegacy(petsclib::PetscLibType, comm::MPI_Comm, PetscLogPLB::external, PetscLogPLE::external, PetscLogPHC::external, PetscLogPHD::external) end + +@for_petsc function PetscLogHandlerCreateLegacy(petsclib::$UnionPetscLib, comm::MPI_Comm, PetscLogPLB::external, PetscLogPLE::external, PetscLogPHC::external, PetscLogPHD::external ) + handler_ = Ref{PetscLogHandler}() + + @chk ccall( + (:PetscLogHandlerCreateLegacy, $petsc_library), + PetscErrorCode, + (MPI_Comm, external, external, external, external, Ptr{PetscLogHandler}), + comm, PetscLogPLB, PetscLogPLE, PetscLogPHC, PetscLogPHD, handler_, + ) + + handler = handler_[] + + return handler +end + +""" + state::PetscLogState = PetscLogStateCreate(petsclib::PetscLibType) +Create a logging state. + +Not collective + +Output Parameters: +- `state` - a `PetscLogState` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateDestroy()` + +# External Links +$(_doc_external("Sys/PetscLogStateCreate")) +""" +function PetscLogStateCreate(petsclib::PetscLibType) end + +@for_petsc function PetscLogStateCreate(petsclib::$UnionPetscLib) + state_ = Ref{PetscLogState}() + + @chk ccall( + (:PetscLogStateCreate, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogState},), + state_, + ) + + state = state_[] + + return state +end + +""" + PetscLogStateDestroy(petsclib::PetscLibType,state::PetscLogState) +Destroy a logging state. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateCreate()` + +# External Links +$(_doc_external("Sys/PetscLogStateDestroy")) +""" +function PetscLogStateDestroy(petsclib::PetscLibType, state::PetscLogState) end + +@for_petsc function PetscLogStateDestroy(petsclib::$UnionPetscLib, state::PetscLogState ) + + @chk ccall( + (:PetscLogStateDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogState},), + state, + ) + + + return nothing +end + +""" + PetscLogStateStagePush(petsclib::PetscLibType,state::PetscLogState, stage::PetscLogStage) +Start a new logging stage. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `stage` - a registered `PetscLogStage` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateStageRegister()`, `PetscLogStateStagePop()`, `PetscLogStateGetCurrentStage()` + +# External Links +$(_doc_external("Sys/PetscLogStateStagePush")) +""" +function PetscLogStateStagePush(petsclib::PetscLibType, state::PetscLogState, stage::PetscLogStage) end + +@for_petsc function PetscLogStateStagePush(petsclib::$UnionPetscLib, state::PetscLogState, stage::PetscLogStage ) + + @chk ccall( + (:PetscLogStateStagePush, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogStage), + state, stage, + ) + + + return nothing +end + +""" + PetscLogStateStagePop(petsclib::PetscLibType,state::PetscLogState) +End a running logging stage. + +Not collective + +Input Parameter: +- `state` - a `PetscLogState` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateStageRegister()`, `PetscLogStateStagePush()`, `PetscLogStateGetCurrentStage()` + +# External Links +$(_doc_external("Sys/PetscLogStateStagePop")) +""" +function PetscLogStateStagePop(petsclib::PetscLibType, state::PetscLogState) end + +@for_petsc function PetscLogStateStagePop(petsclib::$UnionPetscLib, state::PetscLogState ) + + @chk ccall( + (:PetscLogStateStagePop, $petsc_library), + PetscErrorCode, + (PetscLogState,), + state, + ) + + + return nothing +end + +""" + PetscLogStateGetCurrentStage(petsclib::PetscLibType,state::PetscLogState, current::PetscLogStage) +Get the last stage that was started + +Not collective + +Input Parameter: +- `state` - a `PetscLogState` + +Output Parameter: +- `current` - the last `PetscLogStage` started with `PetscLogStateStagePop()` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateStageRegister()`, `PetscLogStateStagePush()`, `PetscLogStateStagePop()` + +# External Links +$(_doc_external("Sys/PetscLogStateGetCurrentStage")) +""" +function PetscLogStateGetCurrentStage(petsclib::PetscLibType, state::PetscLogState, current::PetscLogStage) end + +@for_petsc function PetscLogStateGetCurrentStage(petsclib::$UnionPetscLib, state::PetscLogState, current::PetscLogStage ) + + @chk ccall( + (:PetscLogStateGetCurrentStage, $petsc_library), + PetscErrorCode, + (PetscLogState, Ptr{PetscLogStage}), + state, current, + ) + + + return nothing +end + +""" + PetscLogStateStageRegister(petsclib::PetscLibType,state::PetscLogState, sname::String, stage::PetscLogStage) +Register a new stage with a logging state + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `sname` - a unique name + +Output Parameter: +- `stage` - the identifier for the registered stage + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateStagePush()`, `PetscLogStateStagePop()` + +# External Links +$(_doc_external("Sys/PetscLogStateStageRegister")) +""" +function PetscLogStateStageRegister(petsclib::PetscLibType, state::PetscLogState, sname::String, stage::PetscLogStage) end + +@for_petsc function PetscLogStateStageRegister(petsclib::$UnionPetscLib, state::PetscLogState, sname::String, stage::PetscLogStage ) + + @chk ccall( + (:PetscLogStateStageRegister, $petsc_library), + PetscErrorCode, + (PetscLogState, Ptr{Cchar}, Ptr{PetscLogStage}), + state, sname, stage, + ) + + + return nothing +end + +""" + PetscLogStateEventRegister(petsclib::PetscLibType,state::PetscLogState, sname::String, id::PetscClassId, event::PetscLogEvent) +Register a new event with a logging state + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `sname` - a unique name +- `id` - the `PetscClassId` for the type of object most closely associated with this event + +Output Parameter: +- `event` - the identifier for the registered event + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStageRegister()` + +# External Links +$(_doc_external("Sys/PetscLogStateEventRegister")) +""" +function PetscLogStateEventRegister(petsclib::PetscLibType, state::PetscLogState, sname::String, id::PetscClassId, event::PetscLogEvent) end + +@for_petsc function PetscLogStateEventRegister(petsclib::$UnionPetscLib, state::PetscLogState, sname::String, id::PetscClassId, event::PetscLogEvent ) + + @chk ccall( + (:PetscLogStateEventRegister, $petsc_library), + PetscErrorCode, + (PetscLogState, Ptr{Cchar}, PetscClassId, Ptr{PetscLogEvent}), + state, sname, id, event, + ) + + + return nothing +end + +""" + PetscLogStateEventSetCollective(petsclib::PetscLibType,state::PetscLogState, event::PetscLogEvent, collective::PetscBool) +Set the collective nature of a logging event + +Logically collective + +Input Parameters: +- `state` - a `PetscLogState` +- `event` - a registered `PetscLogEvent` +- `collective` - if `PETSC_TRUE`, MPI processes synchronize during this event, and `PetscLogHandlerEventSync()` can be used to help measure the delays between when the processes begin the event + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogEventRegister()` + +# External Links +$(_doc_external("Sys/PetscLogStateEventSetCollective")) +""" +function PetscLogStateEventSetCollective(petsclib::PetscLibType, state::PetscLogState, event::PetscLogEvent, collective::PetscBool) end + +@for_petsc function PetscLogStateEventSetCollective(petsclib::$UnionPetscLib, state::PetscLogState, event::PetscLogEvent, collective::PetscBool ) + + @chk ccall( + (:PetscLogStateEventSetCollective, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogEvent, PetscBool), + state, event, collective, + ) + + + return nothing +end + +""" + PetscLogStateStageSetActive(petsclib::PetscLibType,state::PetscLogState, stage::PetscLogStage, isActive::PetscBool) +Mark a stage as active or inactive. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `stage` - a registered `PetscLogStage` +- `isActive` - if `PETSC_FALSE`, `PetscLogStateEventGetActive()` will return `PETSC_FALSE` for all events during this stage + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateEventSetActive()` + +# External Links +$(_doc_external("Sys/PetscLogStateStageSetActive")) +""" +function PetscLogStateStageSetActive(petsclib::PetscLibType, state::PetscLogState, stage::PetscLogStage, isActive::PetscBool) end + +@for_petsc function PetscLogStateStageSetActive(petsclib::$UnionPetscLib, state::PetscLogState, stage::PetscLogStage, isActive::PetscBool ) + + @chk ccall( + (:PetscLogStateStageSetActive, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogStage, PetscBool), + state, stage, isActive, + ) + + + return nothing +end + +""" + isActive::PetscBool = PetscLogStateStageGetActive(petsclib::PetscLibType,state::PetscLogState, stage::PetscLogStage) +Check if a logging stage is active or inactive. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `stage` - a registered `PetscLogStage` + +Output Parameter: +- `isActive` - if `PETSC_FALSE`, the state should not send logging events to log handlers during this stage. + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStageSetActive()`, `PetscLogHandler`, `PetscLogHandlerStart()`, `PetscLogHandlerEventBegin()`, `PetscLogHandlerEventEnd()` + +# External Links +$(_doc_external("Sys/PetscLogStateStageGetActive")) +""" +function PetscLogStateStageGetActive(petsclib::PetscLibType, state::PetscLogState, stage::PetscLogStage) end + +@for_petsc function PetscLogStateStageGetActive(petsclib::$UnionPetscLib, state::PetscLogState, stage::PetscLogStage ) + isActive_ = Ref{PetscBool}() + + @chk ccall( + (:PetscLogStateStageGetActive, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogStage, Ptr{PetscBool}), + state, stage, isActive_, + ) + + isActive = isActive_[] + + return isActive +end + +""" + PetscLogStateEventSetActive(petsclib::PetscLibType,state::PetscLogState, stage::PetscLogStage, event::PetscLogEvent, isActive::PetscBool) +Set a logging event as active or inactive during a logging stage. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `stage` - a registered `PetscLogStage`, or `PETSC_DEFAULT` for the current stage +- `event` - a registered `PetscLogEvent` +- `isActive` - if `PETSC_FALSE`, `PetscLogStateEventGetActive()` will return `PETSC_FALSE` for this stage and this event + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogEventGetActive()`, `PetscLogStateGetCurrentStage()`, `PetscLogEventSetActiveAll()` + +# External Links +$(_doc_external("Sys/PetscLogStateEventSetActive")) +""" +function PetscLogStateEventSetActive(petsclib::PetscLibType, state::PetscLogState, stage::PetscLogStage, event::PetscLogEvent, isActive::PetscBool) end + +@for_petsc function PetscLogStateEventSetActive(petsclib::$UnionPetscLib, state::PetscLogState, stage::PetscLogStage, event::PetscLogEvent, isActive::PetscBool ) + + @chk ccall( + (:PetscLogStateEventSetActive, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogStage, PetscLogEvent, PetscBool), + state, stage, event, isActive, + ) + + + return nothing +end + +""" + PetscLogStateEventSetActiveAll(petsclib::PetscLibType,state::PetscLogState, event::PetscLogEvent, isActive::PetscBool) +Set logging event as active or inactive for all logging stages + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `event` - a registered `PetscLogEvent` +- `isActive` - if `PETSC_FALSE`, `PetscLogStateEventGetActive()` will return `PETSC_FALSE` for all stages and all events + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogEventGetActive()` + +# External Links +$(_doc_external("Sys/PetscLogStateEventSetActiveAll")) +""" +function PetscLogStateEventSetActiveAll(petsclib::PetscLibType, state::PetscLogState, event::PetscLogEvent, isActive::PetscBool) end + +@for_petsc function PetscLogStateEventSetActiveAll(petsclib::$UnionPetscLib, state::PetscLogState, event::PetscLogEvent, isActive::PetscBool ) + + @chk ccall( + (:PetscLogStateEventSetActiveAll, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogEvent, PetscBool), + state, event, isActive, + ) + + + return nothing +end + +""" + PetscLogStateClassSetActive(petsclib::PetscLibType,state::PetscLogState, stage::PetscLogStage, classid::PetscClassId, isActive::PetscBool) +Set logging events associated with an event as active or inactive during a logging stage. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `stage` - a registered `PetscLogStage`, or `PETSC_DEFAULT` for the current stage +- `classid` - a `PetscClassId` +- `isActive` - if `PETSC_FALSE`, `PetscLogStateEventGetActive()` will return +`PETSC_FALSE` for this stage and all events that were associated +with this class when they were registered (see +`PetscLogStateEventRegister()`). + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogEventGetActive()`, `PetscLogStateEventSetActive()` + +# External Links +$(_doc_external("Sys/PetscLogStateClassSetActive")) +""" +function PetscLogStateClassSetActive(petsclib::PetscLibType, state::PetscLogState, stage::PetscLogStage, classid::PetscClassId, isActive::PetscBool) end + +@for_petsc function PetscLogStateClassSetActive(petsclib::$UnionPetscLib, state::PetscLogState, stage::PetscLogStage, classid::PetscClassId, isActive::PetscBool ) + + @chk ccall( + (:PetscLogStateClassSetActive, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogStage, PetscClassId, PetscBool), + state, stage, classid, isActive, + ) + + + return nothing +end + +""" + PetscLogStateClassSetActiveAll(petsclib::PetscLibType,state::PetscLogState, classid::PetscClassId, isActive::PetscBool) +Set logging events associated with an event as active or inactive for all logging stages + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `classid` - a `PetscClassId` +- `isActive` - if `PETSC_FALSE`, `PetscLogStateEventGetActive()` will return +`PETSC_FALSE` for all events that were associated with this class when they +were registered (see `PetscLogStateEventRegister()`). + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogEventGetActive()`, `PetscLogStateClassSetActive()` + +# External Links +$(_doc_external("Sys/PetscLogStateClassSetActiveAll")) +""" +function PetscLogStateClassSetActiveAll(petsclib::PetscLibType, state::PetscLogState, classid::PetscClassId, isActive::PetscBool) end + +@for_petsc function PetscLogStateClassSetActiveAll(petsclib::$UnionPetscLib, state::PetscLogState, classid::PetscClassId, isActive::PetscBool ) + + @chk ccall( + (:PetscLogStateClassSetActiveAll, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscClassId, PetscBool), + state, classid, isActive, + ) + + + return nothing +end + +""" + isActive::PetscBool = PetscLogStateEventGetActive(petsclib::PetscLibType,state::PetscLogState, stage::PetscLogStage, event::PetscLogEvent) +Check if a logging event is active or inactive during a logging stage. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `stage` - a registered `PetscLogStage`, or `PETSC_DEFAULT` for the current stage +- `event` - a registered `PetscLogEvent` + +Output Parameter: +- `isActive` - If `PETSC_FALSE`, log handlers should not be notified of the event's beginning or end. + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogEventGetActive()`, `PetscLogStateGetCurrentStage()`, `PetscLogHandler()` + +# External Links +$(_doc_external("Sys/PetscLogStateEventGetActive")) +""" +function PetscLogStateEventGetActive(petsclib::PetscLibType, state::PetscLogState, stage::PetscLogStage, event::PetscLogEvent) end + +@for_petsc function PetscLogStateEventGetActive(petsclib::$UnionPetscLib, state::PetscLogState, stage::PetscLogStage, event::PetscLogEvent ) + isActive_ = Ref{PetscBool}() + + @chk ccall( + (:PetscLogStateEventGetActive, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogStage, PetscLogEvent, Ptr{PetscBool}), + state, stage, event, isActive_, + ) + + isActive = isActive_[] + + return isActive +end + +""" + PetscLogStateGetEventFromName(petsclib::PetscLibType,state::PetscLogState, name::String, event::PetscLogEvent) +Get a `PetscLogEvent` from the name it was registered with. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `name` - an event's name + +Output Parameter: +- `event` - the event's id + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateEventRegister()`, `PetscLogStateEventGetInfo()` + +# External Links +$(_doc_external("Sys/PetscLogStateGetEventFromName")) +""" +function PetscLogStateGetEventFromName(petsclib::PetscLibType, state::PetscLogState, name::String, event::PetscLogEvent) end + +@for_petsc function PetscLogStateGetEventFromName(petsclib::$UnionPetscLib, state::PetscLogState, name::String, event::PetscLogEvent ) + + @chk ccall( + (:PetscLogStateGetEventFromName, $petsc_library), + PetscErrorCode, + (PetscLogState, Ptr{Cchar}, Ptr{PetscLogEvent}), + state, name, event, + ) + + + return nothing +end + +""" + PetscLogStateGetStageFromName(petsclib::PetscLibType,state::PetscLogState, name::String, stage::PetscLogStage) +Get a `PetscLogStage` from the name it was registered with. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `name` - a stage's name + +Output Parameter: +- `stage` - the stage's id + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateStageRegister()`, `PetscLogStateStageGetInfo()` + +# External Links +$(_doc_external("Sys/PetscLogStateGetStageFromName")) +""" +function PetscLogStateGetStageFromName(petsclib::PetscLibType, state::PetscLogState, name::String, stage::PetscLogStage) end + +@for_petsc function PetscLogStateGetStageFromName(petsclib::$UnionPetscLib, state::PetscLogState, name::String, stage::PetscLogStage ) + + @chk ccall( + (:PetscLogStateGetStageFromName, $petsc_library), + PetscErrorCode, + (PetscLogState, Ptr{Cchar}, Ptr{PetscLogStage}), + state, name, stage, + ) + + + return nothing +end + +""" + PetscLogStateGetClassFromName(petsclib::PetscLibType,state::PetscLogState, name::String, clss::PetscLogClass) +Get a `PetscLogClass` from the name of the class it was registered with. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `name` - the name string of the class + +Output Parameter: +- `clss` - the classes's logging id + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateClassRegister()`, `PetscLogStateClassGetInfo()` + +# External Links +$(_doc_external("Sys/PetscLogStateGetClassFromName")) +""" +function PetscLogStateGetClassFromName(petsclib::PetscLibType, state::PetscLogState, name::String, clss::PetscLogClass) end + +@for_petsc function PetscLogStateGetClassFromName(petsclib::$UnionPetscLib, state::PetscLogState, name::String, clss::PetscLogClass ) + + @chk ccall( + (:PetscLogStateGetClassFromName, $petsc_library), + PetscErrorCode, + (PetscLogState, Ptr{Cchar}, Ptr{PetscLogClass}), + state, name, clss, + ) + + + return nothing +end + +""" + PetscLogStateGetClassFromClassId(petsclib::PetscLibType,state::PetscLogState, classid::PetscClassId, clss::PetscLogClass) +Get a `PetscLogClass` from the `PetscClassId` it was registered with. + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `classid` - a `PetscClassId` + +Output Parameter: +- `clss` - the classes's logging id + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateClassRegister()`, `PetscLogStateClassGetInfo()` + +# External Links +$(_doc_external("Sys/PetscLogStateGetClassFromClassId")) +""" +function PetscLogStateGetClassFromClassId(petsclib::PetscLibType, state::PetscLogState, classid::PetscClassId, clss::PetscLogClass) end + +@for_petsc function PetscLogStateGetClassFromClassId(petsclib::$UnionPetscLib, state::PetscLogState, classid::PetscClassId, clss::PetscLogClass ) + + @chk ccall( + (:PetscLogStateGetClassFromClassId, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscClassId, Ptr{PetscLogClass}), + state, classid, clss, + ) + + + return nothing +end + +""" + numEvents::PetscInt = PetscLogStateGetNumEvents(petsclib::PetscLibType,state::PetscLogState) +Get the number of registered events in a logging state. + +Not collective + +Input Parameter: +- `state` - a `PetscLogState` + +Output Parameter: +- `numEvents` - the number of registered `PetscLogEvent`s + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateEventRegister()` + +# External Links +$(_doc_external("Sys/PetscLogStateGetNumEvents")) +""" +function PetscLogStateGetNumEvents(petsclib::PetscLibType, state::PetscLogState) end + +@for_petsc function PetscLogStateGetNumEvents(petsclib::$UnionPetscLib, state::PetscLogState ) + numEvents_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscLogStateGetNumEvents, $petsc_library), + PetscErrorCode, + (PetscLogState, Ptr{$PetscInt}), + state, numEvents_, + ) + + numEvents = numEvents_[] + + return numEvents +end + +""" + numStages::PetscInt = PetscLogStateGetNumStages(petsclib::PetscLibType,state::PetscLogState) +Get the number of registered stages in a logging state. + +Not collective + +Input Parameter: +- `state` - a `PetscLogState` + +Output Parameter: +- `numStages` - the number of registered `PetscLogStage`s + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateStageRegister()` + +# External Links +$(_doc_external("Sys/PetscLogStateGetNumStages")) +""" +function PetscLogStateGetNumStages(petsclib::PetscLibType, state::PetscLogState) end + +@for_petsc function PetscLogStateGetNumStages(petsclib::$UnionPetscLib, state::PetscLogState ) + numStages_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscLogStateGetNumStages, $petsc_library), + PetscErrorCode, + (PetscLogState, Ptr{$PetscInt}), + state, numStages_, + ) + + numStages = numStages_[] + + return numStages +end + +""" + numClasses::PetscInt = PetscLogStateGetNumClasses(petsclib::PetscLibType,state::PetscLogState) +Get the number of registered classes in a logging state. + +Not collective + +Input Parameter: +- `state` - a `PetscLogState` + +Output Parameter: +- `numClasses` - the number of registered `PetscLogClass`s + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateClassRegister()` + +# External Links +$(_doc_external("Sys/PetscLogStateGetNumClasses")) +""" +function PetscLogStateGetNumClasses(petsclib::PetscLibType, state::PetscLogState) end + +@for_petsc function PetscLogStateGetNumClasses(petsclib::$UnionPetscLib, state::PetscLogState ) + numClasses_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscLogStateGetNumClasses, $petsc_library), + PetscErrorCode, + (PetscLogState, Ptr{$PetscInt}), + state, numClasses_, + ) + + numClasses = numClasses_[] + + return numClasses +end + +""" + PetscLogStateEventGetInfo(petsclib::PetscLibType,state::PetscLogState, event::PetscLogEvent, info::PetscLogEventInfo) +Get the registration information of an event + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `event` - a registered `PetscLogEvent` + +Output Parameter: +- `info` - the `PetscLogEventInfo` of the event will be copied into info + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateEventRegister()`, `PetscLogStateGetEventFromName()` + +# External Links +$(_doc_external("Sys/PetscLogStateEventGetInfo")) +""" +function PetscLogStateEventGetInfo(petsclib::PetscLibType, state::PetscLogState, event::PetscLogEvent, info::PetscLogEventInfo) end + +@for_petsc function PetscLogStateEventGetInfo(petsclib::$UnionPetscLib, state::PetscLogState, event::PetscLogEvent, info::PetscLogEventInfo ) + + @chk ccall( + (:PetscLogStateEventGetInfo, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogEvent, Ptr{PetscLogEventInfo}), + state, event, info, + ) + + + return nothing +end + +""" + PetscLogStateStageGetInfo(petsclib::PetscLibType,state::PetscLogState, stage::PetscLogStage, info::PetscLogStageInfo) +Get the registration information of an stage + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `stage` - a registered `PetscLogStage` + +Output Parameter: +- `info` - the `PetscLogStageInfo` of the stage will be copied into info + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateStageRegister()`, `PetscLogStateGetStageFromName()` + +# External Links +$(_doc_external("Sys/PetscLogStateStageGetInfo")) +""" +function PetscLogStateStageGetInfo(petsclib::PetscLibType, state::PetscLogState, stage::PetscLogStage, info::PetscLogStageInfo) end + +@for_petsc function PetscLogStateStageGetInfo(petsclib::$UnionPetscLib, state::PetscLogState, stage::PetscLogStage, info::PetscLogStageInfo ) + + @chk ccall( + (:PetscLogStateStageGetInfo, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogStage, Ptr{PetscLogStageInfo}), + state, stage, info, + ) + + + return nothing +end + +""" + PetscLogStateClassRegister(petsclib::PetscLibType,state::PetscLogState, name::String, id::PetscClassId, logclass::PetscLogClass) +Register a class to with a `PetscLogState` used by `PetscLogHandler`s. + +Logically collective on `PETSC_COMM_WORLD` + +Input Parameters: +- `state` - a `PetscLogState` +- `name` - the name of a class registered with `PetscClassIdRegister()` +- `id` - the `PetscClassId` obtained from `PetscClassIdRegister()` + +Output Parameter: +- `logclass` - a `PetscLogClass` for this class with this state + +Level: developer + +-seealso: [](ch_profiling), `PetscLogStateClassGetInfo()` `PetscLogStateGetClassFromName()`, `PetscLogStateGetClassFromClassId()` + +# External Links +$(_doc_external("Sys/PetscLogStateClassRegister")) +""" +function PetscLogStateClassRegister(petsclib::PetscLibType, state::PetscLogState, name::String, id::PetscClassId, logclass::PetscLogClass) end + +@for_petsc function PetscLogStateClassRegister(petsclib::$UnionPetscLib, state::PetscLogState, name::String, id::PetscClassId, logclass::PetscLogClass ) + + @chk ccall( + (:PetscLogStateClassRegister, $petsc_library), + PetscErrorCode, + (PetscLogState, Ptr{Cchar}, PetscClassId, Ptr{PetscLogClass}), + state, name, id, logclass, + ) + + + return nothing +end + +""" + PetscLogStateClassGetInfo(petsclib::PetscLibType,state::PetscLogState, clss::PetscLogClass, info::PetscLogClassInfo) +Get the registration information of an class + +Not collective + +Input Parameters: +- `state` - a `PetscLogState` +- `clss` - a registered `PetscLogClass` + +Output Parameter: +- `info` - the `PetscLogClassInfo` of the class will be copied into info + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState`, `PetscLogStateClassRegister()`, `PetscLogStateGetClassFromName()` + +# External Links +$(_doc_external("Sys/PetscLogStateClassGetInfo")) +""" +function PetscLogStateClassGetInfo(petsclib::PetscLibType, state::PetscLogState, clss::PetscLogClass, info::PetscLogClassInfo) end + +@for_petsc function PetscLogStateClassGetInfo(petsclib::$UnionPetscLib, state::PetscLogState, clss::PetscLogClass, info::PetscLogClassInfo ) + + @chk ccall( + (:PetscLogStateClassGetInfo, $petsc_library), + PetscErrorCode, + (PetscLogState, PetscLogClass, Ptr{PetscLogClassInfo}), + state, clss, info, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscMatlabEngine_wrappers.jl b/src/autowrapped/PetscMatlabEngine_wrappers.jl new file mode 100644 index 00000000..a6473f10 --- /dev/null +++ b/src/autowrapped/PetscMatlabEngine_wrappers.jl @@ -0,0 +1,298 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscMatlabEngine end +const PetscMatlabEngine = Ptr{_n_PetscMatlabEngine} +# ------------------------------------------------------- + +""" + mengine::PetscMatlabEngine = PetscMatlabEngineCreate(petsclib::PetscLibType,comm::MPI_Comm, host::String) +Creates a MATLAB engine object + +Not Collective + +Input Parameters: +- `comm` - a separate MATLAB engine is started for each process in the communicator +- `host` - name of machine where MATLAB engine is to be run (usually NULL) + +Output Parameter: +- `mengine` - the resulting object + +Options Database Keys: +- `-matlab_engine_graphics` - allow the MATLAB engine to display graphics +- `-matlab_engine_host` - hostname, machine to run the MATLAB engine on +- `-info` - print out all requests to MATLAB and all if its responses (for debugging) + +Level: advanced + +-seealso: `PetscMatlabEngineDestroy()`, `PetscMatlabEnginePut()`, `PetscMatlabEngineGet()`, +`PetscMatlabEngineEvaluate()`, `PetscMatlabEngineGetOutput()`, `PetscMatlabEnginePrintOutput()`, +`PETSC_MATLAB_ENGINE_()`, `PetscMatlabEnginePutArray()`, `PetscMatlabEngineGetArray()`, `PetscMatlabEngine` + +# External Links +$(_doc_external("Sys/PetscMatlabEngineCreate")) +""" +function PetscMatlabEngineCreate(petsclib::PetscLibType, comm::MPI_Comm, host::String) end + +@for_petsc function PetscMatlabEngineCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, host::String ) + mengine_ = Ref{PetscMatlabEngine}() + + @chk ccall( + (:PetscMatlabEngineCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{PetscMatlabEngine}), + comm, host, mengine_, + ) + + mengine = mengine_[] + + return mengine +end + +""" + PetscMatlabEngineDestroy(petsclib::PetscLibType,v::PetscMatlabEngine) +Shuts down a MATLAB engine. + +Collective + +Input Parameter: +- `v` - the engine + +Level: advanced + +-seealso: `PetscMatlabEngineCreate()`, `PetscMatlabEnginePut()`, `PetscMatlabEngineGet()`, +`PetscMatlabEngineEvaluate()`, `PetscMatlabEngineGetOutput()`, `PetscMatlabEnginePrintOutput()`, +`PETSC_MATLAB_ENGINE_()`, `PetscMatlabEnginePutArray()`, `PetscMatlabEngineGetArray()`, `PetscMatlabEngine` + +# External Links +$(_doc_external("Sys/PetscMatlabEngineDestroy")) +""" +function PetscMatlabEngineDestroy(petsclib::PetscLibType, v::PetscMatlabEngine) end + +@for_petsc function PetscMatlabEngineDestroy(petsclib::$UnionPetscLib, v::PetscMatlabEngine ) + + @chk ccall( + (:PetscMatlabEngineDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscMatlabEngine},), + v, + ) + + + return nothing +end + +""" + PetscMatlabEngineGetOutput(petsclib::PetscLibType,mengine::PetscMatlabEngine, string::String) +Gets a string buffer where the MATLAB output is +printed + +Not Collective + +Input Parameter: +- `mengine` - the MATLAB engine + +Output Parameter: +- `string` - buffer where MATLAB output is printed + +Level: advanced + +-seealso: `PetscMatlabEngineDestroy()`, `PetscMatlabEnginePut()`, `PetscMatlabEngineGet()`, +`PetscMatlabEngineEvaluate()`, `PetscMatlabEngineCreate()`, `PetscMatlabEnginePrintOutput()`, +`PETSC_MATLAB_ENGINE_()`, `PetscMatlabEnginePutArray()`, `PetscMatlabEngineGetArray()`, `PetscMatlabEngine` + +# External Links +$(_doc_external("Sys/PetscMatlabEngineGetOutput")) +""" +function PetscMatlabEngineGetOutput(petsclib::PetscLibType, mengine::PetscMatlabEngine, string::String) end + +@for_petsc function PetscMatlabEngineGetOutput(petsclib::$UnionPetscLib, mengine::PetscMatlabEngine, string::String ) + string_ = Ref(pointer(string)) + + @chk ccall( + (:PetscMatlabEngineGetOutput, $petsc_library), + PetscErrorCode, + (PetscMatlabEngine, Ptr{Ptr{Cchar}}), + mengine, string_, + ) + + + return nothing +end + +""" + PetscMatlabEnginePrintOutput(petsclib::PetscLibType,mengine::PetscMatlabEngine, fd::Libc.FILE) +prints the output from MATLAB to an ASCII file + +Collective + +Input Parameters: +- `mengine` - the MATLAB engine +- `fd` - the file + +Level: advanced + +-seealso: `PetscMatlabEngineDestroy()`, `PetscMatlabEnginePut()`, `PetscMatlabEngineGet()`, +`PetscMatlabEngineEvaluate()`, `PetscMatlabEngineGetOutput()`, `PetscMatlabEngineCreate()`, +`PETSC_MATLAB_ENGINE_()`, `PetscMatlabEnginePutArray()`, `PetscMatlabEngineGetArray()`, `PetscMatlabEngine` + +# External Links +$(_doc_external("Sys/PetscMatlabEnginePrintOutput")) +""" +function PetscMatlabEnginePrintOutput(petsclib::PetscLibType, mengine::PetscMatlabEngine, fd::Libc.FILE) end + +@for_petsc function PetscMatlabEnginePrintOutput(petsclib::$UnionPetscLib, mengine::PetscMatlabEngine, fd::Libc.FILE ) + + @chk ccall( + (:PetscMatlabEnginePrintOutput, $petsc_library), + PetscErrorCode, + (PetscMatlabEngine, Ptr{Libc.FILE}), + mengine, fd, + ) + + + return nothing +end + +""" + PetscMatlabEnginePut(petsclib::PetscLibType,mengine::PetscMatlabEngine, obj::PetscObject) +Puts a PETSc object, such as a `Mat` or `Vec` into the MATLAB space. For parallel objects, +each processor's part is put in a separate MATLAB process. + +Collective + +Input Parameters: +- `mengine` - the MATLAB engine +- `obj` - the PETSc object, for example Vec + +Level: advanced + +-seealso: `PetscMatlabEngineDestroy()`, `PetscMatlabEngineCreate()`, `PetscMatlabEngineGet()`, +`PetscMatlabEngineEvaluate()`, `PetscMatlabEngineGetOutput()`, `PetscMatlabEnginePrintOutput()`, +`PETSC_MATLAB_ENGINE_()`, `PetscMatlabEnginePutArray()`, `PetscMatlabEngineGetArray()`, `PetscMatlabEngine` + +# External Links +$(_doc_external("Sys/PetscMatlabEnginePut")) +""" +function PetscMatlabEnginePut(petsclib::PetscLibType, mengine::PetscMatlabEngine, obj::PetscObject) end + +@for_petsc function PetscMatlabEnginePut(petsclib::$UnionPetscLib, mengine::PetscMatlabEngine, obj::PetscObject ) + + @chk ccall( + (:PetscMatlabEnginePut, $petsc_library), + PetscErrorCode, + (PetscMatlabEngine, PetscObject), + mengine, obj, + ) + + + return nothing +end + +""" + PetscMatlabEngineGet(petsclib::PetscLibType,mengine::PetscMatlabEngine, obj::PetscObject) +Gets a variable from MATLAB into a PETSc object. + +Collective + +Input Parameters: +- `mengine` - the MATLAB engine +- `obj` - the PETSc object, for example a `Vec` + +Level: advanced + +-seealso: `PetscMatlabEngineDestroy()`, `PetscMatlabEnginePut()`, `PetscMatlabEngineCreate()`, +`PetscMatlabEngineEvaluate()`, `PetscMatlabEngineGetOutput()`, `PetscMatlabEnginePrintOutput()`, +`PETSC_MATLAB_ENGINE_()`, `PetscMatlabEnginePutArray()`, `PetscMatlabEngineGetArray()`, `PetscMatlabEngine` + +# External Links +$(_doc_external("Sys/PetscMatlabEngineGet")) +""" +function PetscMatlabEngineGet(petsclib::PetscLibType, mengine::PetscMatlabEngine, obj::PetscObject) end + +@for_petsc function PetscMatlabEngineGet(petsclib::$UnionPetscLib, mengine::PetscMatlabEngine, obj::PetscObject ) + + @chk ccall( + (:PetscMatlabEngineGet, $petsc_library), + PetscErrorCode, + (PetscMatlabEngine, PetscObject), + mengine, obj, + ) + + + return nothing +end + +""" + PetscMatlabEnginePutArray(petsclib::PetscLibType,mengine::PetscMatlabEngine, m::Cint, n::Cint, array::Vector{PetscScalar}, name::String) +Puts an array into the MATLAB space, treating it as a Fortran style (column major ordering) array. For parallel objects, +each processors part is put in a separate MATLAB process. + +Collective + +Input Parameters: +- `mengine` - the MATLAB engine +- `m` - the x dimension of the array +- `n` - the y dimension of the array +- `array` - the array (represented in one dimension) +- `name` - the name of the array + +Level: advanced + +-seealso: `PetscMatlabEngineDestroy()`, `PetscMatlabEngineCreate()`, `PetscMatlabEngineGet()`, +`PetscMatlabEngineEvaluate()`, `PetscMatlabEngineGetOutput()`, `PetscMatlabEnginePrintOutput()`, +`PETSC_MATLAB_ENGINE_()`, `PetscMatlabEnginePut()`, `PetscMatlabEngineGetArray()`, `PetscMatlabEngine` + +# External Links +$(_doc_external("Sys/PetscMatlabEnginePutArray")) +""" +function PetscMatlabEnginePutArray(petsclib::PetscLibType, mengine::PetscMatlabEngine, m::Cint, n::Cint, array::Vector{PetscScalar}, name::String) end + +@for_petsc function PetscMatlabEnginePutArray(petsclib::$UnionPetscLib, mengine::PetscMatlabEngine, m::Cint, n::Cint, array::Vector{$PetscScalar}, name::String ) + + @chk ccall( + (:PetscMatlabEnginePutArray, $petsc_library), + PetscErrorCode, + (PetscMatlabEngine, Cint, Cint, Ptr{$PetscScalar}, Ptr{Cchar}), + mengine, m, n, array, name, + ) + + + return nothing +end + +""" + PetscMatlabEngineGetArray(petsclib::PetscLibType,mengine::PetscMatlabEngine, m::Cint, n::Cint, array::Vector{PetscScalar}, name::String) +Gets a variable from MATLAB into an array + +Not Collective + +Input Parameters: +- `mengine` - the MATLAB engine +- `m` - the x dimension of the array +- `n` - the y dimension of the array +- `array` - the array (represented in one dimension), much be large enough to hold all the data +- `name` - the name of the array + +Level: advanced + +-seealso: `PetscMatlabEngineDestroy()`, `PetscMatlabEnginePut()`, `PetscMatlabEngineCreate()`, +`PetscMatlabEngineEvaluate()`, `PetscMatlabEngineGetOutput()`, `PetscMatlabEnginePrintOutput()`, +`PETSC_MATLAB_ENGINE_()`, `PetscMatlabEnginePutArray()`, `PetscMatlabEngineGet()`, `PetscMatlabEngine` + +# External Links +$(_doc_external("Sys/PetscMatlabEngineGetArray")) +""" +function PetscMatlabEngineGetArray(petsclib::PetscLibType, mengine::PetscMatlabEngine, m::Cint, n::Cint, array::Vector{PetscScalar}, name::String) end + +@for_petsc function PetscMatlabEngineGetArray(petsclib::$UnionPetscLib, mengine::PetscMatlabEngine, m::Cint, n::Cint, array::Vector{$PetscScalar}, name::String ) + + @chk ccall( + (:PetscMatlabEngineGetArray, $petsc_library), + PetscErrorCode, + (PetscMatlabEngine, Cint, Cint, Ptr{$PetscScalar}, Ptr{Cchar}), + mengine, m, n, array, name, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscObject_wrappers.jl b/src/autowrapped/PetscObject_wrappers.jl new file mode 100644 index 00000000..dd87af3c --- /dev/null +++ b/src/autowrapped/PetscObject_wrappers.jl @@ -0,0 +1,1842 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscOptionItems end +const PetscOptionItems = Ptr{_n_PetscOptionItems} + +# ------------------------------------------------------- +""" + PetscObjectSAWsTakeAccess(petsclib::PetscLibType,obj::PetscObject) +Take access of the data fields that have been published to SAWs +by a `PetscObject` so their values may be changed in the computation + +Collective + +Input Parameter: +- `obj` - the `PetscObject` variable. This must be cast with a (`PetscObject`), for example, `PetscObjectSAWSTakeAccess`((`PetscObject`)mat); + +Level: advanced + +-seealso: `PetscObjectSetName()`, `PetscObjectSAWsViewOff()`, `PetscObjectSAWsGrantAccess()` + +# External Links +$(_doc_external("Sys/PetscObjectSAWsTakeAccess")) +""" +function PetscObjectSAWsTakeAccess(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectSAWsTakeAccess(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectSAWsTakeAccess, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectSAWsGrantAccess(petsclib::PetscLibType,obj::PetscObject) +Grants access of the data fields that have been published to +SAWs called when the changes made during `PetscObjectSAWsTakeAccess()` are complete. + +Collective + +Input Parameter: +- `obj` - the `PetscObject` variable. This must be cast with a (`PetscObject`), for example, `PetscObjectSAWSRestoreAccess`((`PetscObject`)mat); + +Level: advanced + +-seealso: `PetscObjectSetName()`, `PetscObjectSAWsViewOff()`, `PetscObjectSAWsTakeAccess()` + +# External Links +$(_doc_external("Sys/PetscObjectSAWsGrantAccess")) +""" +function PetscObjectSAWsGrantAccess(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectSAWsGrantAccess(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectSAWsGrantAccess, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectSAWsBlock(petsclib::PetscLibType,obj::PetscObject) +Blocks the object if `PetscObjectSAWsSetBlock()` has been called + +Collective + +Input Parameter: +- `obj` - the PETSc variable + +Level: advanced + +-seealso: `PetscObjectSetName()`, `PetscObjectSAWsViewOff()`, `PetscObjectSAWsSetBlock()`, `PetscSAWsBlock()` + +# External Links +$(_doc_external("Sys/PetscObjectSAWsBlock")) +""" +function PetscObjectSAWsBlock(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectSAWsBlock(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectSAWsBlock, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectSAWsSetBlock(petsclib::PetscLibType,obj::PetscObject, flg::PetscBool) +Sets whether an object will block at `PetscObjectSAWsBlock()` + +Collective + +Input Parameters: +- `obj` - the PETSc variable +- `flg` - whether it should block + +Level: advanced + +-seealso: `PetscObjectSetName()`, `PetscObjectSAWsViewOff()`, `PetscObjectSAWsBlock()`, `PetscSAWsBlock()` + +# External Links +$(_doc_external("Sys/PetscObjectSAWsSetBlock")) +""" +function PetscObjectSAWsSetBlock(petsclib::PetscLibType, obj::PetscObject, flg::PetscBool) end + +@for_petsc function PetscObjectSAWsSetBlock(petsclib::$UnionPetscLib, obj::PetscObject, flg::PetscBool ) + + @chk ccall( + (:PetscObjectSAWsSetBlock, $petsc_library), + PetscErrorCode, + (PetscObject, PetscBool), + obj, flg, + ) + + + return nothing +end + +""" + PetscObjectSAWsViewOff(petsclib::PetscLibType,obj::PetscObject) + +# External Links +$(_doc_external("Sys/PetscObjectSAWsViewOff")) +""" +function PetscObjectSAWsViewOff(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectSAWsViewOff(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectSAWsViewOff, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectViewSAWs(petsclib::PetscLibType,obj::PetscObject, viewer::PetscViewer) +View the base portion of any object with an SAWs viewer + +Collective + +Input Parameters: +- `obj` - the `PetscObject` variable. It must be cast with a (`PetscObject`), for example, `PetscObjectSetName`((`PetscObject`)mat,name); +- `viewer` - the SAWs viewer + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewer`, `PetscObject`, `PetscObjectSetName()` + +# External Links +$(_doc_external("Sys/PetscObjectViewSAWs")) +""" +function PetscObjectViewSAWs(petsclib::PetscLibType, obj::PetscObject, viewer::PetscViewer) end + +@for_petsc function PetscObjectViewSAWs(petsclib::$UnionPetscLib, obj::PetscObject, viewer::PetscViewer ) + + @chk ccall( + (:PetscObjectViewSAWs, $petsc_library), + PetscErrorCode, + (PetscObject, PetscViewer), + obj, viewer, + ) + + + return nothing +end + +""" + type::String = PetscObjectGetType(petsclib::PetscLibType,obj::PetscObject) +Gets the object type of any `PetscObject`. + +Not Collective + +Input Parameter: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, +`PetscObjectGetType`((`PetscObject`)mat,&type); + +Output Parameter: +- `type` - the object type, for example, `MATSEQAIJ` + +Level: advanced + +-seealso: `PetscObject`, `PetscClassId`, `PetscObjectGetClassName()`, `PetscObjectGetClassId()` + +# External Links +$(_doc_external("Sys/PetscObjectGetType")) +""" +function PetscObjectGetType(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectGetType(petsclib::$UnionPetscLib, obj::PetscObject ) + type_ = Ref{Ptr{Cchar}}() + + @chk ccall( + (:PetscObjectGetType, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Ptr{Cchar}}), + obj, type_, + ) + + type = unsafe_wrap(Array, type_[], VecGetLocalSize(petsclib, x); own = false) + + return type +end + +""" + PetscObjectsDump(petsclib::PetscLibType,fd::Libc.FILE, all::PetscBool) +Prints all the currently existing objects. + +Input Parameters: +- `fd` - file pointer +- `all` - by default only tries to display objects created explicitly by the user, if all is `PETSC_TRUE` then lists all outstanding objects + +Options Database Key: +- `-objects_dump ` - print information about all the objects that exist at the end of the programs run + +Level: advanced + +-seealso: `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectsDump")) +""" +function PetscObjectsDump(petsclib::PetscLibType, fd::Libc.FILE, all::PetscBool) end + +@for_petsc function PetscObjectsDump(petsclib::$UnionPetscLib, fd::Libc.FILE, all::PetscBool ) + + @chk ccall( + (:PetscObjectsDump, $petsc_library), + PetscErrorCode, + (Ptr{Libc.FILE}, PetscBool), + fd, all, + ) + + + return nothing +end + +""" + PetscObjectsView(petsclib::PetscLibType,viewer::PetscViewer) +Prints the currently existing objects. + +Logically Collective + +Input Parameter: +- `viewer` - must be an `PETSCVIEWERASCII` viewer + +Level: advanced + +-seealso: `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectsView")) +""" +function PetscObjectsView(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscObjectsView(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscObjectsView, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscObjectsGetObject(petsclib::PetscLibType,name::String, obj::PetscObject, classname::String) +Get a pointer to a named object + +Not Collective + +Input Parameter: +- `name` - the name of an object + +Output Parameters: +- `obj` - the object or `NULL` if there is no object, optional, pass in `NULL` if not needed +- `classname` - the name of the class of the object, optional, pass in `NULL` if not needed + +Level: advanced + +-seealso: `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectsGetObject")) +""" +function PetscObjectsGetObject(petsclib::PetscLibType, name::String, obj::PetscObject, classname::String) end + +@for_petsc function PetscObjectsGetObject(petsclib::$UnionPetscLib, name::String, obj::PetscObject, classname::String ) + classname_ = Ref(pointer(classname)) + + @chk ccall( + (:PetscObjectsGetObject, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscObject}, Ptr{Ptr{Cchar}}), + name, obj, classname_, + ) + + + return nothing +end + +""" + PetscObjectSetPrintedOptions(petsclib::PetscLibType,obj::PetscObject) +indicate to an object that it should behave as if it has already printed the help for its options so it will not display the help message + +Input Parameter: +- `obj` - the `PetscObject` + +Level: developer + +-seealso: `PetscOptionsInsert()`, `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectSetPrintedOptions")) +""" +function PetscObjectSetPrintedOptions(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectSetPrintedOptions(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectSetPrintedOptions, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectInheritPrintedOptions(petsclib::PetscLibType,pobj::PetscObject, obj::PetscObject) +If the child object is not on the MPI rank 0 process of the parent object and the child is sequential then the child gets it set. + +Input Parameters: +- `pobj` - the parent object +- `obj` - the `PetscObject` + +Level: developer + +-seealso: `PetscOptionsInsert()`, `PetscObjectSetPrintedOptions()`, `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectInheritPrintedOptions")) +""" +function PetscObjectInheritPrintedOptions(petsclib::PetscLibType, pobj::PetscObject, obj::PetscObject) end + +@for_petsc function PetscObjectInheritPrintedOptions(petsclib::$UnionPetscLib, pobj::PetscObject, obj::PetscObject ) + + @chk ccall( + (:PetscObjectInheritPrintedOptions, $petsc_library), + PetscErrorCode, + (PetscObject, PetscObject), + pobj, obj, + ) + + + return nothing +end + +""" + PetscObjectAddOptionsHandler(petsclib::PetscLibType,obj::PetscObject, handle::external, destroy::external, ctx::Cvoid) +Adds an additional function to check for options when `XXXSetFromOptions()` is called. + +Not Collective + +Input Parameters: +- `obj` - the PETSc object +- `handle` - function that checks for options +- `destroy` - function to destroy `ctx` if provided +- `ctx` - optional context for check function + +Calling sequence of `handle`: +- `obj` - the PETSc object +- `PetscOptionsObject` - the `PetscOptionItems` object +- `ctx` - optional context for `handle` + +Calling sequence of `destroy`: +- `obj` - the PETSc object +- `ctx` - optional context for `handle` + +Level: developer + +-seealso: `KSPSetFromOptions()`, `PCSetFromOptions()`, `SNESSetFromOptions()`, `PetscObjectProcessOptionsHandlers()`, `PetscObjectDestroyOptionsHandlers()`, +`PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectAddOptionsHandler")) +""" +function PetscObjectAddOptionsHandler(petsclib::PetscLibType, obj::PetscObject, handle::external, destroy::external, ctx::Cvoid) end + +@for_petsc function PetscObjectAddOptionsHandler(petsclib::$UnionPetscLib, obj::PetscObject, handle::external, destroy::external, ctx::Cvoid ) + + @chk ccall( + (:PetscObjectAddOptionsHandler, $petsc_library), + PetscErrorCode, + (PetscObject, external, external, Ptr{Cvoid}), + obj, handle, destroy, ctx, + ) + + + return nothing +end + +""" + PetscObjectProcessOptionsHandlers(petsclib::PetscLibType,obj::PetscObject, PetscOptionsObject::PetscOptionItems) +Calls all the options handlers attached to an object + +Not Collective + +Input Parameters: +- `obj` - the PETSc object +- `PetscOptionsObject` - the options context + +Level: developer + +-seealso: `KSPSetFromOptions()`, `PCSetFromOptions()`, `SNESSetFromOptions()`, `PetscObjectAddOptionsHandler()`, `PetscObjectDestroyOptionsHandlers()`, +`PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectProcessOptionsHandlers")) +""" +function PetscObjectProcessOptionsHandlers(petsclib::PetscLibType, obj::PetscObject, PetscOptionsObject::PetscOptionItems) end + +@for_petsc function PetscObjectProcessOptionsHandlers(petsclib::$UnionPetscLib, obj::PetscObject, PetscOptionsObject::PetscOptionItems ) + + @chk ccall( + (:PetscObjectProcessOptionsHandlers, $petsc_library), + PetscErrorCode, + (PetscObject, PetscOptionItems), + obj, PetscOptionsObject, + ) + + + return nothing +end + +""" + PetscObjectDestroyOptionsHandlers(petsclib::PetscLibType,obj::PetscObject) +Destroys all the option handlers attached to an object + +Not Collective + +Input Parameter: +- `obj` - the PETSc object + +Level: developer + +-seealso: `KSPSetFromOptions()`, `PCSetFromOptions()`, `SNESSetFromOptions()`, `PetscObjectAddOptionsHandler()`, `PetscObjectProcessOptionsHandlers()`, +`PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectDestroyOptionsHandlers")) +""" +function PetscObjectDestroyOptionsHandlers(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectDestroyOptionsHandlers(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectDestroyOptionsHandlers, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectReference(petsclib::PetscLibType,obj::PetscObject) +Indicates to a `PetscObject` that it is being +referenced by another `PetscObject`. This increases the reference +count for that object by one. + +Logically Collective + +Input Parameter: +- `obj` - the PETSc object. This must be cast with (`PetscObject`), for example, `PetscObjectReference`((`PetscObject`)mat); + +Level: advanced + +-seealso: `PetscObjectCompose()`, `PetscObjectDereference()`, `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectReference")) +""" +function PetscObjectReference(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectReference(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectReference, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + cnt::PetscInt = PetscObjectGetReference(petsclib::PetscLibType,obj::PetscObject) +Gets the current reference count for a PETSc object. + +Not Collective + +Input Parameter: +- `obj` - the PETSc object; this must be cast with (`PetscObject`), for example, +`PetscObjectGetReference`((`PetscObject`)mat,&cnt); `obj` cannot be `NULL` + +Output Parameter: +- `cnt` - the reference count + +Level: advanced + +-seealso: `PetscObjectCompose()`, `PetscObjectDereference()`, `PetscObjectReference()`, `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectGetReference")) +""" +function PetscObjectGetReference(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectGetReference(petsclib::$UnionPetscLib, obj::PetscObject ) + cnt_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscObjectGetReference, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{$PetscInt}), + obj, cnt_, + ) + + cnt = cnt_[] + + return cnt +end + +""" + PetscObjectDereference(petsclib::PetscLibType,obj::PetscObject) +Indicates to any `PetscObject` that it is being +referenced by one less `PetscObject`. This decreases the reference +count for that object by one. + +Collective on `obj` if reference reaches 0 otherwise Logically Collective + +Input Parameter: +- `obj` - the PETSc object; this must be cast with (`PetscObject`), for example, +`PetscObjectDereference`((`PetscObject`)mat); + +Level: advanced + +-seealso: `PetscObjectCompose()`, `PetscObjectReference()`, `PetscObjectDestroy()`, `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectDereference")) +""" +function PetscObjectDereference(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectDereference(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectDereference, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectRemoveReference(petsclib::PetscLibType,obj::PetscObject, name::String) + +# External Links +$(_doc_external("Sys/PetscObjectRemoveReference")) +""" +function PetscObjectRemoveReference(petsclib::PetscLibType, obj::PetscObject, name::String) end + +@for_petsc function PetscObjectRemoveReference(petsclib::$UnionPetscLib, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscObjectRemoveReference, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}), + obj, name, + ) + + + return nothing +end + +""" + PetscObjectCompose(petsclib::PetscLibType,obj::PetscObject, name::String, ptr::PetscObject) +Associates another PETSc object with a given PETSc object. + +Not Collective + +Input Parameters: +- `obj` - the PETSc object; this must be cast with (`PetscObject`), for example, +`PetscObjectCompose`((`PetscObject`)mat,...); +- `name` - name associated with the child object +- `ptr` - the other PETSc object to associate with the PETSc object; this must also be +cast with (`PetscObject`) + +Level: advanced + +-seealso: `PetscObjectQuery()`, `PetscContainerCreate()`, `PetscObjectComposeFunction()`, `PetscObjectQueryFunction()`, `PetscContainer`, +`PetscContainerSetPointer()`, `PetscObject`, `PetscObjectContainerCompose()` + +# External Links +$(_doc_external("Sys/PetscObjectCompose")) +""" +function PetscObjectCompose(petsclib::PetscLibType, obj::PetscObject, name::String, ptr::PetscObject) end + +@for_petsc function PetscObjectCompose(petsclib::$UnionPetscLib, obj::PetscObject, name::String, ptr::PetscObject ) + + @chk ccall( + (:PetscObjectCompose, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}, PetscObject), + obj, name, ptr, + ) + + + return nothing +end + +""" + PetscObjectQuery(petsclib::PetscLibType,obj::PetscObject, name::String, ptr::PetscObject) +Gets a PETSc object associated with a given object that was composed with `PetscObjectCompose()` + +Not Collective + +Input Parameters: +- `obj` - the PETSc object. It must be cast with a (`PetscObject`), for example, +`PetscObjectCompose`((`PetscObject`)mat,...); +- `name` - name associated with child object +- `ptr` - the other PETSc object associated with the PETSc object, this must be +cast with (`PetscObject`*) + +Level: advanced + +-seealso: `PetscObjectCompose()`, `PetscObjectComposeFunction()`, `PetscObjectQueryFunction()`, `PetscContainer` +`PetscContainerGetPointer()`, `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectQuery")) +""" +function PetscObjectQuery(petsclib::PetscLibType, obj::PetscObject, name::String, ptr::PetscObject) end + +@for_petsc function PetscObjectQuery(petsclib::$UnionPetscLib, obj::PetscObject, name::String, ptr::PetscObject ) + + @chk ccall( + (:PetscObjectQuery, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}, Ptr{PetscObject}), + obj, name, ptr, + ) + + + return nothing +end + +""" + has::PetscBool = PetscObjectHasFunction(petsclib::PetscLibType,obj::PetscObject, name::String) +Query if a function is associated with a given object. + +Logically Collective + +Input Parameters: +- `obj` - the PETSc object +- `name` - name associated with the child function + +Output Parameter: +- `has` - the boolean value + +Level: advanced + +-seealso: `PetscObject`, `PetscObjectComposeFunction()`, `PetscObjectQueryFunction()` + +# External Links +$(_doc_external("Sys/PetscObjectHasFunction")) +""" +function PetscObjectHasFunction(petsclib::PetscLibType, obj::PetscObject, name::String) end + +@for_petsc function PetscObjectHasFunction(petsclib::$UnionPetscLib, obj::PetscObject, name::String ) + has_ = Ref{PetscBool}() + + @chk ccall( + (:PetscObjectHasFunction, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}, Ptr{PetscBool}), + obj, name, has_, + ) + + has = has_[] + + return has +end + +""" + PetscObjectContainerCompose(petsclib::PetscLibType,obj::PetscObject, name::String, pointer::Cvoid, destroy::PetscCtxDestroyFn) +Creates a `PetscContainer`, provides all of its values and composes it with a `PetscObject` + +Collective + +Input Parameters: +- `obj` - the `PetscObject` +- `name` - the name for the composed container +- `pointer` - the pointer to the data +- `destroy` - the routine to destroy the container's data, see `PetscCtxDestroyFn` for its calling sequence; use `PetscCtxDestroyDefault()` if a `PetscFree()` frees the data + +Level: advanced + +-seealso: `PetscContainerCreate()`, `PetscContainerDestroy()`, `PetscContainerSetPointer()`, `PetscContainerGetPointer()`, `PetscObjectCompose()`, `PetscObjectQuery()`, +`PetscContainerSetCtxDestroy()`, `PetscObject`, `PetscObjectContainerQuery()` + +# External Links +$(_doc_external("Sys/PetscObjectContainerCompose")) +""" +function PetscObjectContainerCompose(petsclib::PetscLibType, obj::PetscObject, name::String, pointer::Cvoid, destroy::PetscCtxDestroyFn) end + +@for_petsc function PetscObjectContainerCompose(petsclib::$UnionPetscLib, obj::PetscObject, name::String, pointer::Cvoid, destroy::PetscCtxDestroyFn ) + + @chk ccall( + (:PetscObjectContainerCompose, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + obj, name, pointer, destroy, + ) + + + return nothing +end + +""" + PetscObjectContainerQuery(petsclib::PetscLibType,obj::PetscObject, name::String, pointer::PeCtx) +Accesses the pointer in a container composed to a `PetscObject` with `PetscObjectContainerCompose()` + +Collective + +Input Parameters: +- `obj` - the `PetscObject` +- `name` - the name for the composed container + +Output Parameter: +- `pointer` - the pointer to the data + +Level: advanced + +-seealso: `PetscContainerCreate()`, `PetscContainerDestroy()`, `PetscContainerSetPointer()`, `PetscContainerGetPointer()`, `PetscObjectCompose()`, `PetscObjectQuery()`, +`PetscContainerSetCtxDestroy()`, `PetscObject`, `PetscObjectContainerCompose()` + +# External Links +$(_doc_external("Sys/PetscObjectContainerQuery")) +""" +function PetscObjectContainerQuery(petsclib::PetscLibType, obj::PetscObject, name::String, pointer::PeCtx) end + +@for_petsc function PetscObjectContainerQuery(petsclib::$UnionPetscLib, obj::PetscObject, name::String, pointer::PeCtx ) + + @chk ccall( + (:PetscObjectContainerQuery, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}, PeCtx), + obj, name, pointer, + ) + + + return nothing +end + +""" + PetscObjectSetFromOptions(petsclib::PetscLibType,obj::PetscObject) +Sets generic parameters from user options. + +Collective + +Input Parameter: +- `obj` - the `PetscObject` + +Level: beginner + +-seealso: `PetscObjectSetOptionsPrefix()`, `PetscObjectGetOptionsPrefix()`, `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectSetFromOptions")) +""" +function PetscObjectSetFromOptions(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectSetFromOptions(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectSetUp(petsclib::PetscLibType,obj::PetscObject) +Sets up the internal data structures for later use of the object + +Collective + +Input Parameter: +- `obj` - the `PetscObject` + +Level: advanced + +-seealso: `PetscObjectDestroy()`, `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectSetUp")) +""" +function PetscObjectSetUp(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectSetUp(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectSetUp, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectGetName(petsclib::PetscLibType,obj::PetscObject, name::String) +Gets a string name associated with a PETSc object. + +Not Collective unless `obj` has not yet been named + +Input Parameters: +- `obj` - the PETSc variable. It must be cast with a (`PetscObject`), for example, +`PetscObjectGetName`((`PetscObject`)mat,&name); +- `name` - the name associated with `obj`, do not free + +Level: intermediate + +-seealso: `PetscObjectSetName()`, `PetscObjectName()`, `PetscObject`, `PetscObjectGetId()` + +# External Links +$(_doc_external("Sys/PetscObjectGetName")) +""" +function PetscObjectGetName(petsclib::PetscLibType, obj::PetscObject, name::String) end + +@for_petsc function PetscObjectGetName(petsclib::$UnionPetscLib, obj::PetscObject, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PetscObjectGetName, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Ptr{Cchar}}), + obj, name_, + ) + + + return nothing +end + +""" + PetscObjectDestroy(petsclib::PetscLibType,obj::PetscObject) +Destroys a `PetscObject`, regardless of the type. + +Collective + +Input Parameter: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, +`PetscObjectDestroy` (`PetscObject` mat); + +Level: beginner + +-seealso: `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectDestroy")) +""" +function PetscObjectDestroy(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectDestroy(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscObject},), + obj, + ) + + + return nothing +end + +""" + PetscObjectView(petsclib::PetscLibType,obj::PetscObject, viewer::PetscViewer) +Views a `PetscObject` regardless of the type. + +Collective + +Input Parameters: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, +`PetscObjectView`((`PetscObject`)mat,`viewer`); +- `viewer` - any PETSc viewer + +Level: intermediate + +-seealso: `PetscObject`, `PetscObjectViewFromOptions()`, `PetscViewer` + +# External Links +$(_doc_external("Sys/PetscObjectView")) +""" +function PetscObjectView(petsclib::PetscLibType, obj::PetscObject, viewer::PetscViewer) end + +@for_petsc function PetscObjectView(petsclib::$UnionPetscLib, obj::PetscObject, viewer::PetscViewer ) + + @chk ccall( + (:PetscObjectView, $petsc_library), + PetscErrorCode, + (PetscObject, PetscViewer), + obj, viewer, + ) + + + return nothing +end + +""" + PetscObjectViewFromOptions(petsclib::PetscLibType,obj::PetscObject, bobj::PetscObject, optionname::String) +Processes command line options to determine if/how a `PetscObject` is to be viewed. + +Collective + +Input Parameters: +- `obj` - the object +- `bobj` - optional other object that provides prefix (if `NULL` then the prefix in `obj` is used) +- `optionname` - option string that is used to activate viewing + +Options Database Key: +- `-optionname_view [viewertype]:...` - option name and values. In actual usage this would be something like `-mat_coarse_view` + +Level: developer + +-seealso: `PetscObject`, `PetscObjectView()`, `PetscOptionsCreateViewer()` + +# External Links +$(_doc_external("Sys/PetscObjectViewFromOptions")) +""" +function PetscObjectViewFromOptions(petsclib::PetscLibType, obj::PetscObject, bobj::PetscObject, optionname::String) end + +@for_petsc function PetscObjectViewFromOptions(petsclib::$UnionPetscLib, obj::PetscObject, bobj::PetscObject, optionname::String ) + + @chk ccall( + (:PetscObjectViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscObject, PetscObject, Ptr{Cchar}), + obj, bobj, optionname, + ) + + + return nothing +end + +""" + same::PetscBool = PetscObjectTypeCompare(petsclib::PetscLibType,obj::PetscObject, type_name::String) +Determines whether a PETSc object is of a particular type. + +Not Collective + +Input Parameters: +- `obj` - a PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, +`PetscObjectTypeCompare`((`PetscObject`)mat); +- `type_name` - string containing a type name + +Output Parameter: +- `same` - `PETSC_TRUE` if the type of `obj` and `type_name` are the same or both `NULL`, else `PETSC_FALSE` + +Level: intermediate + +-seealso: `PetscObject`, `VecGetType()`, `KSPGetType()`, `PCGetType()`, `SNESGetType()`, `PetscObjectBaseTypeCompare()`, `PetscObjectTypeCompareAny()`, `PetscObjectBaseTypeCompareAny()`, `PetscObjectObjectTypeCompare()` + +# External Links +$(_doc_external("Sys/PetscObjectTypeCompare")) +""" +function PetscObjectTypeCompare(petsclib::PetscLibType, obj::PetscObject, type_name::String) end + +@for_petsc function PetscObjectTypeCompare(petsclib::$UnionPetscLib, obj::PetscObject, type_name::String ) + same_ = Ref{PetscBool}() + + @chk ccall( + (:PetscObjectTypeCompare, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}, Ptr{PetscBool}), + obj, type_name, same_, + ) + + same = same_[] + + return same +end + +""" + same::PetscBool = PetscObjectObjectTypeCompare(petsclib::PetscLibType,obj1::PetscObject, obj2::PetscObject) +Determines whether two PETSc objects are of the same type + +Logically Collective + +Input Parameters: +- `obj1` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. +- `obj2` - another PETSc object + +Output Parameter: +- `same` - `PETSC_TRUE` if they are the same or both unset, else `PETSC_FALSE` + +Level: intermediate + +-seealso: `PetscObjectTypeCompare()`, `VecGetType()`, `KSPGetType()`, `PCGetType()`, `SNESGetType()`, `PetscObjectBaseTypeCompare()`, `PetscObjectTypeCompareAny()`, `PetscObjectBaseTypeCompareAny()` + + +# External Links +$(_doc_external("Sys/PetscObjectObjectTypeCompare")) +""" +function PetscObjectObjectTypeCompare(petsclib::PetscLibType, obj1::PetscObject, obj2::PetscObject) end + +@for_petsc function PetscObjectObjectTypeCompare(petsclib::$UnionPetscLib, obj1::PetscObject, obj2::PetscObject ) + same_ = Ref{PetscBool}() + + @chk ccall( + (:PetscObjectObjectTypeCompare, $petsc_library), + PetscErrorCode, + (PetscObject, PetscObject, Ptr{PetscBool}), + obj1, obj2, same_, + ) + + same = same_[] + + return same +end + +""" + same::PetscBool = PetscObjectBaseTypeCompare(petsclib::PetscLibType,obj::PetscObject, type_name::String) +Determines whether a `PetscObject` is of a given base type. For example the base type of `MATSEQAIJPERM` is `MATSEQAIJ` + +Not Collective + +Input Parameters: +- `obj` - the object +- `type_name` - string containing a type name + +Output Parameter: +- `same` - `PETSC_TRUE` if the object is of the same base type identified by `type_name` or both `NULL`, `PETSC_FALSE` otherwise + +Level: intermediate + +-seealso: `PetscObject`, `PetscObjectTypeCompare()`, `PetscObjectTypeCompareAny()`, `PetscObjectBaseTypeCompareAny()` + +# External Links +$(_doc_external("Sys/PetscObjectBaseTypeCompare")) +""" +function PetscObjectBaseTypeCompare(petsclib::PetscLibType, obj::PetscObject, type_name::String) end + +@for_petsc function PetscObjectBaseTypeCompare(petsclib::$UnionPetscLib, obj::PetscObject, type_name::String ) + same_ = Ref{PetscBool}() + + @chk ccall( + (:PetscObjectBaseTypeCompare, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}, Ptr{PetscBool}), + obj, type_name, same_, + ) + + same = same_[] + + return same +end + +""" + PetscObjectRegisterDestroy(petsclib::PetscLibType,obj::PetscObject) +Registers a PETSc object to be destroyed when +`PetscFinalize()` is called. + +Logically Collective + +Input Parameter: +- `obj` - a PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, +`PetscObjectRegisterDestroy`((`PetscObject`)mat); + +Level: developer + +-seealso: `PetscObjectRegisterDestroyAll()` + +# External Links +$(_doc_external("Sys/PetscObjectRegisterDestroy")) +""" +function PetscObjectRegisterDestroy(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectRegisterDestroy(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectRegisterDestroy, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectRegisterDestroyAll(petsclib::PetscLibType) +Frees all the PETSc objects that have been registered +with `PetscObjectRegisterDestroy()`. Called by `PetscFinalize()` + +Logically Collective on the individual `PetscObject`s that are being processed + +Level: developer + +-seealso: `PetscObjectRegisterDestroy()` + +# External Links +$(_doc_external("Sys/PetscObjectRegisterDestroyAll")) +""" +function PetscObjectRegisterDestroyAll(petsclib::PetscLibType) end + +@for_petsc function PetscObjectRegisterDestroyAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscObjectRegisterDestroyAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscObjectGetId(petsclib::PetscLibType,obj::PetscObject, id::PetscObjectId) +get a unique object ID for the `PetscObject` + +Not Collective + +Input Parameter: +- `obj` - object + +Output Parameter: +- `id` - integer ID + +Level: developer + +-seealso: `PetscObjectStateGet()`, `PetscObjectCompareId()` + +# External Links +$(_doc_external("Sys/PetscObjectGetId")) +""" +function PetscObjectGetId(petsclib::PetscLibType, obj::PetscObject, id::PetscObjectId) end + +@for_petsc function PetscObjectGetId(petsclib::$UnionPetscLib, obj::PetscObject, id::PetscObjectId ) + + @chk ccall( + (:PetscObjectGetId, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{PetscObjectId}), + obj, id, + ) + + + return nothing +end + +""" + eq::PetscBool = PetscObjectCompareId(petsclib::PetscLibType,obj::PetscObject, id::PetscObjectId) +compares the objects ID with a given id + +Not Collective + +Input Parameters: +- `obj` - object +- `id` - integer ID + +Output Parameter: +- `eq` - the ids are equal + +Level: developer + +-seealso: `PetscObjectStateGet()`, `PetscObjectGetId()` + +# External Links +$(_doc_external("Sys/PetscObjectCompareId")) +""" +function PetscObjectCompareId(petsclib::PetscLibType, obj::PetscObject, id::PetscObjectId) end + +@for_petsc function PetscObjectCompareId(petsclib::$UnionPetscLib, obj::PetscObject, id::PetscObjectId ) + eq_ = Ref{PetscBool}() + + @chk ccall( + (:PetscObjectCompareId, $petsc_library), + PetscErrorCode, + (PetscObject, PetscObjectId, Ptr{PetscBool}), + obj, id, eq_, + ) + + eq = eq_[] + + return eq +end + +""" + PetscObjectGetOptions(petsclib::PetscLibType,obj::PetscObject, options::PetscOptions) +Gets the options database used by the object that has been set with `PetscObjectSetOptions()` + +Collective + +Input Parameter: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. + +Output Parameter: +- `options` - the options database + +Level: advanced + +-seealso: `PetscOptionsCreate()`, `PetscOptionsDestroy()`, `PetscObjectSetOptionsPrefix()`, `PetscObjectAppendOptionsPrefix()`, `PetscObjectPrependOptionsPrefix()`, +`PetscObjectGetOptionsPrefix()`, `PetscObjectSetOptions()` + +# External Links +$(_doc_external("Sys/PetscObjectGetOptions")) +""" +function PetscObjectGetOptions(petsclib::PetscLibType, obj::PetscObject, options::PetscOptions) end + +@for_petsc function PetscObjectGetOptions(petsclib::$UnionPetscLib, obj::PetscObject, options::PetscOptions ) + options_ = Ref(options.ptr) + + @chk ccall( + (:PetscObjectGetOptions, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{COptions}), + obj, options_, + ) + + options.ptr = C_NULL + + return nothing +end + +""" + PetscObjectSetOptions(petsclib::PetscLibType,obj::PetscObject, options::PetscOptions) +Sets the options database used by the object. Call immediately after creating the object. + +Collective + +Input Parameters: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. +- `options` - the options database, use NULL for default + +Level: advanced + +-seealso: `PetscOptionsCreate()`, `PetscOptionsDestroy()`, `PetscObjectSetOptionsPrefix()`, `PetscObjectAppendOptionsPrefix()`, `PetscObjectPrependOptionsPrefix()`, +`PetscObjectGetOptionsPrefix()`, `PetscObjectGetOptions()` + +# External Links +$(_doc_external("Sys/PetscObjectSetOptions")) +""" +function PetscObjectSetOptions(petsclib::PetscLibType, obj::PetscObject, options::PetscOptions) end + +@for_petsc function PetscObjectSetOptions(petsclib::$UnionPetscLib, obj::PetscObject, options::PetscOptions ) + + @chk ccall( + (:PetscObjectSetOptions, $petsc_library), + PetscErrorCode, + (PetscObject, COptions), + obj, options, + ) + + + return nothing +end + +""" + PetscObjectSetOptionsPrefix(petsclib::PetscLibType,obj::PetscObject, prefix::String) +Sets the prefix used for searching for all +options for the given object in the database. + +Collective + +Input Parameters: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. +- `prefix` - the prefix string to prepend to option requests of the object. + +Level: advanced + +-seealso: `PetscOptionsCreate()`, `PetscOptionsDestroy()`, `PetscObjectAppendOptionsPrefix()`, `PetscObjectPrependOptionsPrefix()`, +`PetscObjectGetOptionsPrefix()`, `TSSetOptionsPrefix()`, `SNESSetOptionsPrefix()`, `KSPSetOptionsPrefix()` + +# External Links +$(_doc_external("Sys/PetscObjectSetOptionsPrefix")) +""" +function PetscObjectSetOptionsPrefix(petsclib::PetscLibType, obj::PetscObject, prefix::String) end + +@for_petsc function PetscObjectSetOptionsPrefix(petsclib::$UnionPetscLib, obj::PetscObject, prefix::String ) + + @chk ccall( + (:PetscObjectSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}), + obj, prefix, + ) + + + return nothing +end + +""" + PetscObjectAppendOptionsPrefix(petsclib::PetscLibType,obj::PetscObject, prefix::String) +Appends to the prefix used for searching for options for the given object in the database. + +Input Parameters: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. +- `prefix` - the prefix string to prepend to option requests of the object. + +Level: advanced + +-seealso: `PetscOptionsCreate()`, `PetscOptionsDestroy()`, `PetscObjectSetOptionsPrefix()`, `PetscObjectPrependOptionsPrefix()`, +`PetscObjectGetOptionsPrefix()`, `TSAppendOptionsPrefix()`, `SNESAppendOptionsPrefix()`, `KSPAppendOptionsPrefix()` + +# External Links +$(_doc_external("Sys/PetscObjectAppendOptionsPrefix")) +""" +function PetscObjectAppendOptionsPrefix(petsclib::PetscLibType, obj::PetscObject, prefix::String) end + +@for_petsc function PetscObjectAppendOptionsPrefix(petsclib::$UnionPetscLib, obj::PetscObject, prefix::String ) + + @chk ccall( + (:PetscObjectAppendOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}), + obj, prefix, + ) + + + return nothing +end + +""" + PetscObjectGetOptionsPrefix(petsclib::PetscLibType,obj::PetscObject, prefix::String) +Gets the prefix of the `PetscObject` used for searching in the options database + +Input Parameter: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. + +Output Parameter: +- `prefix` - pointer to the prefix string used is returned + +Level: advanced + +-seealso: `PetscOptionsCreate()`, `PetscOptionsDestroy()`, `PetscObjectSetOptionsPrefix()`, `PetscObjectAppendOptionsPrefix()`, `PetscObjectPrependOptionsPrefix()`, +`TSGetOptionsPrefix()`, `SNESGetOptionsPrefix()`, `KSPGetOptionsPrefix()` + +# External Links +$(_doc_external("Sys/PetscObjectGetOptionsPrefix")) +""" +function PetscObjectGetOptionsPrefix(petsclib::PetscLibType, obj::PetscObject, prefix::String) end + +@for_petsc function PetscObjectGetOptionsPrefix(petsclib::$UnionPetscLib, obj::PetscObject, prefix::String ) + prefix_ = Ref(pointer(prefix)) + + @chk ccall( + (:PetscObjectGetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Ptr{Cchar}}), + obj, prefix_, + ) + + + return nothing +end + +""" + PetscObjectPrependOptionsPrefix(petsclib::PetscLibType,obj::PetscObject, prefix::String) +Sets the prefix used for searching for options of for this object in the database. + +Input Parameters: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. +- `prefix` - the prefix string to prepend to option requests of the object. + +Level: advanced + +-seealso: `PetscOptionsCreate()`, `PetscOptionsDestroy()`, `PetscObjectSetOptionsPrefix()`, `PetscObjectAppendOptionsPrefix()`, +`PetscObjectGetOptionsPrefix()` + +# External Links +$(_doc_external("Sys/PetscObjectPrependOptionsPrefix")) +""" +function PetscObjectPrependOptionsPrefix(petsclib::PetscLibType, obj::PetscObject, prefix::String) end + +@for_petsc function PetscObjectPrependOptionsPrefix(petsclib::$UnionPetscLib, obj::PetscObject, prefix::String ) + + @chk ccall( + (:PetscObjectPrependOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}), + obj, prefix, + ) + + + return nothing +end + +""" + comm::MPI_Comm = PetscObjectGetComm(petsclib::PetscLibType,obj) +Gets the MPI communicator for any `PetscObject` regardless of the type. + +Not Collective + +Input Parameter: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, +`PetscObjectGetComm`((`PetscObject`)mat,&comm); + +Output Parameter: +- `comm` - the MPI communicator + +Level: advanced + +-seealso: `PetscObject`, `PetscObjectComm()` + +# External Links +$(_doc_external("Sys/PetscObjectGetComm")) +""" +function PetscObjectGetComm(petsclib::PetscLibType, obj) end + +@for_petsc function PetscObjectGetComm(petsclib::$UnionPetscLib, obj) + comm = Ref(MPI_Comm()) + @chk ccall( + (:PetscObjectGetComm, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{MPI_Comm}), + obj, comm + ) + + return comm[] +end + +""" + tab::PetscInt = PetscObjectGetTabLevel(petsclib::PetscLibType,obj::PetscObject) +Gets the number of tabs that `PETSCVIEWERASCII` output for that object uses + +Not Collective + +Input Parameter: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, +`PetscObjectGetTabLevel`((`PetscObject`)mat,&tab); + +Output Parameter: +- `tab` - the number of tabs + +Level: developer + +-seealso: `PetscObjectIncrementTabLevel()`, `PetscObjectSetTabLevel()`, `PETSCVIEWERASCII`, `PetscObject` + +# External Links +$(_doc_external("Sys/PetscObjectGetTabLevel")) +""" +function PetscObjectGetTabLevel(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectGetTabLevel(petsclib::$UnionPetscLib, obj::PetscObject ) + tab_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscObjectGetTabLevel, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{$PetscInt}), + obj, tab_, + ) + + tab = tab_[] + + return tab +end + +""" + PetscObjectSetTabLevel(petsclib::PetscLibType,obj::PetscObject, tab::PetscInt) +Sets the number of tabs that `PETSCVIEWERASCII` output for that object uses + +Not Collective + +Input Parameters: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, +`PetscObjectSetTabLevel`((`PetscObject`)mat,tab; +- `tab` - the number of tabs + +Level: developer + +-seealso: `PetscObjectIncrementTabLevel()`, `PetscObjectGetTabLevel()` + +# External Links +$(_doc_external("Sys/PetscObjectSetTabLevel")) +""" +function PetscObjectSetTabLevel(petsclib::PetscLibType, obj::PetscObject, tab::PetscInt) end + +@for_petsc function PetscObjectSetTabLevel(petsclib::$UnionPetscLib, obj::PetscObject, tab::$PetscInt ) + + @chk ccall( + (:PetscObjectSetTabLevel, $petsc_library), + PetscErrorCode, + (PetscObject, $PetscInt), + obj, tab, + ) + + + return nothing +end + +""" + PetscObjectIncrementTabLevel(petsclib::PetscLibType,obj::PetscObject, oldobj::PetscObject, tab::PetscInt) +Increments the number of tabs that `PETSCVIEWERASCII` output for that object use based on +the tablevel of another object. This should be called immediately after the object is created. + +Not Collective + +Input Parameters: +- `obj` - any PETSc object where we are changing the tab +- `oldobj` - the object providing the tab, optional pass `NULL` to use 0 as the previous tablevel for `obj` +- `tab` - the increment that is added to the old objects tab + +Level: developer + +-seealso: `PETSCVIEWERASCII`, `PetscObjectSetTabLevel()`, `PetscObjectGetTabLevel()` + +# External Links +$(_doc_external("Sys/PetscObjectIncrementTabLevel")) +""" +function PetscObjectIncrementTabLevel(petsclib::PetscLibType, obj::PetscObject, oldobj::PetscObject, tab::PetscInt) end + +@for_petsc function PetscObjectIncrementTabLevel(petsclib::$UnionPetscLib, obj::PetscObject, oldobj::PetscObject, tab::$PetscInt ) + + @chk ccall( + (:PetscObjectIncrementTabLevel, $petsc_library), + PetscErrorCode, + (PetscObject, PetscObject, $PetscInt), + obj, oldobj, tab, + ) + + + return nothing +end + +""" + PetscObjectGetNewTag(petsclib::PetscLibType,obj::PetscObject, tag::PetscMPIInt) +Gets a unique new tag from a PETSc object. All +processors that share the object MUST call this routine EXACTLY the same +number of times. This tag should only be used with the current objects +communicator; do NOT use it with any other MPI communicator. + +Collective + +Input Parameter: +- `obj` - the PETSc object; this must be cast with a (`PetscObject`), for example, +`PetscObjectGetNewTag`((`PetscObject`)mat,&tag); + +Output Parameter: +- `tag` - the new tag + +Level: developer + +-seealso: `PetscCommGetNewTag()` + +# External Links +$(_doc_external("Sys/PetscObjectGetNewTag")) +""" +function PetscObjectGetNewTag(petsclib::PetscLibType, obj::PetscObject, tag::PetscMPIInt) end + +@for_petsc function PetscObjectGetNewTag(petsclib::$UnionPetscLib, obj::PetscObject, tag::PetscMPIInt ) + + @chk ccall( + (:PetscObjectGetNewTag, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{PetscMPIInt}), + obj, tag, + ) + + + return nothing +end + +""" + count::PetscInt,numbering::PetscInt = PetscObjectsListGetGlobalNumbering(petsclib::PetscLibType,comm::MPI_Comm, len::PetscInt, objlist::Vector{PetscObject}) +computes a global numbering +of `PetscObject`s living on subcommunicators of a given communicator. + +Collective. + +Input Parameters: +- `comm` - the `MPI_Comm` +- `len` - local length of `objlist` +- `objlist` - a list of PETSc objects living on subcomms of comm and containing this comm rank +(subcomm ordering is assumed to be deadlock-free) + +Output Parameters: +- `count` - global number of distinct subcommunicators on objlist (may be > `len`) +- `numbering` - global numbers of objlist entries (allocated by user) + +Level: developer + +-seealso: `PetscCommDuplicate()`, `PetscObjectDestroy()` + +# External Links +$(_doc_external("Sys/PetscObjectsListGetGlobalNumbering")) +""" +function PetscObjectsListGetGlobalNumbering(petsclib::PetscLibType, comm::MPI_Comm, len::PetscInt, objlist::Vector{PetscObject}) end + +@for_petsc function PetscObjectsListGetGlobalNumbering(petsclib::$UnionPetscLib, comm::MPI_Comm, len::$PetscInt, objlist::Vector{PetscObject} ) + count_ = Ref{$PetscInt}() + numbering_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscObjectsListGetGlobalNumbering, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{PetscObject}, Ptr{$PetscInt}, Ptr{$PetscInt}), + comm, len, objlist, count_, numbering_, + ) + + count = count_[] + numbering = numbering_[] + + return count,numbering +end + +""" + PetscObjectGetClassId(petsclib::PetscLibType,obj::PetscObject, classid::PetscClassId) +Gets the classid for any `PetscObject` + +Not Collective + +Input Parameter: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, +`PetscObjectGetClassId`((`PetscObject`)mat,&classid); + +Output Parameter: +- `classid` - the classid + +Level: developer + +-seealso: `PetscObject`, `PetscClassId`, `PetscObjectGetClassName()`, `PetscObjectGetType()` + +# External Links +$(_doc_external("Sys/PetscObjectGetClassId")) +""" +function PetscObjectGetClassId(petsclib::PetscLibType, obj::PetscObject, classid::PetscClassId) end + +@for_petsc function PetscObjectGetClassId(petsclib::$UnionPetscLib, obj::PetscObject, classid::PetscClassId ) + + @chk ccall( + (:PetscObjectGetClassId, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{PetscClassId}), + obj, classid, + ) + + + return nothing +end + +""" + PetscObjectGetClassName(petsclib::PetscLibType,obj::PetscObject, classname::String) +Gets the class name for any `PetscObject` + +Not Collective + +Input Parameter: +- `obj` - any PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, +`PetscObjectGetClassName`((`PetscObject`)mat,&classname); + +Output Parameter: +- `classname` - the class name, for example "Vec" + +Level: developer + +-seealso: `PetscObject`, `PetscClassId`, `PetscObjectGetType()`, `PetscObjectGetClassId()` + +# External Links +$(_doc_external("Sys/PetscObjectGetClassName")) +""" +function PetscObjectGetClassName(petsclib::PetscLibType, obj::PetscObject, classname::String) end + +@for_petsc function PetscObjectGetClassName(petsclib::$UnionPetscLib, obj::PetscObject, classname::String ) + classname_ = Ref(pointer(classname)) + + @chk ccall( + (:PetscObjectGetClassName, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Ptr{Cchar}}), + obj, classname_, + ) + + + return nothing +end + +""" + PetscObjectSetName(petsclib::PetscLibType,obj::PetscObject, name::String) +Sets a string name for a PETSc object. + +Not Collective + +Input Parameters: +- `obj` - the PETSc object. It must be cast with a (`PetscObject`), for example, +`PetscObjectSetName`((`PetscObject`)mat,name); +- `name` - the name to give obj + +Level: advanced + +-seealso: `PetscObjectGetName()`, `PetscObjectName()` + +# External Links +$(_doc_external("Sys/PetscObjectSetName")) +""" +function PetscObjectSetName(petsclib::PetscLibType, obj::PetscObject, name::String) end + +@for_petsc function PetscObjectSetName(petsclib::$UnionPetscLib, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscObjectSetName, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}), + obj, name, + ) + + + return nothing +end + +""" + PetscObjectPrintClassNamePrefixType(petsclib::PetscLibType,obj::PetscObject, viewer::PetscViewer) +used in the `XXXView()` methods to display information about the class, name, prefix and type of an object + +Input Parameters: +- `obj` - the PETSc object +- `viewer` - `PETSCVIEWERASCII` viewer where the information is printed, function does nothing if the viewer is not `PETSCVIEWERASCII` type + +Level: developer + +-seealso: `PetscObjectSetName()`, `PetscObjectName()` + +# External Links +$(_doc_external("Sys/PetscObjectPrintClassNamePrefixType")) +""" +function PetscObjectPrintClassNamePrefixType(petsclib::PetscLibType, obj::PetscObject, viewer::PetscViewer) end + +@for_petsc function PetscObjectPrintClassNamePrefixType(petsclib::$UnionPetscLib, obj::PetscObject, viewer::PetscViewer ) + + @chk ccall( + (:PetscObjectPrintClassNamePrefixType, $petsc_library), + PetscErrorCode, + (PetscObject, PetscViewer), + obj, viewer, + ) + + + return nothing +end + +""" + PetscObjectName(petsclib::PetscLibType,obj::PetscObject) +Gives `obj` a name if it does not have one + +Collective + +Input Parameter: +- `obj` - the PETSc object. It must be cast with a (`PetscObject`), for example, `PetscObjectName`((`PetscObject`)mat,name); + +Level: developer + +-seealso: `PetscObjectGetName()`, `PetscObjectSetName()` + +# External Links +$(_doc_external("Sys/PetscObjectName")) +""" +function PetscObjectName(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscObjectName(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscObjectName, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscObjectChangeTypeName(petsclib::PetscLibType,obj::PetscObject, type_name::String) + +# External Links +$(_doc_external("Sys/PetscObjectChangeTypeName")) +""" +function PetscObjectChangeTypeName(petsclib::PetscLibType, obj::PetscObject, type_name::String) end + +@for_petsc function PetscObjectChangeTypeName(petsclib::$UnionPetscLib, obj::PetscObject, type_name::String ) + + @chk ccall( + (:PetscObjectChangeTypeName, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}), + obj, type_name, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscOmpCtrl_wrappers.jl b/src/autowrapped/PetscOmpCtrl_wrappers.jl new file mode 100644 index 00000000..af466a31 --- /dev/null +++ b/src/autowrapped/PetscOmpCtrl_wrappers.jl @@ -0,0 +1,184 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscOmpCtrl end +const PetscOmpCtrl = Ptr{_n_PetscOmpCtrl} +# ------------------------------------------------------- +""" + pctrl::PetscOmpCtrl = PetscOmpCtrlCreate(petsclib::PetscLibType,petsc_comm::MPI_Comm, nthreads::PetscInt) +create a PETSc OpenMP controller, which manages PETSc's interaction with third party libraries that use OpenMP + +Input Parameters: +- `petsc_comm` - a communicator some PETSc object (for example, a matrix) lives in +- `nthreads` - number of threads per MPI rank to spawn in a library using OpenMP. If nthreads = -1, let PETSc decide a suitable value + +Output Parameter: +- `pctrl` - a PETSc OpenMP controller + +Level: developer + +-seealso: `PetscOmpCtrlDestroy()`, `PetscOmpCtrlGetOmpComms()`, `PetscOmpCtrlBarrier()`, `PetscOmpCtrlOmpRegionOnMasterBegin()`, `PetscOmpCtrlOmpRegionOnMasterEnd()`, + +# External Links +$(_doc_external("Sys/PetscOmpCtrlCreate")) +""" +function PetscOmpCtrlCreate(petsclib::PetscLibType, petsc_comm::MPI_Comm, nthreads::PetscInt) end + +@for_petsc function PetscOmpCtrlCreate(petsclib::$UnionPetscLib, petsc_comm::MPI_Comm, nthreads::$PetscInt ) + pctrl_ = Ref{PetscOmpCtrl}() + + @chk ccall( + (:PetscOmpCtrlCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{PetscOmpCtrl}), + petsc_comm, nthreads, pctrl_, + ) + + pctrl = pctrl_[] + + return pctrl +end + +""" + PetscOmpCtrlDestroy(petsclib::PetscLibType,pctrl::PetscOmpCtrl) +destroy the PETSc OpenMP controller + +Input Parameter: +- `pctrl` - a PETSc OpenMP controller + +Level: developer + +-seealso: `PetscOmpCtrlCreate()`, `PetscOmpCtrlGetOmpComms()`, `PetscOmpCtrlBarrier()`, `PetscOmpCtrlOmpRegionOnMasterBegin()`, `PetscOmpCtrlOmpRegionOnMasterEnd()`, + +# External Links +$(_doc_external("Sys/PetscOmpCtrlDestroy")) +""" +function PetscOmpCtrlDestroy(petsclib::PetscLibType, pctrl::PetscOmpCtrl) end + +@for_petsc function PetscOmpCtrlDestroy(petsclib::$UnionPetscLib, pctrl::PetscOmpCtrl ) + + @chk ccall( + (:PetscOmpCtrlDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscOmpCtrl},), + pctrl, + ) + + + return nothing +end + +""" + is_omp_master::PetscBool = PetscOmpCtrlGetOmpComms(petsclib::PetscLibType,ctrl::PetscOmpCtrl, omp_comm::MPI_Comm, omp_master_comm::MPI_Comm) +Get MPI communicators from a PETSc OMP controller + +Input Parameter: +- `ctrl` - a PETSc OMP controller + +Output Parameters: +- `omp_comm` - a communicator that includes a master rank and slave ranks where master spawns threads +- `omp_master_comm` - on master ranks, return a communicator that include master ranks of each omp_comm; +on slave ranks, `MPI_COMM_NULL` will be return in reality. +- `is_omp_master` - true if the calling process is an OMP master rank. + +-seealso: `PetscOmpCtrlCreate()`, `PetscOmpCtrlDestroy()`, `PetscOmpCtrlBarrier()`, `PetscOmpCtrlOmpRegionOnMasterBegin()`, `PetscOmpCtrlOmpRegionOnMasterEnd()`, + +# External Links +$(_doc_external("Sys/PetscOmpCtrlGetOmpComms")) +""" +function PetscOmpCtrlGetOmpComms(petsclib::PetscLibType, ctrl::PetscOmpCtrl, omp_comm::MPI_Comm, omp_master_comm::MPI_Comm) end + +@for_petsc function PetscOmpCtrlGetOmpComms(petsclib::$UnionPetscLib, ctrl::PetscOmpCtrl, omp_comm::MPI_Comm, omp_master_comm::MPI_Comm ) + is_omp_master_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOmpCtrlGetOmpComms, $petsc_library), + PetscErrorCode, + (PetscOmpCtrl, Ptr{MPI_Comm}, Ptr{MPI_Comm}, Ptr{PetscBool}), + ctrl, omp_comm, omp_master_comm, is_omp_master_, + ) + + is_omp_master = is_omp_master_[] + + return is_omp_master +end + +""" + PetscOmpCtrlBarrier(petsclib::PetscLibType,ctrl::PetscOmpCtrl) +Do barrier on MPI ranks in omp_comm contained by the PETSc OMP controller (to let slave ranks free their CPU) + +Input Parameter: +- `ctrl` - a PETSc OMP controller + +-seealso: `PetscOmpCtrlOmpRegionOnMasterBegin()`, `PetscOmpCtrlOmpRegionOnMasterEnd()`, `PetscOmpCtrlCreate()`, `PetscOmpCtrlDestroy()`, + +# External Links +$(_doc_external("Sys/PetscOmpCtrlBarrier")) +""" +function PetscOmpCtrlBarrier(petsclib::PetscLibType, ctrl::PetscOmpCtrl) end + +@for_petsc function PetscOmpCtrlBarrier(petsclib::$UnionPetscLib, ctrl::PetscOmpCtrl ) + + @chk ccall( + (:PetscOmpCtrlBarrier, $petsc_library), + PetscErrorCode, + (PetscOmpCtrl,), + ctrl, + ) + + + return nothing +end + +""" + PetscOmpCtrlOmpRegionOnMasterBegin(petsclib::PetscLibType,ctrl::PetscOmpCtrl) +Mark the beginning of an OpenMP library call on master ranks + +Input Parameter: +- `ctrl` - a PETSc OMP controller + +-seealso: `PetscOmpCtrlOmpRegionOnMasterEnd()`, `PetscOmpCtrlCreate()`, `PetscOmpCtrlDestroy()`, `PetscOmpCtrlBarrier()` + +# External Links +$(_doc_external("Sys/PetscOmpCtrlOmpRegionOnMasterBegin")) +""" +function PetscOmpCtrlOmpRegionOnMasterBegin(petsclib::PetscLibType, ctrl::PetscOmpCtrl) end + +@for_petsc function PetscOmpCtrlOmpRegionOnMasterBegin(petsclib::$UnionPetscLib, ctrl::PetscOmpCtrl ) + + @chk ccall( + (:PetscOmpCtrlOmpRegionOnMasterBegin, $petsc_library), + PetscErrorCode, + (PetscOmpCtrl,), + ctrl, + ) + + + return nothing +end + +""" + PetscOmpCtrlOmpRegionOnMasterEnd(petsclib::PetscLibType,ctrl::PetscOmpCtrl) +Mark the end of an OpenMP library call on master ranks + +Input Parameter: +- `ctrl` - a PETSc OMP controller + +-seealso: `PetscOmpCtrlOmpRegionOnMasterBegin()`, `PetscOmpCtrlCreate()`, `PetscOmpCtrlDestroy()`, `PetscOmpCtrlBarrier()` + +# External Links +$(_doc_external("Sys/PetscOmpCtrlOmpRegionOnMasterEnd")) +""" +function PetscOmpCtrlOmpRegionOnMasterEnd(petsclib::PetscLibType, ctrl::PetscOmpCtrl) end + +@for_petsc function PetscOmpCtrlOmpRegionOnMasterEnd(petsclib::$UnionPetscLib, ctrl::PetscOmpCtrl ) + + @chk ccall( + (:PetscOmpCtrlOmpRegionOnMasterEnd, $petsc_library), + PetscErrorCode, + (PetscOmpCtrl,), + ctrl, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscOptions_addons_wrappers.jl b/src/autowrapped/PetscOptions_addons_wrappers.jl new file mode 100644 index 00000000..deb6a2b3 --- /dev/null +++ b/src/autowrapped/PetscOptions_addons_wrappers.jl @@ -0,0 +1,102 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscOptionsHelpPrCinted end +const PetscOptionsHelpPrCinted = Ptr{_n_PetscOptionsHelpPrCinted} + +# ------------------------------------------------------- +# autodefined type arguments for class ------ +# ------------------------------------------------------- +# autodefined type arguments for class ------ +# ------------------------------------------------------- +""" + PetscOptionsHelpPrintedDestroy(petsclib::PetscLibType,hp::PetscOptionsHelpPrCinted) + +# External Links +$(_doc_external("Sys/PetscOptionsHelpPrintedDestroy")) +""" +function PetscOptionsHelpPrintedDestroy(petsclib::PetscLibType, hp::PetscOptionsHelpPrCinted) end + +@for_petsc function PetscOptionsHelpPrintedDestroy(petsclib::$UnionPetscLib, hp::PetscOptionsHelpPrCinted ) + + @chk ccall( + (:PetscOptionsHelpPrintedDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscOptionsHelpPrCinted},), + hp, + ) + + + return nothing +end + +""" + hp::PetscOptionsHelpPrCinted = PetscOptionsHelpPrintedCreate(petsclib::PetscLibType) +Creates an object used to manage tracking which help messages have +been printed so they will not be printed again. + +Output Parameter: +- `hp` - the created object + +Not Collective + +Level: developer + +-seealso: `PetscOptionsHelpPrintedCheck()`, `PetscOptionsHelpPrintChecked()` + +# External Links +$(_doc_external("Sys/PetscOptionsHelpPrintedCreate")) +""" +function PetscOptionsHelpPrintedCreate(petsclib::PetscLibType) end + +@for_petsc function PetscOptionsHelpPrintedCreate(petsclib::$UnionPetscLib) + hp_ = Ref{PetscOptionsHelpPrCinted}() + + @chk ccall( + (:PetscOptionsHelpPrintedCreate, $petsc_library), + PetscErrorCode, + (Ptr{PetscOptionsHelpPrCinted},), + hp_, + ) + + hp = hp_[] + + return hp +end + +""" + found::PetscBool = PetscOptionsHelpPrintedCheck(petsclib::PetscLibType,hp::PetscOptionsHelpPrCinted, pre::String, name::String) +Checks if a particular pre, name pair has previous been entered (meaning the help message was printed) + +Not Collective + +Input Parameters: +- `hp` - the object used to manage tracking what help messages have been printed +- `pre` - the prefix part of the string, many be `NULL` +- `name` - the string to look for (cannot be `NULL`) + +Output Parameter: +- `found` - `PETSC_TRUE` if the string was already set + +Level: intermediate + +-seealso: `PetscOptionsHelpPrintedCreate()` + +# External Links +$(_doc_external("Sys/PetscOptionsHelpPrintedCheck")) +""" +function PetscOptionsHelpPrintedCheck(petsclib::PetscLibType, hp::PetscOptionsHelpPrCinted, pre::String, name::String) end + +@for_petsc function PetscOptionsHelpPrintedCheck(petsclib::$UnionPetscLib, hp::PetscOptionsHelpPrCinted, pre::String, name::String ) + found_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsHelpPrintedCheck, $petsc_library), + PetscErrorCode, + (PetscOptionsHelpPrCinted, Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}), + hp, pre, name, found_, + ) + + found = found_[] + + return found +end + diff --git a/src/autowrapped/PetscOptions_wrappers.jl b/src/autowrapped/PetscOptions_wrappers.jl new file mode 100644 index 00000000..cdd52abb --- /dev/null +++ b/src/autowrapped/PetscOptions_wrappers.jl @@ -0,0 +1,2217 @@ +# autodefined type arguments for class ------ +# ------------------------------------------------------- + +""" + PetscOptionsPushCreateViewerOff(petsclib::PetscLibType,flg::PetscBool) +sets if `PetscOptionsCreateViewer()`, `PetscOptionsViewer()`, and `PetscOptionsCreateViewers()` return viewers. + +Logically Collective + +Input Parameter: +- `flg` - `PETSC_TRUE` to turn off viewer creation, `PETSC_FALSE` to turn it on. + +Level: developer + +-seealso: [](sec_viewers), `PetscOptionsCreateViewer()`, `PetscOptionsPopCreateViewerOff()` + +# External Links +$(_doc_external("Sys/PetscOptionsPushCreateViewerOff")) +""" +function PetscOptionsPushCreateViewerOff(petsclib::PetscLibType, flg::PetscBool) end + +@for_petsc function PetscOptionsPushCreateViewerOff(petsclib::$UnionPetscLib, flg::PetscBool ) + + @chk ccall( + (:PetscOptionsPushCreateViewerOff, $petsc_library), + PetscErrorCode, + (PetscBool,), + flg, + ) + + + return nothing +end + +""" + PetscOptionsPopCreateViewerOff(petsclib::PetscLibType) +reset whether `PetscOptionsCreateViewer()` returns a viewer. + +Logically Collective + +Level: developer + +-seealso: [](sec_viewers), `PetscOptionsCreateViewer()`, `PetscOptionsPushCreateViewerOff()` + +# External Links +$(_doc_external("Sys/PetscOptionsPopCreateViewerOff")) +""" +function PetscOptionsPopCreateViewerOff(petsclib::PetscLibType) end + +@for_petsc function PetscOptionsPopCreateViewerOff(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscOptionsPopCreateViewerOff, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + flg::PetscBool = PetscOptionsGetCreateViewerOff(petsclib::PetscLibType) +do `PetscOptionsCreateViewer()`, `PetscOptionsViewer()`, and `PetscOptionsCreateViewers()` return viewers + +Logically Collective + +Output Parameter: +- `flg` - whether viewers are returned. + +Level: developer + +-seealso: [](sec_viewers), `PetscOptionsCreateViewer()`, `PetscOptionsPushCreateViewerOff()`, `PetscOptionsPopCreateViewerOff()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetCreateViewerOff")) +""" +function PetscOptionsGetCreateViewerOff(petsclib::PetscLibType) end + +@for_petsc function PetscOptionsGetCreateViewerOff(petsclib::$UnionPetscLib) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetCreateViewerOff, $petsc_library), + PetscErrorCode, + (Ptr{PetscBool},), + flg_, + ) + + flg = flg_[] + + return flg +end + +""" + viewer::PetscViewer,format::PetscViewerFormat,set::PetscBool = PetscOptionsCreateViewer(petsclib::PetscLibType,comm::MPI_Comm, options::Union{Ptr,PetscOptions}, pre::String, name::String) +Creates a viewer appropriate for the type indicated by the user + +Collective + +Input Parameters: +- `comm` - the communicator to own the viewer +- `options` - options database, use `NULL` for default global database +- `pre` - the string to prepend to the name or `NULL` +- `name` - the options database name that will be checked for + +Output Parameters: +- `viewer` - the viewer, pass `NULL` if not needed +- `format` - the `PetscViewerFormat` requested by the user, pass `NULL` if not needed +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewerDestroy()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, +`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` +`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsPushCreateViewerOff()`, `PetscOptionsPopCreateViewerOff()`, +`PetscOptionsCreateViewerOff()` + +# External Links +$(_doc_external("Sys/PetscOptionsCreateViewer")) +""" +function PetscOptionsCreateViewer(petsclib::PetscLibType, comm::MPI_Comm, options::Union{Ptr,PetscOptions}, pre::String, name::String) end + +@for_petsc function PetscOptionsCreateViewer(petsclib::$UnionPetscLib, comm::MPI_Comm, options::Union{Ptr,PetscOptions}, pre::String, name::String) + viewer_ = Ref{PetscViewer}() + format_ = Ref{PetscViewerFormat}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsCreateViewer, $petsc_library), + PetscErrorCode, + (MPI_Comm, COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscViewer}, Ptr{PetscViewerFormat}, Ptr{PetscBool}), + comm, options, pre, name, viewer_, format_, set_, + ) + + viewer = viewer_[] + format = format_[] + set = set_[] + + return viewer,format,set +end + +""" + viewers::Vector{PetscViewer},formats::Vector{PetscViewerFormat},set::PetscBool = PetscOptionsCreateViewers(petsclib::PetscLibType,comm::MPI_Comm, options::PetscOptions, pre::String, name::String, n_max::PetscInt) +Create multiple viewers from a comma + +Collective + +Input Parameters: +- `comm` - the communicator to own the viewers +- `options` - options database, use `NULL` for default global database +- `pre` - the string to prepend to the name or `NULL` +- `name` - the options database name that will be checked for +- `n_max` - on input: the maximum number of viewers; on output: the number of viewers in the comma-separated list + +Output Parameters: +- `viewers` - an array to hold at least `n_max` `PetscViewer`s, or `NULL` if not needed; on output: if not `NULL`, the +first `n_max` entries are initialized `PetscViewer`s +- `formats` - an array to hold at least `n_max` `PetscViewerFormat`s, or `NULL` if not needed; on output: if not `NULL`, the first `n_max` entries are valid `PetscViewerFormat`s +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: intermediate + +-seealso: [](sec_viewers), `PetscOptionsCreateViewer()` + +# External Links +$(_doc_external("Sys/PetscOptionsCreateViewers")) +""" +function PetscOptionsCreateViewers(petsclib::PetscLibType, comm::MPI_Comm, options::PetscOptions, pre::String, name::String, n_max::PetscInt) end + +@for_petsc function PetscOptionsCreateViewers(petsclib::$UnionPetscLib, comm::MPI_Comm, options::PetscOptions, pre::String, name::String, n_max::$PetscInt ) + viewers = Vector{PetscViewer}(undef, ni); # CHECK SIZE!! + formats = Vector{PetscViewerFormat}(undef, ni); # CHECK SIZE!! + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsCreateViewers, $petsc_library), + PetscErrorCode, + (MPI_Comm, COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscInt}, Ptr{PetscViewer}, Ptr{PetscViewerFormat}, Ptr{PetscBool}), + comm, options, pre, name, n_max, viewers, formats, set_, + ) + + set = set_[] + + return viewers,formats,set +end + +""" + PetscOptionsInsertStringYAML(petsclib::PetscLibType,options::PetscOptions, in_str::String) +Inserts YAML + +Logically Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `in_str` - YAML-formatted string options + +Level: intermediate + +-seealso: `PetscOptionsSetValue()`, `PetscOptionsView()`, `PetscOptionsHasName()`, `PetscOptionsGetInt()`, +`PetscOptionsGetReal()`, `PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsInsertFile()`, `PetscOptionsInsertFileYAML()` + +# External Links +$(_doc_external("Sys/PetscOptionsInsertStringYAML")) +""" +function PetscOptionsInsertStringYAML(petsclib::PetscLibType, options::PetscOptions, in_str::String) end + +@for_petsc function PetscOptionsInsertStringYAML(petsclib::$UnionPetscLib, options::PetscOptions, in_str::String ) + + @chk ccall( + (:PetscOptionsInsertStringYAML, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}), + options, in_str, + ) + + + return nothing +end + +""" + PetscOptionsInsertFileYAML(petsclib::PetscLibType,comm::MPI_Comm, options::PetscOptions, file::String, require::PetscBool) +Insert a YAML + +Collective + +Input Parameters: +- `comm` - the processes that will share the options (usually `PETSC_COMM_WORLD`) +- `options` - options database, use `NULL` for default global database +- `file` - name of file +- `require` - if `PETSC_TRUE` will generate an error if the file does not exist + +Level: intermediate + +-seealso: `PetscOptionsSetValue()`, `PetscOptionsView()`, `PetscOptionsHasName()`, `PetscOptionsGetInt()`, +`PetscOptionsGetReal()`, `PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsInsertFile()`, `PetscOptionsInsertStringYAML()` + +# External Links +$(_doc_external("Sys/PetscOptionsInsertFileYAML")) +""" +function PetscOptionsInsertFileYAML(petsclib::PetscLibType, comm::MPI_Comm, options::PetscOptions, file::String, require::PetscBool) end + +@for_petsc function PetscOptionsInsertFileYAML(petsclib::$UnionPetscLib, comm::MPI_Comm, options::PetscOptions, file::String, require::PetscBool ) + + @chk ccall( + (:PetscOptionsInsertFileYAML, $petsc_library), + PetscErrorCode, + (MPI_Comm, COptions, Ptr{Cchar}, PetscBool), + comm, options, file, require, + ) + + + return nothing +end + +""" + options::PetscOptions = PetscOptionsCreate(petsclib::PetscLibType) +Creates an empty options database. + +Logically Collective + +Output Parameter: +- `options` - Options database object + +Level: advanced + +-seealso: `PetscOptionsDestroy()`, `PetscOptionsPush()`, `PetscOptionsPop()`, `PetscOptionsInsert()`, `PetscOptionsSetValue()` + +# External Links +$(_doc_external("Sys/PetscOptionsCreate")) +""" +function PetscOptionsCreate(petsclib::PetscLibType) end + +@for_petsc function PetscOptionsCreate(petsclib::$UnionPetscLib) + options_ = Ref{COptions}() + + @chk ccall( + (:PetscOptionsCreate, $petsc_library), + PetscErrorCode, + (Ptr{COptions},), + options_, + ) + + options = PetscOptions(options_[], petsclib) + + return options +end + +""" + PetscOptionsDestroy(petsclib::PetscLibType,options::PetscOptions) +Destroys an option database. + +Logically Collective on whatever communicator was associated with the call to `PetscOptionsCreate()` + +Input Parameter: +- `options` - the `PetscOptions` object + +Level: advanced + +-seealso: `PetscOptionsInsert()`, `PetscOptionsPush()`, `PetscOptionsPop()`, `PetscOptionsSetValue()` + +# External Links +$(_doc_external("Sys/PetscOptionsDestroy")) +""" +function PetscOptionsDestroy(petsclib::PetscLibType, options::PetscOptions) end + +@for_petsc function PetscOptionsDestroy(petsclib::$UnionPetscLib, options::PetscOptions ) + options_ = Ref(options.ptr) + + @chk ccall( + (:PetscOptionsDestroy, $petsc_library), + PetscErrorCode, + (Ptr{COptions},), + options_, + ) + + options.ptr = C_NULL + + return nothing +end + +""" + PetscOptionsCreateDefault(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscOptionsCreateDefault")) +""" +function PetscOptionsCreateDefault(petsclib::PetscLibType) end + +@for_petsc function PetscOptionsCreateDefault(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscOptionsCreateDefault, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscOptionsPush(petsclib::PetscLibType,opt::PetscOptions) +Push a new `PetscOptions` object as the default provider of options +Allows using different parts of a code to use different options databases + +Logically Collective + +Input Parameter: +- `opt` - the options obtained with `PetscOptionsCreate()` + +Level: advanced + +-seealso: `PetscOptionsPop()`, `PetscOptionsCreate()`, `PetscOptionsInsert()`, `PetscOptionsSetValue()`, `PetscOptionsLeft()` + +# External Links +$(_doc_external("Sys/PetscOptionsPush")) +""" +function PetscOptionsPush(petsclib::PetscLibType, opt::PetscOptions) end + +@for_petsc function PetscOptionsPush(petsclib::$UnionPetscLib, opt::PetscOptions ) + + @chk ccall( + (:PetscOptionsPush, $petsc_library), + PetscErrorCode, + (COptions,), + opt, + ) + + + return nothing +end + +""" + PetscOptionsPop(petsclib::PetscLibType) +Pop the most recent `PetscOptionsPush()` to return to the previous default options + +Logically Collective on whatever communicator was associated with the call to `PetscOptionsCreate()` + +Level: advanced + +-seealso: `PetscOptionsCreate()`, `PetscOptionsInsert()`, `PetscOptionsSetValue()`, `PetscOptionsLeft()` + +# External Links +$(_doc_external("Sys/PetscOptionsPop")) +""" +function PetscOptionsPop(petsclib::PetscLibType) end + +@for_petsc function PetscOptionsPop(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscOptionsPop, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscOptionsDestroyDefault(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscOptionsDestroyDefault")) +""" +function PetscOptionsDestroyDefault(petsclib::PetscLibType) end + +@for_petsc function PetscOptionsDestroyDefault(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscOptionsDestroyDefault, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + valid::PetscBool = PetscOptionsValidKey(petsclib::PetscLibType,key::String) +PETSc Options database keys must begin with one or two dashes ( + +Not Collective + +Input Parameter: +- `key` - string to check if valid + +Output Parameter: +- `valid` - `PETSC_TRUE` if a valid key + +Level: intermediate + +-seealso: `PetscOptionsCreate()`, `PetscOptionsInsert()` + +# External Links +$(_doc_external("Sys/PetscOptionsValidKey")) +""" +function PetscOptionsValidKey(petsclib::PetscLibType, key::String) end + +@for_petsc function PetscOptionsValidKey(petsclib::$UnionPetscLib, key::String ) + valid_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsValidKey, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscBool}), + key, valid_, + ) + + valid = valid_[] + + return valid +end + +""" + PetscOptionsInsertString(petsclib::PetscLibType,options::PetscOptions, in_str::String) +Inserts options into the database from a string + +Logically Collective + +Input Parameters: +- `options` - options object +- `in_str` - string that contains options separated by blanks + +Level: intermediate + +The collectivity of this routine is complex; only the MPI processes that call this routine will +have the affect of these options. If some processes that create objects call this routine and others do +not the code may fail in complicated ways because the same parallel solvers may incorrectly use different options +on different ranks. + +Contributed by Boyana Norris + +-seealso: `PetscOptionsSetValue()`, `PetscOptionsView()`, `PetscOptionsHasName()`, `PetscOptionsGetInt()`, +`PetscOptionsGetReal()`, `PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsInsertFile()` + +# External Links +$(_doc_external("Sys/PetscOptionsInsertString")) +""" +function PetscOptionsInsertString(petsclib::PetscLibType, options::PetscOptions, in_str::String) end + +@for_petsc function PetscOptionsInsertString(petsclib::$UnionPetscLib, options::PetscOptions, in_str::String ) + + @chk ccall( + (:PetscOptionsInsertString, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}), + options, in_str, + ) + + + return nothing +end + +""" + PetscOptionsInsertFile(petsclib::PetscLibType,comm::MPI_Comm, options::PetscOptions, file::String, require::PetscBool) +Inserts options into the database from a file. + +Collective + +Input Parameters: +- `comm` - the processes that will share the options (usually `PETSC_COMM_WORLD`) +- `options` - options database, use `NULL` for default global database +- `file` - name of file, +".yml" and ".yaml" filename extensions are inserted as YAML options, +append ":yaml" to filename to force YAML options. +- `require` - if `PETSC_TRUE` will generate an error if the file does not exist + +Level: developer + +-seealso: `PetscOptionsSetValue()`, `PetscOptionsView()`, `PetscOptionsHasName()`, `PetscOptionsGetInt()`, +`PetscOptionsGetReal()`, `PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsInsertFile")) +""" +function PetscOptionsInsertFile(petsclib::PetscLibType, comm::MPI_Comm, options::PetscOptions, file::String, require::PetscBool) end + +@for_petsc function PetscOptionsInsertFile(petsclib::$UnionPetscLib, comm::MPI_Comm, options::PetscOptions, file::String, require::PetscBool ) + + @chk ccall( + (:PetscOptionsInsertFile, $petsc_library), + PetscErrorCode, + (MPI_Comm, COptions, Ptr{Cchar}, PetscBool), + comm, options, file, require, + ) + + + return nothing +end + +""" + PetscOptionsInsertArgs(petsclib::PetscLibType,options::PetscOptions, argc::Cint, args::String) +Inserts options into the database from a array of strings + +Logically Collective + +Input Parameters: +- `options` - options object +- `argc` - the array length +- `args` - the string array + +Level: intermediate + +-seealso: `PetscOptions`, `PetscOptionsInsertString()`, `PetscOptionsInsertFile()` + +# External Links +$(_doc_external("Sys/PetscOptionsInsertArgs")) +""" +function PetscOptionsInsertArgs(petsclib::PetscLibType, options::PetscOptions, argc::Cint, args::String) end + +@for_petsc function PetscOptionsInsertArgs(petsclib::$UnionPetscLib, options::PetscOptions, argc::Cint, args::String ) + args_ = Ref(pointer(args)) + + @chk ccall( + (:PetscOptionsInsertArgs, $petsc_library), + PetscErrorCode, + (COptions, Cint, Ptr{Ptr{Cchar}}), + options, argc, args_, + ) + + + return nothing +end + +""" + PetscOptionsInsert(petsclib::PetscLibType,options::PetscOptions, argc::Cint, args::Cchar, file::String) +Inserts into the options database from the command line, +the environmental variable and a file. + +Collective on `PETSC_COMM_WORLD` + +Input Parameters: +- `options` - options database or `NULL` for the default global database +- `argc` - count of number of command line arguments +- `args` - the command line arguments +- `file` - [optional] PETSc database file, append ":yaml" to filename to specify YAML options format. +Use `NULL` or empty string to not check for code specific file. +Also checks ~/.petscrc, .petscrc and petscrc. +Use -skip_petscrc in the code specific file (or command line) to skip ~/.petscrc, .petscrc and petscrc files. + +Options Database Keys: +- `-options_file ` - read options from a file +- `-options_file_yaml ` - read options from a YAML file + +Level: advanced + +-seealso: `PetscOptionsDestroy()`, `PetscOptionsView()`, `PetscOptionsInsertString()`, `PetscOptionsInsertFile()`, +`PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscOptionsInsert")) +""" +function PetscOptionsInsert(petsclib::PetscLibType, options::PetscOptions, argc::Cint, args::Cchar, file::String) end + +@for_petsc function PetscOptionsInsert(petsclib::$UnionPetscLib, options::PetscOptions, argc::Cint, args::Cchar, file::String ) + + @chk ccall( + (:PetscOptionsInsert, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cint}, Cchar, Ptr{Cchar}), + options, argc, args, file, + ) + + + return nothing +end + +""" + PetscOptionsView(petsclib::PetscLibType,options::PetscOptions, viewer::PetscViewerFormat) +Prints the options that have been loaded. This is +useful for debugging purposes. + +Logically Collective, No Fortran Support + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `viewer` - must be an `PETSCVIEWERASCII` viewer, can be `PETSC_VIEWER_DEFAULT` + +Options Database Key: +- `-options_view` - Activates `PetscOptionsView()` within `PetscFinalize()` + +Level: advanced + +-seealso: `PetscOptionsAllUsed()` + +# External Links +$(_doc_external("Sys/PetscOptionsView")) +""" +function PetscOptionsView(petsclib::PetscLibType, options::PetscOptions, viewer::PetscViewer) end + +@for_petsc function PetscOptionsView(petsclib::$UnionPetscLib, options::PetscOptions, viewer::PetscViewerFormat ) + + @chk ccall( + (:PetscOptionsView, $petsc_library), + PetscErrorCode, + (COptions, PetscViewerFormat), + options, viewer, + ) + + + return nothing +end + +""" + PetscOptionsLeftError(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscOptionsLeftError")) +""" +function PetscOptionsLeftError(petsclib::PetscLibType) end + +@for_petsc function PetscOptionsLeftError(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscOptionsLeftError, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscOptionsPrefixPush(petsclib::PetscLibType,options::PetscOptions, prefix::String) +Designate a prefix to be used by all options insertions to follow. + +Logically Collective + +Input Parameters: +- `options` - options database, or `NULL` for the default global database +- `prefix` - The string to append to the existing prefix + +Options Database Keys: +- `-prefix_push ` - push the given prefix +- `-prefix_pop` - pop the last prefix + +Level: advanced + +-seealso: `PetscOptionsPrefixPop()`, `PetscOptionsPush()`, `PetscOptionsPop()`, `PetscOptionsCreate()`, `PetscOptionsSetValue()` + +# External Links +$(_doc_external("Sys/PetscOptionsPrefixPush")) +""" +function PetscOptionsPrefixPush(petsclib::PetscLibType, options::PetscOptions, prefix::String) end + +@for_petsc function PetscOptionsPrefixPush(petsclib::$UnionPetscLib, options::PetscOptions, prefix::String ) + + @chk ccall( + (:PetscOptionsPrefixPush, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}), + options, prefix, + ) + + + return nothing +end + +""" + PetscOptionsPrefixPop(petsclib::PetscLibType,options::PetscOptions) +Remove the latest options prefix, see `PetscOptionsPrefixPush()` for details + +Logically Collective on the `MPI_Comm` used when called `PetscOptionsPrefixPush()` + +Input Parameter: +- `options` - options database, or `NULL` for the default global database + +Level: advanced + +-seealso: `PetscOptionsPrefixPush()`, `PetscOptionsPush()`, `PetscOptionsPop()`, `PetscOptionsCreate()`, `PetscOptionsSetValue()` + +# External Links +$(_doc_external("Sys/PetscOptionsPrefixPop")) +""" +function PetscOptionsPrefixPop(petsclib::PetscLibType, options::PetscOptions) end + +@for_petsc function PetscOptionsPrefixPop(petsclib::$UnionPetscLib, options::PetscOptions ) + + @chk ccall( + (:PetscOptionsPrefixPop, $petsc_library), + PetscErrorCode, + (COptions,), + options, + ) + + + return nothing +end + +""" + PetscOptionsClear(petsclib::PetscLibType,options::PetscOptions) +Removes all options form the database leaving it empty. + +Logically Collective + +Input Parameter: +- `options` - options database, use `NULL` for the default global database + +Level: developer + +-seealso: `PetscOptionsInsert()` + +# External Links +$(_doc_external("Sys/PetscOptionsClear")) +""" +function PetscOptionsClear(petsclib::PetscLibType, options::PetscOptions) end + +@for_petsc function PetscOptionsClear(petsclib::$UnionPetscLib, options::PetscOptions ) + + @chk ccall( + (:PetscOptionsClear, $petsc_library), + PetscErrorCode, + (COptions,), + options, + ) + + + return nothing +end + +""" + PetscOptionsSetAlias(petsclib::PetscLibType,options::PetscOptions, newname::String, oldname::String) +Makes a key and alias for another key + +Logically Collective + +Input Parameters: +- `options` - options database, or `NULL` for default global database +- `newname` - the alias +- `oldname` - the name that alias will refer to + +Level: advanced + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, +`PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsSetAlias")) +""" +function PetscOptionsSetAlias(petsclib::PetscLibType, options::PetscOptions, newname::String, oldname::String) end + +@for_petsc function PetscOptionsSetAlias(petsclib::$UnionPetscLib, options::PetscOptions, newname::String, oldname::String ) + + @chk ccall( + (:PetscOptionsSetAlias, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}), + options, newname, oldname, + ) + + + return nothing +end + +""" + PetscOptionsSetValue(petsclib::PetscLibType,options::PetscOptions, name::String, value::Union{Ptr,String}) +Sets an option name +database, overriding whatever is already present. + +Logically Collective + +Input Parameters: +- `options` - options database, use `NULL` for the default global database +- `name` - name of option, this SHOULD have the - prepended +- `value` - the option value (not used for all options, so can be `NULL`) + +Level: intermediate + +-seealso: `PetscOptionsInsert()`, `PetscOptionsClearValue()` + +# External Links +$(_doc_external("Sys/PetscOptionsSetValue")) +""" +function PetscOptionsSetValue(petsclib::PetscLibType, options::PetscOptions, name::String, value::Union{Ptr,String}) end + +@for_petsc function PetscOptionsSetValue(petsclib::$UnionPetscLib, options::PetscOptions, name::String, value::Union{Ptr,String} ) + + @chk ccall( + (:PetscOptionsSetValue, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}), + options, name, value, + ) + + + return nothing +end + +""" + PetscOptionsClearValue(petsclib::PetscLibType,options::PetscOptions, name::String) +Clears an option name +database, overriding whatever is already present. + +Logically Collective + +Input Parameters: +- `options` - options database, use `NULL` for the default global database +- `name` - name of option, this SHOULD have the - prepended + +Level: intermediate + +-seealso: `PetscOptionsInsert()` + +# External Links +$(_doc_external("Sys/PetscOptionsClearValue")) +""" +function PetscOptionsClearValue(petsclib::PetscLibType, options::PetscOptions, name::String) end + +@for_petsc function PetscOptionsClearValue(petsclib::$UnionPetscLib, options::PetscOptions, name::String ) + + @chk ccall( + (:PetscOptionsClearValue, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}), + options, name, + ) + + + return nothing +end + +""" + set::PetscBool = PetscOptionsFindPair(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String, value::String) +Gets an option name + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for the default global database +- `pre` - the string to prepend to the name or `NULL`, this SHOULD NOT have the "-" prepended +- `name` - name of option, this SHOULD have the "-" prepended + +Output Parameters: +- `value` - the option value (optional, not used for all options) +- `set` - whether the option is set (optional) + +Level: developer + +-seealso: `PetscOptionsSetValue()`, `PetscOptionsClearValue()` + +# External Links +$(_doc_external("Sys/PetscOptionsFindPair")) +""" +function PetscOptionsFindPair(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String, value::String) end + +@for_petsc function PetscOptionsFindPair(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String, value::String ) + value_ = Ref(pointer(value)) + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsFindPair, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{Ptr{Cchar}}, Ptr{PetscBool}), + options, pre, name, value_, set_, + ) + + set = set_[] + + return set +end + +""" + PetscOptionsReject(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String, mess::String) +Generates an error if a certain option is given. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - the option prefix (may be `NULL`) +- `name` - the option name one is seeking +- `mess` - error message (may be `NULL`) + +Level: advanced + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, +`PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsReject")) +""" +function PetscOptionsReject(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String, mess::String) end + +@for_petsc function PetscOptionsReject(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String, mess::String ) + + @chk ccall( + (:PetscOptionsReject, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}), + options, pre, name, mess, + ) + + + return nothing +end + +""" + set::PetscBool = PetscOptionsHasHelp(petsclib::PetscLibType,options::PetscOptions) +Determines whether the " + +Not Collective + +Input Parameter: +- `options` - options database, use `NULL` for default global database + +Output Parameter: +- `set` - `PETSC_TRUE` if found else `PETSC_FALSE`. + +Level: advanced + +-seealso: `PetscOptionsHasName()` + +# External Links +$(_doc_external("Sys/PetscOptionsHasHelp")) +""" +function PetscOptionsHasHelp(petsclib::PetscLibType, options::PetscOptions) end + +@for_petsc function PetscOptionsHasHelp(petsclib::$UnionPetscLib, options::PetscOptions ) + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsHasHelp, $petsc_library), + PetscErrorCode, + (COptions, Ptr{PetscBool}), + options, set_, + ) + + set = set_[] + + return set +end + +""" + set::PetscBool = PetscOptionsHasName(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String) +Determines whether a certain option is given in the database. This returns true whether the option is a number, string or Boolean, even +if its value is set to false. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - string to prepend to the name or `NULL` +- `name` - the option one is seeking + +Output Parameter: +- `set` - `PETSC_TRUE` if found else `PETSC_FALSE`. + +Level: beginner + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, +`PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsHasName")) +""" +function PetscOptionsHasName(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String) end + +@for_petsc function PetscOptionsHasName(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String ) + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsHasName, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}), + options, pre, name, set_, + ) + + set = set_[] + + return set +end + +""" + PetscOptionsGetAll(petsclib::PetscLibType,options::PetscOptions, copts::String) +Lists all the options the program was run with in a single string. + +Not Collective + +Input Parameter: +- `options` - the options database, use `NULL` for the default global database + +Output Parameter: +- `copts` - pointer where string pointer is stored + +Level: advanced + +-seealso: `PetscOptionsAllUsed()`, `PetscOptionsView()`, `PetscOptionsPush()`, `PetscOptionsPop()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetAll")) +""" +function PetscOptionsGetAll(petsclib::PetscLibType, options::PetscOptions, copts::String) end + +@for_petsc function PetscOptionsGetAll(petsclib::$UnionPetscLib, options::PetscOptions, copts::String ) + copts_ = Ref(pointer(copts)) + + @chk ccall( + (:PetscOptionsGetAll, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Ptr{Cchar}}), + options, copts_, + ) + + + return nothing +end + +""" + used::PetscBool = PetscOptionsUsed(petsclib::PetscLibType,options::PetscOptions, name::String) +Indicates if PETSc has used a particular option set in the database + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `name` - string name of option + +Output Parameter: +- `used` - `PETSC_TRUE` if the option was used, otherwise false, including if option was not found in options database + +Level: advanced + +-seealso: `PetscOptionsView()`, `PetscOptionsLeft()`, `PetscOptionsAllUsed()` + +# External Links +$(_doc_external("Sys/PetscOptionsUsed")) +""" +function PetscOptionsUsed(petsclib::PetscLibType, options::PetscOptions, name::String) end + +@for_petsc function PetscOptionsUsed(petsclib::$UnionPetscLib, options::PetscOptions, name::String ) + used_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsUsed, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{PetscBool}), + options, name, used_, + ) + + used = used_[] + + return used +end + +""" + N::PetscInt = PetscOptionsAllUsed(petsclib::PetscLibType,options::PetscOptions) +Returns a count of the number of options in the +database that have never been selected. + +Not Collective + +Input Parameter: +- `options` - options database, use `NULL` for default global database + +Output Parameter: +- `N` - count of options not used + +Level: advanced + +-seealso: `PetscOptionsView()` + +# External Links +$(_doc_external("Sys/PetscOptionsAllUsed")) +""" +function PetscOptionsAllUsed(petsclib::PetscLibType, options::PetscOptions) end + +@for_petsc function PetscOptionsAllUsed(petsclib::$UnionPetscLib, options::PetscOptions ) + N_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscOptionsAllUsed, $petsc_library), + PetscErrorCode, + (COptions, Ptr{$PetscInt}), + options, N_, + ) + + N = N_[] + + return N +end + +""" + PetscOptionsLeft(petsclib::PetscLibType,options::PetscOptions) +Prints to screen any options that were set and never used. + +Not Collective + +Input Parameter: +- `options` - options database; use `NULL` for default global database + +Options Database Key: +- `-options_left` - activates `PetscOptionsAllUsed()` within `PetscFinalize()` + +Level: advanced + +-seealso: `PetscOptionsAllUsed()` + +# External Links +$(_doc_external("Sys/PetscOptionsLeft")) +""" +function PetscOptionsLeft(petsclib::PetscLibType, options::PetscOptions) end + +@for_petsc function PetscOptionsLeft(petsclib::$UnionPetscLib, options::PetscOptions ) + + @chk ccall( + (:PetscOptionsLeft, $petsc_library), + PetscErrorCode, + (COptions,), + options, + ) + + + return nothing +end + +""" + N::PetscInt = PetscOptionsLeftGet(petsclib::PetscLibType,options::PetscOptions, names::String, values::String) +Returns all options that were set and never used. + +Not Collective + +Input Parameter: +- `options` - options database, use `NULL` for default global database + +Output Parameters: +- `N` - count of options not used +- `names` - names of options not used +- `values` - values of options not used + +Level: advanced + +-seealso: `PetscOptionsAllUsed()`, `PetscOptionsLeft()` + +# External Links +$(_doc_external("Sys/PetscOptionsLeftGet")) +""" +function PetscOptionsLeftGet(petsclib::PetscLibType, options::PetscOptions, names::String, values::String) end + +@for_petsc function PetscOptionsLeftGet(petsclib::$UnionPetscLib, options::PetscOptions, names::String, values::String ) + N_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscOptionsLeftGet, $petsc_library), + PetscErrorCode, + (COptions, Ptr{$PetscInt}, Ptr{Cchar}, Ptr{Cchar}), + options, N_, names, values, + ) + + N = N_[] + + return N +end + +""" + PetscOptionsLeftRestore(petsclib::PetscLibType,options::PetscOptions, N::PetscInt, names::String, values::String) +Free memory for the unused PETSc options obtained using `PetscOptionsLeftGet()`. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `N` - count of options not used +- `names` - names of options not used +- `values` - values of options not used + +Level: advanced + +-seealso: `PetscOptionsAllUsed()`, `PetscOptionsLeft()`, `PetscOptionsLeftGet()` + +# External Links +$(_doc_external("Sys/PetscOptionsLeftRestore")) +""" +function PetscOptionsLeftRestore(petsclib::PetscLibType, options::PetscOptions, N::PetscInt, names::String, values::String) end + +@for_petsc function PetscOptionsLeftRestore(petsclib::$UnionPetscLib, options::PetscOptions, N::$PetscInt, names::String, values::String ) + + @chk ccall( + (:PetscOptionsLeftRestore, $petsc_library), + PetscErrorCode, + (COptions, Ptr{$PetscInt}, Ptr{Cchar}, Ptr{Cchar}), + options, N, names, values, + ) + + + return nothing +end + +""" + PetscOptionsMonitorDefault(petsclib::PetscLibType,name::String, value::String, source::PetscOptionSource, ctx::Cvoid) +Print all options set value events using the supplied `PetscViewer`. + +Logically Collective + +Input Parameters: +- `name` - option name string +- `value` - option value string +- `source` - The source for the option +- `ctx` - a `PETSCVIEWERASCII` or `NULL` + +Level: intermediate + +-seealso: `PetscOptionsMonitorSet()` + +# External Links +$(_doc_external("Sys/PetscOptionsMonitorDefault")) +""" +function PetscOptionsMonitorDefault(petsclib::PetscLibType, name::String, value::String, source::PetscOptionSource, ctx::Cvoid) end + +@for_petsc function PetscOptionsMonitorDefault(petsclib::$UnionPetscLib, name::String, value::String, source::PetscOptionSource, ctx::Cvoid ) + + @chk ccall( + (:PetscOptionsMonitorDefault, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, PetscOptionSource, Ptr{Cvoid}), + name, value, source, ctx, + ) + + + return nothing +end + +""" + PetscOptionsMonitorSet(petsclib::PetscLibType,monitor::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn) +Sets an ADDITIONAL function to be called at every method that +modified the PETSc options database. + +Not Collective + +Input Parameters: +- `monitor` - pointer to function (if this is `NULL`, it turns off monitoring +- `mctx` - [optional] context for private data for the monitor routine (use `NULL` if +no context is desired) +- `monitordestroy` - [optional] routine that frees monitor context (may be `NULL`), see `PetscCtxDestroyFn` for its calling sequence + +Calling sequence of `monitor`: +- `name` - option name string +- `value` - option value string, a value of `NULL` indicates the option is being removed from the database. A value +of "" indicates the option is in the database but has no value. +- `source` - option source +- `mctx` - optional monitoring context, as set by `PetscOptionsMonitorSet()` + +Options Database Keys: +- `-options_monitor ` - turn on default monitoring of changes to the options database +- `-options_monitor_cancel` - turn off any option monitors except the default monitor obtained with `-options_monitor` + +Level: intermediate + +-seealso: `PetscOptionsMonitorDefault()`, `PetscInitialize()`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("Sys/PetscOptionsMonitorSet")) +""" +function PetscOptionsMonitorSet(petsclib::PetscLibType, monitor::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn) end + +@for_petsc function PetscOptionsMonitorSet(petsclib::$UnionPetscLib, monitor::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn ) + + @chk ccall( + (:PetscOptionsMonitorSet, $petsc_library), + PetscErrorCode, + (external, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + monitor, mctx, monitordestroy, + ) + + + return nothing +end + +""" + a::PetscBool = PetscOptionsStringToBool(petsclib::PetscLibType,value::String) + +# External Links +$(_doc_external("Sys/PetscOptionsStringToBool")) +""" +function PetscOptionsStringToBool(petsclib::PetscLibType, value::String) end + +@for_petsc function PetscOptionsStringToBool(petsclib::$UnionPetscLib, value::String ) + a_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsStringToBool, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscBool}), + value, a_, + ) + + a = a_[] + + return a +end + +""" + a::PetscInt = PetscOptionsStringToInt(petsclib::PetscLibType,name::String) + +# External Links +$(_doc_external("Sys/PetscOptionsStringToInt")) +""" +function PetscOptionsStringToInt(petsclib::PetscLibType, name::String) end + +@for_petsc function PetscOptionsStringToInt(petsclib::$UnionPetscLib, name::String ) + a_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscOptionsStringToInt, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{$PetscInt}), + name, a_, + ) + + a = a_[] + + return a +end + +""" + a::PetscReal = PetscOptionsStringToReal(petsclib::PetscLibType,name::String) + +# External Links +$(_doc_external("Sys/PetscOptionsStringToReal")) +""" +function PetscOptionsStringToReal(petsclib::PetscLibType, name::String) end + +@for_petsc function PetscOptionsStringToReal(petsclib::$UnionPetscLib, name::String ) + a_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscOptionsStringToReal, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{$PetscReal}), + name, a_, + ) + + a = a_[] + + return a +end + +""" + a::PetscScalar = PetscOptionsStringToScalar(petsclib::PetscLibType,name::String) + +# External Links +$(_doc_external("Sys/PetscOptionsStringToScalar")) +""" +function PetscOptionsStringToScalar(petsclib::PetscLibType, name::String) end + +@for_petsc function PetscOptionsStringToScalar(petsclib::$UnionPetscLib, name::String ) + a_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscOptionsStringToScalar, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{$PetscScalar}), + name, a_, + ) + + a = a_[] + + return a +end + +""" + ivalue::PetscBool,set::PetscBool = PetscOptionsGetBool(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String) +Gets the Logical (true or false) value for a particular +option in the database. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - the string to prepend to the name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `ivalue` - the logical value to return +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetBool3()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, +`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetInt()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetBool")) +""" +function PetscOptionsGetBool(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String) end + +@for_petsc function PetscOptionsGetBool(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String ) + ivalue_ = Ref{PetscBool}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetBool, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}, Ptr{PetscBool}), + options, pre, name, ivalue_, set_, + ) + + ivalue = ivalue_[] + set = set_[] + + return ivalue,set +end + +""" + set::PetscBool = PetscOptionsGetBool3(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String, ivalue::PetscBool3) +Gets the ternary logical (true, false or unknown) value for a particular +option in the database. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - the string to prepend to the name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `ivalue` - the ternary logical value to return +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetBool()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, +`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetInt()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetBool3")) +""" +function PetscOptionsGetBool3(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String, ivalue::PetscBool3) end + +@for_petsc function PetscOptionsGetBool3(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String, ivalue::PetscBool3 ) + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetBool3, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool3}, Ptr{PetscBool}), + options, pre, name, ivalue, set_, + ) + + set = set_[] + + return set +end + +""" + value::PetscInt,set::PetscBool = PetscOptionsGetEList(petsclib::PetscLibType,options::PetscOptions, pre::String, opt::String, list::String, ntext::PetscInt) +Puts a list of option values that a single one may be selected from + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - the string to prepend to the name or `NULL` +- `opt` - option name +- `list` - the possible choices (one of these must be selected, anything else is invalid) +- `ntext` - number of choices + +Output Parameters: +- `value` - the index of the value to return (defaults to zero if the option name is given but no choice is listed) +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: intermediate + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, +`PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetEList")) +""" +function PetscOptionsGetEList(petsclib::PetscLibType, options::PetscOptions, pre::String, opt::String, list::String, ntext::PetscInt) end + +@for_petsc function PetscOptionsGetEList(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, opt::String, list::String, ntext::$PetscInt ) + list_ = Ref(pointer(list)) + value_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetEList, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{Ptr{Cchar}}, $PetscInt, Ptr{$PetscInt}, Ptr{PetscBool}), + options, pre, opt, list_, ntext, value_, set_, + ) + + value = value_[] + set = set_[] + + return value,set +end + +""" + set::PetscBool = PetscOptionsGetEnum(petsclib::PetscLibType,options::PetscOptions, pre::String, opt::String, list::String, value::PetscEnum) +Gets the enum value for a particular option in the database. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - option prefix or `NULL` +- `opt` - option name +- `list` - array containing the list of choices, followed by the enum name, followed by the enum prefix, followed by a null + +Output Parameters: +- `value` - the value to return +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, +`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` +`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsGetEList()`, `PetscOptionsEnum()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetEnum")) +""" +function PetscOptionsGetEnum(petsclib::PetscLibType, options::PetscOptions, pre::String, opt::String, list::String, value::PetscEnum) end + +@for_petsc function PetscOptionsGetEnum(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, opt::String, list::String, value::PetscEnum ) + list_ = Ref(pointer(list)) + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetEnum, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{Ptr{Cchar}}, Ptr{PetscEnum}, Ptr{PetscBool}), + options, pre, opt, list_, value, set_, + ) + + set = set_[] + + return set +end + +""" + ivalue::PetscInt,set::PetscBool = PetscOptionsGetInt(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String) +Gets the integer value for a particular option in the database. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - the string to prepend to the name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `ivalue` - the integer value to return +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, +`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` +`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetInt")) +""" +function PetscOptionsGetInt(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String) end + +@for_petsc function PetscOptionsGetInt(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String ) + ivalue_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetInt, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscInt}, Ptr{PetscBool}), + options, pre, name, ivalue_, set_, + ) + + ivalue = ivalue_[] + set = set_[] + + return ivalue,set +end + +""" + set::PetscBool = PetscOptionsGetMPIInt(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String, ivalue::PetscMPIInt) +Gets the MPI integer value for a particular option in the database. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - the string to prepend to the name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `ivalue` - the MPI integer value to return +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, +`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` +`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetMPIInt")) +""" +function PetscOptionsGetMPIInt(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String, ivalue::PetscMPIInt) end + +@for_petsc function PetscOptionsGetMPIInt(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String, ivalue::PetscMPIInt ) + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetMPIInt, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscMPIInt}, Ptr{PetscBool}), + options, pre, name, ivalue, set_, + ) + + set = set_[] + + return set +end + +""" + dvalue::PetscReal,set::PetscBool = PetscOptionsGetReal(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String) +Gets the double precision value for a particular +option in the database. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - string to prepend to each name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `dvalue` - the double value to return +- `set` - `PETSC_TRUE` if found, `PETSC_FALSE` if not found + +Level: beginner + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsHasName()`, +`PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetReal")) +""" +function PetscOptionsGetReal(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String) end + +@for_petsc function PetscOptionsGetReal(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String ) + dvalue_ = Ref{$PetscReal}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetReal, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscReal}, Ptr{PetscBool}), + options, pre, name, dvalue_, set_, + ) + + dvalue = dvalue_[] + set = set_[] + + return dvalue,set +end + +""" + dvalue::PetscScalar,set::PetscBool = PetscOptionsGetScalar(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String) +Gets the scalar value for a particular +option in the database. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - string to prepend to each name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `dvalue` - the scalar value to return +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsHasName()`, +`PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetScalar")) +""" +function PetscOptionsGetScalar(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String) end + +@for_petsc function PetscOptionsGetScalar(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String ) + dvalue_ = Ref{$PetscScalar}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetScalar, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscScalar}, Ptr{PetscBool}), + options, pre, name, dvalue_, set_, + ) + + dvalue = dvalue_[] + set = set_[] + + return dvalue,set +end + +""" + string::Union{Bool,String} = PetscOptionsGetString(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String, string::String, len::Csize_t) +Gets the string value for a particular option in +the database. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - string to prepend to name or `NULL` +- `name` - the option one is seeking +- `len` - maximum length of the string including null termination + +Output Parameters: +- `string` - returns the value of the parameter ifn set, otherwise `false` + +Level: beginner + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, +`PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetString")) +""" +function PetscOptionsGetString(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String) end + +@for_petsc function PetscOptionsGetString(petsclib::$UnionPetscLib, options::PetscOptions, pre::Union{Ptr,String}, name::String) + set_ = Ref{PetscBool}() + val = Vector{UInt8}(undef, 256) + + @chk ccall( + (:PetscOptionsGetString, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Csize_t, Ptr{PetscBool}), + options, pre, name, val, sizeof(val), set_, + ) + + set = set_[] + if set + val = GC.@preserve val unsafe_string(pointer(val)) + else + val = false + end + + + return val +end + +""" + dvalue::Vector{PetscBool},nmax::PetscInt,set::PetscBool = PetscOptionsGetBoolArray(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String) +Gets an array of Logical (true or false) values for a particular +option in the database. The values must be separated with commas with no intervening spaces. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - string to prepend to each name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `dvalue` - the Boolean values to return +- `nmax` - On input maximum number of values to retrieve, on output the actual number of values retrieved +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsHasName()`, +`PetscOptionsGetString()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetBoolArray")) +""" +function PetscOptionsGetBoolArray(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String) end + +@for_petsc function PetscOptionsGetBoolArray(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String ) + dvalue = Vector{PetscBool}(undef, ni); # CHECK SIZE!! + nmax_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetBoolArray, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}, Ptr{$PetscInt}, Ptr{PetscBool}), + options, pre, name, dvalue, nmax_, set_, + ) + + nmax = nmax_[] + set = set_[] + + return dvalue,nmax,set +end + +""" + nmax::PetscInt,set::PetscBool = PetscOptionsGetEnumArray(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String, list::String, ivalue::Vector{PetscEnum}) +Gets an array of enum values for a particular option in the database. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - option prefix or `NULL` +- `name` - option name +- `list` - array containing the list of choices, followed by the enum name, followed by the enum prefix, followed by a null + +Output Parameters: +- `ivalue` - the enum values to return +- `nmax` - On input maximum number of values to retrieve, on output the actual number of values retrieved +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, +`PetscOptionsGetEnum()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` +`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsName()`, +`PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, +`PetscOptionsScalar()`, `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsGetEList()`, `PetscOptionsEnum()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetEnumArray")) +""" +function PetscOptionsGetEnumArray(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String, list::String, ivalue::Vector{PetscEnum}) end + +@for_petsc function PetscOptionsGetEnumArray(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String, list::String, ivalue::Vector{PetscEnum} ) + list_ = Ref(pointer(list)) + nmax_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetEnumArray, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{Ptr{Cchar}}, Ptr{PetscEnum}, Ptr{$PetscInt}, Ptr{PetscBool}), + options, pre, name, list_, ivalue, nmax_, set_, + ) + + nmax = nmax_[] + set = set_[] + + return nmax,set +end + +""" + ivalue::Vector{PetscInt},nmax::PetscInt,set::PetscBool = PetscOptionsGetIntArray(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String) +Gets an array of integer values for a particular option in the database. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - string to prepend to each name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `ivalue` - the integer values to return +- `nmax` - On input maximum number of values to retrieve, on output the actual number of values retrieved +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsHasName()`, +`PetscOptionsGetString()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetIntArray")) +""" +function PetscOptionsGetIntArray(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String) end + +@for_petsc function PetscOptionsGetIntArray(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String ) + ivalue = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + nmax_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetIntArray, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{PetscBool}), + options, pre, name, ivalue, nmax_, set_, + ) + + nmax = nmax_[] + set = set_[] + + return ivalue,nmax,set +end + +""" + dvalue::Vector{PetscReal},nmax::PetscInt,set::PetscBool = PetscOptionsGetRealArray(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String) +Gets an array of double precision values for a +particular option in the database. The values must be separated with commas with no intervening spaces. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - string to prepend to each name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `dvalue` - the double values to return +- `nmax` - On input maximum number of values to retrieve, on output the actual number of values retrieved +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsHasName()`, +`PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetRealArray")) +""" +function PetscOptionsGetRealArray(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String) end + +@for_petsc function PetscOptionsGetRealArray(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String ) + dvalue = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + nmax_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetRealArray, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscReal}, Ptr{$PetscInt}, Ptr{PetscBool}), + options, pre, name, dvalue, nmax_, set_, + ) + + nmax = nmax_[] + set = set_[] + + return dvalue,nmax,set +end + +""" + dvalue::Vector{PetscScalar},nmax::PetscInt,set::PetscBool = PetscOptionsGetScalarArray(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String) +Gets an array of scalars for a +particular option in the database. The values must be separated with commas with no intervening spaces. + +Not Collective + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - string to prepend to each name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `dvalue` - the scalar values to return +- `nmax` - On input maximum number of values to retrieve, on output the actual number of values retrieved +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsHasName()`, +`PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetScalarArray")) +""" +function PetscOptionsGetScalarArray(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String) end + +@for_petsc function PetscOptionsGetScalarArray(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String ) + dvalue = Vector{$PetscScalar}(undef, ni); # CHECK SIZE!! + nmax_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetScalarArray, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscScalar}, Ptr{$PetscInt}, Ptr{PetscBool}), + options, pre, name, dvalue, nmax_, set_, + ) + + nmax = nmax_[] + set = set_[] + + return dvalue,nmax,set +end + +""" + nmax::PetscInt,set::PetscBool = PetscOptionsGetStringArray(petsclib::PetscLibType,options::PetscOptions, pre::String, name::String, strings::String) +Gets an array of string values for a particular +option in the database. The values must be separated with commas with no intervening spaces. + +Not Collective; No Fortran Support + +Input Parameters: +- `options` - options database, use `NULL` for default global database +- `pre` - string to prepend to name or `NULL` +- `name` - the option one is seeking + +Output Parameters: +- `strings` - location to copy strings +- `nmax` - On input maximum number of strings, on output the actual number of strings found +- `set` - `PETSC_TRUE` if found, else `PETSC_FALSE` + +Level: beginner + +-seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, +`PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetStringArray")) +""" +function PetscOptionsGetStringArray(petsclib::PetscLibType, options::PetscOptions, pre::String, name::String, strings::String) end + +@for_petsc function PetscOptionsGetStringArray(petsclib::$UnionPetscLib, options::PetscOptions, pre::String, name::String, strings::String ) + strings_ = Ref(pointer(strings)) + nmax_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetStringArray, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, Ptr{Ptr{Cchar}}, Ptr{$PetscInt}, Ptr{PetscBool}), + options, pre, name, strings_, nmax_, set_, + ) + + nmax = nmax_[] + set = set_[] + + return nmax,set +end + +""" + flag::PetscBool = PetscOptionsGetenv(petsclib::PetscLibType,comm::MPI_Comm, name::String, env::String, len::Csize_t) +Gets an environmental variable, broadcasts to all +processors in communicator from MPI rank zero + +Collective + +Input Parameters: +- `comm` - communicator to share variable +- `name` - name of environmental variable +- `len` - amount of space allocated to hold variable + +Output Parameters: +- `flag` - if not `NULL` indicates if the variable was found +- `env` - value of variable + +Level: advanced + +-seealso: `PetscOptionsHasName()` + +# External Links +$(_doc_external("Sys/PetscOptionsGetenv")) +""" +function PetscOptionsGetenv(petsclib::PetscLibType, comm::MPI_Comm, name::String, env::String, len::Csize_t) end + +@for_petsc function PetscOptionsGetenv(petsclib::$UnionPetscLib, comm::MPI_Comm, name::String, env::String, len::Csize_t ) + flag_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetenv, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Csize_t, Ptr{PetscBool}), + comm, name, env, len, flag_, + ) + + flag = flag_[] + + return flag +end + +""" + set::PetscBool = PetscOptionsGetVec(petsclib::PetscLibType,options::PetscOptions, prefix::String, key::String, v::PetscVec) + +# External Links +$(_doc_external("Vec/PetscOptionsGetVec")) +""" +function PetscOptionsGetVec(petsclib::PetscLibType, options::PetscOptions, prefix::String, key::String, v::PetscVec) end + +@for_petsc function PetscOptionsGetVec(petsclib::$UnionPetscLib, options::PetscOptions, prefix::String, key::String, v::PetscVec ) + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsGetVec, $petsc_library), + PetscErrorCode, + (COptions, Ptr{Cchar}, Ptr{Cchar}, CVec, Ptr{PetscBool}), + options, prefix, key, v, set_, + ) + + set = set_[] + + return set +end + diff --git a/src/autowrapped/PetscPartitioner_wrappers.jl b/src/autowrapped/PetscPartitioner_wrappers.jl new file mode 100644 index 00000000..1978522a --- /dev/null +++ b/src/autowrapped/PetscPartitioner_wrappers.jl @@ -0,0 +1,607 @@ +""" + PetscPartitionerRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new PetscPartitioner implementation + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine + +-seealso: `PetscPartitionerRegisterAll()` + + +# External Links +$(_doc_external("Mat/PetscPartitionerRegister")) +""" +function PetscPartitionerRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscPartitionerRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscPartitionerRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscPartitionerFinalizePackage(petsclib::PetscLibType) +This function finalizes everything in the PetscPartitioner package. +It is called from PetscFinalize(). + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("Mat/PetscPartitionerFinalizePackage")) +""" +function PetscPartitionerFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscPartitionerFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscPartitionerFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscPartitionerInitializePackage(petsclib::PetscLibType) +This function initializes everything in the PetscPartitioner package. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("Mat/PetscPartitionerInitializePackage")) +""" +function PetscPartitionerInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscPartitionerInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscPartitionerInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscPartitionerSetType(petsclib::PetscLibType,part::PetscPartitioner, name::PetscPartitionerType) +Builds a particular `PetscPartitioner` + +Collective + +Input Parameters: +- `part` - The `PetscPartitioner` object +- `name` - The kind of partitioner + +Options Database Key: +- `-petscpartitioner_type ` - Sets the `PetscPartitioner` type + +Level: intermediate + +-seealso: `PetscPartitionerGetType()`, `PetscPartitionerCreate()` + +# External Links +$(_doc_external("Mat/PetscPartitionerSetType")) +""" +function PetscPartitionerSetType(petsclib::PetscLibType, part::PetscPartitioner, name::PetscPartitionerType) end + +@for_petsc function PetscPartitionerSetType(petsclib::$UnionPetscLib, part::PetscPartitioner, name::PetscPartitionerType ) + + @chk ccall( + (:PetscPartitionerSetType, $petsc_library), + PetscErrorCode, + (PetscPartitioner, PetscPartitionerType), + part, name, + ) + + + return nothing +end + +""" + name::PetscPartitionerType = PetscPartitionerGetType(petsclib::PetscLibType,part::PetscPartitioner) +Gets the PetscPartitioner type name (as a string) from the object. + +Not Collective + +Input Parameter: +- `part` - The PetscPartitioner + +Output Parameter: +- `name` - The PetscPartitioner type name + +Level: intermediate + +-seealso: `PetscPartitionerSetType()`, `PetscPartitionerCreate()` + +# External Links +$(_doc_external("Mat/PetscPartitionerGetType")) +""" +function PetscPartitionerGetType(petsclib::PetscLibType, part::PetscPartitioner) end + +@for_petsc function PetscPartitionerGetType(petsclib::$UnionPetscLib, part::PetscPartitioner ) + name_ = Ref{PetscPartitionerType}() + + @chk ccall( + (:PetscPartitionerGetType, $petsc_library), + PetscErrorCode, + (PetscPartitioner, Ptr{PetscPartitionerType}), + part, name_, + ) + + name = unsafe_string(name_[]) + + return name +end + +""" + PetscPartitionerViewFromOptions(petsclib::PetscLibType,A::PetscPartitioner, obj::PetscObject, name::String) +View a `PetscPartitioner` object based on options in the options database + +Collective + +Input Parameters: +- `A` - the `PetscPartitioner` object +- `obj` - Optional `PetscObject` that provides the options prefix +- `name` - command line option + +Level: intermediate + +-seealso: `PetscPartitionerView()`, `PetscObjectViewFromOptions()` + +# External Links +$(_doc_external("Mat/PetscPartitionerViewFromOptions")) +""" +function PetscPartitionerViewFromOptions(petsclib::PetscLibType, A::PetscPartitioner, obj::PetscObject, name::String) end + +@for_petsc function PetscPartitionerViewFromOptions(petsclib::$UnionPetscLib, A::PetscPartitioner, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscPartitionerViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscPartitioner, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscPartitionerView(petsclib::PetscLibType,part::PetscPartitioner, v::PetscViewer) +Views a `PetscPartitioner` + +Collective + +Input Parameters: +- `part` - the `PetscPartitioner` object to view +- `v` - the viewer + +Level: developer + +-seealso: `PetscPartitionerDestroy()` + +# External Links +$(_doc_external("Mat/PetscPartitionerView")) +""" +function PetscPartitionerView(petsclib::PetscLibType, part::PetscPartitioner, v::PetscViewer) end + +@for_petsc function PetscPartitionerView(petsclib::$UnionPetscLib, part::PetscPartitioner, v::PetscViewer ) + + @chk ccall( + (:PetscPartitionerView, $petsc_library), + PetscErrorCode, + (PetscPartitioner, PetscViewer), + part, v, + ) + + + return nothing +end + +""" + PetscPartitionerSetFromOptions(petsclib::PetscLibType,part::PetscPartitioner) +sets parameters in a `PetscPartitioner` from the options database + +Collective + +Input Parameter: +- `part` - the `PetscPartitioner` object to set options for + +Options Database Keys: +- `-petscpartitioner_type ` - Sets the `PetscPartitioner` type; use -help for a list of available types +- `-petscpartitioner_use_vertex_weights` - Uses weights associated with the graph vertices +- `-petscpartitioner_view_graph` - View the graph each time PetscPartitionerPartition is called. Viewer can be customized, see `PetscOptionsCreateViewer()` + +Level: developer + +-seealso: `PetscPartitionerView()`, `PetscPartitionerSetType()`, `PetscPartitionerPartition()` + +# External Links +$(_doc_external("Mat/PetscPartitionerSetFromOptions")) +""" +function PetscPartitionerSetFromOptions(petsclib::PetscLibType, part::PetscPartitioner) end + +@for_petsc function PetscPartitionerSetFromOptions(petsclib::$UnionPetscLib, part::PetscPartitioner ) + + @chk ccall( + (:PetscPartitionerSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscPartitioner,), + part, + ) + + + return nothing +end + +""" + PetscPartitionerSetUp(petsclib::PetscLibType,part::PetscPartitioner) +Construct data structures for the `PetscPartitioner` + +Collective + +Input Parameter: +- `part` - the `PetscPartitioner` object to setup + +Level: developer + +-seealso: `PetscPartitionerView()`, `PetscPartitionerDestroy()` + +# External Links +$(_doc_external("Mat/PetscPartitionerSetUp")) +""" +function PetscPartitionerSetUp(petsclib::PetscLibType, part::PetscPartitioner) end + +@for_petsc function PetscPartitionerSetUp(petsclib::$UnionPetscLib, part::PetscPartitioner ) + + @chk ccall( + (:PetscPartitionerSetUp, $petsc_library), + PetscErrorCode, + (PetscPartitioner,), + part, + ) + + + return nothing +end + +""" + PetscPartitionerReset(petsclib::PetscLibType,part::PetscPartitioner) +Resets data structures for the `PetscPartitioner` + +Collective + +Input Parameter: +- `part` - the `PetscPartitioner` object to reset + +Level: developer + +-seealso: `PetscPartitionerSetUp()`, `PetscPartitionerDestroy()` + +# External Links +$(_doc_external("Mat/PetscPartitionerReset")) +""" +function PetscPartitionerReset(petsclib::PetscLibType, part::PetscPartitioner) end + +@for_petsc function PetscPartitionerReset(petsclib::$UnionPetscLib, part::PetscPartitioner ) + + @chk ccall( + (:PetscPartitionerReset, $petsc_library), + PetscErrorCode, + (PetscPartitioner,), + part, + ) + + + return nothing +end + +""" + PetscPartitionerDestroy(petsclib::PetscLibType,part::PetscPartitioner) +Destroys a `PetscPartitioner` object + +Collective + +Input Parameter: +- `part` - the `PetscPartitioner` object to destroy + +Level: developer + +-seealso: `PetscPartitionerView()` + +# External Links +$(_doc_external("Mat/PetscPartitionerDestroy")) +""" +function PetscPartitionerDestroy(petsclib::PetscLibType, part::PetscPartitioner) end + +@for_petsc function PetscPartitionerDestroy(petsclib::$UnionPetscLib, part::PetscPartitioner ) + + @chk ccall( + (:PetscPartitionerDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscPartitioner},), + part, + ) + + + return nothing +end + +""" + PetscPartitionerPartition(petsclib::PetscLibType,part::PetscPartitioner, nparts::PetscInt, numVertices::PetscInt, start::Vector{PetscInt}, adjacency::Vector{PetscInt}, vertexSection::PetscSection, edgeSection::PetscSection, targetSection::PetscSection, partSection::PetscSection, partition::IS) +Partition a graph + +Collective + +Input Parameters: +- `part` - The `PetscPartitioner` +- `nparts` - Number of partitions +- `numVertices` - Number of vertices in the local part of the graph +- `start` - row pointers for the local part of the graph (CSR style) +- `adjacency` - adjacency list (CSR style) +- `vertexSection` - PetscSection describing the absolute weight of each local vertex (can be `NULL`) +- `edgeSection` - PetscSection describing the absolute weight of each local edge (can be `NULL`) +- `targetSection` - PetscSection describing the absolute weight of each partition (can be `NULL`) + +Output Parameters: +- `partSection` - The `PetscSection` giving the division of points by partition +- `partition` - The list of points by partition + +Options Database Keys: +- `-petscpartitioner_view` - View the partitioner information +- `-petscpartitioner_view_graph` - View the graph we are partitioning + +Level: developer + +-seealso: `PetscPartitionerCreate()`, `PetscPartitionerSetType()`, `PetscSectionCreate()`, `PetscSectionSetChart()`, `PetscSectionSetDof()` + +# External Links +$(_doc_external("Mat/PetscPartitionerPartition")) +""" +function PetscPartitionerPartition(petsclib::PetscLibType, part::PetscPartitioner, nparts::PetscInt, numVertices::PetscInt, start::Vector{PetscInt}, adjacency::Vector{PetscInt}, vertexSection::PetscSection, edgeSection::PetscSection, targetSection::PetscSection, partSection::PetscSection, partition::IS) end + +@for_petsc function PetscPartitionerPartition(petsclib::$UnionPetscLib, part::PetscPartitioner, nparts::$PetscInt, numVertices::$PetscInt, start::Vector{$PetscInt}, adjacency::Vector{$PetscInt}, vertexSection::PetscSection, edgeSection::PetscSection, targetSection::PetscSection, partSection::PetscSection, partition::IS ) + partition_ = Ref(partition.ptr) + + @chk ccall( + (:PetscPartitionerPartition, $petsc_library), + PetscErrorCode, + (PetscPartitioner, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, PetscSection, PetscSection, PetscSection, PetscSection, Ptr{CIS}), + part, nparts, numVertices, start, adjacency, vertexSection, edgeSection, targetSection, partSection, partition_, + ) + + partition.ptr = C_NULL + + return nothing +end + +""" + part::PetscPartitioner = PetscPartitionerCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty `PetscPartitioner` object. The type can then be set with `PetscPartitionerSetType()`. + +Collective + +Input Parameter: +- `comm` - The communicator for the `PetscPartitioner` object + +Output Parameter: +- `part` - The `PetscPartitioner` object + +Level: beginner + +-seealso: `PetscPartitionerSetType()`, `PetscPartitionerDestroy()` + +# External Links +$(_doc_external("Mat/PetscPartitionerCreate")) +""" +function PetscPartitionerCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscPartitionerCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + part_ = Ref{PetscPartitioner}() + + @chk ccall( + (:PetscPartitionerCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscPartitioner}), + comm, part_, + ) + + part = part_[] + + return part +end + +""" + PetscPartitionerShellSetPartition(petsclib::PetscLibType,part::PetscPartitioner, size::PetscInt, sizes::Vector{PetscInt}, points::Vector{PetscInt}) +Set an artificial partition for a mesh + +Collective + +Input Parameters: +- `part` - The `PetscPartitioner` +- `size` - The number of partitions +- `sizes` - array of length size (or `NULL`) providing the number of points in each partition +- `points` - array of length sum(sizes) (may be `NULL` iff sizes is `NULL`), a permutation of the points that groups those assigned to each partition in order (i.e., partition 0 first, partition 1 next, etc.) + +Level: developer + +-seealso: `DMPlexDistribute()`, `PetscPartitionerCreate()` + +# External Links +$(_doc_external("Mat/PetscPartitionerShellSetPartition")) +""" +function PetscPartitionerShellSetPartition(petsclib::PetscLibType, part::PetscPartitioner, size::PetscInt, sizes::Vector{PetscInt}, points::Vector{PetscInt}) end + +@for_petsc function PetscPartitionerShellSetPartition(petsclib::$UnionPetscLib, part::PetscPartitioner, size::$PetscInt, sizes::Vector{$PetscInt}, points::Vector{$PetscInt} ) + + @chk ccall( + (:PetscPartitionerShellSetPartition, $petsc_library), + PetscErrorCode, + (PetscPartitioner, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + part, size, sizes, points, + ) + + + return nothing +end + +""" + PetscPartitionerShellSetRandom(petsclib::PetscLibType,part::PetscPartitioner, random::PetscBool) +Set the flag to use a random partition + +Collective + +Input Parameters: +- `part` - The `PetscPartitioner` +- `random` - The flag to use a random partition + +Level: intermediate + +-seealso: `PetscPartitionerShellGetRandom()`, `PetscPartitionerCreate()` + +# External Links +$(_doc_external("Mat/PetscPartitionerShellSetRandom")) +""" +function PetscPartitionerShellSetRandom(petsclib::PetscLibType, part::PetscPartitioner, random::PetscBool) end + +@for_petsc function PetscPartitionerShellSetRandom(petsclib::$UnionPetscLib, part::PetscPartitioner, random::PetscBool ) + + @chk ccall( + (:PetscPartitionerShellSetRandom, $petsc_library), + PetscErrorCode, + (PetscPartitioner, PetscBool), + part, random, + ) + + + return nothing +end + +""" + random::PetscBool = PetscPartitionerShellGetRandom(petsclib::PetscLibType,part::PetscPartitioner) +get the flag to use a random partition + +Collective + +Input Parameter: +- `part` - The `PetscPartitioner` + +Output Parameter: +- `random` - The flag to use a random partition + +Level: intermediate + +-seealso: `PetscPartitionerShellSetRandom()`, `PetscPartitionerCreate()` + +# External Links +$(_doc_external("Mat/PetscPartitionerShellGetRandom")) +""" +function PetscPartitionerShellGetRandom(petsclib::PetscLibType, part::PetscPartitioner) end + +@for_petsc function PetscPartitionerShellGetRandom(petsclib::$UnionPetscLib, part::PetscPartitioner ) + random_ = Ref{PetscBool}() + + @chk ccall( + (:PetscPartitionerShellGetRandom, $petsc_library), + PetscErrorCode, + (PetscPartitioner, Ptr{PetscBool}), + part, random_, + ) + + random = random_[] + + return random +end + +""" + PetscPartitionerMatPartitioningGetMatPartitioning(petsclib::PetscLibType,part::PetscPartitioner, mp::MatPartitioning) +Get a `MatPartitioning` instance wrapped by this `PetscPartitioner`. + +Not Collective + +Input Parameter: +- `part` - The `PetscPartitioner` + +Output Parameter: +- `mp` - The `MatPartitioning` + +Level: developer + +-seealso: `DMPlexDistribute()`, `PetscPartitionerCreate()` + +# External Links +$(_doc_external("Mat/PetscPartitionerMatPartitioningGetMatPartitioning")) +""" +function PetscPartitionerMatPartitioningGetMatPartitioning(petsclib::PetscLibType, part::PetscPartitioner, mp::MatPartitioning) end + +@for_petsc function PetscPartitionerMatPartitioningGetMatPartitioning(petsclib::$UnionPetscLib, part::PetscPartitioner, mp::MatPartitioning ) + + @chk ccall( + (:PetscPartitionerMatPartitioningGetMatPartitioning, $petsc_library), + PetscErrorCode, + (PetscPartitioner, Ptr{MatPartitioning}), + part, mp, + ) + + + return nothing +end + +""" + PetscPartitionerDMPlexPartition(petsclib::PetscLibType,part::PetscPartitioner, dm::PetscDM, targetSection::PetscSection, partSection::PetscSection, partition::IS) +Create a non + +Collective + +Input Parameters: +- `part` - The `PetscPartitioner` +- `targetSection` - The `PetscSection` describing the absolute weight of each partition (can be `NULL`) +- `dm` - The mesh `DM` + +Output Parameters: +- `partSection` - The `PetscSection` giving the division of points by partition +- `partition` - The list of points by partition + +Level: developer + +-seealso: [](ch_unstructured), `DM`, `DMPLEX`, `PetscPartitioner`, `PetscSection`, `DMPlexDistribute()`, `PetscPartitionerCreate()`, `PetscSectionCreate()`, +`PetscSectionSetChart()`, `PetscPartitionerPartition()` + +# External Links +$(_doc_external("DM/PetscPartitionerDMPlexPartition")) +""" +function PetscPartitionerDMPlexPartition(petsclib::PetscLibType, part::PetscPartitioner, dm::PetscDM, targetSection::PetscSection, partSection::PetscSection, partition::IS) end + +@for_petsc function PetscPartitionerDMPlexPartition(petsclib::$UnionPetscLib, part::PetscPartitioner, dm::PetscDM, targetSection::PetscSection, partSection::PetscSection, partition::IS ) + partition_ = Ref(partition.ptr) + + @chk ccall( + (:PetscPartitionerDMPlexPartition, $petsc_library), + PetscErrorCode, + (PetscPartitioner, CDM, PetscSection, PetscSection, Ptr{CIS}), + part, dm, targetSection, partSection, partition_, + ) + + partition.ptr = C_NULL + + return nothing +end + diff --git a/src/autowrapped/PetscRandom_wrappers.jl b/src/autowrapped/PetscRandom_wrappers.jl new file mode 100644 index 00000000..a53236d7 --- /dev/null +++ b/src/autowrapped/PetscRandom_wrappers.jl @@ -0,0 +1,681 @@ +""" + PetscRandomDestroy(petsclib::PetscLibType,r::PetscRandom) +Destroys a `PetscRandom` object that was created by `PetscRandomCreate()`. + +Collective + +Input Parameter: +- `r` - the random number generator object + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomGetValue()`, `PetscRandomCreate()`, `VecSetRandom()` + +# External Links +$(_doc_external("Sys/PetscRandomDestroy")) +""" +function PetscRandomDestroy(petsclib::PetscLibType, r::PetscRandom) end + +@for_petsc function PetscRandomDestroy(petsclib::$UnionPetscLib, r::PetscRandom ) + + @chk ccall( + (:PetscRandomDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscRandom},), + r, + ) + + + return nothing +end + +""" + PetscRandomGetSeed(petsclib::PetscLibType,r::PetscRandom, seed::PetscInt64) +Gets the random seed. + +Not collective + +Input Parameter: +- `r` - The random number generator context + +Output Parameter: +- `seed` - The random seed + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomCreate()`, `PetscRandomSetSeed()`, `PetscRandomSeed()` + +# External Links +$(_doc_external("Sys/PetscRandomGetSeed")) +""" +function PetscRandomGetSeed(petsclib::PetscLibType, r::PetscRandom, seed::PetscInt64) end + +@for_petsc function PetscRandomGetSeed(petsclib::$UnionPetscLib, r::PetscRandom, seed::$PetscInt64 ) + + @chk ccall( + (:PetscRandomGetSeed, $petsc_library), + PetscErrorCode, + (PetscRandom, Ptr{$PetscInt64}), + r, seed, + ) + + + return nothing +end + +""" + PetscRandomSetSeed(petsclib::PetscLibType,r::PetscRandom, seed::PetscInt64) +Sets the random seed. You MUST call `PetscRandomSeed()` after this call to have the new seed used. + +Not collective + +Input Parameters: +- `r` - The random number generator context +- `seed` - The random seed + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomCreate()`, `PetscRandomGetSeed()`, `PetscRandomSeed()` + +# External Links +$(_doc_external("Sys/PetscRandomSetSeed")) +""" +function PetscRandomSetSeed(petsclib::PetscLibType, r::PetscRandom, seed::PetscInt64) end + +@for_petsc function PetscRandomSetSeed(petsclib::$UnionPetscLib, r::PetscRandom, seed::$PetscInt64 ) + + @chk ccall( + (:PetscRandomSetSeed, $petsc_library), + PetscErrorCode, + (PetscRandom, $PetscInt64), + r, seed, + ) + + + return nothing +end + +""" + PetscRandomSetFromOptions(petsclib::PetscLibType,rnd::PetscRandom) +Configures the random number generator from the options database. + +Collective + +Input Parameter: +- `rnd` - The random number generator context + +Options Database Keys: +- `-random_seed ` - provide a seed to the random number generator +- `-random_no_imaginary_part` - makes the imaginary part of the random number zero, this is useful when you want the +same code to produce the same result when run with real numbers or complex numbers for regression testing purposes + +Level: beginner + +-seealso: `PetscRandom`, `PetscRandomCreate()`, `PetscRandomSetType()` + +# External Links +$(_doc_external("Sys/PetscRandomSetFromOptions")) +""" +function PetscRandomSetFromOptions(petsclib::PetscLibType, rnd::PetscRandom) end + +@for_petsc function PetscRandomSetFromOptions(petsclib::$UnionPetscLib, rnd::PetscRandom ) + + @chk ccall( + (:PetscRandomSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscRandom,), + rnd, + ) + + + return nothing +end + +""" + PetscRandomSetOptionsPrefix(petsclib::PetscLibType,r::PetscRandom, prefix::String) +Sets the prefix used for searching for all +`PetscRandom` options in the database. + +Logically Collective + +Input Parameters: +- `r` - the random number generator context +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: `PetscRandom`, `PetscRandomSetFromOptions()` + +# External Links +$(_doc_external("Sys/PetscRandomSetOptionsPrefix")) +""" +function PetscRandomSetOptionsPrefix(petsclib::PetscLibType, r::PetscRandom, prefix::String) end + +@for_petsc function PetscRandomSetOptionsPrefix(petsclib::$UnionPetscLib, r::PetscRandom, prefix::String ) + + @chk ccall( + (:PetscRandomSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscRandom, Ptr{Cchar}), + r, prefix, + ) + + + return nothing +end + +""" + PetscRandomViewFromOptions(petsclib::PetscLibType,A::PetscRandom, obj::PetscObject, name::String) +View a `PetscRandom` object based on the options database + +Collective + +Input Parameters: +- `A` - the random number generator context +- `obj` - Optional object +- `name` - command line option + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomView`, `PetscObjectViewFromOptions()`, `PetscRandomCreate()` + +# External Links +$(_doc_external("Sys/PetscRandomViewFromOptions")) +""" +function PetscRandomViewFromOptions(petsclib::PetscLibType, A::PetscRandom, obj::PetscObject, name::String) end + +@for_petsc function PetscRandomViewFromOptions(petsclib::$UnionPetscLib, A::PetscRandom, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscRandomViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscRandom, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscRandomView(petsclib::PetscLibType,rnd::PetscRandom, viewer::PetscViewer) +Views a random number generator object. + +Collective + +Input Parameters: +- `rnd` - The random number generator context +- `viewer` - an optional visualization context + +Level: beginner + +-seealso: `PetscRandom`, `PetscRealView()`, `PetscScalarView()`, `PetscIntView()` + +# External Links +$(_doc_external("Sys/PetscRandomView")) +""" +function PetscRandomView(petsclib::PetscLibType, rnd::PetscRandom, viewer::PetscViewer) end + +@for_petsc function PetscRandomView(petsclib::$UnionPetscLib, rnd::PetscRandom, viewer::PetscViewer ) + + @chk ccall( + (:PetscRandomView, $petsc_library), + PetscErrorCode, + (PetscRandom, PetscViewer), + rnd, viewer, + ) + + + return nothing +end + +""" + r::PetscRandom = PetscRandomCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an object for generating random numbers, +and initializes the random-number generator. + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `r` - the random number generator object + +Level: intermediate + +-seealso: `PetscRandomSetType()`, `PetscRandomGetValue()`, `PetscRandomGetValueReal()`, `PetscRandomSetInterval()`, +`PetscRandomDestroy()`, `VecSetRandom()`, `PetscRandomType`, `PetscRandom` + +# External Links +$(_doc_external("Sys/PetscRandomCreate")) +""" +function PetscRandomCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscRandomCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + r_ = Ref{PetscRandom}() + + @chk ccall( + (:PetscRandomCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscRandom}), + comm, r_, + ) + + r = r_[] + + return r +end + +""" + PetscRandomSeed(petsclib::PetscLibType,r::PetscRandom) +Seed the random number generator. + +Not collective + +Input Parameter: +- `r` - The random number generator context + +Level: intermediate + +-seealso: `PetscRandomCreate()`, `PetscRandomGetSeed()`, `PetscRandomSetSeed()` + +# External Links +$(_doc_external("Sys/PetscRandomSeed")) +""" +function PetscRandomSeed(petsclib::PetscLibType, r::PetscRandom) end + +@for_petsc function PetscRandomSeed(petsclib::$UnionPetscLib, r::PetscRandom ) + + @chk ccall( + (:PetscRandomSeed, $petsc_library), + PetscErrorCode, + (PetscRandom,), + r, + ) + + + return nothing +end + +""" + PetscRandomSetType(petsclib::PetscLibType,rnd::PetscRandom, type::PetscRandomType) +Builds a context for generating a particular type of random numbers. + +Collective + +Input Parameters: +- `rnd` - The random number generator context +- `type` - The name of the random type + +Options Database Key: +- `-random_type ` - Sets the random type; use -help for a list +of available types + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomType`, `PetscRandomGetType()`, `PetscRandomCreate()` + +# External Links +$(_doc_external("Sys/PetscRandomSetType")) +""" +function PetscRandomSetType(petsclib::PetscLibType, rnd::PetscRandom, type::PetscRandomType) end + +@for_petsc function PetscRandomSetType(petsclib::$UnionPetscLib, rnd::PetscRandom, type::PetscRandomType ) + + @chk ccall( + (:PetscRandomSetType, $petsc_library), + PetscErrorCode, + (PetscRandom, PetscRandomType), + rnd, type, + ) + + + return nothing +end + +""" + type::PetscRandomType = PetscRandomGetType(petsclib::PetscLibType,rnd::PetscRandom) +Gets the type name (as a string) from the `PetscRandom`. + +Not Collective + +Input Parameter: +- `rnd` - The random number generator context + +Output Parameter: +- `type` - The type name + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomType`, `PetscRandomSetType()`, `PetscRandomCreate()` + +# External Links +$(_doc_external("Sys/PetscRandomGetType")) +""" +function PetscRandomGetType(petsclib::PetscLibType, rnd::PetscRandom) end + +@for_petsc function PetscRandomGetType(petsclib::$UnionPetscLib, rnd::PetscRandom ) + type_ = Ref{PetscRandomType}() + + @chk ccall( + (:PetscRandomGetType, $petsc_library), + PetscErrorCode, + (PetscRandom, Ptr{PetscRandomType}), + rnd, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PetscRandomRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new `PetscRandom` implementation + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine + +Level: advanced + +-seealso: `PetscRandom`, `PetscRandomRegisterAll()`, `PetscRandomRegisterDestroy()` + +# External Links +$(_doc_external("Sys/PetscRandomRegister")) +""" +function PetscRandomRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscRandomRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscRandomRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + val::PetscScalar = PetscRandomGetValue(petsclib::PetscLibType,r::PetscRandom) +Generates a random number. Call this after first calling +`PetscRandomCreate()`. + +Not Collective + +Input Parameter: +- `r` - the random number generator context + +Output Parameter: +- `val` - the value + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomCreate()`, `PetscRandomDestroy()`, `VecSetRandom()`, `PetscRandomGetValueReal()`, `PetscRandomSetInterval()` + +# External Links +$(_doc_external("Sys/PetscRandomGetValue")) +""" +function PetscRandomGetValue(petsclib::PetscLibType, r::PetscRandom) end + +@for_petsc function PetscRandomGetValue(petsclib::$UnionPetscLib, r::PetscRandom ) + val_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscRandomGetValue, $petsc_library), + PetscErrorCode, + (PetscRandom, Ptr{$PetscScalar}), + r, val_, + ) + + val = val_[] + + return val +end + +""" + val::PetscReal = PetscRandomGetValueReal(petsclib::PetscLibType,r::PetscRandom) +Generates a real random number. Call this after first calling +`PetscRandomCreate()`. + +Not Collective + +Input Parameter: +- `r` - the random number generator context + +Output Parameter: +- `val` - the value + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomCreate()`, `PetscRandomDestroy()`, `VecSetRandom()`, `PetscRandomGetValue()` + +# External Links +$(_doc_external("Sys/PetscRandomGetValueReal")) +""" +function PetscRandomGetValueReal(petsclib::PetscLibType, r::PetscRandom) end + +@for_petsc function PetscRandomGetValueReal(petsclib::$UnionPetscLib, r::PetscRandom ) + val_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscRandomGetValueReal, $petsc_library), + PetscErrorCode, + (PetscRandom, Ptr{$PetscReal}), + r, val_, + ) + + val = val_[] + + return val +end + +""" + val::PetscScalar = PetscRandomGetValues(petsclib::PetscLibType,r::PetscRandom, n::PetscInt) +Generates a sequence of random numbers. Call this after first calling +`PetscRandomCreate()`. + +Not Collective + +Input Parameters: +- `r` - the random number generator context +- `n` - number of random numbers to generate + +Output Parameter: +- `val` - the array to hold the values + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomCreate()`, `PetscRandomDestroy()`, `VecSetRandom()`, `PetscRandomGetValue()` + +# External Links +$(_doc_external("Sys/PetscRandomGetValues")) +""" +function PetscRandomGetValues(petsclib::PetscLibType, r::PetscRandom, n::PetscInt) end + +@for_petsc function PetscRandomGetValues(petsclib::$UnionPetscLib, r::PetscRandom, n::$PetscInt ) + val_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscRandomGetValues, $petsc_library), + PetscErrorCode, + (PetscRandom, $PetscInt, Ptr{$PetscScalar}), + r, n, val_, + ) + + val = val_[] + + return val +end + +""" + val::PetscReal = PetscRandomGetValuesReal(petsclib::PetscLibType,r::PetscRandom, n::PetscInt) +Generates a sequence of real random numbers. Call this after first calling +`PetscRandomCreate()`. + +Not Collective + +Input Parameters: +- `r` - the random number generator context +- `n` - number of random numbers to generate + +Output Parameter: +- `val` - the array to hold the values + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomCreate()`, `PetscRandomDestroy()`, `VecSetRandom()`, `PetscRandomGetValues()` + +# External Links +$(_doc_external("Sys/PetscRandomGetValuesReal")) +""" +function PetscRandomGetValuesReal(petsclib::PetscLibType, r::PetscRandom, n::PetscInt) end + +@for_petsc function PetscRandomGetValuesReal(petsclib::$UnionPetscLib, r::PetscRandom, n::$PetscInt ) + val_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscRandomGetValuesReal, $petsc_library), + PetscErrorCode, + (PetscRandom, $PetscInt, Ptr{$PetscReal}), + r, n, val_, + ) + + val = val_[] + + return val +end + +""" + low::PetscScalar,high::PetscScalar = PetscRandomGetInterval(petsclib::PetscLibType,r::PetscRandom) +Gets the interval over which the random numbers +will be distributed. By default, this interval is [0,1). + +Not Collective + +Input Parameter: +- `r` - the random number generator context + +Output Parameters: +- `low` - The lower bound of the interval +- `high` - The upper bound of the interval + +Level: intermediate + +-seealso: `PetscRandom`, `PetscRandomCreate()`, `PetscRandomSetInterval()` + +# External Links +$(_doc_external("Sys/PetscRandomGetInterval")) +""" +function PetscRandomGetInterval(petsclib::PetscLibType, r::PetscRandom) end + +@for_petsc function PetscRandomGetInterval(petsclib::$UnionPetscLib, r::PetscRandom ) + low_ = Ref{$PetscScalar}() + high_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscRandomGetInterval, $petsc_library), + PetscErrorCode, + (PetscRandom, Ptr{$PetscScalar}, Ptr{$PetscScalar}), + r, low_, high_, + ) + + low = low_[] + high = high_[] + + return low,high +end + +""" + PetscRandomSetInterval(petsclib::PetscLibType,r::PetscRandom, low::PetscScalar, high::PetscScalar) +Sets the interval over which the random numbers +will be distributed. By default, this interval is [0,1). + +Not Collective + +Input Parameters: +- `r` - the random number generator context +- `low` - The lower bound of the interval +- `high` - The upper bound of the interval + +Level: intermediate + +-seealso: `PetscRandomCreate()`, `PetscRandomGetInterval()` + +# External Links +$(_doc_external("Sys/PetscRandomSetInterval")) +""" +function PetscRandomSetInterval(petsclib::PetscLibType, r::PetscRandom, low::PetscScalar, high::PetscScalar) end + +@for_petsc function PetscRandomSetInterval(petsclib::$UnionPetscLib, r::PetscRandom, low::$PetscScalar, high::$PetscScalar ) + + @chk ccall( + (:PetscRandomSetInterval, $petsc_library), + PetscErrorCode, + (PetscRandom, $PetscScalar, $PetscScalar), + r, low, high, + ) + + + return nothing +end + +""" + PetscRandomFinalizePackage(petsclib::PetscLibType) +This function frees everything in the `PetscRandom` package. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: `PetscFinalize()` + +# External Links +$(_doc_external("Sys/PetscRandomFinalizePackage")) +""" +function PetscRandomFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscRandomFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscRandomFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscRandomInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PetscRandom` package. It is called +from PetscDLLibraryRegister_petsc() when using dynamic libraries, and on the first call to `PetscRandomCreate()` +when using shared or static libraries. + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscRandomInitializePackage")) +""" +function PetscRandomInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscRandomInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscRandomInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscRegressor_wrappers.jl b/src/autowrapped/PetscRegressor_wrappers.jl new file mode 100644 index 00000000..43bee724 --- /dev/null +++ b/src/autowrapped/PetscRegressor_wrappers.jl @@ -0,0 +1,803 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscRegressor end +const PetscRegressor = Ptr{_n_PetscRegressor} +# ------------------------------------------------------- +""" + PetscRegressorRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a method to the `PetscRegressor` package. + +Not collective + +Input Parameters: +- `sname` - name of a new user-defined regressor +- `function` - routine to create method context + +-seealso: `PetscRegressorRegisterAll()` + +# External Links +$(_doc_external("Ml/PetscRegressorRegister")) +""" +function PetscRegressorRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscRegressorRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscRegressorRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + newregressor::PetscRegressor = PetscRegressorCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a `PetscRegressor` object. + +Collective + +Input Parameter: +- `comm` - the MPI communicator that will share the `PetscRegressor` object + +Output Parameter: +- `newregressor` - the new `PetscRegressor` object + +Level: beginner + +-seealso: `PetscRegressorFit()`, `PetscRegressorPredict()`, `PetscRegressor` + +# External Links +$(_doc_external("Ml/PetscRegressorCreate")) +""" +function PetscRegressorCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscRegressorCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + newregressor_ = Ref{PetscRegressor}() + + @chk ccall( + (:PetscRegressorCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscRegressor}), + comm, newregressor_, + ) + + newregressor = newregressor_[] + + return newregressor +end + +""" + PetscRegressorView(petsclib::PetscLibType,regressor::PetscRegressor, viewer::PetscViewer) +Prints information about the `PetscRegressor` object + +Collective + +Input Parameters: +- `regressor` - the `PetscRegressor` context +- `viewer` - a `PetscViewer` context + +Options Database Key: +- `-regressor_view` - Calls `PetscRegressorView()` at the end of `PetscRegressorFit()` + +Level: beginner + +-seealso: [](ch_regressor), `PetscRegressor`, `PetscViewerASCIIOpen()` + +# External Links +$(_doc_external("Ml/PetscRegressorView")) +""" +function PetscRegressorView(petsclib::PetscLibType, regressor::PetscRegressor, viewer::PetscViewer) end + +@for_petsc function PetscRegressorView(petsclib::$UnionPetscLib, regressor::PetscRegressor, viewer::PetscViewer ) + + @chk ccall( + (:PetscRegressorView, $petsc_library), + PetscErrorCode, + (PetscRegressor, PetscViewer), + regressor, viewer, + ) + + + return nothing +end + +""" + PetscRegressorViewFromOptions(petsclib::PetscLibType,A::PetscRegressor, obj::PetscObject, name::String) +View a `PetscRegressor` object based on values in the options database + +Collective + +Input Parameters: +- `A` - the `PetscRegressor` context +- `obj` - Optional object that provides the prefix for the options database +- `name` - command line option + +Level: intermediate + +-seealso: [](ch_regressor), `PetscRegressor`, `PetscRegressorView`, `PetscObjectViewFromOptions()`, `PetscRegressorCreate()` + +# External Links +$(_doc_external("Ml/PetscRegressorViewFromOptions")) +""" +function PetscRegressorViewFromOptions(petsclib::PetscLibType, A::PetscRegressor, obj::PetscObject, name::String) end + +@for_petsc function PetscRegressorViewFromOptions(petsclib::$UnionPetscLib, A::PetscRegressor, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscRegressorViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscRegressor, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscRegressorSetFromOptions(petsclib::PetscLibType,regressor::PetscRegressor) +Sets `PetscRegressor` options from the options database. + +Collective + +Input Parameter: +- `regressor` - the `PetscRegressor` context + +Options Database Keys: +- `-regressor_type ` - the particular type of regressor to be used; see `PetscRegressorType` for complete list + +Level: beginner + +-seealso: `PetscRegressor`, `PetscRegressorCreate()` + +# External Links +$(_doc_external("Ml/PetscRegressorSetFromOptions")) +""" +function PetscRegressorSetFromOptions(petsclib::PetscLibType, regressor::PetscRegressor) end + +@for_petsc function PetscRegressorSetFromOptions(petsclib::$UnionPetscLib, regressor::PetscRegressor ) + + @chk ccall( + (:PetscRegressorSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscRegressor,), + regressor, + ) + + + return nothing +end + +""" + PetscRegressorSetUp(petsclib::PetscLibType,regressor::PetscRegressor) +Sets up the internal data structures for the later use of a regressor. + +Collective + +Input Parameter: +- `regressor` - the `PetscRegressor` context + +-seealso: `PetscRegressorCreate()`, `PetscRegressorFit()`, `PetscRegressorDestroy()` + +# External Links +$(_doc_external("Ml/PetscRegressorSetUp")) +""" +function PetscRegressorSetUp(petsclib::PetscLibType, regressor::PetscRegressor) end + +@for_petsc function PetscRegressorSetUp(petsclib::$UnionPetscLib, regressor::PetscRegressor ) + + @chk ccall( + (:PetscRegressorSetUp, $petsc_library), + PetscErrorCode, + (PetscRegressor,), + regressor, + ) + + + return nothing +end + +""" + PetscRegressorFit(petsclib::PetscLibType,regressor::PetscRegressor, X::PetscMat, y::PetscVec) +Fit, or train, a regressor from a training dataset + +Collective + +Input Parameters: +- `regressor` - the `PetscRegressor` context +- `X` - matrix of training data (of dimension [number of samples] x [number of features]) +- `y` - vector of target values from the training dataset + +Level: beginner + +-seealso: `PetscRegressorCreate()`, `PetscRegressorSetUp()`, `PetscRegressorDestroy()`, `PetscRegressorPredict()` + +# External Links +$(_doc_external("Ml/PetscRegressorFit")) +""" +function PetscRegressorFit(petsclib::PetscLibType, regressor::PetscRegressor, X::PetscMat, y::PetscVec) end + +@for_petsc function PetscRegressorFit(petsclib::$UnionPetscLib, regressor::PetscRegressor, X::PetscMat, y::PetscVec ) + + @chk ccall( + (:PetscRegressorFit, $petsc_library), + PetscErrorCode, + (PetscRegressor, CMat, CVec), + regressor, X, y, + ) + + + return nothing +end + +""" + PetscRegressorPredict(petsclib::PetscLibType,regressor::PetscRegressor, X::PetscMat, y::PetscVec) +Compute predictions (that is, perform inference) using a fitted regression model. + +Collective + +Input Parameters: +- `regressor` - the `PetscRegressor` context (for which `PetscRegressorFit()` must have been called) +- `X` - data matrix of unlabeled observations + +Output Parameter: +- `y` - vector of predicted labels + +Level: beginner + +-seealso: `PetscRegressorFit()`, `PetscRegressorDestroy()` + +# External Links +$(_doc_external("Ml/PetscRegressorPredict")) +""" +function PetscRegressorPredict(petsclib::PetscLibType, regressor::PetscRegressor, X::PetscMat, y::PetscVec) end + +@for_petsc function PetscRegressorPredict(petsclib::$UnionPetscLib, regressor::PetscRegressor, X::PetscMat, y::PetscVec ) + + @chk ccall( + (:PetscRegressorPredict, $petsc_library), + PetscErrorCode, + (PetscRegressor, CMat, CVec), + regressor, X, y, + ) + + + return nothing +end + +""" + PetscRegressorReset(petsclib::PetscLibType,regressor::PetscRegressor) +Resets a `PetscRegressor` context by removing any allocated `Vec` and `Mat`. Any options set in the object remain. + +Collective + +Input Parameter: +- `regressor` - context obtained from `PetscRegressorCreate()` + +Level: intermediate + +-seealso: `PetscRegressorCreate()`, `PetscRegressorSetUp()`, `PetscRegressorFit()`, `PetscRegressorPredict()`, `PetscRegressorDestroy()` + +# External Links +$(_doc_external("Ml/PetscRegressorReset")) +""" +function PetscRegressorReset(petsclib::PetscLibType, regressor::PetscRegressor) end + +@for_petsc function PetscRegressorReset(petsclib::$UnionPetscLib, regressor::PetscRegressor ) + + @chk ccall( + (:PetscRegressorReset, $petsc_library), + PetscErrorCode, + (PetscRegressor,), + regressor, + ) + + + return nothing +end + +""" + PetscRegressorDestroy(petsclib::PetscLibType,regressor::PetscRegressor) +Destroys the regressor context that was created with `PetscRegressorCreate()`. + +Collective + +Input Parameter: +- `regressor` - the `PetscRegressor` context + +Level: beginner + +-seealso: `PetscRegressorCreate()`, `PetscRegressorSetUp()`, `PetscRegressorReset()`, `PetscRegressor` + +# External Links +$(_doc_external("Ml/PetscRegressorDestroy")) +""" +function PetscRegressorDestroy(petsclib::PetscLibType, regressor::PetscRegressor) end + +@for_petsc function PetscRegressorDestroy(petsclib::$UnionPetscLib, regressor::PetscRegressor ) + + @chk ccall( + (:PetscRegressorDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscRegressor},), + regressor, + ) + + + return nothing +end + +""" + PetscRegressorSetType(petsclib::PetscLibType,regressor::PetscRegressor, type::PetscRegressorType) +Sets the type for the regressor. + +Collective + +Input Parameters: +- `regressor` - the `PetscRegressor` context +- `type` - a known regression method + +Options Database Key: +- `-regressor_type ` - Sets the type of regressor; use -help for a list of available types + +Level: intermediate + +-seealso: `PetscRegressorType` + +# External Links +$(_doc_external("Ml/PetscRegressorSetType")) +""" +function PetscRegressorSetType(petsclib::PetscLibType, regressor::PetscRegressor, type::PetscRegressorType) end + +@for_petsc function PetscRegressorSetType(petsclib::$UnionPetscLib, regressor::PetscRegressor, type::PetscRegressorType ) + + @chk ccall( + (:PetscRegressorSetType, $petsc_library), + PetscErrorCode, + (PetscRegressor, PetscRegressorType), + regressor, type, + ) + + + return nothing +end + +""" + type::PetscRegressorType = PetscRegressorGetType(petsclib::PetscLibType,regressor::PetscRegressor) +Gets the current `PetscRegressorType` being used in the `PetscRegressor` object + +Not Collective + +Input Parameter: +- `regressor` - the `PetscRegressor` solver context + +Output Parameter: +- `type` - the `PetscRegressorType` + +Level: intermediate + +-seealso: [](ch_regressor), `PetscRegressor`, `PetscRegressorType`, `PetscRegressorSetType()` + +# External Links +$(_doc_external("Ml/PetscRegressorGetType")) +""" +function PetscRegressorGetType(petsclib::PetscLibType, regressor::PetscRegressor) end + +@for_petsc function PetscRegressorGetType(petsclib::$UnionPetscLib, regressor::PetscRegressor ) + type_ = Ref{PetscRegressorType}() + + @chk ccall( + (:PetscRegressorGetType, $petsc_library), + PetscErrorCode, + (PetscRegressor, Ptr{PetscRegressorType}), + regressor, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PetscRegressorSetRegularizerWeight(petsclib::PetscLibType,regressor::PetscRegressor, weight::PetscReal) +Sets the weight to be used for the regularizer for a `PetscRegressor` context + +Logically Collective + +Input Parameters: +- `regressor` - the `PetscRegressor` context +- `weight` - the regularizer weight + +Options Database Key: +- `regressor_regularizer_weight ` - sets the regularizer's weight + +Level: beginner + +-seealso: `PetscRegressorSetType` + +# External Links +$(_doc_external("Ml/PetscRegressorSetRegularizerWeight")) +""" +function PetscRegressorSetRegularizerWeight(petsclib::PetscLibType, regressor::PetscRegressor, weight::PetscReal) end + +@for_petsc function PetscRegressorSetRegularizerWeight(petsclib::$UnionPetscLib, regressor::PetscRegressor, weight::$PetscReal ) + + @chk ccall( + (:PetscRegressorSetRegularizerWeight, $petsc_library), + PetscErrorCode, + (PetscRegressor, $PetscReal), + regressor, weight, + ) + + + return nothing +end + +""" + PetscRegressorGetTao(petsclib::PetscLibType,regressor::PetscRegressor, tao::Tao) +Returns the `Tao` context for a `PetscRegressor` object. + +Not Collective, but if the `PetscRegressor` is parallel, then the `Tao` object is parallel + +Input Parameter: +- `regressor` - the regressor context + +Output Parameter: +- `tao` - the `Tao` context + +Level: beginner + +-seealso: `PetscRegressorLinearGetKSP()` + +# External Links +$(_doc_external("Ml/PetscRegressorGetTao")) +""" +function PetscRegressorGetTao(petsclib::PetscLibType, regressor::PetscRegressor, tao::Tao) end + +@for_petsc function PetscRegressorGetTao(petsclib::$UnionPetscLib, regressor::PetscRegressor, tao::Tao ) + + @chk ccall( + (:PetscRegressorGetTao, $petsc_library), + PetscErrorCode, + (PetscRegressor, Ptr{Tao}), + regressor, tao, + ) + + + return nothing +end + +""" + PetscRegressorSetOptionsPrefix(petsclib::PetscLibType,regressor::PetscRegressor, p::String) +Sets the prefix used for searching for all +PetscRegressor options in the database. + +Logically Collective + +Input Parameters: +- `regressor` - the `PetscRegressor` context +- `p` - the prefix string to prepend to all PetscRegressor option requests + +Level: advanced + +-seealso: [](ch_regressor), `PetscRegressor`, `PetscRegressorSetFromOptions()`, `PetscRegressorAppendOptionsPrefix()`, `PetscRegressorGetOptionsPrefix()` + +# External Links +$(_doc_external("Ml/PetscRegressorSetOptionsPrefix")) +""" +function PetscRegressorSetOptionsPrefix(petsclib::PetscLibType, regressor::PetscRegressor, p::String) end + +@for_petsc function PetscRegressorSetOptionsPrefix(petsclib::$UnionPetscLib, regressor::PetscRegressor, p::String ) + + @chk ccall( + (:PetscRegressorSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscRegressor, Ptr{Cchar}), + regressor, p, + ) + + + return nothing +end + +""" + PetscRegressorAppendOptionsPrefix(petsclib::PetscLibType,regressor::PetscRegressor, p::String) +Appends to the prefix used for searching for all PetscRegressor options in the database. + +Logically Collective + +Input Parameters: +- `regressor` - the `PetscRegressor` solver context +- `p` - the prefix string to prepend to all `PetscRegressor` option requests + +Level: advanced + +-seealso: [](ch_regressor), `PetscRegressor`, `PetscRegressorSetFromOptions()`, `PetscRegressorSetOptionsPrefix()`, `PetscRegressorGetOptionsPrefix()` + +# External Links +$(_doc_external("Ml/PetscRegressorAppendOptionsPrefix")) +""" +function PetscRegressorAppendOptionsPrefix(petsclib::PetscLibType, regressor::PetscRegressor, p::String) end + +@for_petsc function PetscRegressorAppendOptionsPrefix(petsclib::$UnionPetscLib, regressor::PetscRegressor, p::String ) + + @chk ccall( + (:PetscRegressorAppendOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscRegressor, Ptr{Cchar}), + regressor, p, + ) + + + return nothing +end + +""" + PetscRegressorGetOptionsPrefix(petsclib::PetscLibType,regressor::PetscRegressor, p::String) +Gets the prefix used for searching for all +PetscRegressor options in the database + +Not Collective + +Input Parameter: +- `regressor` - the `PetscRegressor` context + +Output Parameter: +- `p` - pointer to the prefix string used is returned + +-seealso: [](ch_regressor), `PetscRegressor`, `PetscRegressorSetFromOptions()`, `PetscRegressorSetOptionsPrefix()`, `PetscRegressorAppendOptionsPrefix()` + +# External Links +$(_doc_external("Ml/PetscRegressorGetOptionsPrefix")) +""" +function PetscRegressorGetOptionsPrefix(petsclib::PetscLibType, regressor::PetscRegressor, p::String) end + +@for_petsc function PetscRegressorGetOptionsPrefix(petsclib::$UnionPetscLib, regressor::PetscRegressor, p::String ) + p_ = Ref(pointer(p)) + + @chk ccall( + (:PetscRegressorGetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscRegressor, Ptr{Ptr{Cchar}}), + regressor, p_, + ) + + + return nothing +end + +""" + PetscRegressorInitializePackage(petsclib::PetscLibType) +Initialize `PetscRegressor` package + +Logically Collective + +Level: developer + +-seealso: `PetscRegressorFinalizePackage()` + +# External Links +$(_doc_external("Ml/PetscRegressorInitializePackage")) +""" +function PetscRegressorInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscRegressorInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscRegressorInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscRegressorFinalizePackage(petsclib::PetscLibType) +Finalize `PetscRegressor` package; it is called from `PetscFinalize()` + +Logically Collective + +Level: developer + +-seealso: `PetscRegressorInitializePackage()` + +# External Links +$(_doc_external("Ml/PetscRegressorFinalizePackage")) +""" +function PetscRegressorFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscRegressorFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscRegressorFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscRegressorLinearSetFitIntercept(petsclib::PetscLibType,regressor::PetscRegressor, flg::PetscBool) +Set a flag to indicate that the intercept (also known as the "bias" or "offset") should +be calculated; data are assumed to be mean-centered if false. + +Logically Collective + +Input Parameters: +- `regressor` - the `PetscRegressor` context +- `flg` - `PETSC_TRUE` to calculate the intercept, `PETSC_FALSE` to assume mean-centered data (default is `PETSC_TRUE`) + +Level: intermediate + +Options Database Key: +- `regressor_linear_fit_intercept ` - fit the intercept + +-seealso: `PetscRegressor`, `PetscRegressorFit()` + +# External Links +$(_doc_external("Ml/PetscRegressorLinearSetFitIntercept")) +""" +function PetscRegressorLinearSetFitIntercept(petsclib::PetscLibType, regressor::PetscRegressor, flg::PetscBool) end + +@for_petsc function PetscRegressorLinearSetFitIntercept(petsclib::$UnionPetscLib, regressor::PetscRegressor, flg::PetscBool ) + + @chk ccall( + (:PetscRegressorLinearSetFitIntercept, $petsc_library), + PetscErrorCode, + (PetscRegressor, PetscBool), + regressor, flg, + ) + + + return nothing +end + +""" + PetscRegressorLinearSetUseKSP(petsclib::PetscLibType,regressor::PetscRegressor, flg::PetscBool) +Set a flag to indicate that a `KSP` object, instead of a `Tao` one, should be used +to fit the linear regressor + +Logically Collective + +Input Parameters: +- `regressor` - the `PetscRegressor` context +- `flg` - `PETSC_TRUE` to use a `KSP`, `PETSC_FALSE` to use a `Tao` object (default is false) + +Options Database Key: +- `regressor_linear_use_ksp ` - use `KSP` + +Level: intermediate + +-seealso: `PetscRegressor`, `PetscRegressorLinearGetKSP()`, `KSPLSQR`, `PCQR`, `MATSOLVERSPQR`, `MatSolverType`, `MATSEQDENSE`, `PCSVD` + +# External Links +$(_doc_external("Ml/PetscRegressorLinearSetUseKSP")) +""" +function PetscRegressorLinearSetUseKSP(petsclib::PetscLibType, regressor::PetscRegressor, flg::PetscBool) end + +@for_petsc function PetscRegressorLinearSetUseKSP(petsclib::$UnionPetscLib, regressor::PetscRegressor, flg::PetscBool ) + + @chk ccall( + (:PetscRegressorLinearSetUseKSP, $petsc_library), + PetscErrorCode, + (PetscRegressor, PetscBool), + regressor, flg, + ) + + + return nothing +end + +""" + PetscRegressorLinearGetKSP(petsclib::PetscLibType,regressor::PetscRegressor, ksp::PetscKSP) +Returns the `KSP` context for a `PETSCREGRESSORLINEAR` object. + +Not Collective, but if the `PetscRegressor` is parallel, then the `KSP` object is parallel + +Input Parameter: +- `regressor` - the `PetscRegressor` context + +Output Parameter: +- `ksp` - the `KSP` context + +Level: beginner + +-seealso: `PetscRegressorGetTao()` + +# External Links +$(_doc_external("Ml/PetscRegressorLinearGetKSP")) +""" +function PetscRegressorLinearGetKSP(petsclib::PetscLibType, regressor::PetscRegressor, ksp::PetscKSP) end + +@for_petsc function PetscRegressorLinearGetKSP(petsclib::$UnionPetscLib, regressor::PetscRegressor, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:PetscRegressorLinearGetKSP, $petsc_library), + PetscErrorCode, + (PetscRegressor, Ptr{CKSP}), + regressor, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + PetscRegressorLinearSetType(petsclib::PetscLibType,regressor::PetscRegressor, type::PetscRegressorLinearType) +Sets the type of linear regression to be performed + +Logically Collective + +Input Parameters: +- `regressor` - the `PetscRegressor` context (should be of type `PETSCREGRESSORLINEAR`) +- `type` - a known linear regression method + +Options Database Key: +- `-regressor_linear_type` - Sets the linear regression method; use -help for a list of available methods +(for instance "-regressor_linear_type ols" or "-regressor_linear_type lasso") + +Level: intermediate + +-seealso: `PetscRegressorLinearGetType()`, `PetscRegressorLinearType`, `PetscRegressorSetType()`, `REGRESSOR_LINEAR_OLS`, +`REGRESSOR_LINEAR_LASSO`, `REGRESSOR_LINEAR_RIDGE` + +# External Links +$(_doc_external("Ml/PetscRegressorLinearSetType")) +""" +function PetscRegressorLinearSetType(petsclib::PetscLibType, regressor::PetscRegressor, type::PetscRegressorLinearType) end + +@for_petsc function PetscRegressorLinearSetType(petsclib::$UnionPetscLib, regressor::PetscRegressor, type::PetscRegressorLinearType ) + + @chk ccall( + (:PetscRegressorLinearSetType, $petsc_library), + PetscErrorCode, + (PetscRegressor, PetscRegressorLinearType), + regressor, type, + ) + + + return nothing +end + +""" + type::PetscRegressorLinearType = PetscRegressorLinearGetType(petsclib::PetscLibType,regressor::PetscRegressor) +Return the type for the `PETSCREGRESSORLINEAR` solver + +Input Parameter: +- `regressor` - the `PetscRegressor` solver context + +Output Parameter: +- `type` - `PETSCREGRESSORLINEAR` type + +Level: advanced + +-seealso: `PetscRegressor`, `PETSCREGRESSORLINEAR`, `PetscRegressorLinearSetType()`, `PetscRegressorLinearType` + +# External Links +$(_doc_external("Ml/PetscRegressorLinearGetType")) +""" +function PetscRegressorLinearGetType(petsclib::PetscLibType, regressor::PetscRegressor) end + +@for_petsc function PetscRegressorLinearGetType(petsclib::$UnionPetscLib, regressor::PetscRegressor ) + type_ = Ref{PetscRegressorLinearType}() + + @chk ccall( + (:PetscRegressorLinearGetType, $petsc_library), + PetscErrorCode, + (PetscRegressor, Ptr{PetscRegressorLinearType}), + regressor, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + diff --git a/src/autowrapped/PetscSF_wrappers.jl b/src/autowrapped/PetscSF_wrappers.jl new file mode 100644 index 00000000..92806eb6 --- /dev/null +++ b/src/autowrapped/PetscSF_wrappers.jl @@ -0,0 +1,1897 @@ +# autodefined type arguments for class ------ +mutable struct _n_MPI_Group end +const MPI_Group = Ptr{_n_MPI_Group} + + + +""" + sf::PetscSF = PetscSFCreate(petsclib::PetscLibType,comm::MPI_Comm) +create a star forest communication context + +Collective + +Input Parameter: +- `comm` - communicator on which the star forest will operate + +Output Parameter: +- `sf` - new star forest context + +Options Database Key: +- `-sf_type basic` - Use MPI persistent Isend/Irecv for communication (Default) +- `-sf_type window` - Use MPI-3 one-sided window for communication +- `-sf_type neighbor` - Use MPI-3 neighborhood collectives for communication +- `-sf_neighbor_persistent ` - If true, use MPI-4 persistent neighborhood collectives for communication (used along with -sf_type neighbor) + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFSetType`, `PetscSFSetGraph()`, `PetscSFSetGraphWithPattern()`, `PetscSFDestroy()` + +# External Links +$(_doc_external("Vec/PetscSFCreate")) +""" +function PetscSFCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscSFCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + sf_ = Ref{PetscSF}() + + @chk ccall( + (:PetscSFCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscSF}), + comm, sf_, + ) + + sf = sf_[] + + return sf +end + +""" + PetscSFReset(petsclib::PetscLibType,sf::PetscSF) +Reset a star forest so that different sizes or neighbors can be used + +Collective + +Input Parameter: +- `sf` - star forest + +Level: advanced + +-seealso: `PetscSF`, `PetscSFCreate()`, `PetscSFSetGraph()`, `PetscSFDestroy()` + +# External Links +$(_doc_external("Vec/PetscSFReset")) +""" +function PetscSFReset(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFReset(petsclib::$UnionPetscLib, sf::PetscSF ) + + @chk ccall( + (:PetscSFReset, $petsc_library), + PetscErrorCode, + (PetscSF,), + sf, + ) + + + return nothing +end + +""" + PetscSFSetType(petsclib::PetscLibType,sf::PetscSF, type::PetscSFType) +Set the `PetscSF` communication implementation + +Collective + +Input Parameters: +- `sf` - the `PetscSF` context +- `type` - a known method +-seealso: `PetscSF`, `PetscSFType`, `PetscSFCreate()` + +# External Links +$(_doc_external("Vec/PetscSFSetType")) +""" +function PetscSFSetType(petsclib::PetscLibType, sf::PetscSF, type::PetscSFType) end + +@for_petsc function PetscSFSetType(petsclib::$UnionPetscLib, sf::PetscSF, type::PetscSFType ) + + @chk ccall( + (:PetscSFSetType, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSFType), + sf, type, + ) + + + return nothing +end + +""" + type::PetscSFType = PetscSFGetType(petsclib::PetscLibType,sf::PetscSF) +Get the `PetscSF` communication implementation + +Not Collective + +Input Parameter: +- `sf` - the `PetscSF` context + +Output Parameter: +- `type` - the `PetscSF` type name + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFType`, `PetscSFSetType()`, `PetscSFCreate()` + +# External Links +$(_doc_external("Vec/PetscSFGetType")) +""" +function PetscSFGetType(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFGetType(petsclib::$UnionPetscLib, sf::PetscSF ) + type_ = Ref{PetscSFType}() + + @chk ccall( + (:PetscSFGetType, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{PetscSFType}), + sf, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PetscSFDestroy(petsclib::PetscLibType,sf::PetscSF) +destroy a star forest + +Collective + +Input Parameter: +- `sf` - address of star forest + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFType`, `PetscSFCreate()`, `PetscSFReset()` + +# External Links +$(_doc_external("Vec/PetscSFDestroy")) +""" +function PetscSFDestroy(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFDestroy(petsclib::$UnionPetscLib, sf::PetscSF ) + + sf_ = Ref{PetscSF}(sf) + + @chk ccall( + (:PetscSFDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscSF},), + sf_, + ) + + + return nothing +end + +@for_petsc function PetscSFDestroy(petsclib::$UnionPetscLib, sf::Ref{PetscSF} ) + + @chk ccall( + (:PetscSFDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscSF},), + sf, + ) + + + return nothing +end + +""" + PetscSFSetUp(petsclib::PetscLibType,sf::PetscSF) +set up communication structures for a `PetscSF`, after this is done it may be used to perform communication + +Collective + +Input Parameter: +- `sf` - star forest communication object + +Level: beginner + +-seealso: `PetscSF`, `PetscSFType`, `PetscSFSetFromOptions()`, `PetscSFSetType()` + +# External Links +$(_doc_external("Vec/PetscSFSetUp")) +""" +function PetscSFSetUp(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFSetUp(petsclib::$UnionPetscLib, sf::PetscSF ) + + @chk ccall( + (:PetscSFSetUp, $petsc_library), + PetscErrorCode, + (PetscSF,), + sf, + ) + + + return nothing +end + +""" + PetscSFSetFromOptions(petsclib::PetscLibType,sf::PetscSF) +set `PetscSF` options using the options database + +Logically Collective + +Input Parameter: +- `sf` - star forest + +Options Database Keys: +- `-sf_type` - implementation type, see `PetscSFSetType()` +- `-sf_rank_order` - sort composite points for gathers and scatters in rank order, gathers are non-deterministic otherwise +- `-sf_use_default_stream` - Assume callers of `PetscSF` computed the input root/leafdata with the default CUDA stream. `PetscSF` will also +use the default stream to process data. Therefore, no stream synchronization is needed between `PetscSF` and its caller (default: true). +If true, this option only works with `-use_gpu_aware_mpi 1`. +- `-sf_use_stream_aware_mpi` - Assume the underlying MPI is CUDA-stream aware and `PetscSF` won't sync streams for send/recv buffers passed to MPI (default: false). +If true, this option only works with `-use_gpu_aware_mpi 1`. + +- `-sf_backend ` - Select the device backend`PetscSF` uses. Currently `PetscSF` has these backends: cuda - hip and Kokkos. +On CUDA (HIP) devices, one can choose cuda (hip) or kokkos with the default being kokkos. On other devices, +the only available is kokkos. + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFCreate()`, `PetscSFSetType()` + +# External Links +$(_doc_external("Vec/PetscSFSetFromOptions")) +""" +function PetscSFSetFromOptions(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFSetFromOptions(petsclib::$UnionPetscLib, sf::PetscSF ) + + @chk ccall( + (:PetscSFSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscSF,), + sf, + ) + + + return nothing +end + +""" + PetscSFSetRankOrder(petsclib::PetscLibType,sf::PetscSF, flg::PetscBool) +sort multi + +Logically Collective + +Input Parameters: +- `sf` - star forest +- `flg` - `PETSC_TRUE` to sort, `PETSC_FALSE` to skip sorting (lower setup cost, but non-deterministic) + +Level: advanced + +-seealso: `PetscSF`, `PetscSFType`, `PetscSFGatherBegin()`, `PetscSFScatterBegin()` + +# External Links +$(_doc_external("Vec/PetscSFSetRankOrder")) +""" +function PetscSFSetRankOrder(petsclib::PetscLibType, sf::PetscSF, flg::PetscBool) end + +@for_petsc function PetscSFSetRankOrder(petsclib::$UnionPetscLib, sf::PetscSF, flg::PetscBool ) + + @chk ccall( + (:PetscSFSetRankOrder, $petsc_library), + PetscErrorCode, + (PetscSF, PetscBool), + sf, flg, + ) + + + return nothing +end + +""" + PetscSFSetGraph(petsclib::PetscLibType,sf::PetscSF, nroots::PetscInt, nleaves::PetscInt, iloc::Vector{PetscInt}, locmode::PetscCopyMode, iremote::Vector{PetscSFNode}, remotemode::PetscCopyMode) +Set a parallel star forest + +Collective + +Input Parameters: +- `sf` - star forest +- `nroots` - number of root vertices on the current process (these are possible targets for other process to attach leaves) +- `nleaves` - number of leaf vertices on the current process, each of these references a root on any process +- `ilocal` - locations of leaves in leafdata buffers, pass `NULL` for contiguous storage (locations must be >= 0, enforced +during setup in debug mode) +- `localmode` - copy mode for `ilocal` +- `iremote` - remote locations of root vertices for each leaf on the current process, length is 2 `nleaves' +(locations must be >= 0, enforced during setup in debug mode) +- `remotemode` - copy mode for `iremote` + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFType`, `PetscSFCreate()`, `PetscSFView()`, `PetscSFGetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFSetGraph")) +""" +function PetscSFSetGraph(petsclib::PetscLibType, sf::PetscSF, nroots::PetscInt, nleaves::PetscInt, iloc::Vector{PetscInt}, locmode::PetscCopyMode, iremote::Vector{PetscSFNode}, remotemode::PetscCopyMode) end + +@for_petsc function PetscSFSetGraph(petsclib::$UnionPetscLib, sf::PetscSF, nroots::$PetscInt, nleaves::$PetscInt, iloc::Vector{$PetscInt}, locmode::PetscCopyMode, iremote::Vector{PetscSFNode}, remotemode::PetscCopyMode ) + + @chk ccall( + (:PetscSFSetGraph, $petsc_library), + PetscErrorCode, + (PetscSF, $PetscInt, $PetscInt, Ptr{$PetscInt}, PetscCopyMode, Ptr{PetscSFNode}, PetscCopyMode), + sf, nroots, nleaves, iloc, locmode, iremote, remotemode, + ) + + + return nothing +end + +""" + PetscSFSetGraphWithPattern(petsclib::PetscLibType,sf::PetscSF, map::PetscLayout, pattern::PetscSFPattern) +Sets the graph of a `PetscSF` with a specific pattern + +Collective + +Input Parameters: +- `sf` - The `PetscSF` +- `map` - Layout of roots over all processes (insignificant when pattern is `PETSCSF_PATTERN_ALLTOALL`) +- `pattern` - One of `PETSCSF_PATTERN_ALLGATHER`, `PETSCSF_PATTERN_GATHER`, `PETSCSF_PATTERN_ALLTOALL` + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFCreate()`, `PetscSFView()`, `PetscSFGetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFSetGraphWithPattern")) +""" +function PetscSFSetGraphWithPattern(petsclib::PetscLibType, sf::PetscSF, map::PetscLayout, pattern::PetscSFPattern) end + +@for_petsc function PetscSFSetGraphWithPattern(petsclib::$UnionPetscLib, sf::PetscSF, map::PetscLayout, pattern::PetscSFPattern ) + + @chk ccall( + (:PetscSFSetGraphWithPattern, $petsc_library), + PetscErrorCode, + (PetscSF, PetscLayout, PetscSFPattern), + sf, map, pattern, + ) + + + return nothing +end + +""" + isf::PetscSF = PetscSFCreateInverseSF(petsclib::PetscLibType,sf::PetscSF) +given a `PetscSF` in which all vertices have degree 1, creates the inverse map + +Collective + +Input Parameter: +- `sf` - star forest to invert + +Output Parameter: +- `isf` - inverse of `sf` + +Level: advanced + +-seealso: `PetscSF`, `PetscSFType`, `PetscSFSetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFCreateInverseSF")) +""" +function PetscSFCreateInverseSF(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFCreateInverseSF(petsclib::$UnionPetscLib, sf::PetscSF ) + isf_ = Ref{PetscSF}() + + @chk ccall( + (:PetscSFCreateInverseSF, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{PetscSF}), + sf, isf_, + ) + + isf = isf_[] + + return isf +end + +""" + newsf::PetscSF = PetscSFDuplicate(petsclib::PetscLibType,sf::PetscSF, opt::PetscSFDuplicateOption) +duplicate a `PetscSF`, optionally preserving rank connectivity and graph + +Collective + +Input Parameters: +- `sf` - communication object to duplicate +- `opt` - `PETSCSF_DUPLICATE_CONFONLY`, `PETSCSF_DUPLICATE_RANKS`, or `PETSCSF_DUPLICATE_GRAPH` (see `PetscSFDuplicateOption`) + +Output Parameter: +- `newsf` - new communication object + +Level: beginner + +-seealso: `PetscSF`, `PetscSFType`, `PetscSFCreate()`, `PetscSFSetType()`, `PetscSFSetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFDuplicate")) +""" +function PetscSFDuplicate(petsclib::PetscLibType, sf::PetscSF, opt::PetscSFDuplicateOption) end + +@for_petsc function PetscSFDuplicate(petsclib::$UnionPetscLib, sf::PetscSF, opt::PetscSFDuplicateOption ) + newsf_ = Ref{PetscSF}() + + @chk ccall( + (:PetscSFDuplicate, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSFDuplicateOption, Ptr{PetscSF}), + sf, opt, newsf_, + ) + + newsf = newsf_[] + + return newsf +end + +""" + nroots::PetscInt,nleaves::PetscInt,iloc::Vector{PetscInt} = PetscSFGetGraph(petsclib::PetscLibType,sf::PetscSF, iremote::Vector{PetscSFNode}) +Get the graph specifying a parallel star forest + +Not Collective + +Input Parameter: +- `sf` - star forest + +Output Parameters: +- `nroots` - number of root vertices on the current process (these are possible targets for other process to attach leaves) +- `nleaves` - number of leaf vertices on the current process, each of these references a root on any process +- `ilocal` - locations of leaves in leafdata buffers (if returned value is `NULL`, it means leaves are in contiguous storage) +- `iremote` - remote locations of root vertices for each leaf on the current process + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFType`, `PetscSFCreate()`, `PetscSFView()`, `PetscSFSetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFGetGraph")) +""" +function PetscSFGetGraph(petsclib::PetscLibType, sf::PetscSF, iremote::Vector{PetscSFNode}) end + +@for_petsc function PetscSFGetGraph(petsclib::$UnionPetscLib, sf::PetscSF, iremote::Vector{PetscSFNode} ) + nroots_ = Ref{$PetscInt}() + nleaves_ = Ref{$PetscInt}() + iloc_ = Ref{Ptr{$PetscInt}}() + iremote_ = Ref(pointer(iremote)) + + @chk ccall( + (:PetscSFGetGraph, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{PetscSFNode}}), + sf, nroots_, nleaves_, iloc_, iremote_, + ) + + nroots = nroots_[] + nleaves = nleaves_[] + iloc = unsafe_wrap(Array, iloc_[], VecGetLocalSize(petsclib, x); own = false) + + return nroots,nleaves,iloc +end + +""" + minleaf::PetscInt,maxleaf::PetscInt = PetscSFGetLeafRange(petsclib::PetscLibType,sf::PetscSF) +Get the active leaf ranges + +Not Collective + +Input Parameter: +- `sf` - star forest + +Output Parameters: +- `minleaf` - minimum active leaf on this process. Returns 0 if there are no leaves. +- `maxleaf` - maximum active leaf on this process. Returns -1 if there are no leaves. + +Level: developer + +-seealso: `PetscSF`, `PetscSFType`, `PetscSFCreate()`, `PetscSFView()`, `PetscSFSetGraph()`, `PetscSFGetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFGetLeafRange")) +""" +function PetscSFGetLeafRange(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFGetLeafRange(petsclib::$UnionPetscLib, sf::PetscSF ) + minleaf_ = Ref{$PetscInt}() + maxleaf_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSFGetLeafRange, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{$PetscInt}, Ptr{$PetscInt}), + sf, minleaf_, maxleaf_, + ) + + minleaf = minleaf_[] + maxleaf = maxleaf_[] + + return minleaf,maxleaf +end + +""" + PetscSFViewFromOptions(petsclib::PetscLibType,A::PetscSF, obj::PetscObject, name::String) +View a `PetscSF` based on arguments in the options database + +Collective + +Input Parameters: +- `A` - the star forest +- `obj` - Optional object that provides the prefix for the option names +- `name` - command line option + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFView`, `PetscObjectViewFromOptions()`, `PetscSFCreate()` + +# External Links +$(_doc_external("Vec/PetscSFViewFromOptions")) +""" +function PetscSFViewFromOptions(petsclib::PetscLibType, A::PetscSF, obj::PetscObject, name::String) end + +@for_petsc function PetscSFViewFromOptions(petsclib::$UnionPetscLib, A::PetscSF, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscSFViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscSF, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscSFView(petsclib::PetscLibType,sf::PetscSF, viewer::PetscViewer) +view a star forest + +Collective + +Input Parameters: +- `sf` - star forest +- `viewer` - viewer to display graph, for example `PETSC_VIEWER_STDOUT_WORLD` + +Level: beginner + +-seealso: `PetscSF`, `PetscViewer`, `PetscSFCreate()`, `PetscSFSetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFView")) +""" +function PetscSFView(petsclib::PetscLibType, sf::PetscSF, viewer::PetscViewer) end + +@for_petsc function PetscSFView(petsclib::$UnionPetscLib, sf::PetscSF, viewer::PetscViewer ) + + @chk ccall( + (:PetscSFView, $petsc_library), + PetscErrorCode, + (PetscSF, PetscViewer), + sf, viewer, + ) + + + return nothing +end + +""" + roffset::Vector{PetscInt},rmine::Vector{PetscInt},rremote::Vector{PetscInt} = PetscSFGetRootRanks(petsclib::PetscLibType,sf::PetscSF, nranks::PetscMPIInt, ranks::Vector{PetscMPIInt}) +Get root ranks and number of vertices referenced by leaves on this process + +Not Collective + +Input Parameter: +- `sf` - star forest + +Output Parameters: +- `nranks` - number of ranks referenced by local part +- `ranks` - [`nranks`] array of ranks +- `roffset` - [`nranks`+1] offset in `rmine`/`rremote` for each rank +- `rmine` - [`roffset`[`nranks`]] concatenated array holding local indices referencing each remote rank, or `NULL` +- `rremote` - [`roffset`[`nranks`]] concatenated array holding remote indices referenced for each remote rank, or `NULL` + +Level: developer + +-seealso: `PetscSF`, `PetscSFGetLeafRanks()` + +# External Links +$(_doc_external("Vec/PetscSFGetRootRanks")) +""" +function PetscSFGetRootRanks(petsclib::PetscLibType, sf::PetscSF, nranks::PetscMPIInt, ranks::Vector{PetscMPIInt}) end + +@for_petsc function PetscSFGetRootRanks(petsclib::$UnionPetscLib, sf::PetscSF, nranks::PetscMPIInt, ranks::Vector{PetscMPIInt} ) + ranks_ = Ref(pointer(ranks)) + roffset_ = Ref{Ptr{$PetscInt}}() + rmine_ = Ref{Ptr{$PetscInt}}() + rremote_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscSFGetRootRanks, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{PetscMPIInt}, Ptr{Ptr{PetscMPIInt}}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + sf, nranks, ranks_, roffset_, rmine_, rremote_, + ) + + roffset = unsafe_wrap(Array, roffset_[], VecGetLocalSize(petsclib, x); own = false) + rmine = unsafe_wrap(Array, rmine_[], VecGetLocalSize(petsclib, x); own = false) + rremote = unsafe_wrap(Array, rremote_[], VecGetLocalSize(petsclib, x); own = false) + + return roffset,rmine,rremote +end + +""" + ioffset::Vector{PetscInt},irootloc::Vector{PetscInt} = PetscSFGetLeafRanks(petsclib::PetscLibType,sf::PetscSF, niranks::PetscMPIInt, iranks::Vector{PetscMPIInt}) +Get leaf ranks referencing roots on this process + +Not Collective + +Input Parameter: +- `sf` - star forest + +Output Parameters: +- `niranks` - number of leaf ranks referencing roots on this process +- `iranks` - [`niranks`] array of ranks +- `ioffset` - [`niranks`+1] offset in `irootloc` for each rank +- `irootloc` - [`ioffset`[`niranks`]] concatenated array holding local indices of roots referenced by each leaf rank + +Level: developer + +-seealso: `PetscSF`, `PetscSFGetRootRanks()` + +# External Links +$(_doc_external("Vec/PetscSFGetLeafRanks")) +""" +function PetscSFGetLeafRanks(petsclib::PetscLibType, sf::PetscSF, niranks::PetscMPIInt, iranks::Vector{PetscMPIInt}) end + +@for_petsc function PetscSFGetLeafRanks(petsclib::$UnionPetscLib, sf::PetscSF, niranks::PetscMPIInt, iranks::Vector{PetscMPIInt} ) + iranks_ = Ref(pointer(iranks)) + ioffset_ = Ref{Ptr{$PetscInt}}() + irootloc_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscSFGetLeafRanks, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{PetscMPIInt}, Ptr{Ptr{PetscMPIInt}}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + sf, niranks, iranks_, ioffset_, irootloc_, + ) + + ioffset = unsafe_wrap(Array, ioffset_[], VecGetLocalSize(petsclib, x); own = false) + irootloc = unsafe_wrap(Array, irootloc_[], VecGetLocalSize(petsclib, x); own = false) + + return ioffset,irootloc +end + +""" + PetscSFSetUpRanks(petsclib::PetscLibType,sf::PetscSF, dgroup::MPI_Group) +Set up data structures associated with ranks; this is for internal use by `PetscSF` implementations. + +Collective + +Input Parameters: +- `sf` - `PetscSF` to set up; `PetscSFSetGraph()` must have been called +- `dgroup` - `MPI_Group` of ranks to be distinguished (e.g., for self or shared memory exchange) + +Level: developer + +-seealso: `PetscSF`, `PetscSFGetRootRanks()` + +# External Links +$(_doc_external("Vec/PetscSFSetUpRanks")) +""" +function PetscSFSetUpRanks(petsclib::PetscLibType, sf::PetscSF, dgroup::MPI_Group) end + +@for_petsc function PetscSFSetUpRanks(petsclib::$UnionPetscLib, sf::PetscSF, dgroup::MPI_Group ) + + @chk ccall( + (:PetscSFSetUpRanks, $petsc_library), + PetscErrorCode, + (PetscSF, MPI_Group), + sf, dgroup, + ) + + + return nothing +end + +""" + PetscSFGetGroups(petsclib::PetscLibType,sf::PetscSF, incoming::MPI_Group, outgoing::MPI_Group) +gets incoming and outgoing process groups + +Collective + +Input Parameter: +- `sf` - star forest + +Output Parameters: +- `incoming` - group of origin processes for incoming edges (leaves that reference my roots) +- `outgoing` - group of destination processes for outgoing edges (roots that I reference) + +Level: developer + +-seealso: `PetscSF`, `PetscSFGetWindow()`, `PetscSFRestoreWindow()` + +# External Links +$(_doc_external("Vec/PetscSFGetGroups")) +""" +function PetscSFGetGroups(petsclib::PetscLibType, sf::PetscSF, incoming::MPI_Group, outgoing::MPI_Group) end + +@for_petsc function PetscSFGetGroups(petsclib::$UnionPetscLib, sf::PetscSF, incoming::MPI_Group, outgoing::MPI_Group ) + + @chk ccall( + (:PetscSFGetGroups, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{MPI_Group}, Ptr{MPI_Group}), + sf, incoming, outgoing, + ) + + + return nothing +end + +""" + PetscSFGetRanksSF(petsclib::PetscLibType,sf::PetscSF, rsf::PetscSF) +gets the `PetscSF` to perform communications with root ranks + +Collective + +Input Parameter: +- `sf` - star forest + +Output Parameter: +- `rsf` - the star forest with a single root per process to perform communications + +Level: developer + +-seealso: `PetscSF`, `PetscSFSetGraph()`, `PetscSFGetRootRanks()` + +# External Links +$(_doc_external("Vec/PetscSFGetRanksSF")) +""" +function PetscSFGetRanksSF(petsclib::PetscLibType, sf::PetscSF, rsf::PetscSF) end + +@for_petsc function PetscSFGetRanksSF(petsclib::$UnionPetscLib, sf::PetscSF, rsf::PetscSF ) + + @chk ccall( + (:PetscSFGetRanksSF, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{PetscSF}), + sf, rsf, + ) + + + return nothing +end + +""" + PetscSFGetMultiSF(petsclib::PetscLibType,sf::PetscSF, multi::PetscSF) +gets the inner `PetscSF` implementing gathers and scatters + +Collective + +Input Parameter: +- `sf` - star forest that may contain roots with 0 or with more than 1 vertex + +Output Parameter: +- `multi` - star forest with split roots, such that each root has degree exactly 1 + +Level: developer + +-seealso: `PetscSF`, `PetscSFSetGraph()`, `PetscSFGatherBegin()`, `PetscSFScatterBegin()`, `PetscSFComputeMultiRootOriginalNumbering()` + +# External Links +$(_doc_external("Vec/PetscSFGetMultiSF")) +""" +function PetscSFGetMultiSF(petsclib::PetscLibType, sf::PetscSF, multi::PetscSF) end + +@for_petsc function PetscSFGetMultiSF(petsclib::$UnionPetscLib, sf::PetscSF, multi::PetscSF ) + + @chk ccall( + (:PetscSFGetMultiSF, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{PetscSF}), + sf, multi, + ) + + + return nothing +end + +""" + esf::PetscSF = PetscSFCreateEmbeddedRootSF(petsclib::PetscLibType,sf::PetscSF, nselected::PetscInt, selected::PetscInt) +removes edges from all but the selected roots of a `PetscSF`, does not remap indices + +Collective + +Input Parameters: +- `sf` - original star forest +- `nselected` - number of selected roots on this process +- `selected` - indices of the selected roots on this process + +Output Parameter: +- `esf` - new star forest + +Level: advanced + +-seealso: `PetscSF`, `PetscSFSetGraph()`, `PetscSFGetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFCreateEmbeddedRootSF")) +""" +function PetscSFCreateEmbeddedRootSF(petsclib::PetscLibType, sf::PetscSF, nselected::PetscInt, selected::PetscInt) end + +@for_petsc function PetscSFCreateEmbeddedRootSF(petsclib::$UnionPetscLib, sf::PetscSF, nselected::$PetscInt, selected::$PetscInt ) + esf_ = Ref{PetscSF}() + + @chk ccall( + (:PetscSFCreateEmbeddedRootSF, $petsc_library), + PetscErrorCode, + (PetscSF, $PetscInt, Ptr{$PetscInt}, Ptr{PetscSF}), + sf, nselected, selected, esf_, + ) + + esf = esf_[] + + return esf +end + +""" + newsf::PetscSF = PetscSFCreateEmbeddedLeafSF(petsclib::PetscLibType,sf::PetscSF, nselected::PetscInt, selected::PetscInt) +removes edges from all but the selected leaves of a `PetscSF`, does not remap indices + +Collective + +Input Parameters: +- `sf` - original star forest +- `nselected` - number of selected leaves on this process +- `selected` - indices of the selected leaves on this process + +Output Parameter: +- `newsf` - new star forest + +Level: advanced + +-seealso: `PetscSF`, `PetscSFCreateEmbeddedRootSF()`, `PetscSFSetGraph()`, `PetscSFGetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFCreateEmbeddedLeafSF")) +""" +function PetscSFCreateEmbeddedLeafSF(petsclib::PetscLibType, sf::PetscSF, nselected::PetscInt, selected::PetscInt) end + +@for_petsc function PetscSFCreateEmbeddedLeafSF(petsclib::$UnionPetscLib, sf::PetscSF, nselected::$PetscInt, selected::$PetscInt ) + newsf_ = Ref{PetscSF}() + + @chk ccall( + (:PetscSFCreateEmbeddedLeafSF, $petsc_library), + PetscErrorCode, + (PetscSF, $PetscInt, Ptr{$PetscInt}, Ptr{PetscSF}), + sf, nselected, selected, newsf_, + ) + + newsf = newsf_[] + + return newsf +end + +""" + degree::Vector{PetscInt} = PetscSFComputeDegreeBegin(petsclib::PetscLibType,sf::PetscSF) +begin computation of degree for each root vertex, to be completed with `PetscSFComputeDegreeEnd()` + +Collective + +Input Parameter: +- `sf` - star forest + +Output Parameter: +- `degree` - degree of each root vertex + +Level: advanced + +-seealso: `PetscSF`, `PetscSFGatherBegin()`, `PetscSFComputeDegreeEnd()` + +# External Links +$(_doc_external("Vec/PetscSFComputeDegreeBegin")) +""" +function PetscSFComputeDegreeBegin(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFComputeDegreeBegin(petsclib::$UnionPetscLib, sf::PetscSF ) + degree_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscSFComputeDegreeBegin, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{Ptr{$PetscInt}}), + sf, degree_, + ) + + degree = unsafe_wrap(Array, degree_[], VecGetLocalSize(petsclib, x); own = false) + + return degree +end + +""" + degree::Vector{PetscInt} = PetscSFComputeDegreeEnd(petsclib::PetscLibType,sf::PetscSF) +complete computation of degree for each root vertex, started with `PetscSFComputeDegreeBegin()` + +Collective + +Input Parameter: +- `sf` - star forest + +Output Parameter: +- `degree` - degree of each root vertex + +Level: developer + +-seealso: `PetscSF`, `PetscSFGatherBegin()`, `PetscSFComputeDegreeBegin()` + +# External Links +$(_doc_external("Vec/PetscSFComputeDegreeEnd")) +""" +function PetscSFComputeDegreeEnd(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFComputeDegreeEnd(petsclib::$UnionPetscLib, sf::PetscSF ) + degree_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscSFComputeDegreeEnd, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{Ptr{$PetscInt}}), + sf, degree_, + ) + + degree = unsafe_wrap(Array, degree_[], VecGetLocalSize(petsclib, x); own = false) + + return degree +end + +""" + nMultiRoots::PetscInt,multiRootsOrigNumbering::Vector{PetscInt} = PetscSFComputeMultiRootOriginalNumbering(petsclib::PetscLibType,sf::PetscSF, degree::Vector{PetscInt}) +Returns original numbering of multi +Each multi-root is assigned index of the corresponding original root. + +Collective + +Input Parameters: +- `sf` - star forest +- `degree` - degree of each root vertex, computed with `PetscSFComputeDegreeBegin()`/`PetscSFComputeDegreeEnd()` + +Output Parameters: +- `nMultiRoots` - (optional) number of multi-roots (roots of multi-`PetscSF`) +- `multiRootsOrigNumbering` - original indices of multi-roots; length of this array is `nMultiRoots` + +Level: developer + +-seealso: `PetscSF`, `PetscSFComputeDegreeBegin()`, `PetscSFComputeDegreeEnd()`, `PetscSFGetMultiSF()` + +# External Links +$(_doc_external("Vec/PetscSFComputeMultiRootOriginalNumbering")) +""" +function PetscSFComputeMultiRootOriginalNumbering(petsclib::PetscLibType, sf::PetscSF, degree::Vector{PetscInt}) end + +@for_petsc function PetscSFComputeMultiRootOriginalNumbering(petsclib::$UnionPetscLib, sf::PetscSF, degree::Vector{$PetscInt} ) + nMultiRoots_ = Ref{$PetscInt}() + multiRootsOrigNumbering_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscSFComputeMultiRootOriginalNumbering, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}), + sf, degree, nMultiRoots_, multiRootsOrigNumbering_, + ) + + nMultiRoots = nMultiRoots_[] + multiRootsOrigNumbering = unsafe_wrap(Array, multiRootsOrigNumbering_[], VecGetLocalSize(petsclib, x); own = false) + + return nMultiRoots,multiRootsOrigNumbering +end + +""" + PetscSFCompose(petsclib::PetscLibType,sfA::PetscSF, sfB::PetscSF, sfBA::PetscSF) +Compose a new `PetscSF` by putting the second `PetscSF` under the first one in a top (roots) down (leaves) view + +Input Parameters: +- `sfA` - The first `PetscSF` +- `sfB` - The second `PetscSF` + +Output Parameter: +- `sfBA` - The composite `PetscSF` + +Level: developer + +-seealso: `PetscSF`, `PetscSFComposeInverse()`, `PetscSFGetGraph()`, `PetscSFSetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFCompose")) +""" +function PetscSFCompose(petsclib::PetscLibType, sfA::PetscSF, sfB::PetscSF, sfBA::PetscSF) end + +@for_petsc function PetscSFCompose(petsclib::$UnionPetscLib, sfA::PetscSF, sfB::PetscSF, sfBA::PetscSF ) + + @chk ccall( + (:PetscSFCompose, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSF, Ptr{PetscSF}), + sfA, sfB, sfBA, + ) + + + return nothing +end + +""" + PetscSFComposeInverse(petsclib::PetscLibType,sfA::PetscSF, sfB::PetscSF, sfBA::PetscSF) +Compose a new `PetscSF` by putting the inverse of the second `PetscSF` under the first one + +Input Parameters: +- `sfA` - The first `PetscSF` +- `sfB` - The second `PetscSF` + +Output Parameter: +- `sfBA` - The composite `PetscSF`. + +Level: developer + +-seealso: `PetscSF`, `PetscSFCompose()`, `PetscSFGetGraph()`, `PetscSFSetGraph()`, `PetscSFCreateInverseSF()` + +# External Links +$(_doc_external("Vec/PetscSFComposeInverse")) +""" +function PetscSFComposeInverse(petsclib::PetscLibType, sfA::PetscSF, sfB::PetscSF, sfBA::PetscSF) end + +@for_petsc function PetscSFComposeInverse(petsclib::$UnionPetscLib, sfA::PetscSF, sfB::PetscSF, sfBA::PetscSF ) + + @chk ccall( + (:PetscSFComposeInverse, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSF, Ptr{PetscSF}), + sfA, sfB, sfBA, + ) + + + return nothing +end + +""" + PetscSFConcatenate(petsclib::PetscLibType,comm::MPI_Comm, nsfs::PetscInt, sfs::Vector{PetscSF}, rootMode::PetscSFConcatenateRootMode, leafOffsets::Vector{PetscInt}, newsf::PetscSF) +concatenate multiple `PetscSF` into one + +Input Parameters: +- `comm` - the communicator +- `nsfs` - the number of input `PetscSF` +- `sfs` - the array of input `PetscSF` +- `rootMode` - the root mode specifying how roots are handled +- `leafOffsets` - the array of local leaf offsets, one for each input `PetscSF`, or `NULL` for contiguous storage + +Output Parameter: +- `newsf` - The resulting `PetscSF` + +Level: advanced + +-seealso: `PetscSF`, `PetscSFCompose()`, `PetscSFGetGraph()`, `PetscSFSetGraph()`, `PetscSFConcatenateRootMode` + +# External Links +$(_doc_external("Vec/PetscSFConcatenate")) +""" +function PetscSFConcatenate(petsclib::PetscLibType, comm::MPI_Comm, nsfs::PetscInt, sfs::Vector{PetscSF}, rootMode::PetscSFConcatenateRootMode, leafOffsets::Vector{PetscInt}, newsf::PetscSF) end + +@for_petsc function PetscSFConcatenate(petsclib::$UnionPetscLib, comm::MPI_Comm, nsfs::$PetscInt, sfs::Vector{PetscSF}, rootMode::PetscSFConcatenateRootMode, leafOffsets::Vector{$PetscInt}, newsf::PetscSF ) + + @chk ccall( + (:PetscSFConcatenate, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{PetscSF}, PetscSFConcatenateRootMode, Ptr{$PetscInt}, Ptr{PetscSF}), + comm, nsfs, sfs, rootMode, leafOffsets, newsf, + ) + + + return nothing +end + +""" + PetscSFRegister(petsclib::PetscLibType,name::String, create::external) +Adds an implementation of the `PetscSF` communication protocol. + +Not Collective, No Fortran Support + +Input Parameters: +- `name` - name of a new user-defined implementation +- `create` - routine to create method context + +-seealso: `PetscSF`, `PetscSFType`, `PetscSFRegisterAll()`, `PetscSFInitializePackage()` + +# External Links +$(_doc_external("Vec/PetscSFRegister")) +""" +function PetscSFRegister(petsclib::PetscLibType, name::String, create::external) end + +@for_petsc function PetscSFRegister(petsclib::$UnionPetscLib, name::String, create::external ) + + @chk ccall( + (:PetscSFRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + name, create, + ) + + + return nothing +end + +""" + PetscSFInitializePackage(petsclib::PetscLibType) +Initialize `PetscSF` package + +Logically Collective + +Level: developer + +-seealso: `PetscSF`, `PetscSFFinalizePackage()` + +# External Links +$(_doc_external("Vec/PetscSFInitializePackage")) +""" +function PetscSFInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscSFInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscSFInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscSFFinalizePackage(petsclib::PetscLibType) +Finalize `PetscSF` package, it is called from `PetscFinalize()` + +Logically Collective + +Level: developer + +-seealso: `PetscSF`, `PetscSFInitializePackage()` + +# External Links +$(_doc_external("Vec/PetscSFFinalizePackage")) +""" +function PetscSFFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscSFFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscSFFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscSFWindowSetFlavorType(petsclib::PetscLibType,sf::PetscSF, flavor::PetscSFWindowFlavorType) +Set flavor type for `MPI_Win` creation + +Logically Collective + +Input Parameters: +- `sf` - star forest for communication of type `PETSCSFWINDOW` +- `flavor` - flavor type + +Options Database Key: +- `-sf_window_flavor ` - sets the flavor type CREATE, DYNAMIC, ALLOCATE or SHARED (see `PetscSFWindowFlavorType`) + +Level: advanced + +-seealso: `PetscSF`, `PETSCSFWINDOW`, `PetscSFSetFromOptions()`, `PetscSFWindowGetFlavorType()` + +# External Links +$(_doc_external("Vec/PetscSFWindowSetFlavorType")) +""" +function PetscSFWindowSetFlavorType(petsclib::PetscLibType, sf::PetscSF, flavor::PetscSFWindowFlavorType) end + +@for_petsc function PetscSFWindowSetFlavorType(petsclib::$UnionPetscLib, sf::PetscSF, flavor::PetscSFWindowFlavorType ) + + @chk ccall( + (:PetscSFWindowSetFlavorType, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSFWindowFlavorType), + sf, flavor, + ) + + + return nothing +end + +""" + flavor::PetscSFWindowFlavorType = PetscSFWindowGetFlavorType(petsclib::PetscLibType,sf::PetscSF) +Get `PETSCSFWINDOW` flavor type for `PetscSF` communication + +Logically Collective + +Input Parameter: +- `sf` - star forest for communication of type `PETSCSFWINDOW` + +Output Parameter: +- `flavor` - flavor type + +Level: advanced + +-seealso: `PetscSF`, `PETSCSFWINDOW`, `PetscSFSetFromOptions()`, `PetscSFWindowSetFlavorType()` + +# External Links +$(_doc_external("Vec/PetscSFWindowGetFlavorType")) +""" +function PetscSFWindowGetFlavorType(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFWindowGetFlavorType(petsclib::$UnionPetscLib, sf::PetscSF ) + flavor_ = Ref{PetscSFWindowFlavorType}() + + @chk ccall( + (:PetscSFWindowGetFlavorType, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{PetscSFWindowFlavorType}), + sf, flavor_, + ) + + flavor = unsafe_string(flavor_[]) + + return flavor +end + +""" + PetscSFWindowSetSyncType(petsclib::PetscLibType,sf::PetscSF, sync::PetscSFWindowSyncType) +Set synchronization type for `PetscSF` communication of type `PETSCSFWINDOW` + +Logically Collective + +Input Parameters: +- `sf` - star forest for communication +- `sync` - synchronization type + +Options Database Key: +- `-sf_window_sync ` - sets the synchronization type FENCE, LOCK, or ACTIVE (see `PetscSFWindowSyncType`) + +Level: advanced + +-seealso: `PetscSF`, `PETSCSFWINDOW`, `PetscSFSetFromOptions()`, `PetscSFWindowGetSyncType()`, `PetscSFWindowSyncType` + +# External Links +$(_doc_external("Vec/PetscSFWindowSetSyncType")) +""" +function PetscSFWindowSetSyncType(petsclib::PetscLibType, sf::PetscSF, sync::PetscSFWindowSyncType) end + +@for_petsc function PetscSFWindowSetSyncType(petsclib::$UnionPetscLib, sf::PetscSF, sync::PetscSFWindowSyncType ) + + @chk ccall( + (:PetscSFWindowSetSyncType, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSFWindowSyncType), + sf, sync, + ) + + + return nothing +end + +""" + sync::PetscSFWindowSyncType = PetscSFWindowGetSyncType(petsclib::PetscLibType,sf::PetscSF) +Get synchronization type for `PetscSF` communication of type `PETSCSFWINDOW` + +Logically Collective + +Input Parameter: +- `sf` - star forest for communication + +Output Parameter: +- `sync` - synchronization type + +Level: advanced + +-seealso: `PetscSF`, `PETSCSFWINDOW`, `PetscSFSetFromOptions()`, `PetscSFWindowSetSyncType()`, `PetscSFWindowSyncType` + +# External Links +$(_doc_external("Vec/PetscSFWindowGetSyncType")) +""" +function PetscSFWindowGetSyncType(petsclib::PetscLibType, sf::PetscSF) end + +@for_petsc function PetscSFWindowGetSyncType(petsclib::$UnionPetscLib, sf::PetscSF ) + sync_ = Ref{PetscSFWindowSyncType}() + + @chk ccall( + (:PetscSFWindowGetSyncType, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{PetscSFWindowSyncType}), + sf, sync_, + ) + + sync = unsafe_string(sync_[]) + + return sync +end + +""" + PetscSFWindowSetInfo(petsclib::PetscLibType,sf::PetscSF, info::MPI_Info) +Set the `MPI_Info` handle that will be used for subsequent windows allocation + +Logically Collective + +Input Parameters: +- `sf` - star forest for communication +- `info` - `MPI_Info` handle + +Level: advanced + +-seealso: `PetscSF`, `PETSCSFWINDOW`, `PetscSFSetFromOptions()`, `PetscSFWindowGetInfo()` + +# External Links +$(_doc_external("Vec/PetscSFWindowSetInfo")) +""" +function PetscSFWindowSetInfo(petsclib::PetscLibType, sf::PetscSF, info::MPI_Info) end + +@for_petsc function PetscSFWindowSetInfo(petsclib::$UnionPetscLib, sf::PetscSF, info::MPI_Info ) + + @chk ccall( + (:PetscSFWindowSetInfo, $petsc_library), + PetscErrorCode, + (PetscSF, MPI_Info), + sf, info, + ) + + + return nothing +end + +""" + PetscSFWindowGetInfo(petsclib::PetscLibType,sf::PetscSF, info::MPI_Info) +Get the `MPI_Info` handle used for windows allocation + +Logically Collective + +Input Parameter: +- `sf` - star forest for communication + +Output Parameter: +- `info` - `MPI_Info` handle + +Level: advanced + +-seealso: `PetscSF`, `PETSCSFWINDOW`, `PetscSFSetFromOptions()`, `PetscSFWindowSetInfo()` + +# External Links +$(_doc_external("Vec/PetscSFWindowGetInfo")) +""" +function PetscSFWindowGetInfo(petsclib::PetscLibType, sf::PetscSF, info::MPI_Info) end + +@for_petsc function PetscSFWindowGetInfo(petsclib::$UnionPetscLib, sf::PetscSF, info::MPI_Info ) + + @chk ccall( + (:PetscSFWindowGetInfo, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{MPI_Info}), + sf, info, + ) + + + return nothing +end + +""" + PetscSFSetGraphFromCoordinates(petsclib::PetscLibType,sf::PetscSF, nroots::PetscInt, nleaves::PetscInt, dim::PetscInt, tol::PetscReal, rootcoords::PetscReal, leafcoords::PetscReal) +Create SF by fuzzy matching leaf coordinates to root coordinates + +Collective + +Input Parameters: +- `sf` - PetscSF to set graph on +- `nroots` - number of root coordinates +- `nleaves` - number of leaf coordinates +- `dim` - spatial dimension of coordinates +- `tol` - positive tolerance for matching +- `rootcoords` - array of root coordinates in which root i component d is [i*dim+d] +- `leafcoords` - array of root coordinates in which leaf i component d is [i*dim+d] + +-seealso: `PetscSFCreate()`, `PetscSFSetGraph()`, `PetscSFCreateByMatchingIndices()` + +# External Links +$(_doc_external("Vec/PetscSFSetGraphFromCoordinates")) +""" +function PetscSFSetGraphFromCoordinates(petsclib::PetscLibType, sf::PetscSF, nroots::PetscInt, nleaves::PetscInt, dim::PetscInt, tol::PetscReal, rootcoords::PetscReal, leafcoords::PetscReal) end + +@for_petsc function PetscSFSetGraphFromCoordinates(petsclib::$UnionPetscLib, sf::PetscSF, nroots::$PetscInt, nleaves::$PetscInt, dim::$PetscInt, tol::$PetscReal, rootcoords::$PetscReal, leafcoords::$PetscReal ) + + @chk ccall( + (:PetscSFSetGraphFromCoordinates, $petsc_library), + PetscErrorCode, + (PetscSF, $PetscInt, $PetscInt, $PetscInt, $PetscReal, Ptr{$PetscReal}, Ptr{$PetscReal}), + sf, nroots, nleaves, dim, tol, rootcoords, leafcoords, + ) + + + return nothing +end + +""" + iloc::PetscInt = PetscSFSetGraphLayout(petsclib::PetscLibType,sf::PetscSF, layout::PetscLayout, nleaves::PetscInt, locmode::PetscCopyMode, gremote::PetscInt) +Set a parallel star forest via global indices and a `PetscLayout` + +Collective + +Input Parameters: +- `sf` - star forest +- `layout` - `PetscLayout` defining the global space for roots +- `nleaves` - number of leaf vertices on the current process, each of these references a root on any process +- `ilocal` - locations of leaves in leafdata buffers, pass NULL for contiguous storage +- `localmode` - copy mode for ilocal +- `gremote` - root vertices in global numbering corresponding to leaves in ilocal + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFGetGraphLayout()`, `PetscSFCreate()`, `PetscSFView()`, `PetscSFSetGraph()`, `PetscSFGetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFSetGraphLayout")) +""" +function PetscSFSetGraphLayout(petsclib::PetscLibType, sf::PetscSF, layout::PetscLayout, nleaves::PetscInt, locmode::PetscCopyMode, gremote::PetscInt) end + +@for_petsc function PetscSFSetGraphLayout(petsclib::$UnionPetscLib, sf::PetscSF, layout::PetscLayout, nleaves::$PetscInt, locmode::PetscCopyMode, gremote::$PetscInt ) + iloc_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSFSetGraphLayout, $petsc_library), + PetscErrorCode, + (PetscSF, PetscLayout, $PetscInt, Ptr{$PetscInt}, PetscCopyMode, Ptr{$PetscInt}), + sf, layout, nleaves, iloc_, locmode, gremote, + ) + + iloc = iloc_[] + + return iloc +end + +""" + nleaves::PetscInt,iloc::Vector{PetscInt},gremote::Vector{PetscInt} = PetscSFGetGraphLayout(petsclib::PetscLibType,sf::PetscSF, layout::PetscLayout) +Get the global indices and `PetscLayout` that describe this star forest + +Collective + +Input Parameter: +- `sf` - star forest + +Output Parameters: +- `layout` - `PetscLayout` defining the global space for roots +- `nleaves` - number of leaf vertices on the current process, each of these references a root on any process +- `ilocal` - locations of leaves in leafdata buffers, or `NULL` for contiguous storage +- `gremote` - root vertices in global numbering corresponding to leaves in ilocal + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFSetGraphLayout()`, `PetscSFCreate()`, `PetscSFView()`, `PetscSFSetGraph()`, `PetscSFGetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFGetGraphLayout")) +""" +function PetscSFGetGraphLayout(petsclib::PetscLibType, sf::PetscSF, layout::PetscLayout) end + +@for_petsc function PetscSFGetGraphLayout(petsclib::$UnionPetscLib, sf::PetscSF, layout::PetscLayout ) + nleaves_ = Ref{$PetscInt}() + iloc_ = Ref{Ptr{$PetscInt}}() + gremote_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscSFGetGraphLayout, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{PetscLayout}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + sf, layout, nleaves_, iloc_, gremote_, + ) + + nleaves = nleaves_[] + iloc = unsafe_wrap(Array, iloc_[], VecGetLocalSize(petsclib, x); own = false) + gremote = unsafe_wrap(Array, gremote_[], VecGetLocalSize(petsclib, x); own = false) + + return nleaves,iloc,gremote +end + +""" + PetscSFSetGraphSection(petsclib::PetscLibType,sf::PetscSF, locSection::PetscSection, globSection::PetscSection) +Sets the `PetscSF` graph encoding the parallel dof overlap based upon the `PetscSection` describing the data layout. + +Input Parameters: +- `sf` - The `PetscSF` +- `localSection` - `PetscSection` describing the local data layout +- `globalSection` - `PetscSection` describing the global data layout + +Level: developer + +-seealso: `PetscSF`, `PetscSFSetGraph()`, `PetscSFSetGraphLayout()` + +# External Links +$(_doc_external("Vec/PetscSFSetGraphSection")) +""" +function PetscSFSetGraphSection(petsclib::PetscLibType, sf::PetscSF, locSection::PetscSection, globSection::PetscSection) end + +@for_petsc function PetscSFSetGraphSection(petsclib::$UnionPetscLib, sf::PetscSF, locSection::PetscSection, globSection::PetscSection ) + + @chk ccall( + (:PetscSFSetGraphSection, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSection, PetscSection), + sf, locSection, globSection, + ) + + + return nothing +end + +""" + remoteOffsets::Vector{PetscInt} = PetscSFDistributeSection(petsclib::PetscLibType,sf::PetscSF, rootSection::PetscSection, leafSection::PetscSection) +Create a new `PetscSection` reorganized, moving from the root to the leaves of the `PetscSF` + +Collective + +Input Parameters: +- `sf` - The `PetscSF` +- `rootSection` - Section defined on root space + +Output Parameters: +- `remoteOffsets` - root offsets in leaf storage, or `NULL`, its length will be the size of the chart of `leafSection` +- `leafSection` - Section defined on the leaf space + +Level: advanced + +-seealso: `PetscSF`, `PetscSFCreate()` + +# External Links +$(_doc_external("Vec/PetscSFDistributeSection")) +""" +function PetscSFDistributeSection(petsclib::PetscLibType, sf::PetscSF, rootSection::PetscSection, leafSection::PetscSection) end + +@for_petsc function PetscSFDistributeSection(petsclib::$UnionPetscLib, sf::PetscSF, rootSection::PetscSection, leafSection::PetscSection ) + remoteOffsets_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscSFDistributeSection, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSection, Ptr{Ptr{$PetscInt}}, PetscSection), + sf, rootSection, remoteOffsets_, leafSection, + ) + + remoteOffsets = unsafe_wrap(Array, remoteOffsets_[], VecGetLocalSize(petsclib, x); own = false) + + return remoteOffsets +end + +""" + remoteOffsets::Vector{PetscInt} = PetscSFCreateRemoteOffsets(petsclib::PetscLibType,sf::PetscSF, rootSection::PetscSection, leafSection::PetscSection) +Create offsets for point data on remote processes + +Collective + +Input Parameters: +- `sf` - The `PetscSF` +- `rootSection` - Data layout of remote points for outgoing data (this is layout for roots) +- `leafSection` - Data layout of local points for incoming data (this is layout for leaves) + +Output Parameter: +- `remoteOffsets` - Offsets for point data on remote processes (these are offsets from the root section), or `NULL` + +Level: developer + +-seealso: `PetscSF`, `PetscSFCreate()` + +# External Links +$(_doc_external("Vec/PetscSFCreateRemoteOffsets")) +""" +function PetscSFCreateRemoteOffsets(petsclib::PetscLibType, sf::PetscSF, rootSection::PetscSection, leafSection::PetscSection) end + +@for_petsc function PetscSFCreateRemoteOffsets(petsclib::$UnionPetscLib, sf::PetscSF, rootSection::PetscSection, leafSection::PetscSection ) + remoteOffsets_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscSFCreateRemoteOffsets, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSection, PetscSection, Ptr{Ptr{$PetscInt}}), + sf, rootSection, leafSection, remoteOffsets_, + ) + + remoteOffsets = unsafe_wrap(Array, remoteOffsets_[], VecGetLocalSize(petsclib, x); own = false) + + return remoteOffsets +end + +""" + sectionSF::PetscSF = PetscSFCreateSectionSF(petsclib::PetscLibType,sf::PetscSF, rootSection::PetscSection, remoteOffsets::Vector{PetscInt}, leafSection::PetscSection) +Create an expanded `PetscSF` of dofs, assuming the input `PetscSF` relates points + +Collective + +Input Parameters: +- `sf` - The `PetscSF` +- `rootSection` - Data layout of remote points for outgoing data (this is usually the serial section) +- `remoteOffsets` - Offsets for point data on remote processes (these are offsets from the root section), or NULL +- `leafSection` - Data layout of local points for incoming data (this is the distributed section) + +Output Parameter: +- `sectionSF` - The new `PetscSF` + +Level: advanced + +-seealso: `PetscSF`, `PetscSFCreate()` + +# External Links +$(_doc_external("Vec/PetscSFCreateSectionSF")) +""" +function PetscSFCreateSectionSF(petsclib::PetscLibType, sf::PetscSF, rootSection::PetscSection, remoteOffsets::Vector{PetscInt}, leafSection::PetscSection) end + +@for_petsc function PetscSFCreateSectionSF(petsclib::$UnionPetscLib, sf::PetscSF, rootSection::PetscSection, remoteOffsets::Vector{$PetscInt}, leafSection::PetscSection ) + sectionSF_ = Ref{PetscSF}() + + @chk ccall( + (:PetscSFCreateSectionSF, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSection, Ptr{$PetscInt}, PetscSection, Ptr{PetscSF}), + sf, rootSection, remoteOffsets, leafSection, sectionSF_, + ) + + sectionSF = sectionSF_[] + + return sectionSF +end + +""" + sf::PetscSF = PetscSFCreateFromLayouts(petsclib::PetscLibType,rmap::PetscLayout, lmap::PetscLayout) +Creates a parallel star forest mapping two `PetscLayout` objects + +Collective + +Input Parameters: +- `rmap` - `PetscLayout` defining the global root space +- `lmap` - `PetscLayout` defining the global leaf space + +Output Parameter: +- `sf` - The parallel star forest + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFCreate()`, `PetscLayoutCreate()`, `PetscSFSetGraphLayout()` + +# External Links +$(_doc_external("Vec/PetscSFCreateFromLayouts")) +""" +function PetscSFCreateFromLayouts(petsclib::PetscLibType, rmap::PetscLayout, lmap::PetscLayout) end + +@for_petsc function PetscSFCreateFromLayouts(petsclib::$UnionPetscLib, rmap::PetscLayout, lmap::PetscLayout ) + sf_ = Ref{PetscSF}() + + @chk ccall( + (:PetscSFCreateFromLayouts, $petsc_library), + PetscErrorCode, + (PetscLayout, PetscLayout, Ptr{PetscSF}), + rmap, lmap, sf_, + ) + + sf = sf_[] + + return sf +end + +""" + sfA::PetscSF,sf::PetscSF = PetscSFCreateByMatchingIndices(petsclib::PetscLibType,layout::PetscLayout, numRootIndices::PetscInt, rootIndices::PetscInt, rootLocalIndices::PetscInt, rootLocalOffset::PetscInt, numLeafIndices::PetscInt, leafIndices::PetscInt, leafLocalIndices::PetscInt, leafLocalOffset::PetscInt) +Create `PetscSF` by matching root and leaf indices + +Collective + +Input Parameters: +- `layout` - `PetscLayout` defining the global index space and the rank that brokers each index +- `numRootIndices` - size of rootIndices +- `rootIndices` - `PetscInt` array of global indices of which this process requests ownership +- `rootLocalIndices` - root local index permutation (NULL if no permutation) +- `rootLocalOffset` - offset to be added to root local indices +- `numLeafIndices` - size of leafIndices +- `leafIndices` - `PetscInt` array of global indices with which this process requires data associated +- `leafLocalIndices` - leaf local index permutation (NULL if no permutation) +- `leafLocalOffset` - offset to be added to leaf local indices + +Output Parameters: +- `sfA` - star forest representing the communication pattern from the layout space to the leaf space (NULL if not needed) +- `sf` - star forest representing the communication pattern from the root space to the leaf space + +Level: advanced + +Example 1: +-seealso: `PetscSF`, `PetscSFCreate()` + +# External Links +$(_doc_external("Vec/PetscSFCreateByMatchingIndices")) +""" +function PetscSFCreateByMatchingIndices(petsclib::PetscLibType, layout::PetscLayout, numRootIndices::PetscInt, rootIndices::PetscInt, rootLocalIndices::PetscInt, rootLocalOffset::PetscInt, numLeafIndices::PetscInt, leafIndices::PetscInt, leafLocalIndices::PetscInt, leafLocalOffset::PetscInt) end + +@for_petsc function PetscSFCreateByMatchingIndices(petsclib::$UnionPetscLib, layout::PetscLayout, numRootIndices::$PetscInt, rootIndices::$PetscInt, rootLocalIndices::$PetscInt, rootLocalOffset::$PetscInt, numLeafIndices::$PetscInt, leafIndices::$PetscInt, leafLocalIndices::$PetscInt, leafLocalOffset::$PetscInt ) + sfA_ = Ref{PetscSF}() + sf_ = Ref{PetscSF}() + + @chk ccall( + (:PetscSFCreateByMatchingIndices, $petsc_library), + PetscErrorCode, + (PetscLayout, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt, Ptr{PetscSF}, Ptr{PetscSF}), + layout, numRootIndices, rootIndices, rootLocalIndices, rootLocalOffset, numLeafIndices, leafIndices, leafLocalIndices, leafLocalOffset, sfA_, sf_, + ) + + sfA = sfA_[] + sf = sf_[] + + return sfA,sf +end + +""" + PetscSFMerge(petsclib::PetscLibType,sfa::PetscSF, sfb::PetscSF, merged::PetscSF) +append/merge indices of `sfb` into `sfa`, with preference for `sfb` + +Collective + +Input Parameters: +- `sfa` - default `PetscSF` +- `sfb` - additional edges to add/replace edges in sfa + +Output Parameter: +- `merged` - new `PetscSF` with combined edges + +Level: intermediate + +-seealso: `PetscSFCompose()` + +# External Links +$(_doc_external("Vec/PetscSFMerge")) +""" +function PetscSFMerge(petsclib::PetscLibType, sfa::PetscSF, sfb::PetscSF, merged::PetscSF) end + +@for_petsc function PetscSFMerge(petsclib::$UnionPetscLib, sfa::PetscSF, sfb::PetscSF, merged::PetscSF ) + + @chk ccall( + (:PetscSFMerge, $petsc_library), + PetscErrorCode, + (PetscSF, PetscSF, Ptr{PetscSF}), + sfa, sfb, merged, + ) + + + return nothing +end + +""" + vsf::PetscSF = PetscSFCreateStridedSF(petsclib::PetscLibType,sf::PetscSF, bs::PetscInt, ldr::PetscInt, ldl::PetscInt) +Create an `PetscSF` to communicate interleaved blocks of data + +Collective + +Input Parameters: +- `sf` - star forest +- `bs` - stride +- `ldr` - leading dimension of root space +- `ldl` - leading dimension of leaf space + +Output Parameter: +- `vsf` - the new `PetscSF` + +Level: intermediate + +-seealso: `PetscSF`, `PetscSFCreate()`, `PetscSFSetGraph()` + +# External Links +$(_doc_external("Vec/PetscSFCreateStridedSF")) +""" +function PetscSFCreateStridedSF(petsclib::PetscLibType, sf::PetscSF, bs::PetscInt, ldr::PetscInt, ldl::PetscInt) end + +@for_petsc function PetscSFCreateStridedSF(petsclib::$UnionPetscLib, sf::PetscSF, bs::$PetscInt, ldr::$PetscInt, ldl::$PetscInt ) + vsf_ = Ref{PetscSF}() + + @chk ccall( + (:PetscSFCreateStridedSF, $petsc_library), + PetscErrorCode, + (PetscSF, $PetscInt, $PetscInt, $PetscInt, Ptr{PetscSF}), + sf, bs, ldr, ldl, vsf_, + ) + + vsf = vsf_[] + + return vsf +end + +""" + PetscSFGetSubSF(petsclib::PetscLibType,mainsf::PetscSF, map::ISLocalToGlobalMapping, subSF::PetscSF) +Returns an `PetscSF` for a specific subset of points. Leaves are re + +Collective + +Input Parameters: +- `mainsf` - `PetscSF` structure +- `map` - a `ISLocalToGlobalMapping` that contains the subset of points + +Output Parameter: +- `subSF` - a subset of the `mainSF` for the desired subset. + +Level: intermediate + +-seealso: `PetscSF` + +# External Links +$(_doc_external("DM/PetscSFGetSubSF")) +""" +function PetscSFGetSubSF(petsclib::PetscLibType, mainsf::PetscSF, map::ISLocalToGlobalMapping, subSF::PetscSF) end + +@for_petsc function PetscSFGetSubSF(petsclib::$UnionPetscLib, mainsf::PetscSF, map::ISLocalToGlobalMapping, subSF::PetscSF ) + + @chk ccall( + (:PetscSFGetSubSF, $petsc_library), + PetscErrorCode, + (PetscSF, ISLocalToGlobalMapping, Ptr{PetscSF}), + mainsf, map, subSF, + ) + + + return nothing +end + +""" + PetscSFGetRanks(petsclib::PetscLibType,sf::PetscSF, nranks::PetscMPIInt, ranks::PetscMPIInt, roffset::PetscInt, rmine::PetscInt, rremote::PetscInt) + +# External Links +$(_doc_external("Vec/PetscSFGetRanks")) +""" +function PetscSFGetRanks(petsclib::PetscLibType, sf::PetscSF, nranks::PetscMPIInt, ranks::PetscMPIInt, roffset::PetscInt, rmine::PetscInt, rremote::PetscInt) end + +@for_petsc function PetscSFGetRanks(petsclib::$UnionPetscLib, sf::PetscSF, nranks::PetscMPIInt, ranks::PetscMPIInt, roffset::$PetscInt, rmine::$PetscInt, rremote::$PetscInt ) + + @chk ccall( + (:PetscSFGetRanks, $petsc_library), + PetscErrorCode, + (PetscSF, Ptr{PetscMPIInt}, PetscMPIInt, $PetscInt, $PetscInt, $PetscInt), + sf, nranks, ranks, roffset, rmine, rremote, + ) + + + return nothing +end + +""" + selected::PetscInt,esf::PetscSF = PetscSFCreateEmbeddedSF(petsclib::PetscLibType,sf::PetscSF, nselected::PetscInt) + +# External Links +$(_doc_external("Vec/PetscSFCreateEmbeddedSF")) +""" +function PetscSFCreateEmbeddedSF(petsclib::PetscLibType, sf::PetscSF, nselected::PetscInt) end + +@for_petsc function PetscSFCreateEmbeddedSF(petsclib::$UnionPetscLib, sf::PetscSF, nselected::$PetscInt ) + selected_ = Ref{$PetscInt}() + esf_ = Ref{PetscSF}() + + @chk ccall( + (:PetscSFCreateEmbeddedSF, $petsc_library), + PetscErrorCode, + (PetscSF, $PetscInt, Ptr{$PetscInt}, Ptr{PetscSF}), + sf, nselected, selected_, esf_, + ) + + selected = selected_[] + esf = esf_[] + + return selected,esf +end + diff --git a/src/autowrapped/PetscSection_wrappers.jl b/src/autowrapped/PetscSection_wrappers.jl new file mode 100644 index 00000000..254393a9 --- /dev/null +++ b/src/autowrapped/PetscSection_wrappers.jl @@ -0,0 +1,3520 @@ +mutable struct _p_PetscSectionSym end +const PetscSectionSym = Ptr{_p_PetscSectionSym} + + +""" + PetscSectionCreate(petsclib::PetscLibType,comm::MPI_Comm, s::PetscSection) +Allocates a `PetscSection` and sets the map contents to the default. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `s` - pointer to the section + +Level: beginner + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetChart()`, `PetscSectionDestroy()`, `PetscSectionCreateGlobalSection()` + +# External Links +$(_doc_external("Vec/PetscSectionCreate")) +""" +function PetscSectionCreate(petsclib::PetscLibType, comm::MPI_Comm, s::PetscSection) end + +# Convenience method: accept a Ref so callers can pass `Ref{PetscSection}()` directly +@for_petsc function PetscSectionCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, s::Ref{PetscSection} ) + + @chk ccall( + (:PetscSectionCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscSection}), + comm, s, + ) + + + return nothing +end + +@for_petsc function PetscSectionCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, s::PetscSection ) + + @chk ccall( + (:PetscSectionCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscSection}), + comm, s, + ) + + + return nothing +end + +""" + PetscSectionCopy(petsclib::PetscLibType,section::PetscSection, newSection::PetscSection) +Creates a shallow (if possible) copy of the `PetscSection` + +Collective + +Input Parameter: +- `section` - the `PetscSection` + +Output Parameter: +- `newSection` - the copy + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()`, `PetscSectionDestroy()` + +# External Links +$(_doc_external("Vec/PetscSectionCopy")) +""" +function PetscSectionCopy(petsclib::PetscLibType, section::PetscSection, newSection::PetscSection) end + +@for_petsc function PetscSectionCopy(petsclib::$UnionPetscLib, section::PetscSection, newSection::PetscSection ) + + @chk ccall( + (:PetscSectionCopy, $petsc_library), + PetscErrorCode, + (PetscSection, PetscSection), + section, newSection, + ) + + + return nothing +end + +""" + PetscSectionClone(petsclib::PetscLibType,section::PetscSection, newSection::PetscSection) +Creates a shallow (if possible) copy of the `PetscSection` + +Collective + +Input Parameter: +- `section` - the `PetscSection` + +Output Parameter: +- `newSection` - the copy + +Level: beginner + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()`, `PetscSectionDestroy()`, `PetscSectionCopy()` + +# External Links +$(_doc_external("Vec/PetscSectionClone")) +""" +function PetscSectionClone(petsclib::PetscLibType, section::PetscSection, newSection::PetscSection) end + +@for_petsc function PetscSectionClone(petsclib::$UnionPetscLib, section::PetscSection, newSection::PetscSection ) + + @chk ccall( + (:PetscSectionClone, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{PetscSection}), + section, newSection, + ) + + + return nothing +end + +""" + PetscSectionSetFromOptions(petsclib::PetscLibType,s::PetscSection) +sets parameters in a `PetscSection` from the options database + +Collective + +Input Parameter: +- `s` - the `PetscSection` + +Options Database Key: +- `-petscsection_point_major` - `PETSC_TRUE` for point-major order + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()`, `PetscSectionDestroy()` + +# External Links +$(_doc_external("Vec/PetscSectionSetFromOptions")) +""" +function PetscSectionSetFromOptions(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionSetFromOptions(petsclib::$UnionPetscLib, s::PetscSection ) + + @chk ccall( + (:PetscSectionSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscSection,), + s, + ) + + + return nothing +end + +""" + congruent::PetscBool = PetscSectionCompare(petsclib::PetscLibType,s1::PetscSection, s2::PetscSection) +Compares two sections + +Collective + +Input Parameters: +- `s1` - the first `PetscSection` +- `s2` - the second `PetscSection` + +Output Parameter: +- `congruent` - `PETSC_TRUE` if the two sections are congruent, `PETSC_FALSE` otherwise + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()`, `PetscSectionCopy()`, `PetscSectionClone()` + +# External Links +$(_doc_external("Vec/PetscSectionCompare")) +""" +function PetscSectionCompare(petsclib::PetscLibType, s1::PetscSection, s2::PetscSection) end + +@for_petsc function PetscSectionCompare(petsclib::$UnionPetscLib, s1::PetscSection, s2::PetscSection ) + congruent_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSectionCompare, $petsc_library), + PetscErrorCode, + (PetscSection, PetscSection, Ptr{PetscBool}), + s1, s2, congruent_, + ) + + congruent = congruent_[] + + return congruent +end + +""" + numFields::PetscInt = PetscSectionGetNumFields(petsclib::PetscLibType,s::PetscSection) +Returns the number of fields in a `PetscSection`, or 0 if no fields were defined. + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Output Parameter: +- `numFields` - the number of fields defined, or 0 if none were defined + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetNumFields()` + +# External Links +$(_doc_external("Vec/PetscSectionGetNumFields")) +""" +function PetscSectionGetNumFields(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionGetNumFields(petsclib::$UnionPetscLib, s::PetscSection ) + numFields_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetNumFields, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{$PetscInt}), + s, numFields_, + ) + + numFields = numFields_[] + + return numFields +end + +""" + PetscSectionSetNumFields(petsclib::PetscLibType,s::PetscSection, numFields::PetscInt) +Sets the number of fields in a `PetscSection` + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `numFields` - the number of fields + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetNumFields()`, `PetscSectionSetChart()`, `PetscSectionReset()` + +# External Links +$(_doc_external("Vec/PetscSectionSetNumFields")) +""" +function PetscSectionSetNumFields(petsclib::PetscLibType, s::PetscSection, numFields::PetscInt) end + +@for_petsc function PetscSectionSetNumFields(petsclib::$UnionPetscLib, s::PetscSection, numFields::$PetscInt ) + + @chk ccall( + (:PetscSectionSetNumFields, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt), + s, numFields, + ) + + + return nothing +end + +""" + PetscSectionGetFieldName(petsclib::PetscLibType,s::PetscSection, field::PetscInt, fieldName::String) +Returns the name of a field in the `PetscSection` + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `field` - the field number + +Output Parameter: +- `fieldName` - the field name + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetFieldName()`, `PetscSectionSetNumFields()`, `PetscSectionGetNumFields()` + +# External Links +$(_doc_external("Vec/PetscSectionGetFieldName")) +""" +function PetscSectionGetFieldName(petsclib::PetscLibType, s::PetscSection, field::PetscInt, fieldName::String) end + +@for_petsc function PetscSectionGetFieldName(petsclib::$UnionPetscLib, s::PetscSection, field::$PetscInt, fieldName::String ) + fieldName_ = Ref(pointer(fieldName)) + + @chk ccall( + (:PetscSectionGetFieldName, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{Ptr{Cchar}}), + s, field, fieldName_, + ) + + + return nothing +end + +""" + PetscSectionSetFieldName(petsclib::PetscLibType,s::PetscSection, field::PetscInt, fieldName::String) +Sets the name of a field in the `PetscSection` + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `field` - the field number +- `fieldName` - the field name + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSectionGetFieldName()`, `PetscSectionSetNumFields()`, `PetscSectionGetNumFields()` + +# External Links +$(_doc_external("Vec/PetscSectionSetFieldName")) +""" +function PetscSectionSetFieldName(petsclib::PetscLibType, s::PetscSection, field::PetscInt, fieldName::String) end + +@for_petsc function PetscSectionSetFieldName(petsclib::$UnionPetscLib, s::PetscSection, field::$PetscInt, fieldName::String ) + + @chk ccall( + (:PetscSectionSetFieldName, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{Cchar}), + s, field, fieldName, + ) + + + return nothing +end + +""" + PetscSectionGetComponentName(petsclib::PetscLibType,s::PetscSection, field::PetscInt, comp::PetscInt, compName::String) +Gets the name of a field component in the `PetscSection` + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `field` - the field number +- `comp` - the component number + +Output Parameter: +- `compName` - the component name + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetFieldName()`, `PetscSectionSetNumFields()`, `PetscSectionGetNumFields()`, +`PetscSectionSetComponentName()`, `PetscSectionSetFieldName()`, `PetscSectionGetFieldComponents()`, `PetscSectionSetFieldComponents()` + +# External Links +$(_doc_external("Vec/PetscSectionGetComponentName")) +""" +function PetscSectionGetComponentName(petsclib::PetscLibType, s::PetscSection, field::PetscInt, comp::PetscInt, compName::String) end + +@for_petsc function PetscSectionGetComponentName(petsclib::$UnionPetscLib, s::PetscSection, field::$PetscInt, comp::$PetscInt, compName::String ) + compName_ = Ref(pointer(compName)) + + @chk ccall( + (:PetscSectionGetComponentName, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, Ptr{Ptr{Cchar}}), + s, field, comp, compName_, + ) + + + return nothing +end + +""" + PetscSectionSetComponentName(petsclib::PetscLibType,s::PetscSection, field::PetscInt, comp::PetscInt, compName::String) +Sets the name of a field component in the `PetscSection` + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `field` - the field number +- `comp` - the component number +- `compName` - the component name + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetComponentName()`, `PetscSectionSetNumFields()`, `PetscSectionGetNumFields()`, +`PetscSectionSetFieldName()`, `PetscSectionGetFieldComponents()`, `PetscSectionSetFieldComponents()` + +# External Links +$(_doc_external("Vec/PetscSectionSetComponentName")) +""" +function PetscSectionSetComponentName(petsclib::PetscLibType, s::PetscSection, field::PetscInt, comp::PetscInt, compName::String) end + +@for_petsc function PetscSectionSetComponentName(petsclib::$UnionPetscLib, s::PetscSection, field::$PetscInt, comp::$PetscInt, compName::String ) + + @chk ccall( + (:PetscSectionSetComponentName, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, Ptr{Cchar}), + s, field, comp, compName, + ) + + + return nothing +end + +""" + numComp::PetscInt = PetscSectionGetFieldComponents(petsclib::PetscLibType,s::PetscSection, field::PetscInt) +Returns the number of field components for the given field. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `field` - the field number + +Output Parameter: +- `numComp` - the number of field components + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetFieldComponents()`, `PetscSectionGetNumFields()`, +`PetscSectionSetComponentName()`, `PetscSectionGetComponentName()` + +# External Links +$(_doc_external("Vec/PetscSectionGetFieldComponents")) +""" +function PetscSectionGetFieldComponents(petsclib::PetscLibType, s::PetscSection, field::PetscInt) end + +@for_petsc function PetscSectionGetFieldComponents(petsclib::$UnionPetscLib, s::PetscSection, field::$PetscInt ) + numComp_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetFieldComponents, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{$PetscInt}), + s, field, numComp_, + ) + + numComp = numComp_[] + + return numComp +end + +""" + PetscSectionSetFieldComponents(petsclib::PetscLibType,s::PetscSection, field::PetscInt, numComp::PetscInt) +Sets the number of field components for the given field. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `field` - the field number +- `numComp` - the number of field components + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetFieldComponents()`, `PetscSectionSetComponentName()`, +`PetscSectionGetComponentName()`, `PetscSectionGetNumFields()` + +# External Links +$(_doc_external("Vec/PetscSectionSetFieldComponents")) +""" +function PetscSectionSetFieldComponents(petsclib::PetscLibType, s::PetscSection, field::PetscInt, numComp::PetscInt) end + +@for_petsc function PetscSectionSetFieldComponents(petsclib::$UnionPetscLib, s::PetscSection, field::$PetscInt, numComp::$PetscInt ) + + @chk ccall( + (:PetscSectionSetFieldComponents, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt), + s, field, numComp, + ) + + + return nothing +end + +""" + pStart::PetscInt,pEnd::PetscInt = PetscSectionGetChart(petsclib::PetscLibType,s::PetscSection) +Returns the range [`pStart`, `pEnd`) in which points (indices) lie for this `PetscSection` on this MPI process + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Output Parameters: +- `pStart` - the first point +- `pEnd` - one past the last point + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetChart()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetChart")) +""" +function PetscSectionGetChart(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionGetChart(petsclib::$UnionPetscLib, s::PetscSection ) + pStart_ = Ref{$PetscInt}() + pEnd_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetChart, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{$PetscInt}, Ptr{$PetscInt}), + s, pStart_, pEnd_, + ) + + pStart = pStart_[] + pEnd = pEnd_[] + + return pStart,pEnd +end + +""" + PetscSectionSetChart(petsclib::PetscLibType,s::PetscSection, pStart::PetscInt, pEnd::PetscInt) +Sets the range [`pStart`, `pEnd`) in which points (indices) lie for this `PetscSection` on this MPI process + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `pStart` - the first point +- `pEnd` - one past the last point, `pStart` ≤ `pEnd` + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetChart()`, `PetscSectionCreate()`, `PetscSectionSetNumFields()` + +# External Links +$(_doc_external("Vec/PetscSectionSetChart")) +""" +function PetscSectionSetChart(petsclib::PetscLibType, s::PetscSection, pStart::PetscInt, pEnd::PetscInt) end + +@for_petsc function PetscSectionSetChart(petsclib::$UnionPetscLib, s::PetscSection, pStart::$PetscInt, pEnd::$PetscInt ) + + @chk ccall( + (:PetscSectionSetChart, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt), + s, pStart, pEnd, + ) + + + return nothing +end + +""" + PetscSectionGetPermutation(petsclib::PetscLibType,s::PetscSection, perm::IS) +Returns the permutation of [0, `pEnd` + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Output Parameter: +- `perm` - The permutation as an `IS` + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `PetscSection`, `PetscSectionSetPermutation()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetPermutation")) +""" +function PetscSectionGetPermutation(petsclib::PetscLibType, s::PetscSection, perm::IS) end + +@for_petsc function PetscSectionGetPermutation(petsclib::$UnionPetscLib, s::PetscSection, perm::IS ) + perm_ = Ref(perm.ptr) + + @chk ccall( + (:PetscSectionGetPermutation, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{CIS}), + s, perm_, + ) + + perm.ptr = C_NULL + + return nothing +end + +""" + PetscSectionSetPermutation(petsclib::PetscLibType,s::PetscSection, perm::IS) +Sets a permutation of the chart for this section, [0, `pEnd` + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `perm` - the permutation of points + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `PetscSection`, `PetscSectionSetUp()`, `PetscSectionGetPermutation()`, `PetscSectionPermute()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSetPermutation")) +""" +function PetscSectionSetPermutation(petsclib::PetscLibType, s::PetscSection, perm::IS) end + +@for_petsc function PetscSectionSetPermutation(petsclib::$UnionPetscLib, s::PetscSection, perm::IS ) + + @chk ccall( + (:PetscSectionSetPermutation, $petsc_library), + PetscErrorCode, + (PetscSection, CIS), + s, perm, + ) + + + return nothing +end + +""" + PetscSectionGetBlockStarts(petsclib::PetscLibType,s::PetscSection, blockStarts::PetscBT) +Returns a table indicating which points start new blocks + +Not Collective, No Fortran Support + +Input Parameter: +- `s` - the `PetscSection` + +Output Parameter: +- `blockStarts` - The `PetscBT` with a 1 for each point that begins a block + +-seealso: [](sec_scatter), `IS`, `PetscSection`, `PetscSectionSetBlockStarts()`, `PetscSectionCreate()`, `DMCreateMatrix()`, `MatSetVariableBlockSizes()` + +# External Links +$(_doc_external("Vec/PetscSectionGetBlockStarts")) +""" +function PetscSectionGetBlockStarts(petsclib::PetscLibType, s::PetscSection, blockStarts::PetscBT) end + +@for_petsc function PetscSectionGetBlockStarts(petsclib::$UnionPetscLib, s::PetscSection, blockStarts::PetscBT ) + + @chk ccall( + (:PetscSectionGetBlockStarts, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{PetscBT}), + s, blockStarts, + ) + + + return nothing +end + +""" + PetscSectionSetBlockStarts(petsclib::PetscLibType,s::PetscSection, blockStarts::PetscBT) +Sets a table indicating which points start new blocks + +Not Collective, No Fortran Support + +Input Parameters: +- `s` - the `PetscSection` +- `blockStarts` - The `PetscBT` with a 1 for each point that begins a block + +Level: intermediate + +-seealso: [](sec_scatter), `IS`, `PetscSection`, `PetscSectionGetBlockStarts()`, `PetscSectionCreate()`, `DMCreateMatrix()`, `MatSetVariableBlockSizes()` + +# External Links +$(_doc_external("Vec/PetscSectionSetBlockStarts")) +""" +function PetscSectionSetBlockStarts(petsclib::PetscLibType, s::PetscSection, blockStarts::PetscBT) end + +@for_petsc function PetscSectionSetBlockStarts(petsclib::$UnionPetscLib, s::PetscSection, blockStarts::PetscBT ) + + @chk ccall( + (:PetscSectionSetBlockStarts, $petsc_library), + PetscErrorCode, + (PetscSection, PetscBT), + s, blockStarts, + ) + + + return nothing +end + +""" + pm::PetscBool = PetscSectionGetPointMajor(petsclib::PetscLibType,s::PetscSection) +Returns the flag for dof ordering, `PETSC_TRUE` if it is point major, `PETSC_FALSE` if it is field major + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Output Parameter: +- `pm` - the flag for point major ordering + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetPointMajor()` + +# External Links +$(_doc_external("Vec/PetscSectionGetPointMajor")) +""" +function PetscSectionGetPointMajor(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionGetPointMajor(petsclib::$UnionPetscLib, s::PetscSection ) + pm_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSectionGetPointMajor, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{PetscBool}), + s, pm_, + ) + + pm = pm_[] + + return pm +end + +""" + PetscSectionSetPointMajor(petsclib::PetscLibType,s::PetscSection, pm::PetscBool) +Sets the flag for dof ordering, `PETSC_TRUE` for point major, otherwise it will be field major + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `pm` - the flag for point major ordering + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetPointMajor()`, `PetscSectionSetPermutation()` + +# External Links +$(_doc_external("Vec/PetscSectionSetPointMajor")) +""" +function PetscSectionSetPointMajor(petsclib::PetscLibType, s::PetscSection, pm::PetscBool) end + +@for_petsc function PetscSectionSetPointMajor(petsclib::$UnionPetscLib, s::PetscSection, pm::PetscBool ) + + @chk ccall( + (:PetscSectionSetPointMajor, $petsc_library), + PetscErrorCode, + (PetscSection, PetscBool), + s, pm, + ) + + + return nothing +end + +""" + includesConstraints::PetscBool = PetscSectionGetIncludesConstraints(petsclib::PetscLibType,s::PetscSection) +Returns the flag indicating if constrained dofs were included when computing offsets in the `PetscSection`. +The value is set with `PetscSectionSetIncludesConstraints()` + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Output Parameter: +- `includesConstraints` - the flag indicating if constrained dofs were included when computing offsets + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetIncludesConstraints()` + +# External Links +$(_doc_external("Vec/PetscSectionGetIncludesConstraints")) +""" +function PetscSectionGetIncludesConstraints(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionGetIncludesConstraints(petsclib::$UnionPetscLib, s::PetscSection ) + includesConstraints_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSectionGetIncludesConstraints, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{PetscBool}), + s, includesConstraints_, + ) + + includesConstraints = includesConstraints_[] + + return includesConstraints +end + +""" + PetscSectionSetIncludesConstraints(petsclib::PetscLibType,s::PetscSection, includesConstraints::PetscBool) +Sets the flag indicating if constrained dofs are to be included when computing offsets + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `includesConstraints` - the flag indicating if constrained dofs are to be included when computing offsets + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetIncludesConstraints()` + +# External Links +$(_doc_external("Vec/PetscSectionSetIncludesConstraints")) +""" +function PetscSectionSetIncludesConstraints(petsclib::PetscLibType, s::PetscSection, includesConstraints::PetscBool) end + +@for_petsc function PetscSectionSetIncludesConstraints(petsclib::$UnionPetscLib, s::PetscSection, includesConstraints::PetscBool ) + + @chk ccall( + (:PetscSectionSetIncludesConstraints, $petsc_library), + PetscErrorCode, + (PetscSection, PetscBool), + s, includesConstraints, + ) + + + return nothing +end + +""" + numDof::PetscInt = PetscSectionGetDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt) +Return the total number of degrees of freedom associated with a given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point + +Output Parameter: +- `numDof` - the number of dof + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetDof")) +""" +function PetscSectionGetDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt) end + +@for_petsc function PetscSectionGetDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt ) + numDof_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{$PetscInt}), + s, point, numDof_, + ) + + numDof = numDof_[] + + return numDof +end + +""" + PetscSectionSetDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt, numDof::PetscInt) +Sets the total number of degrees of freedom associated with a given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `numDof` - the number of dof, these values may be negative -(dof+1) to indicate they are off process + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetDof()`, `PetscSectionAddDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSetDof")) +""" +function PetscSectionSetDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, numDof::PetscInt) end + +@for_petsc function PetscSectionSetDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, numDof::$PetscInt ) + + @chk ccall( + (:PetscSectionSetDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt), + s, point, numDof, + ) + + + return nothing +end + +""" + PetscSectionAddDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt, numDof::PetscInt) +Adds to the total number of degrees of freedom associated with a given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `numDof` - the number of additional dof + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetDof()`, `PetscSectionSetDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionAddDof")) +""" +function PetscSectionAddDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, numDof::PetscInt) end + +@for_petsc function PetscSectionAddDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, numDof::$PetscInt ) + + @chk ccall( + (:PetscSectionAddDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt), + s, point, numDof, + ) + + + return nothing +end + +""" + numDof::PetscInt = PetscSectionGetFieldDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt) +Return the number of degrees of freedom associated with a field on a given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `field` - the field + +Output Parameter: +- `numDof` - the number of dof + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetFieldDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetFieldDof")) +""" +function PetscSectionGetFieldDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt) end + +@for_petsc function PetscSectionGetFieldDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt ) + numDof_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetFieldDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, Ptr{$PetscInt}), + s, point, field, numDof_, + ) + + numDof = numDof_[] + + return numDof +end + +""" + PetscSectionSetFieldDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt) +Sets the number of degrees of freedom associated with a field on a given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `field` - the field +- `numDof` - the number of dof, these values may be negative -(dof+1) to indicate they are off process + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetFieldDof()`, `PetscSectionCreate()`, `PetscSectionAddDof()`, `PetscSectionSetDof()` + +# External Links +$(_doc_external("Vec/PetscSectionSetFieldDof")) +""" +function PetscSectionSetFieldDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt) end + +@for_petsc function PetscSectionSetFieldDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt, numDof::$PetscInt ) + + @chk ccall( + (:PetscSectionSetFieldDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, $PetscInt), + s, point, field, numDof, + ) + + + return nothing +end + +""" + PetscSectionAddFieldDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt) +Adds a number of degrees of freedom associated with a field on a given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `field` - the field +- `numDof` - the number of dof + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetFieldDof()`, `PetscSectionGetFieldDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionAddFieldDof")) +""" +function PetscSectionAddFieldDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt) end + +@for_petsc function PetscSectionAddFieldDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt, numDof::$PetscInt ) + + @chk ccall( + (:PetscSectionAddFieldDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, $PetscInt), + s, point, field, numDof, + ) + + + return nothing +end + +""" + numDof::PetscInt = PetscSectionGetConstraintDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt) +Return the number of constrained degrees of freedom associated with a given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point + +Output Parameter: +- `numDof` - the number of dof which are fixed by constraints + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetDof()`, `PetscSectionSetConstraintDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetConstraintDof")) +""" +function PetscSectionGetConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt) end + +@for_petsc function PetscSectionGetConstraintDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt ) + numDof_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetConstraintDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{$PetscInt}), + s, point, numDof_, + ) + + numDof = numDof_[] + + return numDof +end + +""" + PetscSectionSetConstraintDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt, numDof::PetscInt) +Set the number of constrained degrees of freedom associated with a given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `numDof` - the number of dof which are fixed by constraints + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetDof()`, `PetscSectionGetConstraintDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSetConstraintDof")) +""" +function PetscSectionSetConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, numDof::PetscInt) end + +@for_petsc function PetscSectionSetConstraintDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, numDof::$PetscInt ) + + @chk ccall( + (:PetscSectionSetConstraintDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt), + s, point, numDof, + ) + + + return nothing +end + +""" + PetscSectionAddConstraintDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt, numDof::PetscInt) +Increment the number of constrained degrees of freedom associated with a given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `numDof` - the number of additional dof which are fixed by constraints + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionAddDof()`, `PetscSectionGetConstraintDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionAddConstraintDof")) +""" +function PetscSectionAddConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, numDof::PetscInt) end + +@for_petsc function PetscSectionAddConstraintDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, numDof::$PetscInt ) + + @chk ccall( + (:PetscSectionAddConstraintDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt), + s, point, numDof, + ) + + + return nothing +end + +""" + numDof::PetscInt = PetscSectionGetFieldConstraintDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt) +Return the number of constrained degrees of freedom associated with a given field on a point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `field` - the field + +Output Parameter: +- `numDof` - the number of dof which are fixed by constraints + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetDof()`, `PetscSectionSetFieldConstraintDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetFieldConstraintDof")) +""" +function PetscSectionGetFieldConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt) end + +@for_petsc function PetscSectionGetFieldConstraintDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt ) + numDof_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetFieldConstraintDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, Ptr{$PetscInt}), + s, point, field, numDof_, + ) + + numDof = numDof_[] + + return numDof +end + +""" + PetscSectionSetFieldConstraintDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt) +Set the number of constrained degrees of freedom associated with a given field on a point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `field` - the field +- `numDof` - the number of dof which are fixed by constraints + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetDof()`, `PetscSectionGetFieldConstraintDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSetFieldConstraintDof")) +""" +function PetscSectionSetFieldConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt) end + +@for_petsc function PetscSectionSetFieldConstraintDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt, numDof::$PetscInt ) + + @chk ccall( + (:PetscSectionSetFieldConstraintDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, $PetscInt), + s, point, field, numDof, + ) + + + return nothing +end + +""" + PetscSectionAddFieldConstraintDof(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt) +Increment the number of constrained degrees of freedom associated with a given field on a point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `field` - the field +- `numDof` - the number of additional dof which are fixed by constraints + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionAddDof()`, `PetscSectionGetFieldConstraintDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionAddFieldConstraintDof")) +""" +function PetscSectionAddFieldConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt) end + +@for_petsc function PetscSectionAddFieldConstraintDof(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt, numDof::$PetscInt ) + + @chk ccall( + (:PetscSectionAddFieldConstraintDof, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, $PetscInt), + s, point, field, numDof, + ) + + + return nothing +end + +""" + PetscSectionSetUpBC(petsclib::PetscLibType,s::PetscSection) +Setup the subsections describing boundary conditions. + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSetUp()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSetUpBC")) +""" +function PetscSectionSetUpBC(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionSetUpBC(petsclib::$UnionPetscLib, s::PetscSection ) + + @chk ccall( + (:PetscSectionSetUpBC, $petsc_library), + PetscErrorCode, + (PetscSection,), + s, + ) + + + return nothing +end + +""" + PetscSectionSetUp(petsclib::PetscLibType,s::PetscSection) +Calculate offsets based upon the number of degrees of freedom for each point in preparation for use of the `PetscSection` + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()`, `PetscSectionSetPermutation()` + +# External Links +$(_doc_external("Vec/PetscSectionSetUp")) +""" +function PetscSectionSetUp(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionSetUp(petsclib::$UnionPetscLib, s::PetscSection ) + + @chk ccall( + (:PetscSectionSetUp, $petsc_library), + PetscErrorCode, + (PetscSection,), + s, + ) + + + return nothing +end + +""" + maxDof::PetscInt = PetscSectionGetMaxDof(petsclib::PetscLibType,s::PetscSection) +Return the maximum number of degrees of freedom on any point in the `PetscSection` + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Output Parameter: +- `maxDof` - the maximum dof + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetDof()`, `PetscSectionSetDof()`, `PetscSectionAddDof()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetMaxDof")) +""" +function PetscSectionGetMaxDof(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionGetMaxDof(petsclib::$UnionPetscLib, s::PetscSection ) + maxDof_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetMaxDof, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{$PetscInt}), + s, maxDof_, + ) + + maxDof = maxDof_[] + + return maxDof +end + +""" + size::PetscInt = PetscSectionGetStorageSize(petsclib::PetscLibType,s::PetscSection) +Return the size of an array or local `Vec` capable of holding all the degrees of freedom defined in a `PetscSection` + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Output Parameter: +- `size` - the size of an array which can hold all the dofs + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetOffset()`, `PetscSectionGetConstrainedStorageSize()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetStorageSize")) +""" +function PetscSectionGetStorageSize(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionGetStorageSize(petsclib::$UnionPetscLib, s::PetscSection ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetStorageSize, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{$PetscInt}), + s, size_, + ) + + size = size_[] + + return size +end + +""" + size::PetscInt = PetscSectionGetConstrainedStorageSize(petsclib::PetscLibType,s::PetscSection) +Return the size of an array or local `Vec` capable of holding all unconstrained degrees of freedom in a `PetscSection` + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Output Parameter: +- `size` - the size of an array which can hold all unconstrained dofs + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetStorageSize()`, `PetscSectionGetOffset()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetConstrainedStorageSize")) +""" +function PetscSectionGetConstrainedStorageSize(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionGetConstrainedStorageSize(petsclib::$UnionPetscLib, s::PetscSection ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetConstrainedStorageSize, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{$PetscInt}), + s, size_, + ) + + size = size_[] + + return size +end + +""" + gsection::PetscSection = PetscSectionCreateGlobalSection(petsclib::PetscLibType,s::PetscSection, sf::PetscSF, usePermutation::PetscBool, includeConstraints::PetscBool, locOffsets::PetscBool) +Create a parallel section describing the global layout using +a local (sequential) `PetscSection` on each MPI process and a `PetscSF` describing the section point overlap. + +Input Parameters: +- `s` - The `PetscSection` for the local field layout +- `sf` - The `PetscSF` describing parallel layout of the section points (leaves are unowned local points) +- `usePermutation` - By default this is `PETSC_TRUE`, meaning any permutation of the local section is transferred to the global section +- `includeConstraints` - By default this is `PETSC_FALSE`, meaning that the global field vector will not possess constrained dofs +- `localOffsets` - If `PETSC_TRUE`, use local rather than global offsets for the points + +Output Parameter: +- `gsection` - The `PetscSection` for the global field layout + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()`, `PetscSectionCreateGlobalSectionCensored()` + +# External Links +$(_doc_external("Vec/PetscSectionCreateGlobalSection")) +""" +function PetscSectionCreateGlobalSection(petsclib::PetscLibType, s::PetscSection, sf::PetscSF, usePermutation::PetscBool, includeConstraints::PetscBool, locOffsets::PetscBool) end + +@for_petsc function PetscSectionCreateGlobalSection(petsclib::$UnionPetscLib, s::PetscSection, sf::PetscSF, usePermutation::PetscBool, includeConstraints::PetscBool, locOffsets::PetscBool ) + gsection_ = Ref{PetscSection}() + + @chk ccall( + (:PetscSectionCreateGlobalSection, $petsc_library), + PetscErrorCode, + (PetscSection, PetscSF, PetscBool, PetscBool, PetscBool, Ptr{PetscSection}), + s, sf, usePermutation, includeConstraints, locOffsets, gsection_, + ) + + gsection = gsection_[] + + return gsection +end + +""" + gsection::PetscSection = PetscSectionCreateGlobalSectionCensored(petsclib::PetscLibType,s::PetscSection, sf::PetscSF, includeConstraints::PetscBool, numExcludes::PetscInt, excludes::Vector{PetscInt}) +Create a `PetscSection` describing the globallayout using +a local (sequential) `PetscSection` on each MPI process and an `PetscSF` describing the section point overlap. + +Input Parameters: +- `s` - The `PetscSection` for the local field layout +- `sf` - The `PetscSF` describing parallel layout of the section points +- `includeConstraints` - By default this is `PETSC_FALSE`, meaning that the global vector will not possess constrained dofs +- `numExcludes` - The number of exclusion ranges, this must have the same value on all MPI processes +- `excludes` - An array [start_0, end_0, start_1, end_1, ...] where there are `numExcludes` pairs and must have the same values on all MPI processes + +Output Parameter: +- `gsection` - The `PetscSection` for the global field layout + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionCreateGlobalSectionCensored")) +""" +function PetscSectionCreateGlobalSectionCensored(petsclib::PetscLibType, s::PetscSection, sf::PetscSF, includeConstraints::PetscBool, numExcludes::PetscInt, excludes::Vector{PetscInt}) end + +@for_petsc function PetscSectionCreateGlobalSectionCensored(petsclib::$UnionPetscLib, s::PetscSection, sf::PetscSF, includeConstraints::PetscBool, numExcludes::$PetscInt, excludes::Vector{$PetscInt} ) + gsection_ = Ref{PetscSection}() + + @chk ccall( + (:PetscSectionCreateGlobalSectionCensored, $petsc_library), + PetscErrorCode, + (PetscSection, PetscSF, PetscBool, $PetscInt, Ptr{$PetscInt}, Ptr{PetscSection}), + s, sf, includeConstraints, numExcludes, excludes, gsection_, + ) + + gsection = gsection_[] + + return gsection +end + +""" + PetscSectionGetPointLayout(petsclib::PetscLibType,comm::MPI_Comm, s::PetscSection, layout::PetscLayout) +Get a `PetscLayout` for the points with nonzero dof counts of the unnamed default field within this `PetscSection`s local chart + +Collective + +Input Parameters: +- `comm` - The `MPI_Comm` +- `s` - The `PetscSection` + +Output Parameter: +- `layout` - The point layout for the data that defines the section + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetValueLayout()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetPointLayout")) +""" +function PetscSectionGetPointLayout(petsclib::PetscLibType, comm::MPI_Comm, s::PetscSection, layout::PetscLayout) end + +@for_petsc function PetscSectionGetPointLayout(petsclib::$UnionPetscLib, comm::MPI_Comm, s::PetscSection, layout::PetscLayout ) + + @chk ccall( + (:PetscSectionGetPointLayout, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscSection, Ptr{PetscLayout}), + comm, s, layout, + ) + + + return nothing +end + +""" + PetscSectionGetValueLayout(petsclib::PetscLibType,comm::MPI_Comm, s::PetscSection, layout::PetscLayout) +Get the `PetscLayout` associated with the section dofs of a `PetscSection` + +Collective + +Input Parameters: +- `comm` - The `MPI_Comm` +- `s` - The `PetscSection` + +Output Parameter: +- `layout` - The dof layout for the section + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetPointLayout()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetValueLayout")) +""" +function PetscSectionGetValueLayout(petsclib::PetscLibType, comm::MPI_Comm, s::PetscSection, layout::PetscLayout) end + +@for_petsc function PetscSectionGetValueLayout(petsclib::$UnionPetscLib, comm::MPI_Comm, s::PetscSection, layout::PetscLayout ) + + @chk ccall( + (:PetscSectionGetValueLayout, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscSection, Ptr{PetscLayout}), + comm, s, layout, + ) + + + return nothing +end + +""" + offset::PetscInt = PetscSectionGetOffset(petsclib::PetscLibType,s::PetscSection, point::PetscInt) +Return the offset into an array or `Vec` for the dof associated with the given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point + +Output Parameter: +- `offset` - the offset + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetFieldOffset()`, `PetscSectionCreate()`, `PetscSectionSetPointMajor()` + +# External Links +$(_doc_external("Vec/PetscSectionGetOffset")) +""" +function PetscSectionGetOffset(petsclib::PetscLibType, s::PetscSection, point::PetscInt) end + +@for_petsc function PetscSectionGetOffset(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt ) + offset_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetOffset, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{$PetscInt}), + s, point, offset_, + ) + + offset = offset_[] + + return offset +end + +""" + PetscSectionSetOffset(petsclib::PetscLibType,s::PetscSection, point::PetscInt, offset::PetscInt) +Set the offset into an array or `Vec` for the dof associated with the given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `offset` - the offset, these values may be negative indicating the values are off process + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetFieldOffset()`, `PetscSectionCreate()`, `PetscSectionSetUp()` + +# External Links +$(_doc_external("Vec/PetscSectionSetOffset")) +""" +function PetscSectionSetOffset(petsclib::PetscLibType, s::PetscSection, point::PetscInt, offset::PetscInt) end + +@for_petsc function PetscSectionSetOffset(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, offset::$PetscInt ) + + @chk ccall( + (:PetscSectionSetOffset, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt), + s, point, offset, + ) + + + return nothing +end + +""" + offset::PetscInt = PetscSectionGetFieldOffset(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt) +Return the offset into an array or `Vec` for the field dof associated with the given point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `field` - the field + +Output Parameter: +- `offset` - the offset + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetOffset()`, `PetscSectionCreate()`, `PetscSectionGetFieldPointOffset()` + +# External Links +$(_doc_external("Vec/PetscSectionGetFieldOffset")) +""" +function PetscSectionGetFieldOffset(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt) end + +@for_petsc function PetscSectionGetFieldOffset(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt ) + offset_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetFieldOffset, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, Ptr{$PetscInt}), + s, point, field, offset_, + ) + + offset = offset_[] + + return offset +end + +""" + PetscSectionSetFieldOffset(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt, offset::PetscInt) +Set the offset into an array or `Vec` for the dof associated with the given field at a point. + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `field` - the field +- `offset` - the offset, these values may be negative indicating the values are off process + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetFieldOffset()`, `PetscSectionSetOffset()`, `PetscSectionCreate()`, `PetscSectionSetUp()` + +# External Links +$(_doc_external("Vec/PetscSectionSetFieldOffset")) +""" +function PetscSectionSetFieldOffset(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, offset::PetscInt) end + +@for_petsc function PetscSectionSetFieldOffset(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt, offset::$PetscInt ) + + @chk ccall( + (:PetscSectionSetFieldOffset, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, $PetscInt), + s, point, field, offset, + ) + + + return nothing +end + +""" + offset::PetscInt = PetscSectionGetFieldPointOffset(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt) +Return the offset for the first field dof associated with the given point relative to the offset for that point for the +unnamed default field's first dof + +Not Collective + +Input Parameters: +- `s` - the `PetscSection` +- `point` - the point +- `field` - the field + +Output Parameter: +- `offset` - the offset + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetOffset()`, `PetscSectionCreate()`, `PetscSectionGetFieldOffset()` + +# External Links +$(_doc_external("Vec/PetscSectionGetFieldPointOffset")) +""" +function PetscSectionGetFieldPointOffset(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt) end + +@for_petsc function PetscSectionGetFieldPointOffset(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt ) + offset_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetFieldPointOffset, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, Ptr{$PetscInt}), + s, point, field, offset_, + ) + + offset = offset_[] + + return offset +end + +""" + start::PetscInt,end_::PetscInt = PetscSectionGetOffsetRange(petsclib::PetscLibType,s::PetscSection) +Return the full range of offsets [`start`, `end`) for a `PetscSection` + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Output Parameters: +- `start` - the minimum offset +- `end` - one more than the maximum offset + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetOffset()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetOffsetRange")) +""" +function PetscSectionGetOffsetRange(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionGetOffsetRange(petsclib::$UnionPetscLib, s::PetscSection ) + start_ = Ref{$PetscInt}() + end__ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSectionGetOffsetRange, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{$PetscInt}, Ptr{$PetscInt}), + s, start_, end__, + ) + + start = start_[] + end_ = end__[] + + return start,end_ +end + +""" + subs::PetscSection = PetscSectionCreateSubsection(petsclib::PetscLibType,s::PetscSection, len::PetscInt, fields::Vector{PetscInt}) +Create a new, smaller `PetscSection` composed of only selected fields + +Collective + +Input Parameters: +- `s` - the `PetscSection` +- `len` - the number of subfields +- `fields` - the subfield numbers + +Output Parameter: +- `subs` - the subsection + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreateSupersection()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionCreateSubsection")) +""" +function PetscSectionCreateSubsection(petsclib::PetscLibType, s::PetscSection, len::PetscInt, fields::Vector{PetscInt}) end + +@for_petsc function PetscSectionCreateSubsection(petsclib::$UnionPetscLib, s::PetscSection, len::$PetscInt, fields::Vector{$PetscInt} ) + subs_ = Ref{PetscSection}() + + @chk ccall( + (:PetscSectionCreateSubsection, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{$PetscInt}, Ptr{PetscSection}), + s, len, fields, subs_, + ) + + subs = subs_[] + + return subs +end + +""" + subs::PetscSection = PetscSectionCreateComponentSubsection(petsclib::PetscLibType,s::PetscSection, len::PetscInt, comps::Vector{PetscInt}) +Create a new, smaller `PetscSection` composed of only selected components + +Collective + +Input Parameters: +- `s` - the `PetscSection` +- `len` - the number of components +- `comps` - the component numbers + +Output Parameter: +- `subs` - the subsection + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreateSupersection()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionCreateComponentSubsection")) +""" +function PetscSectionCreateComponentSubsection(petsclib::PetscLibType, s::PetscSection, len::PetscInt, comps::Vector{PetscInt}) end + +@for_petsc function PetscSectionCreateComponentSubsection(petsclib::$UnionPetscLib, s::PetscSection, len::$PetscInt, comps::Vector{$PetscInt} ) + subs_ = Ref{PetscSection}() + + @chk ccall( + (:PetscSectionCreateComponentSubsection, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{$PetscInt}, Ptr{PetscSection}), + s, len, comps, subs_, + ) + + subs = subs_[] + + return subs +end + +""" + supers::PetscSection = PetscSectionCreateSupersection(petsclib::PetscLibType,s::Vector{PetscSection}, len::PetscInt) +Create a new, larger section composed of multiple `PetscSection`s + +Collective + +Input Parameters: +- `s` - the input sections +- `len` - the number of input sections + +Output Parameter: +- `supers` - the supersection + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreateSubsection()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionCreateSupersection")) +""" +function PetscSectionCreateSupersection(petsclib::PetscLibType, s::Vector{PetscSection}, len::PetscInt) end + +@for_petsc function PetscSectionCreateSupersection(petsclib::$UnionPetscLib, s::Vector{PetscSection}, len::$PetscInt ) + supers_ = Ref{PetscSection}() + + @chk ccall( + (:PetscSectionCreateSupersection, $petsc_library), + PetscErrorCode, + (Ptr{PetscSection}, $PetscInt, Ptr{PetscSection}), + s, len, supers_, + ) + + supers = supers_[] + + return supers +end + +""" + subs::PetscSection = PetscSectionCreateSubmeshSection(petsclib::PetscLibType,s::PetscSection, subpointIS::IS) +Create a new, smaller section with support on the submesh + +Collective + +Input Parameters: +- `s` - the `PetscSection` +- `subpointIS` - a sorted list of points in the original mesh which are in the submesh + +Output Parameter: +- `subs` - the subsection + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreateSubdomainSection()`, `PetscSectionCreateSubsection()`, `DMPlexGetSubpointMap()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionCreateSubmeshSection")) +""" +function PetscSectionCreateSubmeshSection(petsclib::PetscLibType, s::PetscSection, subpointIS::IS) end + +@for_petsc function PetscSectionCreateSubmeshSection(petsclib::$UnionPetscLib, s::PetscSection, subpointIS::IS ) + subs_ = Ref{PetscSection}() + + @chk ccall( + (:PetscSectionCreateSubmeshSection, $petsc_library), + PetscErrorCode, + (PetscSection, CIS, Ptr{PetscSection}), + s, subpointIS, subs_, + ) + + subs = subs_[] + + return subs +end + +""" + subs::PetscSection = PetscSectionCreateSubdomainSection(petsclib::PetscLibType,s::PetscSection, subpointMap::IS) +Create a new, smaller section with support on a subdomain of the mesh + +Collective + +Input Parameters: +- `s` - the `PetscSection` +- `subpointMap` - a sorted list of points in the original mesh which are in the subdomain + +Output Parameter: +- `subs` - the subsection + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreateSubmeshSection()`, `PetscSectionCreateSubsection()`, `DMPlexGetSubpointMap()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionCreateSubdomainSection")) +""" +function PetscSectionCreateSubdomainSection(petsclib::PetscLibType, s::PetscSection, subpointMap::IS) end + +@for_petsc function PetscSectionCreateSubdomainSection(petsclib::$UnionPetscLib, s::PetscSection, subpointMap::IS ) + subs_ = Ref{PetscSection}() + + @chk ccall( + (:PetscSectionCreateSubdomainSection, $petsc_library), + PetscErrorCode, + (PetscSection, CIS, Ptr{PetscSection}), + s, subpointMap, subs_, + ) + + subs = subs_[] + + return subs +end + +""" + PetscSectionViewFromOptions(petsclib::PetscLibType,A::PetscSection, obj::PetscObject, name::String) +View the `PetscSection` based on values in the options database + +Collective + +Input Parameters: +- `A` - the `PetscSection` object to view +- `obj` - Optional object that provides the options prefix used for the options +- `name` - command line option + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionView`, `PetscObjectViewFromOptions()`, `PetscSectionCreate()`, `PetscSectionView()` + +# External Links +$(_doc_external("Vec/PetscSectionViewFromOptions")) +""" +function PetscSectionViewFromOptions(petsclib::PetscLibType, A::PetscSection, obj::PetscObject, name::String) end + +@for_petsc function PetscSectionViewFromOptions(petsclib::$UnionPetscLib, A::PetscSection, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscSectionViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscSection, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscSectionView(petsclib::PetscLibType,s::PetscSection, viewer::PetscViewer) +Views a `PetscSection` + +Collective + +Input Parameters: +- `s` - the `PetscSection` object to view +- `viewer` - the viewer + +Level: beginner + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()`, `PetscSectionDestroy()`, `PetscSectionLoad()`, `PetscViewer` + +# External Links +$(_doc_external("Vec/PetscSectionView")) +""" +function PetscSectionView(petsclib::PetscLibType, s::PetscSection, viewer::PetscViewer) end + +@for_petsc function PetscSectionView(petsclib::$UnionPetscLib, s::PetscSection, viewer::PetscViewer ) + + @chk ccall( + (:PetscSectionView, $petsc_library), + PetscErrorCode, + (PetscSection, PetscViewer), + s, viewer, + ) + + + return nothing +end + +""" + PetscSectionLoad(petsclib::PetscLibType,s::PetscSection, viewer::PetscViewer) +Loads a `PetscSection` + +Collective + +Input Parameters: +- `s` - the `PetscSection` object to load +- `viewer` - the viewer + +Level: beginner + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()`, `PetscSectionDestroy()`, `PetscSectionView()` + +# External Links +$(_doc_external("Vec/PetscSectionLoad")) +""" +function PetscSectionLoad(petsclib::PetscLibType, s::PetscSection, viewer::PetscViewer) end + +@for_petsc function PetscSectionLoad(petsclib::$UnionPetscLib, s::PetscSection, viewer::PetscViewer ) + + @chk ccall( + (:PetscSectionLoad, $petsc_library), + PetscErrorCode, + (PetscSection, PetscViewer), + s, viewer, + ) + + + return nothing +end + +""" + PetscSectionArrayView(petsclib::PetscLibType,s::PetscSection, array::Cvoid, data_type::PetscDataType, viewer::PetscViewer) +View an array, using the section to structure the values + +Collective + +Input Parameters: +- `s` - the organizing `PetscSection` +- `array` - the array of values +- `data_type` - the `PetscDataType` of the array +- `viewer` - the `PetscViewer` + +Level: developer + +-seealso: `PetscSection`, `PetscViewer`, `PetscSectionCreate()`, `VecSetValuesSection()`, `PetscSectionVecView()` + +# External Links +$(_doc_external("Vec/PetscSectionArrayView")) +""" +function PetscSectionArrayView(petsclib::PetscLibType, s::PetscSection, array::Cvoid, data_type::PetscDataType, viewer::PetscViewer) end + +@for_petsc function PetscSectionArrayView(petsclib::$UnionPetscLib, s::PetscSection, array::Cvoid, data_type::PetscDataType, viewer::PetscViewer ) + + @chk ccall( + (:PetscSectionArrayView, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{Cvoid}, PetscDataType, PetscViewer), + s, array, data_type, viewer, + ) + + + return nothing +end + +""" + PetscSectionResetClosurePermutation(petsclib::PetscLibType,section::PetscSection) +Remove any existing closure permutation + +Input Parameter: +- `section` - The `PetscSection` + +Level: intermediate + +-seealso: `PetscSectionSetClosurePermutation()`, `PetscSectionSetClosureIndex()`, `PetscSectionReset()` + +# External Links +$(_doc_external("Vec/PetscSectionResetClosurePermutation")) +""" +function PetscSectionResetClosurePermutation(petsclib::PetscLibType, section::PetscSection) end + +@for_petsc function PetscSectionResetClosurePermutation(petsclib::$UnionPetscLib, section::PetscSection ) + + @chk ccall( + (:PetscSectionResetClosurePermutation, $petsc_library), + PetscErrorCode, + (PetscSection,), + section, + ) + + + return nothing +end + +""" + PetscSectionReset(petsclib::PetscLibType,s::PetscSection) +Frees all section data, the section is then as if `PetscSectionCreate()` had just been called. + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Level: beginner + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionReset")) +""" +function PetscSectionReset(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionReset(petsclib::$UnionPetscLib, s::PetscSection ) + + @chk ccall( + (:PetscSectionReset, $petsc_library), + PetscErrorCode, + (PetscSection,), + s, + ) + + + return nothing +end + +""" + PetscSectionDestroy(petsclib::PetscLibType,s::PetscSection) +Frees a `PetscSection` + +Not Collective + +Input Parameter: +- `s` - the `PetscSection` + +Level: beginner + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionCreate()`, `PetscSectionReset()` + +# External Links +$(_doc_external("Vec/PetscSectionDestroy")) +""" +function PetscSectionDestroy(petsclib::PetscLibType, s::PetscSection) end + +# Accept a Ref{PetscSection} (pointer-to-pointer) so callers can pass a Ref directly +@for_petsc function PetscSectionDestroy(petsclib::$UnionPetscLib, s::Ref{PetscSection} ) + + @chk ccall( + (:PetscSectionDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscSection},), + s, + ) + + + return nothing +end + +@for_petsc function PetscSectionDestroy(petsclib::$UnionPetscLib, s::PetscSection ) + + @chk ccall( + (:PetscSectionDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscSection},), + s, + ) + + + return nothing +end + +""" + hasConstraints::PetscBool = PetscSectionHasConstraints(petsclib::PetscLibType,s::PetscSection) +Determine whether a `PetscSection` has constrained dofs + +Not Collective + +Input Parameter: +- `s` - The `PetscSection` + +Output Parameter: +- `hasConstraints` - flag indicating that the section has constrained dofs + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSetConstraintIndices()`, `PetscSectionGetConstraintDof()`, `PetscSection` + +# External Links +$(_doc_external("Vec/PetscSectionHasConstraints")) +""" +function PetscSectionHasConstraints(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionHasConstraints(petsclib::$UnionPetscLib, s::PetscSection ) + hasConstraints_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSectionHasConstraints, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{PetscBool}), + s, hasConstraints_, + ) + + hasConstraints = hasConstraints_[] + + return hasConstraints +end + +""" + indices::Vector{PetscInt} = PetscSectionGetConstraintIndices(petsclib::PetscLibType,s::PetscSection, point::PetscInt) +Get the point dof numbers, in [0, dof), which are constrained for a given point + +Not Collective + +Input Parameters: +- `s` - The `PetscSection` +- `point` - The point + +Output Parameter: +- `indices` - The constrained dofs + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSetConstraintIndices()`, `PetscSectionGetConstraintDof()`, `PetscSection` + +# External Links +$(_doc_external("Vec/PetscSectionGetConstraintIndices")) +""" +function PetscSectionGetConstraintIndices(petsclib::PetscLibType, s::PetscSection, point::PetscInt) end + +@for_petsc function PetscSectionGetConstraintIndices(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt ) + indices_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscSectionGetConstraintIndices, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{Ptr{$PetscInt}}), + s, point, indices_, + ) + + indices = unsafe_wrap(Array, indices_[], VecGetLocalSize(petsclib, x); own = false) + + return indices +end + +""" + PetscSectionSetConstraintIndices(petsclib::PetscLibType,s::PetscSection, point::PetscInt, indices::Vector{PetscInt}) +Set the point dof numbers, in [0, dof), which are constrained + +Not Collective + +Input Parameters: +- `s` - The `PetscSection` +- `point` - The point +- `indices` - The constrained dofs + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSectionGetConstraintIndices()`, `PetscSectionGetConstraintDof()`, `PetscSection` + +# External Links +$(_doc_external("Vec/PetscSectionSetConstraintIndices")) +""" +function PetscSectionSetConstraintIndices(petsclib::PetscLibType, s::PetscSection, point::PetscInt, indices::Vector{PetscInt}) end + +@for_petsc function PetscSectionSetConstraintIndices(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, indices::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSectionSetConstraintIndices, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{$PetscInt}), + s, point, indices, + ) + + + return nothing +end + +""" + indices::Vector{PetscInt} = PetscSectionGetFieldConstraintIndices(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt) +Get the field dof numbers, in [0, fdof), which are constrained + +Not Collective + +Input Parameters: +- `s` - The `PetscSection` +- `field` - The field number +- `point` - The point + +Output Parameter: +- `indices` - The constrained dofs sorted in ascending order, the length is returned by `PetscSectionGetConstraintDof()`. + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSetFieldConstraintIndices()`, `PetscSectionGetConstraintIndices()`, `PetscSectionGetConstraintDof()`, `PetscSection` + +# External Links +$(_doc_external("Vec/PetscSectionGetFieldConstraintIndices")) +""" +function PetscSectionGetFieldConstraintIndices(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt) end + +@for_petsc function PetscSectionGetFieldConstraintIndices(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt ) + indices_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscSectionGetFieldConstraintIndices, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, Ptr{Ptr{$PetscInt}}), + s, point, field, indices_, + ) + + indices = unsafe_wrap(Array, indices_[], VecGetLocalSize(petsclib, x); own = false) + + return indices +end + +""" + PetscSectionSetFieldConstraintIndices(petsclib::PetscLibType,s::PetscSection, point::PetscInt, field::PetscInt, indices::Vector{PetscInt}) +Set the field dof numbers, in [0, fdof), which are constrained + +Not Collective + +Input Parameters: +- `s` - The `PetscSection` +- `point` - The point +- `field` - The field number +- `indices` - The constrained dofs + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSetConstraintIndices()`, `PetscSectionGetFieldConstraintIndices()`, `PetscSectionGetConstraintDof()`, `PetscSection` + +# External Links +$(_doc_external("Vec/PetscSectionSetFieldConstraintIndices")) +""" +function PetscSectionSetFieldConstraintIndices(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, indices::Vector{PetscInt}) end + +@for_petsc function PetscSectionSetFieldConstraintIndices(petsclib::$UnionPetscLib, s::PetscSection, point::$PetscInt, field::$PetscInt, indices::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSectionSetFieldConstraintIndices, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, Ptr{$PetscInt}), + s, point, field, indices, + ) + + + return nothing +end + +""" + PetscSectionPermute(petsclib::PetscLibType,section::PetscSection, permutation::IS, sectionNew::PetscSection) +Reorder the section according to the input point permutation + +Collective + +Input Parameters: +- `section` - The `PetscSection` object +- `permutation` - The point permutation, old point p becomes new point perm[p] + +Output Parameter: +- `sectionNew` - The permuted `PetscSection` + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `IS`, `PetscSection`, `MatPermute()`, `PetscSectionSetPermutation()` + +# External Links +$(_doc_external("Vec/PetscSectionPermute")) +""" +function PetscSectionPermute(petsclib::PetscLibType, section::PetscSection, permutation::IS, sectionNew::PetscSection) end + +@for_petsc function PetscSectionPermute(petsclib::$UnionPetscLib, section::PetscSection, permutation::IS, sectionNew::PetscSection ) + + @chk ccall( + (:PetscSectionPermute, $petsc_library), + PetscErrorCode, + (PetscSection, CIS, Ptr{PetscSection}), + section, permutation, sectionNew, + ) + + + return nothing +end + +""" + PetscSectionSetClosureIndex(petsclib::PetscLibType,section::PetscSection, obj::PetscObject, clSection::PetscSection, clPoints::IS) +Create an internal data structure to speed up closure queries. + +Collective + +Input Parameters: +- `section` - The `PetscSection` +- `obj` - A `PetscObject` which serves as the key for this index +- `clSection` - `PetscSection` giving the size of the closure of each point +- `clPoints` - `IS` giving the points in each closure + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionGetClosureIndex()`, `DMPlexCreateClosureIndex()` + +# External Links +$(_doc_external("Vec/PetscSectionSetClosureIndex")) +""" +function PetscSectionSetClosureIndex(petsclib::PetscLibType, section::PetscSection, obj::PetscObject, clSection::PetscSection, clPoints::IS) end + +@for_petsc function PetscSectionSetClosureIndex(petsclib::$UnionPetscLib, section::PetscSection, obj::PetscObject, clSection::PetscSection, clPoints::IS ) + + @chk ccall( + (:PetscSectionSetClosureIndex, $petsc_library), + PetscErrorCode, + (PetscSection, PetscObject, PetscSection, CIS), + section, obj, clSection, clPoints, + ) + + + return nothing +end + +""" + PetscSectionGetClosureIndex(petsclib::PetscLibType,section::PetscSection, obj::PetscObject, clSection::PetscSection, clPoints::IS) +Get the cache of points in the closure of each point in the section set with `PetscSectionSetClosureIndex()` + +Collective + +Input Parameters: +- `section` - The `PetscSection` +- `obj` - A `PetscObject` which serves as the key for this index + +Output Parameters: +- `clSection` - `PetscSection` giving the size of the closure of each point +- `clPoints` - `IS` giving the points in each closure + +Level: advanced + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSetClosureIndex()`, `DMPlexCreateClosureIndex()` + +# External Links +$(_doc_external("Vec/PetscSectionGetClosureIndex")) +""" +function PetscSectionGetClosureIndex(petsclib::PetscLibType, section::PetscSection, obj::PetscObject, clSection::PetscSection, clPoints::IS) end + +@for_petsc function PetscSectionGetClosureIndex(petsclib::$UnionPetscLib, section::PetscSection, obj::PetscObject, clSection::PetscSection, clPoints::IS ) + clPoints_ = Ref(clPoints.ptr) + + @chk ccall( + (:PetscSectionGetClosureIndex, $petsc_library), + PetscErrorCode, + (PetscSection, PetscObject, Ptr{PetscSection}, Ptr{CIS}), + section, obj, clSection, clPoints_, + ) + + clPoints.ptr = C_NULL + + return nothing +end + +""" + PetscSectionSetClosurePermutation(petsclib::PetscLibType,section::PetscSection, obj::PetscObject, depth::PetscInt, perm::IS) +Set the dof permutation for the closure of each cell in the section, meaning clPerm[newIndex] = oldIndex. + +Not Collective + +Input Parameters: +- `section` - The `PetscSection` +- `obj` - A `PetscObject` which serves as the key for this index (usually a `DM`) +- `depth` - Depth of points on which to apply the given permutation +- `perm` - Permutation of the cell dof closure + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `IS`, `PetscSectionGetClosurePermutation()`, `PetscSectionGetClosureIndex()`, `DMPlexCreateClosureIndex()`, `PetscCopyMode` + +# External Links +$(_doc_external("Vec/PetscSectionSetClosurePermutation")) +""" +function PetscSectionSetClosurePermutation(petsclib::PetscLibType, section::PetscSection, obj::PetscObject, depth::PetscInt, perm::IS) end + +@for_petsc function PetscSectionSetClosurePermutation(petsclib::$UnionPetscLib, section::PetscSection, obj::PetscObject, depth::$PetscInt, perm::IS ) + + @chk ccall( + (:PetscSectionSetClosurePermutation, $petsc_library), + PetscErrorCode, + (PetscSection, PetscObject, $PetscInt, CIS), + section, obj, depth, perm, + ) + + + return nothing +end + +""" + PetscSectionGetClosurePermutation(petsclib::PetscLibType,section::PetscSection, obj::PetscObject, depth::PetscInt, clSize::PetscInt, perm::IS) +Get the dof permutation for the closure of each cell in the section, meaning clPerm[newIndex] = oldIndex. + +Not Collective + +Input Parameters: +- `section` - The `PetscSection` +- `obj` - A `PetscObject` which serves as the key for this index (usually a DM) +- `depth` - Depth stratum on which to obtain closure permutation +- `clSize` - Closure size to be permuted (e.g., may vary with element topology and degree) + +Output Parameter: +- `perm` - The dof closure permutation + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `IS`, `PetscSectionSetClosurePermutation()`, `PetscSectionGetClosureInversePermutation()`, `PetscSectionGetClosureIndex()`, `PetscSectionSetClosureIndex()`, `DMPlexCreateClosureIndex()` + +# External Links +$(_doc_external("Vec/PetscSectionGetClosurePermutation")) +""" +function PetscSectionGetClosurePermutation(petsclib::PetscLibType, section::PetscSection, obj::PetscObject, depth::PetscInt, clSize::PetscInt, perm::IS) end + +@for_petsc function PetscSectionGetClosurePermutation(petsclib::$UnionPetscLib, section::PetscSection, obj::PetscObject, depth::$PetscInt, clSize::$PetscInt, perm::IS ) + perm_ = Ref(perm.ptr) + + @chk ccall( + (:PetscSectionGetClosurePermutation, $petsc_library), + PetscErrorCode, + (PetscSection, PetscObject, $PetscInt, $PetscInt, Ptr{CIS}), + section, obj, depth, clSize, perm_, + ) + + perm.ptr = C_NULL + + return nothing +end + +""" + PetscSectionGetClosureInversePermutation(petsclib::PetscLibType,section::PetscSection, obj::PetscObject, depth::PetscInt, clSize::PetscInt, perm::IS) +Get the inverse dof permutation for the closure of each cell in the section, meaning clPerm[oldIndex] = newIndex. + +Not Collective + +Input Parameters: +- `section` - The `PetscSection` +- `obj` - A `PetscObject` which serves as the key for this index (usually a `DM`) +- `depth` - Depth stratum on which to obtain closure permutation +- `clSize` - Closure size to be permuted (e.g., may vary with element topology and degree) + +Output Parameter: +- `perm` - The dof closure permutation + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `IS`, `PetscSectionSetClosurePermutation()`, `PetscSectionGetClosureIndex()`, `PetscSectionSetClosureIndex()`, `DMPlexCreateClosureIndex()` + +# External Links +$(_doc_external("Vec/PetscSectionGetClosureInversePermutation")) +""" +function PetscSectionGetClosureInversePermutation(petsclib::PetscLibType, section::PetscSection, obj::PetscObject, depth::PetscInt, clSize::PetscInt, perm::IS) end + +@for_petsc function PetscSectionGetClosureInversePermutation(petsclib::$UnionPetscLib, section::PetscSection, obj::PetscObject, depth::$PetscInt, clSize::$PetscInt, perm::IS ) + perm_ = Ref(perm.ptr) + + @chk ccall( + (:PetscSectionGetClosureInversePermutation, $petsc_library), + PetscErrorCode, + (PetscSection, PetscObject, $PetscInt, $PetscInt, Ptr{CIS}), + section, obj, depth, clSize, perm_, + ) + + perm.ptr = C_NULL + + return nothing +end + +""" + PetscSectionGetField(petsclib::PetscLibType,s::PetscSection, field::PetscInt, subs::PetscSection) +Get the `PetscSection` associated with a single field + +Input Parameters: +- `s` - The `PetscSection` +- `field` - The field number + +Output Parameter: +- `subs` - The `PetscSection` for the given field, note the chart of `subs` is not set + +Level: intermediate + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `IS`, `PetscSectionSetNumFields()` + +# External Links +$(_doc_external("Vec/PetscSectionGetField")) +""" +function PetscSectionGetField(petsclib::PetscLibType, s::PetscSection, field::PetscInt, subs::PetscSection) end + +@for_petsc function PetscSectionGetField(petsclib::$UnionPetscLib, s::PetscSection, field::$PetscInt, subs::PetscSection ) + + @chk ccall( + (:PetscSectionGetField, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{PetscSection}), + s, field, subs, + ) + + + return nothing +end + +""" + PetscSectionSetSym(petsclib::PetscLibType,section::PetscSection, sym::PetscSectionSym) +Set the symmetries for the data referred to by the section + +Collective + +Input Parameters: +- `section` - the section describing data layout +- `sym` - the symmetry describing the affect of orientation on the access of the data + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionGetSym()`, `PetscSectionSymCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSetSym")) +""" +function PetscSectionSetSym(petsclib::PetscLibType, section::PetscSection, sym::PetscSectionSym) end + +@for_petsc function PetscSectionSetSym(petsclib::$UnionPetscLib, section::PetscSection, sym::PetscSectionSym ) + + @chk ccall( + (:PetscSectionSetSym, $petsc_library), + PetscErrorCode, + (PetscSection, PetscSectionSym), + section, sym, + ) + + + return nothing +end + +""" + PetscSectionGetSym(petsclib::PetscLibType,section::PetscSection, sym::PetscSectionSym) +Get the symmetries for the data referred to by the section + +Not Collective + +Input Parameter: +- `section` - the section describing data layout + +Output Parameter: +- `sym` - the symmetry describing the affect of orientation on the access of the data, provided previously by `PetscSectionSetSym()` + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionSetSym()`, `PetscSectionSymCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetSym")) +""" +function PetscSectionGetSym(petsclib::PetscLibType, section::PetscSection, sym::PetscSectionSym) end + +@for_petsc function PetscSectionGetSym(petsclib::$UnionPetscLib, section::PetscSection, sym::PetscSectionSym ) + + @chk ccall( + (:PetscSectionGetSym, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{PetscSectionSym}), + section, sym, + ) + + + return nothing +end + +""" + PetscSectionSetFieldSym(petsclib::PetscLibType,section::PetscSection, field::PetscInt, sym::PetscSectionSym) +Set the symmetries for the data referred to by a field of the section + +Collective + +Input Parameters: +- `section` - the section describing data layout +- `field` - the field number +- `sym` - the symmetry describing the affect of orientation on the access of the data + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionGetFieldSym()`, `PetscSectionSymCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSetFieldSym")) +""" +function PetscSectionSetFieldSym(petsclib::PetscLibType, section::PetscSection, field::PetscInt, sym::PetscSectionSym) end + +@for_petsc function PetscSectionSetFieldSym(petsclib::$UnionPetscLib, section::PetscSection, field::$PetscInt, sym::PetscSectionSym ) + + @chk ccall( + (:PetscSectionSetFieldSym, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, PetscSectionSym), + section, field, sym, + ) + + + return nothing +end + +""" + PetscSectionGetFieldSym(petsclib::PetscLibType,section::PetscSection, field::PetscInt, sym::PetscSectionSym) +Get the symmetries for the data referred to by a field of the section + +Collective + +Input Parameters: +- `section` - the section describing data layout +- `field` - the field number + +Output Parameter: +- `sym` - the symmetry describing the affect of orientation on the access of the data + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionSetFieldSym()`, `PetscSectionSymCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetFieldSym")) +""" +function PetscSectionGetFieldSym(petsclib::PetscLibType, section::PetscSection, field::PetscInt, sym::PetscSectionSym) end + +@for_petsc function PetscSectionGetFieldSym(petsclib::$UnionPetscLib, section::PetscSection, field::$PetscInt, sym::PetscSectionSym ) + + @chk ccall( + (:PetscSectionGetFieldSym, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{PetscSectionSym}), + section, field, sym, + ) + + + return nothing +end + +""" + perms::PetscInt,rots::PetscScalar = PetscSectionGetPointSyms(petsclib::PetscLibType,section::PetscSection, numPoints::PetscInt, points::PetscInt) +Get the symmetries for a set of points in a `PetscSection` under specific orientations. + +Not Collective + +Input Parameters: +- `section` - the section +- `numPoints` - the number of points +- `points` - an array of size 2 * `numPoints`, containing a list of (point, orientation) pairs. (An orientation is an +arbitrary integer: its interpretation is up to sym. Orientations are used by `DM`: for their interpretation in that +context, see `DMPlexGetConeOrientation()`). + +Output Parameters: +- `perms` - The permutations for the given orientations (or `NULL` if there is no symmetry or the permutation is the identity). +- `rots` - The field rotations symmetries for the given orientations (or `NULL` if there is no symmetry or the rotations are all +identity). + +Example of usage, gathering dofs into a local array (lArray) from a section array (sArray): +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionRestorePointSyms()`, `PetscSectionSymCreate()`, `PetscSectionSetSym()`, `PetscSectionGetSym()` + +# External Links +$(_doc_external("Vec/PetscSectionGetPointSyms")) +""" +function PetscSectionGetPointSyms(petsclib::PetscLibType, section::PetscSection, numPoints::PetscInt, points::PetscInt) end + +@for_petsc function PetscSectionGetPointSyms(petsclib::$UnionPetscLib, section::PetscSection, numPoints::$PetscInt, points::$PetscInt ) + perms_ = Ref{$PetscInt}() + rots_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscSectionGetPointSyms, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscScalar), + section, numPoints, points, perms_, rots_, + ) + + perms = perms_[] + rots = rots_[] + + return perms,rots +end + +""" + PetscSectionRestorePointSyms(petsclib::PetscLibType,section::PetscSection, numPoints::PetscInt, points::PetscInt, perms::PetscInt, rots::PetscScalar) +Restore the symmetries returned by `PetscSectionGetPointSyms()` + +Not Collective + +Input Parameters: +- `section` - the section +- `numPoints` - the number of points +- `points` - an array of size 2 * `numPoints`, containing a list of (point, orientation) pairs. (An orientation is an +arbitrary integer: its interpretation is up to sym. Orientations are used by `DM`: for their interpretation in that +context, see `DMPlexGetConeOrientation()`). +- `perms` - The permutations for the given orientations: set to `NULL` at conclusion +- `rots` - The field rotations symmetries for the given orientations: set to `NULL` at conclusion + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionGetPointSyms()`, `PetscSectionSymCreate()`, `PetscSectionSetSym()`, `PetscSectionGetSym()` + +# External Links +$(_doc_external("Vec/PetscSectionRestorePointSyms")) +""" +function PetscSectionRestorePointSyms(petsclib::PetscLibType, section::PetscSection, numPoints::PetscInt, points::PetscInt, perms::PetscInt, rots::PetscScalar) end + +@for_petsc function PetscSectionRestorePointSyms(petsclib::$UnionPetscLib, section::PetscSection, numPoints::$PetscInt, points::$PetscInt, perms::$PetscInt, rots::$PetscScalar ) + + @chk ccall( + (:PetscSectionRestorePointSyms, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscScalar), + section, numPoints, points, perms, rots, + ) + + + return nothing +end + +""" + perms::PetscInt,rots::PetscScalar = PetscSectionGetFieldPointSyms(petsclib::PetscLibType,section::PetscSection, field::PetscInt, numPoints::PetscInt, points::PetscInt) +Get the symmetries for a set of points in a field of a `PetscSection` under specific orientations. + +Not Collective + +Input Parameters: +- `section` - the section +- `field` - the field of the section +- `numPoints` - the number of points +- `points` - an array of size 2 * `numPoints`, containing a list of (point, orientation) pairs. (An orientation is an +arbitrary integer: its interpretation is up to sym. Orientations are used by `DM`: for their interpretation in that +context, see `DMPlexGetConeOrientation()`). + +Output Parameters: +- `perms` - The permutations for the given orientations (or `NULL` if there is no symmetry or the permutation is the identity). +- `rots` - The field rotations symmetries for the given orientations (or `NULL` if there is no symmetry or the rotations are all +identity). + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionGetPointSyms()`, `PetscSectionRestoreFieldPointSyms()` + +# External Links +$(_doc_external("Vec/PetscSectionGetFieldPointSyms")) +""" +function PetscSectionGetFieldPointSyms(petsclib::PetscLibType, section::PetscSection, field::PetscInt, numPoints::PetscInt, points::PetscInt) end + +@for_petsc function PetscSectionGetFieldPointSyms(petsclib::$UnionPetscLib, section::PetscSection, field::$PetscInt, numPoints::$PetscInt, points::$PetscInt ) + perms_ = Ref{$PetscInt}() + rots_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscSectionGetFieldPointSyms, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscScalar), + section, field, numPoints, points, perms_, rots_, + ) + + perms = perms_[] + rots = rots_[] + + return perms,rots +end + +""" + PetscSectionRestoreFieldPointSyms(petsclib::PetscLibType,section::PetscSection, field::PetscInt, numPoints::PetscInt, points::PetscInt, perms::PetscInt, rots::PetscScalar) +Restore the symmetries returned by `PetscSectionGetFieldPointSyms()` + +Not Collective + +Input Parameters: +- `section` - the section +- `field` - the field number +- `numPoints` - the number of points +- `points` - an array of size 2 * `numPoints`, containing a list of (point, orientation) pairs. (An orientation is an +arbitrary integer: its interpretation is up to sym. Orientations are used by `DM`: for their interpretation in that +context, see `DMPlexGetConeOrientation()`). +- `perms` - The permutations for the given orientations: set to NULL at conclusion +- `rots` - The field rotations symmetries for the given orientations: set to NULL at conclusion + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionRestorePointSyms()`, `petscSectionGetFieldPointSyms()`, `PetscSectionSymCreate()`, `PetscSectionSetSym()`, `PetscSectionGetSym()` + +# External Links +$(_doc_external("Vec/PetscSectionRestoreFieldPointSyms")) +""" +function PetscSectionRestoreFieldPointSyms(petsclib::PetscLibType, section::PetscSection, field::PetscInt, numPoints::PetscInt, points::PetscInt, perms::PetscInt, rots::PetscScalar) end + +@for_petsc function PetscSectionRestoreFieldPointSyms(petsclib::$UnionPetscLib, section::PetscSection, field::$PetscInt, numPoints::$PetscInt, points::$PetscInt, perms::$PetscInt, rots::$PetscScalar ) + + @chk ccall( + (:PetscSectionRestoreFieldPointSyms, $petsc_library), + PetscErrorCode, + (PetscSection, $PetscInt, $PetscInt, Ptr{$PetscInt}, $PetscInt, $PetscScalar), + section, field, numPoints, points, perms, rots, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscSectionGetUseFieldOffsets(petsclib::PetscLibType,s::PetscSection) +Get the flag indicating if field offsets are used directly in a global section, rather than just the point offset + +Not Collective + +Input Parameter: +- `s` - the global `PetscSection` + +Output Parameter: +- `flg` - the flag + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionSetChart()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionGetUseFieldOffsets")) +""" +function PetscSectionGetUseFieldOffsets(petsclib::PetscLibType, s::PetscSection) end + +@for_petsc function PetscSectionGetUseFieldOffsets(petsclib::$UnionPetscLib, s::PetscSection ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSectionGetUseFieldOffsets, $petsc_library), + PetscErrorCode, + (PetscSection, Ptr{PetscBool}), + s, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscSectionSetUseFieldOffsets(petsclib::PetscLibType,s::PetscSection, flg::PetscBool) +Set the flag to use field offsets directly in a global section, rather than just the point offset + +Not Collective + +Input Parameters: +- `s` - the global `PetscSection` +- `flg` - the flag + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionGetUseFieldOffsets()`, `PetscSectionSetChart()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSetUseFieldOffsets")) +""" +function PetscSectionSetUseFieldOffsets(petsclib::PetscLibType, s::PetscSection, flg::PetscBool) end + +@for_petsc function PetscSectionSetUseFieldOffsets(petsclib::$UnionPetscLib, s::PetscSection, flg::PetscBool ) + + @chk ccall( + (:PetscSectionSetUseFieldOffsets, $petsc_library), + PetscErrorCode, + (PetscSection, PetscBool), + s, flg, + ) + + + return nothing +end + +""" + PetscSectionVecView(petsclib::PetscLibType,s::PetscSection, v::PetscVec, viewer::PetscViewer) +View a vector, using the section to structure the values + +Collective + +Input Parameters: +- `s` - the organizing `PetscSection` +- `v` - the `Vec` +- `viewer` - the `PetscViewer` + +Level: developer + +-seealso: `PetscSection`, `PetscViewer`, `PetscSectionCreate()`, `VecSetValuesSection()`, `PetscSectionArrayView()` + +# External Links +$(_doc_external("Vec/PetscSectionVecView")) +""" +function PetscSectionVecView(petsclib::PetscLibType, s::PetscSection, v::PetscVec, viewer::PetscViewer) end + +@for_petsc function PetscSectionVecView(petsclib::$UnionPetscLib, s::PetscSection, v::PetscVec, viewer::PetscViewer ) + + @chk ccall( + (:PetscSectionVecView, $petsc_library), + PetscErrorCode, + (PetscSection, CVec, PetscViewer), + s, v, viewer, + ) + + + return nothing +end + +""" + val::Vector{PetscReal} = PetscSectionVecNorm(petsclib::PetscLibType,s::PetscSection, gs::PetscSection, x::PetscVec, type::NormType) +Computes the vector norm of each field + +Input Parameters: +- `s` - the local Section +- `gs` - the global section +- `x` - the vector +- `type` - one of `NORM_1`, `NORM_2`, `NORM_INFINITY`. + +Output Parameter: +- `val` - the array of norms + +Level: intermediate + +-seealso: `VecNorm()`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionVecNorm")) +""" +function PetscSectionVecNorm(petsclib::PetscLibType, s::PetscSection, gs::PetscSection, x::PetscVec, type::NormType) end + +@for_petsc function PetscSectionVecNorm(petsclib::$UnionPetscLib, s::PetscSection, gs::PetscSection, x::PetscVec, type::NormType ) + val = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscSectionVecNorm, $petsc_library), + PetscErrorCode, + (PetscSection, PetscSection, CVec, NormType, Ptr{$PetscReal}), + s, gs, x, type, val, + ) + + + return val +end + +""" + gsection::PetscSection = PetscSectionCreateGlobalSectionLabel(petsclib::PetscLibType,s::PetscSection, sf::PetscSF, includeConstraints::PetscBool, label::DMLabel, labelValue::PetscInt) +Create a section describing the global field layout using +the local section and an `PetscSF` describing the section point overlap. + +Collective + +Input Parameters: +- `s` - The `PetscSection` for the local field layout +- `sf` - The `PetscSF` describing parallel layout of the section points +- `includeConstraints` - By default this is `PETSC_FALSE`, meaning that the global field vector will not possess constrained dofs +- `label` - The label specifying the points +- `labelValue` - The label stratum specifying the points + +Output Parameter: +- `gsection` - The `PetscSection` for the global field layout + +Level: developer + +-seealso: `DMLabel`, `DM`, `PetscSectionCreate()` + +# External Links +$(_doc_external("Dm/PetscSectionCreateGlobalSectionLabel")) +""" +function PetscSectionCreateGlobalSectionLabel(petsclib::PetscLibType, s::PetscSection, sf::PetscSF, includeConstraints::PetscBool, label::DMLabel, labelValue::PetscInt) end + +@for_petsc function PetscSectionCreateGlobalSectionLabel(petsclib::$UnionPetscLib, s::PetscSection, sf::PetscSF, includeConstraints::PetscBool, label::DMLabel, labelValue::$PetscInt ) + gsection_ = Ref{PetscSection}() + + @chk ccall( + (:PetscSectionCreateGlobalSectionLabel, $petsc_library), + PetscErrorCode, + (PetscSection, PetscSF, PetscBool, DMLabel, $PetscInt, Ptr{PetscSection}), + s, sf, includeConstraints, label, labelValue, gsection_, + ) + + gsection = gsection_[] + + return gsection +end + +""" + sym::PetscSectionSym = PetscSectionSymCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty `PetscSectionSym` object. + +Collective + +Input Parameter: +- `comm` - the MPI communicator + +Output Parameter: +- `sym` - pointer to the new set of symmetries + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSection`, `PetscSectionSym`, `PetscSectionSymDestroy()` + +# External Links +$(_doc_external("Vec/PetscSectionSymCreate")) +""" +function PetscSectionSymCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscSectionSymCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + sym_ = Ref{PetscSectionSym}() + + @chk ccall( + (:PetscSectionSymCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscSectionSym}), + comm, sym_, + ) + + sym = sym_[] + + return sym +end + +""" + PetscSectionSymSetType(petsclib::PetscLibType,sym::PetscSectionSym, method::PetscSectionSymType) +Builds a `PetscSectionSym`, for a particular implementation. + +Collective + +Input Parameters: +- `sym` - The section symmetry object +- `method` - The name of the section symmetry type + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionSymType`, `PetscSectionSymGetType()`, `PetscSectionSymCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSymSetType")) +""" +function PetscSectionSymSetType(petsclib::PetscLibType, sym::PetscSectionSym, method::PetscSectionSymType) end + +@for_petsc function PetscSectionSymSetType(petsclib::$UnionPetscLib, sym::PetscSectionSym, method::PetscSectionSymType ) + + @chk ccall( + (:PetscSectionSymSetType, $petsc_library), + PetscErrorCode, + (PetscSectionSym, PetscSectionSymType), + sym, method, + ) + + + return nothing +end + +""" + type::PetscSectionSymType = PetscSectionSymGetType(petsclib::PetscLibType,sym::PetscSectionSym) +Gets the section symmetry type name (as a string) from the `PetscSectionSym`. + +Not Collective + +Input Parameter: +- `sym` - The section symmetry + +Output Parameter: +- `type` - The index set type name + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionSymType`, `PetscSectionSymSetType()`, `PetscSectionSymCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSymGetType")) +""" +function PetscSectionSymGetType(petsclib::PetscLibType, sym::PetscSectionSym) end + +@for_petsc function PetscSectionSymGetType(petsclib::$UnionPetscLib, sym::PetscSectionSym ) + type_ = Ref{PetscSectionSymType}() + + @chk ccall( + (:PetscSectionSymGetType, $petsc_library), + PetscErrorCode, + (PetscSectionSym, Ptr{PetscSectionSymType}), + sym, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PetscSectionSymRegister(petsclib::PetscLibType,sname::String, fnc::external) +Registers a new section symmetry implementation + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine itself + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionSymType`, `PetscSectionSymCreate()`, `PetscSectionSymSetType()` + +# External Links +$(_doc_external("Vec/PetscSectionSymRegister")) +""" +function PetscSectionSymRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscSectionSymRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscSectionSymRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscSectionSymDestroy(petsclib::PetscLibType,sym::PetscSectionSym) +Destroys a section symmetry. + +Collective + +Input Parameter: +- `sym` - the section symmetry + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionSymCreate()` + +# External Links +$(_doc_external("Vec/PetscSectionSymDestroy")) +""" +function PetscSectionSymDestroy(petsclib::PetscLibType, sym::PetscSectionSym) end + +@for_petsc function PetscSectionSymDestroy(petsclib::$UnionPetscLib, sym::PetscSectionSym ) + + @chk ccall( + (:PetscSectionSymDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscSectionSym},), + sym, + ) + + + return nothing +end + +""" + PetscSectionSymView(petsclib::PetscLibType,sym::PetscSectionSym, viewer::PetscViewer) +Displays a section symmetry + +Collective + +Input Parameters: +- `sym` - the index set +- `viewer` - viewer used to display the set, for example `PETSC_VIEWER_STDOUT_SELF`. + +Level: developer + +-seealso: `PetscSectionSym`, `PetscViewer`, `PetscViewerASCIIOpen()` + +# External Links +$(_doc_external("Vec/PetscSectionSymView")) +""" +function PetscSectionSymView(petsclib::PetscLibType, sym::PetscSectionSym, viewer::PetscViewer) end + +@for_petsc function PetscSectionSymView(petsclib::$UnionPetscLib, sym::PetscSectionSym, viewer::PetscViewer ) + + @chk ccall( + (:PetscSectionSymView, $petsc_library), + PetscErrorCode, + (PetscSectionSym, PetscViewer), + sym, viewer, + ) + + + return nothing +end + +""" + PetscSectionSymCopy(petsclib::PetscLibType,sym::PetscSectionSym, nsym::PetscSectionSym) +Copy the symmetries, assuming that the point structure is compatible + +Not Collective + +Input Parameter: +- `sym` - the `PetscSectionSym` + +Output Parameter: +- `nsym` - the equivalent symmetries + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionSymCreate()`, `PetscSectionSetSym()`, `PetscSectionGetSym()`, `PetscSectionSymLabelSetStratum()`, `PetscSectionGetPointSyms()` + +# External Links +$(_doc_external("Vec/PetscSectionSymCopy")) +""" +function PetscSectionSymCopy(petsclib::PetscLibType, sym::PetscSectionSym, nsym::PetscSectionSym) end + +@for_petsc function PetscSectionSymCopy(petsclib::$UnionPetscLib, sym::PetscSectionSym, nsym::PetscSectionSym ) + + @chk ccall( + (:PetscSectionSymCopy, $petsc_library), + PetscErrorCode, + (PetscSectionSym, PetscSectionSym), + sym, nsym, + ) + + + return nothing +end + +""" + PetscSectionSymDistribute(petsclib::PetscLibType,sym::PetscSectionSym, migrationSF::PetscSF, dsym::PetscSectionSym) +Distribute the symmetries in accordance with the input `PetscSF` + +Collective + +Input Parameters: +- `sym` - the `PetscSectionSym` +- `migrationSF` - the distribution map from roots to leaves + +Output Parameter: +- `dsym` - the redistributed symmetries + +Level: developer + +-seealso: [PetscSection](ch_petscsection), `PetscSectionSym`, `PetscSectionSymCreate()`, `PetscSectionSetSym()`, `PetscSectionGetSym()`, `PetscSectionSymLabelSetStratum()`, `PetscSectionGetPointSyms()` + +# External Links +$(_doc_external("Vec/PetscSectionSymDistribute")) +""" +function PetscSectionSymDistribute(petsclib::PetscLibType, sym::PetscSectionSym, migrationSF::PetscSF, dsym::PetscSectionSym) end + +@for_petsc function PetscSectionSymDistribute(petsclib::$UnionPetscLib, sym::PetscSectionSym, migrationSF::PetscSF, dsym::PetscSectionSym ) + + @chk ccall( + (:PetscSectionSymDistribute, $petsc_library), + PetscErrorCode, + (PetscSectionSym, PetscSF, Ptr{PetscSectionSym}), + sym, migrationSF, dsym, + ) + + + return nothing +end + +""" + PetscSectionSymLabelSetLabel(petsclib::PetscLibType,sym::PetscSectionSym, label::DMLabel) +set the label whose strata will define the points that receive symmetries + +Logically + +Input Parameters: +- `sym` - the section symmetries +- `label` - the `DMLabel` describing the types of points + +Level: developer: + +-seealso: `DMLabel`, `DM`, `PetscSectionSymLabelSetStratum()`, `PetscSectionSymCreateLabel()`, `PetscSectionGetPointSyms()` + +# External Links +$(_doc_external("Dm/PetscSectionSymLabelSetLabel")) +""" +function PetscSectionSymLabelSetLabel(petsclib::PetscLibType, sym::PetscSectionSym, label::DMLabel) end + +@for_petsc function PetscSectionSymLabelSetLabel(petsclib::$UnionPetscLib, sym::PetscSectionSym, label::DMLabel ) + + @chk ccall( + (:PetscSectionSymLabelSetLabel, $petsc_library), + PetscErrorCode, + (PetscSectionSym, DMLabel), + sym, label, + ) + + + return nothing +end + +""" + size::PetscInt,minOrient::PetscInt,maxOrient::PetscInt,perms::PetscInt,rots::PetscScalar = PetscSectionSymLabelGetStratum(petsclib::PetscLibType,sym::PetscSectionSym, stratum::PetscInt) +get the symmetries for the orientations of a stratum + +Logically Collective + +Input Parameters: +- `sym` - the section symmetries +- `stratum` - the stratum value in the label that we are assigning symmetries for + +Output Parameters: +- `size` - the number of dofs for points in the `stratum` of the label +- `minOrient` - the smallest orientation for a point in this `stratum` +- `maxOrient` - one greater than the largest orientation for a ppoint in this `stratum` (i.e., orientations are in the range [`minOrient`, `maxOrient`)) +- `perms` - `NULL` if there are no permutations, or (`maxOrient` - `minOrient`) permutations, one for each orientation. A `NULL` permutation is the identity +- `rots` - `NULL` if there are no rotations, or (`maxOrient` - `minOrient`) sets of rotations, one for each orientation. A `NULL` set of orientations is the identity + +Level: developer + +-seealso: `DMLabel`, `DM`, `PetscSectionSymLabelSetStratum()`, `PetscSectionSymCreate()`, `PetscSectionSetSym()`, `PetscSectionGetPointSyms()`, `PetscSectionSymCreateLabel()` + +# External Links +$(_doc_external("Dm/PetscSectionSymLabelGetStratum")) +""" +function PetscSectionSymLabelGetStratum(petsclib::PetscLibType, sym::PetscSectionSym, stratum::PetscInt) end + +@for_petsc function PetscSectionSymLabelGetStratum(petsclib::$UnionPetscLib, sym::PetscSectionSym, stratum::$PetscInt ) + size_ = Ref{$PetscInt}() + minOrient_ = Ref{$PetscInt}() + maxOrient_ = Ref{$PetscInt}() + perms_ = Ref{$PetscInt}() + rots_ = Ref{$PetscScalar}() + + @chk ccall( + (:PetscSectionSymLabelGetStratum, $petsc_library), + PetscErrorCode, + (PetscSectionSym, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt, $PetscScalar), + sym, stratum, size_, minOrient_, maxOrient_, perms_, rots_, + ) + + size = size_[] + minOrient = minOrient_[] + maxOrient = maxOrient_[] + perms = perms_[] + rots = rots_[] + + return size,minOrient,maxOrient,perms,rots +end + +""" + PetscSectionSymLabelSetStratum(petsclib::PetscLibType,sym::PetscSectionSym, stratum::PetscInt, size::PetscInt, minOrient::PetscInt, maxOrient::PetscInt, mode::PetscCopyMode, perms::PetscInt, rots::PetscScalar) +set the symmetries for the orientations of a stratum + +Logically + +Input Parameters: +- `sym` - the section symmetries +- `stratum` - the stratum value in the label that we are assigning symmetries for +- `size` - the number of dofs for points in the `stratum` of the label +- `minOrient` - the smallest orientation for a point in this `stratum` +- `maxOrient` - one greater than the largest orientation for a point in this `stratum` (i.e., orientations are in the range [`minOrient`, `maxOrient`)) +- `mode` - how `sym` should copy the `perms` and `rots` arrays +- `perms` - `NULL` if there are no permutations, or (`maxOrient` - `minOrient`) permutations, one for each orientation. A `NULL` permutation is the identity +- `rots` - `NULL` if there are no rotations, or (`maxOrient` - `minOrient`) sets of rotations, one for each orientation. A `NULL` set of orientations is the identity + +Level: developer + +-seealso: `DMLabel`, `DM`, `PetscSectionSymLabelGetStratum()`, `PetscSectionSymCreate()`, `PetscSectionSetSym()`, `PetscSectionGetPointSyms()`, `PetscSectionSymCreateLabel()` + +# External Links +$(_doc_external("Dm/PetscSectionSymLabelSetStratum")) +""" +function PetscSectionSymLabelSetStratum(petsclib::PetscLibType, sym::PetscSectionSym, stratum::PetscInt, size::PetscInt, minOrient::PetscInt, maxOrient::PetscInt, mode::PetscCopyMode, perms::PetscInt, rots::PetscScalar) end + +@for_petsc function PetscSectionSymLabelSetStratum(petsclib::$UnionPetscLib, sym::PetscSectionSym, stratum::$PetscInt, size::$PetscInt, minOrient::$PetscInt, maxOrient::$PetscInt, mode::PetscCopyMode, perms::$PetscInt, rots::$PetscScalar ) + + @chk ccall( + (:PetscSectionSymLabelSetStratum, $petsc_library), + PetscErrorCode, + (PetscSectionSym, $PetscInt, $PetscInt, $PetscInt, $PetscInt, PetscCopyMode, $PetscInt, $PetscScalar), + sym, stratum, size, minOrient, maxOrient, mode, perms, rots, + ) + + + return nothing +end + +""" + sym::PetscSectionSym = PetscSectionSymCreateLabel(petsclib::PetscLibType,comm::MPI_Comm, label::DMLabel) +Create a section symmetry that assigns one symmetry to each stratum of a label + +Collective + +Input Parameters: +- `comm` - the MPI communicator for the new symmetry +- `label` - the label defining the strata + +Output Parameter: +- `sym` - the section symmetries + +Level: developer + +-seealso: `DMLabel`, `DM`, `PetscSectionSymCreate()`, `PetscSectionSetSym()`, `PetscSectionGetSym()`, `PetscSectionSymLabelSetStratum()`, `PetscSectionGetPointSyms()` + +# External Links +$(_doc_external("Dm/PetscSectionSymCreateLabel")) +""" +function PetscSectionSymCreateLabel(petsclib::PetscLibType, comm::MPI_Comm, label::DMLabel) end + +@for_petsc function PetscSectionSymCreateLabel(petsclib::$UnionPetscLib, comm::MPI_Comm, label::DMLabel ) + sym_ = Ref{PetscSectionSym}() + + @chk ccall( + (:PetscSectionSymCreateLabel, $petsc_library), + PetscErrorCode, + (MPI_Comm, DMLabel, Ptr{PetscSectionSym}), + comm, label, sym_, + ) + + sym = sym_[] + + return sym +end + diff --git a/src/autowrapped/PetscSegBuffer_wrappers.jl b/src/autowrapped/PetscSegBuffer_wrappers.jl new file mode 100644 index 00000000..68368227 --- /dev/null +++ b/src/autowrapped/PetscSegBuffer_wrappers.jl @@ -0,0 +1,298 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscSegBuffer end +const PetscSegBuffer = Ptr{_n_PetscSegBuffer} +# ------------------------------------------------------- +""" + seg::PetscSegBuffer = PetscSegBufferCreate(petsclib::PetscLibType,unitbytes::Csize_t, expected::PetscCount) +create a segmented buffer + +Not Collective, No Fortran Support + +Input Parameters: +- `unitbytes` - number of bytes that each entry will contain +- `expected` - expected/typical number of entries + +Output Parameter: +- `seg` - `PetscSegBuffer` object + +Level: developer + +-seealso: `PetscSegBufferGet()`, `PetscSegBufferExtractAlloc()`, `PetscSegBufferExtractTo()`, `PetscSegBufferExtractInPlace()`, `PetscSegBufferDestroy()`, +`PetscSegBuffer` + +# External Links +$(_doc_external("Sys/PetscSegBufferCreate")) +""" +function PetscSegBufferCreate(petsclib::PetscLibType, unitbytes::Csize_t, expected::PetscCount) end + +@for_petsc function PetscSegBufferCreate(petsclib::$UnionPetscLib, unitbytes::Csize_t, expected::PetscCount ) + seg_ = Ref{PetscSegBuffer}() + + @chk ccall( + (:PetscSegBufferCreate, $petsc_library), + PetscErrorCode, + (Csize_t, PetscCount, Ptr{PetscSegBuffer}), + unitbytes, expected, seg_, + ) + + seg = seg_[] + + return seg +end + +""" + PetscSegBufferGet(petsclib::PetscLibType,seg::PetscSegBuffer, count::PetscCount, buf::Cvoid) +get new buffer space from a segmented buffer + +Not Collective, No Fortran Support + +Input Parameters: +- `seg` - `PetscSegBuffer` buffer +- `count` - number of entries needed + +Output Parameter: +- `buf` - address of new buffer for contiguous data + +Level: developer + +-seealso: `PetscSegBufferCreate()`, `PetscSegBufferExtractAlloc()`, `PetscSegBufferExtractTo()`, `PetscSegBufferExtractInPlace()`, `PetscSegBufferDestroy()`, +`PetscSegBuffer`, `PetscSegBufferGetInts()` + +# External Links +$(_doc_external("Sys/PetscSegBufferGet")) +""" +function PetscSegBufferGet(petsclib::PetscLibType, seg::PetscSegBuffer, count::PetscCount, buf::Cvoid) end + +@for_petsc function PetscSegBufferGet(petsclib::$UnionPetscLib, seg::PetscSegBuffer, count::PetscCount, buf::Cvoid ) + + @chk ccall( + (:PetscSegBufferGet, $petsc_library), + PetscErrorCode, + (PetscSegBuffer, PetscCount, Ptr{Cvoid}), + seg, count, buf, + ) + + + return nothing +end + +""" + PetscSegBufferDestroy(petsclib::PetscLibType,seg::PetscSegBuffer) +destroy segmented buffer + +Not Collective, No Fortran Support + +Input Parameter: +- `seg` - address of segmented buffer object + +Level: developer + +-seealso: `PetscSegBuffer`, `PetscSegBufferCreate()` + +# External Links +$(_doc_external("Sys/PetscSegBufferDestroy")) +""" +function PetscSegBufferDestroy(petsclib::PetscLibType, seg::PetscSegBuffer) end + +@for_petsc function PetscSegBufferDestroy(petsclib::$UnionPetscLib, seg::PetscSegBuffer ) + + @chk ccall( + (:PetscSegBufferDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscSegBuffer},), + seg, + ) + + + return nothing +end + +""" + PetscSegBufferExtractTo(petsclib::PetscLibType,seg::PetscSegBuffer, contig::Cvoid) +extract contiguous data to provided buffer and reset segmented buffer + +Not Collective, No Fortran Support + +Input Parameters: +- `seg` - segmented buffer +- `contig` - allocated buffer to hold contiguous data + +Level: developer + +-seealso: `PetscSegBufferCreate()`, `PetscSegBufferGet()`, `PetscSegBufferDestroy()`, `PetscSegBufferExtractAlloc()`, `PetscSegBufferExtractInPlace()`, +`PetscSegBuffer` + +# External Links +$(_doc_external("Sys/PetscSegBufferExtractTo")) +""" +function PetscSegBufferExtractTo(petsclib::PetscLibType, seg::PetscSegBuffer, contig::Cvoid) end + +@for_petsc function PetscSegBufferExtractTo(petsclib::$UnionPetscLib, seg::PetscSegBuffer, contig::Cvoid ) + + @chk ccall( + (:PetscSegBufferExtractTo, $petsc_library), + PetscErrorCode, + (PetscSegBuffer, Ptr{Cvoid}), + seg, contig, + ) + + + return nothing +end + +""" + PetscSegBufferExtractAlloc(petsclib::PetscLibType,seg::PetscSegBuffer, contiguous::Cvoid) +extract contiguous data to new allocation and reset segmented buffer + +Not Collective, No Fortran Support + +Input Parameter: +- `seg` - `PetscSegBuffer` buffer + +Output Parameter: +- `contiguous` - address of new array containing contiguous data, caller frees with `PetscFree()` + +Level: developer + +-seealso: `PetscSegBufferCreate()`, `PetscSegBufferGet()`, `PetscSegBufferDestroy()`, `PetscSegBufferExtractTo()`, `PetscSegBufferExtractInPlace()`, +`PetscSegBuffer` + +# External Links +$(_doc_external("Sys/PetscSegBufferExtractAlloc")) +""" +function PetscSegBufferExtractAlloc(petsclib::PetscLibType, seg::PetscSegBuffer, contiguous::Cvoid) end + +@for_petsc function PetscSegBufferExtractAlloc(petsclib::$UnionPetscLib, seg::PetscSegBuffer, contiguous::Cvoid ) + + @chk ccall( + (:PetscSegBufferExtractAlloc, $petsc_library), + PetscErrorCode, + (PetscSegBuffer, Ptr{Cvoid}), + seg, contiguous, + ) + + + return nothing +end + +""" + PetscSegBufferExtractInPlace(petsclib::PetscLibType,seg::PetscSegBuffer, contig::Cvoid) +extract in + +Not Collective, No Fortran Support + +Input Parameter: +- `seg` - `PetscSegBuffer` object + +Output Parameter: +- `contig` - address of pointer to contiguous memory, may be `NULL` + +Level: developer + +-seealso: `PetscSegBuffer`, `PetscSegBufferExtractAlloc()`, `PetscSegBufferExtractTo()` + +# External Links +$(_doc_external("Sys/PetscSegBufferExtractInPlace")) +""" +function PetscSegBufferExtractInPlace(petsclib::PetscLibType, seg::PetscSegBuffer, contig::Cvoid) end + +@for_petsc function PetscSegBufferExtractInPlace(petsclib::$UnionPetscLib, seg::PetscSegBuffer, contig::Cvoid ) + + @chk ccall( + (:PetscSegBufferExtractInPlace, $petsc_library), + PetscErrorCode, + (PetscSegBuffer, Ptr{Cvoid}), + seg, contig, + ) + + + return nothing +end + +""" + PetscSegBufferGetSize(petsclib::PetscLibType,seg::PetscSegBuffer, usedsize::PetscCount) +get currently used number of entries of a `PetscSegBuffer` + +Not Collective, No Fortran Support + +Input Parameter: +- `seg` - `PetscSegBuffer` object + +Output Parameter: +- `usedsize` - number of used units + +Level: developer + +-seealso: `PetscSegBuffer`, `PetscSegBufferExtractAlloc()`, `PetscSegBufferExtractTo()`, `PetscSegBufferCreate()`, `PetscSegBufferGet()` + +# External Links +$(_doc_external("Sys/PetscSegBufferGetSize")) +""" +function PetscSegBufferGetSize(petsclib::PetscLibType, seg::PetscSegBuffer, usedsize::PetscCount) end + +@for_petsc function PetscSegBufferGetSize(petsclib::$UnionPetscLib, seg::PetscSegBuffer, usedsize::PetscCount ) + + @chk ccall( + (:PetscSegBufferGetSize, $petsc_library), + PetscErrorCode, + (PetscSegBuffer, Ptr{PetscCount}), + seg, usedsize, + ) + + + return nothing +end + +""" + PetscSegBufferUnuse(petsclib::PetscLibType,seg::PetscSegBuffer, unused::PetscCount) +return some unused entries obtained with an overzealous `PetscSegBufferGet()` + +Not Collective, No Fortran Support + +Input Parameters: +- `seg` - `PetscSegBuffer` object +- `unused` - number of unused units to return + +Level: developer + +-seealso: `PetscSegBuffer`, `PetscSegBufferCreate()`, `PetscSegBufferGet()` + +# External Links +$(_doc_external("Sys/PetscSegBufferUnuse")) +""" +function PetscSegBufferUnuse(petsclib::PetscLibType, seg::PetscSegBuffer, unused::PetscCount) end + +@for_petsc function PetscSegBufferUnuse(petsclib::$UnionPetscLib, seg::PetscSegBuffer, unused::PetscCount ) + + @chk ccall( + (:PetscSegBufferUnuse, $petsc_library), + PetscErrorCode, + (PetscSegBuffer, PetscCount), + seg, unused, + ) + + + return nothing +end + +""" + PetscSegBufferGetInts(petsclib::PetscLibType,seg::PetscSegBuffer, count::PetscCount, slot::PetscInt) + +# External Links +$(_doc_external("Sys/PetscSegBufferGetInts")) +""" +function PetscSegBufferGetInts(petsclib::PetscLibType, seg::PetscSegBuffer, count::PetscCount, slot::PetscInt) end + +@for_petsc function PetscSegBufferGetInts(petsclib::$UnionPetscLib, seg::PetscSegBuffer, count::PetscCount, slot::$PetscInt ) + + @chk ccall( + (:PetscSegBufferGetInts, $petsc_library), + PetscErrorCode, + (PetscSegBuffer, PetscCount, $PetscInt), + seg, count, slot, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscSpace_wrappers.jl b/src/autowrapped/PetscSpace_wrappers.jl new file mode 100644 index 00000000..f56de721 --- /dev/null +++ b/src/autowrapped/PetscSpace_wrappers.jl @@ -0,0 +1,1247 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscSpace end +const PetscSpace = Ptr{_n_PetscSpace} + +mutable struct _n_PetscDualSpace end +const PetscDualSpace = Ptr{_n_PetscDualSpace} + +# ------------------------------------------------------- +""" + PetscSpaceRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a new `PetscSpace` implementation + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - The name of a new user-defined creation routine +- `function` - The creation routine for the implementation type + +-seealso: `PetscSpace`, `PetscSpaceRegisterAll()`, `PetscSpaceRegisterDestroy()` + +# External Links +$(_doc_external("DM/PetscSpaceRegister")) +""" +function PetscSpaceRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscSpaceRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscSpaceRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + PetscSpaceSetType(petsclib::PetscLibType,sp::PetscSpace, name::PetscSpaceType) +Builds a particular `PetscSpace` + +Collective + +Input Parameters: +- `sp` - The `PetscSpace` object +- `name` - The kind of space + +Options Database Key: +- `-petscspace_type ` - Sets the `PetscSpace` type; use -help for a list of available types + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceType`, `PetscSpaceGetType()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceSetType")) +""" +function PetscSpaceSetType(petsclib::PetscLibType, sp::PetscSpace, name::PetscSpaceType) end + +@for_petsc function PetscSpaceSetType(petsclib::$UnionPetscLib, sp::PetscSpace, name::PetscSpaceType ) + + @chk ccall( + (:PetscSpaceSetType, $petsc_library), + PetscErrorCode, + (PetscSpace, PetscSpaceType), + sp, name, + ) + + + return nothing +end + +""" + name::PetscSpaceType = PetscSpaceGetType(petsclib::PetscLibType,sp::PetscSpace) +Gets the `PetscSpaceType` (as a string) from the object. + +Not Collective + +Input Parameter: +- `sp` - The `PetscSpace` + +Output Parameter: +- `name` - The `PetscSpace` type name + +Level: intermediate + +-seealso: `PetscSpaceType`, `PetscSpace`, `PetscSpaceSetType()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceGetType")) +""" +function PetscSpaceGetType(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceGetType(petsclib::$UnionPetscLib, sp::PetscSpace ) + name_ = Ref{PetscSpaceType}() + + @chk ccall( + (:PetscSpaceGetType, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{PetscSpaceType}), + sp, name_, + ) + + name = unsafe_string(name_[]) + + return name +end + +""" + PetscSpaceViewFromOptions(petsclib::PetscLibType,A::PetscSpace, obj::PetscObject, name::String) +View a `PetscSpace` based on values in the options database + +Collective + +Input Parameters: +- `A` - the `PetscSpace` object +- `obj` - Optional object that provides the options name prefix +- `name` - command line option name + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceView()`, `PetscObjectViewFromOptions()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceViewFromOptions")) +""" +function PetscSpaceViewFromOptions(petsclib::PetscLibType, A::PetscSpace, obj::PetscObject, name::String) end + +@for_petsc function PetscSpaceViewFromOptions(petsclib::$UnionPetscLib, A::PetscSpace, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscSpaceViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscSpace, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscSpaceView(petsclib::PetscLibType,sp::PetscSpace, v::PetscViewer) +Views a `PetscSpace` + +Collective + +Input Parameters: +- `sp` - the `PetscSpace` object to view +- `v` - the viewer + +Level: beginner + +-seealso: `PetscSpace`, `PetscViewer`, `PetscSpaceViewFromOptions()`, `PetscSpaceDestroy()` + +# External Links +$(_doc_external("DM/PetscSpaceView")) +""" +function PetscSpaceView(petsclib::PetscLibType, sp::PetscSpace, v::PetscViewer) end + +@for_petsc function PetscSpaceView(petsclib::$UnionPetscLib, sp::PetscSpace, v::PetscViewer ) + + @chk ccall( + (:PetscSpaceView, $petsc_library), + PetscErrorCode, + (PetscSpace, PetscViewer), + sp, v, + ) + + + return nothing +end + +""" + PetscSpaceSetFromOptions(petsclib::PetscLibType,sp::PetscSpace) +sets parameters in a `PetscSpace` from the options database + +Collective + +Input Parameter: +- `sp` - the `PetscSpace` object to set options for + +Options Database Keys: +- `-petscspace_degree ` - the approximation order of the space +- `-petscspace_variables ` - the number of different variables, e.g. x and y +- `-petscspace_components ` - the number of components, say d for a vector field + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceView()` + +# External Links +$(_doc_external("DM/PetscSpaceSetFromOptions")) +""" +function PetscSpaceSetFromOptions(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceSetFromOptions(petsclib::$UnionPetscLib, sp::PetscSpace ) + + @chk ccall( + (:PetscSpaceSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscSpace,), + sp, + ) + + + return nothing +end + +""" + PetscSpaceSetUp(petsclib::PetscLibType,sp::PetscSpace) +Construct data structures for the `PetscSpace` + +Collective + +Input Parameter: +- `sp` - the `PetscSpace` object to setup + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceView()`, `PetscSpaceDestroy()` + +# External Links +$(_doc_external("DM/PetscSpaceSetUp")) +""" +function PetscSpaceSetUp(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceSetUp(petsclib::$UnionPetscLib, sp::PetscSpace ) + + @chk ccall( + (:PetscSpaceSetUp, $petsc_library), + PetscErrorCode, + (PetscSpace,), + sp, + ) + + + return nothing +end + +""" + PetscSpaceDestroy(petsclib::PetscLibType,sp::PetscSpace) +Destroys a `PetscSpace` object + +Collective + +Input Parameter: +- `sp` - the `PetscSpace` object to destroy + +Level: beginner + +-seealso: `PetscSpace`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceDestroy")) +""" +function PetscSpaceDestroy(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceDestroy(petsclib::$UnionPetscLib, sp::PetscSpace ) + + @chk ccall( + (:PetscSpaceDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscSpace},), + sp, + ) + + + return nothing +end + +""" + sp::PetscSpace = PetscSpaceCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates an empty `PetscSpace` object. The type can then be set with `PetscSpaceSetType()`. + +Collective + +Input Parameter: +- `comm` - The communicator for the `PetscSpace` object + +Output Parameter: +- `sp` - The `PetscSpace` object + +Level: beginner + +-seealso: `PetscSpace`, `PetscSpaceSetType()`, `PETSCSPACEPOLYNOMIAL` + +# External Links +$(_doc_external("DM/PetscSpaceCreate")) +""" +function PetscSpaceCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscSpaceCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + sp_ = Ref{PetscSpace}() + + @chk ccall( + (:PetscSpaceCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscSpace}), + comm, sp_, + ) + + sp = sp_[] + + return sp +end + +""" + dim::PetscInt = PetscSpaceGetDimension(petsclib::PetscLibType,sp::PetscSpace) +Return the dimension of this space, i.e. the number of basis vectors + +Input Parameter: +- `sp` - The `PetscSpace` + +Output Parameter: +- `dim` - The dimension + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceGetDegree()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceGetDimension")) +""" +function PetscSpaceGetDimension(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceGetDimension(petsclib::$UnionPetscLib, sp::PetscSpace ) + dim_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSpaceGetDimension, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{$PetscInt}), + sp, dim_, + ) + + dim = dim_[] + + return dim +end + +""" + minDegree::PetscInt,maxDegree::PetscInt = PetscSpaceGetDegree(petsclib::PetscLibType,sp::PetscSpace) +Return the polynomial degrees that characterize this space + +Input Parameter: +- `sp` - The `PetscSpace` + +Output Parameters: +- `minDegree` - The degree of the largest polynomial space contained in the space, pass `NULL` if not needed +- `maxDegree` - The degree of the smallest polynomial space containing the space, pass `NULL` if not needed + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceSetDegree()`, `PetscSpaceGetDimension()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceGetDegree")) +""" +function PetscSpaceGetDegree(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceGetDegree(petsclib::$UnionPetscLib, sp::PetscSpace ) + minDegree_ = Ref{$PetscInt}() + maxDegree_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSpaceGetDegree, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{$PetscInt}, Ptr{$PetscInt}), + sp, minDegree_, maxDegree_, + ) + + minDegree = minDegree_[] + maxDegree = maxDegree_[] + + return minDegree,maxDegree +end + +""" + PetscSpaceSetDegree(petsclib::PetscLibType,sp::PetscSpace, degree::PetscInt, maxDegree::PetscInt) +Set the degree of approximation for this space. + +Input Parameters: +- `sp` - The `PetscSpace` +- `degree` - The degree of the largest polynomial space contained in the space +- `maxDegree` - The degree of the largest polynomial space containing the space. One of degree and maxDegree can be `PETSC_DETERMINE`. + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceGetDegree()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceSetDegree")) +""" +function PetscSpaceSetDegree(petsclib::PetscLibType, sp::PetscSpace, degree::PetscInt, maxDegree::PetscInt) end + +@for_petsc function PetscSpaceSetDegree(petsclib::$UnionPetscLib, sp::PetscSpace, degree::$PetscInt, maxDegree::$PetscInt ) + + @chk ccall( + (:PetscSpaceSetDegree, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt, $PetscInt), + sp, degree, maxDegree, + ) + + + return nothing +end + +""" + Nc::PetscInt = PetscSpaceGetNumComponents(petsclib::PetscLibType,sp::PetscSpace) +Return the number of components for this space + +Input Parameter: +- `sp` - The `PetscSpace` + +Output Parameter: +- `Nc` - The number of components + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceSetNumComponents()`, `PetscSpaceGetNumVariables()`, `PetscSpaceGetDimension()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceGetNumComponents")) +""" +function PetscSpaceGetNumComponents(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceGetNumComponents(petsclib::$UnionPetscLib, sp::PetscSpace ) + Nc_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSpaceGetNumComponents, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{$PetscInt}), + sp, Nc_, + ) + + Nc = Nc_[] + + return Nc +end + +""" + PetscSpaceSetNumComponents(petsclib::PetscLibType,sp::PetscSpace, Nc::PetscInt) +Set the number of components for this space + +Input Parameters: +- `sp` - The `PetscSpace` +- `Nc` - The number of components + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceGetNumComponents()`, `PetscSpaceSetNumVariables()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceSetNumComponents")) +""" +function PetscSpaceSetNumComponents(petsclib::PetscLibType, sp::PetscSpace, Nc::PetscInt) end + +@for_petsc function PetscSpaceSetNumComponents(petsclib::$UnionPetscLib, sp::PetscSpace, Nc::$PetscInt ) + + @chk ccall( + (:PetscSpaceSetNumComponents, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt), + sp, Nc, + ) + + + return nothing +end + +""" + PetscSpaceSetNumVariables(petsclib::PetscLibType,sp::PetscSpace, n::PetscInt) +Set the number of variables for this space + +Input Parameters: +- `sp` - The `PetscSpace` +- `n` - The number of variables, e.g. x, y, z... + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceGetNumVariables()`, `PetscSpaceSetNumComponents()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceSetNumVariables")) +""" +function PetscSpaceSetNumVariables(petsclib::PetscLibType, sp::PetscSpace, n::PetscInt) end + +@for_petsc function PetscSpaceSetNumVariables(petsclib::$UnionPetscLib, sp::PetscSpace, n::$PetscInt ) + + @chk ccall( + (:PetscSpaceSetNumVariables, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt), + sp, n, + ) + + + return nothing +end + +""" + n::PetscInt = PetscSpaceGetNumVariables(petsclib::PetscLibType,sp::PetscSpace) +Return the number of variables for this space + +Input Parameter: +- `sp` - The `PetscSpace` + +Output Parameter: +- `n` - The number of variables, e.g. x, y, z... + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpaceSetNumVariables()`, `PetscSpaceGetNumComponents()`, `PetscSpaceGetDimension()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceGetNumVariables")) +""" +function PetscSpaceGetNumVariables(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceGetNumVariables(petsclib::$UnionPetscLib, sp::PetscSpace ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSpaceGetNumVariables, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{$PetscInt}), + sp, n_, + ) + + n = n_[] + + return n +end + +""" + B::Vector{PetscReal},D::Vector{PetscReal},H::Vector{PetscReal} = PetscSpaceEvaluate(petsclib::PetscLibType,sp::PetscSpace, npoints::PetscInt, points::Vector{PetscReal}) +Evaluate the basis functions and their derivatives (jet) at each point + +Input Parameters: +- `sp` - The `PetscSpace` +- `npoints` - The number of evaluation points, in reference coordinates +- `points` - The point coordinates + +Output Parameters: +- `B` - The function evaluations in a `npoints` x `nfuncs` array +- `D` - The derivative evaluations in a `npoints` x `nfuncs` x `dim` array +- `H` - The second derivative evaluations in a `npoints` x `nfuncs` x `dim` x `dim` array + +Level: beginner + +-seealso: `PetscSpace`, `PetscFECreateTabulation()`, `PetscFEGetCellTabulation()`, `PetscSpaceCreate()` + +# External Links +$(_doc_external("DM/PetscSpaceEvaluate")) +""" +function PetscSpaceEvaluate(petsclib::PetscLibType, sp::PetscSpace, npoints::PetscInt, points::Vector{PetscReal}) end + +@for_petsc function PetscSpaceEvaluate(petsclib::$UnionPetscLib, sp::PetscSpace, npoints::$PetscInt, points::Vector{$PetscReal} ) + B = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + D = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + H = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscSpaceEvaluate, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + sp, npoints, points, B, D, H, + ) + + + return B,D,H +end + +""" + PetscSpaceGetHeightSubspace(petsclib::PetscLibType,sp::PetscSpace, height::PetscInt, subsp::PetscSpace) +Get the subset of the primal space basis that is supported on a mesh point of a given height. + +Not Collective + +Input Parameters: +- `sp` - the `PetscSpace` object +- `height` - the height of the mesh point for which the subspace is desired + +Output Parameter: +- `subsp` - the subspace + +Level: advanced + +-seealso: `PetscDualSpaceGetHeightSubspace()`, `PetscSpace` + +# External Links +$(_doc_external("DM/PetscSpaceGetHeightSubspace")) +""" +function PetscSpaceGetHeightSubspace(petsclib::PetscLibType, sp::PetscSpace, height::PetscInt, subsp::PetscSpace) end + +@for_petsc function PetscSpaceGetHeightSubspace(petsclib::$UnionPetscLib, sp::PetscSpace, height::$PetscInt, subsp::PetscSpace ) + + @chk ccall( + (:PetscSpaceGetHeightSubspace, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt, Ptr{PetscSpace}), + sp, height, subsp, + ) + + + return nothing +end + +""" + subspace::PetscSpace = PetscSpaceCreateSubspace(petsclib::PetscLibType,origSpace::PetscSpace, dualSubspace::PetscDualSpace, x::PetscReal, Jx::PetscReal, u::PetscReal, Ju::PetscReal, copymode::PetscCopyMode) +creates a subspace from a an `origSpace` and its dual `dualSubspace` + +Input Parameters: +- `origSpace` - the original `PetscSpace` +- `dualSubspace` - no idea +- `x` - no idea +- `Jx` - no idea +- `u` - no idea +- `Ju` - no idea +- `copymode` - whether to copy, borrow, or own some of the input arrays I guess + +Output Parameter: +- `subspace` - the subspace + +Level: advanced + +-seealso: `PetscSpace`, `PetscDualSpace`, `PetscCopyMode`, `PetscSpaceType` + +# External Links +$(_doc_external("DM/PetscSpaceCreateSubspace")) +""" +function PetscSpaceCreateSubspace(petsclib::PetscLibType, origSpace::PetscSpace, dualSubspace::PetscDualSpace, x::PetscReal, Jx::PetscReal, u::PetscReal, Ju::PetscReal, copymode::PetscCopyMode) end + +@for_petsc function PetscSpaceCreateSubspace(petsclib::$UnionPetscLib, origSpace::PetscSpace, dualSubspace::PetscDualSpace, x::$PetscReal, Jx::$PetscReal, u::$PetscReal, Ju::$PetscReal, copymode::PetscCopyMode ) + subspace_ = Ref{PetscSpace}() + + @chk ccall( + (:PetscSpaceCreateSubspace, $petsc_library), + PetscErrorCode, + (PetscSpace, PetscDualSpace, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, PetscCopyMode, Ptr{PetscSpace}), + origSpace, dualSubspace, x, Jx, u, Ju, copymode, subspace_, + ) + + subspace = subspace_[] + + return subspace +end + +""" + PetscSpacePointSetPoints(petsclib::PetscLibType,sp::PetscSpace, q::PetscQuadrature) +Sets the evaluation points for the space to coincide with the points of a quadrature rule + +Logically Collective + +Input Parameters: +- `sp` - The `PetscSpace` +- `q` - The `PetscQuadrature` defining the points + +Level: intermediate + +-seealso: `PetscSpace`, `PetscQuadrature`, `PetscSpaceCreate()`, `PetscSpaceSetType()` + +# External Links +$(_doc_external("DM/PetscSpacePointSetPoints")) +""" +function PetscSpacePointSetPoints(petsclib::PetscLibType, sp::PetscSpace, q::PetscQuadrature) end + +@for_petsc function PetscSpacePointSetPoints(petsclib::$UnionPetscLib, sp::PetscSpace, q::PetscQuadrature ) + + @chk ccall( + (:PetscSpacePointSetPoints, $petsc_library), + PetscErrorCode, + (PetscSpace, PetscQuadrature), + sp, q, + ) + + + return nothing +end + +""" + PetscSpacePointGetPoints(petsclib::PetscLibType,sp::PetscSpace, q::PetscQuadrature) +Gets the evaluation points for the space as the points of a quadrature rule + +Logically Collective + +Input Parameter: +- `sp` - The `PetscSpace` + +Output Parameter: +- `q` - The `PetscQuadrature` defining the points + +Level: intermediate + +-seealso: `PetscSpace`, `PetscQuadrature`, `PetscSpaceCreate()`, `PetscSpaceSetType()` + +# External Links +$(_doc_external("DM/PetscSpacePointGetPoints")) +""" +function PetscSpacePointGetPoints(petsclib::PetscLibType, sp::PetscSpace, q::PetscQuadrature) end + +@for_petsc function PetscSpacePointGetPoints(petsclib::$UnionPetscLib, sp::PetscSpace, q::PetscQuadrature ) + + @chk ccall( + (:PetscSpacePointGetPoints, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{PetscQuadrature}), + sp, q, + ) + + + return nothing +end + +""" + numSumSpaces::PetscInt = PetscSpaceSumGetNumSubspaces(petsclib::PetscLibType,sp::PetscSpace) +Get the number of spaces in the sum space + +Input Parameter: +- `sp` - the function space object + +Output Parameter: +- `numSumSpaces` - the number of spaces + +Level: intermediate + +-seealso: `PETSCSPACESUM`, `PetscSpace`, `PetscSpaceSumSetNumSubspaces()`, `PetscSpaceSetDegree()`, `PetscSpaceSetNumVariables()` + +# External Links +$(_doc_external("DM/PetscSpaceSumGetNumSubspaces")) +""" +function PetscSpaceSumGetNumSubspaces(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceSumGetNumSubspaces(petsclib::$UnionPetscLib, sp::PetscSpace ) + numSumSpaces_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSpaceSumGetNumSubspaces, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{$PetscInt}), + sp, numSumSpaces_, + ) + + numSumSpaces = numSumSpaces_[] + + return numSumSpaces +end + +""" + PetscSpaceSumSetNumSubspaces(petsclib::PetscLibType,sp::PetscSpace, numSumSpaces::PetscInt) +Set the number of spaces in the sum space + +Input Parameters: +- `sp` - the function space object +- `numSumSpaces` - the number of spaces + +Level: intermediate + +-seealso: `PETSCSPACESUM`, `PetscSpace`, `PetscSpaceSumGetNumSubspaces()`, `PetscSpaceSetDegree()`, `PetscSpaceSetNumVariables()` + +# External Links +$(_doc_external("DM/PetscSpaceSumSetNumSubspaces")) +""" +function PetscSpaceSumSetNumSubspaces(petsclib::PetscLibType, sp::PetscSpace, numSumSpaces::PetscInt) end + +@for_petsc function PetscSpaceSumSetNumSubspaces(petsclib::$UnionPetscLib, sp::PetscSpace, numSumSpaces::$PetscInt ) + + @chk ccall( + (:PetscSpaceSumSetNumSubspaces, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt), + sp, numSumSpaces, + ) + + + return nothing +end + +""" + concatenate::PetscBool = PetscSpaceSumGetConcatenate(petsclib::PetscLibType,sp::PetscSpace) +Get the concatenate flag for this space. + +Input Parameter: +- `sp` - the function space object + +Output Parameter: +- `concatenate` - flag indicating whether subspaces are concatenated. + +Level: intermediate + +-seealso: `PETSCSPACESUM`, `PetscSpace`, `PetscSpaceSumSetConcatenate()` + +# External Links +$(_doc_external("DM/PetscSpaceSumGetConcatenate")) +""" +function PetscSpaceSumGetConcatenate(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceSumGetConcatenate(petsclib::$UnionPetscLib, sp::PetscSpace ) + concatenate_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSpaceSumGetConcatenate, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{PetscBool}), + sp, concatenate_, + ) + + concatenate = concatenate_[] + + return concatenate +end + +""" + PetscSpaceSumSetConcatenate(petsclib::PetscLibType,sp::PetscSpace, concatenate::PetscBool) +Sets the concatenate flag for this space. + +Input Parameters: +- `sp` - the function space object +- `concatenate` - are subspaces concatenated components (true) or direct summands (false) + +Level: intermediate + +-seealso: `PETSCSPACESUM`, `PetscSpace`, `PetscSpaceSumGetConcatenate()` + +# External Links +$(_doc_external("DM/PetscSpaceSumSetConcatenate")) +""" +function PetscSpaceSumSetConcatenate(petsclib::PetscLibType, sp::PetscSpace, concatenate::PetscBool) end + +@for_petsc function PetscSpaceSumSetConcatenate(petsclib::$UnionPetscLib, sp::PetscSpace, concatenate::PetscBool ) + + @chk ccall( + (:PetscSpaceSumSetConcatenate, $petsc_library), + PetscErrorCode, + (PetscSpace, PetscBool), + sp, concatenate, + ) + + + return nothing +end + +""" + PetscSpaceSumGetSubspace(petsclib::PetscLibType,sp::PetscSpace, s::PetscInt, subsp::PetscSpace) +Get a space in the sum space + +Input Parameters: +- `sp` - the function space object +- `s` - The space number + +Output Parameter: +- `subsp` - the `PetscSpace` + +Level: intermediate + +-seealso: `PETSCSPACESUM`, `PetscSpace`, `PetscSpaceSumSetSubspace()`, `PetscSpaceSetDegree()`, `PetscSpaceSetNumVariables()` + +# External Links +$(_doc_external("DM/PetscSpaceSumGetSubspace")) +""" +function PetscSpaceSumGetSubspace(petsclib::PetscLibType, sp::PetscSpace, s::PetscInt, subsp::PetscSpace) end + +@for_petsc function PetscSpaceSumGetSubspace(petsclib::$UnionPetscLib, sp::PetscSpace, s::$PetscInt, subsp::PetscSpace ) + + @chk ccall( + (:PetscSpaceSumGetSubspace, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt, Ptr{PetscSpace}), + sp, s, subsp, + ) + + + return nothing +end + +""" + PetscSpaceSumSetSubspace(petsclib::PetscLibType,sp::PetscSpace, s::PetscInt, subsp::PetscSpace) +Set a space in the sum space + +Input Parameters: +- `sp` - the function space object +- `s` - The space number +- `subsp` - the number of spaces + +Level: intermediate + +-seealso: `PETSCSPACESUM`, `PetscSpace`, `PetscSpaceSumGetSubspace()`, `PetscSpaceSetDegree()`, `PetscSpaceSetNumVariables()` + +# External Links +$(_doc_external("DM/PetscSpaceSumSetSubspace")) +""" +function PetscSpaceSumSetSubspace(petsclib::PetscLibType, sp::PetscSpace, s::PetscInt, subsp::PetscSpace) end + +@for_petsc function PetscSpaceSumSetSubspace(petsclib::$UnionPetscLib, sp::PetscSpace, s::$PetscInt, subsp::PetscSpace ) + + @chk ccall( + (:PetscSpaceSumSetSubspace, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt, PetscSpace), + sp, s, subsp, + ) + + + return nothing +end + +""" + PetscSpaceSumSetInterleave(petsclib::PetscLibType,sp::PetscSpace, interleave_basis::PetscBool, interleave_components::PetscBool) +Set whether the basis functions and components of a uniform sum are interleaved + +Logically collective + +Input Parameters: +- `sp` - a `PetscSpace` of type `PETSCSPACESUM` +- `interleave_basis` - if `PETSC_TRUE`, the basis vectors of the subspaces are interleaved +- `interleave_components` - if `PETSC_TRUE` and the space concatenates components (`PetscSpaceSumGetConcatenate()`), +interleave the concatenated components + +Level: developer + +-seealso: `PetscSpace`, `PETSCSPACESUM`, `PETSCFEVECTOR`, `PetscSpaceSumGetInterleave()` + +# External Links +$(_doc_external("DM/PetscSpaceSumSetInterleave")) +""" +function PetscSpaceSumSetInterleave(petsclib::PetscLibType, sp::PetscSpace, interleave_basis::PetscBool, interleave_components::PetscBool) end + +@for_petsc function PetscSpaceSumSetInterleave(petsclib::$UnionPetscLib, sp::PetscSpace, interleave_basis::PetscBool, interleave_components::PetscBool ) + + @chk ccall( + (:PetscSpaceSumSetInterleave, $petsc_library), + PetscErrorCode, + (PetscSpace, PetscBool, PetscBool), + sp, interleave_basis, interleave_components, + ) + + + return nothing +end + +""" + interleave_basis::PetscBool,interleave_components::PetscBool = PetscSpaceSumGetInterleave(petsclib::PetscLibType,sp::PetscSpace) +Get whether the basis functions and components of a uniform sum are interleaved + +Logically collective + +Input Parameter: +- `sp` - a `PetscSpace` of type `PETSCSPACESUM` + +Output Parameters: +- `interleave_basis` - if `PETSC_TRUE`, the basis vectors of the subspaces are interleaved +- `interleave_components` - if `PETSC_TRUE` and the space concatenates components (`PetscSpaceSumGetConcatenate()`), +interleave the concatenated components + +Level: developer + +-seealso: `PetscSpace`, `PETSCSPACESUM`, `PETSCFEVECTOR`, `PetscSpaceSumSetInterleave()` + +# External Links +$(_doc_external("DM/PetscSpaceSumGetInterleave")) +""" +function PetscSpaceSumGetInterleave(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceSumGetInterleave(petsclib::$UnionPetscLib, sp::PetscSpace ) + interleave_basis_ = Ref{PetscBool}() + interleave_components_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSpaceSumGetInterleave, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{PetscBool}, Ptr{PetscBool}), + sp, interleave_basis_, interleave_components_, + ) + + interleave_basis = interleave_basis_[] + interleave_components = interleave_components_[] + + return interleave_basis,interleave_components +end + +""" + PetscSpaceTensorSetNumSubspaces(petsclib::PetscLibType,sp::PetscSpace, numTensSpaces::PetscInt) +Set the number of spaces in the tensor product space + +Input Parameters: +- `sp` - the function space object +- `numTensSpaces` - the number of spaces + +Level: intermediate + +-seealso: `PETSCSPACETENSOR`, `PetscSpace`, `PetscSpaceTensorGetNumSubspaces()`, `PetscSpaceSetDegree()`, `PetscSpaceSetNumVariables()` + +# External Links +$(_doc_external("DM/PetscSpaceTensorSetNumSubspaces")) +""" +function PetscSpaceTensorSetNumSubspaces(petsclib::PetscLibType, sp::PetscSpace, numTensSpaces::PetscInt) end + +@for_petsc function PetscSpaceTensorSetNumSubspaces(petsclib::$UnionPetscLib, sp::PetscSpace, numTensSpaces::$PetscInt ) + + @chk ccall( + (:PetscSpaceTensorSetNumSubspaces, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt), + sp, numTensSpaces, + ) + + + return nothing +end + +""" + numTensSpaces::PetscInt = PetscSpaceTensorGetNumSubspaces(petsclib::PetscLibType,sp::PetscSpace) +Get the number of spaces in the tensor product space + +Input Parameter: +- `sp` - the function space object + +Output Parameter: +- `numTensSpaces` - the number of spaces + +Level: intermediate + +-seealso: `PETSCSPACETENSOR`, `PetscSpace`, `PetscSpaceTensorSetNumSubspaces()`, `PetscSpaceSetDegree()`, `PetscSpaceSetNumVariables()` + +# External Links +$(_doc_external("DM/PetscSpaceTensorGetNumSubspaces")) +""" +function PetscSpaceTensorGetNumSubspaces(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpaceTensorGetNumSubspaces(petsclib::$UnionPetscLib, sp::PetscSpace ) + numTensSpaces_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSpaceTensorGetNumSubspaces, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{$PetscInt}), + sp, numTensSpaces_, + ) + + numTensSpaces = numTensSpaces_[] + + return numTensSpaces +end + +""" + PetscSpaceTensorSetSubspace(petsclib::PetscLibType,sp::PetscSpace, s::PetscInt, subsp::PetscSpace) +Set a space in the tensor product space + +Input Parameters: +- `sp` - the function space object +- `s` - The space number +- `subsp` - the number of spaces + +Level: intermediate + +-seealso: `PETSCSPACETENSOR`, `PetscSpace`, `PetscSpaceTensorGetSubspace()`, `PetscSpaceSetDegree()`, `PetscSpaceSetNumVariables()` + +# External Links +$(_doc_external("DM/PetscSpaceTensorSetSubspace")) +""" +function PetscSpaceTensorSetSubspace(petsclib::PetscLibType, sp::PetscSpace, s::PetscInt, subsp::PetscSpace) end + +@for_petsc function PetscSpaceTensorSetSubspace(petsclib::$UnionPetscLib, sp::PetscSpace, s::$PetscInt, subsp::PetscSpace ) + + @chk ccall( + (:PetscSpaceTensorSetSubspace, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt, PetscSpace), + sp, s, subsp, + ) + + + return nothing +end + +""" + PetscSpaceTensorGetSubspace(petsclib::PetscLibType,sp::PetscSpace, s::PetscInt, subsp::PetscSpace) +Get a space in the tensor product space + +Input Parameters: +- `sp` - the function space object +- `s` - The space number + +Output Parameter: +- `subsp` - the `PetscSpace` + +Level: intermediate + +-seealso: `PETSCSPACETENSOR`, `PetscSpace`, `PetscSpaceTensorSetSubspace()`, `PetscSpaceSetDegree()`, `PetscSpaceSetNumVariables()` + +# External Links +$(_doc_external("DM/PetscSpaceTensorGetSubspace")) +""" +function PetscSpaceTensorGetSubspace(petsclib::PetscLibType, sp::PetscSpace, s::PetscInt, subsp::PetscSpace) end + +@for_petsc function PetscSpaceTensorGetSubspace(petsclib::$UnionPetscLib, sp::PetscSpace, s::$PetscInt, subsp::PetscSpace ) + + @chk ccall( + (:PetscSpaceTensorGetSubspace, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt, Ptr{PetscSpace}), + sp, s, subsp, + ) + + + return nothing +end + +""" + PetscSpacePTrimmedSetFormDegree(petsclib::PetscLibType,sp::PetscSpace, formDegree::PetscInt) +Set the form degree of the trimmed polynomials. + +Input Parameters: +- `sp` - the function space object +- `formDegree` - the form degree + +Options Database Key: +- `-petscspace_ptrimmed_form_degree ` - The trimmed polynomial form degree + +Level: intermediate + +-seealso: `PetscSpace`, `PetscDTAltV`, `PetscDTPTrimmedEvalJet()`, `PetscSpacePTrimmedGetFormDegree()` + +# External Links +$(_doc_external("DM/PetscSpacePTrimmedSetFormDegree")) +""" +function PetscSpacePTrimmedSetFormDegree(petsclib::PetscLibType, sp::PetscSpace, formDegree::PetscInt) end + +@for_petsc function PetscSpacePTrimmedSetFormDegree(petsclib::$UnionPetscLib, sp::PetscSpace, formDegree::$PetscInt ) + + @chk ccall( + (:PetscSpacePTrimmedSetFormDegree, $petsc_library), + PetscErrorCode, + (PetscSpace, $PetscInt), + sp, formDegree, + ) + + + return nothing +end + +""" + formDegree::PetscInt = PetscSpacePTrimmedGetFormDegree(petsclib::PetscLibType,sp::PetscSpace) +Get the form degree of the trimmed polynomials. + +Input Parameter: +- `sp` - the function space object + +Output Parameter: +- `formDegree` - the form degree + +Level: intermediate + +-seealso: `PetscSpace`, `PetscDTAltV`, `PetscDTPTrimmedEvalJet()`, `PetscSpacePTrimmedSetFormDegree()` + +# External Links +$(_doc_external("DM/PetscSpacePTrimmedGetFormDegree")) +""" +function PetscSpacePTrimmedGetFormDegree(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpacePTrimmedGetFormDegree(petsclib::$UnionPetscLib, sp::PetscSpace ) + formDegree_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscSpacePTrimmedGetFormDegree, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{$PetscInt}), + sp, formDegree_, + ) + + formDegree = formDegree_[] + + return formDegree +end + +""" + PetscSpacePolynomialSetTensor(petsclib::PetscLibType,sp::PetscSpace, tensor::PetscBool) +Set whether a function space is a space of tensor polynomials. + +Input Parameters: +- `sp` - the function space object +- `tensor` - `PETSC_TRUE` for a tensor polynomial space, `PETSC_FALSE` for a polynomial space + +Options Database Key: +- `-petscspace_poly_tensor ` - Whether to use tensor product polynomials in higher dimension + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpacePolynomialGetTensor()`, `PetscSpaceSetDegree()`, `PetscSpaceSetNumVariables()` + +# External Links +$(_doc_external("DM/PetscSpacePolynomialSetTensor")) +""" +function PetscSpacePolynomialSetTensor(petsclib::PetscLibType, sp::PetscSpace, tensor::PetscBool) end + +@for_petsc function PetscSpacePolynomialSetTensor(petsclib::$UnionPetscLib, sp::PetscSpace, tensor::PetscBool ) + + @chk ccall( + (:PetscSpacePolynomialSetTensor, $petsc_library), + PetscErrorCode, + (PetscSpace, PetscBool), + sp, tensor, + ) + + + return nothing +end + +""" + tensor::PetscBool = PetscSpacePolynomialGetTensor(petsclib::PetscLibType,sp::PetscSpace) +Get whether a function space is a space of tensor +polynomials. + +Input Parameter: +- `sp` - the function space object + +Output Parameter: +- `tensor` - `PETSC_TRUE` for a tensor polynomial space, `PETSC_FALSE` for a polynomial space + +Level: intermediate + +-seealso: `PetscSpace`, `PetscSpacePolynomialSetTensor()`, `PetscSpaceSetDegree()`, `PetscSpaceSetNumVariables()` + +# External Links +$(_doc_external("DM/PetscSpacePolynomialGetTensor")) +""" +function PetscSpacePolynomialGetTensor(petsclib::PetscLibType, sp::PetscSpace) end + +@for_petsc function PetscSpacePolynomialGetTensor(petsclib::$UnionPetscLib, sp::PetscSpace ) + tensor_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSpacePolynomialGetTensor, $petsc_library), + PetscErrorCode, + (PetscSpace, Ptr{PetscBool}), + sp, tensor_, + ) + + tensor = tensor_[] + + return tensor +end + diff --git a/src/autowrapped/PetscToken_wrappers.jl b/src/autowrapped/PetscToken_wrappers.jl new file mode 100644 index 00000000..4e255c0e --- /dev/null +++ b/src/autowrapped/PetscToken_wrappers.jl @@ -0,0 +1,108 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscToken end +const PetscToken = Ptr{_n_PetscToken} + +# ------------------------------------------------------- +""" + PetscTokenFind(petsclib::PetscLibType,a::PetscToken, result::String) +Locates next "token" in a `PetscToken` + +Not Collective; No Fortran Support + +Input Parameter: +- `a` - pointer to token + +Output Parameter: +- `result` - location of occurrence, `NULL` if not found + +Level: intermediate + +-seealso: `PetscToken`, `PetscTokenCreate()`, `PetscTokenDestroy()` + +# External Links +$(_doc_external("Sys/PetscTokenFind")) +""" +function PetscTokenFind(petsclib::PetscLibType, a::PetscToken, result::String) end + +@for_petsc function PetscTokenFind(petsclib::$UnionPetscLib, a::PetscToken, result::String ) + result_ = Ref(pointer(result)) + + @chk ccall( + (:PetscTokenFind, $petsc_library), + PetscErrorCode, + (PetscToken, Ptr{Ptr{Cchar}}), + a, result_, + ) + + + return nothing +end + +""" + t::PetscToken = PetscTokenCreate(petsclib::PetscLibType,a::String, b::Cchar) +Creates a `PetscToken` used to find tokens in a string + +Not Collective; No Fortran Support + +Input Parameters: +- `a` - the string to look in +- `b` - the separator character + +Output Parameter: +- `t` - the token object + +Level: intermediate + +-seealso: `PetscToken`, `PetscTokenFind()`, `PetscTokenDestroy()` + +# External Links +$(_doc_external("Sys/PetscTokenCreate")) +""" +function PetscTokenCreate(petsclib::PetscLibType, a::String, b::Cchar) end + +@for_petsc function PetscTokenCreate(petsclib::$UnionPetscLib, a::String, b::Cchar ) + t_ = Ref{PetscToken}() + + @chk ccall( + (:PetscTokenCreate, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cchar, Ptr{PetscToken}), + a, b, t_, + ) + + t = t_[] + + return t +end + +""" + PetscTokenDestroy(petsclib::PetscLibType,a::PetscToken) +Destroys a `PetscToken` + +Not Collective; No Fortran Support + +Input Parameter: +- `a` - pointer to token + +Level: intermediate + +-seealso: `PetscToken`, `PetscTokenCreate()`, `PetscTokenFind()` + +# External Links +$(_doc_external("Sys/PetscTokenDestroy")) +""" +function PetscTokenDestroy(petsclib::PetscLibType, a::PetscToken) end + +@for_petsc function PetscTokenDestroy(petsclib::$UnionPetscLib, a::PetscToken ) + + @chk ccall( + (:PetscTokenDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscToken},), + a, + ) + + + return nothing +end + diff --git a/src/autowrapped/PetscViennaCLIndices_wrappers.jl b/src/autowrapped/PetscViennaCLIndices_wrappers.jl new file mode 100644 index 00000000..883692f0 --- /dev/null +++ b/src/autowrapped/PetscViennaCLIndices_wrappers.jl @@ -0,0 +1,2 @@ +# autodefined type arguments for class ------ +# ------------------------------------------------------- diff --git a/src/autowrapped/PetscViewer_wrappers.jl b/src/autowrapped/PetscViewer_wrappers.jl new file mode 100644 index 00000000..b194e8d3 --- /dev/null +++ b/src/autowrapped/PetscViewer_wrappers.jl @@ -0,0 +1,6828 @@ +# autodefined type arguments for class ------ +mutable struct _n_DMPlexStorageVersion end +const DMPlexStorageVersion = Ptr{_n_DMPlexStorageVersion} + +mutable struct _n_PetscViewers end +const PetscViewers = Ptr{_n_PetscViewers} +# ------------------------------------------------------- + +""" + inviewer::PetscViewer = PetscViewerCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a viewing context. A `PetscViewer` represents a file, a graphical window, a Unix socket or a variety of other ways +of viewing a PETSc object + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `inviewer` - location to put the `PetscViewer` context + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerDestroy()`, `PetscViewerSetType()`, `PetscViewerType` + +# External Links +$(_doc_external("Sys/PetscViewerCreate")) +""" +function PetscViewerCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscViewerCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + inviewer_ = Ref{PetscViewer}() + + @chk ccall( + (:PetscViewerCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscViewer}), + comm, inviewer_, + ) + + inviewer = inviewer_[] + + return inviewer +end + +""" + PetscViewerRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a viewer to those available for use with `PetscViewerSetType()` + +Not Collective, No Fortran Support + +Input Parameters: +- `sname` - name of a new user-defined viewer +- `function` - routine to create method context + +Level: developer + +-seealso: [](sec_viewers), `PetscViewerRegisterAll()` + +# External Links +$(_doc_external("Sys/PetscViewerRegister")) +""" +function PetscViewerRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function PetscViewerRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:PetscViewerRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + mcnt::PetscInt,cnt::PetscInt = PetscViewerFlowControlStart(petsclib::PetscLibType,viewer::PetscViewer) + +# External Links +$(_doc_external("Sys/PetscViewerFlowControlStart")) +""" +function PetscViewerFlowControlStart(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerFlowControlStart(petsclib::$UnionPetscLib, viewer::PetscViewer ) + mcnt_ = Ref{$PetscInt}() + cnt_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerFlowControlStart, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscInt}, Ptr{$PetscInt}), + viewer, mcnt_, cnt_, + ) + + mcnt = mcnt_[] + cnt = cnt_[] + + return mcnt,cnt +end + +""" + mcnt::PetscInt = PetscViewerFlowControlStepMain(petsclib::PetscLibType,viewer::PetscViewer, i::PetscInt, cnt::PetscInt) + +# External Links +$(_doc_external("Sys/PetscViewerFlowControlStepMain")) +""" +function PetscViewerFlowControlStepMain(petsclib::PetscLibType, viewer::PetscViewer, i::PetscInt, cnt::PetscInt) end + +@for_petsc function PetscViewerFlowControlStepMain(petsclib::$UnionPetscLib, viewer::PetscViewer, i::$PetscInt, cnt::$PetscInt ) + mcnt_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerFlowControlStepMain, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt, Ptr{$PetscInt}, $PetscInt), + viewer, i, mcnt_, cnt, + ) + + mcnt = mcnt_[] + + return mcnt +end + +""" + mcnt::PetscInt = PetscViewerFlowControlEndMain(petsclib::PetscLibType,viewer::PetscViewer) + +# External Links +$(_doc_external("Sys/PetscViewerFlowControlEndMain")) +""" +function PetscViewerFlowControlEndMain(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerFlowControlEndMain(petsclib::$UnionPetscLib, viewer::PetscViewer ) + mcnt_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerFlowControlEndMain, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscInt}), + viewer, mcnt_, + ) + + mcnt = mcnt_[] + + return mcnt +end + +""" + mcnt::PetscInt = PetscViewerFlowControlStepWorker(petsclib::PetscLibType,viewer::PetscViewer, rank::PetscMPIInt) + +# External Links +$(_doc_external("Sys/PetscViewerFlowControlStepWorker")) +""" +function PetscViewerFlowControlStepWorker(petsclib::PetscLibType, viewer::PetscViewer, rank::PetscMPIInt) end + +@for_petsc function PetscViewerFlowControlStepWorker(petsclib::$UnionPetscLib, viewer::PetscViewer, rank::PetscMPIInt ) + mcnt_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerFlowControlStepWorker, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscMPIInt, Ptr{$PetscInt}), + viewer, rank, mcnt_, + ) + + mcnt = mcnt_[] + + return mcnt +end + +""" + mcnt::PetscInt = PetscViewerFlowControlEndWorker(petsclib::PetscLibType,viewer::PetscViewer) + +# External Links +$(_doc_external("Sys/PetscViewerFlowControlEndWorker")) +""" +function PetscViewerFlowControlEndWorker(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerFlowControlEndWorker(petsclib::$UnionPetscLib, viewer::PetscViewer ) + mcnt_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerFlowControlEndWorker, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscInt}), + viewer, mcnt_, + ) + + mcnt = mcnt_[] + + return mcnt +end + +""" + PetscViewerFlush(petsclib::PetscLibType,viewer::PetscViewer) +Flushes a `PetscViewer` (i.e. tries to dump all the +data that has been printed through a `PetscViewer`). + +Collective + +Input Parameter: +- `viewer` - the `PetscViewer` to be flushed + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerWriteable()`, `PetscViewerSocketOpen()`, `PetscViewerASCIIOpen()`, `PetscViewerDrawOpen()`, `PetscViewerCreate()`, `PetscViewerDestroy()`, +`PetscViewerSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerFlush")) +""" +function PetscViewerFlush(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerFlush(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerFlush, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerPushFormat(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat) +Sets the format for a `PetscViewer`. + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer` +- `format` - the format + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerFormat`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, +`PetscViewerSetFormat()`, `PetscViewerPopFormat()` + +# External Links +$(_doc_external("Sys/PetscViewerPushFormat")) +""" +function PetscViewerPushFormat(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat) end + +@for_petsc function PetscViewerPushFormat(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat ) + + @chk ccall( + (:PetscViewerPushFormat, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerFormat), + viewer, format, + ) + + + return nothing +end + +""" + PetscViewerPopFormat(petsclib::PetscLibType,viewer::PetscViewer) +Resets the format for a `PetscViewer` to the value it had before the previous call to `PetscViewerPushFormat()` + +Logically Collective + +Input Parameter: +- `viewer` - the `PetscViewer` + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerFormat`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, +`PetscViewerSetFormat()`, `PetscViewerPushFormat()` + +# External Links +$(_doc_external("Sys/PetscViewerPopFormat")) +""" +function PetscViewerPopFormat(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerPopFormat(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerPopFormat, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerGetFormat(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat) +Gets the current format for `PetscViewer`. + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` + +Output Parameter: +- `format` - the format + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, `PetscViewerType`, +`PetscViewerPushFormat()`, `PetscViewerPopFormat()`, `PetscViewerDrawOpen()`, `PetscViewerSocketOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerGetFormat")) +""" +function PetscViewerGetFormat(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat) end + +@for_petsc function PetscViewerGetFormat(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat ) + + @chk ccall( + (:PetscViewerGetFormat, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscViewerFormat}), + viewer, format, + ) + + + return nothing +end + +""" + PetscViewerGetSubViewer(petsclib::PetscLibType,viewer::PetscViewer, comm::MPI_Comm, outviewer::PetscViewer) +Creates a new `PetscViewer` (same type as the old) +that lives on a subcommunicator of the original viewer's communicator + +Collective + +Input Parameters: +- `viewer` - the `PetscViewer` to be reproduced +- `comm` - the sub communicator to use + +Output Parameter: +- `outviewer` - new `PetscViewer` + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerSocketOpen()`, `PetscViewerASCIIOpen()`, `PetscViewerDrawOpen()`, +`PetscViewerFlush()`, `PetscViewerRestoreSubViewer()` + +# External Links +$(_doc_external("Sys/PetscViewerGetSubViewer")) +""" +function PetscViewerGetSubViewer(petsclib::PetscLibType, viewer::PetscViewer, comm::MPI_Comm, outviewer::PetscViewer) end + +@for_petsc function PetscViewerGetSubViewer(petsclib::$UnionPetscLib, viewer::PetscViewer, comm::MPI_Comm, outviewer::PetscViewer ) + + @chk ccall( + (:PetscViewerGetSubViewer, $petsc_library), + PetscErrorCode, + (PetscViewer, MPI_Comm, Ptr{PetscViewer}), + viewer, comm, outviewer, + ) + + + return nothing +end + +""" + PetscViewerRestoreSubViewer(petsclib::PetscLibType,viewer::PetscViewer, comm::MPI_Comm, outviewer::PetscViewer) +Restores a `PetscViewer` obtained with `PetscViewerGetSubViewer()`. + +Collective + +Input Parameters: +- `viewer` - the `PetscViewer` that was reproduced +- `comm` - the sub communicator +- `outviewer` - the subviewer to be returned + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerSocketOpen()`, `PetscViewerASCIIOpen()`, `PetscViewerDrawOpen()`, `PetscViewerGetSubViewer()`, +`PetscViewerFlush()` + +# External Links +$(_doc_external("Sys/PetscViewerRestoreSubViewer")) +""" +function PetscViewerRestoreSubViewer(petsclib::PetscLibType, viewer::PetscViewer, comm::MPI_Comm, outviewer::PetscViewer) end + +@for_petsc function PetscViewerRestoreSubViewer(petsclib::$UnionPetscLib, viewer::PetscViewer, comm::MPI_Comm, outviewer::PetscViewer ) + + @chk ccall( + (:PetscViewerRestoreSubViewer, $petsc_library), + PetscErrorCode, + (PetscViewer, MPI_Comm, Ptr{PetscViewer}), + viewer, comm, outviewer, + ) + + + return nothing +end + +""" + PetscViewerFinalizePackage(petsclib::PetscLibType) +This function destroys any global objects created in PETSc viewers. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: [](sec_viewers), `PetscViewer`, `PetscFinalize()`, `PetscViewerInitializePackage()` + +# External Links +$(_doc_external("Sys/PetscViewerFinalizePackage")) +""" +function PetscViewerFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscViewerFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscViewerFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscViewerInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `PetscViewer` package. + +Level: developer + +-seealso: [](sec_viewers), `PetscViewer`, `PetscInitialize()`, `PetscViewerFinalizePackage()` + +# External Links +$(_doc_external("Sys/PetscViewerInitializePackage")) +""" +function PetscViewerInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscViewerInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscViewerInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscViewerDestroy(petsclib::PetscLibType,viewer::PetscViewer) +Destroys a `PetscViewer`. + +Collective + +Input Parameter: +- `viewer` - the `PetscViewer` to be destroyed. + +Level: beginner + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerCreate()`, `PetscViewerSocketOpen()`, `PetscViewerASCIIOpen()`, `PetscViewerDrawOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerDestroy")) +""" +function PetscViewerDestroy(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerDestroy(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscViewer},), + viewer, + ) + + + return nothing +end + +""" + vf::PetscViewerAndFormat = PetscViewerAndFormatCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat) +Creates a `PetscViewerAndFormat` struct. + +Collective + +Input Parameters: +- `viewer` - the viewer +- `format` - the format + +Output Parameter: +- `vf` - viewer and format object + +Level: developer + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerAndFormat`, `PetscViewerFormat`, `PetscViewerSocketOpen()`, `PetscViewerASCIIOpen()`, `PetscViewerCreate()`, +`PetscViewerDrawOpen()`, `PetscViewerAndFormatDestroy()` + +# External Links +$(_doc_external("Sys/PetscViewerAndFormatCreate")) +""" +function PetscViewerAndFormatCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat) end + +@for_petsc function PetscViewerAndFormatCreate(petsclib::$UnionPetscLib, viewer::PetscViewer, format::PetscViewerFormat ) + vf_ = Ref{PetscViewerAndFormat}() + + @chk ccall( + (:PetscViewerAndFormatCreate, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerFormat, PetscViewerAndFormat), + viewer, format, vf_, + ) + + vf = vf_[] + + return vf +end + +""" + PetscViewerAndFormatDestroy(petsclib::PetscLibType,vf::PetscViewerAndFormat) +Destroys a `PetscViewerAndFormat` struct created with `PetscViewerAndFormatCreate()` + +Collective + +Input Parameter: +- `vf` - the `PetscViewerAndFormat` to be destroyed. + +Level: developer + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerAndFormat`, `PetscViewerFormat`, `PetscViewerAndFormatCreate()`, `PetscViewerSocketOpen()`, +`PetscViewerASCIIOpen()`, `PetscViewerCreate()`, `PetscViewerDrawOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerAndFormatDestroy")) +""" +function PetscViewerAndFormatDestroy(petsclib::PetscLibType, vf::PetscViewerAndFormat) end + +@for_petsc function PetscViewerAndFormatDestroy(petsclib::$UnionPetscLib, vf::PetscViewerAndFormat ) + + @chk ccall( + (:PetscViewerAndFormatDestroy, $petsc_library), + PetscErrorCode, + (PetscViewerAndFormat,), + vf, + ) + + + return nothing +end + +""" + type::PetscViewerType = PetscViewerGetType(petsclib::PetscLibType,viewer::PetscViewer) +Returns the type of a `PetscViewer`. + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` + +Output Parameter: +- `type` - `PetscViewerType` + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewerType`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerGetType")) +""" +function PetscViewerGetType(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerGetType(petsclib::$UnionPetscLib, viewer::PetscViewer ) + type_ = Ref{PetscViewerType}() + + @chk ccall( + (:PetscViewerGetType, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscViewerType}), + viewer, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PetscViewerAppendOptionsPrefix(petsclib::PetscLibType,viewer::PetscViewer, prefix::String) +Appends to the prefix used for searching for +`PetscViewer` options in the database during `PetscViewerSetFromOptions()`. + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer` context +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerGetOptionsPrefix()`, `PetscViewerSetOptionsPrefix()` + +# External Links +$(_doc_external("Sys/PetscViewerAppendOptionsPrefix")) +""" +function PetscViewerAppendOptionsPrefix(petsclib::PetscLibType, viewer::PetscViewer, prefix::String) end + +@for_petsc function PetscViewerAppendOptionsPrefix(petsclib::$UnionPetscLib, viewer::PetscViewer, prefix::String ) + + @chk ccall( + (:PetscViewerAppendOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}), + viewer, prefix, + ) + + + return nothing +end + +""" + PetscViewerGetOptionsPrefix(petsclib::PetscLibType,viewer::PetscViewer, prefix::String) +Gets the prefix used for searching for +`PetscViewer` options in the database during `PetscViewerSetFromOptions()`. + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` context + +Output Parameter: +- `prefix` - pointer to the prefix string used + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerAppendOptionsPrefix()`, `PetscViewerSetOptionsPrefix()` + +# External Links +$(_doc_external("Sys/PetscViewerGetOptionsPrefix")) +""" +function PetscViewerGetOptionsPrefix(petsclib::PetscLibType, viewer::PetscViewer, prefix::String) end + +@for_petsc function PetscViewerGetOptionsPrefix(petsclib::$UnionPetscLib, viewer::PetscViewer, prefix::String ) + prefix_ = Ref(pointer(prefix)) + + @chk ccall( + (:PetscViewerGetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Ptr{Cchar}}), + viewer, prefix_, + ) + + + return nothing +end + +""" + PetscViewerViewFromOptions(petsclib::PetscLibType,A::PetscViewer, obj::PetscObject, name::String) +View from the viewer based on options in the options database + +Collective + +Input Parameters: +- `A` - the `PetscViewer` context +- `obj` - Optional object that provides the prefix for the option names +- `name` - command line option + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerView`, `PetscObjectViewFromOptions()`, `PetscViewerCreate()` + +# External Links +$(_doc_external("Sys/PetscViewerViewFromOptions")) +""" +function PetscViewerViewFromOptions(petsclib::PetscLibType, A::PetscViewer, obj::PetscObject, name::String) end + +@for_petsc function PetscViewerViewFromOptions(petsclib::$UnionPetscLib, A::PetscViewer, obj::PetscObject, name::String ) + + @chk ccall( + (:PetscViewerViewFromOptions, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + PetscViewerView(petsclib::PetscLibType,v::PetscViewer, viewer::PetscViewer) +Visualizes a viewer object. + +Collective + +Input Parameters: +- `v` - the viewer to be viewed +- `viewer` - visualization context + +Level: beginner + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerPushFormat()`, `PetscViewerASCIIOpen()`, `PetscViewerDrawOpen()`, +`PetscViewerSocketOpen()`, `PetscViewerBinaryOpen()`, `PetscViewerLoad()` + +# External Links +$(_doc_external("Sys/PetscViewerView")) +""" +function PetscViewerView(petsclib::PetscLibType, v::PetscViewer, viewer::PetscViewer) end + +@for_petsc function PetscViewerView(petsclib::$UnionPetscLib, v::PetscViewer, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerView, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewer), + v, viewer, + ) + + + return nothing +end + +""" + count::PetscInt = PetscViewerRead(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, num::PetscInt, dtype::PetscDataType) +Reads data from a `PetscViewer` + +Collective + +Input Parameters: +- `viewer` - The viewer +- `data` - Location to write the data, treated as an array of the type defined by `datatype` +- `num` - Number of items of data to read +- `dtype` - Type of data to read + +Output Parameter: +- `count` - number of items of data actually read, or `NULL` + +Level: beginner + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, +`PetscViewerReadable()`, `PetscViewerBinaryGetDescriptor()`, +`PetscViewerBinaryGetInfoPointer()`, `PetscFileMode` + +# External Links +$(_doc_external("Sys/PetscViewerRead")) +""" +function PetscViewerRead(petsclib::PetscLibType, viewer::PetscViewer, data::Cvoid, num::PetscInt, dtype::PetscDataType) end + +@for_petsc function PetscViewerRead(petsclib::$UnionPetscLib, viewer::PetscViewer, data::Cvoid, num::$PetscInt, dtype::PetscDataType ) + count_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerRead, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cvoid}, $PetscInt, Ptr{$PetscInt}, PetscDataType), + viewer, data, num, count_, dtype, + ) + + count = count_[] + + return count +end + +""" + flg::PetscBool = PetscViewerReadable(petsclib::PetscLibType,viewer::PetscViewer) +Return a flag whether the viewer can be read from with `PetscViewerRead()` + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` context + +Output Parameter: +- `flg` - `PETSC_TRUE` if the viewer is readable, `PETSC_FALSE` otherwise + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewerRead()`, `PetscViewer`, `PetscViewerWritable()`, `PetscViewerCheckReadable()`, `PetscViewerCreate()`, `PetscViewerFileSetMode()`, `PetscViewerFileSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerReadable")) +""" +function PetscViewerReadable(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerReadable(petsclib::$UnionPetscLib, viewer::PetscViewer ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerReadable, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = PetscViewerWritable(petsclib::PetscLibType,viewer::PetscViewer) +Return a flag whether the viewer can be written to with `PetscViewerWrite()` + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` context + +Output Parameter: +- `flg` - `PETSC_TRUE` if the viewer is writable, `PETSC_FALSE` otherwise + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerReadable()`, `PetscViewerCheckWritable()`, `PetscViewerCreate()`, `PetscViewerFileSetMode()`, `PetscViewerFileSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerWritable")) +""" +function PetscViewerWritable(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerWritable(petsclib::$UnionPetscLib, viewer::PetscViewer ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerWritable, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscViewerCheckReadable(petsclib::PetscLibType,viewer::PetscViewer) +Check whether the viewer can be read from, generates an error if not + +Collective + +Input Parameter: +- `viewer` - the `PetscViewer` context + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerReadable()`, `PetscViewerCheckWritable()`, `PetscViewerCreate()`, `PetscViewerFileSetMode()`, `PetscViewerFileSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerCheckReadable")) +""" +function PetscViewerCheckReadable(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerCheckReadable(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerCheckReadable, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerCheckWritable(petsclib::PetscLibType,viewer::PetscViewer) +Check whether the viewer can be written to, generates an error if not + +Collective + +Input Parameter: +- `viewer` - the `PetscViewer` context + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerWritable()`, `PetscViewerCheckReadable()`, `PetscViewerCreate()`, `PetscViewerFileSetMode()`, `PetscViewerFileSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerCheckWritable")) +""" +function PetscViewerCheckWritable(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerCheckWritable(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerCheckWritable, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerASCIIGetPointer(petsclib::PetscLibType,viewer::PetscViewer, fd::Libc.FILE) +Extracts the file pointer from an ASCII `PetscViewer`. + +Not Collective, depending on the viewer the value may be meaningless except for process 0 of the viewer; No Fortran Support + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerASCIIOpen()` + +Output Parameter: +- `fd` - file pointer + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERASCII`, `PetscViewerASCIIOpen()`, `PetscViewerDestroy()`, `PetscViewerSetType()`, +`PetscViewerCreate()`, `PetscViewerASCIIPrintf()`, `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerFlush()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIGetPointer")) +""" +function PetscViewerASCIIGetPointer(petsclib::PetscLibType, viewer::PetscViewer, fd::Libc.FILE) end + +@for_petsc function PetscViewerASCIIGetPointer(petsclib::$UnionPetscLib, viewer::PetscViewer, fd::Libc.FILE ) + + @chk ccall( + (:PetscViewerASCIIGetPointer, $petsc_library), + PetscErrorCode, + (PetscViewer, Libc.FILE), + viewer, fd, + ) + + + return nothing +end + +""" + PetscViewerASCIISetTab(petsclib::PetscLibType,viewer::PetscViewer, tabs::PetscInt) +Causes `PetscViewer` to tab in a number of times before printing + +Not Collective, but only first processor in set has any effect; No Fortran Support + +Input Parameters: +- `viewer` - obtained with `PetscViewerASCIIOpen()` +- `tabs` - number of tabs + +Level: developer + +-seealso: [](sec_viewers), `PETSCVIEWERASCII`, `PetscPrintf()`, `PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, +`PetscViewerASCIIGetTab()`, +`PetscViewerASCIIPopTab()`, `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerASCIIOpen()`, +`PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()`, `PetscViewerASCIIGetPointer()`, +`PetscViewerASCIIPushTab()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIISetTab")) +""" +function PetscViewerASCIISetTab(petsclib::PetscLibType, viewer::PetscViewer, tabs::PetscInt) end + +@for_petsc function PetscViewerASCIISetTab(petsclib::$UnionPetscLib, viewer::PetscViewer, tabs::$PetscInt ) + + @chk ccall( + (:PetscViewerASCIISetTab, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, tabs, + ) + + + return nothing +end + +""" + tabs::PetscInt = PetscViewerASCIIGetTab(petsclib::PetscLibType,viewer::PetscViewer) +Return the number of tabs used by `PetscViewer`. + +Not Collective, meaningful on first processor only; No Fortran Support + +Input Parameter: +- `viewer` - obtained with `PetscViewerASCIIOpen()` + +Output Parameter: +- `tabs` - number of tabs + +Level: developer + +-seealso: [](sec_viewers), `PETSCVIEWERASCII`, `PetscPrintf()`, `PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, +`PetscViewerASCIISetTab()`, +`PetscViewerASCIIPopTab()`, `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerASCIIOpen()`, +`PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()`, `PetscViewerASCIIGetPointer()`, `PetscViewerASCIIPushTab()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIGetTab")) +""" +function PetscViewerASCIIGetTab(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerASCIIGetTab(petsclib::$UnionPetscLib, viewer::PetscViewer ) + tabs_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerASCIIGetTab, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscInt}), + viewer, tabs_, + ) + + tabs = tabs_[] + + return tabs +end + +""" + PetscViewerASCIIAddTab(petsclib::PetscLibType,viewer::PetscViewer, tabs::PetscInt) +Add to the number of times a `PETSCVIEWERASCII` viewer tabs before printing + +Not Collective, but only first processor in set has any effect; No Fortran Support + +Input Parameters: +- `viewer` - obtained with `PetscViewerASCIIOpen()` +- `tabs` - number of tabs + +Level: developer + +-seealso: [](sec_viewers), `PETSCVIEWERASCII`, `PetscPrintf()`, `PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, +`PetscViewerASCIIPopTab()`, `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerASCIIOpen()`, +`PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()`, `PetscViewerASCIIGetPointer()`, `PetscViewerASCIIPushTab()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIAddTab")) +""" +function PetscViewerASCIIAddTab(petsclib::PetscLibType, viewer::PetscViewer, tabs::PetscInt) end + +@for_petsc function PetscViewerASCIIAddTab(petsclib::$UnionPetscLib, viewer::PetscViewer, tabs::$PetscInt ) + + @chk ccall( + (:PetscViewerASCIIAddTab, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, tabs, + ) + + + return nothing +end + +""" + PetscViewerASCIISubtractTab(petsclib::PetscLibType,viewer::PetscViewer, tabs::PetscInt) +Subtracts from the number of times a `PETSCVIEWERASCII` viewer tabs before printing + +Not Collective, but only first processor in set has any effect; No Fortran Support + +Input Parameters: +- `viewer` - obtained with `PetscViewerASCIIOpen()` +- `tabs` - number of tabs + +Level: developer + +-seealso: [](sec_viewers), `PETSCVIEWERASCII`, `PetscPrintf()`, `PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, +`PetscViewerASCIIPopTab()`, `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerASCIIOpen()`, +`PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()`, `PetscViewerASCIIGetPointer()`, +`PetscViewerASCIIPushTab()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIISubtractTab")) +""" +function PetscViewerASCIISubtractTab(petsclib::PetscLibType, viewer::PetscViewer, tabs::PetscInt) end + +@for_petsc function PetscViewerASCIISubtractTab(petsclib::$UnionPetscLib, viewer::PetscViewer, tabs::$PetscInt ) + + @chk ccall( + (:PetscViewerASCIISubtractTab, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, tabs, + ) + + + return nothing +end + +""" + PetscViewerASCIIPushSynchronized(petsclib::PetscLibType,viewer::PetscViewer) +Allows calls to `PetscViewerASCIISynchronizedPrintf()` for this viewer + +Collective + +Input Parameter: +- `viewer` - obtained with `PetscViewerASCIIOpen()` + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerFlush()`, `PetscViewerASCIIPopSynchronized()`, +`PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, `PetscViewerASCIIOpen()`, +`PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIPushSynchronized")) +""" +function PetscViewerASCIIPushSynchronized(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerASCIIPushSynchronized(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerASCIIPushSynchronized, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerASCIIPopSynchronized(petsclib::PetscLibType,viewer::PetscViewer) +Undoes most recent `PetscViewerASCIIPushSynchronized()` for this viewer + +Collective + +Input Parameter: +- `viewer` - obtained with `PetscViewerASCIIOpen()` + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewerASCIIPushSynchronized()`, `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerFlush()`, +`PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, `PetscViewerASCIIOpen()`, +`PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIPopSynchronized")) +""" +function PetscViewerASCIIPopSynchronized(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerASCIIPopSynchronized(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerASCIIPopSynchronized, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerASCIIPushTab(petsclib::PetscLibType,viewer::PetscViewer) +Adds one more tab to the amount that `PetscViewerASCIIPrintf()` +lines are tabbed. + +Not Collective, but only first MPI rank in the viewer has any effect; No Fortran Support + +Input Parameter: +- `viewer` - obtained with `PetscViewerASCIIOpen()` + +Level: developer + +-seealso: [](sec_viewers), `PetscPrintf()`, `PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, +`PetscViewerASCIIPopTab()`, `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerASCIIOpen()`, +`PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()`, `PetscViewerASCIIGetPointer()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIPushTab")) +""" +function PetscViewerASCIIPushTab(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerASCIIPushTab(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerASCIIPushTab, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerASCIIPopTab(petsclib::PetscLibType,viewer::PetscViewer) +Removes one tab from the amount that `PetscViewerASCIIPrintf()` lines are tabbed that was provided by +`PetscViewerASCIIPushTab()` + +Not Collective, but only first MPI rank in the viewer has any effect; No Fortran Support + +Input Parameter: +- `viewer` - obtained with `PetscViewerASCIIOpen()` + +Level: developer + +-seealso: [](sec_viewers), `PetscPrintf()`, `PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, +`PetscViewerASCIIPushTab()`, `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerASCIIOpen()`, +`PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()`, `PetscViewerASCIIGetPointer()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIPopTab")) +""" +function PetscViewerASCIIPopTab(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerASCIIPopTab(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerASCIIPopTab, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerASCIIUseTabs(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool) +Turns on or off the use of tabs with the `PETSCVIEWERASCII` `PetscViewer` + +Not Collective, but only first MPI rank in the viewer has any effect; No Fortran Support + +Input Parameters: +- `viewer` - obtained with `PetscViewerASCIIOpen()` +- `flg` - `PETSC_TRUE` or `PETSC_FALSE` + +Level: developer + +-seealso: [](sec_viewers), `PetscPrintf()`, `PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, +`PetscViewerASCIIPopTab()`, `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerASCIIPushTab()`, `PetscViewerASCIIOpen()`, +`PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()`, `PetscViewerASCIIGetPointer()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIUseTabs")) +""" +function PetscViewerASCIIUseTabs(petsclib::PetscLibType, viewer::PetscViewer, flg::PetscBool) end + +@for_petsc function PetscViewerASCIIUseTabs(petsclib::$UnionPetscLib, viewer::PetscViewer, flg::PetscBool ) + + @chk ccall( + (:PetscViewerASCIIUseTabs, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, flg, + ) + + + return nothing +end + +""" + PetscViewerASCIIGetStdout(petsclib::PetscLibType,comm::MPI_Comm, viewer::PetscViewer) +Creates a `PETSCVIEWERASCII` `PetscViewer` shared by all processes +in a communicator that prints to `stdout`. Error returning version of `PETSC_VIEWER_STDOUT_()` + +Collective + +Input Parameter: +- `comm` - the MPI communicator to share the `PetscViewer` + +Output Parameter: +- `viewer` - the viewer + +Level: beginner + +-seealso: [](sec_viewers), `PetscViewerASCIIGetStderr()`, `PETSC_VIEWER_DRAW_()`, `PetscViewerASCIIOpen()`, `PETSC_VIEWER_STDERR_`, `PETSC_VIEWER_STDOUT_WORLD`, +`PETSC_VIEWER_STDOUT_SELF` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIGetStdout")) +""" +function PetscViewerASCIIGetStdout(petsclib::PetscLibType, comm::MPI_Comm, viewer::PetscViewer) end + +@for_petsc function PetscViewerASCIIGetStdout(petsclib::$UnionPetscLib, comm::MPI_Comm, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerASCIIGetStdout, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscViewer}), + comm, viewer, + ) + + + return nothing +end + +""" + viewer::PetscViewer = PETSC_VIEWER_STDOUT_SELF(petsclib::PetscLibType) + +Get the default PETSc `STDOUT` viewer for `MPI.COMM_SELF` + +Not Collective + +Input Parameter: +- `petsclib` - the PETSc library instance + +Output Parameter: +- `viewer` - the viewer + +Level: beginner + +-seealso: `PETSC_VIEWER_STDOUT_WORLD`, `PetscViewerASCIIGetStdout()` +""" +function PETSC_VIEWER_STDOUT_SELF(petsclib::PetscLibType) end + +@for_petsc function PETSC_VIEWER_STDOUT_SELF(petsclib::$UnionPetscLib) + viewer_ref = Ref{PetscViewer}() + @chk ccall( + (:PetscViewerASCIIGetStdout, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscViewer}), + MPI.COMM_SELF, viewer_ref, + ) + return viewer_ref[] +end + +""" + viewer::PetscViewer = PETSC_VIEWER_STDOUT_WORLD(petsclib::PetscLibType) + +Get the default PETSc `STDOUT` viewer for `MPI.COMM_WORLD` + +Collective on `MPI.COMM_WORLD` + +Input Parameter: +- `petsclib` - the PETSc library instance + +Output Parameter: +- `viewer` - the viewer + +Level: beginner + +-seealso: `PETSC_VIEWER_STDOUT_SELF`, `PetscViewerASCIIGetStdout()` +""" +function PETSC_VIEWER_STDOUT_WORLD(petsclib::PetscLibType) end + +@for_petsc function PETSC_VIEWER_STDOUT_WORLD(petsclib::$UnionPetscLib) + viewer_ref = Ref{PetscViewer}() + @chk ccall( + (:PetscViewerASCIIGetStdout, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscViewer}), + MPI.COMM_WORLD, viewer_ref, + ) + return viewer_ref[] +end + +""" + viewer::PetscViewer = PETSC_VIEWER_STDERR_SELF(petsclib::PetscLibType) + +Get the default PETSc `STDERR` viewer for `MPI.COMM_SELF` + +Not Collective + +Input Parameter: +- `petsclib` - the PETSc library instance + +Output Parameter: +- `viewer` - the viewer + +Level: beginner + +-seealso: `PETSC_VIEWER_STDERR_WORLD`, `PetscViewerASCIIGetStderr()` +""" +function PETSC_VIEWER_STDERR_SELF(petsclib::PetscLibType) end + +@for_petsc function PETSC_VIEWER_STDERR_SELF(petsclib::$UnionPetscLib) + viewer_ref = Ref{PetscViewer}() + @chk ccall( + (:PetscViewerASCIIGetStderr, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscViewer}), + MPI.COMM_SELF, viewer_ref, + ) + return viewer_ref[] +end + +""" + viewer::PetscViewer = PETSC_VIEWER_STDERR_WORLD(petsclib::PetscLibType) + +Get the default PETSc `STDERR` viewer for `MPI.COMM_WORLD` + +Collective on `MPI.COMM_WORLD` + +Input Parameter: +- `petsclib` - the PETSc library instance + +Output Parameter: +- `viewer` - the viewer + +Level: beginner + +-seealso: `PETSC_VIEWER_STDERR_SELF`, `PetscViewerASCIIGetStderr()` +""" +function PETSC_VIEWER_STDERR_WORLD(petsclib::PetscLibType) end + +@for_petsc function PETSC_VIEWER_STDERR_WORLD(petsclib::$UnionPetscLib) + viewer_ref = Ref{PetscViewer}() + @chk ccall( + (:PetscViewerASCIIGetStderr, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscViewer}), + MPI.COMM_WORLD, viewer_ref, + ) + return viewer_ref[] +end + +""" + PetscViewerFileSetName(petsclib::PetscLibType,viewer::PetscViewer, name::String) +Sets the name of the file the `PetscViewer` should use. + +Collective + +Input Parameters: +- `viewer` - the `PetscViewer`; for example, of type `PETSCVIEWERASCII` or `PETSCVIEWERBINARY` +- `name` - the name of the file it should use + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `PetscViewerDestroy()`, +`PetscViewerASCIIGetPointer()`, `PetscViewerASCIIPrintf()`, `PetscViewerASCIISynchronizedPrintf()` + +# External Links +$(_doc_external("Sys/PetscViewerFileSetName")) +""" +function PetscViewerFileSetName(petsclib::PetscLibType, viewer::PetscViewer, name::String) end + +@for_petsc function PetscViewerFileSetName(petsclib::$UnionPetscLib, viewer::PetscViewer, name::String ) + + @chk ccall( + (:PetscViewerFileSetName, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}), + viewer, name, + ) + + + return nothing +end + +""" + PetscViewerFileGetName(petsclib::PetscLibType,viewer::PetscViewer, name::String) +Gets the name of the file the `PetscViewer` is using + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` + +Output Parameter: +- `name` - the name of the file it is using + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `PetscViewerFileSetName()` + +# External Links +$(_doc_external("Sys/PetscViewerFileGetName")) +""" +function PetscViewerFileGetName(petsclib::PetscLibType, viewer::PetscViewer, name::String) end + +@for_petsc function PetscViewerFileGetName(petsclib::$UnionPetscLib, viewer::PetscViewer, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PetscViewerFileGetName, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Ptr{Cchar}}), + viewer, name_, + ) + + + return nothing +end + +""" + count::PetscInt = PetscViewerASCIIRead(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, num::PetscInt, dtype::PetscDataType) +Reads from a `PETSCVIEWERASCII` file + +Only MPI rank 0 in the `PetscViewer` may call this + +Input Parameters: +- `viewer` - the `PETSCVIEWERASCII` viewer +- `data` - location to write the data, treated as an array of type indicated by `datatype` +- `num` - number of items of data to read +- `dtype` - type of data to read + +Output Parameter: +- `count` - number of items of data actually read, or `NULL` + +Level: beginner + +-seealso: [](sec_viewers), `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, `PetscViewerCreate()`, `PetscViewerFileSetMode()`, `PetscViewerFileSetName()` +`VecView()`, `MatView()`, `VecLoad()`, `MatLoad()`, `PetscViewerBinaryGetDescriptor()`, +`PetscViewerBinaryGetInfoPointer()`, `PetscFileMode`, `PetscViewer`, `PetscViewerBinaryRead()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIRead")) +""" +function PetscViewerASCIIRead(petsclib::PetscLibType, viewer::PetscViewer, data::Cvoid, num::PetscInt, dtype::PetscDataType) end + +@for_petsc function PetscViewerASCIIRead(petsclib::$UnionPetscLib, viewer::PetscViewer, data::Cvoid, num::$PetscInt, dtype::PetscDataType ) + count_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerASCIIRead, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cvoid}, $PetscInt, Ptr{$PetscInt}, PetscDataType), + viewer, data, num, count_, dtype, + ) + + count = count_[] + + return count +end + +""" + PetscViewerASCIIGetStderr(petsclib::PetscLibType,comm::MPI_Comm, viewer::PetscViewer) +Creates a `PETSCVIEWERASCII` `PetscViewer` shared by all MPI processes +in a communicator that prints to `stderr`. Error returning version of `PETSC_VIEWER_STDERR_()` + +Collective + +Input Parameter: +- `comm` - the MPI communicator to share the `PetscViewer` + +Output Parameter: +- `viewer` - the viewer + +Level: beginner + +-seealso: [](sec_viewers), `PetscViewerASCIIGetStdout()`, `PETSC_VIEWER_DRAW_()`, `PetscViewerASCIIOpen()`, `PETSC_VIEWER_STDERR_`, `PETSC_VIEWER_STDERR_WORLD`, +`PETSC_VIEWER_STDERR_SELF` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIGetStderr")) +""" +function PetscViewerASCIIGetStderr(petsclib::PetscLibType, comm::MPI_Comm, viewer::PetscViewer) end + +@for_petsc function PetscViewerASCIIGetStderr(petsclib::$UnionPetscLib, comm::MPI_Comm, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerASCIIGetStderr, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscViewer}), + comm, viewer, + ) + + + return nothing +end + +""" + PetscViewerASCIIOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, viewer::PetscViewer) +Opens an ASCII file for writing as a `PETSCVIEWERASCII` `PetscViewer`. + +Collective + +Input Parameters: +- `comm` - the communicator +- `name` - the file name + +Output Parameter: +- `viewer` - the `PetscViewer` to use with the specified file + +Level: beginner + +-seealso: [](sec_viewers), `MatView()`, `VecView()`, `PetscViewerDestroy()`, `PetscViewerBinaryOpen()`, `PetscViewerASCIIRead()`, `PETSCVIEWERASCII` +`PetscViewerASCIIGetPointer()`, `PetscViewerPushFormat()`, `PETSC_VIEWER_STDOUT_`, `PETSC_VIEWER_STDERR_`, +`PETSC_VIEWER_STDOUT_WORLD`, `PETSC_VIEWER_STDOUT_SELF`, `PetscViewerASCIIGetStdout()`, `PetscViewerASCIIGetStderr()` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIOpen")) +""" +function PetscViewerASCIIOpen(petsclib::PetscLibType, comm::MPI_Comm, name::String, viewer::PetscViewer) end + +@for_petsc function PetscViewerASCIIOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, name::String, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerASCIIOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{PetscViewer}), + comm, name, viewer, + ) + + + return nothing +end + +""" + PetscViewerASCIIOpenWithFILE(petsclib::PetscLibType,comm::MPI_Comm, fd::Libc.FILE, viewer::PetscViewer) +Given an open file creates an `PETSCVIEWERASCII` viewer that prints to it. + +Collective + +Input Parameters: +- `comm` - the communicator +- `fd` - the `FILE` pointer + +Output Parameter: +- `viewer` - the `PetscViewer` to use with the specified file + +Level: beginner + +-seealso: [](sec_viewers), `MatView()`, `VecView()`, `PetscViewerDestroy()`, `PetscViewerBinaryOpen()`, `PetscViewerASCIIOpenWithFileUnit()`, +`PetscViewerASCIIGetPointer()`, `PetscViewerPushFormat()`, `PETSC_VIEWER_STDOUT_`, `PETSC_VIEWER_STDERR_`, +`PETSC_VIEWER_STDOUT_WORLD`, `PETSC_VIEWER_STDOUT_SELF`, `PetscViewerASCIIOpen()`, `PetscViewerASCIISetFILE()`, `PETSCVIEWERASCII` + +# External Links +$(_doc_external("Sys/PetscViewerASCIIOpenWithFILE")) +""" +function PetscViewerASCIIOpenWithFILE(petsclib::PetscLibType, comm::MPI_Comm, fd::Libc.FILE, viewer::PetscViewer) end + +@for_petsc function PetscViewerASCIIOpenWithFILE(petsclib::$UnionPetscLib, comm::MPI_Comm, fd::Libc.FILE, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerASCIIOpenWithFILE, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Libc.FILE}, Ptr{PetscViewer}), + comm, fd, viewer, + ) + + + return nothing +end + +""" + PetscViewerASCIISetFILE(petsclib::PetscLibType,viewer::PetscViewer, fd::Libc.FILE) +Given an open file sets the `PETSCVIEWERASCII` viewer to use the file for output + +Not Collective + +Input Parameters: +- `viewer` - the `PetscViewer` to use with the specified file +- `fd` - the `FILE` pointer + +Level: beginner + +-seealso: `MatView()`, `VecView()`, `PetscViewerDestroy()`, `PetscViewerBinaryOpen()`, `PetscViewerASCIISetFileUnit()`, +`PetscViewerASCIIGetPointer()`, `PetscViewerPushFormat()`, `PETSC_VIEWER_STDOUT_`, `PETSC_VIEWER_STDERR_`, +`PETSC_VIEWER_STDOUT_WORLD`, `PETSC_VIEWER_STDOUT_SELF`, `PetscViewerASCIIOpen()`, `PetscViewerASCIIOpenWithFILE()`, `PETSCVIEWERASCII` + +# External Links +$(_doc_external("Sys/PetscViewerASCIISetFILE")) +""" +function PetscViewerASCIISetFILE(petsclib::PetscLibType, viewer::PetscViewer, fd::Libc.FILE) end + +@for_petsc function PetscViewerASCIISetFILE(petsclib::$UnionPetscLib, viewer::PetscViewer, fd::Libc.FILE ) + + @chk ccall( + (:PetscViewerASCIISetFILE, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Libc.FILE}), + viewer, fd, + ) + + + return nothing +end + +""" + PetscViewerVUGetPointer(petsclib::PetscLibType,viewer::PetscViewer, fd::Libc.FILE) +Extracts the file pointer from a `PETSCVIEWERVU` `PetscViewer`. + +Not Collective + +Input Parameter: +- `viewer` - The `PetscViewer` + +Output Parameter: +- `fd` - The file pointer + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERVU`, `PetscViewerASCIIGetPointer()` + +# External Links +$(_doc_external("Sys/PetscViewerVUGetPointer")) +""" +function PetscViewerVUGetPointer(petsclib::PetscLibType, viewer::PetscViewer, fd::Libc.FILE) end + +@for_petsc function PetscViewerVUGetPointer(petsclib::$UnionPetscLib, viewer::PetscViewer, fd::Libc.FILE ) + + @chk ccall( + (:PetscViewerVUGetPointer, $petsc_library), + PetscErrorCode, + (PetscViewer, Libc.FILE), + viewer, fd, + ) + + + return nothing +end + +""" + PetscViewerVUSetVecSeen(petsclib::PetscLibType,viewer::PetscViewer, vecSeen::PetscBool) +Sets the flag which indicates whether we have viewed +a vector. This is usually called internally rather than by a user. + +Not Collective + +Input Parameters: +- `viewer` - The `PETSCVIEWERVU` `PetscViewer` +- `vecSeen` - The flag which indicates whether we have viewed a vector + +Level: developer + +-seealso: [](sec_viewers), `PETSCVIEWERVU`, `PetscViewerVUGetVecSeen()` + +# External Links +$(_doc_external("Sys/PetscViewerVUSetVecSeen")) +""" +function PetscViewerVUSetVecSeen(petsclib::PetscLibType, viewer::PetscViewer, vecSeen::PetscBool) end + +@for_petsc function PetscViewerVUSetVecSeen(petsclib::$UnionPetscLib, viewer::PetscViewer, vecSeen::PetscBool ) + + @chk ccall( + (:PetscViewerVUSetVecSeen, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, vecSeen, + ) + + + return nothing +end + +""" + vecSeen::PetscBool = PetscViewerVUGetVecSeen(petsclib::PetscLibType,viewer::PetscViewer) +Gets the flag which indicates whether we have viewed +a vector. This is usually called internally rather than by a user. + +Not Collective + +Input Parameter: +- `viewer` - The `PETSCVIEWERVU` `PetscViewer` + +Output Parameter: +- `vecSeen` - The flag which indicates whether we have viewed a vector + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERVU` + +# External Links +$(_doc_external("Sys/PetscViewerVUGetVecSeen")) +""" +function PetscViewerVUGetVecSeen(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerVUGetVecSeen(petsclib::$UnionPetscLib, viewer::PetscViewer ) + vecSeen_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerVUGetVecSeen, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, vecSeen_, + ) + + vecSeen = vecSeen_[] + + return vecSeen +end + +""" + PetscViewerVUFlushDeferred(petsclib::PetscLibType,viewer::PetscViewer) +Flushes the deferred write cache to the file. + +Not Collective + +Input Parameter: +- `viewer` - The `PETSCVIEWERVU` `PetscViewer` + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERVU`, `PetscViewerVUPrintDeferred()` + +# External Links +$(_doc_external("Sys/PetscViewerVUFlushDeferred")) +""" +function PetscViewerVUFlushDeferred(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerVUFlushDeferred(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerVUFlushDeferred, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerPythonSetType(petsclib::PetscLibType,viewer::PetscViewer, pyname::String) +Initialize a `PetscViewer` object implemented in Python. + +Collective + +Input Parameters: +- `viewer` - the viewer object. +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Options Database Key: +- `-viewer_python_type ` - python class + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerType`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PETSCVIEWERPYTHON`, `PetscPythonInitialize()` + +# External Links +$(_doc_external("Sys/PetscViewerPythonSetType")) +""" +function PetscViewerPythonSetType(petsclib::PetscLibType, viewer::PetscViewer, pyname::String) end + +@for_petsc function PetscViewerPythonSetType(petsclib::$UnionPetscLib, viewer::PetscViewer, pyname::String ) + + @chk ccall( + (:PetscViewerPythonSetType, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}), + viewer, pyname, + ) + + + return nothing +end + +""" + pyname::String = PetscViewerPythonGetType(petsclib::PetscLibType,viewer::PetscViewer) +Get the Python name of a `PetscViewer` object implemented in Python. + +Not Collective + +Input Parameter: +- `viewer` - the viewer + +Output Parameter: +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerType`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PETSCVIEWERPYTHON`, `PetscPythonInitialize()`, `PetscViewerPythonSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerPythonGetType")) +""" +function PetscViewerPythonGetType(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerPythonGetType(petsclib::$UnionPetscLib, viewer::PetscViewer ) + pyname_ = Ref{Ptr{Cchar}}() + + @chk ccall( + (:PetscViewerPythonGetType, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Ptr{Cchar}}), + viewer, pyname_, + ) + + pyname = unsafe_wrap(Array, pyname_[], VecGetLocalSize(petsclib, x); own = false) + + return pyname +end + +""" + PetscViewerPythonViewObject(petsclib::PetscLibType,viewer::PetscViewer, obj::PetscObject) +View a `PetscObject`. + +Collective + +Input Parameters: +- `viewer` - the viewer object. +- `obj` - the object to be viewed. + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerPythonCreate()` + +# External Links +$(_doc_external("Sys/PetscViewerPythonViewObject")) +""" +function PetscViewerPythonViewObject(petsclib::PetscLibType, viewer::PetscViewer, obj::PetscObject) end + +@for_petsc function PetscViewerPythonViewObject(petsclib::$UnionPetscLib, viewer::PetscViewer, obj::PetscObject ) + + @chk ccall( + (:PetscViewerPythonViewObject, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscObject), + viewer, obj, + ) + + + return nothing +end + +""" + viewer::PetscViewer = PetscViewerPythonCreate(petsclib::PetscLibType,comm::MPI_Comm, pyname::String) +Create a `PetscViewer` object implemented in Python. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Output Parameter: +- `viewer` - the viewer + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerType`, `PETSCVIEWERPYTHON`, `PetscViewerPythonSetType()`, `PetscPythonInitialize()`, `PetscViewerPythonViewObject()` + +# External Links +$(_doc_external("Sys/PetscViewerPythonCreate")) +""" +function PetscViewerPythonCreate(petsclib::PetscLibType, comm::MPI_Comm, pyname::String) end + +@for_petsc function PetscViewerPythonCreate(petsclib::$UnionPetscLib, comm::MPI_Comm, pyname::String ) + viewer_ = Ref{PetscViewer}() + + @chk ccall( + (:PetscViewerPythonCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{PetscViewer}), + comm, pyname, viewer_, + ) + + viewer = viewer_[] + + return viewer +end + +""" + PetscViewerHDF5GetGroup(petsclib::PetscLibType,viewer::PetscViewer, path::String, abspath::String) +Get the current HDF5 group name (full path), set with `PetscViewerHDF5PushGroup()`/`PetscViewerHDF5PopGroup()`. + +Not Collective + +Input Parameters: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` +- `path` - (Optional) The path relative to the pushed group + +Output Parameter: +- `abspath` - The absolute HDF5 path (group) + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5OpenGroup()`, `PetscViewerHDF5WriteGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5GetGroup")) +""" +function PetscViewerHDF5GetGroup(petsclib::PetscLibType, viewer::PetscViewer, path::String, abspath::String) end + +@for_petsc function PetscViewerHDF5GetGroup(petsclib::$UnionPetscLib, viewer::PetscViewer, path::String, abspath::String ) + abspath_ = Ref(pointer(abspath)) + + @chk ccall( + (:PetscViewerHDF5GetGroup, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{Ptr{Cchar}}), + viewer, path, abspath_, + ) + + + return nothing +end + +""" + PetscViewerHDF5SetBaseDimension2(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool) +Vectors of 1 dimension (i.e. bs/dof is 1) will be saved in the HDF5 file with a +dimension of 2. + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer`; if it is a `PETSCVIEWERHDF5` then this command is ignored +- `flg` - if `PETSC_TRUE` the vector will always have at least a dimension of 2 even if that first dimension is of size 1 + +Options Database Key: +- `-viewer_hdf5_base_dimension2` - turns on (true) or off (false) using a dimension of 2 in the HDF5 file even if the bs/dof of the vector is 1 + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerFileSetMode()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5SetBaseDimension2")) +""" +function PetscViewerHDF5SetBaseDimension2(petsclib::PetscLibType, viewer::PetscViewer, flg::PetscBool) end + +@for_petsc function PetscViewerHDF5SetBaseDimension2(petsclib::$UnionPetscLib, viewer::PetscViewer, flg::PetscBool ) + + @chk ccall( + (:PetscViewerHDF5SetBaseDimension2, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscViewerHDF5GetBaseDimension2(petsclib::PetscLibType,viewer::PetscViewer) +Vectors of 1 dimension (i.e. bs/dof is 1) will be saved in the HDF5 file with a +dimension of 2. + +Logically Collective + +Input Parameter: +- `viewer` - the `PetscViewer`, must be `PETSCVIEWERHDF5` + +Output Parameter: +- `flg` - if `PETSC_TRUE` the vector will always have at least a dimension of 2 even if that first dimension is of size 1 + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerFileSetMode()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5GetBaseDimension2")) +""" +function PetscViewerHDF5GetBaseDimension2(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5GetBaseDimension2(petsclib::$UnionPetscLib, viewer::PetscViewer ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5GetBaseDimension2, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscViewerHDF5SetSPOutput(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool) +Data is written to disk in single precision even if PETSc is +compiled with double precision `PetscReal`. + +Logically Collective + +Input Parameters: +- `viewer` - the PetscViewer; if it is a `PETSCVIEWERHDF5` then this command is ignored +- `flg` - if `PETSC_TRUE` the data will be written to disk with single precision + +Options Database Key: +- `-viewer_hdf5_sp_output` - turns on (true) or off (false) output in single precision + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerFileSetMode()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()`, +`PetscReal`, `PetscViewerHDF5GetSPOutput()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5SetSPOutput")) +""" +function PetscViewerHDF5SetSPOutput(petsclib::PetscLibType, viewer::PetscViewer, flg::PetscBool) end + +@for_petsc function PetscViewerHDF5SetSPOutput(petsclib::$UnionPetscLib, viewer::PetscViewer, flg::PetscBool ) + + @chk ccall( + (:PetscViewerHDF5SetSPOutput, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscViewerHDF5GetSPOutput(petsclib::PetscLibType,viewer::PetscViewer) +Data is written to disk in single precision even if PETSc is +compiled with double precision `PetscReal`. + +Logically Collective + +Input Parameter: +- `viewer` - the PetscViewer, must be of type `PETSCVIEWERHDF5` + +Output Parameter: +- `flg` - if `PETSC_TRUE` the data will be written to disk with single precision + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewerFileSetMode()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()`, +`PetscReal`, `PetscViewerHDF5SetSPOutput()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5GetSPOutput")) +""" +function PetscViewerHDF5GetSPOutput(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5GetSPOutput(petsclib::$UnionPetscLib, viewer::PetscViewer ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5GetSPOutput, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscViewerHDF5SetCollective(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool) +Use collective MPI + +Logically Collective; flg must contain common value + +Input Parameters: +- `viewer` - the `PetscViewer`; if it is not `PETSCVIEWERHDF5` then this command is ignored +- `flg` - `PETSC_TRUE` for collective mode; `PETSC_FALSE` for independent mode (default) + +Options Database Key: +- `-viewer_hdf5_collective` - turns on (true) or off (false) collective transfers + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5GetCollective()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerHDF5Open()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5SetCollective")) +""" +function PetscViewerHDF5SetCollective(petsclib::PetscLibType, viewer::PetscViewer, flg::PetscBool) end + +@for_petsc function PetscViewerHDF5SetCollective(petsclib::$UnionPetscLib, viewer::PetscViewer, flg::PetscBool ) + + @chk ccall( + (:PetscViewerHDF5SetCollective, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscViewerHDF5GetCollective(petsclib::PetscLibType,viewer::PetscViewer) +Return flag whether collective MPI + +Not Collective + +Input Parameter: +- `viewer` - the `PETSCVIEWERHDF5` `PetscViewer` + +Output Parameter: +- `flg` - the flag + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5SetCollective()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerHDF5Open()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5GetCollective")) +""" +function PetscViewerHDF5GetCollective(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5GetCollective(petsclib::$UnionPetscLib, viewer::PetscViewer ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5GetCollective, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscViewerHDF5SetDefaultTimestepping(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool) +Set the flag for default timestepping + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer`; if it is not `PETSCVIEWERHDF5` then this command is ignored +- `flg` - if `PETSC_TRUE` we will assume that timestepping is on + +Options Database Key: +- `-viewer_hdf5_default_timestepping` - turns on (true) or off (false) default timestepping + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5GetDefaultTimestepping()`, `PetscViewerHDF5PushTimestepping()`, `PetscViewerHDF5GetTimestep()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5SetDefaultTimestepping")) +""" +function PetscViewerHDF5SetDefaultTimestepping(petsclib::PetscLibType, viewer::PetscViewer, flg::PetscBool) end + +@for_petsc function PetscViewerHDF5SetDefaultTimestepping(petsclib::$UnionPetscLib, viewer::PetscViewer, flg::PetscBool ) + + @chk ccall( + (:PetscViewerHDF5SetDefaultTimestepping, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscViewerHDF5GetDefaultTimestepping(petsclib::PetscLibType,viewer::PetscViewer) +Get the flag for default timestepping + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` + +Output Parameter: +- `flg` - if `PETSC_TRUE` we will assume that timestepping is on + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5SetDefaultTimestepping()`, `PetscViewerHDF5PushTimestepping()`, `PetscViewerHDF5GetTimestep()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5GetDefaultTimestepping")) +""" +function PetscViewerHDF5GetDefaultTimestepping(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5GetDefaultTimestepping(petsclib::$UnionPetscLib, viewer::PetscViewer ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5GetDefaultTimestepping, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscViewerHDF5SetCompress(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool) +Set the flag for compression + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer`; if it is not `PETSCVIEWERHDF5` then this command is ignored +- `flg` - if `PETSC_TRUE` we will turn on compression + +Options Database Key: +- `-viewer_hdf5_compress` - turns on (true) or off (false) compression + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5GetCompress()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5SetCompress")) +""" +function PetscViewerHDF5SetCompress(petsclib::PetscLibType, viewer::PetscViewer, flg::PetscBool) end + +@for_petsc function PetscViewerHDF5SetCompress(petsclib::$UnionPetscLib, viewer::PetscViewer, flg::PetscBool ) + + @chk ccall( + (:PetscViewerHDF5SetCompress, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscViewerHDF5GetCompress(petsclib::PetscLibType,viewer::PetscViewer) +Get the flag for compression + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` + +Output Parameter: +- `flg` - if `PETSC_TRUE` we will turn on compression + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5SetCompress()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5GetCompress")) +""" +function PetscViewerHDF5GetCompress(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5GetCompress(petsclib::$UnionPetscLib, viewer::PetscViewer ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5GetCompress, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscViewerHDF5Open(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, hdf5v::PetscViewer) +Opens a file for HDF5 input/output as a `PETSCVIEWERHDF5` `PetscViewer` + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `name` - name of file +- `type` - type of file + +Output Parameter: +- `hdf5v` - `PetscViewer` for HDF5 input/output to use with the specified file + +Options Database Keys: +- `-viewer_hdf5_base_dimension2` - turns on (true) or off (false) using a dimension of 2 in the HDF5 file even if the bs/dof of the vector is 1 +- `-viewer_hdf5_sp_output` - forces (if true) the viewer to write data in single precision independent on the precision of PetscReal + +Level: beginner + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, `PetscViewerHDF5SetBaseDimension2()`, +`PetscViewerHDF5SetSPOutput()`, `PetscViewerHDF5GetBaseDimension2()`, `VecView()`, `MatView()`, `VecLoad()`, +`MatLoad()`, `PetscFileMode`, `PetscViewer`, `PetscViewerSetType()`, `PetscViewerFileSetMode()`, `PetscViewerFileSetName()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5Open")) +""" +function PetscViewerHDF5Open(petsclib::PetscLibType, comm::MPI_Comm, name::String, type::PetscFileMode, hdf5v::PetscViewer) end + +@for_petsc function PetscViewerHDF5Open(petsclib::$UnionPetscLib, comm::MPI_Comm, name::String, type::PetscFileMode, hdf5v::PetscViewer ) + + @chk ccall( + (:PetscViewerHDF5Open, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscFileMode, Ptr{PetscViewer}), + comm, name, type, hdf5v, + ) + + + return nothing +end + +""" + PetscViewerHDF5GetFileId(petsclib::PetscLibType,viewer::PetscViewer, file_id::hid_t) +Retrieve the file id, this file ID then can be used in direct HDF5 calls + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` + +Output Parameter: +- `file_id` - The file id + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5GetFileId")) +""" +function PetscViewerHDF5GetFileId(petsclib::PetscLibType, viewer::PetscViewer, file_id::hid_t) end + +@for_petsc function PetscViewerHDF5GetFileId(petsclib::$UnionPetscLib, viewer::PetscViewer, file_id::hid_t ) + + @chk ccall( + (:PetscViewerHDF5GetFileId, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{hid_t}), + viewer, file_id, + ) + + + return nothing +end + +""" + PetscViewerHDF5PushGroup(petsclib::PetscLibType,viewer::PetscViewer, name::String) +Set the current HDF5 group for output + +Not Collective + +Input Parameters: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` +- `name` - The group name + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()`, `PetscViewerHDF5OpenGroup()`, `PetscViewerHDF5WriteGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5PushGroup")) +""" +function PetscViewerHDF5PushGroup(petsclib::PetscLibType, viewer::PetscViewer, name::String) end + +@for_petsc function PetscViewerHDF5PushGroup(petsclib::$UnionPetscLib, viewer::PetscViewer, name::String ) + + @chk ccall( + (:PetscViewerHDF5PushGroup, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}), + viewer, name, + ) + + + return nothing +end + +""" + PetscViewerHDF5PopGroup(petsclib::PetscLibType,viewer::PetscViewer) +Return the current HDF5 group for output to the previous value + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5GetGroup()`, `PetscViewerHDF5OpenGroup()`, `PetscViewerHDF5WriteGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5PopGroup")) +""" +function PetscViewerHDF5PopGroup(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5PopGroup(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerHDF5PopGroup, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerHDF5OpenGroup(petsclib::PetscLibType,viewer::PetscViewer, path::String, fileId::hid_t, groupId::hid_t) +Open the HDF5 group with the name (full path) returned by `PetscViewerHDF5GetGroup()`, +and return this group's ID and file ID. +If `PetscViewerHDF5GetGroup()` yields NULL, then group ID is file ID. + +Not Collective + +Input Parameters: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` +- `path` - (Optional) The path relative to the pushed group + +Output Parameters: +- `fileId` - The HDF5 file ID +- `groupId` - The HDF5 group ID + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()`, `PetscViewerHDF5WriteGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5OpenGroup")) +""" +function PetscViewerHDF5OpenGroup(petsclib::PetscLibType, viewer::PetscViewer, path::String, fileId::hid_t, groupId::hid_t) end + +@for_petsc function PetscViewerHDF5OpenGroup(petsclib::$UnionPetscLib, viewer::PetscViewer, path::String, fileId::hid_t, groupId::hid_t ) + + @chk ccall( + (:PetscViewerHDF5OpenGroup, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{hid_t}, Ptr{hid_t}), + viewer, path, fileId, groupId, + ) + + + return nothing +end + +""" + PetscViewerHDF5WriteGroup(petsclib::PetscLibType,viewer::PetscViewer, path::String) +Ensure the HDF5 group exists in the HDF5 file + +Not Collective + +Input Parameters: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` +- `path` - (Optional) The path relative to the pushed group + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()`, `PetscViewerHDF5OpenGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5WriteGroup")) +""" +function PetscViewerHDF5WriteGroup(petsclib::PetscLibType, viewer::PetscViewer, path::String) end + +@for_petsc function PetscViewerHDF5WriteGroup(petsclib::$UnionPetscLib, viewer::PetscViewer, path::String ) + + @chk ccall( + (:PetscViewerHDF5WriteGroup, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}), + viewer, path, + ) + + + return nothing +end + +""" + PetscViewerHDF5PushTimestepping(petsclib::PetscLibType,viewer::PetscViewer) +Activate timestepping mode for subsequent HDF5 reading and writing. + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PopTimestepping()`, `PetscViewerHDF5IsTimestepping()`, `PetscViewerHDF5SetTimestep()`, `PetscViewerHDF5IncrementTimestep()`, `PetscViewerHDF5GetTimestep()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5PushTimestepping")) +""" +function PetscViewerHDF5PushTimestepping(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5PushTimestepping(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerHDF5PushTimestepping, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerHDF5PopTimestepping(petsclib::PetscLibType,viewer::PetscViewer) +Deactivate timestepping mode for subsequent HDF5 reading and writing. + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PushTimestepping()`, `PetscViewerHDF5IsTimestepping()`, `PetscViewerHDF5SetTimestep()`, `PetscViewerHDF5IncrementTimestep()`, `PetscViewerHDF5GetTimestep()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5PopTimestepping")) +""" +function PetscViewerHDF5PopTimestepping(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5PopTimestepping(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerHDF5PopTimestepping, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscViewerHDF5IsTimestepping(petsclib::PetscLibType,viewer::PetscViewer) +Ask the viewer whether it is in timestepping mode currently. + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` + +Output Parameter: +- `flg` - is timestepping active? + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PushTimestepping()`, `PetscViewerHDF5PopTimestepping()`, `PetscViewerHDF5SetTimestep()`, `PetscViewerHDF5IncrementTimestep()`, `PetscViewerHDF5GetTimestep()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5IsTimestepping")) +""" +function PetscViewerHDF5IsTimestepping(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5IsTimestepping(petsclib::$UnionPetscLib, viewer::PetscViewer ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5IsTimestepping, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscViewerHDF5IncrementTimestep(petsclib::PetscLibType,viewer::PetscViewer) +Increments current timestep for the HDF5 output. Fields are stacked in time. + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PushTimestepping()`, `PetscViewerHDF5SetTimestep()`, `PetscViewerHDF5GetTimestep()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5IncrementTimestep")) +""" +function PetscViewerHDF5IncrementTimestep(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5IncrementTimestep(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerHDF5IncrementTimestep, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerHDF5SetTimestep(petsclib::PetscLibType,viewer::PetscViewer, timestep::PetscInt) +Set the current timestep for the HDF5 output. Fields are stacked in time. + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` +- `timestep` - The timestep + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PushTimestepping()`, `PetscViewerHDF5IncrementTimestep()`, `PetscViewerHDF5GetTimestep()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5SetTimestep")) +""" +function PetscViewerHDF5SetTimestep(petsclib::PetscLibType, viewer::PetscViewer, timestep::PetscInt) end + +@for_petsc function PetscViewerHDF5SetTimestep(petsclib::$UnionPetscLib, viewer::PetscViewer, timestep::$PetscInt ) + + @chk ccall( + (:PetscViewerHDF5SetTimestep, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, timestep, + ) + + + return nothing +end + +""" + timestep::PetscInt = PetscViewerHDF5GetTimestep(petsclib::PetscLibType,viewer::PetscViewer) +Get the current timestep for the HDF5 output. Fields are stacked in time. + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERHDF5` + +Output Parameter: +- `timestep` - The timestep + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PushTimestepping()`, `PetscViewerHDF5IncrementTimestep()`, `PetscViewerHDF5SetTimestep()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5GetTimestep")) +""" +function PetscViewerHDF5GetTimestep(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerHDF5GetTimestep(petsclib::$UnionPetscLib, viewer::PetscViewer ) + timestep_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerHDF5GetTimestep, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscInt}), + viewer, timestep_, + ) + + timestep = timestep_[] + + return timestep +end + +""" + PetscViewerHDF5WriteAttribute(petsclib::PetscLibType,viewer::PetscViewer, parent::String, name::String, datatype::PetscDataType, value::Cvoid) +Write an attribute + +Collective + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `parent` - The parent dataset/group name +- `name` - The attribute name +- `datatype` - The attribute type +- `value` - The attribute value + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5WriteObjectAttribute()`, `PetscViewerHDF5ReadAttribute()`, `PetscViewerHDF5HasAttribute()`, +`PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5WriteAttribute")) +""" +function PetscViewerHDF5WriteAttribute(petsclib::PetscLibType, viewer::PetscViewer, parent::String, name::String, datatype::PetscDataType, value::Cvoid) end + +@for_petsc function PetscViewerHDF5WriteAttribute(petsclib::$UnionPetscLib, viewer::PetscViewer, parent::String, name::String, datatype::PetscDataType, value::Cvoid ) + + @chk ccall( + (:PetscViewerHDF5WriteAttribute, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{Cchar}, PetscDataType, Ptr{Cvoid}), + viewer, parent, name, datatype, value, + ) + + + return nothing +end + +""" + PetscViewerHDF5WriteObjectAttribute(petsclib::PetscLibType,viewer::PetscViewer, obj::PetscObject, name::String, datatype::PetscDataType, value::Cvoid) +Write an attribute to the dataset matching the given `PetscObject` by name + +Collective + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `obj` - The object whose name is used to lookup the parent dataset, relative to the current group. +- `name` - The attribute name +- `datatype` - The attribute type +- `value` - The attribute value + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5WriteAttribute()`, `PetscViewerHDF5ReadObjectAttribute()`, `PetscViewerHDF5HasObjectAttribute()`, +`PetscViewerHDF5HasObject()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5WriteObjectAttribute")) +""" +function PetscViewerHDF5WriteObjectAttribute(petsclib::PetscLibType, viewer::PetscViewer, obj::PetscObject, name::String, datatype::PetscDataType, value::Cvoid) end + +@for_petsc function PetscViewerHDF5WriteObjectAttribute(petsclib::$UnionPetscLib, viewer::PetscViewer, obj::PetscObject, name::String, datatype::PetscDataType, value::Cvoid ) + + @chk ccall( + (:PetscViewerHDF5WriteObjectAttribute, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscObject, Ptr{Cchar}, PetscDataType, Ptr{Cvoid}), + viewer, obj, name, datatype, value, + ) + + + return nothing +end + +""" + PetscViewerHDF5ReadAttribute(petsclib::PetscLibType,viewer::PetscViewer, parent::String, name::String, datatype::PetscDataType, defaultValue::Cvoid, value::Cvoid) +Read an attribute + +Collective + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `parent` - The parent dataset/group name +- `name` - The attribute name +- `datatype` - The attribute type +- `defaultValue` - The pointer to the default value + +Output Parameter: +- `value` - The pointer to the read HDF5 attribute value + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5ReadObjectAttribute()`, `PetscViewerHDF5WriteAttribute()`, `PetscViewerHDF5HasAttribute()`, `PetscViewerHDF5HasObject()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5ReadAttribute")) +""" +function PetscViewerHDF5ReadAttribute(petsclib::PetscLibType, viewer::PetscViewer, parent::String, name::String, datatype::PetscDataType, defaultValue::Cvoid, value::Cvoid) end + +@for_petsc function PetscViewerHDF5ReadAttribute(petsclib::$UnionPetscLib, viewer::PetscViewer, parent::String, name::String, datatype::PetscDataType, defaultValue::Cvoid, value::Cvoid ) + + @chk ccall( + (:PetscViewerHDF5ReadAttribute, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{Cchar}, PetscDataType, Ptr{Cvoid}, Ptr{Cvoid}), + viewer, parent, name, datatype, defaultValue, value, + ) + + + return nothing +end + +""" + PetscViewerHDF5ReadObjectAttribute(petsclib::PetscLibType,viewer::PetscViewer, obj::PetscObject, name::String, datatype::PetscDataType, defaultValue::Cvoid, value::Cvoid) +Read an attribute from the dataset matching the given `PetscObject` by name + +Collective + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `obj` - The object whose name is used to lookup the parent dataset, relative to the current group. +- `name` - The attribute name +- `datatype` - The attribute type +- `defaultValue` - The default attribute value + +Output Parameter: +- `value` - The attribute value + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5ReadAttribute()` `PetscViewerHDF5WriteObjectAttribute()`, `PetscViewerHDF5HasObjectAttribute()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5ReadObjectAttribute")) +""" +function PetscViewerHDF5ReadObjectAttribute(petsclib::PetscLibType, viewer::PetscViewer, obj::PetscObject, name::String, datatype::PetscDataType, defaultValue::Cvoid, value::Cvoid) end + +@for_petsc function PetscViewerHDF5ReadObjectAttribute(petsclib::$UnionPetscLib, viewer::PetscViewer, obj::PetscObject, name::String, datatype::PetscDataType, defaultValue::Cvoid, value::Cvoid ) + + @chk ccall( + (:PetscViewerHDF5ReadObjectAttribute, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscObject, Ptr{Cchar}, PetscDataType, Ptr{Cvoid}, Ptr{Cvoid}), + viewer, obj, name, datatype, defaultValue, value, + ) + + + return nothing +end + +""" + has::PetscBool = PetscViewerHDF5HasGroup(petsclib::PetscLibType,viewer::PetscViewer, path::String) +Check whether the current (pushed) group exists in the HDF5 file + +Collective + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `path` - (Optional) The path relative to the pushed group + +Output Parameter: +- `has` - Flag for group existence + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5HasAttribute()`, `PetscViewerHDF5HasDataset()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()`, `PetscViewerHDF5OpenGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5HasGroup")) +""" +function PetscViewerHDF5HasGroup(petsclib::PetscLibType, viewer::PetscViewer, path::String) end + +@for_petsc function PetscViewerHDF5HasGroup(petsclib::$UnionPetscLib, viewer::PetscViewer, path::String ) + has_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5HasGroup, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{PetscBool}), + viewer, path, has_, + ) + + has = has_[] + + return has +end + +""" + has::PetscBool = PetscViewerHDF5HasDataset(petsclib::PetscLibType,viewer::PetscViewer, path::String) +Check whether a given dataset exists in the HDF5 file + +Collective + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `path` - The dataset path + +Output Parameter: +- `has` - Flag whether dataset exists + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5HasObject()`, `PetscViewerHDF5HasAttribute()`, `PetscViewerHDF5HasGroup()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5HasDataset")) +""" +function PetscViewerHDF5HasDataset(petsclib::PetscLibType, viewer::PetscViewer, path::String) end + +@for_petsc function PetscViewerHDF5HasDataset(petsclib::$UnionPetscLib, viewer::PetscViewer, path::String ) + has_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5HasDataset, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{PetscBool}), + viewer, path, has_, + ) + + has = has_[] + + return has +end + +""" + has::PetscBool = PetscViewerHDF5HasObject(petsclib::PetscLibType,viewer::PetscViewer, obj::PetscObject) +Check whether a dataset with the same name as given object exists in the HDF5 file under current group + +Collective + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `obj` - The named object + +Output Parameter: +- `has` - Flag for dataset existence + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5HasDataset()`, `PetscViewerHDF5HasAttribute()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5HasObject")) +""" +function PetscViewerHDF5HasObject(petsclib::PetscLibType, viewer::PetscViewer, obj::PetscObject) end + +@for_petsc function PetscViewerHDF5HasObject(petsclib::$UnionPetscLib, viewer::PetscViewer, obj::PetscObject ) + has_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5HasObject, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscObject, Ptr{PetscBool}), + viewer, obj, has_, + ) + + has = has_[] + + return has +end + +""" + has::PetscBool = PetscViewerHDF5HasAttribute(petsclib::PetscLibType,viewer::PetscViewer, parent::String, name::String) +Check whether an attribute exists + +Collective + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `parent` - The parent dataset/group name +- `name` - The attribute name + +Output Parameter: +- `has` - Flag for attribute existence + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5HasObjectAttribute()`, `PetscViewerHDF5WriteAttribute()`, `PetscViewerHDF5ReadAttribute()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5HasAttribute")) +""" +function PetscViewerHDF5HasAttribute(petsclib::PetscLibType, viewer::PetscViewer, parent::String, name::String) end + +@for_petsc function PetscViewerHDF5HasAttribute(petsclib::$UnionPetscLib, viewer::PetscViewer, parent::String, name::String ) + has_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5HasAttribute, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}), + viewer, parent, name, has_, + ) + + has = has_[] + + return has +end + +""" + has::PetscBool = PetscViewerHDF5HasObjectAttribute(petsclib::PetscLibType,viewer::PetscViewer, obj::PetscObject, name::String) +Check whether an attribute is attached to the dataset matching the given `PetscObject` by name + +Collective + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `obj` - The object whose name is used to lookup the parent dataset, relative to the current group. +- `name` - The attribute name + +Output Parameter: +- `has` - Flag for attribute existence + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5HasAttribute()`, `PetscViewerHDF5WriteObjectAttribute()`, `PetscViewerHDF5ReadObjectAttribute()`, `PetscViewerHDF5HasObject()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5HasObjectAttribute")) +""" +function PetscViewerHDF5HasObjectAttribute(petsclib::PetscLibType, viewer::PetscViewer, obj::PetscObject, name::String) end + +@for_petsc function PetscViewerHDF5HasObjectAttribute(petsclib::$UnionPetscLib, viewer::PetscViewer, obj::PetscObject, name::String ) + has_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5HasObjectAttribute, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscObject, Ptr{Cchar}, Ptr{PetscBool}), + viewer, obj, name, has_, + ) + + has = has_[] + + return has +end + +""" + PetscViewerCGNSOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, viewer::PetscViewer) +Opens a file for CGNS input/output. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `name` - name of file +- `type` - type of file +-seealso: `PETSCVIEWERCGNS`, `PetscViewer`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, +`DMLoad()`, `PetscFileMode`, `PetscViewerSetType()`, `PetscViewerFileSetMode()`, `PetscViewerFileSetName()` + +# External Links +$(_doc_external("Sys/PetscViewerCGNSOpen")) +""" +function PetscViewerCGNSOpen(petsclib::PetscLibType, comm::MPI_Comm, name::String, type::PetscFileMode, viewer::PetscViewer) end + +@for_petsc function PetscViewerCGNSOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, name::String, type::PetscFileMode, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerCGNSOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscFileMode, Ptr{PetscViewer}), + comm, name, type, viewer, + ) + + + return nothing +end + +""" + PetscViewerCGNSSetSolutionIndex(petsclib::PetscLibType,viewer::PetscViewer, solution_id::PetscInt) +Set index of solution + +Not Collective + +Input Parameters: +- `viewer` - `PETSCVIEWERCGNS` `PetscViewer` for CGNS input/output to use with the specified file +- `solution_id` - Index of the solution id, or `-1` for the last solution on the file + +Level: intermediate + +-seealso: `PETSCVIEWERCGNS`, `PetscViewerCGNSGetSolutionIndex()`, `PetscViewerCGNSGetSolutionInfo()` + + +# External Links +$(_doc_external("Sys/PetscViewerCGNSSetSolutionIndex")) +""" +function PetscViewerCGNSSetSolutionIndex(petsclib::PetscLibType, viewer::PetscViewer, solution_id::PetscInt) end + +@for_petsc function PetscViewerCGNSSetSolutionIndex(petsclib::$UnionPetscLib, viewer::PetscViewer, solution_id::$PetscInt ) + + @chk ccall( + (:PetscViewerCGNSSetSolutionIndex, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, solution_id, + ) + + + return nothing +end + +""" + solution_id::PetscInt = PetscViewerCGNSGetSolutionIndex(petsclib::PetscLibType,viewer::PetscViewer) +Get index of solution + +Not Collective + +Input Parameter: +- `viewer` - `PETSCVIEWERCGNS` `PetscViewer` for CGNS input/output to use with the specified file + +Output Parameter: +- `solution_id` - Index of the solution id + +Level: intermediate + +-seealso: `PETSCVIEWERCGNS`, `PetscViewerCGNSSetSolutionIndex()`, `PetscViewerCGNSGetSolutionInfo()` + + +# External Links +$(_doc_external("Sys/PetscViewerCGNSGetSolutionIndex")) +""" +function PetscViewerCGNSGetSolutionIndex(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerCGNSGetSolutionIndex(petsclib::$UnionPetscLib, viewer::PetscViewer ) + solution_id_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerCGNSGetSolutionIndex, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscInt}), + viewer, solution_id_, + ) + + solution_id = solution_id_[] + + return solution_id +end + +""" + time::PetscReal,set::PetscBool = PetscViewerCGNSGetSolutionTime(petsclib::PetscLibType,viewer::PetscViewer) +Gets the solution time for the FlowSolution of the viewer + +Collective + +Input Parameter: +- `viewer` - `PETSCVIEWERCGNS` `PetscViewer` for CGNS input/output to use with the specified file + +Output Parameters: +- `time` - Solution time of the FlowSolution_t node +- `set` - Whether the time data is in the file + +Level: intermediate + +-seealso: `PETSCVIEWERCGNS`, `PetscViewer`, `PetscViewerCGNSGetSolutionIteration()`, `PetscViewerCGNSSetSolutionIndex()`, `PetscViewerCGNSGetSolutionIndex()`, `PetscViewerCGNSGetSolutionName()` + +# External Links +$(_doc_external("Sys/PetscViewerCGNSGetSolutionTime")) +""" +function PetscViewerCGNSGetSolutionTime(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerCGNSGetSolutionTime(petsclib::$UnionPetscLib, viewer::PetscViewer ) + time_ = Ref{$PetscReal}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerCGNSGetSolutionTime, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscReal}, Ptr{PetscBool}), + viewer, time_, set_, + ) + + time = time_[] + set = set_[] + + return time,set +end + +""" + iteration::PetscInt,set::PetscBool = PetscViewerCGNSGetSolutionIteration(petsclib::PetscLibType,viewer::PetscViewer) +Gets the solution iteration for the FlowSolution of the viewer + +Collective + +Input Parameter: +- `viewer` - `PETSCVIEWERCGNS` `PetscViewer` for CGNS input/output to use with the specified file + +Output Parameters: +- `iteration` - Solution iteration of the FlowSolution_t node +- `set` - Whether the time data is in the file + +Level: intermediate + +-seealso: `PETSCVIEWERCGNS`, `PetscViewer`, `PetscViewerCGNSGetSolutionTime()`, `PetscViewerCGNSSetSolutionIndex()`, `PetscViewerCGNSGetSolutionIndex()`, `PetscViewerCGNSGetSolutionName()` + +# External Links +$(_doc_external("Sys/PetscViewerCGNSGetSolutionIteration")) +""" +function PetscViewerCGNSGetSolutionIteration(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerCGNSGetSolutionIteration(petsclib::$UnionPetscLib, viewer::PetscViewer ) + iteration_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerCGNSGetSolutionIteration, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscInt}, Ptr{PetscBool}), + viewer, iteration_, set_, + ) + + iteration = iteration_[] + set = set_[] + + return iteration,set +end + +""" + PetscViewerCGNSGetSolutionName(petsclib::PetscLibType,viewer::PetscViewer, name::String) +Gets name of FlowSolution of the viewer + +Collective + +Input Parameter: +- `viewer` - `PETSCVIEWERCGNS` `PetscViewer` for CGNS input/output to use with the specified file + +Output Parameter: +- `name` - Name of the FlowSolution_t node corresponding to the solution index + +Level: intermediate + +-seealso: `PETSCVIEWERCGNS`, `PetscViewer`, `PetscViewerCGNSSetSolutionIndex()`, `PetscViewerCGNSGetSolutionIndex()`, `PetscViewerCGNSGetSolutionTime()` + +# External Links +$(_doc_external("Sys/PetscViewerCGNSGetSolutionName")) +""" +function PetscViewerCGNSGetSolutionName(petsclib::PetscLibType, viewer::PetscViewer, name::String) end + +@for_petsc function PetscViewerCGNSGetSolutionName(petsclib::$UnionPetscLib, viewer::PetscViewer, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PetscViewerCGNSGetSolutionName, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Ptr{Cchar}}), + viewer, name_, + ) + + + return nothing +end + +""" + PetscViewerMathematicaFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the PETSc interface to Mathematica. It is +called from PetscFinalize(). + +Level: developer + +-seealso: `PetscFinalize()` + +# External Links +$(_doc_external("Sys/PetscViewerMathematicaFinalizePackage")) +""" +function PetscViewerMathematicaFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscViewerMathematicaFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscViewerMathematicaFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscViewerMathematicaInitializePackage(petsclib::PetscLibType) +This function initializes everything in the PETSc interface to Mathematica. It is +called from `PetscViewerInitializePackage()`. + +Level: developer + +-seealso: `PetscSysInitializePackage()`, `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscViewerMathematicaInitializePackage")) +""" +function PetscViewerMathematicaInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscViewerMathematicaInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscViewerMathematicaInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscViewerMathematicaOpen(petsclib::PetscLibType,comm::MPI_Comm, port::Cint, machine::String, mode::String, v::PetscViewer) +Communicates with Mathemtica using MathLink. + +Collective + +Input Parameters: +- `comm` - The MPI communicator +- `port` - [optional] The port to connect on, or PETSC_DECIDE +- `machine` - [optional] The machine to run Mathematica on, or NULL +- `mode` - [optional] The connection mode, or NULL + +Output Parameter: +- `v` - The Mathematica viewer + +Options Database Keys: +- `-viewer_math_linkhost ` - The host machine for the kernel +- `-viewer_math_linkname ` - The full link name for the connection +- `-viewer_math_linkport ` - The port for the connection +- `-viewer_math_mode ` - The mode, e.g. Launch, Connect +- `-viewer_math_type ` - The plot type, e.g. Triangulation, Vector +- `-viewer_math_graphics ` - The output type, e.g. Motif, PS, PSFile + +Level: intermediate + +-seealso: `PETSCVIEWERMATHEMATICA`, `MatView()`, `VecView()` + +# External Links +$(_doc_external("Sys/PetscViewerMathematicaOpen")) +""" +function PetscViewerMathematicaOpen(petsclib::PetscLibType, comm::MPI_Comm, port::Cint, machine::String, mode::String, v::PetscViewer) end + +@for_petsc function PetscViewerMathematicaOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, port::Cint, machine::String, mode::String, v::PetscViewer ) + + @chk ccall( + (:PetscViewerMathematicaOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Cint, Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscViewer}), + comm, port, machine, mode, v, + ) + + + return nothing +end + +""" + PetscViewerMathematicaSkipPackets(petsclib::PetscLibType,viewer::PetscViewer, type::Cint) +Discard packets sent by Mathematica until a certain packet type is received + +Input Parameters: +- `viewer` - The Mathematica viewer +- `type` - The packet type to search for, e.g RETURNPKT + +Level: advanced + +-seealso: `PetscViewerMathematicaSetName()`, `PetscViewerMathematicaGetVector()` + +# External Links +$(_doc_external("Sys/PetscViewerMathematicaSkipPackets")) +""" +function PetscViewerMathematicaSkipPackets(petsclib::PetscLibType, viewer::PetscViewer, type::Cint) end + +@for_petsc function PetscViewerMathematicaSkipPackets(petsclib::$UnionPetscLib, viewer::PetscViewer, type::Cint ) + + @chk ccall( + (:PetscViewerMathematicaSkipPackets, $petsc_library), + PetscErrorCode, + (PetscViewer, Cint), + viewer, type, + ) + + + return nothing +end + +""" + PetscViewerMathematicaGetName(petsclib::PetscLibType,viewer::PetscViewer, name::Cchar) +Retrieve the default name for objects communicated to Mathematica via `PETSCVIEWERMATHEMATICA` + +Input Parameter: +- `viewer` - The Mathematica viewer + +Output Parameter: +- `name` - The name for new objects created in Mathematica + +Level: intermediate + +-seealso: `PETSCVIEWERMATHEMATICA`, `PetscViewerMathematicaSetName()`, `PetscViewerMathematicaClearName()` + +# External Links +$(_doc_external("Sys/PetscViewerMathematicaGetName")) +""" +function PetscViewerMathematicaGetName(petsclib::PetscLibType, viewer::PetscViewer, name::Cchar) end + +@for_petsc function PetscViewerMathematicaGetName(petsclib::$UnionPetscLib, viewer::PetscViewer, name::Cchar ) + + @chk ccall( + (:PetscViewerMathematicaGetName, $petsc_library), + PetscErrorCode, + (PetscViewer, Cchar), + viewer, name, + ) + + + return nothing +end + +""" + PetscViewerMathematicaSetName(petsclib::PetscLibType,viewer::PetscViewer, name::String) +Override the default name for objects communicated to Mathematica via `PETSCVIEWERMATHEMATICA` + +Input Parameters: +- `viewer` - The Mathematica viewer +- `name` - The name for new objects created in Mathematica + +Level: intermediate + +-seealso: `PETSCVIEWERMATHEMATICA`, `PetscViewerMathematicaClearName()` + +# External Links +$(_doc_external("Sys/PetscViewerMathematicaSetName")) +""" +function PetscViewerMathematicaSetName(petsclib::PetscLibType, viewer::PetscViewer, name::String) end + +@for_petsc function PetscViewerMathematicaSetName(petsclib::$UnionPetscLib, viewer::PetscViewer, name::String ) + + @chk ccall( + (:PetscViewerMathematicaSetName, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}), + viewer, name, + ) + + + return nothing +end + +""" + PetscViewerMathematicaClearName(petsclib::PetscLibType,viewer::PetscViewer) +Use the default name for objects communicated to Mathematica + +Input Parameter: +- `viewer` - The Mathematica viewer + +Level: intermediate + +-seealso: `PETSCVIEWERMATHEMATICA`, `PetscViewerMathematicaGetName()`, `PetscViewerMathematicaSetName()` + +# External Links +$(_doc_external("Sys/PetscViewerMathematicaClearName")) +""" +function PetscViewerMathematicaClearName(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerMathematicaClearName(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerMathematicaClearName, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + a::PetscReal = PetscViewerMathematicaPutMatrix(petsclib::PetscLibType,viewer::PetscViewer, m::Cint, n::Cint) + +# External Links +$(_doc_external("Sys/PetscViewerMathematicaPutMatrix")) +""" +function PetscViewerMathematicaPutMatrix(petsclib::PetscLibType, viewer::PetscViewer, m::Cint, n::Cint) end + +@for_petsc function PetscViewerMathematicaPutMatrix(petsclib::$UnionPetscLib, viewer::PetscViewer, m::Cint, n::Cint ) + a_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscViewerMathematicaPutMatrix, $petsc_library), + PetscErrorCode, + (PetscViewer, Cint, Cint, Ptr{$PetscReal}), + viewer, m, n, a_, + ) + + a = a_[] + + return a +end + +""" + a::PetscReal = PetscViewerMathematicaPutCSRMatrix(petsclib::PetscLibType,viewer::PetscViewer, m::Cint, n::Cint, i::Cint, j::Cint) + +# External Links +$(_doc_external("Sys/PetscViewerMathematicaPutCSRMatrix")) +""" +function PetscViewerMathematicaPutCSRMatrix(petsclib::PetscLibType, viewer::PetscViewer, m::Cint, n::Cint, i::Cint, j::Cint) end + +@for_petsc function PetscViewerMathematicaPutCSRMatrix(petsclib::$UnionPetscLib, viewer::PetscViewer, m::Cint, n::Cint, i::Cint, j::Cint ) + a_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscViewerMathematicaPutCSRMatrix, $petsc_library), + PetscErrorCode, + (PetscViewer, Cint, Cint, Ptr{Cint}, Ptr{Cint}, Ptr{$PetscReal}), + viewer, m, n, i, j, a_, + ) + + a = a_[] + + return a +end + +""" + PetscViewerVTKAddField(petsclib::PetscLibType,viewer::PetscViewer, dm::PetscObject, PetscViewerVTKWriteFunction::external, fieldnum::PetscInt, fieldtype::PetscViewerVTKFieldType, checkdm::PetscBool, vec::PetscObject) +Add a field to the viewer + +Collective + +Input Parameters: +- `viewer` - `PETSCVIEWERVTK` +- `dm` - `DM` on which `Vec` lives +- `PetscViewerVTKWriteFunction` - function to write this `Vec` +- `fieldnum` - which field of the `DM` to write (`PETSC_DEFAULT` if the whole vector should be written) +- `fieldtype` - Either `PETSC_VTK_POINT_FIELD` or `PETSC_VTK_CELL_FIELD` +- `checkdm` - whether to check for identical dm arguments as fields are added +- `vec` - `Vec` from which to write + +Level: developer + +-seealso: [](sec_viewers), `PETSCVIEWERVTK`, `PetscViewerVTKOpen()`, `DMDAVTKWriteAll()`, `PetscViewerVTKWriteFunction`, `PetscViewerVTKGetDM()` + +# External Links +$(_doc_external("Sys/PetscViewerVTKAddField")) +""" +function PetscViewerVTKAddField(petsclib::PetscLibType, viewer::PetscViewer, dm::PetscObject, PetscViewerVTKWriteFunction::external, fieldnum::PetscInt, fieldtype::PetscViewerVTKFieldType, checkdm::PetscBool, vec::PetscObject) end + +@for_petsc function PetscViewerVTKAddField(petsclib::$UnionPetscLib, viewer::PetscViewer, dm::PetscObject, PetscViewerVTKWriteFunction::external, fieldnum::$PetscInt, fieldtype::PetscViewerVTKFieldType, checkdm::PetscBool, vec::PetscObject ) + + @chk ccall( + (:PetscViewerVTKAddField, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscObject, external, $PetscInt, PetscViewerVTKFieldType, PetscBool, PetscObject), + viewer, dm, PetscViewerVTKWriteFunction, fieldnum, fieldtype, checkdm, vec, + ) + + + return nothing +end + +""" + PetscViewerVTKGetDM(petsclib::PetscLibType,viewer::PetscViewer, dm::PetscObject) +get the `DM` associated with the `PETSCVIEWERVTK` viewer + +Collective + +Input Parameters: +- `viewer` - `PETSCVIEWERVTK` viewer +- `dm` - `DM` associated with the viewer (as a `PetscObject`) + +Level: developer + +-seealso: [](sec_viewers), `PETSCVIEWERVTK`, `PetscViewerVTKOpen()`, `DMDAVTKWriteAll()`, `PetscViewerVTKWriteFunction`, `PetscViewerVTKAddField()` + +# External Links +$(_doc_external("Sys/PetscViewerVTKGetDM")) +""" +function PetscViewerVTKGetDM(petsclib::PetscLibType, viewer::PetscViewer, dm::PetscObject) end + +@for_petsc function PetscViewerVTKGetDM(petsclib::$UnionPetscLib, viewer::PetscViewer, dm::PetscObject ) + + @chk ccall( + (:PetscViewerVTKGetDM, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscObject}), + viewer, dm, + ) + + + return nothing +end + +""" + PetscViewerVTKOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, vtk::PetscViewer) +Opens a `PETSCVIEWERVTK` viewer file. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `name` - name of file +- `type` - type of file +-seealso: [](sec_viewers), `PETSCVIEWERVTK`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, +`VecView()`, `MatView()`, `VecLoad()`, `MatLoad()`, +`PetscFileMode`, `PetscViewer` + +# External Links +$(_doc_external("Sys/PetscViewerVTKOpen")) +""" +function PetscViewerVTKOpen(petsclib::PetscLibType, comm::MPI_Comm, name::String, type::PetscFileMode, vtk::PetscViewer) end + +@for_petsc function PetscViewerVTKOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, name::String, type::PetscFileMode, vtk::PetscViewer ) + + @chk ccall( + (:PetscViewerVTKOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscFileMode, Ptr{PetscViewer}), + comm, name, type, vtk, + ) + + + return nothing +end + +""" + PetscViewerMatlabPutArray(petsclib::PetscLibType,mfile::PetscViewer, m::Cint, n::Cint, array::PetscScalar, name::String) +Puts an array into the `PETSCVIEWERMATLAB` viewer. + +Not Collective, only processor zero saves `array` + +Input Parameters: +- `mfile` - the viewer +- `m` - the first dimensions of `array` +- `n` - the second dimensions of `array` +- `array` - the array (represented in one dimension) +- `name` - the MATLAB name of `array` + +Level: advanced + +-seealso: `PETSCVIEWERMATLAB`, `PetscViewerMatlabGetArray()` + +# External Links +$(_doc_external("Sys/PetscViewerMatlabPutArray")) +""" +function PetscViewerMatlabPutArray(petsclib::PetscLibType, mfile::PetscViewer, m::Cint, n::Cint, array::PetscScalar, name::String) end + +@for_petsc function PetscViewerMatlabPutArray(petsclib::$UnionPetscLib, mfile::PetscViewer, m::Cint, n::Cint, array::$PetscScalar, name::String ) + + @chk ccall( + (:PetscViewerMatlabPutArray, $petsc_library), + PetscErrorCode, + (PetscViewer, Cint, Cint, Ptr{$PetscScalar}, Ptr{Cchar}), + mfile, m, n, array, name, + ) + + + return nothing +end + +""" + PetscViewerMatlabPutVariable(petsclib::PetscLibType,viewer::PetscViewer, name::String, mat::Cvoid) + +# External Links +$(_doc_external("Sys/PetscViewerMatlabPutVariable")) +""" +function PetscViewerMatlabPutVariable(petsclib::PetscLibType, viewer::PetscViewer, name::String, mat::Cvoid) end + +@for_petsc function PetscViewerMatlabPutVariable(petsclib::$UnionPetscLib, viewer::PetscViewer, name::String, mat::Cvoid ) + + @chk ccall( + (:PetscViewerMatlabPutVariable, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{Cvoid}), + viewer, name, mat, + ) + + + return nothing +end + +""" + PetscViewerMatlabGetArray(petsclib::PetscLibType,mfile::PetscViewer, m::Cint, n::Cint, array::Vector{PetscScalar}, name::String) +Gets a variable from a `PETSCVIEWERMATLAB` viewer into an array + +Not Collective; only processor zero reads in the array + +Input Parameters: +- `mfile` - the MATLAB file viewer +- `m` - the first dimensions of `array` +- `n` - the second dimensions of `array` +- `array` - the array (represented in one dimension), must of be length `m` * `n` +- `name` - the MATLAB name of `array` + +Level: advanced + +-seealso: `PETSCVIEWERMATLAB`, `PetscViewerMatlabPutArray()` + +# External Links +$(_doc_external("Sys/PetscViewerMatlabGetArray")) +""" +function PetscViewerMatlabGetArray(petsclib::PetscLibType, mfile::PetscViewer, m::Cint, n::Cint, array::Vector{PetscScalar}, name::String) end + +@for_petsc function PetscViewerMatlabGetArray(petsclib::$UnionPetscLib, mfile::PetscViewer, m::Cint, n::Cint, array::Vector{$PetscScalar}, name::String ) + + @chk ccall( + (:PetscViewerMatlabGetArray, $petsc_library), + PetscErrorCode, + (PetscViewer, Cint, Cint, Ptr{$PetscScalar}, Ptr{Cchar}), + mfile, m, n, array, name, + ) + + + return nothing +end + +""" + PetscViewerMatlabOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, binv::PetscViewer) +Opens a MATLAB .mat file for output + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `name` - name of file +- `type` - type of file +-seealso: `PETSCVIEWERMATLAB`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()` +`VecView()`, `MatView()`, `VecLoad()`, `MatLoad()` + +# External Links +$(_doc_external("Sys/PetscViewerMatlabOpen")) +""" +function PetscViewerMatlabOpen(petsclib::PetscLibType, comm::MPI_Comm, name::String, type::PetscFileMode, binv::PetscViewer) end + +@for_petsc function PetscViewerMatlabOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, name::String, type::PetscFileMode, binv::PetscViewer ) + + @chk ccall( + (:PetscViewerMatlabOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscFileMode, Ptr{PetscViewer}), + comm, name, type, binv, + ) + + + return nothing +end + +""" + PetscViewerGLVisSetPrecision(petsclib::PetscLibType,viewer::PetscViewer, prec::PetscInt) +Set the number of digits for floating point values to be displayed + +Not Collective + +Input Parameters: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERGLVIS` +- `prec` - the number of digits required + +Level: beginner + +-seealso: [](sec_viewers), `PETSCVIEWERGLVIS`, `PetscViewerGLVisOpen()`, `PetscViewerGLVisSetFields()`, `PetscViewerCreate()`, `PetscViewerSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerGLVisSetPrecision")) +""" +function PetscViewerGLVisSetPrecision(petsclib::PetscLibType, viewer::PetscViewer, prec::PetscInt) end + +@for_petsc function PetscViewerGLVisSetPrecision(petsclib::$UnionPetscLib, viewer::PetscViewer, prec::$PetscInt ) + + @chk ccall( + (:PetscViewerGLVisSetPrecision, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, prec, + ) + + + return nothing +end + +""" + PetscViewerGLVisSetSnapId(petsclib::PetscLibType,viewer::PetscViewer, id::PetscInt) +Set the snapshot id. Only relevant when the `PetscViewerGLVisType` is `PETSC_VIEWER_GLVIS_DUMP` + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERGLVIS` +- `id` - the current snapshot id in a time-dependent simulation + +Level: beginner + +-seealso: [](sec_viewers), `PETSCVIEWERGLVIS`, `PetscViewerGLVisOpen()`, `PetscViewerGLVisSetFields()`, `PetscViewerCreate()`, `PetscViewerSetType()` + +# External Links +$(_doc_external("Sys/PetscViewerGLVisSetSnapId")) +""" +function PetscViewerGLVisSetSnapId(petsclib::PetscLibType, viewer::PetscViewer, id::PetscInt) end + +@for_petsc function PetscViewerGLVisSetSnapId(petsclib::$UnionPetscLib, viewer::PetscViewer, id::$PetscInt ) + + @chk ccall( + (:PetscViewerGLVisSetSnapId, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, id, + ) + + + return nothing +end + +""" + PetscViewerGLVisSetFields(petsclib::PetscLibType,viewer::PetscViewer, nf::PetscInt, fec_type::String, dim::Vector{PetscInt}, g2l::external, Vfield::Vector{PetscObject}, ctx::Cvoid, destroyctx::external) +Sets the required information to visualize different fields from a vector. + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer` of type `PETSCVIEWERGLVIS` +- `nf` - number of fields to be visualized +- `fec_type` - the type of finite element to be used to visualize the data (see FiniteElementCollection::Name() in MFEM) +- `dim` - array of space dimension for field vectors (used to initialize the scene) +- `g2l` - User routine to compute the local field vectors to be visualized; PetscObject is used in place of Vec on the prototype +- `Vfield` - array of work vectors, one for each field +- `ctx` - User context to store the relevant data to apply g2lfields +- `destroyctx` - Destroy function for userctx + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERGLVIS`, `PetscViewerGLVisOpen()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscObjectSetName()` + +# External Links +$(_doc_external("Sys/PetscViewerGLVisSetFields")) +""" +function PetscViewerGLVisSetFields(petsclib::PetscLibType, viewer::PetscViewer, nf::PetscInt, fec_type::String, dim::Vector{PetscInt}, g2l::external, Vfield::Vector{PetscObject}, ctx::Cvoid, destroyctx::external) end + +@for_petsc function PetscViewerGLVisSetFields(petsclib::$UnionPetscLib, viewer::PetscViewer, nf::$PetscInt, fec_type::String, dim::Vector{$PetscInt}, g2l::external, Vfield::Vector{PetscObject}, ctx::Cvoid, destroyctx::external ) + fec_type_ = Ref(pointer(fec_type)) + + @chk ccall( + (:PetscViewerGLVisSetFields, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt, Ptr{Ptr{Cchar}}, Ptr{$PetscInt}, external, Ptr{PetscObject}, Ptr{Cvoid}, external), + viewer, nf, fec_type_, dim, g2l, Vfield, ctx, destroyctx, + ) + + + return nothing +end + +""" + PetscViewerGLVisOpen(petsclib::PetscLibType,comm::MPI_Comm, type::PetscViewerGLVisType, name::String, port::PetscInt, viewer::PetscViewer) +Opens a `PETSCVIEWERGLVIS` `PetscViewer` + +Collective; No Fortran Support + +Input Parameters: +- `comm` - the MPI communicator +- `type` - the viewer type: `PETSC_VIEWER_GLVIS_SOCKET` for real-time visualization or `PETSC_VIEWER_GLVIS_DUMP` for dumping to a file +- `name` - either the hostname where the GLVis server is running or the base filename for dumping the data for subsequent visualizations +- `port` - socket port where the GLVis server is listening. Not referenced when type is `PETSC_VIEWER_GLVIS_DUMP` + +Output Parameter: +- `viewer` - the `PetscViewer` object + +Options Database Keys: +- `-glvis_precision ` - Sets number of digits for floating point values +- `-glvis_size ` - Sets the window size (in pixels) +- `-glvis_pause ` - Sets time (in seconds) that the program pauses after each visualization +(0 is default, -1 implies every visualization) +- `-glvis_keys` - Additional keys to configure visualization +- `-glvis_exec` - Additional commands to configure visualization + +Level: beginner + +-seealso: [](sec_viewers), `PETSCVIEWERGLVIS`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerGLVisType` + +# External Links +$(_doc_external("Sys/PetscViewerGLVisOpen")) +""" +function PetscViewerGLVisOpen(petsclib::PetscLibType, comm::MPI_Comm, type::PetscViewerGLVisType, name::String, port::PetscInt, viewer::PetscViewer) end + +@for_petsc function PetscViewerGLVisOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, type::PetscViewerGLVisType, name::String, port::$PetscInt, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerGLVisOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscViewerGLVisType, Ptr{Cchar}, $PetscInt, Ptr{PetscViewer}), + comm, type, name, port, viewer, + ) + + + return nothing +end + +""" + PetscViewerBinaryGetMPIIOOffset(petsclib::PetscLibType,viewer::PetscViewer, off::MPI_Offset) +Gets the current global offset that should be passed to `MPI_File_set_view()` or `MPI_File_{write|read}_at[_all]()` + +Not Collective; No Fortran Support + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` + +Output Parameter: +- `off` - the current global offset + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetInfoPointer()`, `PetscViewerBinaryGetUseMPIIO()`, `PetscViewerBinarySetUseMPIIO()`, `PetscViewerBinaryAddMPIIOOffset()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryGetMPIIOOffset")) +""" +function PetscViewerBinaryGetMPIIOOffset(petsclib::PetscLibType, viewer::PetscViewer, off::MPI_Offset) end + +@for_petsc function PetscViewerBinaryGetMPIIOOffset(petsclib::$UnionPetscLib, viewer::PetscViewer, off::MPI_Offset ) + + @chk ccall( + (:PetscViewerBinaryGetMPIIOOffset, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{MPI_Offset}), + viewer, off, + ) + + + return nothing +end + +""" + PetscViewerBinaryAddMPIIOOffset(petsclib::PetscLibType,viewer::PetscViewer, off::MPI_Offset) +Adds to the current global offset + +Logically Collective; No Fortran Support + +Input Parameters: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` +- `off` - the addition to the global offset + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetInfoPointer()`, `PetscViewerBinaryGetUseMPIIO()`, `PetscViewerBinarySetUseMPIIO()`, `PetscViewerBinaryGetMPIIOOffset()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryAddMPIIOOffset")) +""" +function PetscViewerBinaryAddMPIIOOffset(petsclib::PetscLibType, viewer::PetscViewer, off::MPI_Offset) end + +@for_petsc function PetscViewerBinaryAddMPIIOOffset(petsclib::$UnionPetscLib, viewer::PetscViewer, off::MPI_Offset ) + + @chk ccall( + (:PetscViewerBinaryAddMPIIOOffset, $petsc_library), + PetscErrorCode, + (PetscViewer, MPI_Offset), + viewer, off, + ) + + + return nothing +end + +""" + PetscViewerBinaryGetMPIIODescriptor(petsclib::PetscLibType,viewer::PetscViewer, fdes::MPI_File) +Extracts the MPI IO file descriptor from a `PetscViewer`. + +Not Collective; No Fortran Support + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` + +Output Parameter: +- `fdes` - file descriptor + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetInfoPointer()`, `PetscViewerBinaryGetUseMPIIO()`, `PetscViewerBinarySetUseMPIIO()`, `PetscViewerBinaryGetMPIIOOffset()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryGetMPIIODescriptor")) +""" +function PetscViewerBinaryGetMPIIODescriptor(petsclib::PetscLibType, viewer::PetscViewer, fdes::MPI_File) end + +@for_petsc function PetscViewerBinaryGetMPIIODescriptor(petsclib::$UnionPetscLib, viewer::PetscViewer, fdes::MPI_File ) + + @chk ccall( + (:PetscViewerBinaryGetMPIIODescriptor, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{MPI_File}), + viewer, fdes, + ) + + + return nothing +end + +""" + PetscViewerBinarySetUseMPIIO(petsclib::PetscLibType,viewer::PetscViewer, use::PetscBool) +Sets a binary viewer to use MPI +before `PetscViewerFileSetName()` + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer`; must be a `PETSCVIEWERBINARY` +- `use` - `PETSC_TRUE` means MPI-IO will be used + +Options Database Key: +- `-viewer_binary_mpiio` - flag for using MPI-IO + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerFileSetMode()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()`, +`PetscViewerBinaryGetUseMPIIO()` + +# External Links +$(_doc_external("Sys/PetscViewerBinarySetUseMPIIO")) +""" +function PetscViewerBinarySetUseMPIIO(petsclib::PetscLibType, viewer::PetscViewer, use::PetscBool) end + +@for_petsc function PetscViewerBinarySetUseMPIIO(petsclib::$UnionPetscLib, viewer::PetscViewer, use::PetscBool ) + + @chk ccall( + (:PetscViewerBinarySetUseMPIIO, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, use, + ) + + + return nothing +end + +""" + use::PetscBool = PetscViewerBinaryGetUseMPIIO(petsclib::PetscLibType,viewer::PetscViewer) +Returns `PETSC_TRUE` if the binary viewer uses MPI + +Not Collective + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()`; must be a `PETSCVIEWERBINARY` + +Output Parameter: +- `use` - `PETSC_TRUE` if MPI-IO is being used + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetInfoPointer()`, `PetscViewerBinarySetUseMPIIO()`, `PetscViewerBinaryGetMPIIOOffset()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryGetUseMPIIO")) +""" +function PetscViewerBinaryGetUseMPIIO(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerBinaryGetUseMPIIO(petsclib::$UnionPetscLib, viewer::PetscViewer ) + use_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerBinaryGetUseMPIIO, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, use_, + ) + + use = use_[] + + return use +end + +""" + PetscViewerBinarySetFlowControl(petsclib::PetscLibType,viewer::PetscViewer, fc::PetscInt) +Sets how many messages are allowed to be outstanding at the same time during parallel IO reads/writes + +Not Collective + +Input Parameters: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` +- `fc` - the number of messages, defaults to 256 if this function was not called + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetInfoPointer()`, `PetscViewerBinaryGetFlowControl()` + +# External Links +$(_doc_external("Sys/PetscViewerBinarySetFlowControl")) +""" +function PetscViewerBinarySetFlowControl(petsclib::PetscLibType, viewer::PetscViewer, fc::PetscInt) end + +@for_petsc function PetscViewerBinarySetFlowControl(petsclib::$UnionPetscLib, viewer::PetscViewer, fc::$PetscInt ) + + @chk ccall( + (:PetscViewerBinarySetFlowControl, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, fc, + ) + + + return nothing +end + +""" + fc::PetscInt = PetscViewerBinaryGetFlowControl(petsclib::PetscLibType,viewer::PetscViewer) +Returns how many messages are allowed to be outstanding at the same time during parallel IO reads/writes + +Not Collective + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` + +Output Parameter: +- `fc` - the number of messages + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetInfoPointer()`, `PetscViewerBinarySetFlowControl()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryGetFlowControl")) +""" +function PetscViewerBinaryGetFlowControl(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerBinaryGetFlowControl(petsclib::$UnionPetscLib, viewer::PetscViewer ) + fc_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerBinaryGetFlowControl, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscInt}), + viewer, fc_, + ) + + fc = fc_[] + + return fc +end + +""" + PetscViewerBinaryGetDescriptor(petsclib::PetscLibType,viewer::PetscViewer, fdes::Cint) +Extracts the file descriptor from a `PetscViewer` of `PetscViewerType` `PETSCVIEWERBINARY`. + +Collective because it may trigger a `PetscViewerSetUp()` call; No Fortran Support + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` + +Output Parameter: +- `fdes` - file descriptor + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetInfoPointer()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryGetDescriptor")) +""" +function PetscViewerBinaryGetDescriptor(petsclib::PetscLibType, viewer::PetscViewer, fdes::Cint) end + +@for_petsc function PetscViewerBinaryGetDescriptor(petsclib::$UnionPetscLib, viewer::PetscViewer, fdes::Cint ) + + @chk ccall( + (:PetscViewerBinaryGetDescriptor, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cint}), + viewer, fdes, + ) + + + return nothing +end + +""" + PetscViewerBinarySkipInfo(petsclib::PetscLibType,viewer::PetscViewer) +Binary file will not have `.info` file created with it + +Not Collective + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerCreate()` + +Options Database Key: +- `-viewer_binary_skip_info` - true indicates do not generate `.info` file + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetDescriptor()`, `PetscViewerBinarySetSkipOptions()`, +`PetscViewerBinaryGetSkipOptions()`, `PetscViewerBinaryGetSkipInfo()` + +# External Links +$(_doc_external("Sys/PetscViewerBinarySkipInfo")) +""" +function PetscViewerBinarySkipInfo(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerBinarySkipInfo(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerBinarySkipInfo, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerBinarySetSkipInfo(petsclib::PetscLibType,viewer::PetscViewer, skip::PetscBool) +Binary file will not have `.info` file created with it + +Not Collective + +Input Parameters: +- `viewer` - PetscViewer context, obtained from `PetscViewerCreate()` +- `skip` - `PETSC_TRUE` implies the `.info` file will not be generated + +Options Database Key: +- `-viewer_binary_skip_info` - true indicates do not generate `.info` file + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetDescriptor()`, `PetscViewerBinarySetSkipOptions()`, +`PetscViewerBinaryGetSkipOptions()`, `PetscViewerBinaryGetSkipInfo()`, `PetscViewerBinaryGetInfoPointer()` + +# External Links +$(_doc_external("Sys/PetscViewerBinarySetSkipInfo")) +""" +function PetscViewerBinarySetSkipInfo(petsclib::PetscLibType, viewer::PetscViewer, skip::PetscBool) end + +@for_petsc function PetscViewerBinarySetSkipInfo(petsclib::$UnionPetscLib, viewer::PetscViewer, skip::PetscBool ) + + @chk ccall( + (:PetscViewerBinarySetSkipInfo, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, skip, + ) + + + return nothing +end + +""" + skip::PetscBool = PetscViewerBinaryGetSkipInfo(petsclib::PetscLibType,viewer::PetscViewer) +check if viewer wrote a `.info` file + +Not Collective + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` + +Output Parameter: +- `skip` - `PETSC_TRUE` implies the `.info` file was not generated + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetDescriptor()`, +`PetscViewerBinarySetSkipOptions()`, `PetscViewerBinarySetSkipInfo()`, `PetscViewerBinaryGetInfoPointer()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryGetSkipInfo")) +""" +function PetscViewerBinaryGetSkipInfo(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerBinaryGetSkipInfo(petsclib::$UnionPetscLib, viewer::PetscViewer ) + skip_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerBinaryGetSkipInfo, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, skip_, + ) + + skip = skip_[] + + return skip +end + +""" + PetscViewerBinarySetSkipOptions(petsclib::PetscLibType,viewer::PetscViewer, skip::PetscBool) +do not use values in the PETSc options database when loading objects + +Not Collective + +Input Parameters: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` +- `skip` - `PETSC_TRUE` means do not use the options from the options database + +Options Database Key: +- `-viewer_binary_skip_options ` - true means do not use the options from the options database + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetDescriptor()`, `PetscViewerBinarySkipInfo()`, +`PetscViewerBinaryGetSkipOptions()` + +# External Links +$(_doc_external("Sys/PetscViewerBinarySetSkipOptions")) +""" +function PetscViewerBinarySetSkipOptions(petsclib::PetscLibType, viewer::PetscViewer, skip::PetscBool) end + +@for_petsc function PetscViewerBinarySetSkipOptions(petsclib::$UnionPetscLib, viewer::PetscViewer, skip::PetscBool ) + + @chk ccall( + (:PetscViewerBinarySetSkipOptions, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, skip, + ) + + + return nothing +end + +""" + skip::PetscBool = PetscViewerBinaryGetSkipOptions(petsclib::PetscLibType,viewer::PetscViewer) +checks if viewer uses the PETSc options database when loading objects + +Not Collective + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` + +Output Parameter: +- `skip` - `PETSC_TRUE` means do not use + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetDescriptor()`, `PetscViewerBinarySkipInfo()`, +`PetscViewerBinarySetSkipOptions()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryGetSkipOptions")) +""" +function PetscViewerBinaryGetSkipOptions(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerBinaryGetSkipOptions(petsclib::$UnionPetscLib, viewer::PetscViewer ) + skip_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerBinaryGetSkipOptions, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, skip_, + ) + + skip = skip_[] + + return skip +end + +""" + PetscViewerBinarySetSkipHeader(petsclib::PetscLibType,viewer::PetscViewer, skip::PetscBool) +do not write a header with size information on output, just raw data + +Not Collective + +Input Parameters: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` +- `skip` - `PETSC_TRUE` means do not write header + +Options Database Key: +- `-viewer_binary_skip_header ` - true means do not write header + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetDescriptor()`, `PetscViewerBinarySkipInfo()`, +`PetscViewerBinaryGetSkipHeader()` + +# External Links +$(_doc_external("Sys/PetscViewerBinarySetSkipHeader")) +""" +function PetscViewerBinarySetSkipHeader(petsclib::PetscLibType, viewer::PetscViewer, skip::PetscBool) end + +@for_petsc function PetscViewerBinarySetSkipHeader(petsclib::$UnionPetscLib, viewer::PetscViewer, skip::PetscBool ) + + @chk ccall( + (:PetscViewerBinarySetSkipHeader, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, skip, + ) + + + return nothing +end + +""" + skip::PetscBool = PetscViewerBinaryGetSkipHeader(petsclib::PetscLibType,viewer::PetscViewer) +checks whether to write a header with size information on output, or just raw data + +Not Collective + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` + +Output Parameter: +- `skip` - `PETSC_TRUE` means do not write header + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetDescriptor()`, `PetscViewerBinarySkipInfo()`, +`PetscViewerBinarySetSkipHeader()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryGetSkipHeader")) +""" +function PetscViewerBinaryGetSkipHeader(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerBinaryGetSkipHeader(petsclib::$UnionPetscLib, viewer::PetscViewer ) + skip_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerBinaryGetSkipHeader, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, skip_, + ) + + skip = skip_[] + + return skip +end + +""" + PetscViewerBinaryGetInfoPointer(petsclib::PetscLibType,viewer::PetscViewer, file::Libc.FILE) +Extracts the file pointer for the ASCII +`.info` file associated with a binary file. + +Not Collective; No Fortran Support + +Input Parameter: +- `viewer` - `PetscViewer` context, obtained from `PetscViewerBinaryOpen()` + +Output Parameter: +- `file` - file pointer Always returns `NULL` if not a binary viewer + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetDescriptor()`, `PetscViewerBinaryGetSkipInfo()`, +`PetscViewerBinarySetSkipInfo()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryGetInfoPointer")) +""" +function PetscViewerBinaryGetInfoPointer(petsclib::PetscLibType, viewer::PetscViewer, file::Libc.FILE) end + +@for_petsc function PetscViewerBinaryGetInfoPointer(petsclib::$UnionPetscLib, viewer::PetscViewer, file::Libc.FILE ) + + @chk ccall( + (:PetscViewerBinaryGetInfoPointer, $petsc_library), + PetscErrorCode, + (PetscViewer, Libc.FILE), + viewer, file, + ) + + + return nothing +end + +""" + PetscViewerBinaryOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, mode::PetscFileMode, viewer::PetscViewer) +Opens a file for binary input/output. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `name` - name of file +- `mode` - open mode of file +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, +`VecView()`, `MatView()`, `VecLoad()`, `MatLoad()`, `PetscViewerBinaryGetDescriptor()`, +`PetscViewerBinaryGetInfoPointer()`, `PetscFileMode`, `PetscViewer`, `PetscViewerBinaryRead()`, `PetscViewerBinarySetUseMPIIO()`, +`PetscViewerBinaryGetUseMPIIO()`, `PetscViewerBinaryGetMPIIOOffset()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryOpen")) +""" +function PetscViewerBinaryOpen(petsclib::PetscLibType, comm::MPI_Comm, name::String, mode::PetscFileMode, viewer::PetscViewer) end + +@for_petsc function PetscViewerBinaryOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, name::String, mode::PetscFileMode, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerBinaryOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscFileMode, Ptr{PetscViewer}), + comm, name, mode, viewer, + ) + + + return nothing +end + +""" + count::PetscInt = PetscViewerBinaryRead(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, num::PetscInt, dtype::PetscDataType) +Reads from a binary file, all processors get the same result + +Collective; No Fortran Support + +Input Parameters: +- `viewer` - the `PETSCVIEWERBINARY` viewer +- `num` - number of items of data to read +- `dtype` - type of data to read + +Output Parameters: +- `data` - location of the read data, treated as an array of the type indicated by `dtype` +- `count` - number of items of data actually read, or `NULL`. + +Level: beginner + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, +`VecView()`, `MatView()`, `VecLoad()`, `MatLoad()`, `PetscViewerBinaryGetDescriptor()`, +`PetscViewerBinaryGetInfoPointer()`, `PetscFileMode`, `PetscViewer` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryRead")) +""" +function PetscViewerBinaryRead(petsclib::PetscLibType, viewer::PetscViewer, data::Cvoid, num::PetscInt, dtype::PetscDataType) end + +@for_petsc function PetscViewerBinaryRead(petsclib::$UnionPetscLib, viewer::PetscViewer, data::Cvoid, num::$PetscInt, dtype::PetscDataType ) + count_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerBinaryRead, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cvoid}, $PetscInt, Ptr{$PetscInt}, PetscDataType), + viewer, data, num, count_, dtype, + ) + + count = count_[] + + return count +end + +""" + PetscViewerBinaryWrite(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, count::PetscInt, dtype::PetscDataType) +writes to a binary file, only from the first MPI rank + +Collective; No Fortran Support + +Input Parameters: +- `viewer` - the `PETSCVIEWERBINARY` viewer +- `data` - location of data, treated as an array of the type indicated by `dtype` +- `count` - number of items of data to write +- `dtype` - type of data to write + +Level: beginner + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, +`VecView()`, `MatView()`, `VecLoad()`, `MatLoad()`, `PetscViewerBinaryGetDescriptor()`, `PetscDataType` +`PetscViewerBinaryGetInfoPointer()`, `PetscFileMode`, `PetscViewer`, `PetscViewerBinaryRead()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryWrite")) +""" +function PetscViewerBinaryWrite(petsclib::PetscLibType, viewer::PetscViewer, data::Cvoid, count::PetscInt, dtype::PetscDataType) end + +@for_petsc function PetscViewerBinaryWrite(petsclib::$UnionPetscLib, viewer::PetscViewer, data::Cvoid, count::$PetscInt, dtype::PetscDataType ) + + @chk ccall( + (:PetscViewerBinaryWrite, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cvoid}, $PetscInt, PetscDataType), + viewer, data, count, dtype, + ) + + + return nothing +end + +""" + PetscViewerBinaryReadAll(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, count::PetscCount, start::PetscCount, total::PetscCount, dtype::PetscDataType) +reads from a binary file from all MPI processes, each rank receives its own portion of the data + +Collective; No Fortran Support + +Input Parameters: +- `viewer` - the `PETSCVIEWERBINARY` viewer +- `count` - local number of items of data to read +- `start` - local start, can be `PETSC_DETERMINE` +- `total` - global number of items of data to read, can be `PETSC_DETERMINE` +- `dtype` - type of data to read + +Output Parameter: +- `data` - location of data, treated as an array of type indicated by `dtype` + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinarySetUseMPIIO()`, `PetscViewerBinaryRead()`, `PetscViewerBinaryWriteAll()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryReadAll")) +""" +function PetscViewerBinaryReadAll(petsclib::PetscLibType, viewer::PetscViewer, data::Cvoid, count::PetscCount, start::PetscCount, total::PetscCount, dtype::PetscDataType) end + +@for_petsc function PetscViewerBinaryReadAll(petsclib::$UnionPetscLib, viewer::PetscViewer, data::Cvoid, count::PetscCount, start::PetscCount, total::PetscCount, dtype::PetscDataType ) + + @chk ccall( + (:PetscViewerBinaryReadAll, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cvoid}, PetscCount, PetscCount, PetscCount, PetscDataType), + viewer, data, count, start, total, dtype, + ) + + + return nothing +end + +""" + PetscViewerBinaryWriteAll(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, count::PetscCount, start::PetscCount, total::PetscCount, dtype::PetscDataType) +writes to a binary file from all MPI processes, each rank writes its own portion of the data + +Collective; No Fortran Support + +Input Parameters: +- `viewer` - the `PETSCVIEWERBINARY` viewer +- `data` - location of data +- `count` - local number of items of data to write, treated as an array of type indicated by `dtype` +- `start` - local start, can be `PETSC_DETERMINE` +- `total` - global number of items of data to write, can be `PETSC_DETERMINE` +- `dtype` - type of data to write + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinarySetUseMPIIO()`, `PetscViewerBinaryReadAll()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryWriteAll")) +""" +function PetscViewerBinaryWriteAll(petsclib::PetscLibType, viewer::PetscViewer, data::Cvoid, count::PetscCount, start::PetscCount, total::PetscCount, dtype::PetscDataType) end + +@for_petsc function PetscViewerBinaryWriteAll(petsclib::$UnionPetscLib, viewer::PetscViewer, data::Cvoid, count::PetscCount, start::PetscCount, total::PetscCount, dtype::PetscDataType ) + + @chk ccall( + (:PetscViewerBinaryWriteAll, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cvoid}, PetscCount, PetscCount, PetscCount, PetscDataType), + viewer, data, count, start, total, dtype, + ) + + + return nothing +end + +""" + PetscViewerBinaryWriteStringArray(petsclib::PetscLibType,viewer::PetscViewer, data::String) +writes to a binary file, only from the first MPI rank, an array of strings + +Collective; No Fortran Support + +Input Parameters: +- `viewer` - the `PETSCVIEWERBINARY` viewer +- `data` - location of the array of strings + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, +`VecView()`, `MatView()`, `VecLoad()`, `MatLoad()`, `PetscViewerBinaryGetDescriptor()`, +`PetscViewerBinaryGetInfoPointer()`, `PetscFileMode`, `PetscViewer`, `PetscViewerBinaryRead()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryWriteStringArray")) +""" +function PetscViewerBinaryWriteStringArray(petsclib::PetscLibType, viewer::PetscViewer, data::String) end + +@for_petsc function PetscViewerBinaryWriteStringArray(petsclib::$UnionPetscLib, viewer::PetscViewer, data::String ) + data_ = Ref(pointer(data)) + + @chk ccall( + (:PetscViewerBinaryWriteStringArray, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Ptr{Cchar}}), + viewer, data_, + ) + + + return nothing +end + +""" + PetscViewerBinaryReadStringArray(petsclib::PetscLibType,viewer::PetscViewer, data::Cchar) +reads a binary file an array of strings to all MPI processes + +Collective; No Fortran Support + +Input Parameter: +- `viewer` - the `PETSCVIEWERBINARY` viewer + +Output Parameter: +- `data` - location of the array of strings + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, +`VecView()`, `MatView()`, `VecLoad()`, `MatLoad()`, `PetscViewerBinaryGetDescriptor()`, +`PetscViewerBinaryGetInfoPointer()`, `PetscFileMode`, `PetscViewer`, `PetscViewerBinaryRead()` + +# External Links +$(_doc_external("Sys/PetscViewerBinaryReadStringArray")) +""" +function PetscViewerBinaryReadStringArray(petsclib::PetscLibType, viewer::PetscViewer, data::Cchar) end + +@for_petsc function PetscViewerBinaryReadStringArray(petsclib::$UnionPetscLib, viewer::PetscViewer, data::Cchar ) + + @chk ccall( + (:PetscViewerBinaryReadStringArray, $petsc_library), + PetscErrorCode, + (PetscViewer, Cchar), + viewer, data, + ) + + + return nothing +end + +""" + PetscViewerFileSetMode(petsclib::PetscLibType,viewer::PetscViewer, mode::PetscFileMode) +Sets the open mode of file + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer`; must be a `PETSCVIEWERBINARY`, `PETSCVIEWERMATLAB`, `PETSCVIEWERHDF5`, or `PETSCVIEWERASCII` `PetscViewer` +- `mode` - open mode of file +-seealso: [](sec_viewers), `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerFileSetMode")) +""" +function PetscViewerFileSetMode(petsclib::PetscLibType, viewer::PetscViewer, mode::PetscFileMode) end + +@for_petsc function PetscViewerFileSetMode(petsclib::$UnionPetscLib, viewer::PetscViewer, mode::PetscFileMode ) + + @chk ccall( + (:PetscViewerFileSetMode, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscFileMode), + viewer, mode, + ) + + + return nothing +end + +""" + PetscViewerFileGetMode(petsclib::PetscLibType,viewer::PetscViewer, mode::PetscFileMode) +Gets the open mode of a file associated with a `PetscViewer` + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer`; must be a `PETSCVIEWERBINARY`, `PETSCVIEWERMATLAB`, `PETSCVIEWERHDF5`, or `PETSCVIEWERASCII` `PetscViewer` + +Output Parameter: +- `mode` - open mode of file +-seealso: [](sec_viewers), `PetscViewerFileSetMode()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerFileGetMode")) +""" +function PetscViewerFileGetMode(petsclib::PetscLibType, viewer::PetscViewer, mode::PetscFileMode) end + +@for_petsc function PetscViewerFileGetMode(petsclib::$UnionPetscLib, viewer::PetscViewer, mode::PetscFileMode ) + + @chk ccall( + (:PetscViewerFileGetMode, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscFileMode}), + viewer, mode, + ) + + + return nothing +end + +""" + PetscViewerDrawBaseAdd(petsclib::PetscLibType,viewer::PetscViewer, windownumber::PetscInt) +add to the base integer that is added to the `windownumber` passed to `PetscViewerDrawGetDraw()` + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer` (created with `PetscViewerDrawOpen()`) +- `windownumber` - how much to add to the base + +Level: developer + +-seealso: [](sec_viewers), `PetscViewerDrawGetLG()`, `PetscViewerDrawGetAxis()`, `PetscViewerDrawOpen()`, `PetscViewerDrawGetDraw()`, `PetscViewerDrawBaseSet()` + +# External Links +$(_doc_external("Sys/PetscViewerDrawBaseAdd")) +""" +function PetscViewerDrawBaseAdd(petsclib::PetscLibType, viewer::PetscViewer, windownumber::PetscInt) end + +@for_petsc function PetscViewerDrawBaseAdd(petsclib::$UnionPetscLib, viewer::PetscViewer, windownumber::$PetscInt ) + + @chk ccall( + (:PetscViewerDrawBaseAdd, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, windownumber, + ) + + + return nothing +end + +""" + PetscViewerDrawBaseSet(petsclib::PetscLibType,viewer::PetscViewer, windownumber::PetscInt) +sets the base integer that is added to the `windownumber` passed to `PetscViewerDrawGetDraw()` + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer` (created with `PetscViewerDrawOpen()`) +- `windownumber` - value to set the base + +Level: developer + +-seealso: [](sec_viewers), `PetscViewerDrawGetLG()`, `PetscViewerDrawGetAxis()`, `PetscViewerDrawOpen()`, `PetscViewerDrawGetDraw()`, `PetscViewerDrawBaseAdd()` + +# External Links +$(_doc_external("Sys/PetscViewerDrawBaseSet")) +""" +function PetscViewerDrawBaseSet(petsclib::PetscLibType, viewer::PetscViewer, windownumber::PetscInt) end + +@for_petsc function PetscViewerDrawBaseSet(petsclib::$UnionPetscLib, viewer::PetscViewer, windownumber::$PetscInt ) + + @chk ccall( + (:PetscViewerDrawBaseSet, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, windownumber, + ) + + + return nothing +end + +""" + PetscViewerDrawResize(petsclib::PetscLibType,v::PetscViewer, w::Cint, h::Cint) + +# External Links +$(_doc_external("Sys/PetscViewerDrawResize")) +""" +function PetscViewerDrawResize(petsclib::PetscLibType, v::PetscViewer, w::Cint, h::Cint) end + +@for_petsc function PetscViewerDrawResize(petsclib::$UnionPetscLib, v::PetscViewer, w::Cint, h::Cint ) + + @chk ccall( + (:PetscViewerDrawResize, $petsc_library), + PetscErrorCode, + (PetscViewer, Cint, Cint), + v, w, h, + ) + + + return nothing +end + +""" + PetscViewerDrawSetInfo(petsclib::PetscLibType,v::PetscViewer, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint) + +# External Links +$(_doc_external("Sys/PetscViewerDrawSetInfo")) +""" +function PetscViewerDrawSetInfo(petsclib::PetscLibType, v::PetscViewer, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint) end + +@for_petsc function PetscViewerDrawSetInfo(petsclib::$UnionPetscLib, v::PetscViewer, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint ) + + @chk ccall( + (:PetscViewerDrawSetInfo, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{Cchar}, Cint, Cint, Cint, Cint), + v, display, title, x, y, w, h, + ) + + + return nothing +end + +""" + PetscViewerDrawSetTitle(petsclib::PetscLibType,v::PetscViewer, title::String) + +# External Links +$(_doc_external("Sys/PetscViewerDrawSetTitle")) +""" +function PetscViewerDrawSetTitle(petsclib::PetscLibType, v::PetscViewer, title::String) end + +@for_petsc function PetscViewerDrawSetTitle(petsclib::$UnionPetscLib, v::PetscViewer, title::String ) + + @chk ccall( + (:PetscViewerDrawSetTitle, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}), + v, title, + ) + + + return nothing +end + +""" + PetscViewerDrawGetTitle(petsclib::PetscLibType,v::PetscViewer, title::String) + +# External Links +$(_doc_external("Sys/PetscViewerDrawGetTitle")) +""" +function PetscViewerDrawGetTitle(petsclib::PetscLibType, v::PetscViewer, title::String) end + +@for_petsc function PetscViewerDrawGetTitle(petsclib::$UnionPetscLib, v::PetscViewer, title::String ) + title_ = Ref(pointer(title)) + + @chk ccall( + (:PetscViewerDrawGetTitle, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Ptr{Cchar}}), + v, title_, + ) + + + return nothing +end + +""" + PetscViewerDrawOpen(petsclib::PetscLibType,comm::MPI_Comm, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint, viewer::PetscViewer) +Opens a `PetscDraw` window for use as a `PetscViewer` with type +`PETSCVIEWERDRAW`. + +Collective + +Input Parameters: +- `comm` - communicator that will share window +- `display` - the X display on which to open, or `NULL` for the local machine +- `title` - the title to put in the title bar, or `NULL` for no title +- `x` - horizontal screen coordinate of the upper left corner of window, or use `PETSC_DECIDE` +- `y` - vertical screen coordinate of the upper left corner of window, or use `PETSC_DECIDE` +- `w` - window width in pixels, or may use `PETSC_DECIDE` or `PETSC_DRAW_FULL_SIZE`, `PETSC_DRAW_HALF_SIZE`,`PETSC_DRAW_THIRD_SIZE`, `PETSC_DRAW_QUARTER_SIZE` +- `h` - window height in pixels, or may use `PETSC_DECIDE` or `PETSC_DRAW_FULL_SIZE`, `PETSC_DRAW_HALF_SIZE`,`PETSC_DRAW_THIRD_SIZE`, `PETSC_DRAW_QUARTER_SIZE` + +Output Parameter: +- `viewer` - the `PetscViewer` + +Options Database Keys: +- `-draw_type` - use x or null +- `-nox` - Disables all x-windows output +- `-display ` - Specifies name of machine for the X display +- `-geometry ` - allows setting the window location and size +- `-draw_pause ` - Sets time (in seconds) that the +program pauses after `PetscDrawPause()` has been called +(0 is default, -1 implies until user input). + +Level: beginner + +-seealso: [](sec_viewers), `PETSCVIEWERDRAW`, `PetscDrawCreate()`, `PetscViewerDestroy()`, `PetscViewerDrawGetDraw()`, `PetscViewerCreate()`, `PETSC_VIEWER_DRAW_`, +`PETSC_VIEWER_DRAW_WORLD`, `PETSC_VIEWER_DRAW_SELF` + +# External Links +$(_doc_external("Sys/PetscViewerDrawOpen")) +""" +function PetscViewerDrawOpen(petsclib::PetscLibType, comm::MPI_Comm, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint, viewer::PetscViewer) end + +@for_petsc function PetscViewerDrawOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerDrawOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Cint, Cint, Cint, Cint, Ptr{PetscViewer}), + comm, display, title, x, y, w, h, viewer, + ) + + + return nothing +end + +""" + PetscViewerDrawClear(petsclib::PetscLibType,viewer::PetscViewer) +Clears a `PetscDraw` graphic associated with a `PetscViewer`. + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERDRAW`, `PetscViewerDrawOpen()`, `PetscViewerDrawGetDraw()`, + +# External Links +$(_doc_external("Sys/PetscViewerDrawClear")) +""" +function PetscViewerDrawClear(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerDrawClear(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerDrawClear, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + pause::PetscReal = PetscViewerDrawGetPause(petsclib::PetscLibType,viewer::PetscViewer) +Gets the pause value (how long to pause before an image is changed) in the `PETSCVIEWERDRAW` `PetscViewer` + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` + +Output Parameter: +- `pause` - the pause value + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERDRAW`, `PetscViewerDrawOpen()`, `PetscViewerDrawGetDraw()`, + +# External Links +$(_doc_external("Sys/PetscViewerDrawGetPause")) +""" +function PetscViewerDrawGetPause(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerDrawGetPause(petsclib::$UnionPetscLib, viewer::PetscViewer ) + pause_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscViewerDrawGetPause, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscReal}), + viewer, pause_, + ) + + pause = pause_[] + + return pause +end + +""" + PetscViewerDrawSetPause(petsclib::PetscLibType,viewer::PetscViewer, pause::PetscReal) +Sets a pause for each `PetscDraw` in the `PETSCVIEWERDRAW` `PetscViewer` + +Not Collective + +Input Parameters: +- `viewer` - the `PetscViewer` +- `pause` - the pause value + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERDRAW`, `PetscViewerDrawOpen()`, `PetscViewerDrawGetDraw()`, + +# External Links +$(_doc_external("Sys/PetscViewerDrawSetPause")) +""" +function PetscViewerDrawSetPause(petsclib::PetscLibType, viewer::PetscViewer, pause::PetscReal) end + +@for_petsc function PetscViewerDrawSetPause(petsclib::$UnionPetscLib, viewer::PetscViewer, pause::$PetscReal ) + + @chk ccall( + (:PetscViewerDrawSetPause, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscReal), + viewer, pause, + ) + + + return nothing +end + +""" + PetscViewerDrawSetHold(petsclib::PetscLibType,viewer::PetscViewer, hold::PetscBool) +Holds previous image when drawing new image in a `PETSCVIEWERDRAW` + +Not Collective + +Input Parameters: +- `viewer` - the `PetscViewer` +- `hold` - `PETSC_TRUE` indicates to hold the previous image + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERDRAW`, `PetscViewerDrawOpen()`, `PetscViewerDrawGetDraw()`, + +# External Links +$(_doc_external("Sys/PetscViewerDrawSetHold")) +""" +function PetscViewerDrawSetHold(petsclib::PetscLibType, viewer::PetscViewer, hold::PetscBool) end + +@for_petsc function PetscViewerDrawSetHold(petsclib::$UnionPetscLib, viewer::PetscViewer, hold::PetscBool ) + + @chk ccall( + (:PetscViewerDrawSetHold, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool), + viewer, hold, + ) + + + return nothing +end + +""" + hold::PetscBool = PetscViewerDrawGetHold(petsclib::PetscLibType,viewer::PetscViewer) +Checks if the `PETSCVIEWERDRAW` `PetscViewer` holds previous image when drawing new image + +Not Collective + +Input Parameter: +- `viewer` - the `PetscViewer` + +Output Parameter: +- `hold` - indicates to hold or not + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERDRAW`, `PetscViewerDrawOpen()`, `PetscViewerDrawGetDraw()`, + +# External Links +$(_doc_external("Sys/PetscViewerDrawGetHold")) +""" +function PetscViewerDrawGetHold(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerDrawGetHold(petsclib::$UnionPetscLib, viewer::PetscViewer ) + hold_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerDrawGetHold, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscBool}), + viewer, hold_, + ) + + hold = hold_[] + + return hold +end + +""" + PetscViewerDrawSetBounds(petsclib::PetscLibType,viewer::PetscViewer, nbounds::PetscInt, bounds::PetscReal) +sets the upper and lower bounds to be used in plotting in a `PETSCVIEWERDRAW` `PetscViewer` + +Collective + +Input Parameters: +- `viewer` - the `PetscViewer` (created with `PetscViewerDrawOpen()`) +- `nbounds` - number of plots that can be made with this viewer, for example the dof passed to `DMDACreate()` +- `bounds` - the actual bounds, the size of this is 2*`nbounds`, the values are stored in the order min F_0, max F_0, min F_1, max F_1, ..... + +Options Database Key: +- `-draw_bounds minF0,maxF0,minF1,maxF1` - the lower left and upper right bounds + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERDRAW`, `PetscViewerDrawGetLG()`, `PetscViewerDrawGetAxis()`, `PetscViewerDrawOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerDrawSetBounds")) +""" +function PetscViewerDrawSetBounds(petsclib::PetscLibType, viewer::PetscViewer, nbounds::PetscInt, bounds::PetscReal) end + +@for_petsc function PetscViewerDrawSetBounds(petsclib::$UnionPetscLib, viewer::PetscViewer, nbounds::$PetscInt, bounds::$PetscReal ) + + @chk ccall( + (:PetscViewerDrawSetBounds, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt, Ptr{$PetscReal}), + viewer, nbounds, bounds, + ) + + + return nothing +end + +""" + nbounds::PetscInt,bounds::Vector{PetscReal} = PetscViewerDrawGetBounds(petsclib::PetscLibType,viewer::PetscViewer) +gets the upper and lower bounds to be used in plotting set with `PetscViewerDrawSetBounds()` + +Collective + +Input Parameter: +- `viewer` - the `PetscViewer` (created with `PetscViewerDrawOpen()`) + +Output Parameters: +- `nbounds` - number of plots that can be made with this viewer, for example the dof passed to `DMDACreate()` +- `bounds` - the actual bounds, the size of this is 2*`nbounds`, the values are stored in the order min F_0, max F_0, min F_1, max F_1, ..... + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERDRAW`, `PetscViewerDrawGetLG()`, `PetscViewerDrawGetAxis()`, `PetscViewerDrawOpen()`, `PetscViewerDrawSetBounds()` + +# External Links +$(_doc_external("Sys/PetscViewerDrawGetBounds")) +""" +function PetscViewerDrawGetBounds(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerDrawGetBounds(petsclib::$UnionPetscLib, viewer::PetscViewer ) + nbounds_ = Ref{$PetscInt}() + bounds_ = Ref{Ptr{$PetscReal}}() + + @chk ccall( + (:PetscViewerDrawGetBounds, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscInt}, Ptr{Ptr{$PetscReal}}), + viewer, nbounds_, bounds_, + ) + + nbounds = nbounds_[] + bounds = unsafe_wrap(Array, bounds_[], VecGetLocalSize(petsclib, x); own = false) + + return nbounds,bounds +end + +""" + PetscViewerMonitorLGSetUp(petsclib::PetscLibType,viewer::PetscViewer, host::String, title::String, metric::String, l::PetscInt, names::String, x::Cint, y::Cint, m::Cint, n::Cint) +sets up a viewer to be used by line graph monitoring routines such as `KSPMonitorResidualDrawLG()` + +Collective + +Input Parameters: +- `viewer` - the viewer in which to display the line graphs, it not a `PETSCVIEWERDRAW` it will set to that `PetscViewerType` +- `host` - the host to open the window on, 'NULL' indicates the local host +- `title` - the title at the top of the window +- `metric` - the label above the graph +- `l` - the number of curves +- `names` - the names of each curve to be used in displaying the legend. May be 'NULL' +- `x` - horizontal screen coordinate of the upper left corner of window, or use `PETSC_DECIDE` +- `y` - vertical screen coordinate of the upper left corner of window, or use `PETSC_DECIDE` +- `m` - window width in pixels, or may use `PETSC_DECIDE` or `PETSC_DRAW_FULL_SIZE`, `PETSC_DRAW_HALF_SIZE`,`PETSC_DRAW_THIRD_SIZE`, `PETSC_DRAW_QUARTER_SIZE` +- `n` - window height in pixels, or may use `PETSC_DECIDE` or `PETSC_DRAW_FULL_SIZE`, `PETSC_DRAW_HALF_SIZE`,`PETSC_DRAW_THIRD_SIZE`, `PETSC_DRAW_QUARTER_SIZE` + +Level: developer + +-seealso: `PetscViewer()`, `PETSCVIEWERDRAW`, `PetscViewerDrawGetDrawLG()`, `PetscViewerDrawOpen()`, `PetscViewerDrawSetInfo()` + +# External Links +$(_doc_external("Sys/PetscViewerMonitorLGSetUp")) +""" +function PetscViewerMonitorLGSetUp(petsclib::PetscLibType, viewer::PetscViewer, host::String, title::String, metric::String, l::PetscInt, names::String, x::Cint, y::Cint, m::Cint, n::Cint) end + +@for_petsc function PetscViewerMonitorLGSetUp(petsclib::$UnionPetscLib, viewer::PetscViewer, host::String, title::String, metric::String, l::$PetscInt, names::String, x::Cint, y::Cint, m::Cint, n::Cint ) + names_ = Ref(pointer(names)) + + @chk ccall( + (:PetscViewerMonitorLGSetUp, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, $PetscInt, Ptr{Ptr{Cchar}}, Cint, Cint, Cint, Cint), + viewer, host, title, metric, l, names_, x, y, m, n, + ) + + + return nothing +end + +""" + PetscViewerDrawGetDraw(petsclib::PetscLibType,viewer::PetscViewer, windownumber::PetscInt, draw::PetscDraw) +Returns `PetscDraw` object from `PETSCVIEWERDRAW` `PetscViewer` object. +This `PetscDraw` object may then be used to perform graphics using `PetscDraw` commands. + +Collective + +Input Parameters: +- `viewer` - the `PetscViewer` (created with `PetscViewerDrawOpen()` of type `PETSCVIEWERDRAW`) +- `windownumber` - indicates which subwindow (usually 0) to obtain + +Output Parameter: +- `draw` - the draw object + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERDRAW`, `PetscViewerDrawGetLG()`, `PetscViewerDrawGetAxis()`, `PetscViewerDrawOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerDrawGetDraw")) +""" +function PetscViewerDrawGetDraw(petsclib::PetscLibType, viewer::PetscViewer, windownumber::PetscInt, draw::PetscDraw) end + +@for_petsc function PetscViewerDrawGetDraw(petsclib::$UnionPetscLib, viewer::PetscViewer, windownumber::$PetscInt, draw::PetscDraw ) + + @chk ccall( + (:PetscViewerDrawGetDraw, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt, Ptr{PetscDraw}), + viewer, windownumber, draw, + ) + + + return nothing +end + +""" + PetscViewerDrawGetDrawLG(petsclib::PetscLibType,viewer::PetscViewer, windownumber::PetscInt, drawlg::PetscDrawLG) +Returns a `PetscDrawLG` object from `PetscViewer` object of type `PETSCVIEWERDRAW`. +This `PetscDrawLG` object may then be used to perform graphics using `PetscDrawLG` commands. + +Collective + +Input Parameters: +- `viewer` - the `PetscViewer` (created with `PetscViewerDrawOpen()`) +- `windownumber` - indicates which subwindow (usually 0) + +Output Parameter: +- `drawlg` - the draw line graph object + +Level: intermediate + +-seealso: [](sec_viewers), `PetscDrawLG`, `PetscViewerDrawGetDraw()`, `PetscViewerDrawGetAxis()`, `PetscViewerDrawOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerDrawGetDrawLG")) +""" +function PetscViewerDrawGetDrawLG(petsclib::PetscLibType, viewer::PetscViewer, windownumber::PetscInt, drawlg::PetscDrawLG) end + +@for_petsc function PetscViewerDrawGetDrawLG(petsclib::$UnionPetscLib, viewer::PetscViewer, windownumber::$PetscInt, drawlg::PetscDrawLG ) + + @chk ccall( + (:PetscViewerDrawGetDrawLG, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt, Ptr{PetscDrawLG}), + viewer, windownumber, drawlg, + ) + + + return nothing +end + +""" + PetscViewerDrawGetDrawAxis(petsclib::PetscLibType,viewer::PetscViewer, windownumber::PetscInt, drawaxis::PetscDrawAxis) +Returns a `PetscDrawAxis` object from a `PetscViewer` object of type `PETSCVIEWERDRAW`. +This `PetscDrawAxis` object may then be used to perform graphics using `PetscDrawAxis` commands. + +Collective + +Input Parameters: +- `viewer` - the `PetscViewer` (created with `PetscViewerDrawOpen()`) +- `windownumber` - indicates which subwindow (usually 0) + +Output Parameter: +- `drawaxis` - the draw axis object + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewerDrawGetDraw()`, `PetscViewerDrawGetLG()`, `PetscViewerDrawOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerDrawGetDrawAxis")) +""" +function PetscViewerDrawGetDrawAxis(petsclib::PetscLibType, viewer::PetscViewer, windownumber::PetscInt, drawaxis::PetscDrawAxis) end + +@for_petsc function PetscViewerDrawGetDrawAxis(petsclib::$UnionPetscLib, viewer::PetscViewer, windownumber::$PetscInt, drawaxis::PetscDrawAxis ) + + @chk ccall( + (:PetscViewerDrawGetDrawAxis, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt, Ptr{PetscDrawAxis}), + viewer, windownumber, drawaxis, + ) + + + return nothing +end + +""" + PetscViewerDrawSetDrawType(petsclib::PetscLibType,v::PetscViewer, drawtype::PetscDrawType) + +# External Links +$(_doc_external("Sys/PetscViewerDrawSetDrawType")) +""" +function PetscViewerDrawSetDrawType(petsclib::PetscLibType, v::PetscViewer, drawtype::PetscDrawType) end + +@for_petsc function PetscViewerDrawSetDrawType(petsclib::$UnionPetscLib, v::PetscViewer, drawtype::PetscDrawType ) + + @chk ccall( + (:PetscViewerDrawSetDrawType, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscDrawType), + v, drawtype, + ) + + + return nothing +end + +""" + drawtype::PetscDrawType = PetscViewerDrawGetDrawType(petsclib::PetscLibType,v::PetscViewer) + +# External Links +$(_doc_external("Sys/PetscViewerDrawGetDrawType")) +""" +function PetscViewerDrawGetDrawType(petsclib::PetscLibType, v::PetscViewer) end + +@for_petsc function PetscViewerDrawGetDrawType(petsclib::$UnionPetscLib, v::PetscViewer ) + drawtype_ = Ref{PetscDrawType}() + + @chk ccall( + (:PetscViewerDrawGetDrawType, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscDrawType}), + v, drawtype_, + ) + + drawtype = unsafe_string(drawtype_[]) + + return drawtype +end + +""" + PetscViewerADIOSOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, adiosv::PetscViewer) +Opens a file for ADIOS input/output. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `name` - name of file +- `type` - type of file +-seealso: `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, `PetscViewerHDF5Open()`, +`VecView()`, `MatView()`, `VecLoad()`, `PetscViewerSetType()`, `PetscViewerFileSetMode()`, `PetscViewerFileSetName()` +`MatLoad()`, `PetscFileMode`, `PetscViewer` + +# External Links +$(_doc_external("Sys/PetscViewerADIOSOpen")) +""" +function PetscViewerADIOSOpen(petsclib::PetscLibType, comm::MPI_Comm, name::String, type::PetscFileMode, adiosv::PetscViewer) end + +@for_petsc function PetscViewerADIOSOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, name::String, type::PetscFileMode, adiosv::PetscViewer ) + + @chk ccall( + (:PetscViewerADIOSOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscFileMode, Ptr{PetscViewer}), + comm, name, type, adiosv, + ) + + + return nothing +end + +""" + PetscViewerHDF5Load(petsclib::PetscLibType,viewer::PetscViewer, name::String, map::PetscLayout, datatype::hid_t, newarr::Cvoid) +Read a raw array from the `PETSCVIEWERHDF5` dataset in parallel + +Collective; No Fortran Support + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `name` - The dataset name +- `datatype` - The HDF5 datatype of the items in the dataset + +Input/Output Parameter: +- `map` - The layout which specifies array partitioning, on output the +set up layout (with global size and blocksize according to dataset) + +Output Parameter: +- `newarr` - The partitioned array, a memory image of the given dataset + +Level: developer + +-seealso: `PetscViewer`, `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5OpenGroup()`, `PetscViewerHDF5ReadSizes()`, +`VecLoad()`, `ISLoad()`, `PetscLayout` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5Load")) +""" +function PetscViewerHDF5Load(petsclib::PetscLibType, viewer::PetscViewer, name::String, map::PetscLayout, datatype::hid_t, newarr::Cvoid) end + +@for_petsc function PetscViewerHDF5Load(petsclib::$UnionPetscLib, viewer::PetscViewer, name::String, map::PetscLayout, datatype::hid_t, newarr::Cvoid ) + + @chk ccall( + (:PetscViewerHDF5Load, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, PetscLayout, hid_t, Cvoid), + viewer, name, map, datatype, newarr, + ) + + + return nothing +end + +""" + bs::PetscInt,N::PetscInt = PetscViewerHDF5ReadSizes(petsclib::PetscLibType,viewer::PetscViewer, name::String) +Read block size and global size of a `Vec` or `IS` stored in an HDF5 file. + +Input Parameters: +- `viewer` - The `PETSCVIEWERHDF5` viewer +- `name` - The dataset name + +Output Parameters: +- `bs` - block size +- `N` - global size + +Level: advanced + +-seealso: `PetscViewer`, `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `VecLoad()`, `ISLoad()`, `VecGetSize()`, `ISGetSize()`, `PetscViewerHDF5SetBaseDimension2()` + +# External Links +$(_doc_external("Sys/PetscViewerHDF5ReadSizes")) +""" +function PetscViewerHDF5ReadSizes(petsclib::PetscLibType, viewer::PetscViewer, name::String) end + +@for_petsc function PetscViewerHDF5ReadSizes(petsclib::$UnionPetscLib, viewer::PetscViewer, name::String ) + bs_ = Ref{$PetscInt}() + N_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscViewerHDF5ReadSizes, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{$PetscInt}, Ptr{$PetscInt}), + viewer, name, bs_, N_, + ) + + bs = bs_[] + N = N_[] + + return bs,N +end + +""" + PetscViewerExodusIIGetId(petsclib::PetscLibType,viewer::PetscViewer, exoid::Cint) +Get the file id of the `PETSCVIEWEREXODUSII` file + +Logically Collective + +Input Parameter: +- `viewer` - the `PetscViewer` + +Output Parameter: +- `exoid` - The ExodusII file id + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerFileSetMode()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIGetId")) +""" +function PetscViewerExodusIIGetId(petsclib::PetscLibType, viewer::PetscViewer, exoid::Cint) end + +@for_petsc function PetscViewerExodusIIGetId(petsclib::$UnionPetscLib, viewer::PetscViewer, exoid::Cint ) + + @chk ccall( + (:PetscViewerExodusIIGetId, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cint}), + viewer, exoid, + ) + + + return nothing +end + +""" + PetscViewerExodusIISetOrder(petsclib::PetscLibType,viewer::PetscViewer, order::PetscInt) +Set the elements order in the ExodusII file. + +Collective + +Input Parameters: +- `viewer` - the `PETSCVIEWEREXODUSII` viewer +- `order` - elements order + +Output Parameter: + +Level: beginner + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerExodusIIGetId()`, `PetscViewerExodusIIGetOrder()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIISetOrder")) +""" +function PetscViewerExodusIISetOrder(petsclib::PetscLibType, viewer::PetscViewer, order::PetscInt) end + +@for_petsc function PetscViewerExodusIISetOrder(petsclib::$UnionPetscLib, viewer::PetscViewer, order::$PetscInt ) + + @chk ccall( + (:PetscViewerExodusIISetOrder, $petsc_library), + PetscErrorCode, + (PetscViewer, $PetscInt), + viewer, order, + ) + + + return nothing +end + +""" + PetscViewerExodusIIGetOrder(petsclib::PetscLibType,viewer::PetscViewer, order::PetscInt) +Get the elements order in the ExodusII file. + +Collective + +Input Parameters: +- `viewer` - the `PETSCVIEWEREXODUSII` viewer +- `order` - elements order + +Output Parameter: + +Level: beginner + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerExodusIIGetId()`, `PetscViewerExodusIISetOrder()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIGetOrder")) +""" +function PetscViewerExodusIIGetOrder(petsclib::PetscLibType, viewer::PetscViewer, order::PetscInt) end + +@for_petsc function PetscViewerExodusIIGetOrder(petsclib::$UnionPetscLib, viewer::PetscViewer, order::$PetscInt ) + + @chk ccall( + (:PetscViewerExodusIIGetOrder, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{$PetscInt}), + viewer, order, + ) + + + return nothing +end + +""" + PetscViewerExodusIIOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, exo::PetscViewer) +Opens a file for ExodusII input/output. + +Collective + +Input Parameters: +- `comm` - MPI communicator +- `name` - name of file +- `type` - type of file +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, +`DMLoad()`, `PetscFileMode`, `PetscViewerSetType()`, `PetscViewerFileSetMode()`, `PetscViewerFileSetName()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIOpen")) +""" +function PetscViewerExodusIIOpen(petsclib::PetscLibType, comm::MPI_Comm, name::String, type::PetscFileMode, exo::PetscViewer) end + +@for_petsc function PetscViewerExodusIIOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, name::String, type::PetscFileMode, exo::PetscViewer ) + + @chk ccall( + (:PetscViewerExodusIIOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, PetscFileMode, Ptr{PetscViewer}), + comm, name, type, exo, + ) + + + return nothing +end + +""" + PetscViewerHDF5SetDMPlexStorageVersionWriting(petsclib::PetscLibType,viewer::PetscViewer, version::DMPlexStorageVersion) +Set the storage version for writing + +Logically collective + +Input Parameters: +- `viewer` - The `PetscViewer` +- `version` - The storage format version + +Level: advanced + +Note: +The version has major, minor, and subminor integers. Parallel operations are only available for version 3.0.0. + +See also: +=== +`DM`, `PetscViewerHDF5GetDMPlexStorageVersionWriting()`, `PetscViewerHDF5GetDMPlexStorageVersionReading()`, `PetscViewerHDF5SetDMPlexStorageVersionReading()` + +# External Links +$(_doc_external("DM/PetscViewerHDF5SetDMPlexStorageVersionWriting")) +""" +function PetscViewerHDF5SetDMPlexStorageVersionWriting(petsclib::PetscLibType, viewer::PetscViewer, version::DMPlexStorageVersion) end + +@for_petsc function PetscViewerHDF5SetDMPlexStorageVersionWriting(petsclib::$UnionPetscLib, viewer::PetscViewer, version::DMPlexStorageVersion ) + + @chk ccall( + (:PetscViewerHDF5SetDMPlexStorageVersionWriting, $petsc_library), + PetscErrorCode, + (PetscViewer, DMPlexStorageVersion), + viewer, version, + ) + + + return nothing +end + +""" + PetscViewerHDF5GetDMPlexStorageVersionWriting(petsclib::PetscLibType,viewer::PetscViewer, version::DMPlexStorageVersion) +Get the storage version for writing + +Logically collective + +Input Parameter: +- `viewer` - The `PetscViewer` + +Output Parameter: +- `version` - The storage format version + +Options Database Keys: +- `-dm_plex_view_hdf5_storage_version ` - Overrides the storage format version + +Level: advanced + +Note: +The version has major, minor, and subminor integers. Parallel operations are only available for version 3.0.0. + +See also: +=== +`DM`, `PetscViewerHDF5SetDMPlexStorageVersionWriting()`, `PetscViewerHDF5GetDMPlexStorageVersionReading()`, `PetscViewerHDF5SetDMPlexStorageVersionReading()` + +# External Links +$(_doc_external("DM/PetscViewerHDF5GetDMPlexStorageVersionWriting")) +""" +function PetscViewerHDF5GetDMPlexStorageVersionWriting(petsclib::PetscLibType, viewer::PetscViewer, version::DMPlexStorageVersion) end + +@for_petsc function PetscViewerHDF5GetDMPlexStorageVersionWriting(petsclib::$UnionPetscLib, viewer::PetscViewer, version::DMPlexStorageVersion ) + + @chk ccall( + (:PetscViewerHDF5GetDMPlexStorageVersionWriting, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{DMPlexStorageVersion}), + viewer, version, + ) + + + return nothing +end + +""" + PetscViewerHDF5SetDMPlexStorageVersionReading(petsclib::PetscLibType,viewer::PetscViewer, version::DMPlexStorageVersion) +Set the storage version for reading + +Logically collective + +Input Parameters: +- `viewer` - The `PetscViewer` +- `version` - The storage format version + +Level: advanced + +Note: +The version has major, minor, and subminor integers. Parallel operations are only available for version 3.0.0. + +See also: +=== +`DM`, `PetscViewerHDF5GetDMPlexStorageVersionReading()`, `PetscViewerHDF5GetDMPlexStorageVersionWriting()`, `PetscViewerHDF5SetDMPlexStorageVersionWriting()` + +# External Links +$(_doc_external("DM/PetscViewerHDF5SetDMPlexStorageVersionReading")) +""" +function PetscViewerHDF5SetDMPlexStorageVersionReading(petsclib::PetscLibType, viewer::PetscViewer, version::DMPlexStorageVersion) end + +@for_petsc function PetscViewerHDF5SetDMPlexStorageVersionReading(petsclib::$UnionPetscLib, viewer::PetscViewer, version::DMPlexStorageVersion ) + + @chk ccall( + (:PetscViewerHDF5SetDMPlexStorageVersionReading, $petsc_library), + PetscErrorCode, + (PetscViewer, DMPlexStorageVersion), + viewer, version, + ) + + + return nothing +end + +""" + PetscViewerHDF5GetDMPlexStorageVersionReading(petsclib::PetscLibType,viewer::PetscViewer, version::DMPlexStorageVersion) +Get the storage version for reading + +Logically collective + +Input Parameter: +- `viewer` - The `PetscViewer` + +Output Parameter: +- `version` - The storage format version + +Options Database Keys: +- `-dm_plex_view_hdf5_storage_version ` - Overrides the storage format version + +Level: advanced + +Note: +The version has major, minor, and subminor integers. Parallel operations are only available for version 3.0.0. + +See also: +=== +`DM`, `PetscViewerHDF5SetDMPlexStorageVersionReading()`, `PetscViewerHDF5GetDMPlexStorageVersionWriting()`, `PetscViewerHDF5SetDMPlexStorageVersionWriting()` + +# External Links +$(_doc_external("DM/PetscViewerHDF5GetDMPlexStorageVersionReading")) +""" +function PetscViewerHDF5GetDMPlexStorageVersionReading(petsclib::PetscLibType, viewer::PetscViewer, version::DMPlexStorageVersion) end + +@for_petsc function PetscViewerHDF5GetDMPlexStorageVersionReading(petsclib::$UnionPetscLib, viewer::PetscViewer, version::DMPlexStorageVersion ) + + @chk ccall( + (:PetscViewerHDF5GetDMPlexStorageVersionReading, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{DMPlexStorageVersion}), + viewer, version, + ) + + + return nothing +end + +""" + PetscViewerExodusIISetZonalVariable(petsclib::PetscLibType,viewer::PetscViewer, num::PetscExodusIIInt) +Sets the number of zonal variables in an ExodusII file + +Collective; + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `num` - the number of zonal variables in the ExodusII file + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIIGetZonalVariable()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIISetZonalVariable")) +""" +function PetscViewerExodusIISetZonalVariable(petsclib::PetscLibType, viewer::PetscViewer, num::PetscExodusIIInt) end + +@for_petsc function PetscViewerExodusIISetZonalVariable(petsclib::$UnionPetscLib, viewer::PetscViewer, num::PetscExodusIIInt ) + + @chk ccall( + (:PetscViewerExodusIISetZonalVariable, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscExodusIIInt), + viewer, num, + ) + + + return nothing +end + +""" + PetscViewerExodusIISetNodalVariable(petsclib::PetscLibType,viewer::PetscViewer, num::PetscExodusIIInt) +Sets the number of nodal variables in an ExodusII file + +Collective; + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `num` - the number of nodal variables in the ExodusII file + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIIGetNodalVariable()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIISetNodalVariable")) +""" +function PetscViewerExodusIISetNodalVariable(petsclib::PetscLibType, viewer::PetscViewer, num::PetscExodusIIInt) end + +@for_petsc function PetscViewerExodusIISetNodalVariable(petsclib::$UnionPetscLib, viewer::PetscViewer, num::PetscExodusIIInt ) + + @chk ccall( + (:PetscViewerExodusIISetNodalVariable, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscExodusIIInt), + viewer, num, + ) + + + return nothing +end + +""" + PetscViewerExodusIIGetZonalVariable(petsclib::PetscLibType,viewer::PetscViewer, num::PetscExodusIIInt) +Gets the number of zonal variables in an ExodusII file + +Collective + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` + +Output Parameter: +- `num` - the number variables in the ExodusII file + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIIsetZonalVariable()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIGetZonalVariable")) +""" +function PetscViewerExodusIIGetZonalVariable(petsclib::PetscLibType, viewer::PetscViewer, num::PetscExodusIIInt) end + +@for_petsc function PetscViewerExodusIIGetZonalVariable(petsclib::$UnionPetscLib, viewer::PetscViewer, num::PetscExodusIIInt ) + + @chk ccall( + (:PetscViewerExodusIIGetZonalVariable, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscExodusIIInt}), + viewer, num, + ) + + + return nothing +end + +""" + PetscViewerExodusIIGetNodalVariable(petsclib::PetscLibType,viewer::PetscViewer, num::PetscExodusIIInt) +Gets the number of nodal variables in an ExodusII file + +Collective + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` + +Output Parameter: +- `num` - the number variables in the ExodusII file + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIISetNodalVariable()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIGetNodalVariable")) +""" +function PetscViewerExodusIIGetNodalVariable(petsclib::PetscLibType, viewer::PetscViewer, num::PetscExodusIIInt) end + +@for_petsc function PetscViewerExodusIIGetNodalVariable(petsclib::$UnionPetscLib, viewer::PetscViewer, num::PetscExodusIIInt ) + + @chk ccall( + (:PetscViewerExodusIIGetNodalVariable, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscExodusIIInt}), + viewer, num, + ) + + + return nothing +end + +""" + PetscViewerExodusIISetZonalVariableName(petsclib::PetscLibType,viewer::PetscViewer, idx::PetscExodusIIInt, name::String) +Sets the name of a zonal variable. + +Collective; + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `idx` - the index for which you want to save the name +- `name` - string containing the name characters + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIIGetZonalVariableName()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIISetZonalVariableName")) +""" +function PetscViewerExodusIISetZonalVariableName(petsclib::PetscLibType, viewer::PetscViewer, idx::PetscExodusIIInt, name::String) end + +@for_petsc function PetscViewerExodusIISetZonalVariableName(petsclib::$UnionPetscLib, viewer::PetscViewer, idx::PetscExodusIIInt, name::String ) + + @chk ccall( + (:PetscViewerExodusIISetZonalVariableName, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscExodusIIInt, Ptr{Cchar}), + viewer, idx, name, + ) + + + return nothing +end + +""" + PetscViewerExodusIISetNodalVariableName(petsclib::PetscLibType,viewer::PetscViewer, idx::PetscExodusIIInt, name::String) +Sets the name of a nodal variable. + +Collective; + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `idx` - the index for which you want to save the name +- `name` - string containing the name characters + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIIGetNodalVariableName()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIISetNodalVariableName")) +""" +function PetscViewerExodusIISetNodalVariableName(petsclib::PetscLibType, viewer::PetscViewer, idx::PetscExodusIIInt, name::String) end + +@for_petsc function PetscViewerExodusIISetNodalVariableName(petsclib::$UnionPetscLib, viewer::PetscViewer, idx::PetscExodusIIInt, name::String ) + + @chk ccall( + (:PetscViewerExodusIISetNodalVariableName, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscExodusIIInt, Ptr{Cchar}), + viewer, idx, name, + ) + + + return nothing +end + +""" + PetscViewerExodusIIGetZonalVariableName(petsclib::PetscLibType,viewer::PetscViewer, idx::PetscExodusIIInt, name::String) +Gets the name of a zonal variable. + +Collective; + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `idx` - the index for which you want to get the name + +Output Parameter: +- `name` - pointer to the string containing the name characters + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIISetZonalVariableName()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIGetZonalVariableName")) +""" +function PetscViewerExodusIIGetZonalVariableName(petsclib::PetscLibType, viewer::PetscViewer, idx::PetscExodusIIInt, name::String) end + +@for_petsc function PetscViewerExodusIIGetZonalVariableName(petsclib::$UnionPetscLib, viewer::PetscViewer, idx::PetscExodusIIInt, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PetscViewerExodusIIGetZonalVariableName, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscExodusIIInt, Ptr{Ptr{Cchar}}), + viewer, idx, name_, + ) + + + return nothing +end + +""" + PetscViewerExodusIIGetNodalVariableName(petsclib::PetscLibType,viewer::PetscViewer, idx::PetscExodusIIInt, name::String) +Gets the name of a nodal variable. + +Collective; + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `idx` - the index for which you want to save the name + +Output Parameter: +- `name` - string array containing name characters + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIISetNodalVariableName()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIGetNodalVariableName")) +""" +function PetscViewerExodusIIGetNodalVariableName(petsclib::PetscLibType, viewer::PetscViewer, idx::PetscExodusIIInt, name::String) end + +@for_petsc function PetscViewerExodusIIGetNodalVariableName(petsclib::$UnionPetscLib, viewer::PetscViewer, idx::PetscExodusIIInt, name::String ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PetscViewerExodusIIGetNodalVariableName, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscExodusIIInt, Ptr{Ptr{Cchar}}), + viewer, idx, name_, + ) + + + return nothing +end + +""" + PetscViewerExodusIISetZonalVariableNames(petsclib::PetscLibType,viewer::PetscViewer, names::String) +Sets the names of all nodal variables + +Collective; No Fortran Support + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `names` - an array of string names to be set, the strings are copied into the `PetscViewer` + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIIGetZonalVariableNames()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIISetZonalVariableNames")) +""" +function PetscViewerExodusIISetZonalVariableNames(petsclib::PetscLibType, viewer::PetscViewer, names::String) end + +@for_petsc function PetscViewerExodusIISetZonalVariableNames(petsclib::$UnionPetscLib, viewer::PetscViewer, names::String ) + names_ = Ref(pointer(names)) + + @chk ccall( + (:PetscViewerExodusIISetZonalVariableNames, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Ptr{Cchar}}), + viewer, names_, + ) + + + return nothing +end + +""" + PetscViewerExodusIISetNodalVariableNames(petsclib::PetscLibType,viewer::PetscViewer, names::String) +Sets the names of all nodal variables. + +Collective; No Fortran Support + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `names` - an array of string names to be set, the strings are copied into the `PetscViewer` + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIIGetNodalVariableNames()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIISetNodalVariableNames")) +""" +function PetscViewerExodusIISetNodalVariableNames(petsclib::PetscLibType, viewer::PetscViewer, names::String) end + +@for_petsc function PetscViewerExodusIISetNodalVariableNames(petsclib::$UnionPetscLib, viewer::PetscViewer, names::String ) + names_ = Ref(pointer(names)) + + @chk ccall( + (:PetscViewerExodusIISetNodalVariableNames, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Ptr{Cchar}}), + viewer, names_, + ) + + + return nothing +end + +""" + PetscViewerExodusIIGetZonalVariableNames(petsclib::PetscLibType,viewer::PetscViewer, numVars::PetscExodusIIInt, varNames::String) +Gets the names of all zonal variables. + +Collective; No Fortran Support + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `numVars` - the number of zonal variable names to retrieve + +Output Parameter: +- `varNames` - returns an array of char pointers where the zonal variable names are + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIISetZonalVariableNames()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIGetZonalVariableNames")) +""" +function PetscViewerExodusIIGetZonalVariableNames(petsclib::PetscLibType, viewer::PetscViewer, numVars::PetscExodusIIInt, varNames::String) end + +@for_petsc function PetscViewerExodusIIGetZonalVariableNames(petsclib::$UnionPetscLib, viewer::PetscViewer, numVars::PetscExodusIIInt, varNames::String ) + + @chk ccall( + (:PetscViewerExodusIIGetZonalVariableNames, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscExodusIIInt}, Ptr{Cchar}), + viewer, numVars, varNames, + ) + + + return nothing +end + +""" + PetscViewerExodusIIGetNodalVariableNames(petsclib::PetscLibType,viewer::PetscViewer, numVars::PetscExodusIIInt, varNames::String) +Gets the names of all nodal variables. + +Collective; No Fortran Support + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `numVars` - the number of nodal variable names to retrieve + +Output Parameter: +- `varNames` - returns an array of char pointers where the nodal variable names are + +Level: intermediate + +-seealso: `PETSCVIEWEREXODUSII`, `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerExodusIIOpen()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewerExodusIISetNodalVariableNames()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIGetNodalVariableNames")) +""" +function PetscViewerExodusIIGetNodalVariableNames(petsclib::PetscLibType, viewer::PetscViewer, numVars::PetscExodusIIInt, varNames::String) end + +@for_petsc function PetscViewerExodusIIGetNodalVariableNames(petsclib::$UnionPetscLib, viewer::PetscViewer, numVars::PetscExodusIIInt, varNames::String ) + + @chk ccall( + (:PetscViewerExodusIIGetNodalVariableNames, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{PetscExodusIIInt}, Ptr{Cchar}), + viewer, numVars, varNames, + ) + + + return nothing +end + +""" + PetscViewerExodusIIGetNodalVariableIndex(petsclib::PetscLibType,viewer::PetscViewer, name::String, varIndex::PetscExodusIIInt) +return the location of a nodal variable in an ExodusII file given its name + +Collective + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `name` - the name of the result + +Output Parameter: +- `varIndex` - the location of the variable in the exodus file or -1 if the variable is not found + +Level: beginner + +-seealso: `PetscViewerExodusIISetNodalVariable()`, `PetscViewerExodusIIGetNodalVariable()`, `PetscViewerExodusIISetNodalVariableName()`, `PetscViewerExodusIISetNodalVariableNames()`, `PetscViewerExodusIIGetNodalVariableName()`, `PetscViewerExodusIIGetNodalVariableNames()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIGetNodalVariableIndex")) +""" +function PetscViewerExodusIIGetNodalVariableIndex(petsclib::PetscLibType, viewer::PetscViewer, name::String, varIndex::PetscExodusIIInt) end + +@for_petsc function PetscViewerExodusIIGetNodalVariableIndex(petsclib::$UnionPetscLib, viewer::PetscViewer, name::String, varIndex::PetscExodusIIInt ) + + @chk ccall( + (:PetscViewerExodusIIGetNodalVariableIndex, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{PetscExodusIIInt}), + viewer, name, varIndex, + ) + + + return nothing +end + +""" + PetscViewerExodusIIGetZonalVariableIndex(petsclib::PetscLibType,viewer::PetscViewer, name::String, varIndex::Cint) +return the location of a zonal variable in an ExodusII file given its name + +Collective + +Input Parameters: +- `viewer` - a `PetscViewer` of type `PETSCVIEWEREXODUSII` +- `name` - the name of the result + +Output Parameter: +- `varIndex` - the location of the variable in the exodus file or -1 if the variable is not found + +Level: beginner + +-seealso: `PetscViewerExodusIISetNodalVariable()`, `PetscViewerExodusIIGetNodalVariable()`, `PetscViewerExodusIISetNodalVariableName()`, `PetscViewerExodusIISetNodalVariableNames()`, `PetscViewerExodusIIGetNodalVariableName()`, `PetscViewerExodusIIGetNodalVariableNames()` + +# External Links +$(_doc_external("DM/PetscViewerExodusIIGetZonalVariableIndex")) +""" +function PetscViewerExodusIIGetZonalVariableIndex(petsclib::PetscLibType, viewer::PetscViewer, name::String, varIndex::Cint) end + +@for_petsc function PetscViewerExodusIIGetZonalVariableIndex(petsclib::$UnionPetscLib, viewer::PetscViewer, name::String, varIndex::Cint ) + + @chk ccall( + (:PetscViewerExodusIIGetZonalVariableIndex, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Ptr{Cint}), + viewer, name, varIndex, + ) + + + return nothing +end + +""" + has::PetscBool = PetscViewerHDF5PathIsRelative(petsclib::PetscLibType,path::String, emptyIsRelative::PetscBool) + +# External Links +$(_doc_external("Viewer/PetscViewerHDF5PathIsRelative")) +""" +function PetscViewerHDF5PathIsRelative(petsclib::PetscLibType, path::String, emptyIsRelative::PetscBool) end + +@for_petsc function PetscViewerHDF5PathIsRelative(petsclib::$UnionPetscLib, path::String, emptyIsRelative::PetscBool ) + has_ = Ref{PetscBool}() + + @chk ccall( + (:PetscViewerHDF5PathIsRelative, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, PetscBool, Ptr{PetscBool}), + path, emptyIsRelative, has_, + ) + + has = has_[] + + return has +end + +""" + PetscViewerSetType(petsclib::PetscLibType,viewer::PetscViewer, type::PetscViewerType) +Builds `PetscViewer` for a particular implementation. + +Collective + +Input Parameters: +- `viewer` - the `PetscViewer` context obtained with `PetscViewerCreate()` +- `type` - for example, `PETSCVIEWERASCII` + +Options Database Key: +- `-viewer_type ` - Sets the type; use -help for a list of available methods (for instance, ascii) + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerCreate()`, `PetscViewerGetType()`, `PetscViewerType`, `PetscViewerPushFormat()` + +# External Links +$(_doc_external("Sys/PetscViewerSetType")) +""" +function PetscViewerSetType(petsclib::PetscLibType, viewer::PetscViewer, type::PetscViewerType) end + +@for_petsc function PetscViewerSetType(petsclib::$UnionPetscLib, viewer::PetscViewer, type::PetscViewerType ) + + @chk ccall( + (:PetscViewerSetType, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscViewerType), + viewer, type, + ) + + + return nothing +end + +""" + PetscViewerSetFromOptions(petsclib::PetscLibType,viewer::PetscViewer) +Sets various options for a viewer based on values in the options database. + +Collective + +Input Parameter: +- `viewer` - the viewer context + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerType` + +# External Links +$(_doc_external("Sys/PetscViewerSetFromOptions")) +""" +function PetscViewerSetFromOptions(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerSetFromOptions(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerSetOptionsPrefix(petsclib::PetscLibType,viewer::PetscViewer, prefix::String) +Sets the prefix used for searching for +`PetscViewer` options in the database during `PetscViewerSetFromOptions()`. + +Logically Collective + +Input Parameters: +- `viewer` - the `PetscViewer` context +- `prefix` - the prefix to prepend to all option names + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerSetFromOptions()`, `PetscViewerAppendOptionsPrefix()` + +# External Links +$(_doc_external("Sys/PetscViewerSetOptionsPrefix")) +""" +function PetscViewerSetOptionsPrefix(petsclib::PetscLibType, viewer::PetscViewer, prefix::String) end + +@for_petsc function PetscViewerSetOptionsPrefix(petsclib::$UnionPetscLib, viewer::PetscViewer, prefix::String ) + + @chk ccall( + (:PetscViewerSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}), + viewer, prefix, + ) + + + return nothing +end + +""" + PetscViewerSetUp(petsclib::PetscLibType,viewer::PetscViewer) +Sets up the internal viewer data structures for the later use. + +Collective + +Input Parameter: +- `viewer` - the `PetscViewer` context + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerCreate()`, `PetscViewerDestroy()` + +# External Links +$(_doc_external("Sys/PetscViewerSetUp")) +""" +function PetscViewerSetUp(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerSetUp(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerSetUp, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewersDestroy(petsclib::PetscLibType,v::PetscViewers) +Destroys a set of `PetscViewer`s created with `PetscViewersCreate()`. + +Collective + +Input Parameter: +- `v` - the `PetscViewers` to be destroyed. + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewerDestroy()`, `PetscViewers`, `PetscViewerSocketOpen()`, `PetscViewerASCIIOpen()`, `PetscViewerCreate()`, `PetscViewerDrawOpen()`, `PetscViewersCreate()` + +# External Links +$(_doc_external("Sys/PetscViewersDestroy")) +""" +function PetscViewersDestroy(petsclib::PetscLibType, v::PetscViewers) end + +@for_petsc function PetscViewersDestroy(petsclib::$UnionPetscLib, v::PetscViewers ) + + @chk ccall( + (:PetscViewersDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscViewers},), + v, + ) + + + return nothing +end + +""" + v::PetscViewers = PetscViewersCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a container to hold a set of `PetscViewer`'s. The container is essentially a sparse, growable in length array of `PetscViewer`s + +Collective + +Input Parameter: +- `comm` - the MPI communicator + +Output Parameter: +- `v` - the collection of `PetscViewers` + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewers`, `PetscViewerCreate()`, `PetscViewersDestroy()` + +# External Links +$(_doc_external("Sys/PetscViewersCreate")) +""" +function PetscViewersCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscViewersCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + v_ = Ref{PetscViewers}() + + @chk ccall( + (:PetscViewersCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscViewers}), + comm, v_, + ) + + v = v_[] + + return v +end + +""" + PetscViewersGetViewer(petsclib::PetscLibType,viewers::PetscViewers, n::PetscInt, viewer::PetscViewer) +Gets a `PetscViewer` from a `PetscViewers` collection + +Collective if the viewer has not previously be obtained. + +Input Parameters: +- `viewers` - object created with `PetscViewersCreate()` +- `n` - number of `PetscViewer` you want + +Output Parameter: +- `viewer` - the `PetscViewer` + +Level: intermediate + +-seealso: [](sec_viewers), `PetscViewer`, `PetscViewers`, `PetscViewersCreate()`, `PetscViewersDestroy()` + +# External Links +$(_doc_external("Sys/PetscViewersGetViewer")) +""" +function PetscViewersGetViewer(petsclib::PetscLibType, viewers::PetscViewers, n::PetscInt, viewer::PetscViewer) end + +@for_petsc function PetscViewersGetViewer(petsclib::$UnionPetscLib, viewers::PetscViewers, n::$PetscInt, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewersGetViewer, $petsc_library), + PetscErrorCode, + (PetscViewers, $PetscInt, Ptr{PetscViewer}), + viewers, n, viewer, + ) + + + return nothing +end + +""" + PetscViewerSAWsOpen(petsclib::PetscLibType,comm::MPI_Comm, lab::PetscViewer) +Opens an SAWs `PetscViewer`. + +Collective; No Fortran Support + +Input Parameter: +- `comm` - the MPI communicator + +Output Parameter: +- `lab` - the `PetscViewer` + +Options Database Keys: +- `-saws_port ` - port number where you are running SAWs client +- `-xxx_view saws` - publish the object xxx +- `-xxx_saws_block` - blocks the program at the end of a critical point (for `KSP` and `SNES` it is the end of a solve) until +the user unblocks the problem with an external tool that access the object with SAWS + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewerDestroy()`, `PetscViewerStringSPrintf()`, `PETSC_VIEWER_SAWS_()`, `PetscObjectSAWsBlock()`, +`PetscObjectSAWsViewOff()`, `PetscObjectSAWsTakeAccess()`, `PetscObjectSAWsGrantAccess()` + +# External Links +$(_doc_external("Sys/PetscViewerSAWsOpen")) +""" +function PetscViewerSAWsOpen(petsclib::PetscLibType, comm::MPI_Comm, lab::PetscViewer) end + +@for_petsc function PetscViewerSAWsOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, lab::PetscViewer ) + + @chk ccall( + (:PetscViewerSAWsOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscViewer}), + comm, lab, + ) + + + return nothing +end + +""" + PetscViewerStringOpen(petsclib::PetscLibType,comm::MPI_Comm, string::String, len::Csize_t, lab::PetscViewer) +Opens a string as a `PETSCVIEWERSTRING` `PetscViewer`. This is a very +simple `PetscViewer`; information on the object is simply stored into +the string in a fairly nice way. + +Collective; No Fortran Support + +Input Parameters: +- `comm` - the communicator +- `string` - the string to use +- `len` - the string length + +Output Parameter: +- `lab` - the `PetscViewer` + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERSTRING`, `PetscViewerDestroy()`, `PetscViewerStringSPrintf()`, `PetscViewerStringGetStringRead()`, `PetscViewerStringSetString()` + +# External Links +$(_doc_external("Sys/PetscViewerStringOpen")) +""" +function PetscViewerStringOpen(petsclib::PetscLibType, comm::MPI_Comm, string::String, len::Csize_t, lab::PetscViewer) end + +@for_petsc function PetscViewerStringOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, string::String, len::Csize_t, lab::PetscViewer ) + + @chk ccall( + (:PetscViewerStringOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Csize_t, Ptr{PetscViewer}), + comm, string, len, lab, + ) + + + return nothing +end + +""" + PetscViewerStringGetStringRead(petsclib::PetscLibType,viewer::PetscViewer, string::String, len::Csize_t) +Returns the string that a `PETSCVIEWERSTRING` uses + +Logically Collective + +Input Parameter: +- `viewer` - `PETSCVIEWERSTRING` viewer + +Output Parameters: +- `string` - the string, optional use `NULL` if you do not need +- `len` - the length of the string, optional use `NULL` if you do not need it + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewerStringOpen()`, `PETSCVIEWERSTRING`, `PetscViewerStringSetString()`, `PetscViewerStringSPrintf()`, +`PetscViewerStringSetOwnString()` + +# External Links +$(_doc_external("Sys/PetscViewerStringGetStringRead")) +""" +function PetscViewerStringGetStringRead(petsclib::PetscLibType, viewer::PetscViewer, string::String, len::Csize_t) end + +@for_petsc function PetscViewerStringGetStringRead(petsclib::$UnionPetscLib, viewer::PetscViewer, string::String, len::Csize_t ) + string_ = Ref(pointer(string)) + + @chk ccall( + (:PetscViewerStringGetStringRead, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Ptr{Cchar}}, Ptr{Csize_t}), + viewer, string_, len, + ) + + + return nothing +end + +""" + PetscViewerStringSetString(petsclib::PetscLibType,viewer::PetscViewer, string::String, len::Csize_t) +sets the string that a string viewer will print to + +Logically Collective + +Input Parameters: +- `viewer` - string viewer you wish to attach string to +- `string` - the string to print data into +- `len` - the length of the string + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewerStringOpen()`, `PETSCVIEWERSTRING`, `PetscViewerStringGetStringRead()`, `PetscViewerStringSPrintf()`, +`PetscViewerStringSetOwnString()` + +# External Links +$(_doc_external("Sys/PetscViewerStringSetString")) +""" +function PetscViewerStringSetString(petsclib::PetscLibType, viewer::PetscViewer, string::String, len::Csize_t) end + +@for_petsc function PetscViewerStringSetString(petsclib::$UnionPetscLib, viewer::PetscViewer, string::String, len::Csize_t ) + + @chk ccall( + (:PetscViewerStringSetString, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Csize_t), + viewer, string, len, + ) + + + return nothing +end + +""" + PetscViewerStringSetOwnString(petsclib::PetscLibType,viewer::PetscViewer) +tells the viewer that it now owns the string and is responsible for freeing it with `PetscFree()` + +Logically Collective + +Input Parameter: +- `viewer` - string viewer + +Level: advanced + +-seealso: [](sec_viewers), `PetscViewerStringOpen()`, `PETSCVIEWERSTRING`, `PetscViewerStringGetStringRead()`, `PetscViewerStringSPrintf()`, +`PetscViewerStringSetString()` + +# External Links +$(_doc_external("Sys/PetscViewerStringSetOwnString")) +""" +function PetscViewerStringSetOwnString(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscViewerStringSetOwnString(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscViewerStringSetOwnString, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscViewerSocketOpen(petsclib::PetscLibType,comm::MPI_Comm, machine::String, port::Cint, lab::PetscViewer) +Opens a connection to a MATLAB or other socket based server. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `machine` - the machine the server is running on, use `NULL` for the local machine, use "server" to passively wait for +a connection from elsewhere +- `port` - the port to connect to, use `PETSC_DEFAULT` for the default + +Output Parameter: +- `lab` - a context to use when communicating with the server + +Options Database Keys: +For use with `PETSC_VIEWER_SOCKET_WORLD`, `PETSC_VIEWER_SOCKET_SELF`, +`PETSC_VIEWER_SOCKET_()` or if +`NULL` is passed for machine or PETSC_DEFAULT is passed for port +- `-viewer_socket_machine ` - the machine where the socket is available +- `-viewer_socket_port ` - the socket to connect to + +Environmental variables: +- `PETSC_VIEWER_SOCKET_MACHINE` - machine name +- `PETSC_VIEWER_SOCKET_PORT` - portnumber + +Level: intermediate + +-seealso: [](sec_viewers), `PETSCVIEWERBINARY`, `PETSCVIEWERSOCKET`, `MatView()`, `VecView()`, `PetscViewerDestroy()`, `PetscViewerCreate()`, `PetscViewerSetType()`, +`PetscViewerSocketSetConnection()`, `PETSC_VIEWER_SOCKET_`, `PETSC_VIEWER_SOCKET_WORLD`, +`PETSC_VIEWER_SOCKET_SELF`, `PetscViewerBinaryWrite()`, `PetscViewerBinaryRead()`, `PetscViewerBinaryWriteStringArray()`, +`PetscBinaryViewerGetDescriptor()`, `PetscMatlabEngineCreate()` + +# External Links +$(_doc_external("Sys/PetscViewerSocketOpen")) +""" +function PetscViewerSocketOpen(petsclib::PetscLibType, comm::MPI_Comm, machine::String, port::Cint, lab::PetscViewer) end + +@for_petsc function PetscViewerSocketOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, machine::String, port::Cint, lab::PetscViewer ) + + @chk ccall( + (:PetscViewerSocketOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Cint, Ptr{PetscViewer}), + comm, machine, port, lab, + ) + + + return nothing +end + +""" + PetscViewerSocketSetConnection(petsclib::PetscLibType,v::PetscViewer, machine::String, port::Cint) +Sets the machine and port that a PETSc socket +viewer is to use + +Logically Collective + +Input Parameters: +- `v` - viewer to connect +- `machine` - host to connect to, use `NULL` for the local machine,use "server" to passively wait for +a connection from elsewhere +- `port` - the port on the machine one is connecting to, use `PETSC_DEFAULT` for default + +Level: advanced + +-seealso: [](sec_viewers), `PETSCVIEWERMATLAB`, `PETSCVIEWERSOCKET`, `PetscViewerSocketOpen()` + +# External Links +$(_doc_external("Sys/PetscViewerSocketSetConnection")) +""" +function PetscViewerSocketSetConnection(petsclib::PetscLibType, v::PetscViewer, machine::String, port::Cint) end + +@for_petsc function PetscViewerSocketSetConnection(petsclib::$UnionPetscLib, v::PetscViewer, machine::String, port::Cint ) + + @chk ccall( + (:PetscViewerSocketSetConnection, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}, Cint), + v, machine, port, + ) + + + return nothing +end + diff --git a/src/autowrapped/Petsccomm_wrappers.jl b/src/autowrapped/Petsccomm_wrappers.jl new file mode 100644 index 00000000..a0108d2d --- /dev/null +++ b/src/autowrapped/Petsccomm_wrappers.jl @@ -0,0 +1,509 @@ +# autodefined type arguments for class ------ +mutable struct _n_PetscSubcomm end +const PetscSubcomm = Ptr{_n_PetscSubcomm} + +# ------------------------------------------------------- +# autodefined type arguments for class ------ +mutable struct _n_PetscShmComm end +const PetscShmComm = Ptr{_n_PetscShmComm} +# ------------------------------------------------------- + +""" + PetscSubcommSetFromOptions(petsclib::PetscLibType,psubcomm::PetscSubcomm) +Allows setting options for a `PetscSubcomm` + +Collective + +Input Parameter: +- `psubcomm` - `PetscSubcomm` context + +Level: beginner + +-seealso: `PetscSubcomm`, `PetscSubcommCreate()` + +# External Links +$(_doc_external("Sys/PetscSubcommSetFromOptions")) +""" +function PetscSubcommSetFromOptions(petsclib::PetscLibType, psubcomm::PetscSubcomm) end + +@for_petsc function PetscSubcommSetFromOptions(petsclib::$UnionPetscLib, psubcomm::PetscSubcomm ) + + @chk ccall( + (:PetscSubcommSetFromOptions, $petsc_library), + PetscErrorCode, + (PetscSubcomm,), + psubcomm, + ) + + + return nothing +end + +""" + PetscSubcommSetOptionsPrefix(petsclib::PetscLibType,psubcomm::PetscSubcomm, pre::String) +Sets the prefix used for searching for options in the options database for this object + +Logically Collective + +Level: intermediate + +Input Parameters: +- `psubcomm` - `PetscSubcomm` context +- `pre` - the prefix to prepend all `PetscSubcomm` item names with. + +-seealso: `PetscSubcomm`, `PetscSubcommCreate()` + +# External Links +$(_doc_external("Sys/PetscSubcommSetOptionsPrefix")) +""" +function PetscSubcommSetOptionsPrefix(petsclib::PetscLibType, psubcomm::PetscSubcomm, pre::String) end + +@for_petsc function PetscSubcommSetOptionsPrefix(petsclib::$UnionPetscLib, psubcomm::PetscSubcomm, pre::String ) + + @chk ccall( + (:PetscSubcommSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (PetscSubcomm, Ptr{Cchar}), + psubcomm, pre, + ) + + + return nothing +end + +""" + PetscSubcommView(petsclib::PetscLibType,psubcomm::PetscSubcomm, viewer::PetscViewer) +Views a `PetscSubcomm` + +Collective + +Input Parameters: +- `psubcomm` - `PetscSubcomm` context +- `viewer` - `PetscViewer` to display the information + +Level: beginner + +-seealso: `PetscSubcomm`, `PetscSubcommCreate()`, `PetscViewer` + +# External Links +$(_doc_external("Sys/PetscSubcommView")) +""" +function PetscSubcommView(petsclib::PetscLibType, psubcomm::PetscSubcomm, viewer::PetscViewer) end + +@for_petsc function PetscSubcommView(petsclib::$UnionPetscLib, psubcomm::PetscSubcomm, viewer::PetscViewer ) + + @chk ccall( + (:PetscSubcommView, $petsc_library), + PetscErrorCode, + (PetscSubcomm, PetscViewer), + psubcomm, viewer, + ) + + + return nothing +end + +""" + PetscSubcommSetNumber(petsclib::PetscLibType,psubcomm::PetscSubcomm, nsubcomm::PetscInt) +Set total number of subcommunicators desired in the given `PetscSubcomm` + +Collective + +Input Parameters: +- `psubcomm` - `PetscSubcomm` context +- `nsubcomm` - the total number of subcommunicators in psubcomm + +Level: advanced + +-seealso: `PetscSubcomm`, `PetscSubcommCreate()`, `PetscSubcommDestroy()`, `PetscSubcommSetType()`, `PetscSubcommSetTypeGeneral()` + +# External Links +$(_doc_external("Sys/PetscSubcommSetNumber")) +""" +function PetscSubcommSetNumber(petsclib::PetscLibType, psubcomm::PetscSubcomm, nsubcomm::PetscInt) end + +@for_petsc function PetscSubcommSetNumber(petsclib::$UnionPetscLib, psubcomm::PetscSubcomm, nsubcomm::$PetscInt ) + + @chk ccall( + (:PetscSubcommSetNumber, $petsc_library), + PetscErrorCode, + (PetscSubcomm, $PetscInt), + psubcomm, nsubcomm, + ) + + + return nothing +end + +""" + PetscSubcommSetType(petsclib::PetscLibType,psubcomm::PetscSubcomm, subcommtype::PetscSubcommType) +Set the way the original MPI communicator is divided up in the `PetscSubcomm` + +Collective + +Input Parameters: +- `psubcomm` - `PetscSubcomm` context +- `subcommtype` - `PetscSubcommType` `PETSC_SUBCOMM_CONTIGUOUS` or `PETSC_SUBCOMM_INTERLACED` + +Level: advanced + +-seealso: `PetscSubcommType`, `PETSC_SUBCOMM_CONTIGUOUS`, `PETSC_SUBCOMM_INTERLACED`, +`PetscSubcommCreate()`, `PetscSubcommDestroy()`, `PetscSubcommSetNumber()`, `PetscSubcommSetTypeGeneral()` + +# External Links +$(_doc_external("Sys/PetscSubcommSetType")) +""" +function PetscSubcommSetType(petsclib::PetscLibType, psubcomm::PetscSubcomm, subcommtype::PetscSubcommType) end + +@for_petsc function PetscSubcommSetType(petsclib::$UnionPetscLib, psubcomm::PetscSubcomm, subcommtype::PetscSubcommType ) + + @chk ccall( + (:PetscSubcommSetType, $petsc_library), + PetscErrorCode, + (PetscSubcomm, PetscSubcommType), + psubcomm, subcommtype, + ) + + + return nothing +end + +""" + PetscSubcommSetTypeGeneral(petsclib::PetscLibType,psubcomm::PetscSubcomm, color::PetscMPIInt, subrank::PetscMPIInt) +Divides up a communicator based on a specific user's specification + +Collective + +Input Parameters: +- `psubcomm` - `PetscSubcomm` context +- `color` - control of subset assignment (nonnegative integer). Processes with the same color are in the same subcommunicator. +- `subrank` - rank in the subcommunicator + +Level: advanced + +-seealso: `PetscSubcommType`, `PETSC_SUBCOMM_CONTIGUOUS`, `PETSC_SUBCOMM_INTERLACED`, `PetscSubcommCreate()`, `PetscSubcommDestroy()`, `PetscSubcommSetNumber()`, `PetscSubcommSetType()` + +# External Links +$(_doc_external("Sys/PetscSubcommSetTypeGeneral")) +""" +function PetscSubcommSetTypeGeneral(petsclib::PetscLibType, psubcomm::PetscSubcomm, color::PetscMPIInt, subrank::PetscMPIInt) end + +@for_petsc function PetscSubcommSetTypeGeneral(petsclib::$UnionPetscLib, psubcomm::PetscSubcomm, color::PetscMPIInt, subrank::PetscMPIInt ) + + @chk ccall( + (:PetscSubcommSetTypeGeneral, $petsc_library), + PetscErrorCode, + (PetscSubcomm, PetscMPIInt, PetscMPIInt), + psubcomm, color, subrank, + ) + + + return nothing +end + +""" + PetscSubcommDestroy(petsclib::PetscLibType,psubcomm::PetscSubcomm) +Destroys a `PetscSubcomm` object + +Collective + +Input Parameter: +- `psubcomm` - the `PetscSubcomm` context + +Level: advanced + +-seealso: `PetscSubcommCreate()`, `PetscSubcommSetType()` + +# External Links +$(_doc_external("Sys/PetscSubcommDestroy")) +""" +function PetscSubcommDestroy(petsclib::PetscLibType, psubcomm::PetscSubcomm) end + +@for_petsc function PetscSubcommDestroy(petsclib::$UnionPetscLib, psubcomm::PetscSubcomm ) + + @chk ccall( + (:PetscSubcommDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscSubcomm},), + psubcomm, + ) + + + return nothing +end + +""" + psubcomm::PetscSubcomm = PetscSubcommCreate(petsclib::PetscLibType,comm::MPI_Comm) +Create a `PetscSubcomm` context. This object is used to manage the division of a `MPI_Comm` into subcommunicators + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `psubcomm` - location to store the `PetscSubcomm` context + +Level: advanced + +-seealso: `PetscSubcomm`, `PetscSubcommDestroy()`, `PetscSubcommSetTypeGeneral()`, `PetscSubcommSetFromOptions()`, `PetscSubcommSetType()`, +`PetscSubcommSetNumber()` + +# External Links +$(_doc_external("Sys/PetscSubcommCreate")) +""" +function PetscSubcommCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscSubcommCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + psubcomm_ = Ref{PetscSubcomm}() + + @chk ccall( + (:PetscSubcommCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscSubcomm}), + comm, psubcomm_, + ) + + psubcomm = psubcomm_[] + + return psubcomm +end + +""" + PetscSubcommGetParent(petsclib::PetscLibType,scomm::PetscSubcomm, pcomm::MPI_Comm) +Gets the communicator that was used to create the `PetscSubcomm` + +Collective + +Input Parameter: +- `scomm` - the `PetscSubcomm` + +Output Parameter: +- `pcomm` - location to store the parent communicator + +Level: intermediate + +-seealso: `PetscSubcommDestroy()`, `PetscSubcommSetTypeGeneral()`, `PetscSubcommSetFromOptions()`, `PetscSubcommSetType()`, +`PetscSubcommSetNumber()`, `PetscSubcommGetChild()`, `PetscSubcommContiguousParent()` + +# External Links +$(_doc_external("Sys/PetscSubcommGetParent")) +""" +function PetscSubcommGetParent(petsclib::PetscLibType, scomm::PetscSubcomm, pcomm::MPI_Comm) end + +@for_petsc function PetscSubcommGetParent(petsclib::$UnionPetscLib, scomm::PetscSubcomm, pcomm::MPI_Comm ) + + @chk ccall( + (:PetscSubcommGetParent, $petsc_library), + PetscErrorCode, + (PetscSubcomm, Ptr{MPI_Comm}), + scomm, pcomm, + ) + + + return nothing +end + +""" + PetscSubcommGetContiguousParent(petsclib::PetscLibType,scomm::PetscSubcomm, pcomm::MPI_Comm) +Gets a communicator that is a duplicate of the parent but has the ranks +reordered by the order they are in the children + +Collective + +Input Parameter: +- `scomm` - the `PetscSubcomm` + +Output Parameter: +- `pcomm` - location to store the parent communicator + +Level: intermediate + +-seealso: `PetscSubcommDestroy()`, `PetscSubcommSetTypeGeneral()`, `PetscSubcommSetFromOptions()`, `PetscSubcommSetType()`, +`PetscSubcommSetNumber()`, `PetscSubcommGetChild()`, `PetscSubcommContiguousParent()` + +# External Links +$(_doc_external("Sys/PetscSubcommGetContiguousParent")) +""" +function PetscSubcommGetContiguousParent(petsclib::PetscLibType, scomm::PetscSubcomm, pcomm::MPI_Comm) end + +@for_petsc function PetscSubcommGetContiguousParent(petsclib::$UnionPetscLib, scomm::PetscSubcomm, pcomm::MPI_Comm ) + + @chk ccall( + (:PetscSubcommGetContiguousParent, $petsc_library), + PetscErrorCode, + (PetscSubcomm, Ptr{MPI_Comm}), + scomm, pcomm, + ) + + + return nothing +end + +""" + PetscSubcommGetChild(petsclib::PetscLibType,scomm::PetscSubcomm, ccomm::MPI_Comm) +Gets the communicator created by the `PetscSubcomm`. This is part of one of the subcommunicators created by the `PetscSubcomm` + +Collective + +Input Parameter: +- `scomm` - the `PetscSubcomm` + +Output Parameter: +- `ccomm` - location to store the child communicator + +Level: intermediate + +-seealso: `PetscSubcommDestroy()`, `PetscSubcommSetTypeGeneral()`, `PetscSubcommSetFromOptions()`, `PetscSubcommSetType()`, +`PetscSubcommSetNumber()`, `PetscSubcommGetParent()`, `PetscSubcommContiguousParent()` + +# External Links +$(_doc_external("Sys/PetscSubcommGetChild")) +""" +function PetscSubcommGetChild(petsclib::PetscLibType, scomm::PetscSubcomm, ccomm::MPI_Comm) end + +@for_petsc function PetscSubcommGetChild(petsclib::$UnionPetscLib, scomm::PetscSubcomm, ccomm::MPI_Comm ) + + @chk ccall( + (:PetscSubcommGetChild, $petsc_library), + PetscErrorCode, + (PetscSubcomm, Ptr{MPI_Comm}), + scomm, ccomm, + ) + + + return nothing +end + +""" + PetscShmCommGet(petsclib::PetscLibType,globcomm::MPI_Comm, pshmcomm::PetscShmComm) +Returns a sub + +Collective. + +Input Parameter: +- `globcomm` - `MPI_Comm`, which can be a user `MPI_Comm` or a PETSc inner `MPI_Comm` + +Output Parameter: +- `pshmcomm` - the PETSc shared memory communicator object + +Level: developer + +-seealso: `PetscShmCommGlobalToLocal()`, `PetscShmCommLocalToGlobal()`, `PetscShmCommGetMpiShmComm()` + +# External Links +$(_doc_external("Sys/PetscShmCommGet")) +""" +function PetscShmCommGet(petsclib::PetscLibType, globcomm::MPI_Comm, pshmcomm::PetscShmComm) end + +@for_petsc function PetscShmCommGet(petsclib::$UnionPetscLib, globcomm::MPI_Comm, pshmcomm::PetscShmComm ) + + @chk ccall( + (:PetscShmCommGet, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscShmComm}), + globcomm, pshmcomm, + ) + + + return nothing +end + +""" + PetscShmCommGlobalToLocal(petsclib::PetscLibType,pshmcomm::PetscShmComm, grank::PetscMPIInt, lrank::PetscMPIInt) +Given a global rank returns the local rank in the shared memory communicator + +Input Parameters: +- `pshmcomm` - the shared memory communicator object +- `grank` - the global rank + +Output Parameter: +- `lrank` - the local rank, or `MPI_PROC_NULL` if it does not exist + +Level: developer + +-seealso: `PetscShmCommGet()`, `PetscShmCommLocalToGlobal()`, `PetscShmCommGetMpiShmComm()` + +# External Links +$(_doc_external("Sys/PetscShmCommGlobalToLocal")) +""" +function PetscShmCommGlobalToLocal(petsclib::PetscLibType, pshmcomm::PetscShmComm, grank::PetscMPIInt, lrank::PetscMPIInt) end + +@for_petsc function PetscShmCommGlobalToLocal(petsclib::$UnionPetscLib, pshmcomm::PetscShmComm, grank::PetscMPIInt, lrank::PetscMPIInt ) + + @chk ccall( + (:PetscShmCommGlobalToLocal, $petsc_library), + PetscErrorCode, + (PetscShmComm, PetscMPIInt, Ptr{PetscMPIInt}), + pshmcomm, grank, lrank, + ) + + + return nothing +end + +""" + PetscShmCommLocalToGlobal(petsclib::PetscLibType,pshmcomm::PetscShmComm, lrank::PetscMPIInt, grank::PetscMPIInt) +Given a local rank in the shared memory communicator returns the global rank + +Input Parameters: +- `pshmcomm` - the shared memory communicator object +- `lrank` - the local rank in the shared memory communicator + +Output Parameter: +- `grank` - the global rank in the global communicator where the shared memory communicator is built + +Level: developer + +-seealso: `PetscShmCommGlobalToLocal()`, `PetscShmCommGet()`, `PetscShmCommGetMpiShmComm()` + +# External Links +$(_doc_external("Sys/PetscShmCommLocalToGlobal")) +""" +function PetscShmCommLocalToGlobal(petsclib::PetscLibType, pshmcomm::PetscShmComm, lrank::PetscMPIInt, grank::PetscMPIInt) end + +@for_petsc function PetscShmCommLocalToGlobal(petsclib::$UnionPetscLib, pshmcomm::PetscShmComm, lrank::PetscMPIInt, grank::PetscMPIInt ) + + @chk ccall( + (:PetscShmCommLocalToGlobal, $petsc_library), + PetscErrorCode, + (PetscShmComm, PetscMPIInt, Ptr{PetscMPIInt}), + pshmcomm, lrank, grank, + ) + + + return nothing +end + +""" + PetscShmCommGetMpiShmComm(petsclib::PetscLibType,pshmcomm::PetscShmComm, comm::MPI_Comm) +Returns the MPI communicator that represents all processes with common shared memory + +Input Parameter: +- `pshmcomm` - PetscShmComm object obtained with PetscShmCommGet() + +Output Parameter: +- `comm` - the MPI communicator + +Level: developer + +-seealso: `PetscShmCommGlobalToLocal()`, `PetscShmCommGet()`, `PetscShmCommLocalToGlobal()` + +# External Links +$(_doc_external("Sys/PetscShmCommGetMpiShmComm")) +""" +function PetscShmCommGetMpiShmComm(petsclib::PetscLibType, pshmcomm::PetscShmComm, comm::MPI_Comm) end + +@for_petsc function PetscShmCommGetMpiShmComm(petsclib::$UnionPetscLib, pshmcomm::PetscShmComm, comm::MPI_Comm ) + + @chk ccall( + (:PetscShmCommGetMpiShmComm, $petsc_library), + PetscErrorCode, + (PetscShmComm, Ptr{MPI_Comm}), + pshmcomm, comm, + ) + + + return nothing +end + diff --git a/src/autowrapped/SNESLineSearch_wrappers.jl b/src/autowrapped/SNESLineSearch_wrappers.jl new file mode 100644 index 00000000..d7caad48 --- /dev/null +++ b/src/autowrapped/SNESLineSearch_wrappers.jl @@ -0,0 +1,1853 @@ +# autodefined type arguments for class ------ +mutable struct SNESLineSearchVIProjectFn end + +mutable struct SNESLineSearchVINormFn end + +mutable struct SNESLineSearchVIDirDerivFn end + +mutable struct SNESLineSearchShellApplyFn end + +#mutable struct _n_SNESLineSearch end +#const SNESLineSearch = Ptr{_n_SNESLineSearch} + +# ------------------------------------------------------- +""" + SNESLineSearchMonitorCancel(petsclib::PetscLibType,ls::SNESLineSearch) +Clears all the monitor functions for a `SNESLineSearch` object. + +Logically Collective + +Input Parameter: +- `ls` - the `SNESLineSearch` context + +Options Database Key: +- `-snes_linesearch_monitor_cancel` - cancels all monitors that have been hardwired +into a code by calls to `SNESLineSearchMonitorSet()`, but does not cancel those +set via the options database + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchMonitorDefault()`, `SNESLineSearchMonitorSet()` + +# External Links +$(_doc_external("SNES/SNESLineSearchMonitorCancel")) +""" +function SNESLineSearchMonitorCancel(petsclib::PetscLibType, ls::SNESLineSearch) end + +@for_petsc function SNESLineSearchMonitorCancel(petsclib::$UnionPetscLib, ls::SNESLineSearch ) + + @chk ccall( + (:SNESLineSearchMonitorCancel, $petsc_library), + PetscErrorCode, + (SNESLineSearch,), + ls, + ) + + + return nothing +end + +""" + SNESLineSearchMonitor(petsclib::PetscLibType,ls::SNESLineSearch) +runs the user provided monitor routines, if they exist + +Collective + +Input Parameter: +- `ls` - the linesearch object + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchMonitorSet()` + +# External Links +$(_doc_external("SNES/SNESLineSearchMonitor")) +""" +function SNESLineSearchMonitor(petsclib::PetscLibType, ls::SNESLineSearch) end + +@for_petsc function SNESLineSearchMonitor(petsclib::$UnionPetscLib, ls::SNESLineSearch ) + + @chk ccall( + (:SNESLineSearchMonitor, $petsc_library), + PetscErrorCode, + (SNESLineSearch,), + ls, + ) + + + return nothing +end + +""" + SNESLineSearchMonitorSet(petsclib::PetscLibType,ls::SNESLineSearch, f::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn) +Sets an ADDITIONAL function that is to be used at every +iteration of the nonlinear solver to display the iteration's +progress. + +Logically Collective + +Input Parameters: +- `ls` - the `SNESLineSearch` context +- `f` - the monitor function +- `mctx` - [optional] user-defined context for private data for the monitor routine (use `NULL` if no context is desired) +- `monitordestroy` - [optional] routine that frees monitor context (may be `NULL`), see `PetscCtxDestroyFn` for the calling sequence + +Calling sequence of `f`: +- `ls` - the `SNESLineSearch` context +- `mctx` - [optional] user-defined context for private data for the monitor routine + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchMonitorDefault()`, `SNESLineSearchMonitorCancel()`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("SNES/SNESLineSearchMonitorSet")) +""" +function SNESLineSearchMonitorSet(petsclib::PetscLibType, ls::SNESLineSearch, f::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn) end + +@for_petsc function SNESLineSearchMonitorSet(petsclib::$UnionPetscLib, ls::SNESLineSearch, f::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn ) + + @chk ccall( + (:SNESLineSearchMonitorSet, $petsc_library), + PetscErrorCode, + (SNESLineSearch, external, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + ls, f, mctx, monitordestroy, + ) + + + return nothing +end + +""" + SNESLineSearchMonitorSolutionUpdate(petsclib::PetscLibType,ls::SNESLineSearch, vf::PetscViewerAndFormat) +Monitors each update of the function value the linesearch tries + +Collective + +Input Parameters: +- `ls` - the `SNESLineSearch` object +- `vf` - the context for the monitor, in this case it is an `PetscViewerAndFormat` + +Options Database Key: +- `-snes_linesearch_monitor_solution_update [viewer:filename:format]` - view each update tried by line search routine + +Level: developer + +This is not normally called directly but is passed to `SNESLineSearchMonitorSet()` + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchMonitorSet()`, `SNESMonitorSolution()` + +# External Links +$(_doc_external("SNES/SNESLineSearchMonitorSolutionUpdate")) +""" +function SNESLineSearchMonitorSolutionUpdate(petsclib::PetscLibType, ls::SNESLineSearch, vf::PetscViewerAndFormat) end + +@for_petsc function SNESLineSearchMonitorSolutionUpdate(petsclib::$UnionPetscLib, ls::SNESLineSearch, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESLineSearchMonitorSolutionUpdate, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{PetscViewerAndFormat}), + ls, vf, + ) + + + return nothing +end + +""" + outlinesearch::SNESLineSearch = SNESLineSearchCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a `SNESLineSearch` context. + +Logically Collective + +Input Parameter: +- `comm` - MPI communicator for the line search (typically from the associated `SNES` context). + +Output Parameter: +- `outlinesearch` - the new line search context + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `LineSearchDestroy()`, `SNESGetLineSearch()` + +# External Links +$(_doc_external("SNES/SNESLineSearchCreate")) +""" +function SNESLineSearchCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function SNESLineSearchCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + outlinesearch_ = Ref{SNESLineSearch}() + + @chk ccall( + (:SNESLineSearchCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{SNESLineSearch}), + comm, outlinesearch_, + ) + + outlinesearch = outlinesearch_[] + + return outlinesearch +end + +""" + SNESLineSearchSetUp(petsclib::PetscLibType,linesearch::SNESLineSearch) +Prepares the line search for being applied by allocating +any required vectors. + +Collective + +Input Parameter: +- `linesearch` - The `SNESLineSearch` instance. + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchReset()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetUp")) +""" +function SNESLineSearchSetUp(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchSetUp(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + + @chk ccall( + (:SNESLineSearchSetUp, $petsc_library), + PetscErrorCode, + (SNESLineSearch,), + linesearch, + ) + + + return nothing +end + +""" + SNESLineSearchReset(petsclib::PetscLibType,linesearch::SNESLineSearch) +Undoes the `SNESLineSearchSetUp()` and deletes any `Vec`s or `Mat`s allocated by the line search. + +Collective + +Input Parameter: +- `linesearch` - The `SNESLineSearch` instance. + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchSetUp()` + +# External Links +$(_doc_external("SNES/SNESLineSearchReset")) +""" +function SNESLineSearchReset(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchReset(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + + @chk ccall( + (:SNESLineSearchReset, $petsc_library), + PetscErrorCode, + (SNESLineSearch,), + linesearch, + ) + + + return nothing +end + +""" + SNESLineSearchSetFunction(petsclib::PetscLibType,linesearch::SNESLineSearch, func::external) +Sets the function evaluation used by the `SNES` line search +` + +Input Parameters: +- `linesearch` - the `SNESLineSearch` context +- `func` - function evaluation routine, this is usually the function provided with `SNESSetFunction()` + +Calling sequence of `func`: +- `snes` - the `SNES` with which the `SNESLineSearch` context is associated with +- `x` - the input vector +- `f` - the computed value of the function + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESSetFunction()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetFunction")) +""" +function SNESLineSearchSetFunction(petsclib::PetscLibType, linesearch::SNESLineSearch, func::external) end + +@for_petsc function SNESLineSearchSetFunction(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, func::external ) + + @chk ccall( + (:SNESLineSearchSetFunction, $petsc_library), + PetscErrorCode, + (SNESLineSearch, external), + linesearch, func, + ) + + + return nothing +end + +""" + SNESLineSearchSetPreCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, func::external, ctx::Cvoid) +Sets a function that is called after the initial search direction has been computed but +before the line search routine has been applied. Allows adjusting the result of (usually a linear solve) that +determined the search direction. + +Logically Collective + +Input Parameters: +- `linesearch` - the `SNESLineSearch` context +- `func` - [optional] function evaluation routine +- `ctx` - [optional] user-defined context for private data for the function evaluation routine (may be `NULL`) + +Calling sequence of `func`: +- `ls` - the `SNESLineSearch` context +- `x` - the current solution +- `d` - the current search direction +- `changed_d` - indicates if the search direction has been changed +- `ctx` - the context passed to `SNESLineSearchSetPreCheck()` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESGetLineSearch()`, `SNESLineSearchPreCheck()`, `SNESLineSearchSetPostCheck()`, `SNESLineSearchGetPostCheck()`, `SNESLineSearchGetPreCheck()`, +`SNESVISetVariableBounds()`, `SNESVISetComputeVariableBounds()`, `SNESSetFunctionDomainError()`, `SNESSetJacobianDomainError()` + + +# External Links +$(_doc_external("SNES/SNESLineSearchSetPreCheck")) +""" +function SNESLineSearchSetPreCheck(petsclib::PetscLibType, linesearch::SNESLineSearch, func::external, ctx::Cvoid) end + +@for_petsc function SNESLineSearchSetPreCheck(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, func::external, ctx::Cvoid ) + + @chk ccall( + (:SNESLineSearchSetPreCheck, $petsc_library), + PetscErrorCode, + (SNESLineSearch, external, Ptr{Cvoid}), + linesearch, func, ctx, + ) + + + return nothing +end + +""" + SNESLineSearchSetPostCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, func::external, ctx::Cvoid) +Sets a user function that is called after the line search has been applied to determine the step +direction and length. Allows the user a chance to change or override the decision of the line search routine + +Logically Collective + +Input Parameters: +- `linesearch` - the `SNESLineSearch` context +- `func` - [optional] function evaluation routine +- `ctx` - [optional] user-defined context for private data for the function evaluation routine (may be `NULL`) + +Calling sequence of `func`: +- `ls` - the `SNESLineSearch` context +- `x` - the current solution +- `d` - the current search direction +- `w` - w = x + lambda*d for some lambda +- `changed_d` - indicates if the search direction `d` has been changed +- `changed_w` - indicates `w` has been changed +- `ctx` - the context passed to `SNESLineSearchSetPreCheck()` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchPostCheck()`, `SNESLineSearchSetPreCheck()`, `SNESLineSearchGetPreCheck()`, `SNESLineSearchGetPostCheck()`, +`SNESVISetVariableBounds()`, `SNESVISetComputeVariableBounds()`, `SNESSetFunctionDomainError()`, `SNESSetJacobianDomainError()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetPostCheck")) +""" +function SNESLineSearchSetPostCheck(petsclib::PetscLibType, linesearch::SNESLineSearch, func::external, ctx::Cvoid) end + +@for_petsc function SNESLineSearchSetPostCheck(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, func::external, ctx::Cvoid ) + + @chk ccall( + (:SNESLineSearchSetPostCheck, $petsc_library), + PetscErrorCode, + (SNESLineSearch, external, Ptr{Cvoid}), + linesearch, func, ctx, + ) + + + return nothing +end + +""" + changed::PetscBool = SNESLineSearchPreCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec) +Prepares the line search for being applied. + +Logically Collective + +Input Parameters: +- `linesearch` - The linesearch instance. +- `X` - The current solution +- `Y` - The step direction + +Output Parameter: +- `changed` - Indicator that the precheck routine has changed `Y` + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchPostCheck()`, `SNESLineSearchSetPreCheck()`, `SNESLineSearchGetPreCheck()`, `SNESLineSearchSetPostCheck()`, +`SNESLineSearchGetPostCheck()` + +# External Links +$(_doc_external("SNES/SNESLineSearchPreCheck")) +""" +function SNESLineSearchPreCheck(petsclib::PetscLibType, linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec) end + +@for_petsc function SNESLineSearchPreCheck(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec ) + changed_ = Ref{PetscBool}() + + @chk ccall( + (:SNESLineSearchPreCheck, $petsc_library), + PetscErrorCode, + (SNESLineSearch, CVec, CVec, Ptr{PetscBool}), + linesearch, X, Y, changed_, + ) + + changed = changed_[] + + return changed +end + +""" + changed_Y::PetscBool,changed_W::PetscBool = SNESLineSearchPostCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec, W::PetscVec) +Hook to modify step direction or updated solution after a successful linesearch + +Logically Collective + +Input Parameters: +- `linesearch` - The line search context +- `X` - The last solution +- `Y` - The step direction +- `W` - The updated solution, `W = X - lambda * Y` for some lambda + +Output Parameters: +- `changed_Y` - Indicator if the direction `Y` has been changed. +- `changed_W` - Indicator if the new candidate solution `W` has been changed. + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESGetLineSearch()`, `SNESLineSearchPreCheck()`, `SNESLineSearchSetPostCheck()`, `SNESLineSearchGetPostCheck()`, `SNESLineSearchSetPrecheck()`, `SNESLineSearchGetPrecheck()` + +# External Links +$(_doc_external("SNES/SNESLineSearchPostCheck")) +""" +function SNESLineSearchPostCheck(petsclib::PetscLibType, linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec, W::PetscVec) end + +@for_petsc function SNESLineSearchPostCheck(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec, W::PetscVec ) + changed_Y_ = Ref{PetscBool}() + changed_W_ = Ref{PetscBool}() + + @chk ccall( + (:SNESLineSearchPostCheck, $petsc_library), + PetscErrorCode, + (SNESLineSearch, CVec, CVec, CVec, Ptr{PetscBool}, Ptr{PetscBool}), + linesearch, X, Y, W, changed_Y_, changed_W_, + ) + + changed_Y = changed_Y_[] + changed_W = changed_W_[] + + return changed_Y,changed_W +end + +""" + changed::PetscBool = SNESLineSearchPreCheckPicard(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec, ctx::Cvoid) +Implements a correction that is sometimes useful to improve the convergence rate of Picard iteration {cite}`hindmarsh1996time` + +Logically Collective + +Input Parameters: +- `linesearch` - the line search context +- `X` - base state for this step +- `ctx` - context for this function + +Input/Output Parameter: +- `Y` - correction, possibly modified + +Output Parameter: +- `changed` - flag indicating that `Y` was modified + +Options Database Keys: +- `-snes_linesearch_precheck_picard` - activate this routine +- `-snes_linesearch_precheck_picard_angle` - angle + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESSetPicard()`, `SNESGetLineSearch()`, `SNESLineSearchSetPreCheck()`, `SNESLineSearchSetPostCheck()` + +# External Links +$(_doc_external("SNES/SNESLineSearchPreCheckPicard")) +""" +function SNESLineSearchPreCheckPicard(petsclib::PetscLibType, linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec, ctx::Cvoid) end + +@for_petsc function SNESLineSearchPreCheckPicard(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec, ctx::Cvoid ) + changed_ = Ref{PetscBool}() + + @chk ccall( + (:SNESLineSearchPreCheckPicard, $petsc_library), + PetscErrorCode, + (SNESLineSearch, CVec, CVec, Ptr{PetscBool}, Ptr{Cvoid}), + linesearch, X, Y, changed_, ctx, + ) + + changed = changed_[] + + return changed +end + +""" + fnorm::PetscReal = SNESLineSearchApply(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec) +Computes the line + +Collective + +Input Parameter: +- `linesearch` - The line search context + +Input/Output Parameters: +- `X` - The current solution, on output the new solution +- `F` - The current function value, on output the new function value at the solution value `X` +- `fnorm` - The current norm of `F`, on output the new norm of `F` +- `Y` - The current search direction, on output the direction determined by the linesearch, i.e. `Xnew = Xold - lambda*Y` + +Options Database Keys: +- `-snes_linesearch_type` - basic (or equivalently none), bt, secant, cp, nleqerr, bisection, shell +- `-snes_linesearch_monitor [:filename]` - Print progress of line searches +- `-snes_linesearch_damping` - The linesearch damping parameter, default is 1.0 (no damping) +- `-snes_linesearch_norms` - Turn on/off the linesearch norms computation (SNESLineSearchSetComputeNorms()) +- `-snes_linesearch_keeplambda` - Keep the previous `lambda` as the initial guess +- `-snes_linesearch_max_it` - The number of iterations for iterative line searches + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchCreate()`, `SNESLineSearchGetLambda()`, `SNESLineSearchPreCheck()`, `SNESLineSearchPostCheck()`, `SNESSolve()`, `SNESComputeFunction()`, `SNESLineSearchSetComputeNorms()`, +`SNESLineSearchType`, `SNESLineSearchSetType()` + +# External Links +$(_doc_external("SNES/SNESLineSearchApply")) +""" +function SNESLineSearchApply(petsclib::PetscLibType, linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec) end + +@for_petsc function SNESLineSearchApply(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec ) + fnorm_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESLineSearchApply, $petsc_library), + PetscErrorCode, + (SNESLineSearch, CVec, CVec, Ptr{$PetscReal}, CVec), + linesearch, X, F, fnorm_, Y, + ) + + fnorm = fnorm_[] + + return fnorm +end + +""" + SNESLineSearchDestroy(petsclib::PetscLibType,linesearch::SNESLineSearch) +Destroys the line search instance. + +Collective + +Input Parameter: +- `linesearch` - The line search context + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchCreate()`, `SNESLineSearchReset()`, `SNESDestroy()` + +# External Links +$(_doc_external("SNES/SNESLineSearchDestroy")) +""" +function SNESLineSearchDestroy(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchDestroy(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + + @chk ccall( + (:SNESLineSearchDestroy, $petsc_library), + PetscErrorCode, + (Ptr{SNESLineSearch},), + linesearch, + ) + + + return nothing +end + +""" + SNESLineSearchSetDefaultMonitor(petsclib::PetscLibType,linesearch::SNESLineSearch, viewer::PetscViewer) +Turns on/off printing useful information and debugging output about the line search. + +Logically Collective + +Input Parameters: +- `linesearch` - the linesearch object +- `viewer` - an `PETSCVIEWERASCII` `PetscViewer` or `NULL` to turn off monitor + +Options Database Key: +- `-snes_linesearch_monitor [:filename]` - enables the monitor + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `PETSCVIEWERASCII`, `SNESGetLineSearch()`, `SNESLineSearchGetDefaultMonitor()`, `PetscViewer`, `SNESLineSearchSetMonitor()`, +`SNESLineSearchMonitorSetFromOptions()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetDefaultMonitor")) +""" +function SNESLineSearchSetDefaultMonitor(petsclib::PetscLibType, linesearch::SNESLineSearch, viewer::PetscViewer) end + +@for_petsc function SNESLineSearchSetDefaultMonitor(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, viewer::PetscViewer ) + + @chk ccall( + (:SNESLineSearchSetDefaultMonitor, $petsc_library), + PetscErrorCode, + (SNESLineSearch, PetscViewer), + linesearch, viewer, + ) + + + return nothing +end + +""" + SNESLineSearchGetDefaultMonitor(petsclib::PetscLibType,linesearch::SNESLineSearch, monitor::PetscViewer) +Gets the `PetscViewer` instance for the default line search monitor that is turned on with `SNESLineSearchSetDefaultMonitor()` + +Logically Collective + +Input Parameter: +- `linesearch` - the line search context + +Output Parameter: +- `monitor` - monitor context + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchSetDefaultMonitor()`, `PetscViewer` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetDefaultMonitor")) +""" +function SNESLineSearchGetDefaultMonitor(petsclib::PetscLibType, linesearch::SNESLineSearch, monitor::PetscViewer) end + +@for_petsc function SNESLineSearchGetDefaultMonitor(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, monitor::PetscViewer ) + + @chk ccall( + (:SNESLineSearchGetDefaultMonitor, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{PetscViewer}), + linesearch, monitor, + ) + + + return nothing +end + +""" + SNESLineSearchMonitorSetFromOptions(petsclib::PetscLibType,ls::SNESLineSearch, name::String, help::String, manual::String, monitor::external, monitorsetup::external) +Sets a monitor function and viewer appropriate for the type indicated in the options database + +Collective + +Input Parameters: +- `ls` - `SNESLineSearch` object to monitor +- `name` - the monitor type +- `help` - message indicating what monitoring is done +- `manual` - manual page for the monitor +- `monitor` - the monitor function, must use `PetscViewerAndFormat` as its context +- `monitorsetup` - a function that is called once ONLY if the user selected this monitor that may set additional features of the `SNESLineSearch` or `PetscViewer` + +Calling sequence of `monitor`: +- `ls` - `SNESLineSearch` object being monitored +- `vf` - a `PetscViewerAndFormat` struct that provides the `PetscViewer` and `PetscViewerFormat` being used + +Calling sequence of `monitorsetup`: +- `ls` - `SNESLineSearch` object being monitored +- `vf` - a `PetscViewerAndFormat` struct that provides the `PetscViewer` and `PetscViewerFormat` being used + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchSetMonitor()`, `PetscOptionsCreateViewer()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, +`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` +`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("SNES/SNESLineSearchMonitorSetFromOptions")) +""" +function SNESLineSearchMonitorSetFromOptions(petsclib::PetscLibType, ls::SNESLineSearch, name::String, help::String, manual::String, monitor::external, monitorsetup::external) end + +@for_petsc function SNESLineSearchMonitorSetFromOptions(petsclib::$UnionPetscLib, ls::SNESLineSearch, name::String, help::String, manual::String, monitor::external, monitorsetup::external ) + + @chk ccall( + (:SNESLineSearchMonitorSetFromOptions, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, external, external), + ls, name, help, manual, monitor, monitorsetup, + ) + + + return nothing +end + +""" + SNESLineSearchSetFromOptions(petsclib::PetscLibType,linesearch::SNESLineSearch) +Sets options for the line search + +Logically Collective + +Input Parameter: +- `linesearch` - a `SNESLineSearch` line search context + +Options Database Keys: +- `-snes_linesearch_type ` - basic (or equivalently none), `bt`, `secant`, `cp`, `nleqerr`, `bisection`, `shell` +- `-snes_linesearch_order ` - 1, 2, 3. Most types only support certain orders (`bt` supports 1, 2 or 3) +- `-snes_linesearch_norms` - Turn on/off the linesearch norms for the basic linesearch typem (`SNESLineSearchSetComputeNorms()`) +- `-snes_linesearch_minlambda` - The minimum `lambda` +- `-snes_linesearch_maxlambda` - The maximum `lambda` +- `-snes_linesearch_rtol` - Relative tolerance for iterative line searches +- `-snes_linesearch_atol` - Absolute tolerance for iterative line searches +- `-snes_linesearch_ltol` - Change in `lambda` tolerance for iterative line searches +- `-snes_linesearch_max_it` - The number of iterations for iterative line searches +- `-snes_linesearch_monitor [:filename]` - Print progress of line searches +- `-snes_linesearch_monitor_solution_update [viewer:filename:format]` - view each update tried by line search routine +- `-snes_linesearch_damping` - The linesearch damping parameter +- `-snes_linesearch_keeplambda` - Keep the previous `lambda` as the initial guess. +- `-snes_linesearch_precheck_picard` - Use precheck that speeds up convergence of picard method +- `-snes_linesearch_precheck_picard_angle` - Angle used in Picard precheck method + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESLineSearchCreate()`, `SNESLineSearchSetOrder()`, `SNESLineSearchSetType()`, `SNESLineSearchSetTolerances()`, `SNESLineSearchSetDamping()`, `SNESLineSearchPreCheckPicard()`, +`SNESLineSearchType`, `SNESLineSearchSetComputeNorms()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetFromOptions")) +""" +function SNESLineSearchSetFromOptions(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchSetFromOptions(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + + @chk ccall( + (:SNESLineSearchSetFromOptions, $petsc_library), + PetscErrorCode, + (SNESLineSearch,), + linesearch, + ) + + + return nothing +end + +""" + SNESLineSearchView(petsclib::PetscLibType,linesearch::SNESLineSearch, viewer::PetscViewer) +Prints useful information about the line search + +Logically Collective + +Input Parameters: +- `linesearch` - line search context +- `viewer` - the `PetscViewer` to display the line search information to + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `PetscViewer`, `SNESLineSearchCreate()` + +# External Links +$(_doc_external("SNES/SNESLineSearchView")) +""" +function SNESLineSearchView(petsclib::PetscLibType, linesearch::SNESLineSearch, viewer::PetscViewer) end + +@for_petsc function SNESLineSearchView(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, viewer::PetscViewer ) + + @chk ccall( + (:SNESLineSearchView, $petsc_library), + PetscErrorCode, + (SNESLineSearch, PetscViewer), + linesearch, viewer, + ) + + + return nothing +end + +""" + type::SNESLineSearchType = SNESLineSearchGetType(petsclib::PetscLibType,linesearch::SNESLineSearch) +Gets the `SNESLinesearchType` of a `SNESLineSearch` + +Logically Collective + +Input Parameter: +- `linesearch` - the line search context + +Output Parameter: +- `type` - The type of line search, or `NULL` if not set + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchType`, `SNESLineSearchCreate()`, `SNESLineSearchSetFromOptions()`, `SNESLineSearchSetType()` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetType")) +""" +function SNESLineSearchGetType(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchGetType(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + type_ = Ref{SNESLineSearchType}() + + @chk ccall( + (:SNESLineSearchGetType, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{SNESLineSearchType}), + linesearch, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + SNESLineSearchSetType(petsclib::PetscLibType,linesearch::SNESLineSearch, type::SNESLineSearchType) +Sets the `SNESLinesearchType` of a `SNESLineSearch` object to indicate the line search algorithm that should be used by a given `SNES` solver + +Logically Collective + +Input Parameters: +- `linesearch` - the line search context +- `type` - The type of line search to be used, see `SNESLineSearchType` + +Options Database Key: +- `-snes_linesearch_type ` - basic (or equivalently none), bt, secant, cp, nleqerr, bisection, shell + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchType`, `SNESLineSearchCreate()`, `SNESLineSearchSetFromOptions()`, `SNESLineSearchGetType()`, +`SNESGetLineSearch()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetType")) +""" +function SNESLineSearchSetType(petsclib::PetscLibType, linesearch::SNESLineSearch, type::SNESLineSearchType) end + +@for_petsc function SNESLineSearchSetType(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, type::SNESLineSearchType ) + + @chk ccall( + (:SNESLineSearchSetType, $petsc_library), + PetscErrorCode, + (SNESLineSearch, SNESLineSearchType), + linesearch, type, + ) + + + return nothing +end + +""" + SNESLineSearchSetSNES(petsclib::PetscLibType,linesearch::SNESLineSearch, snes::PetscSNES) +Sets the `SNES` for the linesearch for function evaluation. + +Input Parameters: +- `linesearch` - the line search context +- `snes` - The `SNES` instance + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchGetSNES()`, `SNESLineSearchSetVecs()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetSNES")) +""" +function SNESLineSearchSetSNES(petsclib::PetscLibType, linesearch::SNESLineSearch, snes::PetscSNES) end + +@for_petsc function SNESLineSearchSetSNES(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, snes::PetscSNES ) + + @chk ccall( + (:SNESLineSearchSetSNES, $petsc_library), + PetscErrorCode, + (SNESLineSearch, CSNES), + linesearch, snes, + ) + + + return nothing +end + +""" + SNESLineSearchGetSNES(petsclib::PetscLibType,linesearch::SNESLineSearch, snes::PetscSNES) +Gets the `SNES` instance associated with the line search. + +Not Collective + +Input Parameter: +- `linesearch` - the line search context + +Output Parameter: +- `snes` - The `SNES` instance + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESType`, `SNESLineSearchSetVecs()` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetSNES")) +""" +function SNESLineSearchGetSNES(petsclib::PetscLibType, linesearch::SNESLineSearch, snes::PetscSNES) end + +@for_petsc function SNESLineSearchGetSNES(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, snes::PetscSNES ) + snes_ = Ref(snes.ptr) + + @chk ccall( + (:SNESLineSearchGetSNES, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{CSNES}), + linesearch, snes_, + ) + + snes.ptr = C_NULL + + return nothing +end + +""" + lambda::PetscReal = SNESLineSearchGetLambda(petsclib::PetscLibType,linesearch::SNESLineSearch) +Gets the last line search `lambda` used + +Not Collective + +Input Parameter: +- `linesearch` - the line search context + +Output Parameter: +- `lambda` - The last `lambda` (scaling of the solution update) computed during `SNESLineSearchApply()` + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchSetLambda()`, `SNESLineSearchGetDamping()`, `SNESLineSearchApply()` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetLambda")) +""" +function SNESLineSearchGetLambda(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchGetLambda(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + lambda_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESLineSearchGetLambda, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{$PetscReal}), + linesearch, lambda_, + ) + + lambda = lambda_[] + + return lambda +end + +""" + SNESLineSearchSetLambda(petsclib::PetscLibType,linesearch::SNESLineSearch, lambda::PetscReal) +Sets the line search `lambda` (scaling of the solution update) + +Input Parameters: +- `linesearch` - line search context +- `lambda` - The `lambda` to use + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchGetLambda()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetLambda")) +""" +function SNESLineSearchSetLambda(petsclib::PetscLibType, linesearch::SNESLineSearch, lambda::PetscReal) end + +@for_petsc function SNESLineSearchSetLambda(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, lambda::$PetscReal ) + + @chk ccall( + (:SNESLineSearchSetLambda, $petsc_library), + PetscErrorCode, + (SNESLineSearch, $PetscReal), + linesearch, lambda, + ) + + + return nothing +end + +""" + minlambda::PetscReal,maxlambda::PetscReal,rtol::PetscReal,atol::PetscReal,ltol::PetscReal,max_it::PetscInt = SNESLineSearchGetTolerances(petsclib::PetscLibType,linesearch::SNESLineSearch) +Gets the tolerances for the line search. + +Not Collective + +Input Parameter: +- `linesearch` - the line search context + +Output Parameters: +- `minlambda` - The minimum `lambda` allowed +- `maxlambda` - The maximum `lambda` allowed +- `rtol` - The relative tolerance for iterative line searches +- `atol` - The absolute tolerance for iterative line searches +- `ltol` - The change in `lambda` tolerance for iterative line searches +- `max_it` - The maximum number of iterations of the line search + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchSetTolerances()` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetTolerances")) +""" +function SNESLineSearchGetTolerances(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchGetTolerances(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + minlambda_ = Ref{$PetscReal}() + maxlambda_ = Ref{$PetscReal}() + rtol_ = Ref{$PetscReal}() + atol_ = Ref{$PetscReal}() + ltol_ = Ref{$PetscReal}() + max_it_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESLineSearchGetTolerances, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscInt}), + linesearch, minlambda_, maxlambda_, rtol_, atol_, ltol_, max_it_, + ) + + minlambda = minlambda_[] + maxlambda = maxlambda_[] + rtol = rtol_[] + atol = atol_[] + ltol = ltol_[] + max_it = max_it_[] + + return minlambda,maxlambda,rtol,atol,ltol,max_it +end + +""" + SNESLineSearchSetTolerances(petsclib::PetscLibType,linesearch::SNESLineSearch, minlambda::PetscReal, maxlambda::PetscReal, rtol::PetscReal, atol::PetscReal, ltol::PetscReal, max_it::PetscInt) +Sets the tolerances for the linesearch. + +Collective + +Input Parameters: +- `linesearch` - the line search context +- `minlambda` - The minimum `lambda` allowed +- `maxlambda` - The maximum `lambda` allowed +- `rtol` - The relative tolerance for iterative line searches +- `atol` - The absolute tolerance for iterative line searches +- `ltol` - The change in `lambda` tolerance for iterative line searches +- `max_it` - The maximum number of iterations of the line search + +Options Database Keys: +- `-snes_linesearch_minlambda` - The minimum `lambda` allowed +- `-snes_linesearch_maxlambda` - The maximum `lambda` allowed +- `-snes_linesearch_rtol` - Relative tolerance for iterative line searches +- `-snes_linesearch_atol` - Absolute tolerance for iterative line searches +- `-snes_linesearch_ltol` - Change in `lambda` tolerance for iterative line searches +- `-snes_linesearch_max_it` - The number of iterations for iterative line searches + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchGetTolerances()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetTolerances")) +""" +function SNESLineSearchSetTolerances(petsclib::PetscLibType, linesearch::SNESLineSearch, minlambda::PetscReal, maxlambda::PetscReal, rtol::PetscReal, atol::PetscReal, ltol::PetscReal, max_it::PetscInt) end + +@for_petsc function SNESLineSearchSetTolerances(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, minlambda::$PetscReal, maxlambda::$PetscReal, rtol::$PetscReal, atol::$PetscReal, ltol::$PetscReal, max_it::$PetscInt ) + + @chk ccall( + (:SNESLineSearchSetTolerances, $petsc_library), + PetscErrorCode, + (SNESLineSearch, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscInt), + linesearch, minlambda, maxlambda, rtol, atol, ltol, max_it, + ) + + + return nothing +end + +""" + damping::PetscReal = SNESLineSearchGetDamping(petsclib::PetscLibType,linesearch::SNESLineSearch) +Gets the line search damping parameter. + +Input Parameter: +- `linesearch` - the line search context + +Output Parameter: +- `damping` - The damping parameter + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearchGetStepTolerance()`, `SNESQN` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetDamping")) +""" +function SNESLineSearchGetDamping(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchGetDamping(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + damping_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESLineSearchGetDamping, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{$PetscReal}), + linesearch, damping_, + ) + + damping = damping_[] + + return damping +end + +""" + SNESLineSearchSetDamping(petsclib::PetscLibType,linesearch::SNESLineSearch, damping::PetscReal) +Sets the line search damping parameter. + +Input Parameters: +- `linesearch` - the line search context +- `damping` - The damping parameter + +Options Database Key: +- `-snes_linesearch_damping ` - the damping value + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchGetDamping()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetDamping")) +""" +function SNESLineSearchSetDamping(petsclib::PetscLibType, linesearch::SNESLineSearch, damping::PetscReal) end + +@for_petsc function SNESLineSearchSetDamping(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, damping::$PetscReal ) + + @chk ccall( + (:SNESLineSearchSetDamping, $petsc_library), + PetscErrorCode, + (SNESLineSearch, $PetscReal), + linesearch, damping, + ) + + + return nothing +end + +""" + order::PetscInt = SNESLineSearchGetOrder(petsclib::PetscLibType,linesearch::SNESLineSearch) +Gets the line search approximation order. + +Input Parameter: +- `linesearch` - the line search context + +Output Parameter: +- `order` - The order + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchSetOrder()` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetOrder")) +""" +function SNESLineSearchGetOrder(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchGetOrder(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + order_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESLineSearchGetOrder, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{$PetscInt}), + linesearch, order_, + ) + + order = order_[] + + return order +end + +""" + SNESLineSearchSetOrder(petsclib::PetscLibType,linesearch::SNESLineSearch, order::PetscInt) +Sets the maximum order of the polynomial fit used in the line search + +Input Parameters: +- `linesearch` - the line search context +- `order` - The order + +Level: intermediate + +Values for `order`: +- `1 or `SNES_LINESEARCH_ORDER_LINEAR` - linear order +- `2 or `SNES_LINESEARCH_ORDER_QUADRATIC` - quadratic order +- `3 or `SNES_LINESEARCH_ORDER_CUBIC` - cubic order + +Options Database Key: +- `-snes_linesearch_order ` - 1, 2, 3. Most types only support certain orders (`SNESLINESEARCHBT` supports 2 or 3) + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchGetOrder()`, `SNESLineSearchSetDamping()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetOrder")) +""" +function SNESLineSearchSetOrder(petsclib::PetscLibType, linesearch::SNESLineSearch, order::PetscInt) end + +@for_petsc function SNESLineSearchSetOrder(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, order::$PetscInt ) + + @chk ccall( + (:SNESLineSearchSetOrder, $petsc_library), + PetscErrorCode, + (SNESLineSearch, $PetscInt), + linesearch, order, + ) + + + return nothing +end + +""" + xnorm::PetscReal,fnorm::PetscReal,ynorm::PetscReal = SNESLineSearchGetNorms(petsclib::PetscLibType,linesearch::SNESLineSearch) +Gets the norms for the current solution `X`, the current update `Y`, and the current function value `F`. + +Not Collective + +Input Parameter: +- `linesearch` - the line search context + +Output Parameters: +- `xnorm` - The norm of the current solution +- `fnorm` - The norm of the current function, this is the `norm(function(X))` where `X` is the current solution. +- `ynorm` - The norm of the current update (after scaling by the linesearch computed `lambda`) + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchSetNorms()`, `SNESLineSearchGetVecs()` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetNorms")) +""" +function SNESLineSearchGetNorms(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchGetNorms(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + xnorm_ = Ref{$PetscReal}() + fnorm_ = Ref{$PetscReal}() + ynorm_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESLineSearchGetNorms, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + linesearch, xnorm_, fnorm_, ynorm_, + ) + + xnorm = xnorm_[] + fnorm = fnorm_[] + ynorm = ynorm_[] + + return xnorm,fnorm,ynorm +end + +""" + SNESLineSearchSetNorms(petsclib::PetscLibType,linesearch::SNESLineSearch, xnorm::PetscReal, fnorm::PetscReal, ynorm::PetscReal) +Sets the computed norms for the current solution `X`, the current update `Y`, and the current function value `F`. + +Collective + +Input Parameters: +- `linesearch` - the line search context +- `xnorm` - The norm of the current solution +- `fnorm` - The norm of the current function, this is the `norm(function(X))` where `X` is the current solution +- `ynorm` - The norm of the current update (after scaling by the linesearch computed `lambda`) + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchGetNorms()`, `SNESLineSearchSetVecs()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetNorms")) +""" +function SNESLineSearchSetNorms(petsclib::PetscLibType, linesearch::SNESLineSearch, xnorm::PetscReal, fnorm::PetscReal, ynorm::PetscReal) end + +@for_petsc function SNESLineSearchSetNorms(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, xnorm::$PetscReal, fnorm::$PetscReal, ynorm::$PetscReal ) + + @chk ccall( + (:SNESLineSearchSetNorms, $petsc_library), + PetscErrorCode, + (SNESLineSearch, $PetscReal, $PetscReal, $PetscReal), + linesearch, xnorm, fnorm, ynorm, + ) + + + return nothing +end + +""" + SNESLineSearchComputeNorms(petsclib::PetscLibType,linesearch::SNESLineSearch) +Explicitly computes the norms of the current solution `X`, the current update `Y`, and the current function value `F`. + +Input Parameter: +- `linesearch` - the line search context + +Options Database Key: +- `-snes_linesearch_norms` - turn norm computation on or off + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchGetNorms`, `SNESLineSearchSetNorms()`, `SNESLineSearchSetComputeNorms()` + +# External Links +$(_doc_external("SNES/SNESLineSearchComputeNorms")) +""" +function SNESLineSearchComputeNorms(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchComputeNorms(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + + @chk ccall( + (:SNESLineSearchComputeNorms, $petsc_library), + PetscErrorCode, + (SNESLineSearch,), + linesearch, + ) + + + return nothing +end + +""" + SNESLineSearchSetComputeNorms(petsclib::PetscLibType,linesearch::SNESLineSearch, flg::PetscBool) +Turns on or off the computation of final norms in the line search. + +Input Parameters: +- `linesearch` - the line search context +- `flg` - indicates whether or not to compute norms + +Options Database Key: +- `-snes_linesearch_norms ` - Turns on/off computation of the norms for basic (none) `SNESLINESEARCHBASIC` line search + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchGetNorms()`, `SNESLineSearchSetNorms()`, `SNESLineSearchComputeNorms()`, `SNESLINESEARCHBASIC` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetComputeNorms")) +""" +function SNESLineSearchSetComputeNorms(petsclib::PetscLibType, linesearch::SNESLineSearch, flg::PetscBool) end + +@for_petsc function SNESLineSearchSetComputeNorms(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, flg::PetscBool ) + + @chk ccall( + (:SNESLineSearchSetComputeNorms, $petsc_library), + PetscErrorCode, + (SNESLineSearch, PetscBool), + linesearch, flg, + ) + + + return nothing +end + +""" + SNESLineSearchGetVecs(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec, W::PetscVec, G::PetscVec) +Gets the vectors from the `SNESLineSearch` context + +Not Collective but the vectors are parallel + +Input Parameter: +- `linesearch` - the line search context + +Output Parameters: +- `X` - Solution vector +- `F` - Function vector +- `Y` - Search direction vector +- `W` - Solution work vector +- `G` - Function work vector + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchGetNorms()`, `SNESLineSearchSetVecs()` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetVecs")) +""" +function SNESLineSearchGetVecs(petsclib::PetscLibType, linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec, W::PetscVec, G::PetscVec) end + +@for_petsc function SNESLineSearchGetVecs(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec, W::PetscVec, G::PetscVec ) + X_ = Ref(X.ptr) + F_ = Ref(F.ptr) + Y_ = Ref(Y.ptr) + W_ = Ref(W.ptr) + G_ = Ref(G.ptr) + + @chk ccall( + (:SNESLineSearchGetVecs, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{CVec}, Ptr{CVec}, Ptr{CVec}, Ptr{CVec}, Ptr{CVec}), + linesearch, X_, F_, Y_, W_, G_, + ) + + X.ptr = C_NULL + F.ptr = C_NULL + Y.ptr = C_NULL + W.ptr = C_NULL + G.ptr = C_NULL + + return nothing +end + +""" + SNESLineSearchSetVecs(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec, W::PetscVec, G::PetscVec) +Sets the vectors on the `SNESLineSearch` context + +Logically Collective + +Input Parameters: +- `linesearch` - the line search context +- `X` - Solution vector +- `F` - Function vector +- `Y` - Search direction vector +- `W` - Solution work vector +- `G` - Function work vector + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchSetNorms()`, `SNESLineSearchGetVecs()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetVecs")) +""" +function SNESLineSearchSetVecs(petsclib::PetscLibType, linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec, W::PetscVec, G::PetscVec) end + +@for_petsc function SNESLineSearchSetVecs(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec, W::PetscVec, G::PetscVec ) + + @chk ccall( + (:SNESLineSearchSetVecs, $petsc_library), + PetscErrorCode, + (SNESLineSearch, CVec, CVec, CVec, CVec, CVec), + linesearch, X, F, Y, W, G, + ) + + + return nothing +end + +""" + SNESLineSearchAppendOptionsPrefix(petsclib::PetscLibType,linesearch::SNESLineSearch, prefix::String) +Appends to the prefix used for searching for all +`SNESLineSearch` options in the database. + +Logically Collective + +Input Parameters: +- `linesearch` - the `SNESLineSearch` context +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch()`, `SNESLineSearchSetFromOptions()`, `SNESGetOptionsPrefix()` + +# External Links +$(_doc_external("SNES/SNESLineSearchAppendOptionsPrefix")) +""" +function SNESLineSearchAppendOptionsPrefix(petsclib::PetscLibType, linesearch::SNESLineSearch, prefix::String) end + +@for_petsc function SNESLineSearchAppendOptionsPrefix(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, prefix::String ) + + @chk ccall( + (:SNESLineSearchAppendOptionsPrefix, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{Cchar}), + linesearch, prefix, + ) + + + return nothing +end + +""" + SNESLineSearchGetOptionsPrefix(petsclib::PetscLibType,linesearch::SNESLineSearch, prefix::String) +Gets the prefix used for searching for all +SNESLineSearch options in the database. + +Not Collective + +Input Parameter: +- `linesearch` - the `SNESLineSearch` context + +Output Parameter: +- `prefix` - pointer to the prefix string used + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESAppendOptionsPrefix()` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetOptionsPrefix")) +""" +function SNESLineSearchGetOptionsPrefix(petsclib::PetscLibType, linesearch::SNESLineSearch, prefix::String) end + +@for_petsc function SNESLineSearchGetOptionsPrefix(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, prefix::String ) + prefix_ = Ref(pointer(prefix)) + + @chk ccall( + (:SNESLineSearchGetOptionsPrefix, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{Ptr{Cchar}}), + linesearch, prefix_, + ) + + + return nothing +end + +""" + SNESLineSearchSetWorkVecs(petsclib::PetscLibType,linesearch::SNESLineSearch, nwork::PetscInt) +Sets work vectors for the line search. + +Input Parameters: +- `linesearch` - the `SNESLineSearch` context +- `nwork` - the number of work vectors + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESSetWorkVecs()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetWorkVecs")) +""" +function SNESLineSearchSetWorkVecs(petsclib::PetscLibType, linesearch::SNESLineSearch, nwork::PetscInt) end + +@for_petsc function SNESLineSearchSetWorkVecs(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, nwork::$PetscInt ) + + @chk ccall( + (:SNESLineSearchSetWorkVecs, $petsc_library), + PetscErrorCode, + (SNESLineSearch, $PetscInt), + linesearch, nwork, + ) + + + return nothing +end + +""" + SNESLineSearchGetReason(petsclib::PetscLibType,linesearch::SNESLineSearch, result::SNESLineSearchReason) +Gets the success/failure status of the last line search application + +Input Parameter: +- `linesearch` - the line search context + +Output Parameter: +- `result` - The success or failure status + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchSetReason()`, `SNESLineSearchReason` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetReason")) +""" +function SNESLineSearchGetReason(petsclib::PetscLibType, linesearch::SNESLineSearch, result::SNESLineSearchReason) end + +@for_petsc function SNESLineSearchGetReason(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, result::SNESLineSearchReason ) + + @chk ccall( + (:SNESLineSearchGetReason, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{SNESLineSearchReason}), + linesearch, result, + ) + + + return nothing +end + +""" + SNESLineSearchSetReason(petsclib::PetscLibType,linesearch::SNESLineSearch, result::SNESLineSearchReason) +Sets the success/failure status of the line search application + +Logically Collective; No Fortran Support + +Input Parameters: +- `linesearch` - the line search context +- `result` - The success or failure status + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchReason`, `SNESLineSearchGetSResult()` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetReason")) +""" +function SNESLineSearchSetReason(petsclib::PetscLibType, linesearch::SNESLineSearch, result::SNESLineSearchReason) end + +@for_petsc function SNESLineSearchSetReason(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, result::SNESLineSearchReason ) + + @chk ccall( + (:SNESLineSearchSetReason, $petsc_library), + PetscErrorCode, + (SNESLineSearch, SNESLineSearchReason), + linesearch, result, + ) + + + return nothing +end + +""" + SNESLineSearchSetVIFunctions(petsclib::PetscLibType,linesearch::SNESLineSearch, projectfunc::SNESLineSearchVIProjectFn, normfunc::SNESLineSearchVINormFn, dirderivfunc::SNESLineSearchVIDirDerivFn) +Sets VI + +Logically Collective + +Input Parameters: +- `linesearch` - the linesearch object +- `projectfunc` - function for projecting the function to the bounds, see `SNESLineSearchVIProjectFn` for calling sequence +- `normfunc` - function for computing the norm of an active set, see `SNESLineSearchVINormFn` for calling sequence +- `dirderivfunc` - function for computing the directional derivative of an active set, see `SNESLineSearchVIDirDerivFn` for calling sequence + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchGetVIFunctions()`, `SNESLineSearchSetPostCheck()`, `SNESLineSearchSetPreCheck()`, +`SNESLineSearchVIProjectFn`, `SNESLineSearchVINormFn`, `SNESLineSearchVIDirDerivFn` + +# External Links +$(_doc_external("SNES/SNESLineSearchSetVIFunctions")) +""" +function SNESLineSearchSetVIFunctions(petsclib::PetscLibType, linesearch::SNESLineSearch, projectfunc::SNESLineSearchVIProjectFn, normfunc::SNESLineSearchVINormFn, dirderivfunc::SNESLineSearchVIDirDerivFn) end + +@for_petsc function SNESLineSearchSetVIFunctions(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, projectfunc::SNESLineSearchVIProjectFn, normfunc::SNESLineSearchVINormFn, dirderivfunc::SNESLineSearchVIDirDerivFn ) + + @chk ccall( + (:SNESLineSearchSetVIFunctions, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{SNESLineSearchVIProjectFn}, Ptr{SNESLineSearchVINormFn}, Ptr{SNESLineSearchVIDirDerivFn}), + linesearch, projectfunc, normfunc, dirderivfunc, + ) + + + return nothing +end + +""" + SNESLineSearchGetVIFunctions(petsclib::PetscLibType,linesearch::SNESLineSearch, projectfunc::SNESLineSearchVIProjectFn, normfunc::SNESLineSearchVINormFn, dirderivfunc::SNESLineSearchVIDirDerivFn) +Sets VI + +Not Collective + +Input Parameter: +- `linesearch` - the line search context, obtain with `SNESGetLineSearch()` + +Output Parameters: +- `projectfunc` - function for projecting the function to the bounds, see `SNESLineSearchVIProjectFn` for calling sequence +- `normfunc` - function for computing the norm of an active set, see `SNESLineSearchVINormFn ` for calling sequence +- `dirderivfunc` - function for computing the directional derivative of an active set, see `SNESLineSearchVIDirDerivFn` for calling sequence + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchSetVIFunctions()`, `SNESLineSearchGetPostCheck()`, `SNESLineSearchGetPreCheck()`, +`SNESLineSearchVIProjectFn`, `SNESLineSearchVINormFn` + +# External Links +$(_doc_external("SNES/SNESLineSearchGetVIFunctions")) +""" +function SNESLineSearchGetVIFunctions(petsclib::PetscLibType, linesearch::SNESLineSearch, projectfunc::SNESLineSearchVIProjectFn, normfunc::SNESLineSearchVINormFn, dirderivfunc::SNESLineSearchVIDirDerivFn) end + +@for_petsc function SNESLineSearchGetVIFunctions(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, projectfunc::SNESLineSearchVIProjectFn, normfunc::SNESLineSearchVINormFn, dirderivfunc::SNESLineSearchVIDirDerivFn ) + + @chk ccall( + (:SNESLineSearchGetVIFunctions, $petsc_library), + PetscErrorCode, + (SNESLineSearch, SNESLineSearchVIProjectFn, SNESLineSearchVINormFn, SNESLineSearchVIDirDerivFn), + linesearch, projectfunc, normfunc, dirderivfunc, + ) + + + return nothing +end + +""" + SNESLineSearchRegister(petsclib::PetscLibType,sname::String, fnc::external) +register a line search type `SNESLineSearchType` + +Logically Collective, No Fortran Support + +Input Parameters: +- `sname` - name of the `SNESLineSearchType()` +- `function` - the creation function for that type + +Calling sequence of `function`: +- `ls` - the line search context + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESLineSearchType`, `SNESLineSearchSetType()` + +# External Links +$(_doc_external("SNES/SNESLineSearchRegister")) +""" +function SNESLineSearchRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function SNESLineSearchRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:SNESLineSearchRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + SNESLineSearchShellSetApply(petsclib::PetscLibType,linesearch::SNESLineSearch, func::SNESLineSearchShellApplyFn, ctx::Cvoid) +Sets the apply function for the `SNESLINESEARCHSHELL` implementation. + +Not Collective + +Input Parameters: +- `linesearch` - `SNESLineSearch` context +- `func` - function implementing the linesearch shell, see `SNESLineSearchShellApplyFn` for calling sequence +- `ctx` - context for func + +Usage: +-seealso: [](ch_snes), `SNESLineSearchShellGetApply()`, `SNESLINESEARCHSHELL`, `SNESLineSearchType`, `SNESLineSearch`, +`SNESLineSearchShellApplyFn` + +# External Links +$(_doc_external("SNES/SNESLineSearchShellSetApply")) +""" +function SNESLineSearchShellSetApply(petsclib::PetscLibType, linesearch::SNESLineSearch, func::SNESLineSearchShellApplyFn, ctx::Cvoid) end + +@for_petsc function SNESLineSearchShellSetApply(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, func::SNESLineSearchShellApplyFn, ctx::Cvoid ) + + @chk ccall( + (:SNESLineSearchShellSetApply, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{SNESLineSearchShellApplyFn}, Ptr{Cvoid}), + linesearch, func, ctx, + ) + + + return nothing +end + +""" + SNESLineSearchShellGetApply(petsclib::PetscLibType,linesearch::SNESLineSearch, func::SNESLineSearchShellApplyFn, ctx::Cvoid) +Gets the apply function and context for the `SNESLINESEARCHSHELL` + +Not Collective + +Input Parameter: +- `linesearch` - the line search object + +Output Parameters: +- `func` - the user function; can be `NULL` if it is not needed, see `SNESLineSearchShellApplyFn` for calling sequence +- `ctx` - the user function context; can be `NULL` if it is not needed + +Level: advanced + +-seealso: [](ch_snes), `SNESLineSearchShellSetApply()`, `SNESLINESEARCHSHELL`, `SNESLineSearchType`, `SNESLineSearch`, +`SNESLineSearchShellApplyFn` + +# External Links +$(_doc_external("SNES/SNESLineSearchShellGetApply")) +""" +function SNESLineSearchShellGetApply(petsclib::PetscLibType, linesearch::SNESLineSearch, func::SNESLineSearchShellApplyFn, ctx::Cvoid) end + +@for_petsc function SNESLineSearchShellGetApply(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, func::SNESLineSearchShellApplyFn, ctx::Cvoid ) + + @chk ccall( + (:SNESLineSearchShellGetApply, $petsc_library), + PetscErrorCode, + (SNESLineSearch, SNESLineSearchShellApplyFn, Cvoid), + linesearch, func, ctx, + ) + + + return nothing +end + +""" + SNESLineSearchBTSetAlpha(petsclib::PetscLibType,linesearch::SNESLineSearch, alpha::PetscReal) +Sets the descent parameter, `alpha`, in the `SNESLINESEARCHBT` `SNESLineSearch` variant. + +Input Parameters: +- `linesearch` - linesearch context +- `alpha` - The descent parameter + +Level: intermediate + +-seealso: [](ch_snes), `SNESLineSearch`, `SNESLineSearchSetLambda()`, `SNESLineSearchGetTolerances()`, `SNESLINESEARCHBT`, `SNESLineSearchBTGetAlpha()` + +# External Links +$(_doc_external("SNES/SNESLineSearchBTSetAlpha")) +""" +function SNESLineSearchBTSetAlpha(petsclib::PetscLibType, linesearch::SNESLineSearch, alpha::PetscReal) end + +@for_petsc function SNESLineSearchBTSetAlpha(petsclib::$UnionPetscLib, linesearch::SNESLineSearch, alpha::$PetscReal ) + + @chk ccall( + (:SNESLineSearchBTSetAlpha, $petsc_library), + PetscErrorCode, + (SNESLineSearch, $PetscReal), + linesearch, alpha, + ) + + + return nothing +end + +""" + alpha::PetscReal = SNESLineSearchBTGetAlpha(petsclib::PetscLibType,linesearch::SNESLineSearch) +Gets the descent parameter, `alpha`, in the `SNESLINESEARCHBT` variant that was set with `SNESLineSearchBTSetAlpha()` + +Input Parameter: +- `linesearch` - linesearch context + +Output Parameter: +- `alpha` - The descent parameter + +Level: intermediate + +-seealso: [](ch_snes), `SNESLineSearch`, `SNESLineSearchGetLambda()`, `SNESLineSearchGetTolerances()`, `SNESLINESEARCHBT`, `SNESLineSearchBTSetAlpha()` + +# External Links +$(_doc_external("SNES/SNESLineSearchBTGetAlpha")) +""" +function SNESLineSearchBTGetAlpha(petsclib::PetscLibType, linesearch::SNESLineSearch) end + +@for_petsc function SNESLineSearchBTGetAlpha(petsclib::$UnionPetscLib, linesearch::SNESLineSearch ) + alpha_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESLineSearchBTGetAlpha, $petsc_library), + PetscErrorCode, + (SNESLineSearch, Ptr{$PetscReal}), + linesearch, alpha_, + ) + + alpha = alpha_[] + + return alpha +end + diff --git a/src/autowrapped/SNES_wrappers.jl b/src/autowrapped/SNES_wrappers.jl new file mode 100644 index 00000000..1f3d04cd --- /dev/null +++ b/src/autowrapped/SNES_wrappers.jl @@ -0,0 +1,9863 @@ +# autodefined type arguments for class ------ +mutable struct SNESFunctionFn end + +mutable struct SNESNGSFn end + +mutable struct SNESJacobianFn end + +mutable struct SNESInitialGuessFn end + +mutable struct SNESUpdateFn end + +mutable struct _n_SNESLineSearch end +const SNESLineSearch = Ptr{_n_SNESLineSearch} + +mutable struct SNESObjectiveFn end + +# ------------------------------------------------------- +""" + SNESMonitorSolution(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) +Monitors progress of a `SNES` `SNESSolve()` by calling +`VecView()` for the approximate solution at each iteration. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `its` - iteration number +- `fgnorm` - 2-norm of residual +- `vf` - a viewer + +Options Database Key: +- `-snes_monitor_solution [ascii binary draw][:filename][:viewer format]` - plots solution at each iteration + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESMonitorSet()`, `SNESMonitorDefault()`, `VecView()` + +# External Links +$(_doc_external("SNES/SNESMonitorSolution")) +""" +function SNESMonitorSolution(petsclib::PetscLibType, snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorSolution(petsclib::$UnionPetscLib, snes::PetscSNES, its::$PetscInt, fgnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorSolution, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, its, fgnorm, vf, + ) + + + return nothing +end + +""" + SNESMonitorResidual(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) +Monitors progress of a `SNESSolve()` by calling +`VecView()` for the residual at each iteration. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `its` - iteration number +- `fgnorm` - 2-norm of residual +- `vf` - a viewer + +Options Database Key: +- `-snes_monitor_residual [ascii binary draw][:filename][:viewer format]` - plots residual (not its norm) at each iteration + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESMonitorSet()`, `SNESMonitorDefault()`, `VecView()`, `SNESMonitor()` + +# External Links +$(_doc_external("SNES/SNESMonitorResidual")) +""" +function SNESMonitorResidual(petsclib::PetscLibType, snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorResidual(petsclib::$UnionPetscLib, snes::PetscSNES, its::$PetscInt, fgnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorResidual, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, its, fgnorm, vf, + ) + + + return nothing +end + +""" + SNESMonitorSolutionUpdate(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) +Monitors progress of a `SNESSolve()` by calling +`VecView()` for the UPDATE to the solution at each iteration. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `its` - iteration number +- `fgnorm` - 2-norm of residual +- `vf` - a viewer + +Options Database Key: +- `-snes_monitor_solution_update [ascii binary draw][:filename][:viewer format]` - plots update to solution at each iteration + +Level: intermediate + +-seealso: [](ch_snes), `SNESMonitorSet()`, `SNESMonitorDefault()`, `VecView()`, `SNESMonitor()` + +# External Links +$(_doc_external("SNES/SNESMonitorSolutionUpdate")) +""" +function SNESMonitorSolutionUpdate(petsclib::PetscLibType, snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorSolutionUpdate(petsclib::$UnionPetscLib, snes::PetscSNES, its::$PetscInt, fgnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorSolutionUpdate, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, its, fgnorm, vf, + ) + + + return nothing +end + +""" + SNESMonitorDefaultSetUp(petsclib::PetscLibType,snes::PetscSNES, vf::PetscViewerAndFormat) + +# External Links +$(_doc_external("SNES/SNESMonitorDefaultSetUp")) +""" +function SNESMonitorDefaultSetUp(petsclib::PetscLibType, snes::PetscSNES, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorDefaultSetUp(petsclib::$UnionPetscLib, snes::PetscSNES, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorDefaultSetUp, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscViewerAndFormat}), + snes, vf, + ) + + + return nothing +end + +""" + SNESMonitorDefault(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) +Monitors progress of a `SNESSolve()` (default). + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `its` - iteration number +- `fgnorm` - 2-norm of residual +- `vf` - viewer and format structure + +Options Database Key: +- `-snes_monitor` - use this function to monitor the convergence of the nonlinear solver + +Level: intermediate + +-seealso: [](ch_snes), `SNESMonitorSet()`, `SNESMonitorSolution()`, `SNESMonitorFunction()`, `SNESMonitorResidual()`, +`SNESMonitorSolutionUpdate()`, `SNESMonitorScaling()`, `SNESMonitorRange()`, `SNESMonitorRatio()`, +`SNESMonitorDefaultField()`, `PetscViewerFormat`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("SNES/SNESMonitorDefault")) +""" +function SNESMonitorDefault(petsclib::PetscLibType, snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorDefault(petsclib::$UnionPetscLib, snes::PetscSNES, its::$PetscInt, fgnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorDefault, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, its, fgnorm, vf, + ) + + + return nothing +end + +""" + SNESMonitorScaling(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) +Monitors the largest value in each row of the Jacobian of a `SNESSolve()` + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `its` - iteration number +- `fgnorm` - 2-norm of residual +- `vf` - viewer and format structure + +Level: intermediate + +-seealso: [](ch_snes), `SNESMonitorSet()`, `SNESMonitorSolution()`, `SNESMonitorRange()`, `SNESMonitorJacUpdateSpectrum()`, +`PetscViewerFormat`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("SNES/SNESMonitorScaling")) +""" +function SNESMonitorScaling(petsclib::PetscLibType, snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorScaling(petsclib::$UnionPetscLib, snes::PetscSNES, its::$PetscInt, fgnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorScaling, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, its, fgnorm, vf, + ) + + + return nothing +end + +""" + SNESMonitorJacUpdateSpectrum(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, fnorm::PetscReal, vf::PetscViewerAndFormat) +Monitors the spectrun of the change in the Jacobian from the last Jacobian evaluation of a `SNESSolve()` + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `it` - iteration number +- `fnorm` - 2-norm of residual +- `vf` - viewer and format structure + +Options Database Key: +- `-snes_monitor_jacupdate_spectrum` - activates this monitor + +Level: intermediate + +-seealso: [](ch_snes), `SNESMonitorSet()`, `SNESMonitorSolution()`, `SNESMonitorRange()`, `PetscViewerFormat`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("SNES/SNESMonitorJacUpdateSpectrum")) +""" +function SNESMonitorJacUpdateSpectrum(petsclib::PetscLibType, snes::PetscSNES, it::PetscInt, fnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorJacUpdateSpectrum(petsclib::$UnionPetscLib, snes::PetscSNES, it::$PetscInt, fnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorJacUpdateSpectrum, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, it, fnorm, vf, + ) + + + return nothing +end + +""" + SNESMonitorRange(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) +Prints the percentage of residual elements that are more than 10 percent of the maximum entry in the residual in each iteration of a `SNESSolve()` + +Collective + +Input Parameters: +- `snes` - `SNES` iterative context +- `it` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `vf` - unused monitor context + +Options Database Key: +- `-snes_monitor_range` - Activates `SNESMonitorRange()` + +Level: intermediate + +-seealso: [](ch_snes), `SNESMonitorSet()`, `SNESMonitorDefault()`, `SNESMonitorLGCreate()`, `SNESMonitorScaling()`, `PetscViewerFormat`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("SNES/SNESMonitorRange")) +""" +function SNESMonitorRange(petsclib::PetscLibType, snes::PetscSNES, it::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorRange(petsclib::$UnionPetscLib, snes::PetscSNES, it::$PetscInt, rnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorRange, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, it, rnorm, vf, + ) + + + return nothing +end + +""" + SNESMonitorRatio(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) +Monitors progress of a `SNESSolve()` by printing the ratio of residual norm at each iteration to the previous. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `its` - iteration number +- `fgnorm` - 2-norm of residual (or gradient) +- `vf` - context of monitor + +Options Database Key: +- `-snes_monitor_ratio` - activate this monitor + +Level: intermediate + +-seealso: [](ch_snes), `SNESMonitorRationSetUp()`, `SNESMonitorSet()`, `SNESMonitorSolution()`, `SNESMonitorDefault()`, `PetscViewerFormat`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("SNES/SNESMonitorRatio")) +""" +function SNESMonitorRatio(petsclib::PetscLibType, snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorRatio(petsclib::$UnionPetscLib, snes::PetscSNES, its::$PetscInt, fgnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorRatio, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, its, fgnorm, vf, + ) + + + return nothing +end + +""" + SNESMonitorRatioSetUp(petsclib::PetscLibType,snes::PetscSNES, vf::PetscViewerAndFormat) +Insures the `SNES` object is saving its history since this monitor needs access to it + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `vf` - `PetscViewerAndFormat` (ignored) + +Level: intermediate + +-seealso: [](ch_snes), `SNESMonitorSet()`, `SNESMonitorSolution()`, `SNESMonitorDefault()`, `SNESMonitorRatio()`, `PetscViewerFormat`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("SNES/SNESMonitorRatioSetUp")) +""" +function SNESMonitorRatioSetUp(petsclib::PetscLibType, snes::PetscSNES, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorRatioSetUp(petsclib::$UnionPetscLib, snes::PetscSNES, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorRatioSetUp, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscViewerAndFormat}), + snes, vf, + ) + + + return nothing +end + +""" + SNESMonitorDefaultShort(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) + +# External Links +$(_doc_external("SNES/SNESMonitorDefaultShort")) +""" +function SNESMonitorDefaultShort(petsclib::PetscLibType, snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorDefaultShort(petsclib::$UnionPetscLib, snes::PetscSNES, its::$PetscInt, fgnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorDefaultShort, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, its, fgnorm, vf, + ) + + + return nothing +end + +""" + SNESMonitorDefaultField(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) +Monitors progress of a `SNESSolve()`, separated into fields. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `its` - iteration number +- `fgnorm` - 2-norm of residual +- `vf` - the PetscViewer + +Options Database Key: +- `-snes_monitor_field` - activate this monitor + +Level: intermediate + +-seealso: [](ch_snes), `SNESMonitorSet()`, `SNESMonitorSolution()`, `SNESMonitorDefault()`, `PetscViewerFormat`, `PetscViewerAndFormat` + +# External Links +$(_doc_external("SNES/SNESMonitorDefaultField")) +""" +function SNESMonitorDefaultField(petsclib::PetscLibType, snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorDefaultField(petsclib::$UnionPetscLib, snes::PetscSNES, its::$PetscInt, fgnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorDefaultField, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, its, fgnorm, vf, + ) + + + return nothing +end + +""" + SNESConvergedDefault(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal, reason::SNESConvergedReason, dummy::Cvoid) +Default convergence test for `SNESSolve()`. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `it` - the iteration (0 indicates before any Newton steps) +- `xnorm` - 2-norm of current iterate +- `snorm` - 2-norm of current step +- `fnorm` - 2-norm of function at current iterate +- `dummy` - unused context + +Output Parameter: +- `reason` - converged reason, see `SNESConvergedReason` + +Options Database Keys: +- `-snes_convergence_test default` - see `SNESSetFromOptions()` +- `-snes_stol` - convergence tolerance in terms of the norm of the change in the solution between steps +- `-snes_atol ` - absolute tolerance of residual norm +- `-snes_rtol ` - relative decrease in tolerance norm from the initial 2-norm of the solution +- `-snes_divergence_tolerance ` - if the residual goes above divtol*rnorm0, exit with divergence +- `-snes_max_funcs ` - maximum number of function evaluations, use `unlimited` for no maximum +- `-snes_max_fail ` - maximum number of line search failures allowed before stopping, default is none +- `-snes_max_linear_solve_fail` - number of linear solver failures before `SNESSolve()` stops + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESSetConvergenceTest()`, `SNESConvergedSkip()`, `SNESSetTolerances()`, `SNESSetDivergenceTolerance()`, +`SNESConvergedReason` + +# External Links +$(_doc_external("SNES/SNESConvergedDefault")) +""" +function SNESConvergedDefault(petsclib::PetscLibType, snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal, reason::SNESConvergedReason, dummy::Cvoid) end + +@for_petsc function SNESConvergedDefault(petsclib::$UnionPetscLib, snes::PetscSNES, it::$PetscInt, xnorm::$PetscReal, snorm::$PetscReal, fnorm::$PetscReal, reason::SNESConvergedReason, dummy::Cvoid ) + + @chk ccall( + (:SNESConvergedDefault, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, $PetscReal, $PetscReal, Ptr{SNESConvergedReason}, Ptr{Cvoid}), + snes, it, xnorm, snorm, fnorm, reason, dummy, + ) + + + return nothing +end + +""" + SNESConvergedSkip(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal, reason::SNESConvergedReason, dummy::Cvoid) +Convergence test for `SNES` that NEVER returns as +converged, UNLESS the maximum number of iteration have been reached. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `it` - the iteration (0 indicates before any Newton steps) +- `xnorm` - 2-norm of current iterate +- `snorm` - 2-norm of current step +- `fnorm` - 2-norm of function at current iterate +- `dummy` - unused context + +Output Parameter: +- `reason` - `SNES_CONVERGED_ITERATING`, `SNES_CONVERGED_ITS`, or `SNES_DIVERGED_FNORM_NAN` + +Options Database Key: +- `-snes_convergence_test skip` - see `SNESSetFromOptions()` + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESConvergedDefault()`, `SNESSetConvergenceTest()`, `SNESConvergedReason` + +# External Links +$(_doc_external("SNES/SNESConvergedSkip")) +""" +function SNESConvergedSkip(petsclib::PetscLibType, snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal, reason::SNESConvergedReason, dummy::Cvoid) end + +@for_petsc function SNESConvergedSkip(petsclib::$UnionPetscLib, snes::PetscSNES, it::$PetscInt, xnorm::$PetscReal, snorm::$PetscReal, fnorm::$PetscReal, reason::SNESConvergedReason, dummy::Cvoid ) + + @chk ccall( + (:SNESConvergedSkip, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, $PetscReal, $PetscReal, Ptr{SNESConvergedReason}, Ptr{Cvoid}), + snes, it, xnorm, snorm, fnorm, reason, dummy, + ) + + + return nothing +end + +""" + SNESSetWorkVecs(petsclib::PetscLibType,snes::PetscSNES, nw::PetscInt) +Allocates a number of work vectors to be used internally by the `SNES` solver + +Input Parameters: +- `snes` - the `SNES` context +- `nw` - number of work vectors to allocate + +Level: developer + +-seealso: [](ch_snes), `SNES` + +# External Links +$(_doc_external("SNES/SNESSetWorkVecs")) +""" +function SNESSetWorkVecs(petsclib::PetscLibType, snes::PetscSNES, nw::PetscInt) end + +@for_petsc function SNESSetWorkVecs(petsclib::$UnionPetscLib, snes::PetscSNES, nw::$PetscInt ) + + @chk ccall( + (:SNESSetWorkVecs, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, nw, + ) + + + return nothing +end + +""" + SNESFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the PETSc interface to the `SNES` package. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: [](ch_snes), `SNES`, `PetscFinalize()` + +# External Links +$(_doc_external("SNES/SNESFinalizePackage")) +""" +function SNESFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function SNESFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:SNESFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + SNESInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `SNES` package. It is called +from PetscDLLibraryRegister_petscsnes() when using dynamic libraries, and on the first call to `SNESCreate()` +when using shared or static libraries. + +Level: developer + +-seealso: [](ch_snes), `SNES`, `PetscInitialize()` + +# External Links +$(_doc_external("SNES/SNESInitializePackage")) +""" +function SNESInitializePackage(petsclib::PetscLibType) end + +@for_petsc function SNESInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:SNESInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + SNESSetErrorIfNotConverged(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool) +Causes `SNESSolve()` to generate an error immediately if the solver has not converged. + +Logically Collective + +Input Parameters: +- `snes` - iterative context obtained from `SNESCreate()` +- `flg` - `PETSC_TRUE` indicates you want the error generated + +Options Database Key: +- `-snes_error_if_not_converged ` - cause an immediate error condition and stop the program if the solver does not converge + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESGetErrorIfNotConverged()`, `KSPGetErrorIfNotConverged()`, `KSPSetErrorIfNotConverged()` + +# External Links +$(_doc_external("SNES/SNESSetErrorIfNotConverged")) +""" +function SNESSetErrorIfNotConverged(petsclib::PetscLibType, snes::PetscSNES, flg::PetscBool) end + +@for_petsc function SNESSetErrorIfNotConverged(petsclib::$UnionPetscLib, snes::PetscSNES, flg::PetscBool ) + + @chk ccall( + (:SNESSetErrorIfNotConverged, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, flg, + ) + + + return nothing +end + +""" + flag::PetscBool = SNESGetErrorIfNotConverged(petsclib::PetscLibType,snes::PetscSNES) +Indicates if `SNESSolve()` will generate an error if the solver does not converge? + +Not Collective + +Input Parameter: +- `snes` - iterative context obtained from `SNESCreate()` + +Output Parameter: +- `flag` - `PETSC_TRUE` if it will generate an error, else `PETSC_FALSE` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESSetErrorIfNotConverged()`, `KSPGetErrorIfNotConverged()`, `KSPSetErrorIfNotConverged()` + +# External Links +$(_doc_external("SNES/SNESGetErrorIfNotConverged")) +""" +function SNESGetErrorIfNotConverged(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetErrorIfNotConverged(petsclib::$UnionPetscLib, snes::PetscSNES ) + flag_ = Ref{PetscBool}() + + @chk ccall( + (:SNESGetErrorIfNotConverged, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, flag_, + ) + + flag = flag_[] + + return flag +end + +""" + SNESSetAlwaysComputesFinalResidual(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool) +tells the `SNES` to always compute the residual (nonlinear function value) at the final solution + +Logically Collective + +Input Parameters: +- `snes` - the shell `SNES` +- `flg` - `PETSC_TRUE` to always compute the residual + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESSolve()`, `SNESGetAlwaysComputesFinalResidual()` + +# External Links +$(_doc_external("SNES/SNESSetAlwaysComputesFinalResidual")) +""" +function SNESSetAlwaysComputesFinalResidual(petsclib::PetscLibType, snes::PetscSNES, flg::PetscBool) end + +@for_petsc function SNESSetAlwaysComputesFinalResidual(petsclib::$UnionPetscLib, snes::PetscSNES, flg::PetscBool ) + + @chk ccall( + (:SNESSetAlwaysComputesFinalResidual, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = SNESGetAlwaysComputesFinalResidual(petsclib::PetscLibType,snes::PetscSNES) +checks if the `SNES` always computes the residual at the final solution + +Logically Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `flg` - `PETSC_TRUE` if the residual is computed + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESSolve()`, `SNESSetAlwaysComputesFinalResidual()` + +# External Links +$(_doc_external("SNES/SNESGetAlwaysComputesFinalResidual")) +""" +function SNESGetAlwaysComputesFinalResidual(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetAlwaysComputesFinalResidual(petsclib::$UnionPetscLib, snes::PetscSNES ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:SNESGetAlwaysComputesFinalResidual, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + SNESSetFunctionDomainError(petsclib::PetscLibType,snes::PetscSNES) +tells `SNES` that the input vector, a proposed new solution, to your function you provided to `SNESSetFunction()` is not +in the functions domain. For example, a step with negative pressure. + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Level: advanced + +-seealso: [](ch_snes), `SNESCreate()`, `SNESSetFunction()`, `SNESFunctionFn`, `SNESSetJacobianDomainError()`, `SNESVISetVariableBounds()`, +`SNESVISetComputeVariableBounds()`, `SNESLineSearchSetPreCheck()`, `SNESLineSearchSetPostCheck()`, `SNESConvergedReason`, `SNESGetConvergedReason()`, +`SNES_DIVERGED_FUNCTION_DOMAIN` + +# External Links +$(_doc_external("SNES/SNESSetFunctionDomainError")) +""" +function SNESSetFunctionDomainError(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESSetFunctionDomainError(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESSetFunctionDomainError, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESSetJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES) +tells `SNES` that the function you provided to `SNESSetJacobian()` at the proposed step. For example there is a negative element transformation. + +Logically Collective + +Input Parameter: +- `snes` - the `SNES` context + +Level: advanced + +-seealso: [](ch_snes), `SNESCreate()`, `SNESSetFunction()`, `SNESFunctionFn`, `SNESSetFunctionDomainError()`, `SNESVISetVariableBounds()`, +`SNESVISetComputeVariableBounds()`, `SNESLineSearchSetPreCheck()`, `SNESLineSearchSetPostCheck()`, `SNESConvergedReason`, `SNESGetConvergedReason()` + +# External Links +$(_doc_external("SNES/SNESSetJacobianDomainError")) +""" +function SNESSetJacobianDomainError(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESSetJacobianDomainError(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESSetJacobianDomainError, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESSetCheckJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool) +tells `SNESSolve()` whether to check if the user called `SNESSetJacobianDomainError()` Jacobian domain error after +each Jacobian evaluation. By default, it checks for the Jacobian domain error in the debug mode, and does not check it in the optimized mode. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `flg` - indicates if or not to check Jacobian domain error after each Jacobian evaluation + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESConvergedReason`, `SNESCreate()`, `SNESSetFunction()`, `SNESFunctionFn`, `SNESSetFunctionDomainError()`, `SNESGetCheckJacobianDomainError()` + +# External Links +$(_doc_external("SNES/SNESSetCheckJacobianDomainError")) +""" +function SNESSetCheckJacobianDomainError(petsclib::PetscLibType, snes::PetscSNES, flg::PetscBool) end + +@for_petsc function SNESSetCheckJacobianDomainError(petsclib::$UnionPetscLib, snes::PetscSNES, flg::PetscBool ) + + @chk ccall( + (:SNESSetCheckJacobianDomainError, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = SNESGetCheckJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES) +Get an indicator whether or not `SNES` is checking Jacobian domain errors after each Jacobian evaluation. + +Logically Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `flg` - `PETSC_FALSE` indicates that it is not checking Jacobian domain errors after each Jacobian evaluation + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESCreate()`, `SNESSetFunction()`, `SNESFunctionFn`, `SNESSetFunctionDomainError()`, `SNESSetCheckJacobianDomainError()` + +# External Links +$(_doc_external("SNES/SNESGetCheckJacobianDomainError")) +""" +function SNESGetCheckJacobianDomainError(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetCheckJacobianDomainError(petsclib::$UnionPetscLib, snes::PetscSNES ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:SNESGetCheckJacobianDomainError, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + domainerror::PetscBool = SNESGetFunctionDomainError(petsclib::PetscLibType,snes::PetscSNES) +Gets the status of the domain error after a call to `SNESComputeFunction()` + +Not Collective, different MPI processes may return different values + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `domainerror` - Set to `PETSC_TRUE` if there's a domain error; `PETSC_FALSE` otherwise. + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSetFunctionDomainError()`, `SNESComputeFunction()` + +# External Links +$(_doc_external("SNES/SNESGetFunctionDomainError")) +""" +function SNESGetFunctionDomainError(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetFunctionDomainError(petsclib::$UnionPetscLib, snes::PetscSNES ) + domainerror_ = Ref{PetscBool}() + + @chk ccall( + (:SNESGetFunctionDomainError, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, domainerror_, + ) + + domainerror = domainerror_[] + + return domainerror +end + +""" + domainerror::PetscBool = SNESGetJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES) +Gets the status of the Jacobian domain error after a call to `SNESComputeJacobian()` + +Not Collective, different MPI processes may return different values + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `domainerror` - Set to `PETSC_TRUE` if there's a Jacobian domain error; `PETSC_FALSE` otherwise. + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSetFunctionDomainError()`, `SNESComputeFunction()`, `SNESGetFunctionDomainError()` + +# External Links +$(_doc_external("SNES/SNESGetJacobianDomainError")) +""" +function SNESGetJacobianDomainError(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetJacobianDomainError(petsclib::$UnionPetscLib, snes::PetscSNES ) + domainerror_ = Ref{PetscBool}() + + @chk ccall( + (:SNESGetJacobianDomainError, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, domainerror_, + ) + + domainerror = domainerror_[] + + return domainerror +end + +""" + SNESLoad(petsclib::PetscLibType,snes::PetscSNES, viewer::PetscViewer) +Loads a `SNES` that has been stored in `PETSCVIEWERBINARY` with `SNESView()`. + +Collective + +Input Parameters: +- `snes` - the newly loaded `SNES`, this needs to have been created with `SNESCreate()` or +some related function before a call to `SNESLoad()`. +- `viewer` - binary file viewer, obtained from `PetscViewerBinaryOpen()` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `PetscViewer`, `SNESCreate()`, `SNESType`, `PetscViewerBinaryOpen()`, `SNESView()`, `MatLoad()`, `VecLoad()` + +# External Links +$(_doc_external("SNES/SNESLoad")) +""" +function SNESLoad(petsclib::PetscLibType, snes::PetscSNES, viewer::PetscViewer) end + +@for_petsc function SNESLoad(petsclib::$UnionPetscLib, snes::PetscSNES, viewer::PetscViewer ) + + @chk ccall( + (:SNESLoad, $petsc_library), + PetscErrorCode, + (CSNES, PetscViewer), + snes, viewer, + ) + + + return nothing +end + +""" + SNESViewFromOptions(petsclib::PetscLibType,A::PetscSNES, obj::PetscObject, name::String) +View a `SNES` based on values in the options database + +Collective + +Input Parameters: +- `A` - the `SNES` context +- `obj` - Optional object that provides the options prefix for the checks +- `name` - command line option + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESView`, `PetscObjectViewFromOptions()`, `SNESCreate()` + +# External Links +$(_doc_external("SNES/SNESViewFromOptions")) +""" +function SNESViewFromOptions(petsclib::PetscLibType, A::PetscSNES, obj::PetscObject, name::String) end + +@for_petsc function SNESViewFromOptions(petsclib::$UnionPetscLib, A::PetscSNES, obj::PetscObject, name::String ) + + @chk ccall( + (:SNESViewFromOptions, $petsc_library), + PetscErrorCode, + (CSNES, PetscObject, Ptr{Cchar}), + A, obj, name, + ) + + + return nothing +end + +""" + SNESView(petsclib::PetscLibType,snes::PetscSNES, viewer::PetscViewer) +Prints or visualizes the `SNES` data structure. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `viewer` - the `PetscViewer` + +Options Database Key: +- `-snes_view` - Calls `SNESView()` at end of `SNESSolve()` + +Level: beginner + +-seealso: [](ch_snes), `SNES`, `SNESLoad()`, `SNESCreate()`, `PetscViewerASCIIOpen()` + +# External Links +$(_doc_external("SNES/SNESView")) +""" +function SNESView(petsclib::PetscLibType, snes::PetscSNES, viewer::PetscViewer) end + +@for_petsc function SNESView(petsclib::$UnionPetscLib, snes::PetscSNES, viewer::PetscViewer ) + + @chk ccall( + (:SNESView, $petsc_library), + PetscErrorCode, + (CSNES, PetscViewer), + snes, viewer, + ) + + + return nothing +end + +""" + SNESAddOptionsChecker(petsclib::PetscLibType,snescheck::external) +Adds an additional function to check for `SNES` options. + +Not Collective + +Input Parameter: +- `snescheck` - function that checks for options + +Calling sequence of `snescheck`: +- `snes` - the `SNES` object for which it is checking options + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSetFromOptions()` + +# External Links +$(_doc_external("SNES/SNESAddOptionsChecker")) +""" +function SNESAddOptionsChecker(petsclib::PetscLibType, snescheck::external) end + +@for_petsc function SNESAddOptionsChecker(petsclib::$UnionPetscLib, snescheck::external ) + + @chk ccall( + (:SNESAddOptionsChecker, $petsc_library), + PetscErrorCode, + (external,), + snescheck, + ) + + + return nothing +end + +""" + SNESSetUpMatrices(petsclib::PetscLibType,snes::PetscSNES) +ensures that matrices are available for `SNES` Newton + +Collective + +Input Parameter: +- `snes` - `SNES` object to configure + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSetUp()` + +# External Links +$(_doc_external("SNES/SNESSetUpMatrices")) +""" +function SNESSetUpMatrices(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESSetUpMatrices(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESSetUpMatrices, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESMonitorSetFromOptions(petsclib::PetscLibType,snes::PetscSNES, name::String, help::String, manual::String, monitor::external, monitorsetup::external) +Sets a monitor function and viewer appropriate for the type indicated by the user + +Collective + +Input Parameters: +- `snes` - `SNES` object you wish to monitor +- `name` - the monitor type one is seeking +- `help` - message indicating what monitoring is done +- `manual` - manual page for the monitor +- `monitor` - the monitor function, this must use a `PetscViewerFormat` as its context +- `monitorsetup` - a function that is called once ONLY if the user selected this monitor that may set additional features of the `SNES` or `PetscViewer` objects + +Calling sequence of `monitor`: +- `snes` - the nonlinear solver context +- `it` - the current iteration +- `r` - the current function norm +- `vf` - a `PetscViewerAndFormat` struct that contains the `PetscViewer` and `PetscViewerFormat` to use + +Calling sequence of `monitorsetup`: +- `snes` - the nonlinear solver context +- `vf` - a `PetscViewerAndFormat` struct that contains the `PetscViewer` and `PetscViewerFormat` to use + +Options Database Key: +- `-name` - trigger the use of this monitor in `SNESSetFromOptions()` + +Level: advanced + +-seealso: [](ch_snes), `PetscOptionsCreateViewer()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, +`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` +`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, +`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, +`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, +`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, +`PetscOptionsFList()`, `PetscOptionsEList()` + +# External Links +$(_doc_external("SNES/SNESMonitorSetFromOptions")) +""" +function SNESMonitorSetFromOptions(petsclib::PetscLibType, snes::PetscSNES, name::String, help::String, manual::String, monitor::external, monitorsetup::external) end + +@for_petsc function SNESMonitorSetFromOptions(petsclib::$UnionPetscLib, snes::PetscSNES, name::String, help::String, manual::String, monitor::external, monitorsetup::external ) + + @chk ccall( + (:SNESMonitorSetFromOptions, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, external, external), + snes, name, help, manual, monitor, monitorsetup, + ) + + + return nothing +end + +""" + SNESSetFromOptions(petsclib::PetscLibType,snes::PetscSNES) +Sets various `SNES` and `KSP` parameters from user options. + +Collective + +Input Parameter: +- `snes` - the `SNES` context + +Options Database Keys: +- `-snes_type ` - newtonls, newtontr, ngmres, ncg, nrichardson, qn, vi, fas, `SNESType` for complete list +- `-snes_rtol ` - relative decrease in tolerance norm from initial +- `-snes_atol ` - absolute tolerance of residual norm +- `-snes_stol ` - convergence tolerance in terms of the norm of the change in the solution between steps +- `-snes_divergence_tolerance ` - if the residual goes above divtol*rnorm0, exit with divergence +- `-snes_max_it ` - maximum number of iterations +- `-snes_max_funcs ` - maximum number of function evaluations +- `-snes_force_iteration ` - force `SNESSolve()` to take at least one iteration +- `-snes_max_fail ` - maximum number of line search failures allowed before stopping, default is none +- `-snes_max_linear_solve_fail` - number of linear solver failures before SNESSolve() stops +- `-snes_lag_preconditioner ` - how often preconditioner is rebuilt (use -1 to never rebuild) +- `-snes_lag_preconditioner_persists ` - retains the -snes_lag_preconditioner information across multiple SNESSolve() +- `-snes_lag_jacobian ` - how often Jacobian is rebuilt (use -1 to never rebuild) +- `-snes_lag_jacobian_persists ` - retains the -snes_lag_jacobian information across multiple SNESSolve() +- `-snes_convergence_test ` - convergence test in nonlinear solver. default `SNESConvergedDefault()`. skip `SNESConvergedSkip()` means continue iterating until max_it or some other criterion is reached, saving expense of convergence test. correct_pressure `SNESConvergedCorrectPressure()` has special handling of a pressure null space. +- `-snes_monitor [ascii][:filename][:viewer format]` - prints residual norm at each iteration. if no filename given prints to stdout +- `-snes_monitor_solution [ascii binary draw][:filename][:viewer format]` - plots solution at each iteration +- `-snes_monitor_residual [ascii binary draw][:filename][:viewer format]` - plots residual (not its norm) at each iteration +- `-snes_monitor_solution_update [ascii binary draw][:filename][:viewer format]` - plots update to solution at each iteration +- `-snes_monitor_lg_residualnorm` - plots residual norm at each iteration +- `-snes_monitor_lg_range` - plots residual norm at each iteration +- `-snes_monitor_pause_final` - Pauses all monitor drawing after the solver ends +- `-snes_fd` - use finite differences to compute Jacobian; very slow, only for testing +- `-snes_fd_color` - use finite differences with coloring to compute Jacobian +- `-snes_mf_ksp_monitor` - if using matrix-free multiply then print h at each `KSP` iteration +- `-snes_converged_reason` - print the reason for convergence/divergence after each solve +- `-npc_snes_type ` - the `SNES` type to use as a nonlinear preconditioner +- `-snes_test_jacobian ` - compare the user provided Jacobian with one computed via finite differences to check for errors. If a threshold is given, display only those entries whose difference is greater than the threshold. +- `-snes_test_jacobian_view` - display the user provided Jacobian, the finite difference Jacobian and the difference between them to help users detect the location of errors in the user provided Jacobian. + +Options Database Keys for Eisenstat-Walker method: +- `-snes_ksp_ew` - use Eisenstat-Walker method for determining linear system convergence +- `-snes_ksp_ew_version ver` - version of Eisenstat-Walker method +- `-snes_ksp_ew_rtol0 ` - Sets rtol0 +- `-snes_ksp_ew_rtolmax ` - Sets rtolmax +- `-snes_ksp_ew_gamma ` - Sets gamma +- `-snes_ksp_ew_alpha ` - Sets alpha +- `-snes_ksp_ew_alpha2 ` - Sets alpha2 +- `-snes_ksp_ew_threshold ` - Sets threshold + +Level: beginner + +-seealso: [](ch_snes), `SNESType`, `SNESSetOptionsPrefix()`, `SNESResetFromOptions()`, `SNES`, `SNESCreate()`, `MatCreateSNESMF()`, `MatFDColoring` + +# External Links +$(_doc_external("SNES/SNESSetFromOptions")) +""" +function SNESSetFromOptions(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESSetFromOptions(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESSetFromOptions, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESResetFromOptions(petsclib::PetscLibType,snes::PetscSNES) +Sets various `SNES` and `KSP` parameters from user options ONLY if the `SNESSetFromOptions()` was previously called + +Collective + +Input Parameter: +- `snes` - the `SNES` context + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSetFromOptions()`, `SNESSetOptionsPrefix()` + +# External Links +$(_doc_external("SNES/SNESResetFromOptions")) +""" +function SNESResetFromOptions(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESResetFromOptions(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESResetFromOptions, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESSetComputeApplicationContext(petsclib::PetscLibType,snes::PetscSNES, compute::external, destroy::PetscCtxDestroyFn) +Sets an optional function to compute a user +the nonlinear solvers. + +Logically Collective; No Fortran Support + +Input Parameters: +- `snes` - the `SNES` context +- `compute` - function to compute the context +- `destroy` - function to destroy the context, see `PetscCtxDestroyFn` for the calling sequence + +Calling sequence of `compute`: +- `snes` - the `SNES` context +- `ctx` - context to be computed + +Level: intermediate + +-seealso: [](ch_snes), `SNESGetApplicationContext()`, `SNESSetApplicationContext()`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("SNES/SNESSetComputeApplicationContext")) +""" +function SNESSetComputeApplicationContext(petsclib::PetscLibType, snes::PetscSNES, compute::external, destroy::PetscCtxDestroyFn) end + +@for_petsc function SNESSetComputeApplicationContext(petsclib::$UnionPetscLib, snes::PetscSNES, compute::external, destroy::PetscCtxDestroyFn ) + + @chk ccall( + (:SNESSetComputeApplicationContext, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{PetscCtxDestroyFn}), + snes, compute, destroy, + ) + + + return nothing +end + +""" + SNESSetApplicationContext(petsclib::PetscLibType,snes::PetscSNES, ctx::Cvoid) +Sets the optional user + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `ctx` - the user context + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSetComputeApplicationContext()`, `SNESGetApplicationContext()` + +# External Links +$(_doc_external("SNES/SNESSetApplicationContext")) +""" +function SNESSetApplicationContext(petsclib::PetscLibType, snes::PetscSNES, ctx::Cvoid) end + +@for_petsc function SNESSetApplicationContext(petsclib::$UnionPetscLib, snes::PetscSNES, ctx::Cvoid ) + + @chk ccall( + (:SNESSetApplicationContext, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Cvoid}), + snes, ctx, + ) + + + return nothing +end + +""" + SNESGetApplicationContext(petsclib::PetscLibType,snes::PetscSNES, ctx::PeCtx) +Gets the user +nonlinear solvers set with `SNESGetApplicationContext()` or `SNESSetComputeApplicationContext()` + +Not Collective + +Input Parameter: +- `snes` - `SNES` context + +Output Parameter: +- `ctx` - user context + +Level: intermediate + +-seealso: [](ch_snes), `SNESSetApplicationContext()`, `SNESSetComputeApplicationContext()` + +# External Links +$(_doc_external("SNES/SNESGetApplicationContext")) +""" +function SNESGetApplicationContext(petsclib::PetscLibType, snes::PetscSNES, ctx::PeCtx) end + +@for_petsc function SNESGetApplicationContext(petsclib::$UnionPetscLib, snes::PetscSNES, ctx::PeCtx ) + + @chk ccall( + (:SNESGetApplicationContext, $petsc_library), + PetscErrorCode, + (CSNES, PeCtx), + snes, ctx, + ) + + + return nothing +end + +""" + SNESSetUseMatrixFree(petsclib::PetscLibType,snes::PetscSNES, mf_operator::PetscBool, mf::PetscBool) +indicates that `SNES` should use matrix + +Logically Collective + +Input Parameters: +- `snes` - `SNES` context +- `mf_operator` - use matrix-free only for the Amat used by `SNESSetJacobian()`, this means the user provided Pmat will continue to be used +- `mf` - use matrix-free for both the Amat and Pmat used by `SNESSetJacobian()`, both the Amat and Pmat set in `SNESSetJacobian()` will be ignored. With +this option no matrix-element based preconditioners can be used in the linear solve since the matrix won't be explicitly available + +Options Database Keys: +- `-snes_mf_operator` - use matrix-free only for the mat operator +- `-snes_mf` - use matrix-free for both the mat and pmat operator +- `-snes_fd_color` - compute the Jacobian via coloring and finite differences. +- `-snes_fd` - compute the Jacobian via finite differences (slow) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESGetUseMatrixFree()`, `MatCreateSNESMF()`, `SNESComputeJacobianDefaultColor()`, `MatFDColoring` + +# External Links +$(_doc_external("SNES/SNESSetUseMatrixFree")) +""" +function SNESSetUseMatrixFree(petsclib::PetscLibType, snes::PetscSNES, mf_operator::PetscBool, mf::PetscBool) end + +@for_petsc function SNESSetUseMatrixFree(petsclib::$UnionPetscLib, snes::PetscSNES, mf_operator::PetscBool, mf::PetscBool ) + + @chk ccall( + (:SNESSetUseMatrixFree, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool, PetscBool), + snes, mf_operator, mf, + ) + + + return nothing +end + +""" + mf_operator::PetscBool,mf::PetscBool = SNESGetUseMatrixFree(petsclib::PetscLibType,snes::PetscSNES) +indicates if the `SNES` uses matrix + +Not Collective, but the resulting flags will be the same on all MPI processes + +Input Parameter: +- `snes` - `SNES` context + +Output Parameters: +- `mf_operator` - use matrix-free only for the Amat used by `SNESSetJacobian()`, this means the user provided Pmat will continue to be used +- `mf` - use matrix-free for both the Amat and Pmat used by `SNESSetJacobian()`, both the Amat and Pmat set in `SNESSetJacobian()` will be ignored + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSetUseMatrixFree()`, `MatCreateSNESMF()` + +# External Links +$(_doc_external("SNES/SNESGetUseMatrixFree")) +""" +function SNESGetUseMatrixFree(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetUseMatrixFree(petsclib::$UnionPetscLib, snes::PetscSNES ) + mf_operator_ = Ref{PetscBool}() + mf_ = Ref{PetscBool}() + + @chk ccall( + (:SNESGetUseMatrixFree, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}, Ptr{PetscBool}), + snes, mf_operator_, mf_, + ) + + mf_operator = mf_operator_[] + mf = mf_[] + + return mf_operator,mf +end + +""" + iter::PetscInt = SNESGetIterationNumber(petsclib::PetscLibType,snes::PetscSNES) +Gets the number of nonlinear iterations completed in the current or most recent `SNESSolve()` + +Not Collective + +Input Parameter: +- `snes` - `SNES` context + +Output Parameter: +- `iter` - iteration number + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESSetLagJacobian()`, `SNESGetLinearSolveIterations()`, `SNESSetMonitor()` + +# External Links +$(_doc_external("SNES/SNESGetIterationNumber")) +""" +function SNESGetIterationNumber(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetIterationNumber(petsclib::$UnionPetscLib, snes::PetscSNES ) + iter_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetIterationNumber, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, iter_, + ) + + iter = iter_[] + + return iter +end + +""" + SNESSetIterationNumber(petsclib::PetscLibType,snes::PetscSNES, iter::PetscInt) +Sets the current iteration number. + +Not Collective + +Input Parameters: +- `snes` - `SNES` context +- `iter` - iteration number + +Level: developer + +-seealso: [](ch_snes), `SNESGetLinearSolveIterations()` + +# External Links +$(_doc_external("SNES/SNESSetIterationNumber")) +""" +function SNESSetIterationNumber(petsclib::PetscLibType, snes::PetscSNES, iter::PetscInt) end + +@for_petsc function SNESSetIterationNumber(petsclib::$UnionPetscLib, snes::PetscSNES, iter::$PetscInt ) + + @chk ccall( + (:SNESSetIterationNumber, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, iter, + ) + + + return nothing +end + +""" + nfails::PetscInt = SNESGetNonlinearStepFailures(petsclib::PetscLibType,snes::PetscSNES) +Gets the number of unsuccessful steps +attempted by the nonlinear solver in the current or most recent `SNESSolve()` . + +Not Collective + +Input Parameter: +- `snes` - `SNES` context + +Output Parameter: +- `nfails` - number of unsuccessful steps attempted + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESGetMaxLinearSolveFailures()`, `SNESGetLinearSolveIterations()`, `SNESSetMaxLinearSolveFailures()`, `SNESGetLinearSolveFailures()`, +`SNESSetMaxNonlinearStepFailures()`, `SNESGetMaxNonlinearStepFailures()` + +# External Links +$(_doc_external("SNES/SNESGetNonlinearStepFailures")) +""" +function SNESGetNonlinearStepFailures(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetNonlinearStepFailures(petsclib::$UnionPetscLib, snes::PetscSNES ) + nfails_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetNonlinearStepFailures, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, nfails_, + ) + + nfails = nfails_[] + + return nfails +end + +""" + SNESSetMaxNonlinearStepFailures(petsclib::PetscLibType,snes::PetscSNES, maxFails::PetscInt) +Sets the maximum number of unsuccessful steps +attempted by the nonlinear solver before it gives up and returns unconverged or generates an error + +Not Collective + +Input Parameters: +- `snes` - `SNES` context +- `maxFails` - maximum of unsuccessful steps allowed, use `PETSC_UNLIMITED` to have no limit on the number of failures + +Options Database Key: +- `-snes_max_fail ` - maximum number of unsuccessful steps allowed + +Level: intermediate + +-seealso: [](ch_snes), `SNESSetErrorIfNotConverged()`, `SNESGetMaxLinearSolveFailures()`, `SNESGetLinearSolveIterations()`, `SNESSetMaxLinearSolveFailures()`, `SNESGetLinearSolveFailures()`, +`SNESGetMaxNonlinearStepFailures()`, `SNESGetNonlinearStepFailures()` + +# External Links +$(_doc_external("SNES/SNESSetMaxNonlinearStepFailures")) +""" +function SNESSetMaxNonlinearStepFailures(petsclib::PetscLibType, snes::PetscSNES, maxFails::PetscInt) end + +@for_petsc function SNESSetMaxNonlinearStepFailures(petsclib::$UnionPetscLib, snes::PetscSNES, maxFails::$PetscInt ) + + @chk ccall( + (:SNESSetMaxNonlinearStepFailures, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, maxFails, + ) + + + return nothing +end + +""" + maxFails::PetscInt = SNESGetMaxNonlinearStepFailures(petsclib::PetscLibType,snes::PetscSNES) +Gets the maximum number of unsuccessful steps +attempted by the nonlinear solver before it gives up and returns unconverged or generates an error + +Not Collective + +Input Parameter: +- `snes` - `SNES` context + +Output Parameter: +- `maxFails` - maximum of unsuccessful steps + +Level: intermediate + +-seealso: [](ch_snes), `SNESSetErrorIfNotConverged()`, `SNESGetMaxLinearSolveFailures()`, `SNESGetLinearSolveIterations()`, `SNESSetMaxLinearSolveFailures()`, `SNESGetLinearSolveFailures()`, +`SNESSetMaxNonlinearStepFailures()`, `SNESGetNonlinearStepFailures()` + +# External Links +$(_doc_external("SNES/SNESGetMaxNonlinearStepFailures")) +""" +function SNESGetMaxNonlinearStepFailures(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetMaxNonlinearStepFailures(petsclib::$UnionPetscLib, snes::PetscSNES ) + maxFails_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetMaxNonlinearStepFailures, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, maxFails_, + ) + + maxFails = maxFails_[] + + return maxFails +end + +""" + nfuncs::PetscInt = SNESGetNumberFunctionEvals(petsclib::PetscLibType,snes::PetscSNES) +Gets the number of user provided function evaluations +done by the `SNES` object in the current or most recent `SNESSolve()` + +Not Collective + +Input Parameter: +- `snes` - `SNES` context + +Output Parameter: +- `nfuncs` - number of evaluations + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESGetMaxLinearSolveFailures()`, `SNESGetLinearSolveIterations()`, `SNESSetMaxLinearSolveFailures()`, `SNESGetLinearSolveFailures()`, `SNESSetCountersReset()` + +# External Links +$(_doc_external("SNES/SNESGetNumberFunctionEvals")) +""" +function SNESGetNumberFunctionEvals(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetNumberFunctionEvals(petsclib::$UnionPetscLib, snes::PetscSNES ) + nfuncs_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetNumberFunctionEvals, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, nfuncs_, + ) + + nfuncs = nfuncs_[] + + return nfuncs +end + +""" + nfails::PetscInt = SNESGetLinearSolveFailures(petsclib::PetscLibType,snes::PetscSNES) +Gets the number of failed (non +linear solvers in the current or most recent `SNESSolve()` + +Not Collective + +Input Parameter: +- `snes` - `SNES` context + +Output Parameter: +- `nfails` - number of failed solves + +Options Database Key: +- `-snes_max_linear_solve_fail ` - The number of failures before the solve is terminated + +Level: intermediate + +-seealso: [](ch_snes), `SNESGetMaxLinearSolveFailures()`, `SNESGetLinearSolveIterations()`, `SNESSetMaxLinearSolveFailures()` + +# External Links +$(_doc_external("SNES/SNESGetLinearSolveFailures")) +""" +function SNESGetLinearSolveFailures(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetLinearSolveFailures(petsclib::$UnionPetscLib, snes::PetscSNES ) + nfails_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetLinearSolveFailures, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, nfails_, + ) + + nfails = nfails_[] + + return nfails +end + +""" + SNESSetMaxLinearSolveFailures(petsclib::PetscLibType,snes::PetscSNES, maxFails::PetscInt) +the number of failed linear solve attempts +allowed before `SNES` returns with a diverged reason of `SNES_DIVERGED_LINEAR_SOLVE` + +Logically Collective + +Input Parameters: +- `snes` - `SNES` context +- `maxFails` - maximum allowed linear solve failures, use `PETSC_UNLIMITED` to have no limit on the number of failures + +Options Database Key: +- `-snes_max_linear_solve_fail ` - The number of failures before the solve is terminated + +Level: intermediate + +-seealso: [](ch_snes), `SNESSetErrorIfNotConverged()`, `SNESGetLinearSolveFailures()`, `SNESGetMaxLinearSolveFailures()`, `SNESGetLinearSolveIterations()` + +# External Links +$(_doc_external("SNES/SNESSetMaxLinearSolveFailures")) +""" +function SNESSetMaxLinearSolveFailures(petsclib::PetscLibType, snes::PetscSNES, maxFails::PetscInt) end + +@for_petsc function SNESSetMaxLinearSolveFailures(petsclib::$UnionPetscLib, snes::PetscSNES, maxFails::$PetscInt ) + + @chk ccall( + (:SNESSetMaxLinearSolveFailures, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, maxFails, + ) + + + return nothing +end + +""" + maxFails::PetscInt = SNESGetMaxLinearSolveFailures(petsclib::PetscLibType,snes::PetscSNES) +gets the maximum number of linear solve failures that +are allowed before `SNES` returns as unsuccessful + +Not Collective + +Input Parameter: +- `snes` - `SNES` context + +Output Parameter: +- `maxFails` - maximum of unsuccessful solves allowed + +Level: intermediate + +-seealso: [](ch_snes), `SNESSetErrorIfNotConverged()`, `SNESGetLinearSolveFailures()`, `SNESGetLinearSolveIterations()`, `SNESSetMaxLinearSolveFailures()`, + +# External Links +$(_doc_external("SNES/SNESGetMaxLinearSolveFailures")) +""" +function SNESGetMaxLinearSolveFailures(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetMaxLinearSolveFailures(petsclib::$UnionPetscLib, snes::PetscSNES ) + maxFails_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetMaxLinearSolveFailures, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, maxFails_, + ) + + maxFails = maxFails_[] + + return maxFails +end + +""" + lits::PetscInt = SNESGetLinearSolveIterations(petsclib::PetscLibType,snes::PetscSNES) +Gets the total number of linear iterations +used by the nonlinear solver in the most recent `SNESSolve()` + +Not Collective + +Input Parameter: +- `snes` - `SNES` context + +Output Parameter: +- `lits` - number of linear iterations + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESGetIterationNumber()`, `SNESGetLinearSolveFailures()`, `SNESGetMaxLinearSolveFailures()`, `SNESSetCountersReset()` + +# External Links +$(_doc_external("SNES/SNESGetLinearSolveIterations")) +""" +function SNESGetLinearSolveIterations(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetLinearSolveIterations(petsclib::$UnionPetscLib, snes::PetscSNES ) + lits_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetLinearSolveIterations, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, lits_, + ) + + lits = lits_[] + + return lits +end + +""" + SNESSetCountersReset(petsclib::PetscLibType,snes::PetscSNES, reset::PetscBool) +Sets whether or not the counters for linear iterations and function evaluations +are reset every time `SNESSolve()` is called. + +Logically Collective + +Input Parameters: +- `snes` - `SNES` context +- `reset` - whether to reset the counters or not, defaults to `PETSC_TRUE` + +Level: developer + +-seealso: [](ch_snes), `SNESGetNumberFunctionEvals()`, `SNESGetLinearSolveIterations()`, `SNESGetNPC()` + +# External Links +$(_doc_external("SNES/SNESSetCountersReset")) +""" +function SNESSetCountersReset(petsclib::PetscLibType, snes::PetscSNES, reset::PetscBool) end + +@for_petsc function SNESSetCountersReset(petsclib::$UnionPetscLib, snes::PetscSNES, reset::PetscBool ) + + @chk ccall( + (:SNESSetCountersReset, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, reset, + ) + + + return nothing +end + +""" + SNESResetCounters(petsclib::PetscLibType,snes::PetscSNES) +Reset counters for linear iterations and function evaluations. + +Logically Collective + +Input Parameters: +- `snes` - `SNES` context + +Level: developer + +-seealso: [](ch_snes), `SNESGetNumberFunctionEvals()`, `SNESGetLinearSolveIterations()`, `SNESGetNPC()` + +# External Links +$(_doc_external("SNES/SNESResetCounters")) +""" +function SNESResetCounters(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESResetCounters(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESResetCounters, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESSetKSP(petsclib::PetscLibType,snes::PetscSNES, ksp::PetscKSP) +Sets a `KSP` context for the `SNES` object to use + +Not Collective, but the `SNES` and `KSP` objects must live on the same `MPI_Comm` + +Input Parameters: +- `snes` - the `SNES` context +- `ksp` - the `KSP` context + +Level: developer + +-seealso: [](ch_snes), `SNES`, `KSP`, `KSPGetPC()`, `SNESCreate()`, `KSPCreate()` + +# External Links +$(_doc_external("SNES/SNESSetKSP")) +""" +function SNESSetKSP(petsclib::PetscLibType, snes::PetscSNES, ksp::PetscKSP) end + +@for_petsc function SNESSetKSP(petsclib::$UnionPetscLib, snes::PetscSNES, ksp::PetscKSP ) + + @chk ccall( + (:SNESSetKSP, $petsc_library), + PetscErrorCode, + (CSNES, CKSP), + snes, ksp, + ) + + + return nothing +end + +""" + SNESParametersInitialize(petsclib::PetscLibType,snes::PetscSNES) +Sets all the parameters in `snes` to their default value (when `SNESCreate()` was called) if they +currently contain default values + +Collective + +Input Parameter: +- `snes` - the `SNES` object + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESDestroy()`, `SNESSetLagPreconditioner()`, `SNESSetLagJacobian()`, +`PetscObjectParameterSetDefault()` + +# External Links +$(_doc_external("SNES/SNESParametersInitialize")) +""" +function SNESParametersInitialize(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESParametersInitialize(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESParametersInitialize, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + outsnes::PetscSNES = SNESCreate(petsclib::PetscLibType,comm::MPI_Comm) +Creates a nonlinear solver context used to manage a set of nonlinear solves + +Collective + +Input Parameter: +- `comm` - MPI communicator + +Output Parameter: +- `outsnes` - the new `SNES` context + +Options Database Keys: +- `-snes_mf` - Activates default matrix-free Jacobian-vector products, and no matrix to construct a preconditioner +- `-snes_mf_operator` - Activates default matrix-free Jacobian-vector products, and a user-provided matrix as set by `SNESSetJacobian()` +- `-snes_fd_coloring` - uses a relative fast computation of the Jacobian using finite differences and a graph coloring +- `-snes_fd` - Uses (slow!) finite differences to compute Jacobian + +Level: beginner + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESDestroy()`, `SNESSetLagPreconditioner()`, `SNESSetLagJacobian()` + +# External Links +$(_doc_external("SNES/SNESCreate")) +""" +function SNESCreate(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function SNESCreate(petsclib::$UnionPetscLib, comm::MPI_Comm ) + outsnes_ = Ref{CSNES}() + + @chk ccall( + (:SNESCreate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{CSNES}), + comm, outsnes_, + ) + + outsnes = PetscSNES(outsnes_[], petsclib) + + return outsnes +end + +""" + SNESSetFunction(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, ctx::Cvoid) +Sets the function evaluation routine and function +vector for use by the `SNES` routines in solving systems of nonlinear +equations. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `r` - vector to store function values, may be `NULL` +- `f` - function evaluation routine; for calling sequence see `SNESFunctionFn` +- `ctx` - [optional] user-defined context for private data for the +function evaluation routine (may be `NULL`) + +Level: beginner + +-seealso: [](ch_snes), `SNES`, `SNESGetFunction()`, `SNESComputeFunction()`, `SNESSetJacobian()`, `SNESSetPicard()`, `SNESFunctionFn` + +# External Links +$(_doc_external("SNES/SNESSetFunction")) +""" +function SNESSetFunction(petsclib::PetscLibType, snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, ctx::Cvoid) end + +@for_petsc function SNESSetFunction(petsclib::$UnionPetscLib, snes::PetscSNES, r::PetscVec, f::Union{SNESFunctionFn, Ptr}, ctx::Union{Cvoid, Ptr} ) + + @chk ccall( + (:SNESSetFunction, $petsc_library), + PetscErrorCode, + (CSNES, CVec, Ptr{SNESFunctionFn}, Ptr{Cvoid}), + snes, r, f, ctx, + ) + + + return nothing +end + +""" + SNESSetInitialFunction(petsclib::PetscLibType,snes::PetscSNES, f::PetscVec) +Set an already computed function evaluation at the initial guess to be reused by `SNESSolve()`. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `f` - vector to store function value + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESSetFunction()`, `SNESComputeFunction()`, `SNESSetInitialFunctionNorm()` + +# External Links +$(_doc_external("SNES/SNESSetInitialFunction")) +""" +function SNESSetInitialFunction(petsclib::PetscLibType, snes::PetscSNES, f::PetscVec) end + +@for_petsc function SNESSetInitialFunction(petsclib::$UnionPetscLib, snes::PetscSNES, f::PetscVec ) + + @chk ccall( + (:SNESSetInitialFunction, $petsc_library), + PetscErrorCode, + (CSNES, CVec), + snes, f, + ) + + + return nothing +end + +""" + SNESSetNormSchedule(petsclib::PetscLibType,snes::PetscSNES, normschedule::SNESNormSchedule) +Sets the `SNESNormSchedule` used in convergence and monitoring +of the `SNES` method, when norms are computed in the solving process + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `normschedule` - the frequency of norm computation + +Options Database Key: +- `-snes_norm_schedule ` - set the schedule + +Level: advanced + +-seealso: [](ch_snes), `SNESNormSchedule`, `SNESGetNormSchedule()`, `SNESComputeFunction()`, `VecNorm()`, `SNESSetFunction()`, `SNESSetInitialFunction()` + +# External Links +$(_doc_external("SNES/SNESSetNormSchedule")) +""" +function SNESSetNormSchedule(petsclib::PetscLibType, snes::PetscSNES, normschedule::SNESNormSchedule) end + +@for_petsc function SNESSetNormSchedule(petsclib::$UnionPetscLib, snes::PetscSNES, normschedule::SNESNormSchedule ) + + @chk ccall( + (:SNESSetNormSchedule, $petsc_library), + PetscErrorCode, + (CSNES, SNESNormSchedule), + snes, normschedule, + ) + + + return nothing +end + +""" + SNESGetNormSchedule(petsclib::PetscLibType,snes::PetscSNES, normschedule::SNESNormSchedule) +Gets the `SNESNormSchedule` used in convergence and monitoring +of the `SNES` method. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `normschedule` - the type of the norm used + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSetNormSchedule()`, `SNESComputeFunction()`, `VecNorm()`, `SNESSetFunction()`, `SNESSetInitialFunction()`, `SNESNormSchedule` + +# External Links +$(_doc_external("SNES/SNESGetNormSchedule")) +""" +function SNESGetNormSchedule(petsclib::PetscLibType, snes::PetscSNES, normschedule::SNESNormSchedule) end + +@for_petsc function SNESGetNormSchedule(petsclib::$UnionPetscLib, snes::PetscSNES, normschedule::SNESNormSchedule ) + + @chk ccall( + (:SNESGetNormSchedule, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESNormSchedule}), + snes, normschedule, + ) + + + return nothing +end + +""" + SNESSetFunctionNorm(petsclib::PetscLibType,snes::PetscSNES, norm::PetscReal) +Sets the last computed residual norm. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `norm` - the value of the norm + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESGetNormSchedule()`, `SNESComputeFunction()`, `VecNorm()`, `SNESSetFunction()`, `SNESSetInitialFunction()`, `SNESNormSchedule` + +# External Links +$(_doc_external("SNES/SNESSetFunctionNorm")) +""" +function SNESSetFunctionNorm(petsclib::PetscLibType, snes::PetscSNES, norm::PetscReal) end + +@for_petsc function SNESSetFunctionNorm(petsclib::$UnionPetscLib, snes::PetscSNES, norm::$PetscReal ) + + @chk ccall( + (:SNESSetFunctionNorm, $petsc_library), + PetscErrorCode, + (CSNES, $PetscReal), + snes, norm, + ) + + + return nothing +end + +""" + norm::PetscReal = SNESGetFunctionNorm(petsclib::PetscLibType,snes::PetscSNES) +Gets the last computed norm of the residual + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `norm` - the last computed residual norm + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSetNormSchedule()`, `SNESComputeFunction()`, `VecNorm()`, `SNESSetFunction()`, `SNESSetInitialFunction()`, `SNESNormSchedule` + +# External Links +$(_doc_external("SNES/SNESGetFunctionNorm")) +""" +function SNESGetFunctionNorm(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetFunctionNorm(petsclib::$UnionPetscLib, snes::PetscSNES ) + norm_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESGetFunctionNorm, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}), + snes, norm_, + ) + + norm = norm_[] + + return norm +end + +""" + ynorm::PetscReal = SNESGetUpdateNorm(petsclib::PetscLibType,snes::PetscSNES) +Gets the last computed norm of the solution update + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `ynorm` - the last computed update norm + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSetNormSchedule()`, `SNESComputeFunction()`, `SNESGetFunctionNorm()` + +# External Links +$(_doc_external("SNES/SNESGetUpdateNorm")) +""" +function SNESGetUpdateNorm(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetUpdateNorm(petsclib::$UnionPetscLib, snes::PetscSNES ) + ynorm_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESGetUpdateNorm, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}), + snes, ynorm_, + ) + + ynorm = ynorm_[] + + return ynorm +end + +""" + xnorm::PetscReal = SNESGetSolutionNorm(petsclib::PetscLibType,snes::PetscSNES) +Gets the last computed norm of the solution + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `xnorm` - the last computed solution norm + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSetNormSchedule()`, `SNESComputeFunction()`, `SNESGetFunctionNorm()`, `SNESGetUpdateNorm()` + +# External Links +$(_doc_external("SNES/SNESGetSolutionNorm")) +""" +function SNESGetSolutionNorm(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetSolutionNorm(petsclib::$UnionPetscLib, snes::PetscSNES ) + xnorm_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESGetSolutionNorm, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}), + snes, xnorm_, + ) + + xnorm = xnorm_[] + + return xnorm +end + +""" + SNESSetFunctionType(petsclib::PetscLibType,snes::PetscSNES, type::SNESFunctionType) +Sets the `SNESFunctionType` +of the `SNES` method. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `type` - the function type + +Level: developer + +Values of the function type: +- `SNES_FUNCTION_DEFAULT` - the default for the given `SNESType` +- `SNES_FUNCTION_UNPRECONDITIONED` - an unpreconditioned function evaluation (this is the function provided with `SNESSetFunction()` +- `SNES_FUNCTION_PRECONDITIONED` - a transformation of the function provided with `SNESSetFunction()` + +-seealso: [](ch_snes), `SNES`, `SNESFunctionType`, `SNESGetNormSchedule()`, `SNESComputeFunction()`, `VecNorm()`, `SNESSetFunction()`, `SNESSetInitialFunction()`, `SNESNormSchedule` + +# External Links +$(_doc_external("SNES/SNESSetFunctionType")) +""" +function SNESSetFunctionType(petsclib::PetscLibType, snes::PetscSNES, type::SNESFunctionType) end + +@for_petsc function SNESSetFunctionType(petsclib::$UnionPetscLib, snes::PetscSNES, type::SNESFunctionType ) + + @chk ccall( + (:SNESSetFunctionType, $petsc_library), + PetscErrorCode, + (CSNES, SNESFunctionType), + snes, type, + ) + + + return nothing +end + +""" + SNESGetFunctionType(petsclib::PetscLibType,snes::PetscSNES, type::SNESFunctionType) +Gets the `SNESFunctionType` used in convergence and monitoring set with `SNESSetFunctionType()` +of the SNES method. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `type` - the type of the function evaluation, see `SNESSetFunctionType()` + +Level: advanced + +-seealso: [](ch_snes), `SNESSetFunctionType()`, `SNESFunctionType`, `SNESSetNormSchedule()`, `SNESComputeFunction()`, `VecNorm()`, `SNESSetFunction()`, `SNESSetInitialFunction()`, `SNESNormSchedule` + +# External Links +$(_doc_external("SNES/SNESGetFunctionType")) +""" +function SNESGetFunctionType(petsclib::PetscLibType, snes::PetscSNES, type::SNESFunctionType) end + +@for_petsc function SNESGetFunctionType(petsclib::$UnionPetscLib, snes::PetscSNES, type::SNESFunctionType ) + + @chk ccall( + (:SNESGetFunctionType, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESFunctionType}), + snes, type, + ) + + + return nothing +end + +""" + SNESSetNGS(petsclib::PetscLibType,snes::PetscSNES, f::SNESNGSFn, ctx::Cvoid) +Sets the user nonlinear Gauss +use with composed nonlinear solvers. + +Input Parameters: +- `snes` - the `SNES` context, usually of the `SNESType` `SNESNGS` +- `f` - function evaluation routine to apply Gauss-Seidel, see `SNESNGSFn` for calling sequence +- `ctx` - [optional] user-defined context for private data for the smoother evaluation routine (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_snes), `SNESNGS`, `SNESGetNGS()`, `SNESNCG`, `SNESGetFunction()`, `SNESComputeNGS()`, `SNESNGSFn` + +# External Links +$(_doc_external("SNES/SNESSetNGS")) +""" +function SNESSetNGS(petsclib::PetscLibType, snes::PetscSNES, f::SNESNGSFn, ctx::Cvoid) end + +@for_petsc function SNESSetNGS(petsclib::$UnionPetscLib, snes::PetscSNES, f::SNESNGSFn, ctx::Cvoid ) + + @chk ccall( + (:SNESSetNGS, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESNGSFn}, Ptr{Cvoid}), + snes, f, ctx, + ) + + + return nothing +end + +""" + SNESPicardComputeMFFunction(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, f::PetscVec, ctx::Cvoid) + +# External Links +$(_doc_external("SNES/SNESPicardComputeMFFunction")) +""" +function SNESPicardComputeMFFunction(petsclib::PetscLibType, snes::PetscSNES, x::PetscVec, f::PetscVec, ctx::Cvoid) end + +@for_petsc function SNESPicardComputeMFFunction(petsclib::$UnionPetscLib, snes::PetscSNES, x::PetscVec, f::PetscVec, ctx::Cvoid ) + + @chk ccall( + (:SNESPicardComputeMFFunction, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, Ptr{Cvoid}), + snes, x, f, ctx, + ) + + + return nothing +end + +""" + SNESPicardComputeFunction(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, f::PetscVec, ctx::Cvoid) + +# External Links +$(_doc_external("SNES/SNESPicardComputeFunction")) +""" +function SNESPicardComputeFunction(petsclib::PetscLibType, snes::PetscSNES, x::PetscVec, f::PetscVec, ctx::Cvoid) end + +@for_petsc function SNESPicardComputeFunction(petsclib::$UnionPetscLib, snes::PetscSNES, x::PetscVec, f::PetscVec, ctx::Cvoid ) + + @chk ccall( + (:SNESPicardComputeFunction, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, Ptr{Cvoid}), + snes, x, f, ctx, + ) + + + return nothing +end + +""" + SNESPicardComputeJacobian(petsclib::PetscLibType,snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid) + +# External Links +$(_doc_external("SNES/SNESPicardComputeJacobian")) +""" +function SNESPicardComputeJacobian(petsclib::PetscLibType, snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid) end + +@for_petsc function SNESPicardComputeJacobian(petsclib::$UnionPetscLib, snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid ) + + @chk ccall( + (:SNESPicardComputeJacobian, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CMat, CMat, Ptr{Cvoid}), + snes, x1, J, B, ctx, + ) + + + return nothing +end + +""" + SNESSetPicard(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, bp::SNESFunctionFn, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid) +Use `SNES` to solve the system A(x) x = bp(x) + b via a Picard type iteration (Picard linearization) + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `r` - vector to store function values, may be `NULL` +- `bp` - function evaluation routine, may be `NULL`, for the calling sequence see `SNESFunctionFn` +- `Amat` - matrix with which A(x) x - bp(x) - b is to be computed +- `Pmat` - matrix from which preconditioner is computed (usually the same as `Amat`) +- `J` - function to compute matrix values, for the calling sequence see `SNESJacobianFn` +- `ctx` - [optional] user-defined context for private data for the function evaluation routine (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESGetFunction()`, `SNESSetFunction()`, `SNESComputeFunction()`, `SNESSetJacobian()`, `SNESGetPicard()`, `SNESLineSearchPreCheckPicard()`, +`SNESFunctionFn`, `SNESJacobianFn` + +# External Links +$(_doc_external("SNES/SNESSetPicard")) +""" +function SNESSetPicard(petsclib::PetscLibType, snes::PetscSNES, r::PetscVec, bp::SNESFunctionFn, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid) end + +@for_petsc function SNESSetPicard(petsclib::$UnionPetscLib, snes::PetscSNES, r::PetscVec, bp::SNESFunctionFn, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid ) + + @chk ccall( + (:SNESSetPicard, $petsc_library), + PetscErrorCode, + (CSNES, CVec, Ptr{SNESFunctionFn}, CMat, CMat, Ptr{SNESJacobianFn}, Ptr{Cvoid}), + snes, r, bp, Amat, Pmat, J, ctx, + ) + + + return nothing +end + +""" + SNESGetPicard(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid) +Returns the context for the Picard iteration + +Not Collective, but `Vec` is parallel if `SNES` is parallel. Collective if `Vec` is requested, but has not been created yet. + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `r` - the function (or `NULL`) +- `f` - the function (or `NULL`); for calling sequence see `SNESFunctionFn` +- `Amat` - the matrix used to defined the operation A(x) x - b(x) (or `NULL`) +- `Pmat` - the matrix from which the preconditioner will be constructed (or `NULL`) +- `J` - the function for matrix evaluation (or `NULL`); for calling sequence see `SNESJacobianFn` +- `ctx` - the function context (or `NULL`) + +Level: advanced + +-seealso: [](ch_snes), `SNESSetFunction()`, `SNESSetPicard()`, `SNESGetFunction()`, `SNESGetJacobian()`, `SNESGetDM()`, `SNESFunctionFn`, `SNESJacobianFn` + +# External Links +$(_doc_external("SNES/SNESGetPicard")) +""" +function SNESGetPicard(petsclib::PetscLibType, snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid) end + +@for_petsc function SNESGetPicard(petsclib::$UnionPetscLib, snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid ) + r_ = Ref(r.ptr) + Amat_ = Ref(Amat.ptr) + Pmat_ = Ref(Pmat.ptr) + + @chk ccall( + (:SNESGetPicard, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CVec}, SNESFunctionFn, Ptr{CMat}, Ptr{CMat}, SNESJacobianFn, Cvoid), + snes, r_, f, Amat_, Pmat_, J, ctx, + ) + + r.ptr = C_NULL + Amat.ptr = C_NULL + Pmat.ptr = C_NULL + + return nothing +end + +""" + SNESSetComputeInitialGuess(petsclib::PetscLibType,snes::PetscSNES, func::SNESInitialGuessFn, ctx::Cvoid) +Sets a routine used to compute an initial guess for the nonlinear problem + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `func` - function evaluation routine, see `SNESInitialGuessFn` for the calling sequence +- `ctx` - [optional] user-defined context for private data for the +function evaluation routine (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESSetFunction()`, `SNESGetFunction()`, `SNESComputeFunction()`, `SNESSetJacobian()`, `SNESInitialGuessFn` + +# External Links +$(_doc_external("SNES/SNESSetComputeInitialGuess")) +""" +function SNESSetComputeInitialGuess(petsclib::PetscLibType, snes::PetscSNES, func::SNESInitialGuessFn, ctx::Cvoid) end + +@for_petsc function SNESSetComputeInitialGuess(petsclib::$UnionPetscLib, snes::PetscSNES, func::SNESInitialGuessFn, ctx::Cvoid ) + + @chk ccall( + (:SNESSetComputeInitialGuess, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESInitialGuessFn}, Ptr{Cvoid}), + snes, func, ctx, + ) + + + return nothing +end + +""" + SNESGetRhs(petsclib::PetscLibType,snes::PetscSNES, rhs::PetscVec) +Gets the vector for solving F(x) = `rhs`. If `rhs` is not set +it assumes a zero right-hand side. + +Logically Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `rhs` - the right-hand side vector or `NULL` if there is no right-hand side vector + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESGetSolution()`, `SNESGetFunction()`, `SNESComputeFunction()`, `SNESSetJacobian()`, `SNESSetFunction()` + +# External Links +$(_doc_external("SNES/SNESGetRhs")) +""" +function SNESGetRhs(petsclib::PetscLibType, snes::PetscSNES, rhs::PetscVec) end + +@for_petsc function SNESGetRhs(petsclib::$UnionPetscLib, snes::PetscSNES, rhs::PetscVec ) + rhs_ = Ref(rhs.ptr) + + @chk ccall( + (:SNESGetRhs, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CVec}), + snes, rhs_, + ) + + rhs.ptr = C_NULL + + return nothing +end + +""" + SNESComputeFunction(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, y::PetscVec) +Calls the function that has been set with `SNESSetFunction()`. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `x` - input vector + +Output Parameter: +- `y` - function vector, as set by `SNESSetFunction()` + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSetFunction()`, `SNESGetFunction()`, `SNESComputeMFFunction()` + +# External Links +$(_doc_external("SNES/SNESComputeFunction")) +""" +function SNESComputeFunction(petsclib::PetscLibType, snes::PetscSNES, x::PetscVec, y::PetscVec) end + +@for_petsc function SNESComputeFunction(petsclib::$UnionPetscLib, snes::PetscSNES, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:SNESComputeFunction, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec), + snes, x, y, + ) + + + return nothing +end + +""" + SNESComputeMFFunction(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, y::PetscVec) +Calls the function that has been set with `DMSNESSetMFFunction()`. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `x` - input vector + +Output Parameter: +- `y` - output vector + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSetFunction()`, `SNESGetFunction()`, `SNESComputeFunction()`, `MatCreateSNESMF()`, `DMSNESSetMFFunction()` + +# External Links +$(_doc_external("SNES/SNESComputeMFFunction")) +""" +function SNESComputeMFFunction(petsclib::PetscLibType, snes::PetscSNES, x::PetscVec, y::PetscVec) end + +@for_petsc function SNESComputeMFFunction(petsclib::$UnionPetscLib, snes::PetscSNES, x::PetscVec, y::PetscVec ) + + @chk ccall( + (:SNESComputeMFFunction, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec), + snes, x, y, + ) + + + return nothing +end + +""" + SNESComputeNGS(petsclib::PetscLibType,snes::PetscSNES, b::PetscVec, x::PetscVec) +Calls the Gauss + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `x` - input vector +- `b` - rhs vector + +Output Parameter: +- `x` - new solution vector + +Level: developer + +-seealso: [](ch_snes), `SNESNGSFn`, `SNESSetNGS()`, `SNESComputeFunction()`, `SNESNGS` + +# External Links +$(_doc_external("SNES/SNESComputeNGS")) +""" +function SNESComputeNGS(petsclib::PetscLibType, snes::PetscSNES, b::PetscVec, x::PetscVec) end + +@for_petsc function SNESComputeNGS(petsclib::$UnionPetscLib, snes::PetscSNES, b::PetscVec, x::PetscVec ) + + @chk ccall( + (:SNESComputeNGS, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec), + snes, b, x, + ) + + + return nothing +end + +""" + SNESTestFunction(petsclib::PetscLibType,snes::PetscSNES) +Computes the difference between the computed and finite + +Collective + +Input Parameter: +- `snes` - the `SNES` context + +Options Database Keys: +- `-snes_test_function` - compare the user provided function with one compute via finite differences to check for errors. +- `-snes_test_function_view` - display the user provided function, the finite difference function and the difference + +Level: developer + +-seealso: [](ch_snes), `SNESTestJacobian()`, `SNESSetFunction()`, `SNESComputeFunction()` + +# External Links +$(_doc_external("SNES/SNESTestFunction")) +""" +function SNESTestFunction(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESTestFunction(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESTestFunction, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + Jnorm::PetscReal,diffNorm::PetscReal = SNESTestJacobian(petsclib::PetscLibType,snes::PetscSNES) +Computes the difference between the computed and finite + +Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `Jnorm` - the Frobenius norm of the computed Jacobian, or `NULL` +- `diffNorm` - the Frobenius norm of the difference of the computed and finite-difference Jacobians, or `NULL` + +Options Database Keys: +- `-snes_test_jacobian ` - compare the user provided Jacobian with one compute via finite differences to check for errors. If a threshold is given, display only those entries whose difference is greater than the threshold. +- `-snes_test_jacobian_view` - display the user provided Jacobian, the finite difference Jacobian and the difference + +Level: developer + +-seealso: [](ch_snes), `SNESTestFunction()`, `SNESSetJacobian()`, `SNESComputeJacobian()` + +# External Links +$(_doc_external("SNES/SNESTestJacobian")) +""" +function SNESTestJacobian(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESTestJacobian(petsclib::$UnionPetscLib, snes::PetscSNES ) + Jnorm_ = Ref{$PetscReal}() + diffNorm_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESTestJacobian, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}, Ptr{$PetscReal}), + snes, Jnorm_, diffNorm_, + ) + + Jnorm = Jnorm_[] + diffNorm = diffNorm_[] + + return Jnorm,diffNorm +end + +""" + SNESComputeJacobian(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, A::PetscMat, B::PetscMat) +Computes the Jacobian matrix that has been set with `SNESSetJacobian()`. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `X` - input vector + +Output Parameters: +- `A` - Jacobian matrix +- `B` - optional matrix for building the preconditioner, usually the same as `A` + +Options Database Keys: +- `-snes_lag_preconditioner ` - how often to rebuild preconditioner +- `-snes_lag_jacobian ` - how often to rebuild Jacobian +- `-snes_test_jacobian ` - compare the user provided Jacobian with one compute via finite differences to check for errors. If a threshold is given, display only those entries whose difference is greater than the threshold. +- `-snes_test_jacobian_view` - display the user provided Jacobian, the finite difference Jacobian and the difference between them to help users detect the location of errors in the user provided Jacobian +- `-snes_compare_explicit` - Compare the computed Jacobian to the finite difference Jacobian and output the differences +- `-snes_compare_explicit_draw` - Compare the computed Jacobian to the finite difference Jacobian and draw the result +- `-snes_compare_explicit_contour` - Compare the computed Jacobian to the finite difference Jacobian and draw a contour plot with the result +- `-snes_compare_operator` - Make the comparison options above use the operator instead of the matrix used to construct the preconditioner +- `-snes_compare_coloring` - Compute the finite difference Jacobian using coloring and display norms of difference +- `-snes_compare_coloring_display` - Compute the finite difference Jacobian using coloring and display verbose differences +- `-snes_compare_coloring_threshold` - Display only those matrix entries that differ by more than a given threshold +- `-snes_compare_coloring_threshold_atol` - Absolute tolerance for difference in matrix entries to be displayed by `-snes_compare_coloring_threshold` +- `-snes_compare_coloring_threshold_rtol` - Relative tolerance for difference in matrix entries to be displayed by `-snes_compare_coloring_threshold` +- `-snes_compare_coloring_draw` - Compute the finite difference Jacobian using coloring and draw differences +- `-snes_compare_coloring_draw_contour` - Compute the finite difference Jacobian using coloring and show contours of matrices and differences + +Level: developer + +-seealso: [](ch_snes), `SNESSetJacobian()`, `KSPSetOperators()`, `MatStructure`, `SNESSetLagPreconditioner()`, `SNESSetLagJacobian()` + +# External Links +$(_doc_external("SNES/SNESComputeJacobian")) +""" +function SNESComputeJacobian(petsclib::PetscLibType, snes::PetscSNES, X::PetscVec, A::PetscMat, B::PetscMat) end + +@for_petsc function SNESComputeJacobian(petsclib::$UnionPetscLib, snes::PetscSNES, X::PetscVec, A::PetscMat, B::PetscMat ) + + @chk ccall( + (:SNESComputeJacobian, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CMat, CMat), + snes, X, A, B, + ) + + + return nothing +end + +""" + SNESSetJacobian(petsclib::PetscLibType,snes::PetscSNES, Amat::PetscMat, Pmat::PetscMat, J::Union{SNESJacobianFn,Ptr}, ctx::Union{Cvoid,Ptr}) +Sets the function to compute Jacobian as well as the +location to store the matrix. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `Amat` - the matrix that defines the (approximate) Jacobian +- `Pmat` - the matrix to be used in constructing the preconditioner, usually the same as `Amat`. +- `J` - Jacobian evaluation routine (if `NULL` then `SNES` retains any previously set value), see `SNESJacobianFn` for details +- `ctx` - [optional] user-defined context for private data for the +Jacobian evaluation routine (may be `NULL`) (if `NULL` then `SNES` retains any previously set value) + +Level: beginner + +-seealso: [](ch_snes), `SNES`, `KSPSetOperators()`, `SNESSetFunction()`, `MatMFFDComputeJacobian()`, `SNESComputeJacobianDefaultColor()`, `MatStructure`, +`SNESSetPicard()`, `SNESJacobianFn`, `SNESFunctionFn` + +# External Links +$(_doc_external("SNES/SNESSetJacobian")) +""" +function SNESSetJacobian(petsclib::PetscLibType, snes::PetscSNES, Amat::PetscMat, Pmat::PetscMat, J::Union{SNESJacobianFn,Ptr}, ctx::Union{Cvoid,Ptr}) end + +@for_petsc function SNESSetJacobian(petsclib::$UnionPetscLib, snes::PetscSNES, Amat::PetscMat, Pmat::PetscMat, J::Union{Ptr,SNESJacobianFn}, ctx::Union{Cvoid,Ptr} ) + + @chk ccall( + (:SNESSetJacobian, $petsc_library), + PetscErrorCode, + (CSNES, CMat, CMat, Ptr{SNESJacobianFn}, Ptr{Cvoid}), + snes, Amat, Pmat, J, ctx, + ) + + + return nothing +end + +""" + SNESGetJacobian(petsclib::PetscLibType,snes::PetscSNES, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid) +Returns the Jacobian matrix and optionally the user +provided context for evaluating the Jacobian. + +Not Collective, but `Mat` object will be parallel if `SNES` is + +Input Parameter: +- `snes` - the nonlinear solver context + +Output Parameters: +- `Amat` - location to stash (approximate) Jacobian matrix (or `NULL`) +- `Pmat` - location to stash matrix used to compute the preconditioner (or `NULL`) +- `J` - location to put Jacobian function (or `NULL`), for calling sequence see `SNESJacobianFn` +- `ctx` - location to stash Jacobian ctx (or `NULL`) + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `Mat`, `SNESSetJacobian()`, `SNESComputeJacobian()`, `SNESJacobianFn`, `SNESGetFunction()` + +# External Links +$(_doc_external("SNES/SNESGetJacobian")) +""" +function SNESGetJacobian(petsclib::PetscLibType, snes::PetscSNES, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid) end + +@for_petsc function SNESGetJacobian(petsclib::$UnionPetscLib, snes::PetscSNES, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid ) + Amat_ = Ref(Amat.ptr) + Pmat_ = Ref(Pmat.ptr) + + @chk ccall( + (:SNESGetJacobian, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CMat}, Ptr{CMat}, SNESJacobianFn, Cvoid), + snes, Amat_, Pmat_, J, ctx, + ) + + Amat.ptr = C_NULL + Pmat.ptr = C_NULL + + return nothing +end + +""" + SNESSetUp(petsclib::PetscLibType,snes::PetscSNES) +Sets up the internal data structures for the later use +of a nonlinear solver `SNESSolve()`. + +Collective + +Input Parameter: +- `snes` - the `SNES` context + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESCreate()`, `SNESSolve()`, `SNESDestroy()`, `SNESSetFromOptions()` + +# External Links +$(_doc_external("SNES/SNESSetUp")) +""" +function SNESSetUp(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESSetUp(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESSetUp, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESReset(petsclib::PetscLibType,snes::PetscSNES) +Resets a `SNES` context to the state it was in before `SNESSetUp()` was called and removes any allocated `Vec` and `Mat` from its data structures + +Collective + +Input Parameter: +- `snes` - the nonlinear iterative solver context obtained from `SNESCreate()` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESDestroy()`, `SNESCreate()`, `SNESSetUp()`, `SNESSolve()` + +# External Links +$(_doc_external("SNES/SNESReset")) +""" +function SNESReset(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESReset(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESReset, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESConvergedReasonViewCancel(petsclib::PetscLibType,snes::PetscSNES) +Clears all the reason view functions for a `SNES` object provided with `SNESConvergedReasonViewSet()` also +removes the default viewer. + +Collective + +Input Parameter: +- `snes` - the nonlinear iterative solver context obtained from `SNESCreate()` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESCreate()`, `SNESDestroy()`, `SNESReset()`, `SNESConvergedReasonViewSet()` + +# External Links +$(_doc_external("SNES/SNESConvergedReasonViewCancel")) +""" +function SNESConvergedReasonViewCancel(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESConvergedReasonViewCancel(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESConvergedReasonViewCancel, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESDestroy(petsclib::PetscLibType,snes::PetscSNES) +Destroys the nonlinear solver context that was created +with `SNESCreate()`. + +Collective + +Input Parameter: +- `snes` - the `SNES` context + +Level: beginner + +-seealso: [](ch_snes), `SNES`, `SNESCreate()`, `SNESSolve()` + +# External Links +$(_doc_external("SNES/SNESDestroy")) +""" +function SNESDestroy(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESDestroy(petsclib::$UnionPetscLib, snes::PetscSNES ) + snes_ = Ref(snes.ptr) + + @chk ccall( + (:SNESDestroy, $petsc_library), + PetscErrorCode, + (Ptr{CSNES},), + snes_, + ) + + snes.ptr = C_NULL + + return nothing +end + +""" + SNESSetLagPreconditioner(petsclib::PetscLibType,snes::PetscSNES, lag::PetscInt) +Sets when the preconditioner is rebuilt in the nonlinear solve `SNESSolve()`. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `lag` - 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time +the Jacobian is built etc. -2 indicates rebuild preconditioner at next chance but then never rebuild after that + +Options Database Keys: +- `-snes_lag_jacobian_persists ` - sets the persistence through multiple `SNESSolve()` +- `-snes_lag_jacobian <-2,1,2,...>` - sets the lag +- `-snes_lag_preconditioner_persists ` - sets the persistence through multiple `SNESSolve()` +- `-snes_lag_preconditioner <-2,1,2,...>` - sets the lag + +Level: intermediate + +-seealso: [](ch_snes), `SNESGetLagPreconditioner()`, `SNESSetLagJacobian()`, `SNESGetLagJacobian()`, `SNESSetLagPreconditionerPersists()`, +`SNESSetLagJacobianPersists()`, `SNES`, `SNESSolve()` + +# External Links +$(_doc_external("SNES/SNESSetLagPreconditioner")) +""" +function SNESSetLagPreconditioner(petsclib::PetscLibType, snes::PetscSNES, lag::PetscInt) end + +@for_petsc function SNESSetLagPreconditioner(petsclib::$UnionPetscLib, snes::PetscSNES, lag::$PetscInt ) + + @chk ccall( + (:SNESSetLagPreconditioner, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, lag, + ) + + + return nothing +end + +""" + SNESSetGridSequence(petsclib::PetscLibType,snes::PetscSNES, steps::PetscInt) +sets the number of steps of grid sequencing that `SNES` will do + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `steps` - the number of refinements to do, defaults to 0 + +Options Database Key: +- `-snes_grid_sequence ` - Use grid sequencing to generate initial guess + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESGetLagPreconditioner()`, `SNESSetLagJacobian()`, `SNESGetLagJacobian()`, `SNESGetGridSequence()`, +`SNESSetDM()`, `SNESSolve()` + +# External Links +$(_doc_external("SNES/SNESSetGridSequence")) +""" +function SNESSetGridSequence(petsclib::PetscLibType, snes::PetscSNES, steps::PetscInt) end + +@for_petsc function SNESSetGridSequence(petsclib::$UnionPetscLib, snes::PetscSNES, steps::$PetscInt ) + + @chk ccall( + (:SNESSetGridSequence, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, steps, + ) + + + return nothing +end + +""" + steps::PetscInt = SNESGetGridSequence(petsclib::PetscLibType,snes::PetscSNES) +gets the number of steps of grid sequencing that `SNES` will do + +Logically Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `steps` - the number of refinements to do, defaults to 0 + +Level: intermediate + +-seealso: [](ch_snes), `SNESGetLagPreconditioner()`, `SNESSetLagJacobian()`, `SNESGetLagJacobian()`, `SNESSetGridSequence()` + +# External Links +$(_doc_external("SNES/SNESGetGridSequence")) +""" +function SNESGetGridSequence(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetGridSequence(petsclib::$UnionPetscLib, snes::PetscSNES ) + steps_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetGridSequence, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, steps_, + ) + + steps = steps_[] + + return steps +end + +""" + lag::PetscInt = SNESGetLagPreconditioner(petsclib::PetscLibType,snes::PetscSNES) +Return how often the preconditioner is rebuilt + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `lag` - -1 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time +the Jacobian is built etc. -2 indicates rebuild preconditioner at next chance but then never rebuild after that + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSetLagPreconditioner()`, `SNESSetLagJacobianPersists()`, `SNESSetLagPreconditionerPersists()` + +# External Links +$(_doc_external("SNES/SNESGetLagPreconditioner")) +""" +function SNESGetLagPreconditioner(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetLagPreconditioner(petsclib::$UnionPetscLib, snes::PetscSNES ) + lag_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetLagPreconditioner, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, lag_, + ) + + lag = lag_[] + + return lag +end + +""" + SNESSetLagJacobian(petsclib::PetscLibType,snes::PetscSNES, lag::PetscInt) +Set when the Jacobian is rebuilt in the nonlinear solve. See `SNESSetLagPreconditioner()` for determining how +often the preconditioner is rebuilt. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `lag` - -1 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time +the Jacobian is built etc. -2 means rebuild at next chance but then never again + +Options Database Keys: +- `-snes_lag_jacobian_persists ` - sets the persistence through multiple SNES solves +- `-snes_lag_jacobian <-2,1,2,...>` - sets the lag +- `-snes_lag_preconditioner_persists ` - sets the persistence through multiple SNES solves +- `-snes_lag_preconditioner <-2,1,2,...>` - sets the lag. + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESGetLagPreconditioner()`, `SNESSetLagPreconditioner()`, `SNESGetLagJacobianPersists()`, `SNESSetLagPreconditionerPersists()` + +# External Links +$(_doc_external("SNES/SNESSetLagJacobian")) +""" +function SNESSetLagJacobian(petsclib::PetscLibType, snes::PetscSNES, lag::PetscInt) end + +@for_petsc function SNESSetLagJacobian(petsclib::$UnionPetscLib, snes::PetscSNES, lag::$PetscInt ) + + @chk ccall( + (:SNESSetLagJacobian, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, lag, + ) + + + return nothing +end + +""" + lag::PetscInt = SNESGetLagJacobian(petsclib::PetscLibType,snes::PetscSNES) +Get how often the Jacobian is rebuilt. See `SNESGetLagPreconditioner()` to determine when the preconditioner is rebuilt + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `lag` - -1 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time +the Jacobian is built etc. + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSetLagJacobian()`, `SNESSetLagPreconditioner()`, `SNESGetLagPreconditioner()`, `SNESSetLagJacobianPersists()`, `SNESSetLagPreconditionerPersists()` + + +# External Links +$(_doc_external("SNES/SNESGetLagJacobian")) +""" +function SNESGetLagJacobian(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetLagJacobian(petsclib::$UnionPetscLib, snes::PetscSNES ) + lag_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetLagJacobian, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, lag_, + ) + + lag = lag_[] + + return lag +end + +""" + SNESSetLagJacobianPersists(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool) +Set whether or not the Jacobian lagging persists through multiple nonlinear solves + +Logically collective + +Input Parameters: +- `snes` - the `SNES` context +- `flg` - jacobian lagging persists if true + +Options Database Keys: +- `-snes_lag_jacobian_persists ` - sets the persistence through multiple SNES solves +- `-snes_lag_jacobian <-2,1,2,...>` - sets the lag +- `-snes_lag_preconditioner_persists ` - sets the persistence through multiple SNES solves +- `-snes_lag_preconditioner <-2,1,2,...>` - sets the lag + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSetLagPreconditionerPersists()`, `SNESSetLagJacobian()`, `SNESGetLagJacobian()`, `SNESGetNPC()` + +# External Links +$(_doc_external("SNES/SNESSetLagJacobianPersists")) +""" +function SNESSetLagJacobianPersists(petsclib::PetscLibType, snes::PetscSNES, flg::PetscBool) end + +@for_petsc function SNESSetLagJacobianPersists(petsclib::$UnionPetscLib, snes::PetscSNES, flg::PetscBool ) + + @chk ccall( + (:SNESSetLagJacobianPersists, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, flg, + ) + + + return nothing +end + +""" + SNESSetLagPreconditionerPersists(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool) +Set whether or not the preconditioner lagging persists through multiple nonlinear solves + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `flg` - preconditioner lagging persists if true + +Options Database Keys: +- `-snes_lag_jacobian_persists ` - sets the persistence through multiple SNES solves +- `-snes_lag_jacobian <-2,1,2,...>` - sets the lag +- `-snes_lag_preconditioner_persists ` - sets the persistence through multiple SNES solves +- `-snes_lag_preconditioner <-2,1,2,...>` - sets the lag + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSetLagJacobianPersists()`, `SNESSetLagJacobian()`, `SNESGetLagJacobian()`, `SNESGetNPC()`, `SNESSetLagPreconditioner()` + +# External Links +$(_doc_external("SNES/SNESSetLagPreconditionerPersists")) +""" +function SNESSetLagPreconditionerPersists(petsclib::PetscLibType, snes::PetscSNES, flg::PetscBool) end + +@for_petsc function SNESSetLagPreconditionerPersists(petsclib::$UnionPetscLib, snes::PetscSNES, flg::PetscBool ) + + @chk ccall( + (:SNESSetLagPreconditionerPersists, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, flg, + ) + + + return nothing +end + +""" + SNESSetForceIteration(petsclib::PetscLibType,snes::PetscSNES, force::PetscBool) +force `SNESSolve()` to take at least one iteration regardless of the initial residual norm + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `force` - `PETSC_TRUE` require at least one iteration + +Options Database Key: +- `-snes_force_iteration ` - Sets forcing an iteration + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `TS`, `SNESSetDivergenceTolerance()` + +# External Links +$(_doc_external("SNES/SNESSetForceIteration")) +""" +function SNESSetForceIteration(petsclib::PetscLibType, snes::PetscSNES, force::PetscBool) end + +@for_petsc function SNESSetForceIteration(petsclib::$UnionPetscLib, snes::PetscSNES, force::PetscBool ) + + @chk ccall( + (:SNESSetForceIteration, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, force, + ) + + + return nothing +end + +""" + force::PetscBool = SNESGetForceIteration(petsclib::PetscLibType,snes::PetscSNES) +Check whether or not `SNESSolve()` take at least one iteration regardless of the initial residual norm + +Logically Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `force` - `PETSC_TRUE` requires at least one iteration. + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSetForceIteration()`, `SNESSetDivergenceTolerance()` + +# External Links +$(_doc_external("SNES/SNESGetForceIteration")) +""" +function SNESGetForceIteration(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetForceIteration(petsclib::$UnionPetscLib, snes::PetscSNES ) + force_ = Ref{PetscBool}() + + @chk ccall( + (:SNESGetForceIteration, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, force_, + ) + + force = force_[] + + return force +end + +""" + SNESSetTolerances(petsclib::PetscLibType,snes::PetscSNES, abstol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt, maxf::PetscInt) +Sets various parameters used in `SNES` convergence tests. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `abstol` - the absolute convergence tolerance, F(x^n) ≤ abstol +- `rtol` - the relative convergence tolerance, F(x^n) ≤ reltol * F(x^0) +- `stol` - convergence tolerance in terms of the norm of the change in the solution between steps, || delta x || < stol*|| x || +- `maxit` - the maximum number of iterations allowed in the solver, default 50. +- `maxf` - the maximum number of function evaluations allowed in the solver (use `PETSC_UNLIMITED` indicates no limit), default 10,000 + +Options Database Keys: +- `-snes_atol ` - Sets `abstol` +- `-snes_rtol ` - Sets `rtol` +- `-snes_stol ` - Sets `stol` +- `-snes_max_it ` - Sets `maxit` +- `-snes_max_funcs ` - Sets `maxf` (use `unlimited` to have no maximum) + +Level: intermediate + +-seealso: [](ch_snes), `SNESSolve()`, `SNES`, `SNESSetDivergenceTolerance()`, `SNESSetForceIteration()` + +# External Links +$(_doc_external("SNES/SNESSetTolerances")) +""" +function SNESSetTolerances(petsclib::PetscLibType, snes::PetscSNES, abstol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt, maxf::PetscInt) end + +@for_petsc function SNESSetTolerances(petsclib::$UnionPetscLib, snes::PetscSNES, abstol::$PetscReal, rtol::$PetscReal, stol::$PetscReal, maxit::$PetscInt, maxf::$PetscInt ) + + @chk ccall( + (:SNESSetTolerances, $petsc_library), + PetscErrorCode, + (CSNES, $PetscReal, $PetscReal, $PetscReal, $PetscInt, $PetscInt), + snes, abstol, rtol, stol, maxit, maxf, + ) + + + return nothing +end + +""" + SNESSetDivergenceTolerance(petsclib::PetscLibType,snes::PetscSNES, divtol::PetscReal) +Sets the divergence tolerance used for the `SNES` divergence test. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `divtol` - the divergence tolerance. Use `PETSC_UNLIMITED` to deactivate the test. If the residual norm F(x^n) ≥ divtol * F(x^0) the solver +is stopped due to divergence. + +Options Database Key: +- `-snes_divergence_tolerance ` - Sets `divtol` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESSetTolerances()`, `SNESGetDivergenceTolerance()` + +# External Links +$(_doc_external("SNES/SNESSetDivergenceTolerance")) +""" +function SNESSetDivergenceTolerance(petsclib::PetscLibType, snes::PetscSNES, divtol::PetscReal) end + +@for_petsc function SNESSetDivergenceTolerance(petsclib::$UnionPetscLib, snes::PetscSNES, divtol::$PetscReal ) + + @chk ccall( + (:SNESSetDivergenceTolerance, $petsc_library), + PetscErrorCode, + (CSNES, $PetscReal), + snes, divtol, + ) + + + return nothing +end + +""" + atol::PetscReal,rtol::PetscReal,stol::PetscReal,maxit::PetscInt,maxf::PetscInt = SNESGetTolerances(petsclib::PetscLibType,snes::PetscSNES) +Gets various parameters used in `SNES` convergence tests. + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `atol` - the absolute convergence tolerance +- `rtol` - the relative convergence tolerance +- `stol` - convergence tolerance in terms of the norm of the change in the solution between steps +- `maxit` - the maximum number of iterations allowed +- `maxf` - the maximum number of function evaluations allowed, `PETSC_UNLIMITED` indicates no bound + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSetTolerances()` + +# External Links +$(_doc_external("SNES/SNESGetTolerances")) +""" +function SNESGetTolerances(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetTolerances(petsclib::$UnionPetscLib, snes::PetscSNES ) + atol_ = Ref{$PetscReal}() + rtol_ = Ref{$PetscReal}() + stol_ = Ref{$PetscReal}() + maxit_ = Ref{$PetscInt}() + maxf_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetTolerances, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscInt}, Ptr{$PetscInt}), + snes, atol_, rtol_, stol_, maxit_, maxf_, + ) + + atol = atol_[] + rtol = rtol_[] + stol = stol_[] + maxit = maxit_[] + maxf = maxf_[] + + return atol,rtol,stol,maxit,maxf +end + +""" + SNESGetDivergenceTolerance(petsclib::PetscLibType,snes::PetscSNES, divtol::PetscReal) +Gets divergence tolerance used in divergence test. + +Not Collective + +Input Parameters: +- `snes` - the `SNES` context +- `divtol` - divergence tolerance + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSetDivergenceTolerance()` + +# External Links +$(_doc_external("SNES/SNESGetDivergenceTolerance")) +""" +function SNESGetDivergenceTolerance(petsclib::PetscLibType, snes::PetscSNES, divtol::PetscReal) end + +@for_petsc function SNESGetDivergenceTolerance(petsclib::$UnionPetscLib, snes::PetscSNES, divtol::$PetscReal ) + + @chk ccall( + (:SNESGetDivergenceTolerance, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}), + snes, divtol, + ) + + + return nothing +end + +""" + SNESMonitorLGRange(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, rnorm::PetscReal, monctx::Cvoid) + +# External Links +$(_doc_external("SNES/SNESMonitorLGRange")) +""" +function SNESMonitorLGRange(petsclib::PetscLibType, snes::PetscSNES, n::PetscInt, rnorm::PetscReal, monctx::Cvoid) end + +@for_petsc function SNESMonitorLGRange(petsclib::$UnionPetscLib, snes::PetscSNES, n::$PetscInt, rnorm::$PetscReal, monctx::Cvoid ) + + @chk ccall( + (:SNESMonitorLGRange, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{Cvoid}), + snes, n, rnorm, monctx, + ) + + + return nothing +end + +""" + SNESConverged(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal) +Run the convergence test and update the `SNESConvergedReason`. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `it` - current iteration +- `xnorm` - 2-norm of current iterate +- `snorm` - 2-norm of current step +- `fnorm` - 2-norm of function + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESSolve`, `SNESSetConvergenceTest()` + +# External Links +$(_doc_external("SNES/SNESConverged")) +""" +function SNESConverged(petsclib::PetscLibType, snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal) end + +@for_petsc function SNESConverged(petsclib::$UnionPetscLib, snes::PetscSNES, it::$PetscInt, xnorm::$PetscReal, snorm::$PetscReal, fnorm::$PetscReal ) + + @chk ccall( + (:SNESConverged, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, $PetscReal, $PetscReal), + snes, it, xnorm, snorm, fnorm, + ) + + + return nothing +end + +""" + SNESMonitor(petsclib::PetscLibType,snes::PetscSNES, iter::PetscInt, rnorm::PetscReal) +runs any `SNES` monitor routines provided with `SNESMonitor()` or the options database + +Collective + +Input Parameters: +- `snes` - nonlinear solver context obtained from `SNESCreate()` +- `iter` - current iteration number +- `rnorm` - current relative norm of the residual + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESMonitorSet()` + +# External Links +$(_doc_external("SNES/SNESMonitor")) +""" +function SNESMonitor(petsclib::PetscLibType, snes::PetscSNES, iter::PetscInt, rnorm::PetscReal) end + +@for_petsc function SNESMonitor(petsclib::$UnionPetscLib, snes::PetscSNES, iter::$PetscInt, rnorm::$PetscReal ) + + @chk ccall( + (:SNESMonitor, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal), + snes, iter, rnorm, + ) + + + return nothing +end + +""" + SNESMonitorSet(petsclib::PetscLibType,snes::PetscSNES, f::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn) +Sets an ADDITIONAL function that is to be used at every +iteration of the `SNES` nonlinear solver to display the iteration's +progress. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `f` - the monitor function, for the calling sequence see `SNESMonitorFunction` +- `mctx` - [optional] user-defined context for private data for the monitor routine (use `NULL` if no context is desired) +- `monitordestroy` - [optional] routine that frees monitor context (may be `NULL`), see `PetscCtxDestroyFn` for the calling sequence + +Options Database Keys: +- `-snes_monitor` - sets `SNESMonitorDefault()` +- `-snes_monitor draw::draw_lg` - sets line graph monitor, +- `-snes_monitor_cancel` - cancels all monitors that have been hardwired into a code by calls to `SNESMonitorSet()`, but does not cancel those set via +the options database. + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESMonitorDefault()`, `SNESMonitorCancel()`, `SNESMonitorFunction`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("SNES/SNESMonitorSet")) +""" +function SNESMonitorSet(petsclib::PetscLibType, snes::PetscSNES, f::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn) end + +@for_petsc function SNESMonitorSet(petsclib::$UnionPetscLib, snes::PetscSNES, f::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn ) + + @chk ccall( + (:SNESMonitorSet, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + snes, f, mctx, monitordestroy, + ) + + + return nothing +end + +""" + SNESMonitorCancel(petsclib::PetscLibType,snes::PetscSNES) +Clears all the monitor functions for a `SNES` object. + +Logically Collective + +Input Parameter: +- `snes` - the `SNES` context + +Options Database Key: +- `-snes_monitor_cancel` - cancels all monitors that have been hardwired +into a code by calls to `SNESMonitorSet()`, but does not cancel those +set via the options database + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESMonitorDefault()`, `SNESMonitorSet()` + +# External Links +$(_doc_external("SNES/SNESMonitorCancel")) +""" +function SNESMonitorCancel(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESMonitorCancel(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESMonitorCancel, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESSetConvergenceTest(petsclib::PetscLibType,snes::PetscSNES, SNESConvergenceTestFunction::external, cctx::Cvoid, destroy::external) +Sets the function that is to be used +to test for convergence of the nonlinear iterative solution. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `SNESConvergenceTestFunction` - routine to test for convergence +- `cctx` - [optional] context for private data for the convergence routine (may be `NULL`) +- `destroy` - [optional] destructor for the context (may be `NULL`; `PETSC_NULL_FUNCTION` in Fortran) + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESConvergedDefault()`, `SNESConvergedSkip()`, `SNESConvergenceTestFunction` + +# External Links +$(_doc_external("SNES/SNESSetConvergenceTest")) +""" +function SNESSetConvergenceTest(petsclib::PetscLibType, snes::PetscSNES, SNESConvergenceTestFunction::external, cctx::Cvoid, destroy::external) end + +@for_petsc function SNESSetConvergenceTest(petsclib::$UnionPetscLib, snes::PetscSNES, SNESConvergenceTestFunction::external, cctx::Cvoid, destroy::external ) + + @chk ccall( + (:SNESSetConvergenceTest, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{Cvoid}, external), + snes, SNESConvergenceTestFunction, cctx, destroy, + ) + + + return nothing +end + +""" + SNESGetConvergedReason(petsclib::PetscLibType,snes::PetscSNES, reason::SNESConvergedReason) +Gets the reason the `SNES` iteration was stopped, which may be due to convergence, divergence, or stagnation + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `reason` - negative value indicates diverged, positive value converged, see `SNESConvergedReason` for the individual convergence tests for complete lists + +Options Database Key: +- `-snes_converged_reason` - prints the reason to standard out + +Level: intermediate + +-seealso: [](ch_snes), `SNESSolve()`, `SNESSetConvergenceTest()`, `SNESSetConvergedReason()`, `SNESConvergedReason`, `SNESGetConvergedReasonString()` + +# External Links +$(_doc_external("SNES/SNESGetConvergedReason")) +""" +function SNESGetConvergedReason(petsclib::PetscLibType, snes::PetscSNES, reason::SNESConvergedReason) end + + +@for_petsc function SNESGetConvergedReason(petsclib::$UnionPetscLib, snes::PetscSNES) + reason = Ref{SNESConvergedReason}() + @chk ccall( + (:SNESGetConvergedReason, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESConvergedReason}), + snes, reason, + ) + return reason[] +end + +@for_petsc function SNESGetConvergedReason(petsclib::$UnionPetscLib, snes::PetscSNES, reason::SNESConvergedReason ) + + @chk ccall( + (:SNESGetConvergedReason, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESConvergedReason}), + snes, reason, + ) + + + return nothing +end + +""" + SNESGetConvergedReasonString(petsclib::PetscLibType,snes::PetscSNES, strreason::Cchar) +Return a human readable string for `SNESConvergedReason` + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `strreason` - a human readable string that describes `SNES` converged reason + +Level: beginner + +-seealso: [](ch_snes), `SNES`, `SNESGetConvergedReason()` + +# External Links +$(_doc_external("SNES/SNESGetConvergedReasonString")) +""" +function SNESGetConvergedReasonString(petsclib::PetscLibType, snes::PetscSNES, strreason::Cchar) end + +@for_petsc function SNESGetConvergedReasonString(petsclib::$UnionPetscLib, snes::PetscSNES, strreason::Cchar ) + + @chk ccall( + (:SNESGetConvergedReasonString, $petsc_library), + PetscErrorCode, + (CSNES, Cchar), + snes, strreason, + ) + + + return nothing +end + +""" + SNESSetConvergedReason(petsclib::PetscLibType,snes::PetscSNES, reason::SNESConvergedReason) +Sets the reason the `SNES` iteration was stopped. + +Not Collective + +Input Parameters: +- `snes` - the `SNES` context +- `reason` - negative value indicates diverged, positive value converged, see `SNESConvergedReason` or the +manual pages for the individual convergence tests for complete lists + +Level: developer + +-seealso: [](ch_snes), `SNESGetConvergedReason()`, `SNESSetConvergenceTest()`, `SNESConvergedReason` + +# External Links +$(_doc_external("SNES/SNESSetConvergedReason")) +""" +function SNESSetConvergedReason(petsclib::PetscLibType, snes::PetscSNES, reason::SNESConvergedReason) end + +@for_petsc function SNESSetConvergedReason(petsclib::$UnionPetscLib, snes::PetscSNES, reason::SNESConvergedReason ) + + @chk ccall( + (:SNESSetConvergedReason, $petsc_library), + PetscErrorCode, + (CSNES, SNESConvergedReason), + snes, reason, + ) + + + return nothing +end + +""" + SNESSetConvergenceHistory(petsclib::PetscLibType,snes::PetscSNES, a::Vector{PetscReal}, its::Vector{PetscInt}, na::PetscInt, reset::PetscBool) +Sets the arrays used to hold the convergence history. + +Logically Collective + +Input Parameters: +- `snes` - iterative context obtained from `SNESCreate()` +- `a` - array to hold history, this array will contain the function norms computed at each step +- `its` - integer array holds the number of linear iterations for each solve. +- `na` - size of `a` and `its` +- `reset` - `PETSC_TRUE` indicates each new nonlinear solve resets the history counter to zero, +else it continues storing new values for new nonlinear solves after the old ones + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESGetConvergenceHistory()` + +# External Links +$(_doc_external("SNES/SNESSetConvergenceHistory")) +""" +function SNESSetConvergenceHistory(petsclib::PetscLibType, snes::PetscSNES, a::Vector{PetscReal}, its::Vector{PetscInt}, na::PetscInt, reset::PetscBool) end + +@for_petsc function SNESSetConvergenceHistory(petsclib::$UnionPetscLib, snes::PetscSNES, a::Vector{$PetscReal}, its::Vector{$PetscInt}, na::$PetscInt, reset::PetscBool ) + + @chk ccall( + (:SNESSetConvergenceHistory, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}, Ptr{$PetscInt}, $PetscInt, PetscBool), + snes, a, its, na, reset, + ) + + + return nothing +end + +""" + a::Vector{PetscReal},its::Vector{PetscInt},na::PetscInt = SNESGetConvergenceHistory(petsclib::PetscLibType,snes::PetscSNES) +Gets the arrays used to hold the convergence history. + +Not Collective + +Input Parameter: +- `snes` - iterative context obtained from `SNESCreate()` + +Output Parameters: +- `a` - array to hold history, usually was set with `SNESSetConvergenceHistory()` +- `its` - integer array holds the number of linear iterations (or +negative if not converged) for each solve. +- `na` - size of `a` and `its` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESSetConvergenceHistory()` + +# External Links +$(_doc_external("SNES/SNESGetConvergenceHistory")) +""" +function SNESGetConvergenceHistory(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetConvergenceHistory(petsclib::$UnionPetscLib, snes::PetscSNES ) + a_ = Ref{Ptr{$PetscReal}}() + its_ = Ref{Ptr{$PetscInt}}() + na_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESGetConvergenceHistory, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Ptr{$PetscReal}}, Ptr{Ptr{$PetscInt}}, Ptr{$PetscInt}), + snes, a_, its_, na_, + ) + + a = unsafe_wrap(Array, a_[], VecGetLocalSize(petsclib, x); own = false) + its = unsafe_wrap(Array, its_[], VecGetLocalSize(petsclib, x); own = false) + na = na_[] + + return a,its,na +end + +""" + SNESSetUpdate(petsclib::PetscLibType,snes::PetscSNES, func::SNESUpdateFn) +Sets the general +at the beginning of every iteration of the nonlinear solve. Specifically +it is called just before the Jacobian is "evaluated" and after the function +evaluation. + +Logically Collective + +Input Parameters: +- `snes` - The nonlinear solver context +- `func` - The update function; for calling sequence see `SNESUpdateFn` + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESSetJacobian()`, `SNESLineSearchSetPreCheck()`, `SNESLineSearchSetPostCheck()`, `SNESNewtonTRSetPreCheck()`, `SNESNewtonTRSetPostCheck()`, +`SNESMonitorSet()` + +# External Links +$(_doc_external("SNES/SNESSetUpdate")) +""" +function SNESSetUpdate(petsclib::PetscLibType, snes::PetscSNES, func::SNESUpdateFn) end + +@for_petsc function SNESSetUpdate(petsclib::$UnionPetscLib, snes::PetscSNES, func::SNESUpdateFn ) + + @chk ccall( + (:SNESSetUpdate, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESUpdateFn}), + snes, func, + ) + + + return nothing +end + +""" + SNESConvergedReasonView(petsclib::PetscLibType,snes::PetscSNES, viewer::PetscViewer) +Displays the reason a `SNES` solve converged or diverged to a viewer + +Collective + +Input Parameters: +- `snes` - iterative context obtained from `SNESCreate()` +- `viewer` - the viewer to display the reason + +Options Database Keys: +- `-snes_converged_reason` - print reason for converged or diverged, also prints number of iterations +- `-snes_converged_reason ::failed` - only print reason and number of iterations when diverged + +Level: beginner + +-seealso: [](ch_snes), `SNESConvergedReason`, `PetscViewer`, `SNES`, +`SNESCreate()`, `SNESSetUp()`, `SNESDestroy()`, `SNESSetTolerances()`, `SNESConvergedDefault()`, `SNESGetConvergedReason()`, +`SNESConvergedReasonViewFromOptions()`, +`PetscViewerPushFormat()`, `PetscViewerPopFormat()` + +# External Links +$(_doc_external("SNES/SNESConvergedReasonView")) +""" +function SNESConvergedReasonView(petsclib::PetscLibType, snes::PetscSNES, viewer::PetscViewer) end + +@for_petsc function SNESConvergedReasonView(petsclib::$UnionPetscLib, snes::PetscSNES, viewer::PetscViewer ) + + @chk ccall( + (:SNESConvergedReasonView, $petsc_library), + PetscErrorCode, + (CSNES, PetscViewer), + snes, viewer, + ) + + + return nothing +end + +""" + SNESConvergedReasonViewSet(petsclib::PetscLibType,snes::PetscSNES, f::external, vctx::Cvoid, reasonviewdestroy::PetscCtxDestroyFn) +Sets an ADDITIONAL function that is to be used at the +end of the nonlinear solver to display the convergence reason of the nonlinear solver. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `f` - the `SNESConvergedReason` view function +- `vctx` - [optional] user-defined context for private data for the `SNESConvergedReason` view function (use `NULL` if no context is desired) +- `reasonviewdestroy` - [optional] routine that frees the context (may be `NULL`), see `PetscCtxDestroyFn` for the calling sequence + +Calling sequence of `f`: +- `snes` - the `SNES` context +- `vctx` - [optional] context for private data for the function + +Options Database Keys: +- `-snes_converged_reason` - sets a default `SNESConvergedReasonView()` +- `-snes_converged_reason_view_cancel` - cancels all converged reason viewers that have been hardwired into a code by +calls to `SNESConvergedReasonViewSet()`, but does not cancel those set via the options database. + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESConvergedReason`, `SNESGetConvergedReason()`, `SNESConvergedReasonView()`, `SNESConvergedReasonViewCancel()`, +`PetscCtxDestroyFn` + +# External Links +$(_doc_external("SNES/SNESConvergedReasonViewSet")) +""" +function SNESConvergedReasonViewSet(petsclib::PetscLibType, snes::PetscSNES, f::external, vctx::Cvoid, reasonviewdestroy::PetscCtxDestroyFn) end + +@for_petsc function SNESConvergedReasonViewSet(petsclib::$UnionPetscLib, snes::PetscSNES, f::external, vctx::Cvoid, reasonviewdestroy::PetscCtxDestroyFn ) + + @chk ccall( + (:SNESConvergedReasonViewSet, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}), + snes, f, vctx, reasonviewdestroy, + ) + + + return nothing +end + +""" + SNESConvergedReasonViewFromOptions(petsclib::PetscLibType,snes::PetscSNES) +Processes command line options to determine if/how a `SNESConvergedReason` is to be viewed at the end of `SNESSolve()` +All the user-provided viewer routines set with `SNESConvergedReasonViewSet()` will be called, if they exist. + +Collective + +Input Parameter: +- `snes` - the `SNES` object + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESConvergedReason`, `SNESConvergedReasonViewSet()`, `SNESCreate()`, `SNESSetUp()`, `SNESDestroy()`, +`SNESSetTolerances()`, `SNESConvergedDefault()`, `SNESGetConvergedReason()`, `SNESConvergedReasonView()` + +# External Links +$(_doc_external("SNES/SNESConvergedReasonViewFromOptions")) +""" +function SNESConvergedReasonViewFromOptions(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESConvergedReasonViewFromOptions(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESConvergedReasonViewFromOptions, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESSolve(petsclib::PetscLibType,snes::PetscSNES, b::Union{PetscVec,Ptr}, x::PetscVec) +Solves a nonlinear system F(x) = b associated with a `SNES` object + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `b` - the constant part of the equation F(x) = b, or `NULL` to use zero. +- `x` - the solution vector. + +Level: beginner + +-seealso: [](ch_snes), `SNES`, `SNESCreate()`, `SNESDestroy()`, `SNESSetFunction()`, `SNESSetJacobian()`, `SNESSetGridSequence()`, `SNESGetSolution()`, +`SNESNewtonTRSetPreCheck()`, `SNESNewtonTRGetPreCheck()`, `SNESNewtonTRSetPostCheck()`, `SNESNewtonTRGetPostCheck()`, +`SNESLineSearchSetPostCheck()`, `SNESLineSearchGetPostCheck()`, `SNESLineSearchSetPreCheck()`, `SNESLineSearchGetPreCheck()` + +# External Links +$(_doc_external("SNES/SNESSolve")) +""" +function SNESSolve(petsclib::PetscLibType, snes::PetscSNES, b::Union{PetscVec,Ptr}, x::PetscVec) end + +@for_petsc function SNESSolve(petsclib::$UnionPetscLib, snes::PetscSNES, b::Union{PetscVec,Ptr}, x::PetscVec ) + + @chk ccall( + (:SNESSolve, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec), + snes, b, x, + ) + + + return nothing +end + +""" + SNESSetType(petsclib::PetscLibType,snes::PetscSNES, type::SNESType) +Sets the algorithm/method to be used to solve the nonlinear system with the given `SNES` + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `type` - a known method + +Options Database Key: +- `-snes_type ` - Sets the method; use -help for a list +of available methods (for instance, newtonls or newtontr) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESType`, `SNESCreate()`, `SNESDestroy()`, `SNESGetType()`, `SNESSetFromOptions()` + +# External Links +$(_doc_external("SNES/SNESSetType")) +""" +function SNESSetType(petsclib::PetscLibType, snes::PetscSNES, type::SNESType) end + +@for_petsc function SNESSetType(petsclib::$UnionPetscLib, snes::PetscSNES, type::SNESType ) + + @chk ccall( + (:SNESSetType, $petsc_library), + PetscErrorCode, + (CSNES, SNESType), + snes, type, + ) + + + return nothing +end + +""" + type::SNESType = SNESGetType(petsclib::PetscLibType,snes::PetscSNES) +Gets the `SNES` method type and name (as a string). + +Not Collective + +Input Parameter: +- `snes` - nonlinear solver context + +Output Parameter: +- `type` - `SNES` method (a character string) + +Level: intermediate + +-seealso: [](ch_snes), `SNESSetType()`, `SNESType`, `SNESSetFromOptions()`, `SNES` + +# External Links +$(_doc_external("SNES/SNESGetType")) +""" +function SNESGetType(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetType(petsclib::$UnionPetscLib, snes::PetscSNES ) + type_ = Ref{SNESType}() + + @chk ccall( + (:SNESGetType, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESType}), + snes, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + SNESSetSolution(petsclib::PetscLibType,snes::PetscSNES, u::PetscVec) +Sets the solution vector for use by the `SNES` routines. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context obtained from `SNESCreate()` +- `u` - the solution vector + +Level: beginner + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESGetSolution()`, `Vec` + +# External Links +$(_doc_external("SNES/SNESSetSolution")) +""" +function SNESSetSolution(petsclib::PetscLibType, snes::PetscSNES, u::PetscVec) end + +@for_petsc function SNESSetSolution(petsclib::$UnionPetscLib, snes::PetscSNES, u::PetscVec ) + + @chk ccall( + (:SNESSetSolution, $petsc_library), + PetscErrorCode, + (CSNES, CVec), + snes, u, + ) + + + return nothing +end + +""" + SNESGetSolution(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec) +Returns the vector where the approximate solution is +stored. This is the fine grid solution when using `SNESSetGridSequence()`. + +Not Collective, but `x` is parallel if `snes` is parallel + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `x` - the solution + +Level: intermediate + +-seealso: [](ch_snes), `SNESSetSolution()`, `SNESSolve()`, `SNES`, `SNESGetSolutionUpdate()`, `SNESGetFunction()` + +# External Links +$(_doc_external("SNES/SNESGetSolution")) +""" +function SNESGetSolution(petsclib::PetscLibType, snes::PetscSNES, x::PetscVec) end + +@for_petsc function SNESGetSolution(petsclib::$UnionPetscLib, snes::PetscSNES, x::PetscVec ) + x_ = Ref(x.ptr) + + @chk ccall( + (:SNESGetSolution, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CVec}), + snes, x_, + ) + + x.ptr = C_NULL + + return nothing +end + +""" + SNESGetSolutionUpdate(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec) +Returns the vector where the solution update is +stored. + +Not Collective, but `x` is parallel if `snes` is parallel + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `x` - the solution update + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESGetSolution()`, `SNESGetFunction()` + +# External Links +$(_doc_external("SNES/SNESGetSolutionUpdate")) +""" +function SNESGetSolutionUpdate(petsclib::PetscLibType, snes::PetscSNES, x::PetscVec) end + +@for_petsc function SNESGetSolutionUpdate(petsclib::$UnionPetscLib, snes::PetscSNES, x::PetscVec ) + x_ = Ref(x.ptr) + + @chk ccall( + (:SNESGetSolutionUpdate, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CVec}), + snes, x_, + ) + + x.ptr = C_NULL + + return nothing +end + +""" + SNESGetFunction(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, ctx::Cvoid) +Returns the function that defines the nonlinear system set with `SNESSetFunction()` + +Not Collective, but `r` is parallel if `snes` is parallel. Collective if `r` is requested, but has not been created yet. + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `r` - the vector that is used to store residuals (or `NULL` if you don't want it) +- `f` - the function (or `NULL` if you don't want it); for calling sequence see `SNESFunctionFn` +- `ctx` - the function context (or `NULL` if you don't want it) + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSolve()`, `SNESSetFunction()`, `SNESGetSolution()`, `SNESFunctionFn` + +# External Links +$(_doc_external("SNES/SNESGetFunction")) +""" +function SNESGetFunction(petsclib::PetscLibType, snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, ctx::Cvoid) end + +@for_petsc function SNESGetFunction(petsclib::$UnionPetscLib, snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, ctx::Cvoid ) + r_ = Ref(r.ptr) + + @chk ccall( + (:SNESGetFunction, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CVec}, SNESFunctionFn, Cvoid), + snes, r_, f, ctx, + ) + + r.ptr = C_NULL + + return nothing +end + +""" + SNESGetNGS(petsclib::PetscLibType,snes::PetscSNES, f::SNESNGSFn, ctx::Cvoid) +Returns the function and context set with `SNESSetNGS()` + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `f` - the function (or `NULL`) see `SNESNGSFn` for calling sequence +- `ctx` - the function context (or `NULL`) + +Level: advanced + +-seealso: [](ch_snes), `SNESSetNGS()`, `SNESGetFunction()`, `SNESNGSFn` + +# External Links +$(_doc_external("SNES/SNESGetNGS")) +""" +function SNESGetNGS(petsclib::PetscLibType, snes::PetscSNES, f::SNESNGSFn, ctx::Cvoid) end + +@for_petsc function SNESGetNGS(petsclib::$UnionPetscLib, snes::PetscSNES, f::SNESNGSFn, ctx::Cvoid ) + + @chk ccall( + (:SNESGetNGS, $petsc_library), + PetscErrorCode, + (CSNES, SNESNGSFn, Cvoid), + snes, f, ctx, + ) + + + return nothing +end + +""" + SNESSetOptionsPrefix(petsclib::PetscLibType,snes::PetscSNES, prefix::String) +Sets the prefix used for searching for all +`SNES` options in the database. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSetFromOptions()`, `SNESAppendOptionsPrefix()` + +# External Links +$(_doc_external("SNES/SNESSetOptionsPrefix")) +""" +function SNESSetOptionsPrefix(petsclib::PetscLibType, snes::PetscSNES, prefix::String) end + +@for_petsc function SNESSetOptionsPrefix(petsclib::$UnionPetscLib, snes::PetscSNES, prefix::String ) + + @chk ccall( + (:SNESSetOptionsPrefix, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Cchar}), + snes, prefix, + ) + + + return nothing +end + +""" + SNESAppendOptionsPrefix(petsclib::PetscLibType,snes::PetscSNES, prefix::String) +Appends to the prefix used for searching for all +`SNES` options in the database. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `prefix` - the prefix to prepend to all option names + +Level: advanced + +-seealso: [](ch_snes), `SNESGetOptionsPrefix()`, `SNESSetOptionsPrefix()` + +# External Links +$(_doc_external("SNES/SNESAppendOptionsPrefix")) +""" +function SNESAppendOptionsPrefix(petsclib::PetscLibType, snes::PetscSNES, prefix::String) end + +@for_petsc function SNESAppendOptionsPrefix(petsclib::$UnionPetscLib, snes::PetscSNES, prefix::String ) + + @chk ccall( + (:SNESAppendOptionsPrefix, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Cchar}), + snes, prefix, + ) + + + return nothing +end + +""" + SNESGetOptionsPrefix(petsclib::PetscLibType,snes::PetscSNES, prefix::String) +Gets the prefix used for searching for all +`SNES` options in the database. + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `prefix` - pointer to the prefix string used + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSetOptionsPrefix()`, `SNESAppendOptionsPrefix()` + +# External Links +$(_doc_external("SNES/SNESGetOptionsPrefix")) +""" +function SNESGetOptionsPrefix(petsclib::PetscLibType, snes::PetscSNES, prefix::String) end + +@for_petsc function SNESGetOptionsPrefix(petsclib::$UnionPetscLib, snes::PetscSNES, prefix::String ) + prefix_ = Ref(pointer(prefix)) + + @chk ccall( + (:SNESGetOptionsPrefix, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Ptr{Cchar}}), + snes, prefix_, + ) + + + return nothing +end + +""" + SNESRegister(petsclib::PetscLibType,sname::String, fnc::external) +Adds a method to the nonlinear solver package. + +Not Collective + +Input Parameters: +- `sname` - name of a new user-defined solver +- `function` - routine to create method context + +Level: advanced + +-seealso: [](ch_snes), `SNESRegisterAll()`, `SNESRegisterDestroy()` + +# External Links +$(_doc_external("SNES/SNESRegister")) +""" +function SNESRegister(petsclib::PetscLibType, sname::String, fnc::external) end + +@for_petsc function SNESRegister(petsclib::$UnionPetscLib, sname::String, fnc::external ) + + @chk ccall( + (:SNESRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, external), + sname, fnc, + ) + + + return nothing +end + +""" + SNESTestLocalMin(petsclib::PetscLibType,snes::PetscSNES) + +# External Links +$(_doc_external("SNES/SNESTestLocalMin")) +""" +function SNESTestLocalMin(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESTestLocalMin(petsclib::$UnionPetscLib, snes::PetscSNES ) + + @chk ccall( + (:SNESTestLocalMin, $petsc_library), + PetscErrorCode, + (CSNES,), + snes, + ) + + + return nothing +end + +""" + SNESKSPSetUseEW(petsclib::PetscLibType,snes::PetscSNES, flag::PetscBool) +Sets `SNES` to the use Eisenstat +computing relative tolerance for linear solvers within an inexact +Newton method. + +Logically Collective + +Input Parameters: +- `snes` - `SNES` context +- `flag` - `PETSC_TRUE` or `PETSC_FALSE` + +Options Database Keys: +- `-snes_ksp_ew` - use Eisenstat-Walker method for determining linear system convergence +- `-snes_ksp_ew_version ver` - version of Eisenstat-Walker method +- `-snes_ksp_ew_rtol0 ` - Sets rtol0 +- `-snes_ksp_ew_rtolmax ` - Sets rtolmax +- `-snes_ksp_ew_gamma ` - Sets gamma +- `-snes_ksp_ew_alpha ` - Sets alpha +- `-snes_ksp_ew_alpha2 ` - Sets alpha2 +- `-snes_ksp_ew_threshold ` - Sets threshold + +Level: advanced + +-seealso: [](ch_snes), `KSP`, `SNES`, `SNESKSPGetUseEW()`, `SNESKSPGetParametersEW()`, `SNESKSPSetParametersEW()` + +# External Links +$(_doc_external("SNES/SNESKSPSetUseEW")) +""" +function SNESKSPSetUseEW(petsclib::PetscLibType, snes::PetscSNES, flag::PetscBool) end + +@for_petsc function SNESKSPSetUseEW(petsclib::$UnionPetscLib, snes::PetscSNES, flag::PetscBool ) + + @chk ccall( + (:SNESKSPSetUseEW, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, flag, + ) + + + return nothing +end + +""" + flag::PetscBool = SNESKSPGetUseEW(petsclib::PetscLibType,snes::PetscSNES) +Gets if `SNES` is using Eisenstat +for computing relative tolerance for linear solvers within an +inexact Newton method. + +Not Collective + +Input Parameter: +- `snes` - `SNES` context + +Output Parameter: +- `flag` - `PETSC_TRUE` or `PETSC_FALSE` + +Level: advanced + +-seealso: [](ch_snes), `SNESKSPSetUseEW()`, `SNESKSPGetParametersEW()`, `SNESKSPSetParametersEW()` + +# External Links +$(_doc_external("SNES/SNESKSPGetUseEW")) +""" +function SNESKSPGetUseEW(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESKSPGetUseEW(petsclib::$UnionPetscLib, snes::PetscSNES ) + flag_ = Ref{PetscBool}() + + @chk ccall( + (:SNESKSPGetUseEW, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, flag_, + ) + + flag = flag_[] + + return flag +end + +""" + SNESKSPSetParametersEW(petsclib::PetscLibType,snes::PetscSNES, version::PetscInt, rtol_0::PetscReal, rtol_max::PetscReal, gamma::PetscReal, alpha::PetscReal, alpha2::PetscReal, threshold::PetscReal) +Sets parameters for Eisenstat +convergence criteria for the linear solvers within an inexact +Newton method. + +Logically Collective + +Input Parameters: +- `snes` - `SNES` context +- `version` - version 1, 2 (default is 2), 3 or 4 +- `rtol_0` - initial relative tolerance (0 <= rtol_0 < 1) +- `rtol_max` - maximum relative tolerance (0 <= rtol_max < 1) +- `gamma` - multiplicative factor for version 2 rtol computation +(0 <= gamma2 <= 1) +- `alpha` - power for version 2 rtol computation (1 < alpha <= 2) +- `alpha2` - power for safeguard +- `threshold` - threshold for imposing safeguard (0 < threshold < 1) + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESKSPSetUseEW()`, `SNESKSPGetUseEW()`, `SNESKSPGetParametersEW()` + +# External Links +$(_doc_external("SNES/SNESKSPSetParametersEW")) +""" +function SNESKSPSetParametersEW(petsclib::PetscLibType, snes::PetscSNES, version::PetscInt, rtol_0::PetscReal, rtol_max::PetscReal, gamma::PetscReal, alpha::PetscReal, alpha2::PetscReal, threshold::PetscReal) end + +@for_petsc function SNESKSPSetParametersEW(petsclib::$UnionPetscLib, snes::PetscSNES, version::$PetscInt, rtol_0::$PetscReal, rtol_max::$PetscReal, gamma::$PetscReal, alpha::$PetscReal, alpha2::$PetscReal, threshold::$PetscReal ) + + @chk ccall( + (:SNESKSPSetParametersEW, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + snes, version, rtol_0, rtol_max, gamma, alpha, alpha2, threshold, + ) + + + return nothing +end + +""" + version::PetscInt,rtol_0::PetscReal,rtol_max::PetscReal,gamma::PetscReal,alpha::PetscReal,alpha2::PetscReal,threshold::PetscReal = SNESKSPGetParametersEW(petsclib::PetscLibType,snes::PetscSNES) +Gets parameters for Eisenstat +convergence criteria for the linear solvers within an inexact +Newton method. + +Not Collective + +Input Parameter: +- `snes` - `SNES` context + +Output Parameters: +- `version` - version 1, 2 (default is 2), 3 or 4 +- `rtol_0` - initial relative tolerance (0 <= rtol_0 < 1) +- `rtol_max` - maximum relative tolerance (0 <= rtol_max < 1) +- `gamma` - multiplicative factor for version 2 rtol computation (0 <= gamma2 <= 1) +- `alpha` - power for version 2 rtol computation (1 < alpha <= 2) +- `alpha2` - power for safeguard +- `threshold` - threshold for imposing safeguard (0 < threshold < 1) + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESKSPSetUseEW()`, `SNESKSPGetUseEW()`, `SNESKSPSetParametersEW()` + +# External Links +$(_doc_external("SNES/SNESKSPGetParametersEW")) +""" +function SNESKSPGetParametersEW(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESKSPGetParametersEW(petsclib::$UnionPetscLib, snes::PetscSNES ) + version_ = Ref{$PetscInt}() + rtol_0_ = Ref{$PetscReal}() + rtol_max_ = Ref{$PetscReal}() + gamma_ = Ref{$PetscReal}() + alpha_ = Ref{$PetscReal}() + alpha2_ = Ref{$PetscReal}() + threshold_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESKSPGetParametersEW, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + snes, version_, rtol_0_, rtol_max_, gamma_, alpha_, alpha2_, threshold_, + ) + + version = version_[] + rtol_0 = rtol_0_[] + rtol_max = rtol_max_[] + gamma = gamma_[] + alpha = alpha_[] + alpha2 = alpha2_[] + threshold = threshold_[] + + return version,rtol_0,rtol_max,gamma,alpha,alpha2,threshold +end + +""" + SNESGetKSP(petsclib::PetscLibType,snes::PetscSNES, ksp::PetscKSP) +Returns the `KSP` context for a `SNES` solver. + +Not Collective, but if `snes` is parallel, then `ksp` is parallel + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `ksp` - the `KSP` context + +Level: beginner + +-seealso: [](ch_snes), `SNES`, `KSP`, `PC`, `KSPGetPC()`, `SNESCreate()`, `KSPCreate()`, `SNESSetKSP()` + +# External Links +$(_doc_external("SNES/SNESGetKSP")) +""" +function SNESGetKSP(petsclib::PetscLibType, snes::PetscSNES, ksp::PetscKSP) end + +@for_petsc function SNESGetKSP(petsclib::$UnionPetscLib, snes::PetscSNES, ksp::PetscKSP ) + ksp_ = Ref(ksp.ptr) + + @chk ccall( + (:SNESGetKSP, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CKSP}), + snes, ksp_, + ) + + ksp.ptr = C_NULL + + return nothing +end + +""" + SNESSetDM(petsclib::PetscLibType,snes::PetscSNES, dm::PetscDM) +Sets the `DM` that may be used by some `SNES` nonlinear solvers or their underlying preconditioners + +Logically Collective + +Input Parameters: +- `snes` - the nonlinear solver context +- `dm` - the `DM`, cannot be `NULL` + +Level: intermediate + +-seealso: [](ch_snes), `DM`, `SNES`, `SNESGetDM()`, `KSPSetDM()`, `KSPGetDM()` + +# External Links +$(_doc_external("SNES/SNESSetDM")) +""" +function SNESSetDM(petsclib::PetscLibType, snes::PetscSNES, dm::PetscDM) end + +@for_petsc function SNESSetDM(petsclib::$UnionPetscLib, snes::PetscSNES, dm::PetscDM ) + + @chk ccall( + (:SNESSetDM, $petsc_library), + PetscErrorCode, + (CSNES, CDM), + snes, dm, + ) + + + return nothing +end + +""" + dm::PetscDM = SNESGetDM(petsclib::PetscLibType,snes::PetscSNES) +Gets the `DM` that may be used by some `SNES` nonlinear solvers/preconditioners + +Not Collective but `dm` obtained is parallel on `snes` + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `dm` - the `DM` + +Level: intermediate + +-seealso: [](ch_snes), `DM`, `SNES`, `SNESSetDM()`, `KSPSetDM()`, `KSPGetDM()` + +# External Links +$(_doc_external("SNES/SNESGetDM")) +""" +function SNESGetDM(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESGetDM(petsclib::$UnionPetscLib, snes::PetscSNES) + dm_ = Ref{CDM}() + + @chk ccall( + (:SNESGetDM, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CDM}), + snes, dm_, + ) + + dm = PetscDM(dm_[], petsclib) + + return dm +end + +""" + SNESSetNPC(petsclib::PetscLibType,snes::PetscSNES, npc::PetscSNES) +Sets the nonlinear preconditioner to be used. + +Collective + +Input Parameters: +- `snes` - iterative context obtained from `SNESCreate()` +- `npc` - the `SNES` nonlinear preconditioner object + +Options Database Key: +- `-npc_snes_type ` - set the type of the `SNES` to use as the nonlinear preconditioner + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESNGS`, `SNESFAS`, `SNESGetNPC()`, `SNESHasNPC()` + +# External Links +$(_doc_external("SNES/SNESSetNPC")) +""" +function SNESSetNPC(petsclib::PetscLibType, snes::PetscSNES, npc::PetscSNES) end + +@for_petsc function SNESSetNPC(petsclib::$UnionPetscLib, snes::PetscSNES, npc::PetscSNES ) + + @chk ccall( + (:SNESSetNPC, $petsc_library), + PetscErrorCode, + (CSNES, CSNES), + snes, npc, + ) + + + return nothing +end + +""" + SNESGetNPC(petsclib::PetscLibType,snes::PetscSNES, pc::PetscSNES) +Gets a nonlinear preconditioning solver SNES` to be used to precondition the original nonlinear solver. + +Not Collective; but any changes to the obtained the `pc` object must be applied collectively + +Input Parameter: +- `snes` - iterative context obtained from `SNESCreate()` + +Output Parameter: +- `pc` - the `SNES` preconditioner context + +Options Database Key: +- `-npc_snes_type ` - set the type of the `SNES` to use as the nonlinear preconditioner + +Level: advanced + +-seealso: [](ch_snes), `SNESSetNPC()`, `SNESHasNPC()`, `SNES`, `SNESCreate()` + +# External Links +$(_doc_external("SNES/SNESGetNPC")) +""" +function SNESGetNPC(petsclib::PetscLibType, snes::PetscSNES, pc::PetscSNES) end + +@for_petsc function SNESGetNPC(petsclib::$UnionPetscLib, snes::PetscSNES, pc::PetscSNES ) + pc_ = Ref(pc.ptr) + + @chk ccall( + (:SNESGetNPC, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CSNES}), + snes, pc_, + ) + + pc.ptr = C_NULL + + return nothing +end + +""" + has_npc::PetscBool = SNESHasNPC(petsclib::PetscLibType,snes::PetscSNES) +Returns whether a nonlinear preconditioner is associated with the given `SNES` + +Not Collective + +Input Parameter: +- `snes` - iterative context obtained from `SNESCreate()` + +Output Parameter: +- `has_npc` - whether the `SNES` has a nonlinear preconditioner or not + +Level: developer + +-seealso: [](ch_snes), `SNESSetNPC()`, `SNESGetNPC()` + +# External Links +$(_doc_external("SNES/SNESHasNPC")) +""" +function SNESHasNPC(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESHasNPC(petsclib::$UnionPetscLib, snes::PetscSNES ) + has_npc_ = Ref{PetscBool}() + + @chk ccall( + (:SNESHasNPC, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, has_npc_, + ) + + has_npc = has_npc_[] + + return has_npc +end + +""" + SNESSetNPCSide(petsclib::PetscLibType,snes::PetscSNES, side::PCSide) +Sets the nonlinear preconditioning side used by the nonlinear preconditioner inside `SNES`. + +Logically Collective + +Input Parameter: +- `snes` - iterative context obtained from `SNESCreate()` + +Output Parameter: +- `side` - the preconditioning side, where side is one of +-seealso: [](ch_snes), `SNES`, `SNESGetNPC()`, `SNESNRICHARDSON`, `SNESNCG`, `SNESType`, `SNESGetNPCSide()`, `KSPSetPCSide()`, `PC_LEFT`, `PC_RIGHT`, `PCSide` + +# External Links +$(_doc_external("SNES/SNESSetNPCSide")) +""" +function SNESSetNPCSide(petsclib::PetscLibType, snes::PetscSNES, side::PCSide) end + +@for_petsc function SNESSetNPCSide(petsclib::$UnionPetscLib, snes::PetscSNES, side::PCSide ) + + @chk ccall( + (:SNESSetNPCSide, $petsc_library), + PetscErrorCode, + (CSNES, PCSide), + snes, side, + ) + + + return nothing +end + +""" + SNESGetNPCSide(petsclib::PetscLibType,snes::PetscSNES, side::PCSide) +Gets the preconditioning side used by the nonlinear preconditioner inside `SNES`. + +Not Collective + +Input Parameter: +- `snes` - iterative context obtained from `SNESCreate()` + +Output Parameter: +- `side` - the preconditioning side, where side is one of +-seealso: [](ch_snes), `SNES`, `SNESGetNPC()`, `SNESSetNPCSide()`, `KSPGetPCSide()`, `PC_LEFT`, `PC_RIGHT`, `PCSide` + +# External Links +$(_doc_external("SNES/SNESGetNPCSide")) +""" +function SNESGetNPCSide(petsclib::PetscLibType, snes::PetscSNES, side::PCSide) end + +@for_petsc function SNESGetNPCSide(petsclib::$UnionPetscLib, snes::PetscSNES, side::PCSide ) + + @chk ccall( + (:SNESGetNPCSide, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PCSide}), + snes, side, + ) + + + return nothing +end + +""" + SNESSetLineSearch(petsclib::PetscLibType,snes::PetscSNES, linesearch::SNESLineSearch) +Sets the `SNESLineSearch` to be used for a given `SNES` + +Collective + +Input Parameters: +- `snes` - iterative context obtained from `SNESCreate()` +- `linesearch` - the linesearch object + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch`, `SNESGetLineSearch()` + +# External Links +$(_doc_external("SNES/SNESSetLineSearch")) +""" +function SNESSetLineSearch(petsclib::PetscLibType, snes::PetscSNES, linesearch::SNESLineSearch) end + +@for_petsc function SNESSetLineSearch(petsclib::$UnionPetscLib, snes::PetscSNES, linesearch::SNESLineSearch ) + + @chk ccall( + (:SNESSetLineSearch, $petsc_library), + PetscErrorCode, + (CSNES, SNESLineSearch), + snes, linesearch, + ) + + + return nothing +end + +""" + SNESGetLineSearch(petsclib::PetscLibType,snes::PetscSNES, linesearch::SNESLineSearch) +Returns the line search associated with the `SNES`. + +Not Collective + +Input Parameter: +- `snes` - iterative context obtained from `SNESCreate()` + +Output Parameter: +- `linesearch` - linesearch context + +Level: beginner + +-seealso: [](ch_snes), `SNESLineSearch`, `SNESSetLineSearch()`, `SNESLineSearchCreate()`, `SNESLineSearchSetFromOptions()` + +# External Links +$(_doc_external("SNES/SNESGetLineSearch")) +""" +function SNESGetLineSearch(petsclib::PetscLibType, snes::PetscSNES, linesearch::SNESLineSearch) end + +@for_petsc function SNESGetLineSearch(petsclib::$UnionPetscLib, snes::PetscSNES, linesearch::SNESLineSearch ) + + @chk ccall( + (:SNESGetLineSearch, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESLineSearch}), + snes, linesearch, + ) + + + return nothing +end + +""" + SNESComputeJacobianDefault(petsclib::PetscLibType,snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid) +Computes the Jacobian using finite differences. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `x1` - compute Jacobian at this point +- `ctx` - application's function context, as set with `SNESSetFunction()` + +Output Parameters: +- `J` - Jacobian matrix (not altered in this routine) +- `B` - newly computed Jacobian matrix to use with preconditioner (generally the same as `J`) + +Options Database Keys: +- `-snes_fd` - Activates `SNESComputeJacobianDefault()` +- `-snes_fd_coloring` - Activates a faster computation that uses a graph coloring of the matrix +- `-snes_test_err` - Square root of function error tolerance, default square root of machine +epsilon (1.e-8 in double, 3.e-4 in single) +- `-mat_fd_type` - Either wp or ds (see `MATMFFD_WP` or `MATMFFD_DS`) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESSetJacobian()`, `SNESComputeJacobianDefaultColor()`, `MatCreateSNESMF()` + +# External Links +$(_doc_external("SNES/SNESComputeJacobianDefault")) +""" +function SNESComputeJacobianDefault(petsclib::PetscLibType, snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid) end + +@for_petsc function SNESComputeJacobianDefault(petsclib::$UnionPetscLib, snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid ) + + @chk ccall( + (:SNESComputeJacobianDefault, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CMat, CMat, Ptr{Cvoid}), + snes, x1, J, B, ctx, + ) + + + return nothing +end + +""" + SNESApplyNPC(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, f::PetscVec, y::PetscVec) +Calls `SNESSolve()` on the preconditioner for the `SNES` + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `x` - input vector +- `f` - optional; the function evaluation on `x` + +Output Parameter: +- `y` - function vector, as set by `SNESSetFunction()` + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESGetNPC()`, `SNESSetNPC()`, `SNESComputeFunction()` + +# External Links +$(_doc_external("SNES/SNESApplyNPC")) +""" +function SNESApplyNPC(petsclib::PetscLibType, snes::PetscSNES, x::PetscVec, f::PetscVec, y::PetscVec) end + +@for_petsc function SNESApplyNPC(petsclib::$UnionPetscLib, snes::PetscSNES, x::PetscVec, f::PetscVec, y::PetscVec ) + + @chk ccall( + (:SNESApplyNPC, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, CVec), + snes, x, f, y, + ) + + + return nothing +end + +""" + SNESComputeFunctionDefaultNPC(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec) + +# External Links +$(_doc_external("SNES/SNESComputeFunctionDefaultNPC")) +""" +function SNESComputeFunctionDefaultNPC(petsclib::PetscLibType, snes::PetscSNES, X::PetscVec, F::PetscVec) end + +@for_petsc function SNESComputeFunctionDefaultNPC(petsclib::$UnionPetscLib, snes::PetscSNES, X::PetscVec, F::PetscVec ) + + @chk ccall( + (:SNESComputeFunctionDefaultNPC, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec), + snes, X, F, + ) + + + return nothing +end + +""" + fnorm::PetscReal = SNESGetNPCFunction(petsclib::PetscLibType,snes::PetscSNES, F::PetscVec) +Gets the current function value and its norm from a nonlinear preconditioner after `SNESSolve()` has been called on that `SNES` + +Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `F` - function vector +- `fnorm` - the norm of `F` + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESGetNPC()`, `SNESSetNPC()`, `SNESComputeFunction()`, `SNESApplyNPC()`, `SNESSolve()` + +# External Links +$(_doc_external("SNES/SNESGetNPCFunction")) +""" +function SNESGetNPCFunction(petsclib::PetscLibType, snes::PetscSNES, F::PetscVec) end + +@for_petsc function SNESGetNPCFunction(petsclib::$UnionPetscLib, snes::PetscSNES, F::PetscVec ) + fnorm_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESGetNPCFunction, $petsc_library), + PetscErrorCode, + (CSNES, CVec, Ptr{$PetscReal}), + snes, F, fnorm_, + ) + + fnorm = fnorm_[] + + return fnorm +end + +""" + SNESSetObjective(petsclib::PetscLibType,snes::PetscSNES, obj::SNESObjectiveFn, ctx::Cvoid) +Sets the objective function minimized by some of the `SNES` linesearch methods, used instead of the 2 + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `obj` - objective evaluation routine; see `SNESObjectiveFn` for the calling sequence +- `ctx` - [optional] user-defined context for private data for the objective evaluation routine (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESLineSearch()`, `SNESGetObjective()`, `SNESComputeObjective()`, `SNESSetFunction()`, `SNESSetJacobian()`, +`SNESObjectiveFn` + +# External Links +$(_doc_external("SNES/SNESSetObjective")) +""" +function SNESSetObjective(petsclib::PetscLibType, snes::PetscSNES, obj::SNESObjectiveFn, ctx::Cvoid) end + +@for_petsc function SNESSetObjective(petsclib::$UnionPetscLib, snes::PetscSNES, obj::SNESObjectiveFn, ctx::Cvoid ) + + @chk ccall( + (:SNESSetObjective, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESObjectiveFn}, Ptr{Cvoid}), + snes, obj, ctx, + ) + + + return nothing +end + +""" + SNESGetObjective(petsclib::PetscLibType,snes::PetscSNES, obj::SNESObjectiveFn, ctx::Cvoid) +Returns the objective function set with `SNESSetObjective()` + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `obj` - objective evaluation routine (or `NULL`); see `SNESObjectiveFn` for the calling sequence +- `ctx` - the function context (or `NULL`) + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSetObjective()`, `SNESGetSolution()`, `SNESObjectiveFn` + +# External Links +$(_doc_external("SNES/SNESGetObjective")) +""" +function SNESGetObjective(petsclib::PetscLibType, snes::PetscSNES, obj::SNESObjectiveFn, ctx::Cvoid) end + +@for_petsc function SNESGetObjective(petsclib::$UnionPetscLib, snes::PetscSNES, obj::SNESObjectiveFn, ctx::Cvoid ) + + @chk ccall( + (:SNESGetObjective, $petsc_library), + PetscErrorCode, + (CSNES, SNESObjectiveFn, Cvoid), + snes, obj, ctx, + ) + + + return nothing +end + +""" + ob::PetscReal = SNESComputeObjective(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec) +Computes the objective function that has been provided by `SNESSetObjective()` + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `X` - the state vector + +Output Parameter: +- `ob` - the objective value + +Level: developer + +-seealso: [](ch_snes), `SNESLineSearch`, `SNES`, `SNESSetObjective()`, `SNESGetSolution()` + +# External Links +$(_doc_external("SNES/SNESComputeObjective")) +""" +function SNESComputeObjective(petsclib::PetscLibType, snes::PetscSNES, X::PetscVec) end + +@for_petsc function SNESComputeObjective(petsclib::$UnionPetscLib, snes::PetscSNES, X::PetscVec ) + ob_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESComputeObjective, $petsc_library), + PetscErrorCode, + (CSNES, CVec, Ptr{$PetscReal}), + snes, X, ob_, + ) + + ob = ob_[] + + return ob +end + +""" + SNESObjectiveComputeFunctionDefaultFD(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec, ctx::Cvoid) +Computes the gradient of a user provided objective function + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `X` - the state vector +- `ctx` - the (ignored) function context + +Output Parameter: +- `F` - the function value + +Options Database Keys: +- `-snes_fd_function_eps` - Tolerance for including non-zero entries into the gradient, default is 1.e-6 +- `-snes_fd_function` - Computes function from user provided objective function (set with `SNESSetObjective()`) with finite difference + +Level: advanced + +-seealso: [](ch_snes), `SNESSetObjective()`, `SNESSetFunction()`, `SNESComputeObjective()`, `SNESComputeJacobianDefault()`, `SNESObjectiveFn` + +# External Links +$(_doc_external("SNES/SNESObjectiveComputeFunctionDefaultFD")) +""" +function SNESObjectiveComputeFunctionDefaultFD(petsclib::PetscLibType, snes::PetscSNES, X::PetscVec, F::PetscVec, ctx::Cvoid) end + +@for_petsc function SNESObjectiveComputeFunctionDefaultFD(petsclib::$UnionPetscLib, snes::PetscSNES, X::PetscVec, F::PetscVec, ctx::Cvoid ) + + @chk ccall( + (:SNESObjectiveComputeFunctionDefaultFD, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, Ptr{Cvoid}), + snes, X, F, ctx, + ) + + + return nothing +end + +""" + SNESComputeJacobianDefaultColor(petsclib::PetscLibType,snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid) +Computes the Jacobian using +finite differences and coloring to exploit matrix sparsity. + +Collective + +Input Parameters: +- `snes` - nonlinear solver object +- `x1` - location at which to evaluate Jacobian +- `ctx` - `MatFDColoring` context or `NULL` + +Output Parameters: +- `J` - Jacobian matrix (not altered in this routine) +- `B` - newly computed Jacobian matrix to use with preconditioner (generally the same as `J`) + +Options Database Keys: +- `-snes_fd_color_use_mat` - use a matrix coloring from the explicit matrix nonzero pattern instead of from the `DM` providing the matrix +- `-snes_fd_color` - Activates `SNESComputeJacobianDefaultColor()` in `SNESSetFromOptions()` +- `-mat_fd_coloring_err ` - Sets (square root of relative error in the function) +- `-mat_fd_coloring_umin ` - Sets umin, the minimum allowable u-value magnitude +- `-mat_fd_type` - Either wp or ds (see `MATMFFD_WP` or `MATMFFD_DS`) +- `-snes_mf_operator` - Use matrix-free application of Jacobian +- `-snes_mf` - Use matrix-free Jacobian with no explicit Jacobian representation + +-seealso: [](ch_snes), `SNES`, `SNESSetJacobian()`, `SNESTestJacobian()`, `SNESComputeJacobianDefault()`, `SNESSetUseMatrixFree()`, +`MatFDColoringCreate()`, `MatFDColoringSetFunction()` + +# External Links +$(_doc_external("SNES/SNESComputeJacobianDefaultColor")) +""" +function SNESComputeJacobianDefaultColor(petsclib::PetscLibType, snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid) end + +@for_petsc function SNESComputeJacobianDefaultColor(petsclib::$UnionPetscLib, snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid ) + + @chk ccall( + (:SNESComputeJacobianDefaultColor, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CMat, CMat, Ptr{Cvoid}), + snes, x1, J, B, ctx, + ) + + + return nothing +end + +""" + SNESPruneJacobianColor(petsclib::PetscLibType,snes::PetscSNES, J::PetscMat, B::PetscMat) +Remove nondiagonal zeros in the Jacobian matrix and update the `MatMFFD` coloring information based on the new nonzero structure + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `J` - Jacobian matrix (not altered in this routine) +- `B` - newly computed Jacobian matrix to use with preconditioner (generally the same as `J`) + +Level: intermediate + +-seealso: [](ch_snes), `SNESComputeJacobianDefaultColor()`, `MatEliminateZeros()`, `MatFDColoringCreate()`, `MatFDColoringSetFunction()` + +# External Links +$(_doc_external("SNES/SNESPruneJacobianColor")) +""" +function SNESPruneJacobianColor(petsclib::PetscLibType, snes::PetscSNES, J::PetscMat, B::PetscMat) end + +@for_petsc function SNESPruneJacobianColor(petsclib::$UnionPetscLib, snes::PetscSNES, J::PetscMat, B::PetscMat ) + + @chk ccall( + (:SNESPruneJacobianColor, $petsc_library), + PetscErrorCode, + (CSNES, CMat, CMat), + snes, J, B, + ) + + + return nothing +end + +""" + ctx::Cvoid = SNESMonitorSAWsCreate(petsclib::PetscLibType,snes::PetscSNES) +create an SAWs monitor context for `SNES` + +Collective + +Input Parameter: +- `snes` - `SNES` to monitor + +Output Parameter: +- `ctx` - context for monitor + +Level: developer + +-seealso: [](ch_snes), `SNESMonitorSet()`, `SNES`, `SNESMonitorSAWs()`, `SNESMonitorSAWsDestroy()` + +# External Links +$(_doc_external("SNES/SNESMonitorSAWsCreate")) +""" +function SNESMonitorSAWsCreate(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESMonitorSAWsCreate(petsclib::$UnionPetscLib, snes::PetscSNES ) + ctx_ = Ref{Cvoid}() + + @chk ccall( + (:SNESMonitorSAWsCreate, $petsc_library), + PetscErrorCode, + (CSNES, Cvoid), + snes, ctx_, + ) + + ctx = ctx_[] + + return ctx +end + +""" + SNESMonitorSAWsDestroy(petsclib::PetscLibType,ctx::Cvoid) +destroy a monitor context created with `SNESMonitorSAWsCreate()` + +Collective + +Input Parameter: +- `ctx` - monitor context + +Level: developer + +-seealso: [](ch_snes), `SNESMonitorSAWsCreate()` + +# External Links +$(_doc_external("SNES/SNESMonitorSAWsDestroy")) +""" +function SNESMonitorSAWsDestroy(petsclib::PetscLibType, ctx::Cvoid) end + +@for_petsc function SNESMonitorSAWsDestroy(petsclib::$UnionPetscLib, ctx::Cvoid ) + + @chk ccall( + (:SNESMonitorSAWsDestroy, $petsc_library), + PetscErrorCode, + (Cvoid,), + ctx, + ) + + + return nothing +end + +""" + SNESMonitorSAWs(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, rnorm::PetscReal, ctx::Cvoid) +monitor solution process of `SNES` using SAWs + +Collective + +Input Parameters: +- `snes` - iterative context +- `n` - iteration number +- `rnorm` - 2-norm (preconditioned) residual value (may be estimated). +- `ctx` - `PetscViewer` of type `PETSCVIEWERSAWS` + +Level: advanced + +-seealso: [](ch_snes), `PetscViewerSAWsOpen()`, `SNESMonitorSAWsDestroy()`, `SNESMonitorSAWsCreate()` + +# External Links +$(_doc_external("SNES/SNESMonitorSAWs")) +""" +function SNESMonitorSAWs(petsclib::PetscLibType, snes::PetscSNES, n::PetscInt, rnorm::PetscReal, ctx::Cvoid) end + +@for_petsc function SNESMonitorSAWs(petsclib::$UnionPetscLib, snes::PetscSNES, n::$PetscInt, rnorm::$PetscReal, ctx::Cvoid ) + + @chk ccall( + (:SNESMonitorSAWs, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{Cvoid}), + snes, n, rnorm, ctx, + ) + + + return nothing +end + +""" + SNESNGMRESSetRestartFmRise(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool) +Increase the restart count if the step x_M increases the residual F_M inside a `SNESNGMRES` solve + +Input Parameters: +- `snes` - the `SNES` context. +- `flg` - boolean value deciding whether to use the option or not, default is `PETSC_FALSE` + +Options Database Key: +- `-snes_ngmres_restart_fm_rise` - Increase the restart count if the step x_M increases the residual F_M + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNES_NGMRES_RESTART_DIFFERENCE`, `SNESNGMRES`, `SNESNGMRESRestartType`, `SNESNGMRESSetRestartType()` + +# External Links +$(_doc_external("SNES/SNESNGMRESSetRestartFmRise")) +""" +function SNESNGMRESSetRestartFmRise(petsclib::PetscLibType, snes::PetscSNES, flg::PetscBool) end + +@for_petsc function SNESNGMRESSetRestartFmRise(petsclib::$UnionPetscLib, snes::PetscSNES, flg::PetscBool ) + + @chk ccall( + (:SNESNGMRESSetRestartFmRise, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, flg, + ) + + + return nothing +end + +""" + flg::PetscBool = SNESNGMRESGetRestartFmRise(petsclib::PetscLibType,snes::PetscSNES) + +# External Links +$(_doc_external("SNES/SNESNGMRESGetRestartFmRise")) +""" +function SNESNGMRESGetRestartFmRise(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESNGMRESGetRestartFmRise(petsclib::$UnionPetscLib, snes::PetscSNES ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:SNESNGMRESGetRestartFmRise, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + SNESNGMRESSetRestartType(petsclib::PetscLibType,snes::PetscSNES, rtype::SNESNGMRESRestartType) +Sets the restart type for `SNESNGMRES`. + +Logically Collective + +Input Parameters: +- `snes` - the iterative context +- `rtype` - restart type, see `SNESNGMRESRestartType` + +Options Database Keys: +- `-snes_ngmres_restart_type` - set the restart type +- `-snes_ngmres_restart <30>` - sets the number of iterations before restart for periodic + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNES_NGMRES_RESTART_DIFFERENCE`, `SNESNGMRES`, `SNESNGMRESRestartType`, `SNESNGMRESSetRestartFmRise()`, +`SNESNGMRESSetSelectType()` + +# External Links +$(_doc_external("SNES/SNESNGMRESSetRestartType")) +""" +function SNESNGMRESSetRestartType(petsclib::PetscLibType, snes::PetscSNES, rtype::SNESNGMRESRestartType) end + +@for_petsc function SNESNGMRESSetRestartType(petsclib::$UnionPetscLib, snes::PetscSNES, rtype::SNESNGMRESRestartType ) + + @chk ccall( + (:SNESNGMRESSetRestartType, $petsc_library), + PetscErrorCode, + (CSNES, SNESNGMRESRestartType), + snes, rtype, + ) + + + return nothing +end + +""" + SNESNGMRESSetSelectType(petsclib::PetscLibType,snes::PetscSNES, stype::SNESNGMRESSelectType) +Sets the selection type for `SNESNGMRES`. This determines how the candidate solution and +combined solution are used to create the next iterate. + +Logically Collective + +Input Parameters: +- `snes` - the iterative context +- `stype` - selection type, see `SNESNGMRESSelectType` + +Options Database Key: +- `-snes_ngmres_select_type` - select type + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNGMRES`, `SNESNGMRESSelectType`, `SNES_NGMRES_SELECT_NONE`, `SNES_NGMRES_SELECT_DIFFERENCE`, `SNES_NGMRES_SELECT_LINESEARCH`, +`SNESNGMRESSetRestartType()` + +# External Links +$(_doc_external("SNES/SNESNGMRESSetSelectType")) +""" +function SNESNGMRESSetSelectType(petsclib::PetscLibType, snes::PetscSNES, stype::SNESNGMRESSelectType) end + +@for_petsc function SNESNGMRESSetSelectType(petsclib::$UnionPetscLib, snes::PetscSNES, stype::SNESNGMRESSelectType ) + + @chk ccall( + (:SNESNGMRESSetSelectType, $petsc_library), + PetscErrorCode, + (CSNES, SNESNGMRESSelectType), + snes, stype, + ) + + + return nothing +end + +""" + SNESVISetComputeVariableBounds(petsclib::PetscLibType,snes::PetscSNES, compute::external) +Sets a function that is called to compute the bounds on variable for +(differential) variable inequalities. + +Input Parameters: +- `snes` - the `SNES` context +- `compute` - function that computes the bounds + +Calling sequence of `compute`: +- `snes` - the `SNES` context +- `lower` - vector to hold lower bounds +- `higher` - vector to hold upper bounds + +Level: advanced + +-seealso: [](sec_vi), `SNES`, `SNESVISetVariableBounds()`, `DMSetVariableBounds()`, `SNESSetFunctionDomainError()`, `SNESSetJacobianDomainError()`, `SNESVINEWTONRSLS`, `SNESVINEWTONSSLS`, +`SNESSetType()`, `PETSC_NINFINITY`, `PETSC_INFINITY` + +# External Links +$(_doc_external("SNES/SNESVISetComputeVariableBounds")) +""" +function SNESVISetComputeVariableBounds(petsclib::PetscLibType, snes::PetscSNES, compute::external) end + +@for_petsc function SNESVISetComputeVariableBounds(petsclib::$UnionPetscLib, snes::PetscSNES, compute::external ) + + @chk ccall( + (:SNESVISetComputeVariableBounds, $petsc_library), + PetscErrorCode, + (CSNES, external), + snes, compute, + ) + + + return nothing +end + +""" + SNESVIGetActiveSetIS(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec, ISact::IS) +Gets the global indices for the active set variables + +Input Parameters: +- `snes` - the `SNES` context +- `X` - the `snes` solution vector +- `F` - the nonlinear function vector + +Output Parameter: +- `ISact` - active set index set + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESVINEWTONRSLS`, `SNESVINEWTONSSLS` + +# External Links +$(_doc_external("SNES/SNESVIGetActiveSetIS")) +""" +function SNESVIGetActiveSetIS(petsclib::PetscLibType, snes::PetscSNES, X::PetscVec, F::PetscVec, ISact::IS) end + +@for_petsc function SNESVIGetActiveSetIS(petsclib::$UnionPetscLib, snes::PetscSNES, X::PetscVec, F::PetscVec, ISact::IS ) + + @chk ccall( + (:SNESVIGetActiveSetIS, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, Ptr{CIS}), + snes, X, F, ISact, + ) + + + return nothing +end + +""" + fnorm::PetscReal = SNESVIComputeInactiveSetFnorm(petsclib::PetscLibType,snes::PetscSNES, F::PetscVec, X::PetscVec) +Computes the function norm for variational inequalities on the inactive set + +Input Parameters: +- `snes` - the `SNES` context +- `F` - the nonlinear function vector +- `X` - the `SNES` solution vector + +Output Parameter: +- `fnorm` - the function norm + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESVINEWTONRSLS`, `SNESVINEWTONSSLS`, `SNESLineSearchSetVIFunctions()` + +# External Links +$(_doc_external("SNES/SNESVIComputeInactiveSetFnorm")) +""" +function SNESVIComputeInactiveSetFnorm(petsclib::PetscLibType, snes::PetscSNES, F::PetscVec, X::PetscVec) end + +@for_petsc function SNESVIComputeInactiveSetFnorm(petsclib::$UnionPetscLib, snes::PetscSNES, F::PetscVec, X::PetscVec ) + fnorm_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESVIComputeInactiveSetFnorm, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, Ptr{$PetscReal}), + snes, F, X, fnorm_, + ) + + fnorm = fnorm_[] + + return fnorm +end + +""" + fty::PetscScalar = SNESVIComputeInactiveSetFtY(petsclib::PetscLibType,snes::PetscSNES, F::PetscVec, X::PetscVec, Y::PetscVec) +Computes the directional derivative for variational inequalities on the inactive set, +assuming that there exists some G(x) for which the `SNESFunctionFn` F(x) = grad G(x) (relevant for some line search algorithms) + +Input Parameters: +- `snes` - the `SNES` context +- `F` - the nonlinear function vector +- `X` - the `SNES` solution vector +- `Y` - the direction vector + +Output Parameter: +- `fty` - the directional derivative + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESVINEWTONRSLS`, `SNESVINEWTONSSLS` + +# External Links +$(_doc_external("SNES/SNESVIComputeInactiveSetFtY")) +""" +function SNESVIComputeInactiveSetFtY(petsclib::PetscLibType, snes::PetscSNES, F::PetscVec, X::PetscVec, Y::PetscVec) end + +@for_petsc function SNESVIComputeInactiveSetFtY(petsclib::$UnionPetscLib, snes::PetscSNES, F::PetscVec, X::PetscVec, Y::PetscVec ) + fty_ = Ref{$PetscScalar}() + + @chk ccall( + (:SNESVIComputeInactiveSetFtY, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, CVec, Ptr{$PetscScalar}), + snes, F, X, Y, fty_, + ) + + fty = fty_[] + + return fty +end + +""" + SNESVISetVariableBounds(petsclib::PetscLibType,snes::PetscSNES, xl::PetscVec, xu::PetscVec) +Sets the lower and upper bounds for the solution vector. `xl` <= x <= `xu`. This allows solving +(differential) variable inequalities. + +Input Parameters: +- `snes` - the `SNES` context. +- `xl` - lower bound. +- `xu` - upper bound. + +Level: advanced + +-seealso: [](sec_vi), `SNES`, `SNESVIGetVariableBounds()`, `SNESVISetComputeVariableBounds()`, `SNESSetFunctionDomainError()`, `SNESSetJacobianDomainError()`, `SNESVINEWTONRSLS`, `SNESVINEWTONSSLS`, `SNESSetType()`, `PETSC_NINFINITY`, `PETSC_INFINITY` + +# External Links +$(_doc_external("SNES/SNESVISetVariableBounds")) +""" +function SNESVISetVariableBounds(petsclib::PetscLibType, snes::PetscSNES, xl::PetscVec, xu::PetscVec) end + +@for_petsc function SNESVISetVariableBounds(petsclib::$UnionPetscLib, snes::PetscSNES, xl::PetscVec, xu::PetscVec ) + + @chk ccall( + (:SNESVISetVariableBounds, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec), + snes, xl, xu, + ) + + + return nothing +end + +""" + SNESVIGetVariableBounds(petsclib::PetscLibType,snes::PetscSNES, xl::PetscVec, xu::PetscVec) +Gets the lower and upper bounds for the solution vector. `xl` <= x <= `xu`. These are used in solving +(differential) variable inequalities. + +Input Parameters: +- `snes` - the `SNES` context. +- `xl` - lower bound (may be `NULL`) +- `xu` - upper bound (may be `NULL`) + +Level: advanced + +-seealso: [](sec_vi), `SNES`, `SNESVISetVariableBounds()`, `SNESVISetComputeVariableBounds()`, `SNESSetFunctionDomainError()`, `SNESSetJacobianDomainError()`, `SNESVINEWTONRSLS`, `SNESVINEWTONSSLS`, `SNESSetType()`, `PETSC_NINFINITY`, `PETSC_INFINITY` + +# External Links +$(_doc_external("SNES/SNESVIGetVariableBounds")) +""" +function SNESVIGetVariableBounds(petsclib::PetscLibType, snes::PetscSNES, xl::PetscVec, xu::PetscVec) end + +@for_petsc function SNESVIGetVariableBounds(petsclib::$UnionPetscLib, snes::PetscSNES, xl::PetscVec, xu::PetscVec ) + xl_ = Ref(xl.ptr) + xu_ = Ref(xu.ptr) + + @chk ccall( + (:SNESVIGetVariableBounds, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CVec}, Ptr{CVec}), + snes, xl_, xu_, + ) + + xl.ptr = C_NULL + xu.ptr = C_NULL + + return nothing +end + +""" + SNESVIGetInactiveSet(petsclib::PetscLibType,snes::PetscSNES, inact::IS) +Gets the global indices for the inactive set variables (these correspond to the degrees of freedom the linear +system is solved on) + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `inact` - inactive set index set + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESVINEWTONRSLS` + +# External Links +$(_doc_external("SNES/SNESVIGetInactiveSet")) +""" +function SNESVIGetInactiveSet(petsclib::PetscLibType, snes::PetscSNES, inact::IS) end + +@for_petsc function SNESVIGetInactiveSet(petsclib::$UnionPetscLib, snes::PetscSNES, inact::IS ) + + @chk ccall( + (:SNESVIGetInactiveSet, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CIS}), + snes, inact, + ) + + + return nothing +end + +""" + SNESVISetRedundancyCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid) +Provide a function to check for any redundancy in the VI active set + +Logically Collective + +Input Parameters: +- `snes` - the `SNESVINEWTONRSLS` context +- `func` - the function to check of redundancies +- `ctx` - optional context used by the function + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESVINEWTONRSLS`, `SNESVIGetInactiveSet()`, `DMSetVI()` + +# External Links +$(_doc_external("SNES/SNESVISetRedundancyCheck")) +""" +function SNESVISetRedundancyCheck(petsclib::PetscLibType, snes::PetscSNES, func::external, ctx::Cvoid) end + +@for_petsc function SNESVISetRedundancyCheck(petsclib::$UnionPetscLib, snes::PetscSNES, func::external, ctx::Cvoid ) + + @chk ccall( + (:SNESVISetRedundancyCheck, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{Cvoid}), + snes, func, ctx, + ) + + + return nothing +end + +""" + merit::PetscReal,phinorm::PetscReal = SNESVIComputeMeritFunction(petsclib::PetscLibType,phi::PetscVec) +Evaluates the merit function for the mixed complementarity problem. + +Input Parameter: +- `phi` - the `Vec` holding the evaluation of the semismooth function + +Output Parameters: +- `merit` - the merit function 1/2 ||phi||^2 +- `phinorm` - the two-norm of the vector, ||phi|| + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESVINEWTONSSLS`, `SNESVIComputeFunction()` + +# External Links +$(_doc_external("SNES/SNESVIComputeMeritFunction")) +""" +function SNESVIComputeMeritFunction(petsclib::PetscLibType, phi::PetscVec) end + +@for_petsc function SNESVIComputeMeritFunction(petsclib::$UnionPetscLib, phi::PetscVec ) + merit_ = Ref{$PetscReal}() + phinorm_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESVIComputeMeritFunction, $petsc_library), + PetscErrorCode, + (CVec, Ptr{$PetscReal}, Ptr{$PetscReal}), + phi, merit_, phinorm_, + ) + + merit = merit_[] + phinorm = phinorm_[] + + return merit,phinorm +end + +""" + SNESVIComputeFunction(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, phi::PetscVec, functx::Cvoid) +Provides the function that reformulates a system of nonlinear equations in mixed complementarity form to a system of nonlinear +equations in semismooth form. + +Input Parameters: +- `snes` - the `SNES` context +- `X` - current iterate +- `functx` - user defined function context + +Output Parameter: +- `phi` - the evaluation of semismooth function at `X` + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESVINEWTONSSLS`, `SNESVIComputeMeritFunction()` + +# External Links +$(_doc_external("SNES/SNESVIComputeFunction")) +""" +function SNESVIComputeFunction(petsclib::PetscLibType, snes::PetscSNES, X::PetscVec, phi::PetscVec, functx::Cvoid) end + +@for_petsc function SNESVIComputeFunction(petsclib::$UnionPetscLib, snes::PetscSNES, X::PetscVec, phi::PetscVec, functx::Cvoid ) + + @chk ccall( + (:SNESVIComputeFunction, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, Ptr{Cvoid}), + snes, X, phi, functx, + ) + + + return nothing +end + +""" + SNESMSRegisterAll(petsclib::PetscLibType) +Registers all of the multi + +Logically Collective + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESMS`, `SNESMSRegisterDestroy()` + +# External Links +$(_doc_external("SNES/SNESMSRegisterAll")) +""" +function SNESMSRegisterAll(petsclib::PetscLibType) end + +@for_petsc function SNESMSRegisterAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:SNESMSRegisterAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + SNESMSRegisterDestroy(petsclib::PetscLibType) +Frees the list of schemes that were registered by `SNESMSRegister()`. + +Logically Collective + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESMS`, `SNESMSRegister()`, `SNESMSRegisterAll()` + +# External Links +$(_doc_external("SNES/SNESMSRegisterDestroy")) +""" +function SNESMSRegisterDestroy(petsclib::PetscLibType) end + +@for_petsc function SNESMSRegisterDestroy(petsclib::$UnionPetscLib) + + @chk ccall( + (:SNESMSRegisterDestroy, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + SNESMSInitializePackage(petsclib::PetscLibType) +This function initializes everything in the `SNESMS` package. It is called +from `SNESInitializePackage()`. + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESMS`, `SNESMSRegister()`, `SNESMSRegisterAll()`, `PetscInitialize()` + +# External Links +$(_doc_external("SNES/SNESMSInitializePackage")) +""" +function SNESMSInitializePackage(petsclib::PetscLibType) end + +@for_petsc function SNESMSInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:SNESMSInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + SNESMSFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the `SNESMS` package. It is +called from `PetscFinalize()`. + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESMS`, `SNESMSRegister()`, `SNESMSRegisterAll()`, `SNESMSInitializePackage()`, `PetscFinalize()` + +# External Links +$(_doc_external("SNES/SNESMSFinalizePackage")) +""" +function SNESMSFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function SNESMSFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:SNESMSFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + SNESMSRegister(petsclib::PetscLibType,name::SNESMSType, nstages::PetscInt, nregisters::PetscInt, stability::PetscReal, gamma::Vector{PetscReal}, delta::Vector{PetscReal}, betasub::Vector{PetscReal}) +register a multistage scheme for `SNESMS` + +Logically Collective, No Fortran Support + +Input Parameters: +- `name` - identifier for method +- `nstages` - number of stages +- `nregisters` - number of registers used by low-storage implementation +- `stability` - scaled stability region +- `gamma` - coefficients, see Ketcheson's paper {cite}`ketcheson2010runge` +- `delta` - coefficients, see Ketcheson's paper {cite}`ketcheson2010runge` +- `betasub` - subdiagonal of Shu-Osher form + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESMS` + +# External Links +$(_doc_external("SNES/SNESMSRegister")) +""" +function SNESMSRegister(petsclib::PetscLibType, name::SNESMSType, nstages::PetscInt, nregisters::PetscInt, stability::PetscReal, gamma::Vector{PetscReal}, delta::Vector{PetscReal}, betasub::Vector{PetscReal}) end + +@for_petsc function SNESMSRegister(petsclib::$UnionPetscLib, name::SNESMSType, nstages::$PetscInt, nregisters::$PetscInt, stability::$PetscReal, gamma::Vector{$PetscReal}, delta::Vector{$PetscReal}, betasub::Vector{$PetscReal} ) + + @chk ccall( + (:SNESMSRegister, $petsc_library), + PetscErrorCode, + (SNESMSType, $PetscInt, $PetscInt, $PetscReal, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + name, nstages, nregisters, stability, gamma, delta, betasub, + ) + + + return nothing +end + +""" + mstype::SNESMSType = SNESMSGetType(petsclib::PetscLibType,snes::PetscSNES) +Get the type of multistage smoother `SNESMS` + +Not Collective + +Input Parameter: +- `snes` - nonlinear solver context + +Output Parameter: +- `mstype` - type of multistage method + +Level: advanced + +-seealso: [](ch_snes), `SNESMS`, `SNESMSSetType()`, `SNESMSType` + +# External Links +$(_doc_external("SNES/SNESMSGetType")) +""" +function SNESMSGetType(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESMSGetType(petsclib::$UnionPetscLib, snes::PetscSNES ) + mstype_ = Ref{SNESMSType}() + + @chk ccall( + (:SNESMSGetType, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESMSType}), + snes, mstype_, + ) + + mstype = unsafe_string(mstype_[]) + + return mstype +end + +""" + SNESMSSetType(petsclib::PetscLibType,snes::PetscSNES, mstype::SNESMSType) +Set the type of multistage smoother `SNESMS` + +Logically Collective + +Input Parameters: +- `snes` - nonlinear solver context +- `mstype` - type of multistage method + +Level: advanced + +-seealso: [](ch_snes), `SNESMS`, `SNESMSGetType()`, `SNESMSType` + +# External Links +$(_doc_external("SNES/SNESMSSetType")) +""" +function SNESMSSetType(petsclib::PetscLibType, snes::PetscSNES, mstype::SNESMSType) end + +@for_petsc function SNESMSSetType(petsclib::$UnionPetscLib, snes::PetscSNES, mstype::SNESMSType ) + + @chk ccall( + (:SNESMSSetType, $petsc_library), + PetscErrorCode, + (CSNES, SNESMSType), + snes, mstype, + ) + + + return nothing +end + +""" + damping::PetscReal = SNESMSGetDamping(petsclib::PetscLibType,snes::PetscSNES) +Get the damping parameter of `SNESMS` multistage scheme + +Not Collective + +Input Parameter: +- `snes` - nonlinear solver context + +Output Parameter: +- `damping` - damping parameter + +Level: advanced + +-seealso: [](ch_snes), `SNESMSSetDamping()`, `SNESMS` + +# External Links +$(_doc_external("SNES/SNESMSGetDamping")) +""" +function SNESMSGetDamping(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESMSGetDamping(petsclib::$UnionPetscLib, snes::PetscSNES ) + damping_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESMSGetDamping, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}), + snes, damping_, + ) + + damping = damping_[] + + return damping +end + +""" + SNESMSSetDamping(petsclib::PetscLibType,snes::PetscSNES, damping::PetscReal) +Set the damping parameter for a `SNESMS` multistage scheme + +Logically Collective + +Input Parameters: +- `snes` - nonlinear solver context +- `damping` - damping parameter + +Level: advanced + +-seealso: [](ch_snes), `SNESMSGetDamping()`, `SNESMS` + +# External Links +$(_doc_external("SNES/SNESMSSetDamping")) +""" +function SNESMSSetDamping(petsclib::PetscLibType, snes::PetscSNES, damping::PetscReal) end + +@for_petsc function SNESMSSetDamping(petsclib::$UnionPetscLib, snes::PetscSNES, damping::$PetscReal ) + + @chk ccall( + (:SNESMSSetDamping, $petsc_library), + PetscErrorCode, + (CSNES, $PetscReal), + snes, damping, + ) + + + return nothing +end + +""" + SNESNGSSetTolerances(petsclib::PetscLibType,snes::PetscSNES, abstol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt) +Sets various parameters used in convergence tests for nonlinear Gauss + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `abstol` - absolute convergence tolerance +- `rtol` - relative convergence tolerance +- `stol` - convergence tolerance in terms of the norm of the change in the solution between steps, || delta x || < stol*|| x || +- `maxit` - maximum number of iterations + +Options Database Keys: +- `-snes_ngs_atol ` - Sets abstol +- `-snes_ngs_rtol ` - Sets rtol +- `-snes_ngs_stol ` - Sets stol +- `-snes_max_it ` - Sets maxit + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNCG` + +# External Links +$(_doc_external("SNES/SNESNGSSetTolerances")) +""" +function SNESNGSSetTolerances(petsclib::PetscLibType, snes::PetscSNES, abstol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt) end + +@for_petsc function SNESNGSSetTolerances(petsclib::$UnionPetscLib, snes::PetscSNES, abstol::$PetscReal, rtol::$PetscReal, stol::$PetscReal, maxit::$PetscInt ) + + @chk ccall( + (:SNESNGSSetTolerances, $petsc_library), + PetscErrorCode, + (CSNES, $PetscReal, $PetscReal, $PetscReal, $PetscInt), + snes, abstol, rtol, stol, maxit, + ) + + + return nothing +end + +""" + SNESNGSGetTolerances(petsclib::PetscLibType,snes::PetscSNES, atol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt) +Gets various parameters used in convergence tests for nonlinear Gauss + +Not Collective + +Input Parameters: +- `snes` - the `SNES` context +- `atol` - absolute convergence tolerance +- `rtol` - relative convergence tolerance +- `stol` - convergence tolerance in terms of the norm +of the change in the solution between steps +- `maxit` - maximum number of iterations + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNCG`, `SNESSetTolerances()` + +# External Links +$(_doc_external("SNES/SNESNGSGetTolerances")) +""" +function SNESNGSGetTolerances(petsclib::PetscLibType, snes::PetscSNES, atol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt) end + +@for_petsc function SNESNGSGetTolerances(petsclib::$UnionPetscLib, snes::PetscSNES, atol::$PetscReal, rtol::$PetscReal, stol::$PetscReal, maxit::$PetscInt ) + + @chk ccall( + (:SNESNGSGetTolerances, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscInt}), + snes, atol, rtol, stol, maxit, + ) + + + return nothing +end + +""" + SNESNGSSetSweeps(petsclib::PetscLibType,snes::PetscSNES, sweeps::PetscInt) +Sets the number of sweeps of nonlinear GS to use in `SNESNCG` + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `sweeps` - the number of sweeps of nonlinear GS to perform. + +Options Database Key: +- `-snes_ngs_sweeps ` - Number of sweeps of nonlinear GS to apply + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNCG`, `SNESSetNGS()`, `SNESGetNGS()`, `SNESSetNPC()`, `SNESNGSGetSweeps()` + +# External Links +$(_doc_external("SNES/SNESNGSSetSweeps")) +""" +function SNESNGSSetSweeps(petsclib::PetscLibType, snes::PetscSNES, sweeps::PetscInt) end + +@for_petsc function SNESNGSSetSweeps(petsclib::$UnionPetscLib, snes::PetscSNES, sweeps::$PetscInt ) + + @chk ccall( + (:SNESNGSSetSweeps, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, sweeps, + ) + + + return nothing +end + +""" + sweeps::PetscInt = SNESNGSGetSweeps(petsclib::PetscLibType,snes::PetscSNES) +Gets the number of sweeps nonlinear GS will use in `SNESNCG` + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `sweeps` - the number of sweeps of nonlinear GS to perform. + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNCG`, `SNESSetNGS()`, `SNESGetNGS()`, `SNESSetNPC()`, `SNESNGSSetSweeps()` + +# External Links +$(_doc_external("SNES/SNESNGSGetSweeps")) +""" +function SNESNGSGetSweeps(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESNGSGetSweeps(petsclib::$UnionPetscLib, snes::PetscSNES ) + sweeps_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESNGSGetSweeps, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, sweeps_, + ) + + sweeps = sweeps_[] + + return sweeps +end + +""" + SNESNewtonALSetCorrectionType(petsclib::PetscLibType,snes::PetscSNES, ctype::SNESNewtonALCorrectionType) +Set the type of correction to use in the arc + +Logically Collective + +Input Parameters: +- `snes` - the nonlinear solver object +- `ctype` - the type of correction to use + +Options Database Key: +- `-snes_newtonal_correction_type ` - Set the type of correction to use; use -help for a list of available types + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONAL`, `SNESNewtonALCorrectionType` + +# External Links +$(_doc_external("SNES/SNESNewtonALSetCorrectionType")) +""" +function SNESNewtonALSetCorrectionType(petsclib::PetscLibType, snes::PetscSNES, ctype::SNESNewtonALCorrectionType) end + +@for_petsc function SNESNewtonALSetCorrectionType(petsclib::$UnionPetscLib, snes::PetscSNES, ctype::SNESNewtonALCorrectionType ) + + @chk ccall( + (:SNESNewtonALSetCorrectionType, $petsc_library), + PetscErrorCode, + (CSNES, SNESNewtonALCorrectionType), + snes, ctype, + ) + + + return nothing +end + +""" + SNESNewtonALSetFunction(petsclib::PetscLibType,snes::PetscSNES, func::SNESFunctionFn, ctx::Cvoid) +Sets a user function that is called at each function evaluation to +compute the tangent load vector for the arc-length continuation method. + +Logically Collective + +Input Parameters: +- `snes` - the nonlinear solver object +- `func` - [optional] tangent load function evaluation routine, see `SNESFunctionFn` for the calling sequence. `U` is the current solution vector, `Q` is the output tangent load vector +- `ctx` - [optional] user-defined context for private data for the function evaluation routine (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONAL`, `SNESNewtonALGetFunction()`, `SNESNewtonALGetLoadParameter()` + +# External Links +$(_doc_external("SNES/SNESNewtonALSetFunction")) +""" +function SNESNewtonALSetFunction(petsclib::PetscLibType, snes::PetscSNES, func::SNESFunctionFn, ctx::Cvoid) end + +@for_petsc function SNESNewtonALSetFunction(petsclib::$UnionPetscLib, snes::PetscSNES, func::SNESFunctionFn, ctx::Cvoid ) + + @chk ccall( + (:SNESNewtonALSetFunction, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESFunctionFn}, Ptr{Cvoid}), + snes, func, ctx, + ) + + + return nothing +end + +""" + SNESNewtonALGetFunction(petsclib::PetscLibType,snes::PetscSNES, func::SNESFunctionFn, ctx::Cvoid) +Get the user function and context set with `SNESNewtonALSetFunction` + +Logically Collective + +Input Parameters: +- `snes` - the nonlinear solver object +- `func` - [optional] tangent load function evaluation routine, see `SNESNewtonALSetFunction()` for the call sequence +- `ctx` - [optional] user-defined context for private data for the function evaluation routine (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONAL`, `SNESNewtonALSetFunction()` + +# External Links +$(_doc_external("SNES/SNESNewtonALGetFunction")) +""" +function SNESNewtonALGetFunction(petsclib::PetscLibType, snes::PetscSNES, func::SNESFunctionFn, ctx::Cvoid) end + +@for_petsc function SNESNewtonALGetFunction(petsclib::$UnionPetscLib, snes::PetscSNES, func::SNESFunctionFn, ctx::Cvoid ) + + @chk ccall( + (:SNESNewtonALGetFunction, $petsc_library), + PetscErrorCode, + (CSNES, SNESFunctionFn, Cvoid), + snes, func, ctx, + ) + + + return nothing +end + +""" + lambda::PetscReal = SNESNewtonALGetLoadParameter(petsclib::PetscLibType,snes::PetscSNES) +Get the value of the load parameter `lambda` for the arc + +Logically Collective + +Input Parameter: +- `snes` - the nonlinear solver object + +Output Parameter: +- `lambda` - the arc-length parameter + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONAL`, `SNESNewtonALSetFunction()` + +# External Links +$(_doc_external("SNES/SNESNewtonALGetLoadParameter")) +""" +function SNESNewtonALGetLoadParameter(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESNewtonALGetLoadParameter(petsclib::$UnionPetscLib, snes::PetscSNES ) + lambda_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESNewtonALGetLoadParameter, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}), + snes, lambda_, + ) + + lambda = lambda_[] + + return lambda +end + +""" + SNESNewtonALComputeFunction(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, Q::PetscVec) +Calls the function that has been set with `SNESNewtonALSetFunction()`. + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `X` - input vector + +Output Parameter: +- `Q` - tangent load vector, as set by `SNESNewtonALSetFunction()` + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESNewtonALSetFunction()`, `SNESNewtonALGetFunction()` + +# External Links +$(_doc_external("SNES/SNESNewtonALComputeFunction")) +""" +function SNESNewtonALComputeFunction(petsclib::PetscLibType, snes::PetscSNES, X::PetscVec, Q::PetscVec) end + +@for_petsc function SNESNewtonALComputeFunction(petsclib::$UnionPetscLib, snes::PetscSNES, X::PetscVec, Q::PetscVec ) + + @chk ccall( + (:SNESNewtonALComputeFunction, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec), + snes, X, Q, + ) + + + return nothing +end + +""" + SNESPythonSetType(petsclib::PetscLibType,snes::PetscSNES, pyname::String) +Initialize a `SNES` object implemented in Python. + +Collective + +Input Parameters: +- `snes` - the nonlinear solver (`SNES`) context. +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Options Database Key: +- `-snes_python_type ` - python class + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESCreate()`, `SNESSetType()`, `SNESPYTHON`, `PetscPythonInitialize()`, `SNESPythonGetType()` + +# External Links +$(_doc_external("SNES/SNESPythonSetType")) +""" +function SNESPythonSetType(petsclib::PetscLibType, snes::PetscSNES, pyname::String) end + +@for_petsc function SNESPythonSetType(petsclib::$UnionPetscLib, snes::PetscSNES, pyname::String ) + + @chk ccall( + (:SNESPythonSetType, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Cchar}), + snes, pyname, + ) + + + return nothing +end + +""" + pyname::String = SNESPythonGetType(petsclib::PetscLibType,snes::PetscSNES) +Get the type of a `SNES` object implemented in Python set with `SNESPythonSetType()` + +Not Collective + +Input Parameter: +- `snes` - the nonlinear solver (`SNES`) context. + +Output Parameter: +- `pyname` - full dotted Python name [package].module[.{class|function}] + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESCreate()`, `SNESSetType()`, `SNESPYTHON`, `PetscPythonInitialize()`, `SNESPythonSetType()` + +# External Links +$(_doc_external("SNES/SNESPythonGetType")) +""" +function SNESPythonGetType(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESPythonGetType(petsclib::$UnionPetscLib, snes::PetscSNES ) + pyname_ = Ref{Ptr{Cchar}}() + + @chk ccall( + (:SNESPythonGetType, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Ptr{Cchar}}), + snes, pyname_, + ) + + pyname = unsafe_wrap(Array, pyname_[], VecGetLocalSize(petsclib, x); own = false) + + return pyname +end + +""" + SNESShellSetSolve(petsclib::PetscLibType,snes::PetscSNES, solve::external) +Sets routine to apply as solver to a `SNESSHELL` `SNES` object + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` nonlinear solver context +- `solve` - the application-provided solver routine + +Calling sequence of `apply`: +- `snes` - the preconditioner, get the application context with `SNESShellGetContext()` provided with `SNESShellSetContext()` +- `xout` - solution vector + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSHELL`, `SNESShellSetContext()`, `SNESShellGetContext()` + +# External Links +$(_doc_external("SNES/SNESShellSetSolve")) +""" +function SNESShellSetSolve(petsclib::PetscLibType, snes::PetscSNES, solve::external) end + +@for_petsc function SNESShellSetSolve(petsclib::$UnionPetscLib, snes::PetscSNES, solve::external ) + + @chk ccall( + (:SNESShellSetSolve, $petsc_library), + PetscErrorCode, + (CSNES, external), + snes, solve, + ) + + + return nothing +end + +""" + SNESShellGetContext(petsclib::PetscLibType,snes::PetscSNES, ctx::Cvoid) +Returns the user + +Not Collective + +Input Parameter: +- `snes` - should have been created with `SNESSetType`(snes,`SNESSHELL`); + +Output Parameter: +- `ctx` - the user provided context + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSHELL`, `SNESCreateShell()`, `SNESShellSetContext()` + +# External Links +$(_doc_external("SNES/SNESShellGetContext")) +""" +function SNESShellGetContext(petsclib::PetscLibType, snes::PetscSNES, ctx::Cvoid) end + +@for_petsc function SNESShellGetContext(petsclib::$UnionPetscLib, snes::PetscSNES, ctx::Cvoid ) + + @chk ccall( + (:SNESShellGetContext, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Cvoid}), + snes, ctx, + ) + + + return nothing +end + +""" + SNESShellSetContext(petsclib::PetscLibType,snes::PetscSNES, ctx::Cvoid) +sets the context for a `SNESSHELL` + +Logically Collective + +Input Parameters: +- `snes` - the `SNESSHELL` +- `ctx` - the context + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESSHELL`, `SNESCreateShell()`, `SNESShellGetContext()` + +# External Links +$(_doc_external("SNES/SNESShellSetContext")) +""" +function SNESShellSetContext(petsclib::PetscLibType, snes::PetscSNES, ctx::Cvoid) end + +@for_petsc function SNESShellSetContext(petsclib::$UnionPetscLib, snes::PetscSNES, ctx::Cvoid ) + + @chk ccall( + (:SNESShellSetContext, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Cvoid}), + snes, ctx, + ) + + + return nothing +end + +""" + SNESNASMSetType(petsclib::PetscLibType,snes::PetscSNES, type::PCASMType) +Set the type of subdomain update used for the nonlinear additive Schwarz solver `SNESNASM` + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `type` - the type of update, `PC_ASM_BASIC` or `PC_ASM_RESTRICT` + +Options Database Key: +- `-snes_nasm_type ` - type of subdomain update used + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNASM`, `SNESNASMGetType()`, `PCASMSetType()`, `PC_ASM_BASIC`, `PC_ASM_RESTRICT`, `PCASMType` + +# External Links +$(_doc_external("SNES/SNESNASMSetType")) +""" +function SNESNASMSetType(petsclib::PetscLibType, snes::PetscSNES, type::PCASMType) end + +@for_petsc function SNESNASMSetType(petsclib::$UnionPetscLib, snes::PetscSNES, type::PCASMType ) + + @chk ccall( + (:SNESNASMSetType, $petsc_library), + PetscErrorCode, + (CSNES, PCASMType), + snes, type, + ) + + + return nothing +end + +""" + type::PCASMType = SNESNASMGetType(petsclib::PetscLibType,snes::PetscSNES) +Get the type of subdomain update used for the nonlinear additive Schwarz solver `SNESNASM` + +Logically Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `type` - the type of update + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNASM`, `SNESNASMSetType()`, `PCASMGetType()`, `PC_ASM_BASIC`, `PC_ASM_RESTRICT`, `PCASMType` + +# External Links +$(_doc_external("SNES/SNESNASMGetType")) +""" +function SNESNASMGetType(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESNASMGetType(petsclib::$UnionPetscLib, snes::PetscSNES ) + type_ = Ref{PCASMType}() + + @chk ccall( + (:SNESNASMGetType, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PCASMType}), + snes, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + SNESNASMSetSubdomains(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, subsnes::Vector{PetscSNES}, iscatter::Vector{VecScatter}, oscatter::Vector{VecScatter}, gscatter::Vector{VecScatter}) +Manually Set the context required to restrict and solve subdomain problems in the nonlinear additive Schwarz solver + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `n` - the number of local subdomains +- `subsnes` - solvers defined on the local subdomains +- `iscatter` - scatters into the nonoverlapping portions of the local subdomains +- `oscatter` - scatters into the overlapping portions of the local subdomains +- `gscatter` - scatters into the (ghosted) local vector of the local subdomain + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNASM`, `SNESNASMGetSubdomains()` + +# External Links +$(_doc_external("SNES/SNESNASMSetSubdomains")) +""" +function SNESNASMSetSubdomains(petsclib::PetscLibType, snes::PetscSNES, n::PetscInt, subsnes::Vector{PetscSNES}, iscatter::Vector{VecScatter}, oscatter::Vector{VecScatter}, gscatter::Vector{VecScatter}) end + +@for_petsc function SNESNASMSetSubdomains(petsclib::$UnionPetscLib, snes::PetscSNES, n::$PetscInt, subsnes::Vector{PetscSNES}, iscatter::Vector{VecScatter}, oscatter::Vector{VecScatter}, gscatter::Vector{VecScatter} ) + + @chk ccall( + (:SNESNASMSetSubdomains, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CSNES}, Ptr{VecScatter}, Ptr{VecScatter}, Ptr{VecScatter}), + snes, n, subsnes, iscatter, oscatter, gscatter, + ) + + + return nothing +end + +""" + n::PetscInt = SNESNASMGetSubdomains(petsclib::PetscLibType,snes::PetscSNES, subsnes::Vector{PetscSNES}, iscatter::Vector{VecScatter}, oscatter::Vector{VecScatter}, gscatter::Vector{VecScatter}) +Get the local subdomain contexts for the nonlinear additive Schwarz solver + +Not Collective but some of the objects returned will be parallel + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `n` - the number of local subdomains +- `subsnes` - solvers defined on the local subdomains +- `iscatter` - scatters into the nonoverlapping portions of the local subdomains +- `oscatter` - scatters into the overlapping portions of the local subdomains +- `gscatter` - scatters into the (ghosted) local vector of the local subdomain + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNASM`, `SNESNASMSetSubdomains()` + +# External Links +$(_doc_external("SNES/SNESNASMGetSubdomains")) +""" +function SNESNASMGetSubdomains(petsclib::PetscLibType, snes::PetscSNES, subsnes::Vector{PetscSNES}, iscatter::Vector{VecScatter}, oscatter::Vector{VecScatter}, gscatter::Vector{VecScatter}) end + +@for_petsc function SNESNASMGetSubdomains(petsclib::$UnionPetscLib, snes::PetscSNES, subsnes::Vector{PetscSNES}, iscatter::Vector{VecScatter}, oscatter::Vector{VecScatter}, gscatter::Vector{VecScatter} ) + n_ = Ref{$PetscInt}() + subsnes_ = Ref(pointer(subsnes)) + iscatter_ = Ref(pointer(iscatter)) + oscatter_ = Ref(pointer(oscatter)) + gscatter_ = Ref(pointer(gscatter)) + + @chk ccall( + (:SNESNASMGetSubdomains, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}, Ptr{Ptr{CSNES}}, Ptr{Ptr{VecScatter}}, Ptr{Ptr{VecScatter}}, Ptr{Ptr{VecScatter}}), + snes, n_, subsnes_, iscatter_, oscatter_, gscatter_, + ) + + n = n_[] + + return n +end + +""" + n::PetscInt = SNESNASMGetSubdomainVecs(petsclib::PetscLibType,snes::PetscSNES, x::Vector{PetscVec}, y::Vector{PetscVec}, b::Vector{PetscVec}, xl::Vector{PetscVec}) +Get the processor + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `n` - the number of local subdomains +- `x` - The subdomain solution vector +- `y` - The subdomain step vector +- `b` - The subdomain RHS vector +- `xl` - The subdomain local vectors (ghosted) + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESNASM`, `SNESNASMGetSubdomains()` + +# External Links +$(_doc_external("SNES/SNESNASMGetSubdomainVecs")) +""" +function SNESNASMGetSubdomainVecs(petsclib::PetscLibType, snes::PetscSNES, x::Vector{PetscVec}, y::Vector{PetscVec}, b::Vector{PetscVec}, xl::Vector{PetscVec}) end + +@for_petsc function SNESNASMGetSubdomainVecs(petsclib::$UnionPetscLib, snes::PetscSNES, x::Vector{PetscVec}, y::Vector{PetscVec}, b::Vector{PetscVec}, xl::Vector{PetscVec} ) + n_ = Ref{$PetscInt}() + x_ = Ref(pointer(x)) + y_ = Ref(pointer(y)) + b_ = Ref(pointer(b)) + xl_ = Ref(pointer(xl)) + + @chk ccall( + (:SNESNASMGetSubdomainVecs, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}, Ptr{Ptr{CVec}}, Ptr{Ptr{CVec}}, Ptr{Ptr{CVec}}, Ptr{Ptr{CVec}}), + snes, n_, x_, y_, b_, xl_, + ) + + n = n_[] + + return n +end + +""" + SNESNASMSetComputeFinalJacobian(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool) +Schedules the computation of the global and subdomain Jacobians upon convergence for the +nonlinear additive Schwarz solver + +Collective + +Input Parameters: +- `snes` - the SNES context +- `flg` - `PETSC_TRUE` to compute the Jacobians + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESNASM`, `SNESNASMGetSubdomains()` + +# External Links +$(_doc_external("SNES/SNESNASMSetComputeFinalJacobian")) +""" +function SNESNASMSetComputeFinalJacobian(petsclib::PetscLibType, snes::PetscSNES, flg::PetscBool) end + +@for_petsc function SNESNASMSetComputeFinalJacobian(petsclib::$UnionPetscLib, snes::PetscSNES, flg::PetscBool ) + + @chk ccall( + (:SNESNASMSetComputeFinalJacobian, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, flg, + ) + + + return nothing +end + +""" + SNESNASMSetDamping(petsclib::PetscLibType,snes::PetscSNES, dmp::PetscReal) +Sets the update damping for `SNESNASM` the nonlinear additive Schwarz solver + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `dmp` - damping + +Options Database Key: +- `-snes_nasm_damping ` - the new solution is obtained as old solution plus `dmp` times (sum of the solutions on the subdomains) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNASM`, `SNESNASMGetDamping()` + +# External Links +$(_doc_external("SNES/SNESNASMSetDamping")) +""" +function SNESNASMSetDamping(petsclib::PetscLibType, snes::PetscSNES, dmp::PetscReal) end + +@for_petsc function SNESNASMSetDamping(petsclib::$UnionPetscLib, snes::PetscSNES, dmp::$PetscReal ) + + @chk ccall( + (:SNESNASMSetDamping, $petsc_library), + PetscErrorCode, + (CSNES, $PetscReal), + snes, dmp, + ) + + + return nothing +end + +""" + dmp::PetscReal = SNESNASMGetDamping(petsclib::PetscLibType,snes::PetscSNES) +Gets the update damping for `SNESNASM` the nonlinear additive Schwarz solver + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `dmp` - damping + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNASM`, `SNESNASMSetDamping()` + +# External Links +$(_doc_external("SNES/SNESNASMGetDamping")) +""" +function SNESNASMGetDamping(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESNASMGetDamping(petsclib::$UnionPetscLib, snes::PetscSNES ) + dmp_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESNASMGetDamping, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}), + snes, dmp_, + ) + + dmp = dmp_[] + + return dmp +end + +""" + SNESNASMGetSNES(petsclib::PetscLibType,snes::PetscSNES, i::PetscInt, subsnes::PetscSNES) +Gets a subsolver + +Not Collective + +Input Parameters: +- `snes` - the `SNES` context +- `i` - the number of the subsnes to get + +Output Parameter: +- `subsnes` - the subsolver context + +Level: intermediate + +-seealso: [](ch_snes), `SNESNASM`, `SNESNASMGetNumber()` + +# External Links +$(_doc_external("SNES/SNESNASMGetSNES")) +""" +function SNESNASMGetSNES(petsclib::PetscLibType, snes::PetscSNES, i::PetscInt, subsnes::PetscSNES) end + +@for_petsc function SNESNASMGetSNES(petsclib::$UnionPetscLib, snes::PetscSNES, i::$PetscInt, subsnes::PetscSNES ) + subsnes_ = Ref(subsnes.ptr) + + @chk ccall( + (:SNESNASMGetSNES, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CSNES}), + snes, i, subsnes_, + ) + + subsnes.ptr = C_NULL + + return nothing +end + +""" + n::PetscInt = SNESNASMGetNumber(petsclib::PetscLibType,snes::PetscSNES) +Gets number of subsolvers + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `n` - the number of subsolvers + +Level: intermediate + +-seealso: [](ch_snes), `SNESNASM`, `SNESNASMGetSNES()` + +# External Links +$(_doc_external("SNES/SNESNASMGetNumber")) +""" +function SNESNASMGetNumber(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESNASMGetNumber(petsclib::$UnionPetscLib, snes::PetscSNES ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESNASMGetNumber, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, n_, + ) + + n = n_[] + + return n +end + +""" + SNESNASMSetWeight(petsclib::PetscLibType,snes::PetscSNES, weight::PetscVec) +Sets weight to use when adding overlapping updates + +Collective + +Input Parameters: +- `snes` - the `SNES` context +- `weight` - the weights to use (typically 1/N for each dof, where N is the number of patches it appears in) + +Level: intermediate + +-seealso: [](ch_snes), `SNESNASM` + +# External Links +$(_doc_external("SNES/SNESNASMSetWeight")) +""" +function SNESNASMSetWeight(petsclib::PetscLibType, snes::PetscSNES, weight::PetscVec) end + +@for_petsc function SNESNASMSetWeight(petsclib::$UnionPetscLib, snes::PetscSNES, weight::PetscVec ) + + @chk ccall( + (:SNESNASMSetWeight, $petsc_library), + PetscErrorCode, + (CSNES, CVec), + snes, weight, + ) + + + return nothing +end + +""" + SNESQNSetRestartType(petsclib::PetscLibType,snes::PetscSNES, rtype::SNESQNRestartType) +Sets the restart type for `SNESQN`. + +Logically Collective + +Input Parameters: +- `snes` - the iterative context +- `rtype` - restart type, see `SNESQNRestartType` + +Options Database Keys: +- `-snes_qn_restart_type ` - set the restart type +- `-snes_qn_m ` - sets the number of stored updates and the restart period for periodic + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESQN`, `SNESQNRestartType`, `SNES_QN_RESTART_NONE`, `SNES_QN_RESTART_POWELL`, `SNES_QN_RESTART_PERIODIC`, +`SNESQNType`, `SNESQNScaleType` + +# External Links +$(_doc_external("SNES/SNESQNSetRestartType")) +""" +function SNESQNSetRestartType(petsclib::PetscLibType, snes::PetscSNES, rtype::SNESQNRestartType) end + +@for_petsc function SNESQNSetRestartType(petsclib::$UnionPetscLib, snes::PetscSNES, rtype::SNESQNRestartType ) + + @chk ccall( + (:SNESQNSetRestartType, $petsc_library), + PetscErrorCode, + (CSNES, SNESQNRestartType), + snes, rtype, + ) + + + return nothing +end + +""" + SNESQNSetScaleType(petsclib::PetscLibType,snes::PetscSNES, stype::SNESQNScaleType) +Sets the scaling type for the inner inverse Jacobian in `SNESQN`. + +Logically Collective + +Input Parameters: +- `snes` - the nonlinear solver context +- `stype` - scale type, see `SNESQNScaleType` + +Options Database Key: +- `-snes_qn_scale_type ` - Scaling type + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESQN`, `SNESLineSearch`, `SNESQNScaleType`, `SNESSetJacobian()`, `SNESQNType`, `SNESQNRestartType` + +# External Links +$(_doc_external("SNES/SNESQNSetScaleType")) +""" +function SNESQNSetScaleType(petsclib::PetscLibType, snes::PetscSNES, stype::SNESQNScaleType) end + +@for_petsc function SNESQNSetScaleType(petsclib::$UnionPetscLib, snes::PetscSNES, stype::SNESQNScaleType ) + + @chk ccall( + (:SNESQNSetScaleType, $petsc_library), + PetscErrorCode, + (CSNES, SNESQNScaleType), + snes, stype, + ) + + + return nothing +end + +""" + SNESQNSetType(petsclib::PetscLibType,snes::PetscSNES, qtype::SNESQNType) +Sets the quasi + +Logically Collective + +Input Parameters: +- `snes` - the iterative context +- `qtype` - variant type, see `SNESQNType` + +Options Database Key: +- `-snes_qn_type ` - quasi-Newton type + +Level: intermediate + +-seealso: [](ch_snes), `SNESQN`, `SNES_QN_LBFGS`, `SNES_QN_BROYDEN`, `SNES_QN_BADBROYDEN`, `SNESQNType`, `SNESQNScaleType`, `TAOLMVM`, `TAOBLMVM` + +# External Links +$(_doc_external("SNES/SNESQNSetType")) +""" +function SNESQNSetType(petsclib::PetscLibType, snes::PetscSNES, qtype::SNESQNType) end + +@for_petsc function SNESQNSetType(petsclib::$UnionPetscLib, snes::PetscSNES, qtype::SNESQNType ) + + @chk ccall( + (:SNESQNSetType, $petsc_library), + PetscErrorCode, + (CSNES, SNESQNType), + snes, qtype, + ) + + + return nothing +end + +""" + SNESCompositeSetType(petsclib::PetscLibType,snes::PetscSNES, type::SNESCompositeType) +Sets the type of composite preconditioner. + +Logically Collective + +Input Parameters: +- `snes` - the preconditioner context +- `type` - `SNES_COMPOSITE_ADDITIVE` (default), `SNES_COMPOSITE_MULTIPLICATIVE`, or `SNES_COMPOSITE_ADDITIVEOPTIMAL` + +Options Database Key: +- `-snes_composite_type ` - Sets composite preconditioner type + +Level: developer + +-seealso: [](ch_snes), `SNES_COMPOSITE_ADDITIVE`, `SNES_COMPOSITE_MULTIPLICATIVE`, `SNESCompositeType`, `SNESCOMPOSITE`, `SNES_COMPOSITE_ADDITIVEOPTIMAL`, +`PCCompositeType` + +# External Links +$(_doc_external("SNES/SNESCompositeSetType")) +""" +function SNESCompositeSetType(petsclib::PetscLibType, snes::PetscSNES, type::SNESCompositeType) end + +@for_petsc function SNESCompositeSetType(petsclib::$UnionPetscLib, snes::PetscSNES, type::SNESCompositeType ) + + @chk ccall( + (:SNESCompositeSetType, $petsc_library), + PetscErrorCode, + (CSNES, SNESCompositeType), + snes, type, + ) + + + return nothing +end + +""" + SNESCompositeAddSNES(petsclib::PetscLibType,snes::PetscSNES, type::SNESType) +Adds another `SNES` to the `SNESCOMPOSITE` + +Collective + +Input Parameters: +- `snes` - the `SNES` context of type `SNESCOMPOSITE` +- `type` - the `SNESType` of the new solver + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESCOMPOSITE`, `SNESCompositeGetSNES()` + +# External Links +$(_doc_external("SNES/SNESCompositeAddSNES")) +""" +function SNESCompositeAddSNES(petsclib::PetscLibType, snes::PetscSNES, type::SNESType) end + +@for_petsc function SNESCompositeAddSNES(petsclib::$UnionPetscLib, snes::PetscSNES, type::SNESType ) + + @chk ccall( + (:SNESCompositeAddSNES, $petsc_library), + PetscErrorCode, + (CSNES, SNESType), + snes, type, + ) + + + return nothing +end + +""" + SNESCompositeGetSNES(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, subsnes::PetscSNES) +Gets one of the `SNES` objects in the `SNES` of `SNESType` `SNESCOMPOSITE` + +Not Collective + +Input Parameters: +- `snes` - the `SNES` context +- `n` - the number of the composed `SNES` requested + +Output Parameter: +- `subsnes` - the `SNES` requested + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESCOMPOSITE`, `SNESCompositeAddSNES()`, `SNESCompositeGetNumber()` + +# External Links +$(_doc_external("SNES/SNESCompositeGetSNES")) +""" +function SNESCompositeGetSNES(petsclib::PetscLibType, snes::PetscSNES, n::PetscInt, subsnes::PetscSNES) end + +@for_petsc function SNESCompositeGetSNES(petsclib::$UnionPetscLib, snes::PetscSNES, n::$PetscInt, subsnes::PetscSNES ) + subsnes_ = Ref(subsnes.ptr) + + @chk ccall( + (:SNESCompositeGetSNES, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CSNES}), + snes, n, subsnes_, + ) + + subsnes.ptr = C_NULL + + return nothing +end + +""" + n::PetscInt = SNESCompositeGetNumber(petsclib::PetscLibType,snes::PetscSNES) +Get the number of subsolvers in the `SNESCOMPOSITE` + +Logically Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameter: +- `n` - the number of subsolvers + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESCOMPOSITE`, `SNESCompositeAddSNES()`, `SNESCompositeGetSNES()` + +# External Links +$(_doc_external("SNES/SNESCompositeGetNumber")) +""" +function SNESCompositeGetNumber(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESCompositeGetNumber(petsclib::$UnionPetscLib, snes::PetscSNES ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESCompositeGetNumber, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, n_, + ) + + n = n_[] + + return n +end + +""" + SNESCompositeSetDamping(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, dmp::PetscReal) +Sets the damping of a subsolver when using `SNES_COMPOSITE_ADDITIVE` with a `SNES` of `SNESType` `SNESCOMPOSITE` + +Not Collective + +Input Parameters: +- `snes` - the `SNES` context +- `n` - the number of the sub-`SNES` object requested +- `dmp` - the damping + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESCOMPOSITE`, `SNESCompositeAddSNES()`, `SNESCompositeGetSNES()`, +`SNES_COMPOSITE_ADDITIVE`, `SNES_COMPOSITE_MULTIPLICATIVE`, `SNESCompositeType`, `SNESCompositeSetType()` + +# External Links +$(_doc_external("SNES/SNESCompositeSetDamping")) +""" +function SNESCompositeSetDamping(petsclib::PetscLibType, snes::PetscSNES, n::PetscInt, dmp::PetscReal) end + +@for_petsc function SNESCompositeSetDamping(petsclib::$UnionPetscLib, snes::PetscSNES, n::$PetscInt, dmp::$PetscReal ) + + @chk ccall( + (:SNESCompositeSetDamping, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal), + snes, n, dmp, + ) + + + return nothing +end + +""" + rho_flag::PetscBool = SNESNewtonTRDCGetRhoFlag(petsclib::PetscLibType,snes::PetscSNES) +Get whether the current solution update is within the trust + +Logically Collective + +Input Parameter: +- `snes` - the nonlinear solver object + +Output Parameter: +- `rho_flag` - `PETSC_FALSE` or `PETSC_TRUE` + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONTRDC`, `SNESNewtonTRDCPreCheck()`, `SNESNewtonTRDCGetPreCheck()`, `SNESNewtonTRDCSetPreCheck()`, +`SNESNewtonTRDCSetPostCheck()`, `SNESNewtonTRDCGetPostCheck()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRDCGetRhoFlag")) +""" +function SNESNewtonTRDCGetRhoFlag(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESNewtonTRDCGetRhoFlag(petsclib::$UnionPetscLib, snes::PetscSNES ) + rho_flag_ = Ref{PetscBool}() + + @chk ccall( + (:SNESNewtonTRDCGetRhoFlag, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, rho_flag_, + ) + + rho_flag = rho_flag_[] + + return rho_flag +end + +""" + SNESNewtonTRDCSetPreCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid) +Sets a user function that is called before the search step has been determined. +Allows the user a chance to change or override the trust region decision. + +Logically Collective + +Input Parameters: +- `snes` - the nonlinear solver object +- `func` - [optional] function evaluation routine, for the calling sequence see `SNESNewtonTRDCPreCheck()` +- `ctx` - [optional] user-defined context for private data for the function evaluation routine (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONTRDC`, `SNESNewtonTRDCPreCheck()`, `SNESNewtonTRDCGetPreCheck()`, `SNESNewtonTRDCSetPostCheck()`, `SNESNewtonTRDCGetPostCheck()`, +`SNESNewtonTRDCGetRhoFlag()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRDCSetPreCheck")) +""" +function SNESNewtonTRDCSetPreCheck(petsclib::PetscLibType, snes::PetscSNES, func::external, ctx::Cvoid) end + +@for_petsc function SNESNewtonTRDCSetPreCheck(petsclib::$UnionPetscLib, snes::PetscSNES, func::external, ctx::Cvoid ) + + @chk ccall( + (:SNESNewtonTRDCSetPreCheck, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{Cvoid}), + snes, func, ctx, + ) + + + return nothing +end + +""" + SNESNewtonTRDCSetPostCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid) +Sets a user function that is called after the search step has been determined but before the next +function evaluation. Allows the user a chance to change or override the decision of the line search routine + +Logically Collective + +Input Parameters: +- `snes` - the nonlinear solver object +- `func` - [optional] function evaluation routine, for the calling sequence see `SNESNewtonTRDCPostCheck()` +- `ctx` - [optional] user-defined context for private data for the function evaluation routine (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONTRDC`, `SNESNewtonTRDCPostCheck()`, `SNESNewtonTRDCGetPostCheck()`, `SNESNewtonTRDCSetPreCheck()`, `SNESNewtonTRDCGetPreCheck()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRDCSetPostCheck")) +""" +function SNESNewtonTRDCSetPostCheck(petsclib::PetscLibType, snes::PetscSNES, func::external, ctx::Cvoid) end + +@for_petsc function SNESNewtonTRDCSetPostCheck(petsclib::$UnionPetscLib, snes::PetscSNES, func::external, ctx::Cvoid ) + + @chk ccall( + (:SNESNewtonTRDCSetPostCheck, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{Cvoid}), + snes, func, ctx, + ) + + + return nothing +end + +""" + bs::PetscInt,nodesPerCell::PetscInt,subspaceOffsets::PetscInt,ghostBcNodes::PetscInt,globalBcNodes::PetscInt = SNESPatchSetDiscretisationInfo(petsclib::PetscLibType,snes::PetscSNES, nsubspaces::PetscInt, dms::PetscDM, cellNodeMap::PetscInt, numGhostBcs::PetscInt, numGlobalBcs::PetscInt) + +# External Links +$(_doc_external("SNES/SNESPatchSetDiscretisationInfo")) +""" +function SNESPatchSetDiscretisationInfo(petsclib::PetscLibType, snes::PetscSNES, nsubspaces::PetscInt, dms::PetscDM, cellNodeMap::PetscInt, numGhostBcs::PetscInt, numGlobalBcs::PetscInt) end + +@for_petsc function SNESPatchSetDiscretisationInfo(petsclib::$UnionPetscLib, snes::PetscSNES, nsubspaces::$PetscInt, dms::PetscDM, cellNodeMap::$PetscInt, numGhostBcs::$PetscInt, numGlobalBcs::$PetscInt ) + dms_ = Ref(dms.ptr) + bs_ = Ref{$PetscInt}() + nodesPerCell_ = Ref{$PetscInt}() + subspaceOffsets_ = Ref{$PetscInt}() + ghostBcNodes_ = Ref{$PetscInt}() + globalBcNodes_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESPatchSetDiscretisationInfo, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CDM}, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}), + snes, nsubspaces, dms_, bs_, nodesPerCell_, cellNodeMap, subspaceOffsets_, numGhostBcs, ghostBcNodes_, numGlobalBcs, globalBcNodes_, + ) + + dms.ptr = C_NULL + bs = bs_[] + nodesPerCell = nodesPerCell_[] + subspaceOffsets = subspaceOffsets_[] + ghostBcNodes = ghostBcNodes_[] + globalBcNodes = globalBcNodes_[] + + return bs,nodesPerCell,subspaceOffsets,ghostBcNodes,globalBcNodes +end + +""" + SNESPatchSetComputeOperator(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid) + +# External Links +$(_doc_external("SNES/SNESPatchSetComputeOperator")) +""" +function SNESPatchSetComputeOperator(petsclib::PetscLibType, snes::PetscSNES, func::external, ctx::Cvoid) end + +@for_petsc function SNESPatchSetComputeOperator(petsclib::$UnionPetscLib, snes::PetscSNES, func::external, ctx::Cvoid ) + + @chk ccall( + (:SNESPatchSetComputeOperator, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{Cvoid}), + snes, func, ctx, + ) + + + return nothing +end + +""" + SNESPatchSetComputeFunction(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid) + +# External Links +$(_doc_external("SNES/SNESPatchSetComputeFunction")) +""" +function SNESPatchSetComputeFunction(petsclib::PetscLibType, snes::PetscSNES, func::external, ctx::Cvoid) end + +@for_petsc function SNESPatchSetComputeFunction(petsclib::$UnionPetscLib, snes::PetscSNES, func::external, ctx::Cvoid ) + + @chk ccall( + (:SNESPatchSetComputeFunction, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{Cvoid}), + snes, func, ctx, + ) + + + return nothing +end + +""" + ctx::Cvoid = SNESPatchSetConstructType(petsclib::PetscLibType,snes::PetscSNES, ctype::PCPatchConstructType, func::external) + +# External Links +$(_doc_external("SNES/SNESPatchSetConstructType")) +""" +function SNESPatchSetConstructType(petsclib::PetscLibType, snes::PetscSNES, ctype::PCPatchConstructType, func::external) end + +@for_petsc function SNESPatchSetConstructType(petsclib::$UnionPetscLib, snes::PetscSNES, ctype::PCPatchConstructType, func::external ) + ctx_ = Ref{Cvoid}() + + @chk ccall( + (:SNESPatchSetConstructType, $petsc_library), + PetscErrorCode, + (CSNES, PCPatchConstructType, external, Ptr{Cvoid}), + snes, ctype, func, ctx_, + ) + + ctx = ctx_[] + + return ctx +end + +""" + SNESPatchSetCellNumbering(petsclib::PetscLibType,snes::PetscSNES, cellNumbering::PetscSection) + +# External Links +$(_doc_external("SNES/SNESPatchSetCellNumbering")) +""" +function SNESPatchSetCellNumbering(petsclib::PetscLibType, snes::PetscSNES, cellNumbering::PetscSection) end + +@for_petsc function SNESPatchSetCellNumbering(petsclib::$UnionPetscLib, snes::PetscSNES, cellNumbering::PetscSection ) + + @chk ccall( + (:SNESPatchSetCellNumbering, $petsc_library), + PetscErrorCode, + (CSNES, PetscSection), + snes, cellNumbering, + ) + + + return nothing +end + +""" + SNESMultiblockSetFields(petsclib::PetscLibType,snes::PetscSNES, name::String, n::PetscInt, fields::PetscInt) +Sets the fields for one particular block in a `SNESMULTIBLOCK` solver + +Logically Collective + +Input Parameters: +- `snes` - the solver +- `name` - name of this block, if `NULL` the number of the block is used +- `n` - the number of fields in this block +- `fields` - the fields in this block + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESMULTIBLOCK`, `SNESMultiblockGetSubSNES()`, `SNESMultiblockSetBlockSize()`, `SNESMultiblockSetIS()` + +# External Links +$(_doc_external("SNES/SNESMultiblockSetFields")) +""" +function SNESMultiblockSetFields(petsclib::PetscLibType, snes::PetscSNES, name::String, n::PetscInt, fields::PetscInt) end + +@for_petsc function SNESMultiblockSetFields(petsclib::$UnionPetscLib, snes::PetscSNES, name::String, n::$PetscInt, fields::$PetscInt ) + + @chk ccall( + (:SNESMultiblockSetFields, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Cchar}, $PetscInt, Ptr{$PetscInt}), + snes, name, n, fields, + ) + + + return nothing +end + +""" + SNESMultiblockSetIS(petsclib::PetscLibType,snes::PetscSNES, name::String, is::IS) +Sets the global row indices for one particular block in a `SNESMULTIBLOCK` solver + +Logically Collective + +Input Parameters: +- `snes` - the solver context +- `name` - name of this block, if `NULL` the number of the block is used +- `is` - the index set that defines the global row indices in this block + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESMULTIBLOCK`, `SNESMultiblockGetSubSNES()`, `SNESMultiblockSetBlockSize()`, `SNESMultiblockSetFields()` + +# External Links +$(_doc_external("SNES/SNESMultiblockSetIS")) +""" +function SNESMultiblockSetIS(petsclib::PetscLibType, snes::PetscSNES, name::String, is::IS) end + +@for_petsc function SNESMultiblockSetIS(petsclib::$UnionPetscLib, snes::PetscSNES, name::String, is::IS ) + + @chk ccall( + (:SNESMultiblockSetIS, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{Cchar}, CIS), + snes, name, is, + ) + + + return nothing +end + +""" + SNESMultiblockSetType(petsclib::PetscLibType,snes::PetscSNES, type::PCCompositeType) +Sets the type of block combination used for a `SNESMULTIBLOCK` solver + +Logically Collective + +Input Parameters: +- `snes` - the solver context +- `type` - `PC_COMPOSITE_ADDITIVE`, `PC_COMPOSITE_MULTIPLICATIVE` (default), `PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE` + +Options Database Key: +- `-snes_multiblock_type ` - Sets block combination type + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESMULTIBLOCK`, `PCCompositeSetType()`, `PC_COMPOSITE_ADDITIVE`, `PC_COMPOSITE_MULTIPLICATIVE`, `PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE`, +`PCCompositeType`, `SNESCOMPOSITE`, `SNESCompositeSetType()` + +# External Links +$(_doc_external("SNES/SNESMultiblockSetType")) +""" +function SNESMultiblockSetType(petsclib::PetscLibType, snes::PetscSNES, type::PCCompositeType) end + +@for_petsc function SNESMultiblockSetType(petsclib::$UnionPetscLib, snes::PetscSNES, type::PCCompositeType ) + + @chk ccall( + (:SNESMultiblockSetType, $petsc_library), + PetscErrorCode, + (CSNES, PCCompositeType), + snes, type, + ) + + + return nothing +end + +""" + SNESMultiblockSetBlockSize(petsclib::PetscLibType,snes::PetscSNES, bs::PetscInt) +Sets the block size for structured block division in a `SNESMULTIBLOCK` solver. If not set the matrix block size is used. + +Logically Collective + +Input Parameters: +- `snes` - the solver context +- `bs` - the block size + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESMULTIBLOCK`, `SNESMultiblockGetSubSNES()`, `SNESMultiblockSetFields()` + +# External Links +$(_doc_external("SNES/SNESMultiblockSetBlockSize")) +""" +function SNESMultiblockSetBlockSize(petsclib::PetscLibType, snes::PetscSNES, bs::PetscInt) end + +@for_petsc function SNESMultiblockSetBlockSize(petsclib::$UnionPetscLib, snes::PetscSNES, bs::$PetscInt ) + + @chk ccall( + (:SNESMultiblockSetBlockSize, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, bs, + ) + + + return nothing +end + +""" + n::PetscInt = SNESMultiblockGetSubSNES(petsclib::PetscLibType,snes::PetscSNES, subsnes::Vector{PetscSNES}) +Gets the `SNES` contexts for all blocks in a `SNESMULTIBLOCK` solver. + +Not Collective but each `SNES` obtained is parallel + +Input Parameter: +- `snes` - the solver context + +Output Parameters: +- `n` - the number of blocks +- `subsnes` - the array of `SNES` contexts + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESMULTIBLOCK`, `SNESMultiblockSetIS()`, `SNESMultiblockSetFields()` + +# External Links +$(_doc_external("SNES/SNESMultiblockGetSubSNES")) +""" +function SNESMultiblockGetSubSNES(petsclib::PetscLibType, snes::PetscSNES, subsnes::Vector{PetscSNES}) end + +@for_petsc function SNESMultiblockGetSubSNES(petsclib::$UnionPetscLib, snes::PetscSNES, subsnes::Vector{PetscSNES} ) + n_ = Ref{$PetscInt}() + subsnes_ = Ref(pointer(subsnes)) + + @chk ccall( + (:SNESMultiblockGetSubSNES, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}, Ptr{Ptr{CSNES}}), + snes, n_, subsnes_, + ) + + n = n_[] + + return n +end + +""" + SNESNCGSetType(petsclib::PetscLibType,snes::PetscSNES, btype::SNESNCGType) +Sets the conjugate update type for nonlinear CG `SNESNCG`. + +Logically Collective + +Input Parameters: +- `snes` - the iterative context +- `btype` - update type, see `SNESNCGType` + +Options Database Key: +- `-snes_ncg_type ` - strategy for selecting algorithm for computing beta + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNCG`, `SNESNCGType`, `SNES_NCG_FR`, `SNES_NCG_PRP`, `SNES_NCG_HS`, `SNES_NCG_DY`, `SNES_NCG_CD` + +# External Links +$(_doc_external("SNES/SNESNCGSetType")) +""" +function SNESNCGSetType(petsclib::PetscLibType, snes::PetscSNES, btype::SNESNCGType) end + +@for_petsc function SNESNCGSetType(petsclib::$UnionPetscLib, snes::PetscSNES, btype::SNESNCGType ) + + @chk ccall( + (:SNESNCGSetType, $petsc_library), + PetscErrorCode, + (CSNES, SNESNCGType), + snes, btype, + ) + + + return nothing +end + +""" + Xcoarse::PetscVec = SNESFASCreateCoarseVec(petsclib::PetscLibType,snes::PetscSNES) +create a `Vec` corresponding to a state vector on one level coarser than the current level + +Collective + +Input Parameter: +- `snes` - `SNESFAS` object + +Output Parameter: +- `Xcoarse` - vector on level one coarser than the current level + +Level: developer + +-seealso: [](ch_snes), `SNESFASSetRestriction()`, `SNESFASRestrict()`, `SNESFAS` + +# External Links +$(_doc_external("SNES/SNESFASCreateCoarseVec")) +""" +function SNESFASCreateCoarseVec(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESFASCreateCoarseVec(petsclib::$UnionPetscLib, snes::PetscSNES ) + Xcoarse_ = Ref{CVec}() + + @chk ccall( + (:SNESFASCreateCoarseVec, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CVec}), + snes, Xcoarse_, + ) + + Xcoarse = PetscVec(Xcoarse_[], petsclib) + + return Xcoarse +end + +""" + SNESFASRestrict(petsclib::PetscLibType,fine::PetscSNES, Xfine::PetscVec, Xcoarse::PetscVec) +restrict a `Vec` to the next coarser level + +Collective + +Input Parameters: +- `fine` - `SNES` from which to restrict +- `Xfine` - vector to restrict + +Output Parameter: +- `Xcoarse` - result of restriction + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetRestriction()`, `SNESFASSetInjection()`, `SNESFASCreateCoarseVec()` + +# External Links +$(_doc_external("SNES/SNESFASRestrict")) +""" +function SNESFASRestrict(petsclib::PetscLibType, fine::PetscSNES, Xfine::PetscVec, Xcoarse::PetscVec) end + +@for_petsc function SNESFASRestrict(petsclib::$UnionPetscLib, fine::PetscSNES, Xfine::PetscVec, Xcoarse::PetscVec ) + + @chk ccall( + (:SNESFASRestrict, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec), + fine, Xfine, Xcoarse, + ) + + + return nothing +end + +""" + flg::PetscBool = SNESFASGetGalerkin(petsclib::PetscLibType,snes::PetscSNES) +Gets if the coarse problems are formed by projection to the fine problem + +Not Collective but the result would be the same on all MPI processes + +Input Parameter: +- `snes` - the `SNESFAS` nonlinear solver context + +Output Parameter: +- `flg` - `PETSC_TRUE` if the coarse problem is formed by projection + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetLevels()`, `SNESFASSetGalerkin()` + +# External Links +$(_doc_external("SNES/SNESFASGetGalerkin")) +""" +function SNESFASGetGalerkin(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESFASGetGalerkin(petsclib::$UnionPetscLib, snes::PetscSNES ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:SNESFASGetGalerkin, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + SNESFASSetGalerkin(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool) +Sets coarse problems as formed by projection to the fine problem + +Logically Collective + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear solver context +- `flg` - `PETSC_TRUE` to use the projection process + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetLevels()`, `SNESFASGetGalerkin()` + +# External Links +$(_doc_external("SNES/SNESFASSetGalerkin")) +""" +function SNESFASSetGalerkin(petsclib::PetscLibType, snes::PetscSNES, flg::PetscBool) end + +@for_petsc function SNESFASSetGalerkin(petsclib::$UnionPetscLib, snes::PetscSNES, flg::PetscBool ) + + @chk ccall( + (:SNESFASSetGalerkin, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, flg, + ) + + + return nothing +end + +""" + SNESFASGalerkinFunctionDefault(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec, ctx::Cvoid) +Computes the Galerkin FAS function + +Collective + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear solver context +- `X` - input vector +- `ctx` - the application context + +Output Parameter: +- `F` - output vector + +Level: developer + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASGetGalerkin()`, `SNESFASSetGalerkin()` + +# External Links +$(_doc_external("SNES/SNESFASGalerkinFunctionDefault")) +""" +function SNESFASGalerkinFunctionDefault(petsclib::PetscLibType, snes::PetscSNES, X::PetscVec, F::PetscVec, ctx::Cvoid) end + +@for_petsc function SNESFASGalerkinFunctionDefault(petsclib::$UnionPetscLib, snes::PetscSNES, X::PetscVec, F::PetscVec, ctx::Cvoid ) + + @chk ccall( + (:SNESFASGalerkinFunctionDefault, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, Ptr{Cvoid}), + snes, X, F, ctx, + ) + + + return nothing +end + +""" + SNESFASSetType(petsclib::PetscLibType,snes::PetscSNES, fastype::SNESFASType) +Sets the update and correction type used for `SNESFAS`. + +Logically Collective + +Input Parameters: +- `snes` - `SNESFAS` context +- `fastype` - `SNES_FAS_ADDITIVE`, `SNES_FAS_MULTIPLICATIVE`, `SNES_FAS_FULL`, or `SNES_FAS_KASKADE` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `PCMGSetType()`, `SNESFASGetType()`, `SNES_FAS_ADDITIVE`, `SNES_FAS_MULTIPLICATIVE`, `SNES_FAS_FULL`, `SNES_FAS_KASKADE` + +# External Links +$(_doc_external("SNES/SNESFASSetType")) +""" +function SNESFASSetType(petsclib::PetscLibType, snes::PetscSNES, fastype::SNESFASType) end + +@for_petsc function SNESFASSetType(petsclib::$UnionPetscLib, snes::PetscSNES, fastype::SNESFASType ) + + @chk ccall( + (:SNESFASSetType, $petsc_library), + PetscErrorCode, + (CSNES, SNESFASType), + snes, fastype, + ) + + + return nothing +end + +""" + fastype::SNESFASType = SNESFASGetType(petsclib::PetscLibType,snes::PetscSNES) +Gets the update and correction type used for `SNESFAS`. + +Logically Collective + +Input Parameter: +- `snes` - `SNESFAS` context + +Output Parameter: +- `fastype` - `SNES_FAS_ADDITIVE`, `SNES_FAS_MULTIPLICATIVE`, `SNES_FAS_FULL`, or `SNES_FAS_KASKADE` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `PCMGSetType()`, `SNESFASSetType()`, `SNES_FAS_ADDITIVE`, `SNES_FAS_MULTIPLICATIVE`, `SNES_FAS_FULL`, `SNES_FAS_KASKADE` + +# External Links +$(_doc_external("SNES/SNESFASGetType")) +""" +function SNESFASGetType(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESFASGetType(petsclib::$UnionPetscLib, snes::PetscSNES ) + fastype_ = Ref{SNESFASType}() + + @chk ccall( + (:SNESFASGetType, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{SNESFASType}), + snes, fastype_, + ) + + fastype = unsafe_string(fastype_[]) + + return fastype +end + +""" + SNESFASSetLevels(petsclib::PetscLibType,snes::PetscSNES, levels::PetscInt, comms::MPI_Comm) +Sets the number of levels to use with `SNESFAS`. +Must be called before any other `SNESFAS` routine. + +Input Parameters: +- `snes` - the `SNES` context of `SNESType` `SNESFAS` +- `levels` - the number of levels +- `comms` - optional communicators for each level; this is to allow solving the coarser +problems on smaller sets of processors. + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASGetLevels()` + +# External Links +$(_doc_external("SNES/SNESFASSetLevels")) +""" +function SNESFASSetLevels(petsclib::PetscLibType, snes::PetscSNES, levels::PetscInt, comms::MPI_Comm) end + +@for_petsc function SNESFASSetLevels(petsclib::$UnionPetscLib, snes::PetscSNES, levels::$PetscInt, comms::MPI_Comm ) + + @chk ccall( + (:SNESFASSetLevels, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{MPI_Comm}), + snes, levels, comms, + ) + + + return nothing +end + +""" + levels::PetscInt = SNESFASGetLevels(petsclib::PetscLibType,snes::PetscSNES) +Gets the number of levels in a `SNESFAS`, including fine and coarse grids + +Input Parameter: +- `snes` - the `SNES` nonlinear solver context of `SNESType` `SNESFAS` + +Output Parameter: +- `levels` - the number of levels + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetLevels()`, `PCMGGetLevels()` + +# External Links +$(_doc_external("SNES/SNESFASGetLevels")) +""" +function SNESFASGetLevels(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESFASGetLevels(petsclib::$UnionPetscLib, snes::PetscSNES ) + levels_ = Ref{$PetscInt}() + + @chk ccall( + (:SNESFASGetLevels, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscInt}), + snes, levels_, + ) + + levels = levels_[] + + return levels +end + +""" + SNESFASGetCycleSNES(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, lsnes::PetscSNES) +Gets the `SNES` corresponding to a particular level of the `SNESFAS` hierarchy + +Input Parameters: +- `snes` - the `SNES` nonlinear multigrid context +- `level` - the level to get + +Output Parameter: +- `lsnes` - the `SNES` for the requested level + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetLevels()`, `SNESFASGetLevels()` + +# External Links +$(_doc_external("SNES/SNESFASGetCycleSNES")) +""" +function SNESFASGetCycleSNES(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, lsnes::PetscSNES) end + +@for_petsc function SNESFASGetCycleSNES(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, lsnes::PetscSNES ) + lsnes_ = Ref(lsnes.ptr) + + @chk ccall( + (:SNESFASGetCycleSNES, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CSNES}), + snes, level, lsnes_, + ) + + lsnes.ptr = C_NULL + + return nothing +end + +""" + SNESFASSetNumberSmoothUp(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt) +Sets the number of post +use on all levels. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` nonlinear multigrid context +- `n` - the number of smoothing steps to use + +Options Database Key: +- `-snes_fas_smoothup ` - Sets number of pre-smoothing steps + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetNumberSmoothDown()` + +# External Links +$(_doc_external("SNES/SNESFASSetNumberSmoothUp")) +""" +function SNESFASSetNumberSmoothUp(petsclib::PetscLibType, snes::PetscSNES, n::PetscInt) end + +@for_petsc function SNESFASSetNumberSmoothUp(petsclib::$UnionPetscLib, snes::PetscSNES, n::$PetscInt ) + + @chk ccall( + (:SNESFASSetNumberSmoothUp, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, n, + ) + + + return nothing +end + +""" + SNESFASSetNumberSmoothDown(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt) +Sets the number of pre +use on all levels. + +Logically Collective + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `n` - the number of smoothing steps to use + +Options Database Key: +- `-snes_fas_smoothdown ` - Sets number of pre-smoothing steps + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetNumberSmoothUp()` + +# External Links +$(_doc_external("SNES/SNESFASSetNumberSmoothDown")) +""" +function SNESFASSetNumberSmoothDown(petsclib::PetscLibType, snes::PetscSNES, n::PetscInt) end + +@for_petsc function SNESFASSetNumberSmoothDown(petsclib::$UnionPetscLib, snes::PetscSNES, n::$PetscInt ) + + @chk ccall( + (:SNESFASSetNumberSmoothDown, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, n, + ) + + + return nothing +end + +""" + SNESFASSetContinuation(petsclib::PetscLibType,snes::PetscSNES, continuation::PetscBool) +Sets the `SNESFAS` cycle to default to using exact Newton solves on the upsweep + +Logically Collective + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `continuation` - whether to use continuation + +Options Database Key: +- `-snes_fas_continuation` - sets continuation to true + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetNumberSmoothUp()` + +# External Links +$(_doc_external("SNES/SNESFASSetContinuation")) +""" +function SNESFASSetContinuation(petsclib::PetscLibType, snes::PetscSNES, continuation::PetscBool) end + +@for_petsc function SNESFASSetContinuation(petsclib::$UnionPetscLib, snes::PetscSNES, continuation::PetscBool ) + + @chk ccall( + (:SNESFASSetContinuation, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, continuation, + ) + + + return nothing +end + +""" + SNESFASSetCycles(petsclib::PetscLibType,snes::PetscSNES, cycles::PetscInt) +Sets the number of `SNESFAS` multigrid cycles to use each time a grid is visited. Use `SNESFASSetCyclesOnLevel()` for more +complicated cycling. + +Logically Collective + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `cycles` - the number of cycles -- 1 for V-cycle, 2 for W-cycle + +Options Database Key: +- `-snes_fas_cycles <1,2>` - 1 for V-cycle, 2 for W-cycle + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetCyclesOnLevel()` + +# External Links +$(_doc_external("SNES/SNESFASSetCycles")) +""" +function SNESFASSetCycles(petsclib::PetscLibType, snes::PetscSNES, cycles::PetscInt) end + +@for_petsc function SNESFASSetCycles(petsclib::$UnionPetscLib, snes::PetscSNES, cycles::$PetscInt ) + + @chk ccall( + (:SNESFASSetCycles, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, cycles, + ) + + + return nothing +end + +""" + SNESFASSetMonitor(petsclib::PetscLibType,snes::PetscSNES, vf::PetscViewerAndFormat, flg::PetscBool) +Sets the method + +Logically Collective + +Input Parameters: +- `snes` - the `SNESFAS` context +- `vf` - viewer and format structure (may be `NULL` if `flg` is `PETSC_FALSE`) +- `flg` - monitor or not + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESMonitorSet()`, `SNESFASSetCyclesOnLevel()` + +# External Links +$(_doc_external("SNES/SNESFASSetMonitor")) +""" +function SNESFASSetMonitor(petsclib::PetscLibType, snes::PetscSNES, vf::PetscViewerAndFormat, flg::PetscBool) end + +@for_petsc function SNESFASSetMonitor(petsclib::$UnionPetscLib, snes::PetscSNES, vf::PetscViewerAndFormat, flg::PetscBool ) + + @chk ccall( + (:SNESFASSetMonitor, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscViewerAndFormat}, PetscBool), + snes, vf, flg, + ) + + + return nothing +end + +""" + SNESFASSetLog(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool) +Sets or unsets time logging for various `SNESFAS` stages on all levels + +Logically Collective + +Input Parameters: +- `snes` - the `SNESFAS` context +- `flg` - whether to log or not + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetMonitor()` + +# External Links +$(_doc_external("SNES/SNESFASSetLog")) +""" +function SNESFASSetLog(petsclib::PetscLibType, snes::PetscSNES, flg::PetscBool) end + +@for_petsc function SNESFASSetLog(petsclib::$UnionPetscLib, snes::PetscSNES, flg::PetscBool ) + + @chk ccall( + (:SNESFASSetLog, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, flg, + ) + + + return nothing +end + +""" + SNESFASCycleSetCycles(petsclib::PetscLibType,snes::PetscSNES, cycles::PetscInt) +Sets the number of cycles for all levels in a `SNESFAS` + +Logically Collective + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `cycles` - the number of cycles -- 1 for V-cycle, 2 for W-cycle + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetCycles()` + +# External Links +$(_doc_external("SNES/SNESFASCycleSetCycles")) +""" +function SNESFASCycleSetCycles(petsclib::PetscLibType, snes::PetscSNES, cycles::PetscInt) end + +@for_petsc function SNESFASCycleSetCycles(petsclib::$UnionPetscLib, snes::PetscSNES, cycles::$PetscInt ) + + @chk ccall( + (:SNESFASCycleSetCycles, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt), + snes, cycles, + ) + + + return nothing +end + +""" + SNESFASCycleGetSmoother(petsclib::PetscLibType,snes::PetscSNES, smooth::PetscSNES) +Gets the smoother on a particular cycle level. + +Logically Collective + +Input Parameter: +- `snes` - the `SNESFAS` obtained with `SNESFASGetCycleSNES()` + +Output Parameter: +- `smooth` - the smoother + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASCycleGetSmootherUp()`, `SNESFASCycleGetSmootherDown()`, `SNESFASGetCycleSNES()` + +# External Links +$(_doc_external("SNES/SNESFASCycleGetSmoother")) +""" +function SNESFASCycleGetSmoother(petsclib::PetscLibType, snes::PetscSNES, smooth::PetscSNES) end + +@for_petsc function SNESFASCycleGetSmoother(petsclib::$UnionPetscLib, snes::PetscSNES, smooth::PetscSNES ) + smooth_ = Ref(smooth.ptr) + + @chk ccall( + (:SNESFASCycleGetSmoother, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CSNES}), + snes, smooth_, + ) + + smooth.ptr = C_NULL + + return nothing +end + +""" + SNESFASCycleGetSmootherUp(petsclib::PetscLibType,snes::PetscSNES, smoothu::PetscSNES) +Gets the up smoother on a particular cycle level. + +Logically Collective + +Input Parameter: +- `snes` - the `SNESFAS` obtained with `SNESFASGetCycleSNES()` + +Output Parameter: +- `smoothu` - the smoother + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASCycleGetSmoother()`, `SNESFASCycleGetSmootherDown()`, `SNESFASGetCycleSNES()` + +# External Links +$(_doc_external("SNES/SNESFASCycleGetSmootherUp")) +""" +function SNESFASCycleGetSmootherUp(petsclib::PetscLibType, snes::PetscSNES, smoothu::PetscSNES) end + +@for_petsc function SNESFASCycleGetSmootherUp(petsclib::$UnionPetscLib, snes::PetscSNES, smoothu::PetscSNES ) + smoothu_ = Ref(smoothu.ptr) + + @chk ccall( + (:SNESFASCycleGetSmootherUp, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CSNES}), + snes, smoothu_, + ) + + smoothu.ptr = C_NULL + + return nothing +end + +""" + SNESFASCycleGetSmootherDown(petsclib::PetscLibType,snes::PetscSNES, smoothd::PetscSNES) +Gets the down smoother on a particular cycle level. + +Logically Collective + +Input Parameter: +- `snes` - `SNESFAS` obtained with `SNESFASGetCycleSNES()` + +Output Parameter: +- `smoothd` - the smoother + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASCycleGetSmootherUp()`, `SNESFASCycleGetSmoother()`, `SNESFASGetCycleSNES()` + +# External Links +$(_doc_external("SNES/SNESFASCycleGetSmootherDown")) +""" +function SNESFASCycleGetSmootherDown(petsclib::PetscLibType, snes::PetscSNES, smoothd::PetscSNES) end + +@for_petsc function SNESFASCycleGetSmootherDown(petsclib::$UnionPetscLib, snes::PetscSNES, smoothd::PetscSNES ) + smoothd_ = Ref(smoothd.ptr) + + @chk ccall( + (:SNESFASCycleGetSmootherDown, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CSNES}), + snes, smoothd_, + ) + + smoothd.ptr = C_NULL + + return nothing +end + +""" + SNESFASCycleGetCorrection(petsclib::PetscLibType,snes::PetscSNES, correction::PetscSNES) +Gets the coarse correction `SNESFAS` context for this level + +Logically Collective + +Input Parameter: +- `snes` - the `SNESFAS` obtained with `SNESFASGetCycleSNES()` + +Output Parameter: +- `correction` - the coarse correction solve on this level + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS` `SNESFASCycleGetSmootherUp()`, `SNESFASCycleGetSmoother()` + +# External Links +$(_doc_external("SNES/SNESFASCycleGetCorrection")) +""" +function SNESFASCycleGetCorrection(petsclib::PetscLibType, snes::PetscSNES, correction::PetscSNES) end + +@for_petsc function SNESFASCycleGetCorrection(petsclib::$UnionPetscLib, snes::PetscSNES, correction::PetscSNES ) + correction_ = Ref(correction.ptr) + + @chk ccall( + (:SNESFASCycleGetCorrection, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CSNES}), + snes, correction_, + ) + + correction.ptr = C_NULL + + return nothing +end + +""" + SNESFASCycleGetInterpolation(petsclib::PetscLibType,snes::PetscSNES, mat::PetscMat) +Gets the interpolation on a level + +Logically Collective + +Input Parameter: +- `snes` - the `SNESFAS` obtained with `SNESFASGetCycleSNES()` + +Output Parameter: +- `mat` - the interpolation operator on this level + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASCycleGetSmootherUp()`, `SNESFASCycleGetSmoother()` + +# External Links +$(_doc_external("SNES/SNESFASCycleGetInterpolation")) +""" +function SNESFASCycleGetInterpolation(petsclib::PetscLibType, snes::PetscSNES, mat::PetscMat) end + +@for_petsc function SNESFASCycleGetInterpolation(petsclib::$UnionPetscLib, snes::PetscSNES, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:SNESFASCycleGetInterpolation, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CMat}), + snes, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + SNESFASCycleGetRestriction(petsclib::PetscLibType,snes::PetscSNES, mat::PetscMat) +Gets the restriction on a level + +Logically Collective + +Input Parameter: +- `snes` - the `SNESFAS` obtained with `SNESFASGetCycleSNES()` + +Output Parameter: +- `mat` - the restriction operator on this level + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASGetRestriction()`, `SNESFASCycleGetInterpolation()` + +# External Links +$(_doc_external("SNES/SNESFASCycleGetRestriction")) +""" +function SNESFASCycleGetRestriction(petsclib::PetscLibType, snes::PetscSNES, mat::PetscMat) end + +@for_petsc function SNESFASCycleGetRestriction(petsclib::$UnionPetscLib, snes::PetscSNES, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:SNESFASCycleGetRestriction, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CMat}), + snes, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + SNESFASCycleGetInjection(petsclib::PetscLibType,snes::PetscSNES, mat::PetscMat) +Gets the injection on a level + +Logically Collective + +Input Parameter: +- `snes` - the `SNESFAS` obtained with `SNESFASGetCycleSNES()` + +Output Parameter: +- `mat` - the restriction operator on this level + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASGetInjection()`, `SNESFASCycleGetRestriction()` + +# External Links +$(_doc_external("SNES/SNESFASCycleGetInjection")) +""" +function SNESFASCycleGetInjection(petsclib::PetscLibType, snes::PetscSNES, mat::PetscMat) end + +@for_petsc function SNESFASCycleGetInjection(petsclib::$UnionPetscLib, snes::PetscSNES, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:SNESFASCycleGetInjection, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CMat}), + snes, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + SNESFASCycleGetRScale(petsclib::PetscLibType,snes::PetscSNES, vec::PetscVec) +Gets the injection scale + +Logically Collective + +Input Parameter: +- `snes` - the `SNESFAS` obtained with `SNESFASGetCycleSNES()` + +Output Parameter: +- `vec` - the restriction operator on this level + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASCycleGetRestriction()`, `SNESFASGetRScale()` + +# External Links +$(_doc_external("SNES/SNESFASCycleGetRScale")) +""" +function SNESFASCycleGetRScale(petsclib::PetscLibType, snes::PetscSNES, vec::PetscVec) end + +@for_petsc function SNESFASCycleGetRScale(petsclib::$UnionPetscLib, snes::PetscSNES, vec::PetscVec ) + vec_ = Ref(vec.ptr) + + @chk ccall( + (:SNESFASCycleGetRScale, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CVec}), + snes, vec_, + ) + + vec.ptr = C_NULL + + return nothing +end + +""" + flg::PetscBool = SNESFASCycleIsFine(petsclib::PetscLibType,snes::PetscSNES) +Determines if a given `SNES` is the finest level in a `SNESFAS` + +Logically Collective + +Input Parameter: +- `snes` - the `SNESFAS` context obtained with `SNESFASGetCycleSNES()` + +Output Parameter: +- `flg` - indicates if this is the fine level or not + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetLevels()` + +# External Links +$(_doc_external("SNES/SNESFASCycleIsFine")) +""" +function SNESFASCycleIsFine(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESFASCycleIsFine(petsclib::$UnionPetscLib, snes::PetscSNES ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:SNESFASCycleIsFine, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + SNESFASSetInterpolation(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat) +Sets the `Mat` to be used to apply the +interpolation from l-1 to the lth level + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `mat` - the interpolation operator +- `level` - the level (0 is coarsest) to supply [do not supply 0] + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetInjection()`, `SNESFASSetRestriction()`, `SNESFASSetRScale()` + +# External Links +$(_doc_external("SNES/SNESFASSetInterpolation")) +""" +function SNESFASSetInterpolation(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, mat::PetscMat) end + +@for_petsc function SNESFASSetInterpolation(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, mat::PetscMat ) + + @chk ccall( + (:SNESFASSetInterpolation, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, CMat), + snes, level, mat, + ) + + + return nothing +end + +""" + SNESFASGetInterpolation(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat) +Gets the matrix used to calculate the +interpolation from l-1 to the lth level + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `level` - the level (0 is coarsest) to supply [do not supply 0] + +Output Parameter: +- `mat` - the interpolation operator + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetInterpolation()`, `SNESFASGetInjection()`, `SNESFASGetRestriction()`, `SNESFASGetRScale()` + +# External Links +$(_doc_external("SNES/SNESFASGetInterpolation")) +""" +function SNESFASGetInterpolation(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, mat::PetscMat) end + +@for_petsc function SNESFASGetInterpolation(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:SNESFASGetInterpolation, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CMat}), + snes, level, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + SNESFASSetRestriction(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat) +Sets the matrix to be used to restrict the defect +from level l to l-1. + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `mat` - the restriction matrix +- `level` - the level (0 is coarsest) to supply [Do not supply 0] + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetInterpolation()`, `SNESFASSetInjection()` + +# External Links +$(_doc_external("SNES/SNESFASSetRestriction")) +""" +function SNESFASSetRestriction(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, mat::PetscMat) end + +@for_petsc function SNESFASSetRestriction(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, mat::PetscMat ) + + @chk ccall( + (:SNESFASSetRestriction, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, CMat), + snes, level, mat, + ) + + + return nothing +end + +""" + SNESFASGetRestriction(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat) +Gets the matrix used to calculate the +restriction from l to the l-1th level + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `level` - the level (0 is coarsest) to supply [do not supply 0] + +Output Parameter: +- `mat` - the interpolation operator + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetRestriction()`, `SNESFASGetInjection()`, `SNESFASGetInterpolation()`, `SNESFASGetRScale()` + +# External Links +$(_doc_external("SNES/SNESFASGetRestriction")) +""" +function SNESFASGetRestriction(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, mat::PetscMat) end + +@for_petsc function SNESFASGetRestriction(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:SNESFASGetRestriction, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CMat}), + snes, level, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + SNESFASSetInjection(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat) +Sets the matrix to be used to inject the solution +from `level` to `level-1`. + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `mat` - the injection matrix +- `level` - the level (0 is coarsest) to supply [Do not supply 0] + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetInterpolation()`, `SNESFASSetRestriction()` + +# External Links +$(_doc_external("SNES/SNESFASSetInjection")) +""" +function SNESFASSetInjection(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, mat::PetscMat) end + +@for_petsc function SNESFASSetInjection(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, mat::PetscMat ) + + @chk ccall( + (:SNESFASSetInjection, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, CMat), + snes, level, mat, + ) + + + return nothing +end + +""" + SNESFASGetInjection(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat) +Gets the matrix used to calculate the +injection from l-1 to the lth level + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `level` - the level (0 is coarsest) to supply [do not supply 0] + +Output Parameter: +- `mat` - the injection operator + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetInjection()`, `SNESFASGetRestriction()`, `SNESFASGetInterpolation()`, `SNESFASGetRScale()` + +# External Links +$(_doc_external("SNES/SNESFASGetInjection")) +""" +function SNESFASGetInjection(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, mat::PetscMat) end + +@for_petsc function SNESFASGetInjection(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, mat::PetscMat ) + mat_ = Ref(mat.ptr) + + @chk ccall( + (:SNESFASGetInjection, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CMat}), + snes, level, mat_, + ) + + mat.ptr = C_NULL + + return nothing +end + +""" + SNESFASSetRScale(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, rscale::PetscVec) +Sets the scaling factor of the restriction +operator from level l to l-1. + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `rscale` - the restriction scaling +- `level` - the level (0 is coarsest) to supply [Do not supply 0] + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetInjection()`, `SNESFASSetRestriction()` + +# External Links +$(_doc_external("SNES/SNESFASSetRScale")) +""" +function SNESFASSetRScale(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, rscale::PetscVec) end + +@for_petsc function SNESFASSetRScale(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, rscale::PetscVec ) + + @chk ccall( + (:SNESFASSetRScale, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, CVec), + snes, level, rscale, + ) + + + return nothing +end + +""" + SNESFASGetSmoother(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, smooth::PetscSNES) +Gets the default smoother on a level. + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `level` - the level (0 is coarsest) to supply + +Output Parameter: +- `smooth` - the smoother + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetInjection()`, `SNESFASSetRestriction()` + +# External Links +$(_doc_external("SNES/SNESFASGetSmoother")) +""" +function SNESFASGetSmoother(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, smooth::PetscSNES) end + +@for_petsc function SNESFASGetSmoother(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, smooth::PetscSNES ) + smooth_ = Ref(smooth.ptr) + + @chk ccall( + (:SNESFASGetSmoother, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CSNES}), + snes, level, smooth_, + ) + + smooth.ptr = C_NULL + + return nothing +end + +""" + SNESFASGetSmootherDown(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, smooth::PetscSNES) +Gets the downsmoother on a level. + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `level` - the level (0 is coarsest) to supply + +Output Parameter: +- `smooth` - the smoother + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetInjection()`, `SNESFASSetRestriction()` + +# External Links +$(_doc_external("SNES/SNESFASGetSmootherDown")) +""" +function SNESFASGetSmootherDown(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, smooth::PetscSNES) end + +@for_petsc function SNESFASGetSmootherDown(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, smooth::PetscSNES ) + smooth_ = Ref(smooth.ptr) + + @chk ccall( + (:SNESFASGetSmootherDown, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CSNES}), + snes, level, smooth_, + ) + + smooth.ptr = C_NULL + + return nothing +end + +""" + SNESFASGetSmootherUp(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, smooth::PetscSNES) +Gets the upsmoother on a level. + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `level` - the level (0 is coarsest) + +Output Parameter: +- `smooth` - the smoother + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetInjection()`, `SNESFASSetRestriction()` + +# External Links +$(_doc_external("SNES/SNESFASGetSmootherUp")) +""" +function SNESFASGetSmootherUp(petsclib::PetscLibType, snes::PetscSNES, level::PetscInt, smooth::PetscSNES) end + +@for_petsc function SNESFASGetSmootherUp(petsclib::$UnionPetscLib, snes::PetscSNES, level::$PetscInt, smooth::PetscSNES ) + smooth_ = Ref(smooth.ptr) + + @chk ccall( + (:SNESFASGetSmootherUp, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, Ptr{CSNES}), + snes, level, smooth_, + ) + + smooth.ptr = C_NULL + + return nothing +end + +""" + SNESFASGetCoarseSolve(petsclib::PetscLibType,snes::PetscSNES, coarse::PetscSNES) +Gets the coarsest level solver. + +Input Parameter: +- `snes` - the `SNESFAS` nonlinear multigrid context + +Output Parameter: +- `coarse` - the coarse-level solver + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetInjection()`, `SNESFASSetRestriction()` + +# External Links +$(_doc_external("SNES/SNESFASGetCoarseSolve")) +""" +function SNESFASGetCoarseSolve(petsclib::PetscLibType, snes::PetscSNES, coarse::PetscSNES) end + +@for_petsc function SNESFASGetCoarseSolve(petsclib::$UnionPetscLib, snes::PetscSNES, coarse::PetscSNES ) + coarse_ = Ref(coarse.ptr) + + @chk ccall( + (:SNESFASGetCoarseSolve, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{CSNES}), + snes, coarse_, + ) + + coarse.ptr = C_NULL + + return nothing +end + +""" + SNESFASFullSetDownSweep(petsclib::PetscLibType,snes::PetscSNES, swp::PetscBool) +Smooth during the initial downsweep for `SNESFAS` + +Logically Collective + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `swp` - whether to downsweep or not + +Options Database Key: +- `-snes_fas_full_downsweep` - Sets whether to smooth on the initial downsweep + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetNumberSmoothUp()` + +# External Links +$(_doc_external("SNES/SNESFASFullSetDownSweep")) +""" +function SNESFASFullSetDownSweep(petsclib::PetscLibType, snes::PetscSNES, swp::PetscBool) end + +@for_petsc function SNESFASFullSetDownSweep(petsclib::$UnionPetscLib, snes::PetscSNES, swp::PetscBool ) + + @chk ccall( + (:SNESFASFullSetDownSweep, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, swp, + ) + + + return nothing +end + +""" + SNESFASFullSetTotal(petsclib::PetscLibType,snes::PetscSNES, total::PetscBool) +Use total residual restriction and total interpolation on the initial down and up sweep of full `SNESFAS` cycles + +Logically Collective + +Input Parameters: +- `snes` - the `SNESFAS` nonlinear multigrid context +- `total` - whether to use total restriction / interpolatiaon or not (the alternative is defect restriction and correction interpolation) + +Options Database Key: +- `-snes_fas_full_total` - Use total restriction and interpolation on the initial down and up sweeps for the full `SNESFAS` cycle + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetNumberSmoothUp()`, `DMInterpolateSolution()` + +# External Links +$(_doc_external("SNES/SNESFASFullSetTotal")) +""" +function SNESFASFullSetTotal(petsclib::PetscLibType, snes::PetscSNES, total::PetscBool) end + +@for_petsc function SNESFASFullSetTotal(petsclib::$UnionPetscLib, snes::PetscSNES, total::PetscBool ) + + @chk ccall( + (:SNESFASFullSetTotal, $petsc_library), + PetscErrorCode, + (CSNES, PetscBool), + snes, total, + ) + + + return nothing +end + +""" + total::PetscBool = SNESFASFullGetTotal(petsclib::PetscLibType,snes::PetscSNES) +Use total residual restriction and total interpolation on the initial down and up sweep of full FAS cycles + +Logically Collective + +Input Parameter: +- `snes` - the `SNESFAS` nonlinear multigrid context + +Output Parameter: +- `total` - whether to use total restriction / interpolatiaon or not (the alternative is defect restriction and correction interpolation) + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `SNESFAS`, `SNESFASSetNumberSmoothUp()`, `DMInterpolateSolution()`, `SNESFullSetTotal()` + +# External Links +$(_doc_external("SNES/SNESFASFullGetTotal")) +""" +function SNESFASFullGetTotal(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESFASFullGetTotal(petsclib::$UnionPetscLib, snes::PetscSNES ) + total_ = Ref{PetscBool}() + + @chk ccall( + (:SNESFASFullGetTotal, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{PetscBool}), + snes, total_, + ) + + total = total_[] + + return total +end + +""" + SNESNewtonTRSetNormType(petsclib::PetscLibType,snes::PetscSNES, norm::NormType) +Specify the type of norm to use for the computation of the trust region. + +Input Parameters: +- `snes` - the nonlinear solver object +- `norm` - the norm type + +Level: intermediate + +-seealso: `SNESNEWTONTR`, `NormType` + +# External Links +$(_doc_external("SNES/SNESNewtonTRSetNormType")) +""" +function SNESNewtonTRSetNormType(petsclib::PetscLibType, snes::PetscSNES, norm::NormType) end + +@for_petsc function SNESNewtonTRSetNormType(petsclib::$UnionPetscLib, snes::PetscSNES, norm::NormType ) + + @chk ccall( + (:SNESNewtonTRSetNormType, $petsc_library), + PetscErrorCode, + (CSNES, NormType), + snes, norm, + ) + + + return nothing +end + +""" + SNESNewtonTRSetQNType(petsclib::PetscLibType,snes::PetscSNES, use::SNESNewtonTRQNType) +Specify to use a quasi + +Input Parameters: +- `snes` - the nonlinear solver object +- `use` - the type of approximations to be used + +Level: intermediate + +-seealso: `SNESNEWTONTR`, `SNESNewtonTRQNType`, `MATLMVM` + +# External Links +$(_doc_external("SNES/SNESNewtonTRSetQNType")) +""" +function SNESNewtonTRSetQNType(petsclib::PetscLibType, snes::PetscSNES, use::SNESNewtonTRQNType) end + +@for_petsc function SNESNewtonTRSetQNType(petsclib::$UnionPetscLib, snes::PetscSNES, use::SNESNewtonTRQNType ) + + @chk ccall( + (:SNESNewtonTRSetQNType, $petsc_library), + PetscErrorCode, + (CSNES, SNESNewtonTRQNType), + snes, use, + ) + + + return nothing +end + +""" + SNESNewtonTRSetFallbackType(petsclib::PetscLibType,snes::PetscSNES, ftype::SNESNewtonTRFallbackType) +Set the type of fallback to use if the solution of the trust region subproblem is outside the radius + +Input Parameters: +- `snes` - the nonlinear solver object +- `ftype` - the fallback type, see `SNESNewtonTRFallbackType` + +Level: intermediate + +-seealso: [](ch_snes), `SNESNEWTONTR`, `SNESNewtonTRPreCheck()`, `SNESNewtonTRGetPreCheck()`, `SNESNewtonTRSetPreCheck()`, +`SNESNewtonTRSetPostCheck()`, `SNESNewtonTRGetPostCheck()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRSetFallbackType")) +""" +function SNESNewtonTRSetFallbackType(petsclib::PetscLibType, snes::PetscSNES, ftype::SNESNewtonTRFallbackType) end + +@for_petsc function SNESNewtonTRSetFallbackType(petsclib::$UnionPetscLib, snes::PetscSNES, ftype::SNESNewtonTRFallbackType ) + + @chk ccall( + (:SNESNewtonTRSetFallbackType, $petsc_library), + PetscErrorCode, + (CSNES, SNESNewtonTRFallbackType), + snes, ftype, + ) + + + return nothing +end + +""" + SNESNewtonTRSetPreCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid) +Sets a user function that is called before the search step has been determined. +Allows the user a chance to change or override the trust region decision. + +Logically Collective + +Input Parameters: +- `snes` - the nonlinear solver object +- `func` - [optional] function evaluation routine, for the calling sequence see `SNESNewtonTRPreCheck()` +- `ctx` - [optional] user-defined context for private data for the function evaluation routine (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_snes), `SNESNEWTONTR`, `SNESNewtonTRPreCheck()`, `SNESNewtonTRGetPreCheck()`, `SNESNewtonTRSetPostCheck()`, `SNESNewtonTRGetPostCheck()`, + +# External Links +$(_doc_external("SNES/SNESNewtonTRSetPreCheck")) +""" +function SNESNewtonTRSetPreCheck(petsclib::PetscLibType, snes::PetscSNES, func::external, ctx::Cvoid) end + +@for_petsc function SNESNewtonTRSetPreCheck(petsclib::$UnionPetscLib, snes::PetscSNES, func::external, ctx::Cvoid ) + + @chk ccall( + (:SNESNewtonTRSetPreCheck, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{Cvoid}), + snes, func, ctx, + ) + + + return nothing +end + +""" + SNESNewtonTRSetPostCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid) +Sets a user function that is called after the search step has been determined but before the next +function evaluation. Allows the user a chance to change or override the internal decision of the solver + +Logically Collective + +Input Parameters: +- `snes` - the nonlinear solver object +- `func` - [optional] function evaluation routine, for the calling sequence see `SNESNewtonTRPostCheck()` +- `ctx` - [optional] user-defined context for private data for the function evaluation routine (may be `NULL`) + +Level: intermediate + +-seealso: [](ch_snes), `SNESNEWTONTR`, `SNESNewtonTRPostCheck()`, `SNESNewtonTRGetPostCheck()`, `SNESNewtonTRSetPreCheck()`, `SNESNewtonTRGetPreCheck()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRSetPostCheck")) +""" +function SNESNewtonTRSetPostCheck(petsclib::PetscLibType, snes::PetscSNES, func::external, ctx::Cvoid) end + +@for_petsc function SNESNewtonTRSetPostCheck(petsclib::$UnionPetscLib, snes::PetscSNES, func::external, ctx::Cvoid ) + + @chk ccall( + (:SNESNewtonTRSetPostCheck, $petsc_library), + PetscErrorCode, + (CSNES, external, Ptr{Cvoid}), + snes, func, ctx, + ) + + + return nothing +end + +""" + changed_Y::PetscBool = SNESNewtonTRPreCheck(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, Y::PetscVec) +Runs the precheck routine + +Logically Collective + +Input Parameters: +- `snes` - the solver +- `X` - The last solution +- `Y` - The step direction + +Output Parameter: +- `changed_Y` - Indicator that the step direction `Y` has been changed. + +Level: intermediate + +-seealso: [](ch_snes), `SNESNEWTONTR`, `SNESNewtonTRSetPreCheck()`, `SNESNewtonTRGetPreCheck()`, `SNESNewtonTRPostCheck()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRPreCheck")) +""" +function SNESNewtonTRPreCheck(petsclib::PetscLibType, snes::PetscSNES, X::PetscVec, Y::PetscVec) end + +@for_petsc function SNESNewtonTRPreCheck(petsclib::$UnionPetscLib, snes::PetscSNES, X::PetscVec, Y::PetscVec ) + changed_Y_ = Ref{PetscBool}() + + @chk ccall( + (:SNESNewtonTRPreCheck, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, Ptr{PetscBool}), + snes, X, Y, changed_Y_, + ) + + changed_Y = changed_Y_[] + + return changed_Y +end + +""" + changed_Y::PetscBool,changed_W::PetscBool = SNESNewtonTRPostCheck(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, Y::PetscVec, W::PetscVec) +Runs the postcheck routine + +Logically Collective + +Input Parameters: +- `snes` - the solver +- `X` - The last solution +- `Y` - The full step direction +- `W` - The updated solution, W = X - Y + +Output Parameters: +- `changed_Y` - indicator if step has been changed +- `changed_W` - Indicator if the new candidate solution W has been changed. + +-seealso: [](ch_snes), `SNESNEWTONTR`, `SNESNewtonTRSetPostCheck()`, `SNESNewtonTRGetPostCheck()`, `SNESNewtonTRPreCheck()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRPostCheck")) +""" +function SNESNewtonTRPostCheck(petsclib::PetscLibType, snes::PetscSNES, X::PetscVec, Y::PetscVec, W::PetscVec) end + +@for_petsc function SNESNewtonTRPostCheck(petsclib::$UnionPetscLib, snes::PetscSNES, X::PetscVec, Y::PetscVec, W::PetscVec ) + changed_Y_ = Ref{PetscBool}() + changed_W_ = Ref{PetscBool}() + + @chk ccall( + (:SNESNewtonTRPostCheck, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, CVec, Ptr{PetscBool}, Ptr{PetscBool}), + snes, X, Y, W, changed_Y_, changed_W_, + ) + + changed_Y = changed_Y_[] + changed_W = changed_W_[] + + return changed_Y,changed_W +end + +""" + SNESNewtonTRSetTolerances(petsclib::PetscLibType,snes::PetscSNES, delta_min::PetscReal, delta_max::PetscReal, delta_0::PetscReal) +Sets the trust region parameter tolerances. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `delta_min` - minimum allowed trust region size +- `delta_max` - maximum allowed trust region size +- `delta_0` - initial trust region size + +Options Database Key: +- `-snes_tr_deltamin ` - Set minimum size +- `-snes_tr_deltamax ` - Set maximum size +- `-snes_tr_delta0 ` - Set initial size + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONTR`, `SNESNewtonTRGetTolerances()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRSetTolerances")) +""" +function SNESNewtonTRSetTolerances(petsclib::PetscLibType, snes::PetscSNES, delta_min::PetscReal, delta_max::PetscReal, delta_0::PetscReal) end + +@for_petsc function SNESNewtonTRSetTolerances(petsclib::$UnionPetscLib, snes::PetscSNES, delta_min::$PetscReal, delta_max::$PetscReal, delta_0::$PetscReal ) + + @chk ccall( + (:SNESNewtonTRSetTolerances, $petsc_library), + PetscErrorCode, + (CSNES, $PetscReal, $PetscReal, $PetscReal), + snes, delta_min, delta_max, delta_0, + ) + + + return nothing +end + +""" + delta_min::PetscReal,delta_max::PetscReal,delta_0::PetscReal = SNESNewtonTRGetTolerances(petsclib::PetscLibType,snes::PetscSNES) +Gets the trust region parameter tolerances. + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `delta_min` - minimum allowed trust region size or `NULL` +- `delta_max` - maximum allowed trust region size or `NULL` +- `delta_0` - initial trust region size or `NULL` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONTR`, `SNESNewtonTRSetTolerances()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRGetTolerances")) +""" +function SNESNewtonTRGetTolerances(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESNewtonTRGetTolerances(petsclib::$UnionPetscLib, snes::PetscSNES ) + delta_min_ = Ref{$PetscReal}() + delta_max_ = Ref{$PetscReal}() + delta_0_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESNewtonTRGetTolerances, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + snes, delta_min_, delta_max_, delta_0_, + ) + + delta_min = delta_min_[] + delta_max = delta_max_[] + delta_0 = delta_0_[] + + return delta_min,delta_max,delta_0 +end + +""" + SNESNewtonTRSetUpdateParameters(petsclib::PetscLibType,snes::PetscSNES, eta1::PetscReal, eta2::PetscReal, eta3::PetscReal, t1::PetscReal, t2::PetscReal) +Sets the trust region update parameters. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `eta1` - acceptance tolerance +- `eta2` - shrinking tolerance +- `eta3` - enlarging tolerance +- `t1` - shrink factor +- `t2` - enlarge factor + +Options Database Key: +- `-snes_tr_eta1 ` - Set `eta1` +- `-snes_tr_eta2 ` - Set `eta2` +- `-snes_tr_eta3 ` - Set `eta3` +- `-snes_tr_t1 ` - Set `t1` +- `-snes_tr_t2 ` - Set `t2` + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONTR`, `SNESSetObjective()`, `SNESNewtonTRGetUpdateParameters()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRSetUpdateParameters")) +""" +function SNESNewtonTRSetUpdateParameters(petsclib::PetscLibType, snes::PetscSNES, eta1::PetscReal, eta2::PetscReal, eta3::PetscReal, t1::PetscReal, t2::PetscReal) end + +@for_petsc function SNESNewtonTRSetUpdateParameters(petsclib::$UnionPetscLib, snes::PetscSNES, eta1::$PetscReal, eta2::$PetscReal, eta3::$PetscReal, t1::$PetscReal, t2::$PetscReal ) + + @chk ccall( + (:SNESNewtonTRSetUpdateParameters, $petsc_library), + PetscErrorCode, + (CSNES, $PetscReal, $PetscReal, $PetscReal, $PetscReal, $PetscReal), + snes, eta1, eta2, eta3, t1, t2, + ) + + + return nothing +end + +""" + eta1::PetscReal,eta2::PetscReal,eta3::PetscReal,t1::PetscReal,t2::PetscReal = SNESNewtonTRGetUpdateParameters(petsclib::PetscLibType,snes::PetscSNES) +Gets the trust region update parameters. + +Not Collective + +Input Parameter: +- `snes` - the `SNES` context + +Output Parameters: +- `eta1` - acceptance tolerance +- `eta2` - shrinking tolerance +- `eta3` - enlarging tolerance +- `t1` - shrink factor +- `t2` - enlarge factor + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESNEWTONTR`, `SNESNewtonTRSetUpdateParameters()` + +# External Links +$(_doc_external("SNES/SNESNewtonTRGetUpdateParameters")) +""" +function SNESNewtonTRGetUpdateParameters(petsclib::PetscLibType, snes::PetscSNES) end + +@for_petsc function SNESNewtonTRGetUpdateParameters(petsclib::$UnionPetscLib, snes::PetscSNES ) + eta1_ = Ref{$PetscReal}() + eta2_ = Ref{$PetscReal}() + eta3_ = Ref{$PetscReal}() + t1_ = Ref{$PetscReal}() + t2_ = Ref{$PetscReal}() + + @chk ccall( + (:SNESNewtonTRGetUpdateParameters, $petsc_library), + PetscErrorCode, + (CSNES, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + snes, eta1_, eta2_, eta3_, t1_, t2_, + ) + + eta1 = eta1_[] + eta2 = eta2_[] + eta3 = eta3_[] + t1 = t1_[] + t2 = t2_[] + + return eta1,eta2,eta3,t1,t2 +end + +""" + SNESConvergedCorrectPressure(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, gnorm::PetscReal, f::PetscReal, reason::SNESConvergedReason, ctx::Cvoid) +The regular `SNES` convergence test that, up on convergence, adds a vector in the nullspace +to make the continuum integral of the pressure field equal to zero. + +Logically Collective + +Input Parameters: +- `snes` - the `SNES` context +- `it` - the iteration (0 indicates before any Newton steps) +- `xnorm` - 2-norm of current iterate +- `gnorm` - 2-norm of current step +- `f` - 2-norm of function at current iterate +- `ctx` - Optional user context + +Output Parameter: +- `reason` - `SNES_CONVERGED_ITERATING`, `SNES_CONVERGED_ITS`, or `SNES_DIVERGED_FNORM_NAN` + +Options Database Key: +- `-snes_convergence_test correct_pressure` - see `SNESSetFromOptions()` + +Level: advanced + +-seealso: [](ch_snes), `SNES`, `DM`, `SNESConvergedDefault()`, `SNESSetConvergenceTest()`, `DMSetNullSpaceConstructor()` + +# External Links +$(_doc_external("SNES/SNESConvergedCorrectPressure")) +""" +function SNESConvergedCorrectPressure(petsclib::PetscLibType, snes::PetscSNES, it::PetscInt, xnorm::PetscReal, gnorm::PetscReal, f::PetscReal, reason::SNESConvergedReason, ctx::Cvoid) end + +@for_petsc function SNESConvergedCorrectPressure(petsclib::$UnionPetscLib, snes::PetscSNES, it::$PetscInt, xnorm::$PetscReal, gnorm::$PetscReal, f::$PetscReal, reason::SNESConvergedReason, ctx::Cvoid ) + + @chk ccall( + (:SNESConvergedCorrectPressure, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, $PetscReal, $PetscReal, Ptr{SNESConvergedReason}, Ptr{Cvoid}), + snes, it, xnorm, gnorm, f, reason, ctx, + ) + + + return nothing +end + +""" + SNESMonitorFields(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) +Monitors the residual for each field separately + +Collective + +Input Parameters: +- `snes` - the `SNES` context, must have an attached `DM` +- `its` - iteration number +- `fgnorm` - 2-norm of residual +- `vf` - `PetscViewerAndFormat` of `PetscViewerType` `PETSCVIEWERASCII` + +Level: intermediate + +-seealso: [](ch_snes), `SNES`, `SNESMonitorSet()`, `SNESMonitorDefault()` + +# External Links +$(_doc_external("SNES/SNESMonitorFields")) +""" +function SNESMonitorFields(petsclib::PetscLibType, snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat) end + +@for_petsc function SNESMonitorFields(petsclib::$UnionPetscLib, snes::PetscSNES, its::$PetscInt, fgnorm::$PetscReal, vf::PetscViewerAndFormat ) + + @chk ccall( + (:SNESMonitorFields, $petsc_library), + PetscErrorCode, + (CSNES, $PetscInt, $PetscReal, Ptr{PetscViewerAndFormat}), + snes, its, fgnorm, vf, + ) + + + return nothing +end + +""" + SNESTSFormFunction(petsclib::PetscLibType,snes::PetscSNES, U::PetscVec, F::PetscVec, ctx::Cvoid) +Function to evaluate nonlinear residual defined by an ODE solver algorithm implemented within `TS` + +Logically Collective + +Input Parameters: +- `snes` - nonlinear solver +- `U` - the current state at which to evaluate the residual +- `ctx` - user context, must be a `TS` + +Output Parameter: +- `F` - the nonlinear residual + +Level: developer + +-seealso: [](ch_ts), `SNESSetFunction()`, `MatFDColoringSetFunction()` + +# External Links +$(_doc_external("Ts/SNESTSFormFunction")) +""" +function SNESTSFormFunction(petsclib::PetscLibType, snes::PetscSNES, U::PetscVec, F::PetscVec, ctx::Cvoid) end + +@for_petsc function SNESTSFormFunction(petsclib::$UnionPetscLib, snes::PetscSNES, U::PetscVec, F::PetscVec, ctx::Cvoid ) + + @chk ccall( + (:SNESTSFormFunction, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CVec, Ptr{Cvoid}), + snes, U, F, ctx, + ) + + + return nothing +end + +""" + SNESTSFormJacobian(petsclib::PetscLibType,snes::PetscSNES, U::PetscVec, A::PetscMat, B::PetscMat, ctx::Cvoid) +Function to evaluate the Jacobian defined by an ODE solver algorithm implemented within `TS` + +Collective + +Input Parameters: +- `snes` - nonlinear solver +- `U` - the current state at which to evaluate the residual +- `ctx` - user context, must be a `TS` + +Output Parameters: +- `A` - the Jacobian +- `B` - the matrix used to construct the preconditioner (often the same as `A`) + +Level: developer + +-seealso: [](ch_ts), `SNESSetJacobian()` + +# External Links +$(_doc_external("Ts/SNESTSFormJacobian")) +""" +function SNESTSFormJacobian(petsclib::PetscLibType, snes::PetscSNES, U::PetscVec, A::PetscMat, B::PetscMat, ctx::Cvoid) end + +@for_petsc function SNESTSFormJacobian(petsclib::$UnionPetscLib, snes::PetscSNES, U::PetscVec, A::PetscMat, B::PetscMat, ctx::Cvoid ) + + @chk ccall( + (:SNESTSFormJacobian, $petsc_library), + PetscErrorCode, + (CSNES, CVec, CMat, CMat, Ptr{Cvoid}), + snes, U, A, B, ctx, + ) + + + return nothing +end + diff --git a/src/autowrapped/Sys_wrappers.jl b/src/autowrapped/Sys_wrappers.jl new file mode 100644 index 00000000..7dfcd7ba --- /dev/null +++ b/src/autowrapped/Sys_wrappers.jl @@ -0,0 +1,14021 @@ +# autodefined type arguments for class ------ +mutable struct _n_SSL_CTX end +const SSL_CTX = Ptr{_n_SSL_CTX} + +mutable struct _n_SSL end +const SSL = Ptr{_n_SSL} + +mutable struct _n_hid_t end +const hid_t = Ptr{_n_hid_t} + +mutable struct _n_MPI_Request end +const MPI_Request = Ptr{_n_MPI_Request} + +const PetscDLHandle = Ptr{Cvoid} + +#mutable struct _n_PetscClassId end +#const PetscClassId = Ptr{_n_PetscClassId} + +#mutable struct _n_PetscInfoCommFlag end +#const PetscInfoCommFlag = Ptr{_n_PetscInfoCommFlag} + +#mutable struct _n_PetscDLMode end +#const PetscDLMode = Ptr{_n_PetscDLMode} + +#mutable struct _n_PetscFPTrap end +#const PetscFPTrap = Ptr{_n_PetscFPTrap} + +mutable struct _n_PetscLogHandler end +const PetscLogHandler = Ptr{_n_PetscLogHandler} + +#mutable struct _n_PetscLogState end +#const PetscLogState = Ptr{_n_PetscLogState} + +#mutable struct _n_PetscLogStage end +#const PetscLogStage = Ptr{_n_PetscLogStage} + +#mutable struct _n_PetscLogEvent end +#const PetscLogEvent = Ptr{_n_PetscLogEvent} + +#mutable struct _n_PetscEventPerfInfo end +#const PetscEventPerfInfo = Ptr{_n_PetscEventPerfInfo} + +mutable struct _n_PetscLayout end +const PetscLayout = Ptr{_n_PetscLayout} + +mutable struct _n_PetscQuadrature end +const PetscQuadrature = Ptr{_n_PetscQuadrature} + +#mutable struct _n_PetscDTSimplexQuadratureType end +#const PetscDTSimplexQuadratureType = Ptr{_n_PetscDTSimplexQuadratureType} + +#mutable struct _n_DMPolytopeType end +#const DMPolytopeType = Ptr{_n_DMPolytopeType} + +#mutable struct _n_LandauStaticData end +#const LandauStaticData = Ptr{_n_LandauStaticData} + +mutable struct _n_P4estVertexMaps end +const P4estVertexMaps = Ptr{_n_P4estVertexMaps} + +mutable struct _n_pointInterpolationP4est end +const pointInterpolationP4est = Ptr{_n_pointInterpolationP4est} + +mutable struct _n_hCsize_t end +const hCsize_t = Ptr{_n_hCsize_t} + +mutable struct _n_MPIU_Count end +const MPIU_Count = Ptr{_n_MPIU_Count} + +mutable struct _n_PetscBLASInt end +const PetscBLASInt = Ptr{_n_PetscBLASInt} + +#mutable struct _n_PetscCuBLASInt end +#const PetscCuBLASInt = Ptr{_n_PetscCuBLASInt} + +#mutable struct _n_PetscHipBLASInt end +#const PetscHipBLASInt = Ptr{_n_PetscHipBLASInt} + +#mutable struct _n_PetscBool3 end +#const PetscBool3 = Ptr{_n_PetscBool3} + +# ------------------------------------------------------- +""" + PetscGlobusAuthorize(petsclib::PetscLibType,comm::MPI_Comm, access_token::Vector{Cchar}, tokensize::Csize_t) +Get an access token allowing PETSc applications to make Globus file transfer requests + +Not Collective, only the first process in `MPI_Comm` does anything + +Input Parameters: +- `comm` - the MPI communicator +- `tokensize` - size of the token array + +Output Parameter: +- `access_token` - can be used with `PetscGlobusUpLoad()` for 30 days + +Level: intermediate + +-seealso: `PetscGoogleDriveRefresh()`, `PetscGoogleDriveUpload()`, `PetscGlobusUpload()` + +# External Links +$(_doc_external("Sys/PetscGlobusAuthorize")) +""" +function PetscGlobusAuthorize(petsclib::PetscLibType, comm::MPI_Comm, access_token::Vector{Cchar}, tokensize::Csize_t) end + +@for_petsc function PetscGlobusAuthorize(petsclib::$UnionPetscLib, comm::MPI_Comm, access_token::Vector{Cchar}, tokensize::Csize_t ) + + @chk ccall( + (:PetscGlobusAuthorize, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Csize_t), + comm, access_token, tokensize, + ) + + + return nothing +end + +""" + PetscGlobusGetTransfers(petsclib::PetscLibType,comm::MPI_Comm, access_token::Vector{Cchar}, buff::Vector{Cchar}, buffsize::Csize_t) +Get a record of current transfers requested from Globus + +Not Collective, only the first process in `MPI_Comm` does anything + +Input Parameters: +- `comm` - the MPI communicator +- `access_token` - Globus access token, if `NULL` will check in options database for -globus_access_token XXX otherwise +will call `PetscGlobusAuthorize()`. +- `buffsize` - size of the buffer + +Output Parameter: +- `buff` - location to put Globus information + +Level: intermediate + +-seealso: `PetscGoogleDriveRefresh()`, `PetscGoogleDriveUpload()`, `PetscGlobusUpload()`, `PetscGlobusAuthorize()` + +# External Links +$(_doc_external("Sys/PetscGlobusGetTransfers")) +""" +function PetscGlobusGetTransfers(petsclib::PetscLibType, comm::MPI_Comm, access_token::Vector{Cchar}, buff::Vector{Cchar}, buffsize::Csize_t) end + +@for_petsc function PetscGlobusGetTransfers(petsclib::$UnionPetscLib, comm::MPI_Comm, access_token::Vector{Cchar}, buff::Vector{Cchar}, buffsize::Csize_t ) + + @chk ccall( + (:PetscGlobusGetTransfers, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Csize_t), + comm, access_token, buff, buffsize, + ) + + + return nothing +end + +""" + PetscGlobusUpload(petsclib::PetscLibType,comm::MPI_Comm, access_token::Vector{Cchar}, filename::Vector{Cchar}) +Loads a file to Globus + +Not Collective, only the first process in the `MPI_Comm` uploads the file + +Input Parameters: +- `comm` - MPI communicator +- `access_token` - obtained with `PetscGlobusAuthorize()`, pass `NULL` to use `-globus_access_token XXX` from the PETSc database +- `filename` - file to upload + +Options Database Key: +- `-globus_access_token XXX` - the Globus token + +Level: intermediate + +-seealso: `PetscGoogleDriveAuthorize()`, `PetscGoogleDriveRefresh()`, `PetscGlobusAuthorize()` + +# External Links +$(_doc_external("Sys/PetscGlobusUpload")) +""" +function PetscGlobusUpload(petsclib::PetscLibType, comm::MPI_Comm, access_token::Vector{Cchar}, filename::Vector{Cchar}) end + +@for_petsc function PetscGlobusUpload(petsclib::$UnionPetscLib, comm::MPI_Comm, access_token::Vector{Cchar}, filename::Vector{Cchar} ) + + @chk ccall( + (:PetscGlobusUpload, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}), + comm, access_token, filename, + ) + + + return nothing +end + +""" + PetscGoogleDriveRefresh(petsclib::PetscLibType,comm::MPI_Comm, refresh_token::Vector{Cchar}, access_token::Vector{Cchar}, tokensize::Csize_t) +Get a new authorization token for accessing Google drive from PETSc from a refresh token + +Not Collective, only the first process in the `MPI_Comm` does anything + +Input Parameters: +- `comm` - MPI communicator +- `refresh_token` - obtained with `PetscGoogleDriveAuthorize()`, if NULL PETSc will first look for one in the options data +if not found it will call `PetscGoogleDriveAuthorize()` +- `tokensize` - size of the output string access_token + +Output Parameter: +- `access_token` - token that can be passed to `PetscGoogleDriveUpload()` + +Options Database Key: +- `-google_refresh_token XXX` - where XXX was obtained from `PetscGoogleDriveAuthorize()` + +Level: intermediate + +-seealso: `PetscGoogleDriveAuthorize()`, `PetscGoogleDriveUpload()` + +# External Links +$(_doc_external("Sys/PetscGoogleDriveRefresh")) +""" +function PetscGoogleDriveRefresh(petsclib::PetscLibType, comm::MPI_Comm, refresh_token::Vector{Cchar}, access_token::Vector{Cchar}, tokensize::Csize_t) end + +@for_petsc function PetscGoogleDriveRefresh(petsclib::$UnionPetscLib, comm::MPI_Comm, refresh_token::Vector{Cchar}, access_token::Vector{Cchar}, tokensize::Csize_t ) + + @chk ccall( + (:PetscGoogleDriveRefresh, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Csize_t), + comm, refresh_token, access_token, tokensize, + ) + + + return nothing +end + +""" + PetscGoogleDriveUpload(petsclib::PetscLibType,comm::MPI_Comm, access_token::Vector{Cchar}, filename::Vector{Cchar}) +Loads a file to the Google Drive + +Not Collective, only the first process in the `MPI_Comm` uploads the file + +Input Parameters: +- `comm` - MPI communicator +- `access_token` - obtained with PetscGoogleDriveRefresh(), pass `NULL` to have PETSc generate one +- `filename` - file to upload; if you upload multiple times it will have different names each time on Google Drive + +Options Database Key: +- `-google_refresh_token XXX` - pass the access token for the operation + +-seealso: `PetscGoogleDriveAuthorize()`, `PetscGoogleDriveRefresh()` + +# External Links +$(_doc_external("Sys/PetscGoogleDriveUpload")) +""" +function PetscGoogleDriveUpload(petsclib::PetscLibType, comm::MPI_Comm, access_token::Vector{Cchar}, filename::Vector{Cchar}) end + +@for_petsc function PetscGoogleDriveUpload(petsclib::$UnionPetscLib, comm::MPI_Comm, access_token::Vector{Cchar}, filename::Vector{Cchar} ) + + @chk ccall( + (:PetscGoogleDriveUpload, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}), + comm, access_token, filename, + ) + + + return nothing +end + +""" + PetscGoogleDriveAuthorize(petsclib::PetscLibType,comm::MPI_Comm, access_token::Vector{Cchar}, refresh_token::Vector{Cchar}, tokensize::Csize_t) +Get authorization and refresh token for accessing Google drive from PETSc + +Not Collective, only the first process in `MPI_Comm` does anything + +Input Parameters: +- `comm` - the MPI communicator +- `tokensize` - size of the token arrays + +Output Parameters: +- `access_token` - can be used with `PetscGoogleDriveUpload()` for this one session +- `refresh_token` - can be used for ever to obtain new access_tokens with `PetscGoogleDriveRefresh()`, guard this like a password +it gives access to your Google Drive + +Level: intermediate + +-seealso: `PetscGoogleDriveRefresh()`, `PetscGoogleDriveUpload()` + +# External Links +$(_doc_external("Sys/PetscGoogleDriveAuthorize")) +""" +function PetscGoogleDriveAuthorize(petsclib::PetscLibType, comm::MPI_Comm, access_token::Vector{Cchar}, refresh_token::Vector{Cchar}, tokensize::Csize_t) end + +@for_petsc function PetscGoogleDriveAuthorize(petsclib::$UnionPetscLib, comm::MPI_Comm, access_token::Vector{Cchar}, refresh_token::Vector{Cchar}, tokensize::Csize_t ) + + @chk ccall( + (:PetscGoogleDriveAuthorize, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Csize_t), + comm, access_token, refresh_token, tokensize, + ) + + + return nothing +end + +""" + PetscSSLInitializeContext(petsclib::PetscLibType,octx::SSL_CTX) +Set up an SSL context suitable for initiating HTTPS requests. + +Output Parameter: +- `octx` - the SSL_CTX to be passed to `PetscHTTPSConnect90` + +Level: advanced + +If PETSc was ./configure -with-ssl-certificate requires the user have created a self-signed certificate with +-seealso: `PetscSSLDestroyContext()`, `PetscHTTPSConnect()`, `PetscHTTPSRequest()` + +# External Links +$(_doc_external("Sys/PetscSSLInitializeContext")) +""" +function PetscSSLInitializeContext(petsclib::PetscLibType, octx::SSL_CTX) end + +@for_petsc function PetscSSLInitializeContext(petsclib::$UnionPetscLib, octx::SSL_CTX ) + + @chk ccall( + (:PetscSSLInitializeContext, $petsc_library), + PetscErrorCode, + (SSL_CTX,), + octx, + ) + + + return nothing +end + +""" + PetscSSLDestroyContext(petsclib::PetscLibType,ctx::SSL_CTX) +frees a `SSL_CTX` obtained with `PetscSSLInitializeContext()` + +Input Parameter: +- `ctx` - the `SSL_CTX` + +Level: advanced + +-seealso: `PetscSSLInitializeContext()`, `PetscHTTPSConnect()` + +# External Links +$(_doc_external("Sys/PetscSSLDestroyContext")) +""" +function PetscSSLDestroyContext(petsclib::PetscLibType, ctx::SSL_CTX) end + +@for_petsc function PetscSSLDestroyContext(petsclib::$UnionPetscLib, ctx::SSL_CTX ) + + @chk ccall( + (:PetscSSLDestroyContext, $petsc_library), + PetscErrorCode, + (Ptr{SSL_CTX},), + ctx, + ) + + + return nothing +end + +""" + PetscHTTPSRequest(petsclib::PetscLibType,type::Vector{Cchar}, url::Vector{Cchar}, header::Vector{Cchar}, ctype::Vector{Cchar}, body::Vector{Cchar}, ssl::SSL, buff::Vector{Cchar}, buffsize::Csize_t) +Send a request to an HTTPS server + +Input Parameters: +- `type` - either "POST" or "GET" +- `url` - URL of request host/path +- `header` - additional header information, may be `NULL` +- `ctype` - data type of body, for example application/json +- `body` - data to send to server +- `ssl` - obtained with `PetscHTTPSConnect()` +- `buffsize` - size of buffer + +Output Parameter: +- `buff` - everything returned from server + +Level: advanced + +-seealso: `PetscHTTPRequest()`, `PetscHTTPSConnect()`, `PetscSSLInitializeContext()`, `PetscSSLDestroyContext()`, `PetscPullJSONValue()` + +# External Links +$(_doc_external("Sys/PetscHTTPSRequest")) +""" +function PetscHTTPSRequest(petsclib::PetscLibType, type::Vector{Cchar}, url::Vector{Cchar}, header::Vector{Cchar}, ctype::Vector{Cchar}, body::Vector{Cchar}, ssl::SSL, buff::Vector{Cchar}, buffsize::Csize_t) end + +@for_petsc function PetscHTTPSRequest(petsclib::$UnionPetscLib, type::Vector{Cchar}, url::Vector{Cchar}, header::Vector{Cchar}, ctype::Vector{Cchar}, body::Vector{Cchar}, ssl::SSL, buff::Vector{Cchar}, buffsize::Csize_t ) + + @chk ccall( + (:PetscHTTPSRequest, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Ptr{SSL}, Ptr{Cchar}, Csize_t), + type, url, header, ctype, body, ssl, buff, buffsize, + ) + + + return nothing +end + +""" + PetscHTTPRequest(petsclib::PetscLibType,type::Vector{Cchar}, url::Vector{Cchar}, header::Vector{Cchar}, ctype::Vector{Cchar}, body::Vector{Cchar}, sock::Cint, buff::Vector{Cchar}, buffsize::Csize_t) +Send a request to an HTTP server + +Input Parameters: +- `type` - either "POST" or "GET" +- `url` - URL of request host/path +- `header` - additional header information, may be `NULL` +- `ctype` - data type of body, for example application/json +- `body` - data to send to server +- `sock` - obtained with `PetscOpenSocket()` +- `buffsize` - size of buffer + +Output Parameter: +- `buff` - everything returned from server + +Level: advanced + +-seealso: `PetscHTTPSRequest()`, `PetscOpenSocket()`, `PetscHTTPSConnect()`, `PetscPullJSONValue()` + +# External Links +$(_doc_external("Sys/PetscHTTPRequest")) +""" +function PetscHTTPRequest(petsclib::PetscLibType, type::Vector{Cchar}, url::Vector{Cchar}, header::Vector{Cchar}, ctype::Vector{Cchar}, body::Vector{Cchar}, sock::Cint, buff::Vector{Cchar}, buffsize::Csize_t) end + +@for_petsc function PetscHTTPRequest(petsclib::$UnionPetscLib, type::Vector{Cchar}, url::Vector{Cchar}, header::Vector{Cchar}, ctype::Vector{Cchar}, body::Vector{Cchar}, sock::Cint, buff::Vector{Cchar}, buffsize::Csize_t ) + + @chk ccall( + (:PetscHTTPRequest, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Cint, Ptr{Cchar}, Csize_t), + type, url, header, ctype, body, sock, buff, buffsize, + ) + + + return nothing +end + +""" + PetscHTTPSConnect(petsclib::PetscLibType,host::Vector{Cchar}, port::Cint, ctx::SSL_CTX, sock::Cint, ssl::SSL) +connect to a HTTPS server + +Input Parameters: +- `host` - the name of the machine hosting the HTTPS server +- `port` - the port number where the server is hosting, usually 443 +- `ctx` - value obtained with `PetscSSLInitializeContext()` + +Output Parameters: +- `sock` - socket to connect +- `ssl` - the argument passed to `PetscHTTPSRequest()` + +Level: advanced + +-seealso: `PetscOpenSocket()`, `PetscHTTPSRequest()`, `PetscSSLInitializeContext()` + +# External Links +$(_doc_external("Sys/PetscHTTPSConnect")) +""" +function PetscHTTPSConnect(petsclib::PetscLibType, host::Vector{Cchar}, port::Cint, ctx::SSL_CTX, sock::Cint, ssl::SSL) end + +@for_petsc function PetscHTTPSConnect(petsclib::$UnionPetscLib, host::Vector{Cchar}, port::Cint, ctx::SSL_CTX, sock::Cint, ssl::SSL ) + + @chk ccall( + (:PetscHTTPSConnect, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cint, Ptr{SSL_CTX}, Ptr{Cint}, SSL), + host, port, ctx, sock, ssl, + ) + + + return nothing +end + +""" + found::PetscBool = PetscPullJSONValue(petsclib::PetscLibType,buff::Vector{Cchar}, key::Vector{Cchar}, value::Vector{Cchar}, valuelen::Csize_t) +Given a JSON response containing the substring with "key" : "value" where there may or not be spaces around the : returns the value. + +Input Parameters: +- `buff` - the char array containing the possible values +- `key` - the key of the requested value +- `valuelen` - the length of the array to contain the value associated with the key + +Output Parameters: +- `value` - the value obtained +- `found` - flag indicating if the value was found in the buff + +Level: advanced + +-seealso: `PetscOpenSocket()`, `PetscHTTPSRequest()`, `PetscSSLInitializeContext()`, `PetscPushJSONValue()` + +# External Links +$(_doc_external("Sys/PetscPullJSONValue")) +""" +function PetscPullJSONValue(petsclib::PetscLibType, buff::Vector{Cchar}, key::Vector{Cchar}, value::Vector{Cchar}, valuelen::Csize_t) end + +@for_petsc function PetscPullJSONValue(petsclib::$UnionPetscLib, buff::Vector{Cchar}, key::Vector{Cchar}, value::Vector{Cchar}, valuelen::Csize_t ) + found_ = Ref{PetscBool}() + + @chk ccall( + (:PetscPullJSONValue, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Csize_t, Ptr{PetscBool}), + buff, key, value, valuelen, found_, + ) + + found = found_[] + + return found +end + +""" + PetscPushJSONValue(petsclib::PetscLibType,buff::Vector{Cchar}, key::Vector{Cchar}, value::Vector{Cchar}, bufflen::Csize_t) +Puts a "key" : "value" pair onto a string + +Input Parameters: +- `buff` - the char array where the value will be put +- `key` - the key value to be set +- `value` - the value associated with the key +- `bufflen` - the size of the buffer (currently ignored) + +Level: advanced + +-seealso: `PetscOpenSocket()`, `PetscHTTPSRequest()`, `PetscSSLInitializeContext()`, `PetscPullJSONValue()` + +# External Links +$(_doc_external("Sys/PetscPushJSONValue")) +""" +function PetscPushJSONValue(petsclib::PetscLibType, buff::Vector{Cchar}, key::Vector{Cchar}, value::Vector{Cchar}, bufflen::Csize_t) end + +@for_petsc function PetscPushJSONValue(petsclib::$UnionPetscLib, buff::Vector{Cchar}, key::Vector{Cchar}, value::Vector{Cchar}, bufflen::Csize_t ) + + @chk ccall( + (:PetscPushJSONValue, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Csize_t), + buff, key, value, bufflen, + ) + + + return nothing +end + +""" + PetscBoxAuthorize(petsclib::PetscLibType,comm::MPI_Comm, access_token::Vector{Cchar}, refresh_token::Vector{Cchar}, tokensize::Csize_t) +Get authorization and refresh token for accessing Box drive from PETSc + +Not Collective, only the first rank in `MPI_Comm` does anything + +Input Parameters: +- `comm` - the MPI communicator +- `tokensize` - size of the token arrays + +Output Parameters: +- `access_token` - can be used with `PetscBoxUpload()` for this one session +- `refresh_token` - can be used for ever to obtain new access_tokens with `PetscBoxRefresh()`, +guard this like a password it gives access to your Box Drive + +Level: intermediate + +-seealso: `PetscBoxRefresh()`, `PetscBoxUpload()` + +# External Links +$(_doc_external("Sys/PetscBoxAuthorize")) +""" +function PetscBoxAuthorize(petsclib::PetscLibType, comm::MPI_Comm, access_token::Vector{Cchar}, refresh_token::Vector{Cchar}, tokensize::Csize_t) end + +@for_petsc function PetscBoxAuthorize(petsclib::$UnionPetscLib, comm::MPI_Comm, access_token::Vector{Cchar}, refresh_token::Vector{Cchar}, tokensize::Csize_t ) + + @chk ccall( + (:PetscBoxAuthorize, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Csize_t), + comm, access_token, refresh_token, tokensize, + ) + + + return nothing +end + +""" + PetscBoxRefresh(petsclib::PetscLibType,comm::MPI_Comm, refresh_token::Vector{Cchar}, access_token::Vector{Cchar}, new_refresh_token::Vector{Cchar}, tokensize::Csize_t) +Get a new authorization token for accessing Box drive from PETSc from a refresh token + +Not Collective, only the first process in the `MPI_Comm` does anything + +Input Parameters: +- `comm` - MPI communicator +- `refresh_token` - obtained with `PetscBoxAuthorize()`, if `NULL` PETSc will first look for one in the options data +if not found it will call `PetscBoxAuthorize()` +- `tokensize` - size of the output string access_token + +Output Parameters: +- `access_token` - token that can be passed to `PetscBoxUpload()` +- `new_refresh_token` - the old refresh token is no longer valid, not this is different than Google where the same refresh_token is used forever + +Level: intermediate + +-seealso: `PetscBoxAuthorize()`, `PetscBoxUpload()` + +# External Links +$(_doc_external("Sys/PetscBoxRefresh")) +""" +function PetscBoxRefresh(petsclib::PetscLibType, comm::MPI_Comm, refresh_token::Vector{Cchar}, access_token::Vector{Cchar}, new_refresh_token::Vector{Cchar}, tokensize::Csize_t) end + +@for_petsc function PetscBoxRefresh(petsclib::$UnionPetscLib, comm::MPI_Comm, refresh_token::Vector{Cchar}, access_token::Vector{Cchar}, new_refresh_token::Vector{Cchar}, tokensize::Csize_t ) + + @chk ccall( + (:PetscBoxRefresh, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Csize_t), + comm, refresh_token, access_token, new_refresh_token, tokensize, + ) + + + return nothing +end + +""" + PetscBoxUpload(petsclib::PetscLibType,comm::MPI_Comm, access_token::Vector{Cchar}, filename::Vector{Cchar}) +Loads a file to the Box Drive + +This routine has not yet been written; it is just copied from Google Drive + +Not collective, only the first process in the `MPI_Comm` uploads the file + +Input Parameters: +- `comm` - MPI communicator +- `access_token` - obtained with `PetscBoxRefresh()`, pass `NULL` to have PETSc generate one +- `filename` - file to upload; if you upload multiple times it will have different names each time on Box Drive + +Options Database Key: +- `-box_refresh_token XXX` - the token value + +-seealso: `PetscBoxAuthorize()`, `PetscBoxRefresh()` + +# External Links +$(_doc_external("Sys/PetscBoxUpload")) +""" +function PetscBoxUpload(petsclib::PetscLibType, comm::MPI_Comm, access_token::Vector{Cchar}, filename::Vector{Cchar}) end + +@for_petsc function PetscBoxUpload(petsclib::$UnionPetscLib, comm::MPI_Comm, access_token::Vector{Cchar}, filename::Vector{Cchar} ) + + @chk ccall( + (:PetscBoxUpload, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}), + comm, access_token, filename, + ) + + + return nothing +end + +""" + PetscSAWsBlock(petsclib::PetscLibType) +Blocks on SAWs until a client (person using the web browser) unblocks it + +Not Collective + +Level: advanced + +-seealso: `PetscObjectSetName()`, `PetscObjectSAWsViewOff()`, `PetscObjectSAWsSetBlock()`, `PetscObjectSAWsBlock()` + +# External Links +$(_doc_external("Sys/PetscSAWsBlock")) +""" +function PetscSAWsBlock(petsclib::PetscLibType) end + +@for_petsc function PetscSAWsBlock(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscSAWsBlock, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscMemoryGetCurrentUsage(petsclib::PetscLibType,mem::PetscLogDouble) +Returns the current resident set size (memory used) +for the program. + +Not Collective + +Output Parameter: +- `mem` - memory usage in bytes + +Options Database Key: +- `-memory_view` - Print memory usage at end of run +- `-log_view_memory` - Display memory information for each logged event +- `-malloc_view` - Print usage of `PetscMalloc()` in `PetscFinalize()` + +Level: intermediate + +-seealso: `PetscMallocGetMaximumUsage()`, `PetscMemoryGetMaximumUsage()`, `PetscMallocGetCurrentUsage()`, `PetscMemorySetGetMaximumUsage()`, `PetscMemoryView()` + +# External Links +$(_doc_external("Sys/PetscMemoryGetCurrentUsage")) +""" +function PetscMemoryGetCurrentUsage(petsclib::PetscLibType, mem::PetscLogDouble) end + +@for_petsc function PetscMemoryGetCurrentUsage(petsclib::$UnionPetscLib, mem::PetscLogDouble ) + + @chk ccall( + (:PetscMemoryGetCurrentUsage, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble},), + mem, + ) + + + return nothing +end + +""" + PetscMemoryGetMaximumUsage(petsclib::PetscLibType,mem::PetscLogDouble) +Returns the maximum resident set size (memory used) +for the program since it started (the high water mark). + +Not Collective + +Output Parameter: +- `mem` - memory usage in bytes + +Options Database Key: +- `-memory_view` - Print memory usage at end of run +- `-log_view_memory` - Print memory information per event +- `-malloc_view` - Print usage of `PetscMalloc()` in `PetscFinalize()` + +Level: intermediate + +-seealso: `PetscMallocGetMaximumUsage()`, `PetscMemoryGetCurrentUsage()`, `PetscMallocGetCurrentUsage()`, +`PetscMemorySetGetMaximumUsage()` + +# External Links +$(_doc_external("Sys/PetscMemoryGetMaximumUsage")) +""" +function PetscMemoryGetMaximumUsage(petsclib::PetscLibType, mem::PetscLogDouble) end + +@for_petsc function PetscMemoryGetMaximumUsage(petsclib::$UnionPetscLib, mem::PetscLogDouble ) + + @chk ccall( + (:PetscMemoryGetMaximumUsage, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble},), + mem, + ) + + + return nothing +end + +""" + PetscMemorySetGetMaximumUsage(petsclib::PetscLibType) +Tells PETSc to monitor the maximum memory usage so that +`PetscMemoryGetMaximumUsage()` will work. + +Not Collective + +Options Database Key: +- `-memory_view` - Print memory usage at end of run +- `-log_view_memory` - Print memory information per event +- `-malloc_view` - Print usage of `PetscMalloc()` in `PetscFinalize()` + +Level: intermediate + +-seealso: `PetscMallocGetMaximumUsage()`, `PetscMemoryGetCurrentUsage()`, `PetscMallocGetCurrentUsage()`, +`PetscMemoryGetMaximumUsage()` + +# External Links +$(_doc_external("Sys/PetscMemorySetGetMaximumUsage")) +""" +function PetscMemorySetGetMaximumUsage(petsclib::PetscLibType) end + +@for_petsc function PetscMemorySetGetMaximumUsage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscMemorySetGetMaximumUsage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscMallocValidate(petsclib::PetscLibType,line::Cint, fnc::Vector{Cchar}, file::Vector{Cchar}) +Test the memory for corruption. This can be called at any time between `PetscInitialize()` and `PetscFinalize()` + +Input Parameters: +- `line` - line number where call originated. +- `function` - name of function calling +- `file` - file where function is + +Options Database Keys: +- `-malloc_test` - turns this feature on when PETSc was not configured with `--with-debugging=0` +- `-malloc_debug` - turns this feature on anytime + +Level: advanced + +-seealso: `CHKMEMQ`, `PetscMalloc()`, `PetscFree()`, `PetscMallocSetDebug()` + +# External Links +$(_doc_external("Sys/PetscMallocValidate")) +""" +function PetscMallocValidate(petsclib::PetscLibType, line::Cint, fnc::Vector{Cchar}, file::Vector{Cchar}) end + +@for_petsc function PetscMallocValidate(petsclib::$UnionPetscLib, line::Cint, fnc::Vector{Cchar}, file::Vector{Cchar} ) + + @chk ccall( + (:PetscMallocValidate, $petsc_library), + PetscErrorCode, + (Cint, Ptr{Cchar}, Ptr{Cchar}), + line, fnc, file, + ) + + + return nothing +end + +""" + PetscMemoryView(petsclib::PetscLibType,viewer::PetscViewer, message::Vector{Cchar}) +Shows the amount of memory currently being used in a communicator. + +Collective + +Input Parameters: +- `viewer` - the viewer to output the information on +- `message` - string printed before values + +Options Database Keys: +- `-malloc_debug` - have PETSc track how much memory it has allocated +- `-log_view_memory` - print memory usage per event when `-log_view` is used +- `-memory_view` - during `PetscFinalize()` have this routine called + +Level: intermediate + +-seealso: `PetscMallocDump()`, `PetscMemoryGetCurrentUsage()`, `PetscMemorySetGetMaximumUsage()`, `PetscMallocView()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMemoryView")) +""" +function PetscMemoryView(petsclib::PetscLibType, viewer::PetscViewer, message::Vector{Cchar}) end + +@for_petsc function PetscMemoryView(petsclib::$UnionPetscLib, viewer::PetscViewer, message::Vector{Cchar} ) + + @chk ccall( + (:PetscMemoryView, $petsc_library), + PetscErrorCode, + (PetscViewer, Ptr{Cchar}), + viewer, message, + ) + + + return nothing +end + +""" + PetscMallocGetCurrentUsage(petsclib::PetscLibType,space::PetscLogDouble) +gets the current amount of memory used that was allocated with `PetscMalloc()` + +Not Collective + +Output Parameter: +- `space` - number of bytes currently allocated + +Level: intermediate + +-seealso: `PetscMallocDump()`, `PetscMallocGetMaximumUsage()`, `PetscMemoryGetCurrentUsage()`, `PetscMalloc()`, `PetscFree()`, +`PetscMemoryGetMaximumUsage()` + +# External Links +$(_doc_external("Sys/PetscMallocGetCurrentUsage")) +""" +function PetscMallocGetCurrentUsage(petsclib::PetscLibType, space::PetscLogDouble) end + +@for_petsc function PetscMallocGetCurrentUsage(petsclib::$UnionPetscLib, space::PetscLogDouble ) + + @chk ccall( + (:PetscMallocGetCurrentUsage, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble},), + space, + ) + + + return nothing +end + +""" + PetscMallocGetMaximumUsage(petsclib::PetscLibType,space::PetscLogDouble) +gets the maximum amount of memory used that was obtained with `PetscMalloc()` at any time +during this run, the high water mark. + +Not Collective + +Output Parameter: +- `space` - maximum number of bytes ever allocated at one time + +Level: intermediate + +-seealso: `PetscMallocDump()`, `PetscMallocView()`, `PetscMemoryGetCurrentUsage()`, `PetscMalloc()`, `PetscFree()`, +`PetscMallocPushMaximumUsage()` + +# External Links +$(_doc_external("Sys/PetscMallocGetMaximumUsage")) +""" +function PetscMallocGetMaximumUsage(petsclib::PetscLibType, space::PetscLogDouble) end + +@for_petsc function PetscMallocGetMaximumUsage(petsclib::$UnionPetscLib, space::PetscLogDouble ) + + @chk ccall( + (:PetscMallocGetMaximumUsage, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble},), + space, + ) + + + return nothing +end + +""" + PetscMallocPushMaximumUsage(petsclib::PetscLibType,event::Cint) +Adds another event to collect the maximum memory usage over an event + +Not Collective + +Input Parameter: +- `event` - an event id; this is just for error checking + +Level: developer + +-seealso: `PetscMallocDump()`, `PetscMallocView()`, `PetscMallocGetMaximumUsage()`, `PetscMemoryGetCurrentUsage()`, `PetscMalloc()`, `PetscFree()`, +`PetscMallocPopMaximumUsage()` + +# External Links +$(_doc_external("Sys/PetscMallocPushMaximumUsage")) +""" +function PetscMallocPushMaximumUsage(petsclib::PetscLibType, event::Cint) end + +@for_petsc function PetscMallocPushMaximumUsage(petsclib::$UnionPetscLib, event::Cint ) + + @chk ccall( + (:PetscMallocPushMaximumUsage, $petsc_library), + PetscErrorCode, + (Cint,), + event, + ) + + + return nothing +end + +""" + PetscMallocPopMaximumUsage(petsclib::PetscLibType,event::Cint, mu::PetscLogDouble) +collect the maximum memory usage over an event + +Not Collective + +Input Parameter: +- `event` - an event id; this is just for error checking + +Output Parameter: +- `mu` - maximum amount of memory malloced during this event; high water mark relative to the beginning of the event + +Level: developer + +-seealso: `PetscMallocDump()`, `PetscMallocView()`, `PetscMallocGetMaximumUsage()`, `PetscMemoryGetCurrentUsage()`, `PetscMalloc()`, `PetscFree()`, +`PetscMallocPushMaximumUsage()` + +# External Links +$(_doc_external("Sys/PetscMallocPopMaximumUsage")) +""" +function PetscMallocPopMaximumUsage(petsclib::PetscLibType, event::Cint, mu::PetscLogDouble) end + +@for_petsc function PetscMallocPopMaximumUsage(petsclib::$UnionPetscLib, event::Cint, mu::PetscLogDouble ) + + @chk ccall( + (:PetscMallocPopMaximumUsage, $petsc_library), + PetscErrorCode, + (Cint, Ptr{PetscLogDouble}), + event, mu, + ) + + + return nothing +end + +""" + PetscMallocDump(petsclib::PetscLibType,fp::Libc.FILE) +Dumps the currently allocated memory blocks to a file. The information +printed is: size of space (in bytes), address of space, id of space, +file in which space was allocated, and line number at which it was +allocated. + +Not Collective + +Input Parameter: +- `fp` - file pointer. If `fp` is `NULL`, `stdout` is assumed. + +Options Database Key: +- `-malloc_dump ` - Print summary of unfreed memory during call to `PetscFinalize()`, writing to filename if given + +Level: intermediate + +-seealso: `PetscMallocGetCurrentUsage()`, `PetscMallocView()`, `PetscMallocViewSet()`, `PetscMallocValidate()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocDump")) +""" +function PetscMallocDump(petsclib::PetscLibType, fp::Libc.FILE) end + +@for_petsc function PetscMallocDump(petsclib::$UnionPetscLib, fp::Libc.FILE ) + + @chk ccall( + (:PetscMallocDump, $petsc_library), + PetscErrorCode, + (Ptr{Libc.FILE},), + fp, + ) + + + return nothing +end + +""" + PetscMallocViewSet(petsclib::PetscLibType,logmin::PetscLogDouble) +Activates logging of all calls to `PetscMalloc()` with a minimum size to view + +Not Collective + +Input Parameter: +- `logmin` - minimum allocation size to log, or `PETSC_DEFAULT` to log all memory allocations + +Options Database Keys: +- `-malloc_view ` - Activates `PetscMallocView()` in `PetscFinalize()` +- `-malloc_view_threshold ` - Sets a minimum size if `-malloc_view` is used +- `-log_view_memory` - view the memory usage also with the -log_view option + +Level: advanced + +-seealso: `PetscMallocViewGet()`, `PetscMallocDump()`, `PetscMallocView()`, `PetscMallocTraceSet()`, `PetscMallocValidate()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocViewSet")) +""" +function PetscMallocViewSet(petsclib::PetscLibType, logmin::PetscLogDouble) end + +@for_petsc function PetscMallocViewSet(petsclib::$UnionPetscLib, logmin::PetscLogDouble ) + + @chk ccall( + (:PetscMallocViewSet, $petsc_library), + PetscErrorCode, + (PetscLogDouble,), + logmin, + ) + + + return nothing +end + +""" + logging::PetscBool = PetscMallocViewGet(petsclib::PetscLibType) +Determine whether calls to `PetscMalloc()` are being logged + +Not Collective + +Output Parameter: +- `logging` - `PETSC_TRUE` if logging is active + +Options Database Key: +- `-malloc_view ` - Activates `PetscMallocView()` + +Level: advanced + +-seealso: `PetscMallocViewSet()`, `PetscMallocDump()`, `PetscMallocView()`, `PetscMallocTraceGet()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocViewGet")) +""" +function PetscMallocViewGet(petsclib::PetscLibType) end + +@for_petsc function PetscMallocViewGet(petsclib::$UnionPetscLib) + logging_ = Ref{PetscBool}() + + @chk ccall( + (:PetscMallocViewGet, $petsc_library), + PetscErrorCode, + (Ptr{PetscBool},), + logging_, + ) + + logging = logging_[] + + return logging +end + +""" + PetscMallocTraceSet(petsclib::PetscLibType,viewer::PetscViewer, active::PetscBool, logmin::PetscLogDouble) +Trace all calls to `PetscMalloc()`. That is print each `PetscMalloc()` and `PetscFree()` call to a viewer. + +Not Collective + +Input Parameters: +- `viewer` - The viewer to use for tracing, or `NULL` to use `PETSC_VIEWER_STDOUT_SELF` +- `active` - Flag to activate or deactivate tracing +- `logmin` - The smallest memory size that will be logged + +Level: advanced + +-seealso: `PetscMallocTraceGet()`, `PetscMallocViewGet()`, `PetscMallocDump()`, `PetscMallocView()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocTraceSet")) +""" +function PetscMallocTraceSet(petsclib::PetscLibType, viewer::PetscViewer, active::PetscBool, logmin::PetscLogDouble) end + +@for_petsc function PetscMallocTraceSet(petsclib::$UnionPetscLib, viewer::PetscViewer, active::PetscBool, logmin::PetscLogDouble ) + + @chk ccall( + (:PetscMallocTraceSet, $petsc_library), + PetscErrorCode, + (PetscViewer, PetscBool, PetscLogDouble), + viewer, active, logmin, + ) + + + return nothing +end + +""" + logging::PetscBool = PetscMallocTraceGet(petsclib::PetscLibType) +Determine whether all calls to `PetscMalloc()` are being traced + +Not Collective + +Output Parameter: +- `logging` - `PETSC_TRUE` if logging is active + +Options Database Key: +- `-malloc_view ` - Activates `PetscMallocView()` + +Level: advanced + +This only does anything if `-malloc_debug` (or `-malloc_test` if PETSc was configured with debugging) has been used + +-seealso: `PetscMallocTraceSet()`, `PetscMallocViewGet()`, `PetscMallocDump()`, `PetscMallocView()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocTraceGet")) +""" +function PetscMallocTraceGet(petsclib::PetscLibType) end + +@for_petsc function PetscMallocTraceGet(petsclib::$UnionPetscLib) + logging_ = Ref{PetscBool}() + + @chk ccall( + (:PetscMallocTraceGet, $petsc_library), + PetscErrorCode, + (Ptr{PetscBool},), + logging_, + ) + + logging = logging_[] + + return logging +end + +""" + PetscMallocView(petsclib::PetscLibType,fp::Libc.FILE) +Saves the log of all calls to `PetscMalloc()`; also calls `PetscMemoryGetMaximumUsage()` + +Not Collective + +Input Parameter: +- `fp` - file pointer; or `NULL` + +Options Database Key: +- `-malloc_view ` - Activates `PetscMallocView()` in `PetscFinalize()` + +Level: advanced + +-seealso: `PetscMallocGetCurrentUsage()`, `PetscMallocDump()`, `PetscMallocViewSet()`, `PetscMemoryView()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocView")) +""" +function PetscMallocView(petsclib::PetscLibType, fp::Libc.FILE) end + +@for_petsc function PetscMallocView(petsclib::$UnionPetscLib, fp::Libc.FILE ) + + @chk ccall( + (:PetscMallocView, $petsc_library), + PetscErrorCode, + (Ptr{Libc.FILE},), + fp, + ) + + + return nothing +end + +""" + PetscMallocSetDebug(petsclib::PetscLibType,eachcall::PetscBool, initializenan::PetscBool) +Set's PETSc memory debugging + +Not Collective + +Input Parameters: +- `eachcall` - checks the entire heap of allocated memory for issues on each call to `PetscMalloc()` and `PetscFree()`, slow +- `initializenan` - initializes all memory with `NaN` to catch use of uninitialized floating point arrays + +Options Database Keys: +- `-malloc_debug ` - turns on or off debugging +- `-malloc_test` - turns on all debugging if PETSc was configured with debugging including `-malloc_dump`, otherwise ignored +- `-malloc_view_threshold t` - log only allocations larger than t +- `-malloc_dump ` - print a list of all memory that has not been freed, in `PetscFinalize()` + +Level: developer + +-seealso: `CHKMEMQ`, `PetscMallocValidate()`, `PetscMallocGetDebug()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocSetDebug")) +""" +function PetscMallocSetDebug(petsclib::PetscLibType, eachcall::PetscBool, initializenan::PetscBool) end + +@for_petsc function PetscMallocSetDebug(petsclib::$UnionPetscLib, eachcall::PetscBool, initializenan::PetscBool ) + + @chk ccall( + (:PetscMallocSetDebug, $petsc_library), + PetscErrorCode, + (PetscBool, PetscBool), + eachcall, initializenan, + ) + + + return nothing +end + +""" + basic::PetscBool,eachcall::PetscBool,initializenan::PetscBool = PetscMallocGetDebug(petsclib::PetscLibType) +Indicates what PETSc memory debugging it is doing. + +Not Collective + +Output Parameters: +- `basic` - doing basic debugging +- `eachcall` - checks the entire memory heap at each `PetscMalloc()`/`PetscFree()` +- `initializenan` - initializes memory with `NaN` + +Level: intermediate + +-seealso: `CHKMEMQ`, `PetscMallocValidate()`, `PetscMallocSetDebug()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocGetDebug")) +""" +function PetscMallocGetDebug(petsclib::PetscLibType) end + +@for_petsc function PetscMallocGetDebug(petsclib::$UnionPetscLib) + basic_ = Ref{PetscBool}() + eachcall_ = Ref{PetscBool}() + initializenan_ = Ref{PetscBool}() + + @chk ccall( + (:PetscMallocGetDebug, $petsc_library), + PetscErrorCode, + (Ptr{PetscBool}, Ptr{PetscBool}, Ptr{PetscBool}), + basic_, eachcall_, initializenan_, + ) + + basic = basic_[] + eachcall = eachcall_[] + initializenan = initializenan_[] + + return basic,eachcall,initializenan +end + +""" + PetscMallocLogRequestedSizeSet(petsclib::PetscLibType,flg::PetscBool) +Whether to log the requested or aligned memory size + +Not Collective + +Input Parameter: +- `flg` - `PETSC_TRUE` to log the requested memory size + +Options Database Key: +- `-malloc_requested_size ` - Sets this flag + +Level: developer + +-seealso: `PetscMallocLogRequestedSizeGet()`, `PetscMallocViewSet()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocLogRequestedSizeSet")) +""" +function PetscMallocLogRequestedSizeSet(petsclib::PetscLibType, flg::PetscBool) end + +@for_petsc function PetscMallocLogRequestedSizeSet(petsclib::$UnionPetscLib, flg::PetscBool ) + + @chk ccall( + (:PetscMallocLogRequestedSizeSet, $petsc_library), + PetscErrorCode, + (PetscBool,), + flg, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscMallocLogRequestedSizeGet(petsclib::PetscLibType) +Whether to log the requested or aligned memory size + +Not Collective + +Output Parameter: +- `flg` - `PETSC_TRUE` if we log the requested memory size + +Level: developer + +-seealso: `PetscMallocLogRequestedSizeSet()`, `PetscMallocViewSet()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocLogRequestedSizeGet")) +""" +function PetscMallocLogRequestedSizeGet(petsclib::PetscLibType) end + +@for_petsc function PetscMallocLogRequestedSizeGet(petsclib::$UnionPetscLib) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscMallocLogRequestedSizeGet, $petsc_library), + PetscErrorCode, + (Ptr{PetscBool},), + flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscMallocSet(petsclib::PetscLibType,imalloc::external, ifree::external, iralloc::external) +Sets the underlying allocation routines used by `PetscMalloc()` and `PetscFree()` + +Not Collective, No Fortran Support + +Input Parameters: +- `imalloc` - the routine that provides the `malloc()` implementation (also provides `calloc()`, which is used depending on the second argument) +- `ifree` - the routine that provides the `free()` implementation +- `iralloc` - the routine that provides the `realloc()` implementation + +Level: developer + +-seealso: `PetscMallocClear()`, `PetscInitialize()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocSet")) +""" +function PetscMallocSet(petsclib::PetscLibType, imalloc::external, ifree::external, iralloc::external) end + +@for_petsc function PetscMallocSet(petsclib::$UnionPetscLib, imalloc::external, ifree::external, iralloc::external ) + + @chk ccall( + (:PetscMallocSet, $petsc_library), + PetscErrorCode, + (external, external, external), + imalloc, ifree, iralloc, + ) + + + return nothing +end + +""" + PetscMallocClear(petsclib::PetscLibType) +Resets the routines used by `PetscMalloc()` and `PetscFree()` + +Not Collective + +Level: developer + +-seealso: `PetscMallocSet()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocClear")) +""" +function PetscMallocClear(petsclib::PetscLibType) end + +@for_petsc function PetscMallocClear(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscMallocClear, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscMemoryTrace(petsclib::PetscLibType,label::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscMemoryTrace")) +""" +function PetscMemoryTrace(petsclib::PetscLibType, label::Vector{Cchar}) end + +@for_petsc function PetscMemoryTrace(petsclib::$UnionPetscLib, label::Vector{Cchar} ) + + @chk ccall( + (:PetscMemoryTrace, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + label, + ) + + + return nothing +end + +""" + PetscMallocSetDRAM(petsclib::PetscLibType) +Set `PetscMalloc()` to use DRAM. +If memkind is available, change the memkind type. Otherwise, switch the +current malloc and free routines to the `PetscMallocAlign()` and +`PetscFreeAlign()` (PETSc default). + +Not Collective + +Level: developer + +-seealso: `PetscMallocReset()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocSetDRAM")) +""" +function PetscMallocSetDRAM(petsclib::PetscLibType) end + +@for_petsc function PetscMallocSetDRAM(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscMallocSetDRAM, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscMallocResetDRAM(petsclib::PetscLibType) +Reset the changes made by `PetscMallocSetDRAM()` + +Not Collective + +Level: developer + +-seealso: `PetscMallocSetDRAM()` + +# External Links +$(_doc_external("Sys/PetscMallocResetDRAM")) +""" +function PetscMallocResetDRAM(petsclib::PetscLibType) end + +@for_petsc function PetscMallocResetDRAM(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscMallocResetDRAM, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscMallocSetCoalesce(petsclib::PetscLibType,coalesce::PetscBool) +Use coalesced `PetscMalloc()` when allocating groups of objects, that is when using `PetscMallocN()` + +Not Collective + +Input Parameter: +- `coalesce` - `PETSC_TRUE` to use coalesced malloc for multi-memory allocation. + +Options Database Key: +- `-malloc_coalesce` - turn coalesced `PetscMallocN()` on or off + +Level: developer + +-seealso: `PetscMallocA()`, `PetscMalloc()`, `PetscFree()` + +# External Links +$(_doc_external("Sys/PetscMallocSetCoalesce")) +""" +function PetscMallocSetCoalesce(petsclib::PetscLibType, coalesce::PetscBool) end + +@for_petsc function PetscMallocSetCoalesce(petsclib::$UnionPetscLib, coalesce::PetscBool ) + + @chk ccall( + (:PetscMallocSetCoalesce, $petsc_library), + PetscErrorCode, + (PetscBool,), + coalesce, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscTestFile(petsclib::PetscLibType,fname::Vector{Cchar}, mode::Cchar) +checks for the existence of a file + +Not Collective + +Input Parameters: +- `fname` - the filename +- `mode` - either 'r', 'w', 'x' or '\0' + +Output Parameter: +- `flg` - the file exists and satisfies the mode + +Level: intermediate + +-seealso: `PetscTestDirectory()`, `PetscLs()` + +# External Links +$(_doc_external("Sys/PetscTestFile")) +""" +function PetscTestFile(petsclib::PetscLibType, fname::Vector{Cchar}, mode::Cchar) end + +@for_petsc function PetscTestFile(petsclib::$UnionPetscLib, fname::Vector{Cchar}, mode::Cchar ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscTestFile, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cchar, Ptr{PetscBool}), + fname, mode, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = PetscTestDirectory(petsclib::PetscLibType,dirname::Vector{Cchar}, mode::Cchar) +checks for the existence of a directory + +Not Collective + +Input Parameters: +- `dirname` - the directory name +- `mode` - either 'r', 'w', or 'x' + +Output Parameter: +- `flg` - the directory exists and satisfies the mode + +Level: intermediate + +-seealso: `PetscTestFile()`, `PetscLs()`, `PetscRMTree()` + +# External Links +$(_doc_external("Sys/PetscTestDirectory")) +""" +function PetscTestDirectory(petsclib::PetscLibType, dirname::Vector{Cchar}, mode::Cchar) end + +@for_petsc function PetscTestDirectory(petsclib::$UnionPetscLib, dirname::Vector{Cchar}, mode::Cchar ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscTestDirectory, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cchar, Ptr{PetscBool}), + dirname, mode, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = PetscLs(petsclib::PetscLibType,comm::MPI_Comm, dirname::Vector{Cchar}, found::Vector{Cchar}, tlen::Csize_t) +produce a listing of the files in a directory + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `dirname` - the directory name +- `tlen` - the length of the buffer `found` + +Output Parameters: +- `found` - listing of files +- `flg` - the directory exists + +Level: intermediate + +-seealso: `PetscTestFile()`, `PetscRMTree()`, `PetscTestDirectory()` + +# External Links +$(_doc_external("Sys/PetscLs")) +""" +function PetscLs(petsclib::PetscLibType, comm::MPI_Comm, dirname::Vector{Cchar}, found::Vector{Cchar}, tlen::Csize_t) end + +@for_petsc function PetscLs(petsclib::$UnionPetscLib, comm::MPI_Comm, dirname::Vector{Cchar}, found::Vector{Cchar}, tlen::Csize_t ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscLs, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Csize_t, Ptr{PetscBool}), + comm, dirname, found, tlen, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscGetRealPath(petsclib::PetscLibType,path::Vector{Cchar}, rpath::Vector{Cchar}) +Get the path without symbolic links etc. in absolute form. + +Not Collective + +Input Parameter: +- `path` - path to resolve + +Output Parameter: +- `rpath` - resolved path + +Level: developer + +-seealso: `PetscGetFullPath()` + +# External Links +$(_doc_external("Sys/PetscGetRealPath")) +""" +function PetscGetRealPath(petsclib::PetscLibType, path::Vector{Cchar}, rpath::Vector{Cchar}) end + +@for_petsc function PetscGetRealPath(petsclib::$UnionPetscLib, path::Vector{Cchar}, rpath::Vector{Cchar} ) + + @chk ccall( + (:PetscGetRealPath, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}), + path, rpath, + ) + + + return nothing +end + +""" + PetscGetTmp(petsclib::PetscLibType,comm::MPI_Comm, dir::Vector{Cchar}, len::Csize_t) +Gets the name of the "tmp" directory, often this is `/tmp` + +Collective + +Input Parameters: +- `comm` - MPI_Communicator that may share tmp +- `len` - length of string to hold name + +Output Parameter: +- `dir` - directory name + +Options Database Keys: +- `-shared_tmp` - indicates the directory is known to be shared among the MPI processes +- `-not_shared_tmp` - indicates the directory is known to be not shared among the MPI processes +- `-tmp tmpdir` - name of the directory you wish to use as tmp + +Environmental Variables: +- `PETSC_SHARED_TMP` - indicates the directory is known to be shared among the MPI processes +- `PETSC_NOT_SHARED_TMP` - indicates the directory is known to be not shared among the MPI processes +- `PETSC_TMP` - name of the directory you wish to use as tmp + +Level: developer + +-seealso: `PetscSharedTmp()`, `PetscSharedWorkingDirectory()`, `PetscGetWorkingDirectory()`, `PetscGetHomeDirectory()` + +# External Links +$(_doc_external("Sys/PetscGetTmp")) +""" +function PetscGetTmp(petsclib::PetscLibType, comm::MPI_Comm, dir::Vector{Cchar}, len::Csize_t) end + +@for_petsc function PetscGetTmp(petsclib::$UnionPetscLib, comm::MPI_Comm, dir::Vector{Cchar}, len::Csize_t ) + + @chk ccall( + (:PetscGetTmp, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Csize_t), + comm, dir, len, + ) + + + return nothing +end + +""" + shared::PetscBool = PetscSharedTmp(petsclib::PetscLibType,comm::MPI_Comm) +Determines if all processors in a communicator share a +tmp directory or have different ones. + +Collective + +Input Parameter: +- `comm` - MPI_Communicator that may share tmp + +Output Parameter: +- `shared` - `PETSC_TRUE` or `PETSC_FALSE` + +Options Database Keys: +- `-shared_tmp` - indicates the directory is known to be shared among the MPI processes +- `-not_shared_tmp` - indicates the directory is known to be not shared among the MPI processes +- `-tmp tmpdir` - name of the directory you wish to use as tmp + +Environmental Variables: +- `PETSC_SHARED_TMP` - indicates the directory is known to be shared among the MPI processes +- `PETSC_NOT_SHARED_TMP` - indicates the directory is known to be not shared among the MPI processes +- `PETSC_TMP` - name of the directory you wish to use as tmp + +Level: developer + +-seealso: `PetscGetTmp()`, `PetscSharedWorkingDirectory()`, `PetscGetWorkingDirectory()`, `PetscGetHomeDirectory()` + +# External Links +$(_doc_external("Sys/PetscSharedTmp")) +""" +function PetscSharedTmp(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscSharedTmp(petsclib::$UnionPetscLib, comm::MPI_Comm ) + shared_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSharedTmp, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscBool}), + comm, shared_, + ) + + shared = shared_[] + + return shared +end + +""" + shared::PetscBool = PetscSharedWorkingDirectory(petsclib::PetscLibType,comm::MPI_Comm) +Determines if all processors in a communicator share a working directory or have different ones. + +Collective + +Input Parameter: +- `comm` - MPI_Communicator that may share working directory + +Output Parameter: +- `shared` - `PETSC_TRUE` or `PETSC_FALSE` + +Options Database Keys: +- `-shared_working_directory` - indicates the directory is known to be shared among the MPI processes +- `-not_shared_working_directory` - indicates the directory is known to be not shared among the MPI processes + +Environmental Variables: +- `PETSC_SHARED_WORKING_DIRECTORY` - indicates the directory is known to be shared among the MPI processes +- `PETSC_NOT_SHARED_WORKING_DIRECTORY` - indicates the directory is known to be not shared among the MPI processes + +Level: developer + +-seealso: `PetscGetTmp()`, `PetscSharedTmp()`, `PetscGetWorkingDirectory()`, `PetscGetHomeDirectory()` + +# External Links +$(_doc_external("Sys/PetscSharedWorkingDirectory")) +""" +function PetscSharedWorkingDirectory(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscSharedWorkingDirectory(petsclib::$UnionPetscLib, comm::MPI_Comm ) + shared_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSharedWorkingDirectory, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscBool}), + comm, shared_, + ) + + shared = shared_[] + + return shared +end + +""" + found::PetscBool = PetscFileRetrieve(petsclib::PetscLibType,comm::MPI_Comm, url::Vector{Cchar}, locname::Vector{Cchar}, llen::Csize_t) +Obtains a file from a URL or a compressed file +and copies into local disk space as uncompressed. + +Collective + +Input Parameters: +- `comm` - processors accessing the file +- `url` - name of file, including entire URL (with or without .gz) +- `llen` - length of `localname` + +Output Parameters: +- `localname` - name of local copy of file - valid on only process zero +- `found` - if found or retrieved the file - valid on all processes + +Level: developer + +-seealso: `PetscDLLibraryRetrieve()` + +# External Links +$(_doc_external("Sys/PetscFileRetrieve")) +""" +function PetscFileRetrieve(petsclib::PetscLibType, comm::MPI_Comm, url::Vector{Cchar}, locname::Vector{Cchar}, llen::Csize_t) end + +@for_petsc function PetscFileRetrieve(petsclib::$UnionPetscLib, comm::MPI_Comm, url::Vector{Cchar}, locname::Vector{Cchar}, llen::Csize_t ) + found_ = Ref{PetscBool}() + + @chk ccall( + (:PetscFileRetrieve, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Csize_t, Ptr{PetscBool}), + comm, url, locname, llen, found_, + ) + + found = found_[] + + return found +end + +""" + PetscGetFullPath(petsclib::PetscLibType,path::Vector{Cchar}, fullpath::Vector{Cchar}, flen::Csize_t) +Given a filename, returns the fully qualified file name. + +Not Collective + +Input Parameters: +- `path` - pathname to qualify +- `flen` - size of `fullpath` + +Output Parameter: +- `fullpath` - buffer to hold the full pathname + +Level: developer + +-seealso: `PetscGetRelativePath()` + +# External Links +$(_doc_external("Sys/PetscGetFullPath")) +""" +function PetscGetFullPath(petsclib::PetscLibType, path::Vector{Cchar}, fullpath::Vector{Cchar}, flen::Csize_t) end + +@for_petsc function PetscGetFullPath(petsclib::$UnionPetscLib, path::Vector{Cchar}, fullpath::Vector{Cchar}, flen::Csize_t ) + + @chk ccall( + (:PetscGetFullPath, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Csize_t), + path, fullpath, flen, + ) + + + return nothing +end + +""" + PetscByteSwap(petsclib::PetscLibType,data::Cvoid, pdtype::PetscDataType, count::PetscCount) + +# External Links +$(_doc_external("Sys/PetscByteSwap")) +""" +function PetscByteSwap(petsclib::PetscLibType, data::Cvoid, pdtype::PetscDataType, count::PetscCount) end + +@for_petsc function PetscByteSwap(petsclib::$UnionPetscLib, data::Cvoid, pdtype::PetscDataType, count::PetscCount ) + + @chk ccall( + (:PetscByteSwap, $petsc_library), + PetscErrorCode, + (Ptr{Cvoid}, PetscDataType, PetscCount), + data, pdtype, count, + ) + + + return nothing +end + +""" + count::PetscInt = PetscBinaryRead(petsclib::PetscLibType,fd::Cint, data::Cvoid, num::PetscCount, type::PetscDataType) +Reads from a binary file. + +Not Collective + +Input Parameters: +- `fd` - the file descriptor +- `num` - the maximum number of items to read +- `type` - the type of items to read (`PETSC_INT`, `PETSC_REAL`, `PETSC_SCALAR`, etc.) + +Output Parameters: +- `data` - the buffer, this is an array of the type that matches the value in `type` +- `count` - the number of items read, optional + +Level: developer + +-seealso: `PetscBinaryWrite()`, `PetscBinaryOpen()`, `PetscBinaryClose()`, `PetscViewerBinaryGetDescriptor()`, `PetscBinarySynchronizedWrite()`, +`PetscBinarySynchronizedRead()`, `PetscBinarySynchronizedSeek()` + +# External Links +$(_doc_external("Sys/PetscBinaryRead")) +""" +function PetscBinaryRead(petsclib::PetscLibType, fd::Cint, data::Cvoid, num::PetscCount, type::PetscDataType) end + +@for_petsc function PetscBinaryRead(petsclib::$UnionPetscLib, fd::Cint, data::Cvoid, num::PetscCount, type::PetscDataType ) + count_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscBinaryRead, $petsc_library), + PetscErrorCode, + (Cint, Ptr{Cvoid}, PetscCount, Ptr{$PetscInt}, PetscDataType), + fd, data, num, count_, type, + ) + + count = count_[] + + return count +end + +""" + PetscBinaryWrite(petsclib::PetscLibType,fd::Cint, p::Cvoid, n::PetscCount, type::PetscDataType) +Writes to a binary file. + +Not Collective + +Input Parameters: +- `fd` - the file +- `p` - the buffer, an array of the type that matches the value in `type` +- `n` - the number of items to write +- `type` - the type of items to read (`PETSC_INT`, `PETSC_REAL` or `PETSC_SCALAR`) + +Level: advanced + +-seealso: `PetscBinaryRead()`, `PetscBinaryOpen()`, `PetscBinaryClose()`, `PetscViewerBinaryGetDescriptor()`, `PetscBinarySynchronizedWrite()`, +`PetscBinarySynchronizedRead()`, `PetscBinarySynchronizedSeek()` + +# External Links +$(_doc_external("Sys/PetscBinaryWrite")) +""" +function PetscBinaryWrite(petsclib::PetscLibType, fd::Cint, p::Cvoid, n::PetscCount, type::PetscDataType) end + +@for_petsc function PetscBinaryWrite(petsclib::$UnionPetscLib, fd::Cint, p::Cvoid, n::PetscCount, type::PetscDataType ) + + @chk ccall( + (:PetscBinaryWrite, $petsc_library), + PetscErrorCode, + (Cint, Ptr{Cvoid}, PetscCount, PetscDataType), + fd, p, n, type, + ) + + + return nothing +end + +""" + PetscBinaryOpen(petsclib::PetscLibType,name::Vector{Cchar}, mode::PetscFileMode, fd::Cint) +Opens a PETSc binary file. + +Not Collective + +Input Parameters: +- `name` - filename +- `mode` - open mode of binary file, one of `FILE_MODE_READ`, `FILE_MODE_WRITE`, `FILE_MODE_APPEND` + +Output Parameter: +- `fd` - the file + +Level: advanced + +-seealso: `PetscBinaryRead()`, `PetscBinaryWrite()`, `PetscFileMode`, `PetscViewerFileSetMode()`, `PetscViewerBinaryGetDescriptor()`, +`PetscBinarySynchronizedWrite()`, `PetscBinarySynchronizedRead()`, `PetscBinarySynchronizedSeek()` + +# External Links +$(_doc_external("Sys/PetscBinaryOpen")) +""" +function PetscBinaryOpen(petsclib::PetscLibType, name::Vector{Cchar}, mode::PetscFileMode, fd::Cint) end + +@for_petsc function PetscBinaryOpen(petsclib::$UnionPetscLib, name::Vector{Cchar}, mode::PetscFileMode, fd::Cint ) + + @chk ccall( + (:PetscBinaryOpen, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, PetscFileMode, Ptr{Cint}), + name, mode, fd, + ) + + + return nothing +end + +""" + PetscBinaryClose(petsclib::PetscLibType,fd::Cint) +Closes a PETSc binary file. + +Not Collective + +Output Parameter: +- `fd` - the file + +Level: advanced + +-seealso: `PetscBinaryRead()`, `PetscBinaryWrite()`, `PetscBinaryOpen()`, `PetscBinarySynchronizedWrite()`, `PetscBinarySynchronizedRead()`, +`PetscBinarySynchronizedSeek()` + +# External Links +$(_doc_external("Sys/PetscBinaryClose")) +""" +function PetscBinaryClose(petsclib::PetscLibType, fd::Cint) end + +@for_petsc function PetscBinaryClose(petsclib::$UnionPetscLib, fd::Cint ) + + @chk ccall( + (:PetscBinaryClose, $petsc_library), + PetscErrorCode, + (Cint,), + fd, + ) + + + return nothing +end + +""" + count::PetscInt = PetscBinarySynchronizedRead(petsclib::PetscLibType,comm::MPI_Comm, fd::Cint, data::Cvoid, num::PetscInt, type::PetscDataType) +Reads from a binary file, all MPI processes get the same values + +Collective, No Fortran Support + +Input Parameters: +- `comm` - the MPI communicator +- `fd` - the file descriptor +- `num` - the maximum number of items to read +- `type` - the type of items to read (`PETSC_INT`, `PETSC_REAL`, `PETSC_SCALAR`, etc.) + +Output Parameters: +- `data` - the buffer, an array of the type that matches the value in `type` +- `count` - the number of items read, optional + +Level: developer + +-seealso: `PetscBinaryWrite()`, `PetscBinaryOpen()`, `PetscBinaryClose()`, `PetscBinaryRead()`, `PetscBinarySynchronizedWrite()`, +`PetscBinarySynchronizedSeek()` + +# External Links +$(_doc_external("Sys/PetscBinarySynchronizedRead")) +""" +function PetscBinarySynchronizedRead(petsclib::PetscLibType, comm::MPI_Comm, fd::Cint, data::Cvoid, num::PetscInt, type::PetscDataType) end + +@for_petsc function PetscBinarySynchronizedRead(petsclib::$UnionPetscLib, comm::MPI_Comm, fd::Cint, data::Cvoid, num::$PetscInt, type::PetscDataType ) + count_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscBinarySynchronizedRead, $petsc_library), + PetscErrorCode, + (MPI_Comm, Cint, Ptr{Cvoid}, $PetscInt, Ptr{$PetscInt}, PetscDataType), + comm, fd, data, num, count_, type, + ) + + count = count_[] + + return count +end + +""" + PetscBinarySynchronizedWrite(petsclib::PetscLibType,comm::MPI_Comm, fd::Cint, p::Cvoid, n::PetscInt, type::PetscDataType) +writes to a binary file. + +Collective, No Fortran Support + +Input Parameters: +- `comm` - the MPI communicator +- `fd` - the file +- `n` - the number of items to write +- `p` - the buffer, an array of the type that matches the value in `type` +- `type` - the type of items to write (`PETSC_INT`, `PETSC_REAL` or `PETSC_SCALAR`) + +Level: developer + +-seealso: `PetscBinaryWrite()`, `PetscBinaryOpen()`, `PetscBinaryClose()`, `PetscBinaryRead()`, `PetscBinarySynchronizedRead()`, +`PetscBinarySynchronizedSeek()` + +# External Links +$(_doc_external("Sys/PetscBinarySynchronizedWrite")) +""" +function PetscBinarySynchronizedWrite(petsclib::PetscLibType, comm::MPI_Comm, fd::Cint, p::Cvoid, n::PetscInt, type::PetscDataType) end + +@for_petsc function PetscBinarySynchronizedWrite(petsclib::$UnionPetscLib, comm::MPI_Comm, fd::Cint, p::Cvoid, n::$PetscInt, type::PetscDataType ) + + @chk ccall( + (:PetscBinarySynchronizedWrite, $petsc_library), + PetscErrorCode, + (MPI_Comm, Cint, Ptr{Cvoid}, $PetscInt, PetscDataType), + comm, fd, p, n, type, + ) + + + return nothing +end + +""" + PetscStartMatlab(petsclib::PetscLibType,comm::MPI_Comm, machine::Vector{Cchar}, script::Vector{Cchar}, fp::Libc.FILE) +starts up MATLAB with a MATLAB script + +Logically Collective, but only MPI rank 0 in the communicator does anything + +Input Parameters: +- `comm` - MPI communicator +- `machine` - optional machine to run MATLAB on +- `script` - name of script (without the .m) + +Output Parameter: +- `fp` - a file pointer returned from `PetscPOpen()` + +Level: intermediate + +-seealso: `PetscPOpen()`, `PetscPClose()`, `PetscMatlabEngine` + +# External Links +$(_doc_external("Sys/PetscStartMatlab")) +""" +function PetscStartMatlab(petsclib::PetscLibType, comm::MPI_Comm, machine::Vector{Cchar}, script::Vector{Cchar}, fp::Libc.FILE) end + +@for_petsc function PetscStartMatlab(petsclib::$UnionPetscLib, comm::MPI_Comm, machine::Vector{Cchar}, script::Vector{Cchar}, fp::Libc.FILE ) + + @chk ccall( + (:PetscStartMatlab, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Libc.FILE), + comm, machine, script, fp, + ) + + + return nothing +end + +""" + PetscFOpen(petsclib::PetscLibType,comm::MPI_Comm, name::Vector{Cchar}, mode::Vector{Cchar}, fp::Libc.FILE) +Has the first process in the MPI communicator open a file; +all others do nothing. + +Logically Collective + +Input Parameters: +- `comm` - the MPI communicator +- `name` - the filename +- `mode` - the mode for `fopen()`, usually "w" + +Output Parameter: +- `fp` - the file pointer + +Level: developer + +-seealso: `PetscFClose()`, `PetscSynchronizedFGets()`, `PetscSynchronizedPrintf()`, `PetscSynchronizedFlush()`, +`PetscFPrintf()` + +# External Links +$(_doc_external("Sys/PetscFOpen")) +""" +function PetscFOpen(petsclib::PetscLibType, comm::MPI_Comm, name::Vector{Cchar}, mode::Vector{Cchar}, fp::Libc.FILE) end + +@for_petsc function PetscFOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, name::Vector{Cchar}, mode::Vector{Cchar}, fp::Libc.FILE ) + + @chk ccall( + (:PetscFOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Libc.FILE), + comm, name, mode, fp, + ) + + + return nothing +end + +""" + PetscFClose(petsclib::PetscLibType,comm::MPI_Comm, fd::Libc.FILE) +Has MPI rank 0 in the communicator close a +file (usually obtained with `PetscFOpen()`; all others do nothing. + +Logically Collective + +Input Parameters: +- `comm` - the MPI communicator +- `fd` - the file, opened with `PetscFOpen()` + +Level: developer + +-seealso: `PetscFOpen()` + +# External Links +$(_doc_external("Sys/PetscFClose")) +""" +function PetscFClose(petsclib::PetscLibType, comm::MPI_Comm, fd::Libc.FILE) end + +@for_petsc function PetscFClose(petsclib::$UnionPetscLib, comm::MPI_Comm, fd::Libc.FILE ) + + @chk ccall( + (:PetscFClose, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Libc.FILE}), + comm, fd, + ) + + + return nothing +end + +""" + PetscPClose(petsclib::PetscLibType,comm::MPI_Comm, fd::Libc.FILE) +Closes (ends) a program on MPI rank 0 run with `PetscPOpen()` + +Collective, but only MPI rank 0 does anything + +Input Parameters: +- `comm` - MPI communicator, only rank 0 performs the close +- `fd` - the file pointer where program input or output may be read or `NULL` if don't care + +Level: intermediate + +-seealso: `PetscFOpen()`, `PetscFClose()`, `PetscPOpen()` + +# External Links +$(_doc_external("Sys/PetscPClose")) +""" +function PetscPClose(petsclib::PetscLibType, comm::MPI_Comm, fd::Libc.FILE) end + +@for_petsc function PetscPClose(petsclib::$UnionPetscLib, comm::MPI_Comm, fd::Libc.FILE ) + + @chk ccall( + (:PetscPClose, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Libc.FILE}), + comm, fd, + ) + + + return nothing +end + +""" + PetscPOpen(petsclib::PetscLibType,comm::MPI_Comm, machine::Vector{Cchar}, program::Vector{Cchar}, mode::Vector{Cchar}, fp::Libc.FILE) +Runs a program on MPI rank 0 and sends either its input or output to +a file. + +Logically Collective, but only MPI rank 0 runs the command + +Input Parameters: +- `comm` - MPI communicator, only processor zero runs the program +- `machine` - machine to run command on or `NULL`, or a string with 0 in first location +- `program` - name of program to run +- `mode` - either "r" or "w" + +Output Parameter: +- `fp` - the file pointer where program input or output may be read or `NULL` if results are not needed + +Level: intermediate + +-seealso: `PetscFOpen()`, `PetscFClose()`, `PetscPClose()`, `PetscPOpenSetMachine()` + +# External Links +$(_doc_external("Sys/PetscPOpen")) +""" +function PetscPOpen(petsclib::PetscLibType, comm::MPI_Comm, machine::Vector{Cchar}, program::Vector{Cchar}, mode::Vector{Cchar}, fp::Libc.FILE) end + +@for_petsc function PetscPOpen(petsclib::$UnionPetscLib, comm::MPI_Comm, machine::Vector{Cchar}, program::Vector{Cchar}, mode::Vector{Cchar}, fp::Libc.FILE ) + + @chk ccall( + (:PetscPOpen, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Libc.FILE), + comm, machine, program, mode, fp, + ) + + + return nothing +end + +""" + PetscPOpenSetMachine(petsclib::PetscLibType,machine::Vector{Cchar}) +Sets the name of the default machine to run `PetscPOpen()` calls on + +Logically Collective, but only the MPI process with rank 0 runs the command + +Input Parameter: +- `machine` - machine to run command on or `NULL` for the current machine + +Options Database Key: +- `-popen_machine ` - run the process on this machine + +Level: intermediate + +-seealso: `PetscFOpen()`, `PetscFClose()`, `PetscPClose()`, `PetscPOpen()` + +# External Links +$(_doc_external("Sys/PetscPOpenSetMachine")) +""" +function PetscPOpenSetMachine(petsclib::PetscLibType, machine::Vector{Cchar}) end + +@for_petsc function PetscPOpenSetMachine(petsclib::$UnionPetscLib, machine::Vector{Cchar} ) + + @chk ccall( + (:PetscPOpenSetMachine, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + machine, + ) + + + return nothing +end + +""" + PetscGetWorkingDirectory(petsclib::PetscLibType,path::Vector{Cchar}, len::Csize_t) +Gets the current working directory. + +Not Collective + +Input Parameter: +- `len` - maximum length of `path` + +Output Parameter: +- `path` - holds the result value. The string should be long enough to hold the path, for example, `PETSC_MAX_PATH_LEN` + +Level: developer + +-seealso: `PetscGetTmp()`, `PetscSharedTmp()`, `PetscSharedWorkingDirectory()`, `PetscGetHomeDirectory()` + +# External Links +$(_doc_external("Sys/PetscGetWorkingDirectory")) +""" +function PetscGetWorkingDirectory(petsclib::PetscLibType, path::Vector{Cchar}, len::Csize_t) end + +@for_petsc function PetscGetWorkingDirectory(petsclib::$UnionPetscLib, path::Vector{Cchar}, len::Csize_t ) + + @chk ccall( + (:PetscGetWorkingDirectory, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Csize_t), + path, len, + ) + + + return nothing +end + +""" + PetscGetHomeDirectory(petsclib::PetscLibType,dir::Vector{Cchar}, maxlen::Csize_t) +Returns the name of the user's home directory + +Not Collective + +Input Parameter: +- `maxlen` - maximum length allowed + +Output Parameter: +- `dir` - contains the home directory. Must be long enough to hold the name. + +Level: developer + +-seealso: `PetscGetTmp()`, `PetscSharedTmp()`, `PetscGetWorkingDirectory()` + +# External Links +$(_doc_external("Sys/PetscGetHomeDirectory")) +""" +function PetscGetHomeDirectory(petsclib::PetscLibType, dir::Vector{Cchar}, maxlen::Csize_t) end + +@for_petsc function PetscGetHomeDirectory(petsclib::$UnionPetscLib, dir::Vector{Cchar}, maxlen::Csize_t ) + + @chk ccall( + (:PetscGetHomeDirectory, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Csize_t), + dir, maxlen, + ) + + + return nothing +end + +""" + PetscFixFilename(petsclib::PetscLibType,filein::Vector{Cchar}, fileout::Vector{Cchar}) +Fixes a file name so that it is correct for both Unix and +Microsoft Windows by using the correct `/` or `\` to separate directories. + +Not Collective + +Input Parameter: +- `filein` - name of file to be fixed + +Output Parameter: +- `fileout` - the fixed name. Should long enough to hold the filename. + +Level: developer + +-seealso: `PetscFOpen()` + +# External Links +$(_doc_external("Sys/PetscFixFilename")) +""" +function PetscFixFilename(petsclib::PetscLibType, filein::Vector{Cchar}, fileout::Vector{Cchar}) end + +@for_petsc function PetscFixFilename(petsclib::$UnionPetscLib, filein::Vector{Cchar}, fileout::Vector{Cchar} ) + + @chk ccall( + (:PetscFixFilename, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}), + filein, fileout, + ) + + + return nothing +end + +""" + PetscGetRelativePath(petsclib::PetscLibType,fullpath::Vector{Cchar}, path::Vector{Cchar}, flen::Csize_t) +Given a filename, returns the relative path (removes +all directory specifiers). + +Not Collective; No Fortran Support + +Input Parameters: +- `fullpath` - full pathname +- `flen` - size of `path` + +Output Parameter: +- `path` - buffer that holds relative pathname + +Level: developer + +-seealso: `PetscGetFullPath()` + +# External Links +$(_doc_external("Sys/PetscGetRelativePath")) +""" +function PetscGetRelativePath(petsclib::PetscLibType, fullpath::Vector{Cchar}, path::Vector{Cchar}, flen::Csize_t) end + +@for_petsc function PetscGetRelativePath(petsclib::$UnionPetscLib, fullpath::Vector{Cchar}, path::Vector{Cchar}, flen::Csize_t ) + + @chk ccall( + (:PetscGetRelativePath, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Csize_t), + fullpath, path, flen, + ) + + + return nothing +end + +""" + PetscFormatConvertGetSize(petsclib::PetscLibType,format::Vector{Cchar}, size::Csize_t) +Gets the length of a string needed to hold data converted with `PetscFormatConvert()` based on the format + +No Fortran Support + +Input Parameter: +- `format` - the PETSc format string + +Output Parameter: +- `size` - the needed length of the new format + +Level: developer + +-seealso: `PetscFormatConvert()`, `PetscVSNPrintf()`, `PetscVFPrintf()` + +# External Links +$(_doc_external("Sys/PetscFormatConvertGetSize")) +""" +function PetscFormatConvertGetSize(petsclib::PetscLibType, format::Vector{Cchar}, size::Csize_t) end + +@for_petsc function PetscFormatConvertGetSize(petsclib::$UnionPetscLib, format::Vector{Cchar}, size::Csize_t ) + + @chk ccall( + (:PetscFormatConvertGetSize, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Csize_t}), + format, size, + ) + + + return nothing +end + +""" + PetscFormatConvert(petsclib::PetscLibType,format::Vector{Cchar}, newformat::Vector{Cchar}) +converts %g to [|%g|] so that `PetscVSNPrintf()` can ensure all %g formatted numbers have a decimal point when printed. + +No Fortran Support + +Input Parameter: +- `format` - the PETSc format string + +Output Parameter: +- `newformat` - the formatted string, must be long enough to hold result + +Level: developer + +-seealso: `PetscFormatConvertGetSize()`, `PetscVSNPrintf()`, `PetscVFPrintf()` + +# External Links +$(_doc_external("Sys/PetscFormatConvert")) +""" +function PetscFormatConvert(petsclib::PetscLibType, format::Vector{Cchar}, newformat::Vector{Cchar}) end + +@for_petsc function PetscFormatConvert(petsclib::$UnionPetscLib, format::Vector{Cchar}, newformat::Vector{Cchar} ) + + @chk ccall( + (:PetscFormatConvert, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}), + format, newformat, + ) + + + return nothing +end + +""" + PetscFFlush(petsclib::PetscLibType,fd::Libc.FILE) +Flush a file stream + +Input Parameter: +- `fd` - The file stream handle + +Level: intermediate + +-seealso: `PetscPrintf()`, `PetscFPrintf()`, `PetscVFPrintf()`, `PetscVSNPrintf()` + +# External Links +$(_doc_external("Sys/PetscFFlush")) +""" +function PetscFFlush(petsclib::PetscLibType, fd::Libc.FILE) end + +@for_petsc function PetscFFlush(petsclib::$UnionPetscLib, fd::Libc.FILE ) + + @chk ccall( + (:PetscFFlush, $petsc_library), + PetscErrorCode, + (Ptr{Libc.FILE},), + fd, + ) + + + return nothing +end + +""" + PetscSynchronizedFlush(petsclib::PetscLibType,comm::MPI_Comm, fd::Libc.FILE) +Flushes to the screen output from all processors +involved in previous `PetscSynchronizedPrintf()`/`PetscSynchronizedFPrintf()` calls. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `fd` - the file pointer (valid on MPI rank 0 of the communicator), `PETSC_STDOUT` or value obtained from `PetscFOpen()` + +Level: intermediate + +-seealso: `PetscSynchronizedPrintf()`, `PetscFPrintf()`, `PetscPrintf()`, `PetscViewerASCIIPrintf()`, +`PetscViewerASCIISynchronizedPrintf()` + +# External Links +$(_doc_external("Sys/PetscSynchronizedFlush")) +""" +function PetscSynchronizedFlush(petsclib::PetscLibType, comm::MPI_Comm, fd::Libc.FILE) end + +@for_petsc function PetscSynchronizedFlush(petsclib::$UnionPetscLib, comm::MPI_Comm, fd::Libc.FILE ) + + @chk ccall( + (:PetscSynchronizedFlush, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Libc.FILE}), + comm, fd, + ) + + + return nothing +end + +""" + PetscSynchronizedFGets(petsclib::PetscLibType,comm::MPI_Comm, fp::Libc.FILE, len::Csize_t, string::Vector{Cchar}) +Multiple MPI processes all get the same line from a file. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `fp` - the file pointer +- `len` - the length of `string` + +Output Parameter: +- `string` - the line read from the file, at end of file `string`[0] == 0 + +Level: intermediate + +-seealso: `PetscSynchronizedPrintf()`, `PetscSynchronizedFlush()`, +`PetscFOpen()`, `PetscViewerASCIISynchronizedPrintf()`, `PetscViewerASCIIPrintf()` + +# External Links +$(_doc_external("Sys/PetscSynchronizedFGets")) +""" +function PetscSynchronizedFGets(petsclib::PetscLibType, comm::MPI_Comm, fp::Libc.FILE, len::Csize_t, string::Vector{Cchar}) end + +@for_petsc function PetscSynchronizedFGets(petsclib::$UnionPetscLib, comm::MPI_Comm, fp::Libc.FILE, len::Csize_t, string::Vector{Cchar} ) + + @chk ccall( + (:PetscSynchronizedFGets, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Libc.FILE}, Csize_t, Ptr{Cchar}), + comm, fp, len, string, + ) + + + return nothing +end + +""" + PetscFormatRealArray(petsclib::PetscLibType,buf::Vector{Cchar}, len::Csize_t, fmt::Vector{Cchar}, n::PetscInt, x::Vector{PetscReal}) + +# External Links +$(_doc_external("Sys/PetscFormatRealArray")) +""" +function PetscFormatRealArray(petsclib::PetscLibType, buf::Vector{Cchar}, len::Csize_t, fmt::Vector{Cchar}, n::PetscInt, x::Vector{PetscReal}) end + +@for_petsc function PetscFormatRealArray(petsclib::$UnionPetscLib, buf::Vector{Cchar}, len::Csize_t, fmt::Vector{Cchar}, n::$PetscInt, x::Vector{$PetscReal} ) + + @chk ccall( + (:PetscFormatRealArray, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Csize_t, Ptr{Cchar}, $PetscInt, Ptr{$PetscReal}), + buf, len, fmt, n, x, + ) + + + return nothing +end + +""" + PetscMkdir(petsclib::PetscLibType,dir::Vector{Cchar}) +Create a directory + +Not Collective + +Input Parameter: +- `dir` - the directory name + +Level: advanced + +-seealso: `PetscMkdtemp()`, `PetscRMTree()` + +# External Links +$(_doc_external("Sys/PetscMkdir")) +""" +function PetscMkdir(petsclib::PetscLibType, dir::Vector{Cchar}) end + +@for_petsc function PetscMkdir(petsclib::$UnionPetscLib, dir::Vector{Cchar} ) + + @chk ccall( + (:PetscMkdir, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + dir, + ) + + + return nothing +end + +""" + PetscMkdtemp(petsclib::PetscLibType,dir::Vector{Cchar}) +Create a directory with a unique name given a name template. + +Input Parameter: +- `dir` - file name template, the last six characters must be 'XXXXXX', and they will be modified upon return + +Level: advanced + +-seealso: `PetscMkdir()`, `PetscRMTree()` + +# External Links +$(_doc_external("Sys/PetscMkdtemp")) +""" +function PetscMkdtemp(petsclib::PetscLibType, dir::Vector{Cchar}) end + +@for_petsc function PetscMkdtemp(petsclib::$UnionPetscLib, dir::Vector{Cchar} ) + + @chk ccall( + (:PetscMkdtemp, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + dir, + ) + + + return nothing +end + +""" + PetscRMTree(petsclib::PetscLibType,dir::Vector{Cchar}) +delete a directory and all of its children + +Input Parameter: +- `dir` - the name of the directory + +Level: advanced + +-seealso: `PetscMkdtemp()`, `PetscMkdir()` + +# External Links +$(_doc_external("Sys/PetscRMTree")) +""" +function PetscRMTree(petsclib::PetscLibType, dir::Vector{Cchar}) end + +@for_petsc function PetscRMTree(petsclib::$UnionPetscLib, dir::Vector{Cchar} ) + + @chk ccall( + (:PetscRMTree, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + dir, + ) + + + return nothing +end + +""" + PetscPythonFinalize(petsclib::PetscLibType) +Finalize PETSc for use with Python. + +Level: intermediate + +-seealso: `PetscPythonInitialize()`, `PetscPythonPrintError()` + +# External Links +$(_doc_external("Sys/PetscPythonFinalize")) +""" +function PetscPythonFinalize(petsclib::PetscLibType) end + +@for_petsc function PetscPythonFinalize(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscPythonFinalize, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscPythonInitialize(petsclib::PetscLibType,pyexe::Vector{Cchar}, pylib::Vector{Cchar}) +Initialize Python for use with PETSc and import petsc4py. + +Input Parameters: +- `pyexe` - path to the Python interpreter executable, or `NULL`. +- `pylib` - full path to the Python dynamic library, or `NULL`. + +Options Database Key: +- `-python ` - Initializes Python, and optionally takes a Python executable name + +Level: intermediate + +-seealso: `PetscPythonFinalize()`, `PetscPythonPrintError()` + +# External Links +$(_doc_external("Sys/PetscPythonInitialize")) +""" +function PetscPythonInitialize(petsclib::PetscLibType, pyexe::Vector{Cchar}, pylib::Vector{Cchar}) end + +@for_petsc function PetscPythonInitialize(petsclib::$UnionPetscLib, pyexe::Vector{Cchar}, pylib::Vector{Cchar} ) + + @chk ccall( + (:PetscPythonInitialize, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}), + pyexe, pylib, + ) + + + return nothing +end + +""" + PetscPythonPrintError(petsclib::PetscLibType) +Print any current Python errors. + +Level: developer + +-seealso: `PetscPythonInitialize()`, `PetscPythonFinalize()` + +# External Links +$(_doc_external("Sys/PetscPythonPrintError")) +""" +function PetscPythonPrintError(petsclib::PetscLibType) end + +@for_petsc function PetscPythonPrintError(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscPythonPrintError, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscPythonMonitorSet(petsclib::PetscLibType,obj::PetscObject, url::Vector{Cchar}) +Set a Python monitor for a `PetscObject` + +Level: developer + +-seealso: `PetscPythonInitialize()`, `PetscPythonFinalize()`, `PetscPythonPrintError()` + +# External Links +$(_doc_external("Sys/PetscPythonMonitorSet")) +""" +function PetscPythonMonitorSet(petsclib::PetscLibType, obj::PetscObject, url::Vector{Cchar}) end + +@for_petsc function PetscPythonMonitorSet(petsclib::$UnionPetscLib, obj::PetscObject, url::Vector{Cchar} ) + + @chk ccall( + (:PetscPythonMonitorSet, $petsc_library), + PetscErrorCode, + (PetscObject, Ptr{Cchar}), + obj, url, + ) + + + return nothing +end + +""" + PetscSysFinalizePackage(petsclib::PetscLibType) +This function destroys everything in the system library portion of PETSc. +It is called from `PetscFinalize()`. + +Level: developer + +-seealso: `PetscSysInitializePackage()`, `PetscFinalize()` + +# External Links +$(_doc_external("Sys/PetscSysFinalizePackage")) +""" +function PetscSysFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscSysFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscSysFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscSysInitializePackage(petsclib::PetscLibType) +This function initializes everything in the system library portion of PETSc. It is called +from `PetscDLLibraryRegister_petsc()` when using dynamic libraries, and in the call to `PetscInitialize()` +when using shared or static libraries. + +Level: developer + +-seealso: `PetscSysFinalizePackage()`, `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscSysInitializePackage")) +""" +function PetscSysInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscSysInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscSysInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + identical::PetscBool = PetscMonitorCompare(petsclib::PetscLibType,nmon::external, nmctx::Cvoid, nmdestroy::PetscCtxDestroyFn, mon::external, mctx::Cvoid, mdestroy::PetscCtxDestroyFn) +Checks if two monitors are identical; if they are then it destroys the new one + +Not Collective + +Input Parameters: +- `nmon` - The new monitor +- `nmctx` - The new monitor context, or `NULL` +- `nmdestroy` - The new monitor context destroy function, or `NULL`, see `PetscCtxDestroyFn` for its calling sequence +- `mon` - The old monitor +- `mctx` - The old monitor context, or `NULL` +- `mdestroy` - The old monitor context destroy function, or `NULL`, see `PetscCtxDestroyFn` for its calling sequence + +Output Parameter: +- `identical` - `PETSC_TRUE` if the monitors are the same + +Level: developer + +-seealso: [](sec_viewers), `DMMonitorSetFromOptions()`, `KSPMonitorSetFromOptions()`, `SNESMonitorSetFromOptions()`, `PetscCtxDestroyFn` + +# External Links +$(_doc_external("Sys/PetscMonitorCompare")) +""" +function PetscMonitorCompare(petsclib::PetscLibType, nmon::external, nmctx::Cvoid, nmdestroy::PetscCtxDestroyFn, mon::external, mctx::Cvoid, mdestroy::PetscCtxDestroyFn) end + +@for_petsc function PetscMonitorCompare(petsclib::$UnionPetscLib, nmon::external, nmctx::Cvoid, nmdestroy::PetscCtxDestroyFn, mon::external, mctx::Cvoid, mdestroy::PetscCtxDestroyFn ) + identical_ = Ref{PetscBool}() + + @chk ccall( + (:PetscMonitorCompare, $petsc_library), + PetscErrorCode, + (external, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}, external, Ptr{Cvoid}, Ptr{PetscCtxDestroyFn}, Ptr{PetscBool}), + nmon, nmctx, nmdestroy, mon, mctx, mdestroy, identical_, + ) + + identical = identical_[] + + return identical +end + +""" + htype::hid_t = PetscDataTypeToHDF5DataType(petsclib::PetscLibType,ptype::PetscDataType) +Converts the PETSc name of a datatype to its HDF5 name. + +Not Collective + +Input Parameter: +- `ptype` - the PETSc datatype name (for example `PETSC_DOUBLE`) + +Output Parameter: +- `htype` - the HDF5 datatype + +Level: advanced + +-seealso: [](sec_viewers), `PetscDataType`, `PetscHDF5DataTypeToPetscDataType()` + +# External Links +$(_doc_external("Sys/PetscDataTypeToHDF5DataType")) +""" +function PetscDataTypeToHDF5DataType(petsclib::PetscLibType, ptype::PetscDataType) end + +@for_petsc function PetscDataTypeToHDF5DataType(petsclib::$UnionPetscLib, ptype::PetscDataType ) + htype_ = Ref{hid_t}() + + @chk ccall( + (:PetscDataTypeToHDF5DataType, $petsc_library), + PetscErrorCode, + (PetscDataType, Ptr{hid_t}), + ptype, htype_, + ) + + htype = htype_[] + + return htype +end + +""" + ptype::PetscDataType = PetscHDF5DataTypeToPetscDataType(petsclib::PetscLibType,htype::hid_t) +Finds the PETSc name of a datatype from its HDF5 name + +Not Collective + +Input Parameter: +- `htype` - the HDF5 datatype (for example `H5T_NATIVE_DOUBLE`, ...) + +Output Parameter: +- `ptype` - the PETSc datatype name (for example `PETSC_DOUBLE`) + +Level: advanced + +-seealso: [](sec_viewers), `PetscDataType` + +# External Links +$(_doc_external("Sys/PetscHDF5DataTypeToPetscDataType")) +""" +function PetscHDF5DataTypeToPetscDataType(petsclib::PetscLibType, htype::hid_t) end + +@for_petsc function PetscHDF5DataTypeToPetscDataType(petsclib::$UnionPetscLib, htype::hid_t ) + ptype_ = Ref{PetscDataType}() + + @chk ccall( + (:PetscHDF5DataTypeToPetscDataType, $petsc_library), + PetscErrorCode, + (hid_t, Ptr{PetscDataType}), + htype, ptype_, + ) + + ptype = unsafe_string(ptype_[]) + + return ptype +end + +""" + PetscOpenSocket(petsclib::PetscLibType,hostname::Vector{Cchar}, portnum::Cint, t::Cint) +handles connected to an open port where someone is waiting. + +Input Parameters: +- `hostname` - for example www.mcs.anl.gov +- `portnum` - for example 80 + +Output Parameter: +- `t` - the socket number + +-seealso: `PetscSocketListen()`, `PetscSocketEstablish()`, `PetscHTTPRequest()`, `PetscHTTPSConnect()` + +# External Links +$(_doc_external("Sys/PetscOpenSocket")) +""" +function PetscOpenSocket(petsclib::PetscLibType, hostname::Vector{Cchar}, portnum::Cint, t::Cint) end + +@for_petsc function PetscOpenSocket(petsclib::$UnionPetscLib, hostname::Vector{Cchar}, portnum::Cint, t::Cint ) + + @chk ccall( + (:PetscOpenSocket, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cint, Ptr{Cint}), + hostname, portnum, t, + ) + + + return nothing +end + +""" + PetscBTView(petsclib::PetscLibType,m::PetscCount, bt::PetscBT, viewer::PetscViewer) + +# External Links +$(_doc_external("Sys/PetscBTView")) +""" +function PetscBTView(petsclib::PetscLibType, m::PetscCount, bt::PetscBT, viewer::PetscViewer) end + +@for_petsc function PetscBTView(petsclib::$UnionPetscLib, m::PetscCount, bt::PetscBT, viewer::PetscViewer ) + + @chk ccall( + (:PetscBTView, $petsc_library), + PetscErrorCode, + (PetscCount, PetscBT, PetscViewer), + m, bt, viewer, + ) + + + return nothing +end + +""" + PetscRegisterFinalize(petsclib::PetscLibType,f::external) +Registers a function that is to be called in `PetscFinalize()` + +Not Collective + +Input Parameter: +- `f` - function to be called + +Level: developer + +-seealso: `PetscRegisterFinalizeAll()`, `PetscObjectRegisterDestroy()` + +# External Links +$(_doc_external("Sys/PetscRegisterFinalize")) +""" +function PetscRegisterFinalize(petsclib::PetscLibType, f::external) end + +@for_petsc function PetscRegisterFinalize(petsclib::$UnionPetscLib, f::external ) + + @chk ccall( + (:PetscRegisterFinalize, $petsc_library), + PetscErrorCode, + (external,), + f, + ) + + + return nothing +end + +""" + PetscRegisterFinalizeAll(petsclib::PetscLibType) +Runs all the finalize functions set with `PetscRegisterFinalize()` + +Not Collective unless registered functions are collective + +Level: developer + +-seealso: `PetscRegisterFinalize()`, `PetscObjectRegisterDestroyAll()` + +# External Links +$(_doc_external("Sys/PetscRegisterFinalizeAll")) +""" +function PetscRegisterFinalizeAll(petsclib::PetscLibType) end + +@for_petsc function PetscRegisterFinalizeAll(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscRegisterFinalizeAll, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + has::PetscBool = PetscHasExternalPackage(petsclib::PetscLibType,pkg::Vector{Cchar}) +Determine whether PETSc has been configured with the given package + +Not Collective + +Input Parameter: +- `pkg` - external package name + +Output Parameter: +- `has` - `PETSC_TRUE` if PETSc is configured with the given package, else `PETSC_FALSE`. + +Level: intermediate + +-seealso: `PetscViewerType`, `MatPartitioningType`, `MatSolverType` + +# External Links +$(_doc_external("Sys/PetscHasExternalPackage")) +""" +function PetscHasExternalPackage(petsclib::PetscLibType, pkg::Vector{Cchar}) end + +@for_petsc function PetscHasExternalPackage(petsclib::$UnionPetscLib, pkg::Vector{Cchar} ) + has_ = Ref{PetscBool}() + + @chk ccall( + (:PetscHasExternalPackage, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscBool}), + pkg, has_, + ) + + has = has_[] + + return has +end + +""" + PetscInitializeNoPointers(petsclib::PetscLibType,argc::Cint, args::Cchar, filename::Vector{Cchar}, help::Vector{Cchar}) +Calls PetscInitialize() from C/C++ without the pointers to argc and args + +Collective, No Fortran Support + +Input Parameters: +- `argc` - number of args +- `args` - array of command line arguments +- `filename` - optional name of the program file, pass `NULL` to ignore +- `help` - optional help, pass `NULL` to ignore + +Level: advanced + +-seealso: `PetscInitialize()`, `PetscInitializeFortran()`, `PetscInitializeNoArguments()` +*/ +PetscErrorCode PetscInitializeNoPointers(int argc, char **args, const char *filename, const char *help) +{ +int myargc = argc; +char **myargs = args; + +PetscFunctionBegin; +PetscCall(PetscInitialize(&myargc, &myargs, filename, help)); +PetscCall(PetscPopSignalHandler()); +PetscBeganMPI = PETSC_FALSE; +PetscFunctionReturn(PETSC_SUCCESS); +} + +/*@C +PetscInitializeNoArguments - Calls `PetscInitialize()` from C/C++ without +the command line arguments. + +Collective + +Level: advanced + +-seealso: `PetscInitialize()`, `PetscInitializeFortran()` + +# External Links +$(_doc_external("Sys/PetscInitializeNoPointers")) +""" +function PetscInitializeNoPointers(petsclib::PetscLibType, argc::Cint, args::Cchar, filename::Vector{Cchar}, help::Vector{Cchar}) end + +@for_petsc function PetscInitializeNoPointers(petsclib::$UnionPetscLib, argc::Cint, args::Cchar, filename::Vector{Cchar}, help::Vector{Cchar} ) + + @chk ccall( + (:PetscInitializeNoPointers, $petsc_library), + PetscErrorCode, + (Cint, Cchar, Ptr{Cchar}, Ptr{Cchar}), + argc, args, filename, help, + ) + + + return nothing +end + +""" + PetscInitializeNoArguments(petsclib::PetscLibType) +Calls `PetscInitialize()` from C/C++ without +the command line arguments. + +Collective + +Level: advanced + +-seealso: `PetscInitialize()`, `PetscInitializeFortran()` + +# External Links +$(_doc_external("Sys/PetscInitializeNoArguments")) +""" +function PetscInitializeNoArguments(petsclib::PetscLibType) end + +@for_petsc function PetscInitializeNoArguments(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscInitializeNoArguments, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + isInitialized::PetscBool = PetscInitialized(petsclib::PetscLibType) +Determine whether PETSc is initialized. + +Output Parameter: +- `isInitialized` - `PETSC_TRUE` if PETSc is initialized, `PETSC_FALSE` otherwise + +Level: beginner + +-seealso: `PetscInitialize()`, `PetscInitializeNoArguments()`, `PetscInitializeFortran()` + +# External Links +$(_doc_external("Sys/PetscInitialized")) +""" +function PetscInitialized(petsclib::PetscLibType) end + +@for_petsc function PetscInitialized(petsclib::$UnionPetscLib) + isInitialized_ = Ref{PetscBool}() + + @chk ccall( + (:PetscInitialized, $petsc_library), + PetscErrorCode, + (Ptr{PetscBool},), + isInitialized_, + ) + + isInitialized = isInitialized_[] + + return isInitialized +end + +""" + isFinalized::PetscBool = PetscFinalized(petsclib::PetscLibType) +Determine whether `PetscFinalize()` has been called yet + +Output Parameter: +- `isFinalized` - `PETSC_TRUE` if PETSc is finalized, `PETSC_FALSE` otherwise + +Level: developer + +-seealso: `PetscInitialize()`, `PetscInitializeNoArguments()`, `PetscInitializeFortran()` + +# External Links +$(_doc_external("Sys/PetscFinalized")) +""" +function PetscFinalized(petsclib::PetscLibType) end + +@for_petsc function PetscFinalized(petsclib::$UnionPetscLib) + isFinalized_ = Ref{PetscBool}() + + @chk ccall( + (:PetscFinalized, $petsc_library), + PetscErrorCode, + (Ptr{PetscBool},), + isFinalized_, + ) + + isFinalized = isFinalized_[] + + return isFinalized +end + +""" + max::PetscInt,sum::PetscInt = PetscMaxSum(petsclib::PetscLibType,comm::MPI_Comm, array::Vector{PetscInt}) +Returns the max of the first entry over all MPI processes and the sum of the second entry. + +Collective + +Input Parameters: +- `comm` - the communicator +- `array` - an arry of length 2 times `size`, the number of MPI processes + +Output Parameters: +- `max` - the maximum of `array[2*rank]` over all MPI processes +- `sum` - the sum of the `array[2*rank + 1]` over all MPI processes + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscMaxSum")) +""" +function PetscMaxSum(petsclib::PetscLibType, comm::MPI_Comm, array::Vector{PetscInt}) end + +@for_petsc function PetscMaxSum(petsclib::$UnionPetscLib, comm::MPI_Comm, array::Vector{$PetscInt} ) + max_ = Ref{$PetscInt}() + sum_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscMaxSum, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + comm, array, max_, sum_, + ) + + max = max_[] + sum = sum_[] + + return max,sum +end + +""" + PetscSetProgramName(petsclib::PetscLibType,name::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscSetProgramName")) +""" +function PetscSetProgramName(petsclib::PetscLibType, name::Vector{Cchar}) end + +@for_petsc function PetscSetProgramName(petsclib::$UnionPetscLib, name::Vector{Cchar} ) + + @chk ccall( + (:PetscSetProgramName, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + name, + ) + + + return nothing +end + +""" + PetscGetProgramName(petsclib::PetscLibType,name::Vector{Cchar}, len::Csize_t) +Gets the name of the running program. + +Not Collective + +Input Parameter: +- `len` - length of the string name + +Output Parameter: +- `name` - the name of the running program, provide a string of length `PETSC_MAX_PATH_LEN` + +Level: advanced + +-seealso: `PetscFinalize()`, `PetscInitializeFortran()`, `PetscGetArguments()`, `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscGetProgramName")) +""" +function PetscGetProgramName(petsclib::PetscLibType, name::Vector{Cchar}, len::Csize_t) end + +@for_petsc function PetscGetProgramName(petsclib::$UnionPetscLib, name::Vector{Cchar}, len::Csize_t ) + + @chk ccall( + (:PetscGetProgramName, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Csize_t), + name, len, + ) + + + return nothing +end + +""" + PetscGetArgs(petsclib::PetscLibType,argc::Cint, args::Cchar) +Allows you to access the raw command line arguments anywhere +after `PetscInitialize()` is called but before `PetscFinalize()`. + +Not Collective, No Fortran Support + +Output Parameters: +- `argc` - count of the number of command line arguments +- `args` - the command line arguments + +Level: intermediate + +-seealso: `PetscFinalize()`, `PetscInitializeFortran()`, `PetscGetArguments()`, `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscGetArgs")) +""" +function PetscGetArgs(petsclib::PetscLibType, argc::Cint, args::Cchar) end + +@for_petsc function PetscGetArgs(petsclib::$UnionPetscLib, argc::Cint, args::Cchar ) + + @chk ccall( + (:PetscGetArgs, $petsc_library), + PetscErrorCode, + (Ptr{Cint}, Cchar), + argc, args, + ) + + + return nothing +end + +""" + PetscGetArguments(petsclib::PetscLibType,args::Cchar) +Allows you to access the command line arguments anywhere +after `PetscInitialize()` is called but before `PetscFinalize()`. + +Not Collective, No Fortran Support + +Output Parameter: +- `args` - the command line arguments + +Level: intermediate + +-seealso: `PetscFinalize()`, `PetscInitializeFortran()`, `PetscGetArgs()`, `PetscFreeArguments()`, `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscGetArguments")) +""" +function PetscGetArguments(petsclib::PetscLibType, args::Cchar) end + +@for_petsc function PetscGetArguments(petsclib::$UnionPetscLib, args::Cchar ) + + @chk ccall( + (:PetscGetArguments, $petsc_library), + PetscErrorCode, + (Cchar,), + args, + ) + + + return nothing +end + +""" + PetscFreeArguments(petsclib::PetscLibType,args::Cchar) +Frees the memory obtained with `PetscGetArguments()` + +Not Collective, No Fortran Support + +Output Parameter: +- `args` - the command line arguments + +Level: intermediate + +-seealso: `PetscFinalize()`, `PetscInitializeFortran()`, `PetscGetArgs()`, `PetscGetArguments()` + +# External Links +$(_doc_external("Sys/PetscFreeArguments")) +""" +function PetscFreeArguments(petsclib::PetscLibType, args::Cchar) end + +@for_petsc function PetscFreeArguments(petsclib::$UnionPetscLib, args::Cchar ) + + @chk ccall( + (:PetscFreeArguments, $petsc_library), + PetscErrorCode, + (Cchar,), + args, + ) + + + return nothing +end + +""" + PetscInitialize(petsclib::PetscLibType,argc::Cint, args::Cchar, file::Vector{Cchar}, help::Vector{Cchar}) +Initializes the PETSc database and MPI. +`PetscInitialize()` calls MPI_Init() if that has yet to be called, so this routine should always be called near the beginning of your program -- usually the very first line! + +Collective on `MPI_COMM_WORLD` or `PETSC_COMM_WORLD` if it has been set + +Input Parameters: +- `argc` - count of number of command line arguments +- `args` - the command line arguments +- `file` - [optional] PETSc database file, append ":yaml" to filename to specify YAML options format. Use `NULL` or empty string to not check for code specific file. Also checks `~/.petscrc`, `.petscrc` and `petscrc`. Use `-skip_petscrc` in the code specific file (or command line) to skip `~/.petscrc`, `.petscrc` and `petscrc` files. +- `help` - [optional] Help message to print, use `NULL` for no message + +If you wish PETSc code to run ONLY on a subcommunicator of `MPI_COMM_WORLD`, create that +communicator first and assign it to `PETSC_COMM_WORLD` BEFORE calling `PetscInitialize()`. +then do this. If ALL processes in the job are using `PetscInitialize()` and `PetscFinalize()` then you don't need to do this, even +if different subcommunicators of the job are doing different things with PETSc. + +Options Database Keys: +- `-help [intro]` - prints help method for each option; if `intro` is given the program stops after printing the introductory help message +- `-start_in_debugger [noxterm,dbx,xdb,gdb,...]` - Starts program in debugger +- `-on_error_attach_debugger [noxterm,dbx,xdb,gdb,...]` - Starts debugger when error detected +- `-on_error_emacs ` - causes `emacsclient` to jump to error file if an error is detected +- `-on_error_abort` - calls `abort()` when error detected (no traceback) +- `-on_error_mpiabort` - calls `MPI_abort()` when error detected +- `-error_output_stdout` - prints PETSc error messages to `stdout` instead of the default `stderr` +- `-error_output_none` - does not print the error messages (but handles errors in the same way as if this was not called) +- `-debugger_ranks [rank1,rank2,...]` - Indicates MPI ranks to start in debugger +- `-debugger_pause [sleeptime] (in seconds)` - Pauses debugger, use if it takes a long time for the debugger to start up on your system +- `-stop_for_debugger` - Print message on how to attach debugger manually to process and wait (`-debugger_pause`) seconds for attachment +- `-malloc_dump` - prints a list of all unfreed memory at the end of the run +- `-malloc_test` - like `-malloc_dump` `-malloc_debug`, only active for debugging build, ignored in optimized build. Often set in `PETSC_OPTIONS` environmental variable +- `-malloc_view` - show a list of all allocated memory during `PetscFinalize()` +- `-malloc_view_threshold ` - only list memory allocations of size greater than t with `-malloc_view` +- `-malloc_requested_size` - malloc logging will record the requested size rather than (possibly large) size after alignment +- `-fp_trap` - Stops on floating point exceptions +- `-no_signal_handler` - Indicates not to trap error signals +- `-shared_tmp` - indicates `/tmp` directory is known to be shared by all processors +- `-not_shared_tmp` - indicates each processor has own `/tmp` +- `-tmp` - alternative directory to use instead of `/tmp` +- `-python ` - Initializes Python, and optionally takes a Python executable name +- `-mpiuni-allow-multiprocess-launch` - allow `mpiexec` to launch multiple independent MPI-Uni jobs, otherwise a sanity check error is invoked to prevent misuse of MPI-Uni + +Options Database Keys for Option Database: +- `-skip_petscrc` - skip the default option files `~/.petscrc`, `.petscrc`, `petscrc` +- `-options_monitor` - monitor all set options to standard output for the whole program run +- `-options_monitor_cancel` - cancel options monitoring hard-wired using `PetscOptionsMonitorSet()` + +Options -options_monitor_{all,cancel} are +position-independent and apply to all options set since the PETSc start. +They can be used also in option files. + +See `PetscOptionsMonitorSet()` to do monitoring programmatically. + +Options Database Keys for Profiling: +See Users-Manual: ch_profiling for details. +- `-info [filename][:[~][:[~]self]]` - Prints verbose information. See `PetscInfo()`. +- `-log_sync` - Enable barrier synchronization for all events. This option is useful to debug imbalance within each event, however it slows things down and gives a distorted view of the overall runtime. +- `-log_trace [filename]` - Print traces of all PETSc calls to the screen (useful to determine where a program hangs without running in the debugger). See `PetscLogTraceBegin()`. +- `-log_view [:filename:format][,[:filename:format]...]` - Prints summary of flop and timing information to screen or file, see `PetscLogView()` (up to 4 viewers) +- `-log_view_memory` - Includes in the summary from -log_view the memory used in each event, see `PetscLogView()`. +- `-log_view_gpu_time` - Includes in the summary from -log_view the time used in each GPU kernel, see `PetscLogView(). +- `-log_exclude: ` - excludes subset of object classes from logging +- `-log [filename]` - Logs profiling information in a dump file, see `PetscLogDump()`. +- `-log_all [filename]` - Same as `-log`. +- `-log_mpe [filename]` - Creates a logfile viewable by the utility Jumpshot (in MPICH distribution) +- `-log_perfstubs` - Starts a log handler with the perfstubs interface (which is used by TAU) +- `-log_nvtx` - Starts an nvtx log handler for use with Nsight +- `-log_roctx` - Starts an roctx log handler for use with rocprof on AMD GPUs +- `-viewfromoptions on,off` - Enable or disable `XXXSetFromOptions()` calls, for applications with many small solves turn this off +- `-get_total_flops` - Returns total flops done by all processors +- `-memory_view` - Print memory usage at end of run +- `-check_pointer_intensity 0,1,2` - if pointers are checked for validity (debug version only), using 0 will result in faster code + +Options Database Keys for SAWs: +- `-saws_port ` - port number to publish SAWs data, default is 8080 +- `-saws_port_auto_select` - have SAWs select a new unique port number where it publishes the data, the URL is printed to the screen this is useful when you are running many jobs that utilize SAWs at the same time +- `-saws_log ` - save a log of all SAWs communication +- `-saws_https ` - have SAWs use HTTPS instead of HTTP +- `-saws_root ` - allow SAWs to have access to the given directory to search for requested resources and files + +Environmental Variables: +- `PETSC_TMP` - alternative directory to use instead of `/tmp` +- `PETSC_SHARED_TMP` - `/tmp` is shared by all processes +- `PETSC_NOT_SHARED_TMP` - each process has its own private `/tmp` +- `PETSC_OPTIONS` - a string containing additional options for PETSc in the form of command line "-key value" pairs +- `PETSC_OPTIONS_YAML` - (requires configuring PETSc to use libyaml with `--download-yaml`) a string containing additional options for PETSc in the form of a YAML document +- `PETSC_VIEWER_SOCKET_PORT` - socket number to use for socket viewer +- `PETSC_VIEWER_SOCKET_MACHINE` - machine to use for socket viewer to connect to + +Level: beginner + +-seealso: `PetscFinalize()`, `PetscInitializeFortran()`, `PetscGetArgs()`, `PetscInitializeNoArguments()`, `PetscLogGpuTime()` + +# External Links +$(_doc_external("Sys/PetscInitialize")) +""" +function PetscInitialize(petsclib::PetscLibType, argc::Ptr{Cint}, args::Ptr{Ptr{Cchar}}, file::Ptr{Cchar}, help::Ptr{Cchar}) end + +@for_petsc function PetscInitialize(petsclib::$UnionPetscLib, argc::Ptr{Cint}, args::Ptr{Ptr{Cchar}}, file::Ptr{Cchar}, help::Ptr{Cchar} ) + + @chk ccall( + (:PetscInitialize, $petsc_library), + PetscErrorCode, + (Ptr{Cint}, Ptr{Ptr{Cchar}}, Ptr{Cchar}, Ptr{Cchar}), + argc, args, file, help, + ) + + + return nothing +end + +""" + PetscFinalize(petsclib::PetscLibType) +Checks for options to be called at the conclusion of a PETSc program and frees any remaining PETSc objects and data structures. +of the program. Automatically calls `MPI_Finalize()` if the user had not called `MPI_Init()` before calling `PetscInitialize()`. + +Collective on `PETSC_COMM_WORLD` + +Options Database Keys: +- `-options_view` - Calls `PetscOptionsView()` +- `-options_left` - Prints unused options that remain in the database +- `-objects_dump [all]` - Prints list of objects allocated by the user that have not been freed, the option all cause all outstanding objects to be listed +- `-mpidump` - Calls PetscMPIDump() +- `-malloc_dump ` - Calls `PetscMallocDump()`, displays all memory allocated that has not been freed +- `-memory_view` - Prints total memory usage +- `-malloc_view ` - Prints list of all memory allocated and in what functions + +Level: beginner + +-seealso: `PetscInitialize()`, `PetscOptionsView()`, `PetscMallocDump()`, `PetscMPIDump()`, `PetscEnd()` + +# External Links +$(_doc_external("Sys/PetscFinalize")) +""" +function PetscFinalize(petsclib::PetscLibType) end + +@for_petsc function PetscFinalize(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscFinalize, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscEnd(petsclib::PetscLibType) +Calls `PetscFinalize()` and then ends the program. This is useful if one +wishes a clean exit somewhere deep in the program. + +Collective on `PETSC_COMM_WORLD` + +Level: advanced + +-seealso: `PetscInitialize()`, `PetscOptionsView()`, `PetscMallocDump()`, `PetscMPIDump()`, `PetscFinalize()` + +# External Links +$(_doc_external("Sys/PetscEnd")) +""" +function PetscEnd(petsclib::PetscLibType) end + +@for_petsc function PetscEnd(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscEnd, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscSetHelpVersionFunctions(petsclib::PetscLibType,help::external, version::external) +Sets functions that print help and version information +before the PETSc help and version information is printed. + +No Fortran Support + +Input Parameters: +- `help` - the help function (may be `NULL`) +- `version` - the version function (may be `NULL`) + +Level: developer + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscSetHelpVersionFunctions")) +""" +function PetscSetHelpVersionFunctions(petsclib::PetscLibType, help::external, version::external) end + +@for_petsc function PetscSetHelpVersionFunctions(petsclib::$UnionPetscLib, help::external, version::external ) + + @chk ccall( + (:PetscSetHelpVersionFunctions, $petsc_library), + PetscErrorCode, + (external, external), + help, version, + ) + + + return nothing +end + +""" + PetscInitializeFortran(petsclib::PetscLibType) +Routine that should be called soon AFTER +the call to `PetscInitialize()` if one is using a C main program +that calls Fortran routines that in turn call PETSc routines. + +Collective on `PETSC_COMM_WORLD` + +Level: beginner + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscInitializeFortran")) +""" +function PetscInitializeFortran(petsclib::PetscLibType) end + +@for_petsc function PetscInitializeFortran(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscInitializeFortran, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscCommGetNewTag(petsclib::PetscLibType,comm::MPI_Comm, tag::PetscMPIInt) +Gets a unique new tag from a PETSc communicator + +Collective + +Input Parameter: +- `comm` - the MPI communicator + +Output Parameter: +- `tag` - the new tag + +Level: developer + +-seealso: `PetscObjectGetNewTag()`, `PetscCommDuplicate()` + +# External Links +$(_doc_external("Sys/PetscCommGetNewTag")) +""" +function PetscCommGetNewTag(petsclib::PetscLibType, comm::MPI_Comm, tag::PetscMPIInt) end + +@for_petsc function PetscCommGetNewTag(petsclib::$UnionPetscLib, comm::MPI_Comm, tag::PetscMPIInt ) + + @chk ccall( + (:PetscCommGetNewTag, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscMPIInt}), + comm, tag, + ) + + + return nothing +end + +""" + PetscCommGetComm(petsclib::PetscLibType,comm_in::MPI_Comm, comm_out::MPI_Comm) +get a new MPI communicator from a PETSc communicator that can be passed off to another package + +Collective + +Input Parameter: +- `comm_in` - Input communicator + +Output Parameter: +- `comm_out` - Output communicator + +Level: developer + +-seealso: `PetscObjectGetNewTag()`, `PetscCommGetNewTag()`, `PetscCommDestroy()`, `PetscCommRestoreComm()` + +# External Links +$(_doc_external("Sys/PetscCommGetComm")) +""" +function PetscCommGetComm(petsclib::PetscLibType, comm_in::MPI_Comm, comm_out::MPI_Comm) end + +@for_petsc function PetscCommGetComm(petsclib::$UnionPetscLib, comm_in::MPI_Comm, comm_out::MPI_Comm ) + + @chk ccall( + (:PetscCommGetComm, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{MPI_Comm}), + comm_in, comm_out, + ) + + + return nothing +end + +""" + PetscCommRestoreComm(petsclib::PetscLibType,comm_in::MPI_Comm, comm_out::MPI_Comm) +restores an MPI communicator that was obtained with `PetscCommGetComm()` + +Collective + +Input Parameters: +- `comm_in` - Input communicator +- `comm_out` - returned communicator + +Level: developer + +-seealso: `PetscObjectGetNewTag()`, `PetscCommGetNewTag()`, `PetscCommDestroy()` + +# External Links +$(_doc_external("Sys/PetscCommRestoreComm")) +""" +function PetscCommRestoreComm(petsclib::PetscLibType, comm_in::MPI_Comm, comm_out::MPI_Comm) end + +@for_petsc function PetscCommRestoreComm(petsclib::$UnionPetscLib, comm_in::MPI_Comm, comm_out::MPI_Comm ) + + @chk ccall( + (:PetscCommRestoreComm, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{MPI_Comm}), + comm_in, comm_out, + ) + + + return nothing +end + +""" + comm_out::MPI_Comm,first_tag::PetscMPIInt = PetscCommDuplicate(petsclib::PetscLibType,comm_in::MPI_Comm) +Duplicates the communicator only if it is not already a PETSc communicator. + +Collective + +Input Parameter: +- `comm_in` - Input communicator + +Output Parameters: +- `comm_out` - Output communicator. May be `comm_in`. +- `first_tag` - Tag available that has not already been used with this communicator (you may pass in `NULL` if you do not need a tag) + +Level: developer + +-seealso: `PetscObjectGetNewTag()`, `PetscCommGetNewTag()`, `PetscCommDestroy()` + +# External Links +$(_doc_external("Sys/PetscCommDuplicate")) +""" +function PetscCommDuplicate(petsclib::PetscLibType, comm_in::MPI_Comm) end + +@for_petsc function PetscCommDuplicate(petsclib::$UnionPetscLib, comm_in::MPI_Comm ) + comm_out_ = Ref{MPI_Comm}() + first_tag_ = Ref{PetscMPIInt}() + + @chk ccall( + (:PetscCommDuplicate, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{MPI_Comm}, Ptr{PetscMPIInt}), + comm_in, comm_out_, first_tag_, + ) + + comm_out = comm_out_[] + first_tag = first_tag_[] + + return comm_out,first_tag +end + +""" + PetscCommDestroy(petsclib::PetscLibType,comm::MPI_Comm) +Frees communicator obtained with `PetscCommDuplicate()`. + +Collective + +Input Parameter: +- `comm` - the communicator to free + +Level: developer + +-seealso: `PetscCommDuplicate()` + +# External Links +$(_doc_external("Sys/PetscCommDestroy")) +""" +function PetscCommDestroy(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscCommDestroy(petsclib::$UnionPetscLib, comm::MPI_Comm ) + + @chk ccall( + (:PetscCommDestroy, $petsc_library), + PetscErrorCode, + (Ptr{MPI_Comm},), + comm, + ) + + + return nothing +end + +""" + PetscGetVersion(petsclib::PetscLibType,version::Vector{Cchar}, len::Csize_t) +Gets the PETSc version information in a string. + +Not Collective; No Fortran Support + +Input Parameter: +- `len` - length of the string + +Output Parameter: +- `version` - version string + +Level: developer + +-seealso: `PetscGetProgramName()`, `PetscGetVersionNumber()` + +# External Links +$(_doc_external("Sys/PetscGetVersion")) +""" +function PetscGetVersion(petsclib::PetscLibType, version::Vector{Cchar}, len::Csize_t) end + +@for_petsc function PetscGetVersion(petsclib::$UnionPetscLib, version::Vector{Cchar}, len::Csize_t ) + + @chk ccall( + (:PetscGetVersion, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Csize_t), + version, len, + ) + + + return nothing +end + +""" + major::PetscInt,minor::PetscInt,subminor::PetscInt,release::PetscInt = PetscGetVersionNumber(petsclib::PetscLibType) +Gets the PETSc version information from the library + +Not Collective + +Output Parameters: +- `major` - the major version (optional, pass `NULL` if not requested) +- `minor` - the minor version (optional, pass `NULL` if not requested) +- `subminor` - the subminor version (patch number) (optional, pass `NULL` if not requested) +- `release` - indicates the library is from a release, not random git repository (optional, pass `NULL` if not requested) + +Level: developer + +-seealso: `PetscGetProgramName()`, `PetscGetVersion()`, `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscGetVersionNumber")) +""" +function PetscGetVersionNumber(petsclib::PetscLibType) end + +@for_petsc function PetscGetVersionNumber(petsclib::$UnionPetscLib) + major_ = Ref{$PetscInt}() + minor_ = Ref{$PetscInt}() + subminor_ = Ref{$PetscInt}() + release_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscGetVersionNumber, $petsc_library), + PetscErrorCode, + (Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + major_, minor_, subminor_, release_, + ) + + major = major_[] + minor = minor_[] + subminor = subminor_[] + release = release_[] + + return major,minor,subminor,release +end + +""" + PetscBLASSetNumThreads(petsclib::PetscLibType,nt::PetscInt) +set the number of threads for calls to BLAS to use + +Input Parameter: +- `nt` - the number of threads + +Options Database Key: +- `-blas_num_threads ` - set the number of threads when PETSc is initialized + +Level: intermediate + +-seealso: `PetscInitialize()`, `PetscBLASGetNumThreads()` + +# External Links +$(_doc_external("Sys/PetscBLASSetNumThreads")) +""" +function PetscBLASSetNumThreads(petsclib::PetscLibType, nt::PetscInt) end + +@for_petsc function PetscBLASSetNumThreads(petsclib::$UnionPetscLib, nt::$PetscInt ) + + @chk ccall( + (:PetscBLASSetNumThreads, $petsc_library), + PetscErrorCode, + ($PetscInt,), + nt, + ) + + + return nothing +end + +""" + nt::PetscInt = PetscBLASGetNumThreads(petsclib::PetscLibType) +get the number of threads for calls to BLAS to use + +Output Parameter: +- `nt` - the number of threads + +Level: intermediate + +-seealso: `PetscInitialize()`, `PetscBLASSetNumThreads()` + +# External Links +$(_doc_external("Sys/PetscBLASGetNumThreads")) +""" +function PetscBLASGetNumThreads(petsclib::PetscLibType) end + +@for_petsc function PetscBLASGetNumThreads(petsclib::$UnionPetscLib) + nt_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscBLASGetNumThreads, $petsc_library), + PetscErrorCode, + (Ptr{$PetscInt},), + nt_, + ) + + nt = nt_[] + + return nt +end + +""" + size::Csize_t = PetscDataTypeGetSize(petsclib::PetscLibType,ptype::PetscDataType) +Gets the size (in bytes) of a PETSc datatype + +Not Collective + +Input Parameter: +- `ptype` - the PETSc datatype name (for example `PETSC_DOUBLE`) + +Output Parameter: +- `size` - the size in bytes (for example the size of `PETSC_DOUBLE` is 8) + +Level: advanced + +-seealso: `PetscDataType`, `PetscDataTypeToMPIDataType()` + +# External Links +$(_doc_external("Sys/PetscDataTypeGetSize")) +""" +function PetscDataTypeGetSize(petsclib::PetscLibType, ptype::PetscDataType) end + +@for_petsc function PetscDataTypeGetSize(petsclib::$UnionPetscLib, ptype::PetscDataType ) + size_ = Ref{Csize_t}() + + @chk ccall( + (:PetscDataTypeGetSize, $petsc_library), + PetscErrorCode, + (PetscDataType, Ptr{Csize_t}), + ptype, size_, + ) + + size = size_[] + + return size +end + +""" + ptype::PetscDataType,found::PetscBool = PetscDataTypeFromString(petsclib::PetscLibType,name::Vector{Cchar}) +Gets the enum value of a PETSc datatype represented as a string + +Not Collective + +Input Parameter: +- `name` - the PETSc datatype name (for example, "double" or "real") + +Output Parameters: +- `ptype` - the enum value, only valid if found is `PETSC_TRUE` +- `found` - the string matches one of the data types + +Level: advanced + +-seealso: `PetscDataType`, `PetscDataTypeToMPIDataType()`, `PetscDataTypeGetSize()` + +# External Links +$(_doc_external("Sys/PetscDataTypeFromString")) +""" +function PetscDataTypeFromString(petsclib::PetscLibType, name::Vector{Cchar}) end + +@for_petsc function PetscDataTypeFromString(petsclib::$UnionPetscLib, name::Vector{Cchar} ) + ptype_ = Ref{PetscDataType}() + found_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDataTypeFromString, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscDataType}, Ptr{PetscBool}), + name, ptype_, found_, + ) + + ptype = unsafe_string(ptype_[]) + found = found_[] + + return ptype,found +end + +""" + PetscKokkosInitializeCheck(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscKokkosInitializeCheck")) +""" +function PetscKokkosInitializeCheck(petsclib::PetscLibType) end + +@for_petsc function PetscKokkosInitializeCheck(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscKokkosInitializeCheck, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscElementalInitializePackage(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscElementalInitializePackage")) +""" +function PetscElementalInitializePackage(petsclib::PetscLibType) end + +@for_petsc function PetscElementalInitializePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscElementalInitializePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + isInitialized::PetscBool = PetscElementalInitialized(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscElementalInitialized")) +""" +function PetscElementalInitialized(petsclib::PetscLibType) end + +@for_petsc function PetscElementalInitialized(petsclib::$UnionPetscLib) + isInitialized_ = Ref{PetscBool}() + + @chk ccall( + (:PetscElementalInitialized, $petsc_library), + PetscErrorCode, + (Ptr{PetscBool},), + isInitialized_, + ) + + isInitialized = isInitialized_[] + + return isInitialized +end + +""" + PetscElementalFinalizePackage(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscElementalFinalizePackage")) +""" +function PetscElementalFinalizePackage(petsclib::PetscLibType) end + +@for_petsc function PetscElementalFinalizePackage(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscElementalFinalizePackage, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + type::PetscMemType = PetscGetMemType(petsclib::PetscLibType,ptr::Cvoid) +Query the `PetscMemType` of a pointer + +Not Collective, No Fortran Support + +Input Parameter: +- `ptr` - The pointer to query (may be `NULL`) + +Output Parameter: +- `type` - The `PetscMemType` of the pointer + +-seealso: `PetscMemType`, `PetscDeviceMalloc()`, `PetscDeviceCalloc()`, `PetscDeviceFree()`, +`PetscDeviceArrayCopy()`, `PetscDeviceArrayZero()` + +# External Links +$(_doc_external("Sys/PetscGetMemType")) +""" +function PetscGetMemType(petsclib::PetscLibType, ptr::Cvoid) end + +@for_petsc function PetscGetMemType(petsclib::$UnionPetscLib, ptr::Cvoid ) + type_ = Ref{PetscMemType}() + + @chk ccall( + (:PetscGetMemType, $petsc_library), + PetscErrorCode, + (Ptr{Cvoid}, Ptr{PetscMemType}), + ptr, type_, + ) + + type = unsafe_string(type_[]) + + return type +end + +""" + PetscTimSort(petsclib::PetscLibType,n::PetscInt, arr::Cvoid, size::Csize_t, cmp::external, ctx::Cvoid) +Sorts an array in place in increasing order using Tim Peters adaptive sorting algorithm. + +Not Collective, No Fortran Support + +Input Parameters: +- `n` - number of values +- `arr` - array to be sorted +- `size` - size in bytes of the datatype held in arr +- `cmp` - function pointer to comparison function +- `ctx` - optional context to be passed to comparison function, NULL if not needed + +Output Parameter: +- `arr` - sorted array + +Level: developer + +-seealso: `PetscTimSortWithArray()`, `PetscIntSortSemiOrdered()`, `PetscRealSortSemiOrdered()`, `PetscMPIIntSortSemiOrdered()` + +# External Links +$(_doc_external("Sys/PetscTimSort")) +""" +function PetscTimSort(petsclib::PetscLibType, n::PetscInt, arr::Cvoid, size::Csize_t, cmp::external, ctx::Cvoid) end + +@for_petsc function PetscTimSort(petsclib::$UnionPetscLib, n::$PetscInt, arr::Cvoid, size::Csize_t, cmp::external, ctx::Cvoid ) + + @chk ccall( + (:PetscTimSort, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Cvoid}, Csize_t, external, Ptr{Cvoid}), + n, arr, size, cmp, ctx, + ) + + + return nothing +end + +""" + PetscTimSortWithArray(petsclib::PetscLibType,n::PetscInt, arr::Cvoid, asize::Csize_t, barr::Cvoid, bsize::Csize_t, cmp::external, ctx::Cvoid) +Sorts an array in place in increasing order using Tim Peters adaptive sorting algorithm and +reorders a second array to match the first. The arrays need not be the same type. + +Not Collective, No Fortran Support + +Input Parameters: +- `n` - number of values +- `asize` - size in bytes of the datatype held in arr +- `bsize` - size in bytes of the datatype held in barr +- `cmp` - function pointer to comparison function +- `ctx` - optional context to be passed to comparison function, NULL if not needed + +Input/Output Parameters: +- `arr` - array to be sorted, on output it is sorted +- `barr` - array to be reordered, on output it is reordered + +Level: developer + +-seealso: `PetscTimSort()`, `PetscIntSortSemiOrderedWithArray()`, `PetscRealSortSemiOrderedWithArrayInt()`, `PetscMPIIntSortSemiOrderedWithArray()` + +# External Links +$(_doc_external("Sys/PetscTimSortWithArray")) +""" +function PetscTimSortWithArray(petsclib::PetscLibType, n::PetscInt, arr::Cvoid, asize::Csize_t, barr::Cvoid, bsize::Csize_t, cmp::external, ctx::Cvoid) end + +@for_petsc function PetscTimSortWithArray(petsclib::$UnionPetscLib, n::$PetscInt, arr::Cvoid, asize::Csize_t, barr::Cvoid, bsize::Csize_t, cmp::external, ctx::Cvoid ) + + @chk ccall( + (:PetscTimSortWithArray, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Cvoid}, Csize_t, Ptr{Cvoid}, Csize_t, external, Ptr{Cvoid}), + n, arr, asize, barr, bsize, cmp, ctx, + ) + + + return nothing +end + +""" + PetscIntSortSemiOrdered(petsclib::PetscLibType,n::PetscInt, arr::Vector{PetscInt}) +Sorts an array of `PetscInt` in place in increasing order. + +Not Collective + +Input Parameters: +- `n` - number of values +- `arr` - array of integers + +Output Parameter: +- `arr` - sorted array of integers + +Level: intermediate + +-seealso: `PetscTimSort()`, `PetscSortInt()`, `PetscSortIntWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscIntSortSemiOrdered")) +""" +function PetscIntSortSemiOrdered(petsclib::PetscLibType, n::PetscInt, arr::Vector{PetscInt}) end + +@for_petsc function PetscIntSortSemiOrdered(petsclib::$UnionPetscLib, n::$PetscInt, arr::Vector{$PetscInt} ) + + @chk ccall( + (:PetscIntSortSemiOrdered, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscInt}), + n, arr, + ) + + + return nothing +end + +""" + PetscIntSortSemiOrderedWithArray(petsclib::PetscLibType,n::PetscInt, arr1::Vector{PetscInt}, arr2::Vector{PetscInt}) +Sorts an array of `PetscInt` in place in increasing order and reorders a second +`PetscInt` array to match the first. + +Not Collective + +Input Parameter: +- `n` - number of values + +Input/Output Parameters: +- `arr1` - array of integers to be sorted, modified on output +- `arr2` - array of integers to be reordered, modified on output + +Level: intermediate + +-seealso: `PetscTimSortWithArray()`, `PetscSortIntWithArray()`, `PetscSortIntWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscIntSortSemiOrderedWithArray")) +""" +function PetscIntSortSemiOrderedWithArray(petsclib::PetscLibType, n::PetscInt, arr1::Vector{PetscInt}, arr2::Vector{PetscInt}) end + +@for_petsc function PetscIntSortSemiOrderedWithArray(petsclib::$UnionPetscLib, n::$PetscInt, arr1::Vector{$PetscInt}, arr2::Vector{$PetscInt} ) + + @chk ccall( + (:PetscIntSortSemiOrderedWithArray, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + n, arr1, arr2, + ) + + + return nothing +end + +""" + PetscMPIIntSortSemiOrdered(petsclib::PetscLibType,n::PetscInt, arr::Vector{PetscMPIInt}) +Sorts an array of `PetscMPIInt` in place in increasing order. + +Not Collective + +Input Parameters: +- `n` - number of values +- `arr` - array of `PetscMPIInt` + +Output Parameter: +- `arr` - sorted array of integers + +Level: intermediate + +-seealso: `PetscTimSort()`, `PetscSortMPIInt()` + +# External Links +$(_doc_external("Sys/PetscMPIIntSortSemiOrdered")) +""" +function PetscMPIIntSortSemiOrdered(petsclib::PetscLibType, n::PetscInt, arr::Vector{PetscMPIInt}) end + +@for_petsc function PetscMPIIntSortSemiOrdered(petsclib::$UnionPetscLib, n::$PetscInt, arr::Vector{PetscMPIInt} ) + + @chk ccall( + (:PetscMPIIntSortSemiOrdered, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{PetscMPIInt}), + n, arr, + ) + + + return nothing +end + +""" + PetscMPIIntSortSemiOrderedWithArray(petsclib::PetscLibType,n::PetscInt, arr1::Vector{PetscMPIInt}, arr2::Vector{PetscMPIInt}) +Sorts an array of `PetscMPIInt` in place in increasing order and reorders a second `PetscMPIInt` +array to match the first. + +Not Collective + +Input Parameter: +- `n` - number of values + +Input/Output Parameters: +- `arr1` - array of integers to be sorted, modified on output +- `arr2` - array of integers to be reordered, modified on output + +Level: intermediate + +-seealso: `PetscTimSortWithArray()`, `PetscSortMPIIntWithArray()`, `PetscSortMPIIntWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscMPIIntSortSemiOrderedWithArray")) +""" +function PetscMPIIntSortSemiOrderedWithArray(petsclib::PetscLibType, n::PetscInt, arr1::Vector{PetscMPIInt}, arr2::Vector{PetscMPIInt}) end + +@for_petsc function PetscMPIIntSortSemiOrderedWithArray(petsclib::$UnionPetscLib, n::$PetscInt, arr1::Vector{PetscMPIInt}, arr2::Vector{PetscMPIInt} ) + + @chk ccall( + (:PetscMPIIntSortSemiOrderedWithArray, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{PetscMPIInt}, Ptr{PetscMPIInt}), + n, arr1, arr2, + ) + + + return nothing +end + +""" + PetscRealSortSemiOrdered(petsclib::PetscLibType,n::PetscInt, arr::Vector{PetscReal}) +Sorts an array of `PetscReal` in place in increasing order. + +Not Collective + +Input Parameters: +- `n` - number of values +- `arr` - array of `PetscReal` + +Output Parameter: +- `arr` - sorted array of integers + +Level: intermediate + +-seealso: `PetscTimSort()`, `PetscSortReal()`, `PetscSortRealWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscRealSortSemiOrdered")) +""" +function PetscRealSortSemiOrdered(petsclib::PetscLibType, n::PetscInt, arr::Vector{PetscReal}) end + +@for_petsc function PetscRealSortSemiOrdered(petsclib::$UnionPetscLib, n::$PetscInt, arr::Vector{$PetscReal} ) + + @chk ccall( + (:PetscRealSortSemiOrdered, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}), + n, arr, + ) + + + return nothing +end + +""" + PetscRealSortSemiOrderedWithArrayInt(petsclib::PetscLibType,n::PetscInt, arr1::Vector{PetscReal}, arr2::Vector{PetscInt}) +Sorts an array of `PetscReal` in place in increasing order and reorders a second +array of `PetscInt` to match the first. + +Not Collective + +Input Parameter: +- `n` - number of values + +Input/Output Parameters: +- `arr1` - array of `PetscReal` to be sorted, modified on output +- `arr2` - array of `PetscInt` to be reordered, modified on output + +Level: intermediate + +-seealso: `PetscTimSortWithArray()`, `PetscSortRealWithArrayInt()`, `PetscSortRealWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscRealSortSemiOrderedWithArrayInt")) +""" +function PetscRealSortSemiOrderedWithArrayInt(petsclib::PetscLibType, n::PetscInt, arr1::Vector{PetscReal}, arr2::Vector{PetscInt}) end + +@for_petsc function PetscRealSortSemiOrderedWithArrayInt(petsclib::$UnionPetscLib, n::$PetscInt, arr1::Vector{$PetscReal}, arr2::Vector{$PetscInt} ) + + @chk ccall( + (:PetscRealSortSemiOrderedWithArrayInt, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscInt}), + n, arr1, arr2, + ) + + + return nothing +end + +""" + slope::PetscReal,intercept::PetscReal = PetscLinearRegression(petsclib::PetscLibType,n::PetscInt, x::Vector{PetscReal}, y::Vector{PetscReal}) +Gives the best least + +Input Parameters: +- `n` - The number of points +- `x` - The x-values +- `y` - The y-values + +Output Parameters: +- `slope` - The slope of the best-fit line +- `intercept` - The y-intercept of the best-fit line + +Level: intermediate + +-seealso: `PetscConvEstGetConvRate()` + +# External Links +$(_doc_external("Sys/PetscLinearRegression")) +""" +function PetscLinearRegression(petsclib::PetscLibType, n::PetscInt, x::Vector{PetscReal}, y::Vector{PetscReal}) end + +@for_petsc function PetscLinearRegression(petsclib::$UnionPetscLib, n::$PetscInt, x::Vector{$PetscReal}, y::Vector{$PetscReal} ) + slope_ = Ref{$PetscReal}() + intercept_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscLinearRegression, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + n, x, y, slope_, intercept_, + ) + + slope = slope_[] + intercept = intercept_[] + + return slope,intercept +end + +""" + sorted::PetscBool = PetscSortedInt(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}) +Determines whether the `PetscInt` array is sorted. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt` + +Output Parameter: +- `sorted` - flag whether the array is sorted + +Level: intermediate + +-seealso: `PetscSortInt()`, `PetscSortedMPIInt()`, `PetscSortedReal()` + +# External Links +$(_doc_external("Sys/PetscSortedInt")) +""" +function PetscSortedInt(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}) end + +@for_petsc function PetscSortedInt(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt} ) + sorted_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSortedInt, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}, Ptr{PetscBool}), + n, X, sorted_, + ) + + sorted = sorted_[] + + return sorted +end + +""" + sorted::PetscBool = PetscSortedInt64(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt64}) +Determines whether the `PetscInt64` array is sorted. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt64` + +Output Parameter: +- `sorted` - flag whether the array is sorted + +Level: intermediate + +-seealso: `PetscSortInt64()`, `PetscSortInt()`, `PetscSortedMPIInt()`, `PetscSortedReal()` + +# External Links +$(_doc_external("Sys/PetscSortedInt64")) +""" +function PetscSortedInt64(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt64}) end + +@for_petsc function PetscSortedInt64(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt64} ) + sorted_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSortedInt64, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt64}, Ptr{PetscBool}), + n, X, sorted_, + ) + + sorted = sorted_[] + + return sorted +end + +""" + PetscSortInt(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}) +Sorts an array of `PetscInt` in place in increasing order. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt` + +-seealso: `PetscIntSortSemiOrdered()`, `PetscSortReal()`, `PetscSortIntWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscSortInt")) +""" +function PetscSortInt(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}) end + +@for_petsc function PetscSortInt(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortInt, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}), + n, X, + ) + + + return nothing +end + +""" + PetscSortInt64(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt64}) +Sorts an array of `PetscInt64` in place in increasing order. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt64` + +-seealso: `PetscSortInt()` + +# External Links +$(_doc_external("Sys/PetscSortInt64")) +""" +function PetscSortInt64(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt64}) end + +@for_petsc function PetscSortInt64(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt64} ) + + @chk ccall( + (:PetscSortInt64, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt64}), + n, X, + ) + + + return nothing +end + +""" + PetscSortCount(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscCount}) +Sorts an array of `PetscCount` in place in increasing order. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscCount` + +-seealso: `PetscSortInt()` + +# External Links +$(_doc_external("Sys/PetscSortCount")) +""" +function PetscSortCount(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscCount}) end + +@for_petsc function PetscSortCount(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{PetscCount} ) + + @chk ccall( + (:PetscSortCount, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{PetscCount}), + n, X, + ) + + + return nothing +end + +""" + PetscSortReverseInt(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}) +Sorts an array of `PetscInt` in place in decreasing order. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt` + +Level: intermediate + +-seealso: `PetscIntSortSemiOrdered()`, `PetscSortInt()`, `PetscSortIntWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscSortReverseInt")) +""" +function PetscSortReverseInt(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}) end + +@for_petsc function PetscSortReverseInt(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortReverseInt, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}), + n, X, + ) + + + return nothing +end + +""" + PetscSortedRemoveDupsInt(petsclib::PetscLibType,n::PetscInt, X::Vector{PetscInt}) +Removes all duplicate entries of a sorted `PetscInt` array + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - sorted array of `PetscInt` + +Output Parameter: +- `n` - number of non-redundant values + +Level: intermediate + +-seealso: `PetscSortInt()` + +# External Links +$(_doc_external("Sys/PetscSortedRemoveDupsInt")) +""" +function PetscSortedRemoveDupsInt(petsclib::PetscLibType, n::PetscInt, X::Vector{PetscInt}) end + +@for_petsc function PetscSortedRemoveDupsInt(petsclib::$UnionPetscLib, n::$PetscInt, X::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortedRemoveDupsInt, $petsc_library), + PetscErrorCode, + (Ptr{$PetscInt}, Ptr{$PetscInt}), + n, X, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscSortedCheckDupsInt(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}) +Checks if a sorted `PetscInt` array has duplicates + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - sorted array of `PetscInt` + +Output Parameter: +- `flg` - True if the array has duplications, otherwise false + +Level: intermediate + +-seealso: `PetscSortInt()`, `PetscCheckDupsInt()`, `PetscSortRemoveDupsInt()`, `PetscSortedRemoveDupsInt()` + +# External Links +$(_doc_external("Sys/PetscSortedCheckDupsInt")) +""" +function PetscSortedCheckDupsInt(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}) end + +@for_petsc function PetscSortedCheckDupsInt(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt} ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSortedCheckDupsInt, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}, Ptr{PetscBool}), + n, X, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = PetscSortedCheckDupsCount(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscCount}) +Checks if a sorted `PetscCount` array has duplicates + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - sorted array of `PetscCount` + +Output Parameter: +- `flg` - True if the array has duplications, otherwise false + +Level: intermediate + +-seealso: `PetscCount`, `PetscSortCount()`, `PetscSortedCheckDupsInt()` + +# External Links +$(_doc_external("Sys/PetscSortedCheckDupsCount")) +""" +function PetscSortedCheckDupsCount(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscCount}) end + +@for_petsc function PetscSortedCheckDupsCount(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{PetscCount} ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSortedCheckDupsCount, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{PetscCount}, Ptr{PetscBool}), + n, X, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscSortRemoveDupsInt(petsclib::PetscLibType,n::PetscInt, X::Vector{PetscInt}) +Sorts an array of `PetscInt` in place in increasing order removes all duplicate entries + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt` + +Output Parameter: +- `n` - number of non-redundant values + +Level: intermediate + +-seealso: `PetscIntSortSemiOrdered()`, `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortedRemoveDupsInt()` + +# External Links +$(_doc_external("Sys/PetscSortRemoveDupsInt")) +""" +function PetscSortRemoveDupsInt(petsclib::PetscLibType, n::PetscInt, X::Vector{PetscInt}) end + +@for_petsc function PetscSortRemoveDupsInt(petsclib::$UnionPetscLib, n::$PetscInt, X::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortRemoveDupsInt, $petsc_library), + PetscErrorCode, + (Ptr{$PetscInt}, Ptr{$PetscInt}), + n, X, + ) + + + return nothing +end + +""" + loc::PetscInt = PetscFindInt(petsclib::PetscLibType,key::PetscInt, n::PetscCount, X::Vector{PetscInt}) +Finds the location of a `PetscInt` key in a sorted array of `PetscInt` + +Not Collective + +Input Parameters: +- `key` - the `PetscInt` key to locate +- `n` - number of values in the array +- `X` - array of `PetscInt` + +Output Parameter: +- `loc` - the location if found, otherwise -(slot+1) where slot is the place the value would go + +Level: intermediate + +-seealso: `PetscIntSortSemiOrdered()`, `PetscSortInt()`, `PetscSortIntWithArray()`, `PetscSortRemoveDupsInt()` + +# External Links +$(_doc_external("Sys/PetscFindInt")) +""" +function PetscFindInt(petsclib::PetscLibType, key::PetscInt, n::PetscCount, X::Vector{PetscInt}) end + +@for_petsc function PetscFindInt(petsclib::$UnionPetscLib, key::$PetscInt, n::PetscCount, X::Vector{$PetscInt} ) + loc_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscFindInt, $petsc_library), + PetscErrorCode, + ($PetscInt, PetscCount, Ptr{$PetscInt}, Ptr{$PetscInt}), + key, n, X, loc_, + ) + + loc = loc_[] + + return loc +end + +""" + PetscFindCount(petsclib::PetscLibType,key::PetscCount, n::PetscCount, X::Vector{PetscCount}, loc::PetscCount) +Finds the location of a `PetscCount` key in a sorted array of `PetscCount` + +Not Collective + +Input Parameters: +- `key` - the `PetscCount` key to locate +- `n` - number of values in the array +- `X` - array of `PetscCount` + +Output Parameter: +- `loc` - the location if found, otherwise -(slot+1) where slot is the place the value would go + +Level: intermediate + +-seealso: `PetscCount`, `PetscSortCount()` + +# External Links +$(_doc_external("Sys/PetscFindCount")) +""" +function PetscFindCount(petsclib::PetscLibType, key::PetscCount, n::PetscCount, X::Vector{PetscCount}, loc::PetscCount) end + +@for_petsc function PetscFindCount(petsclib::$UnionPetscLib, key::PetscCount, n::PetscCount, X::Vector{PetscCount}, loc::PetscCount ) + + @chk ccall( + (:PetscFindCount, $petsc_library), + PetscErrorCode, + (PetscCount, PetscCount, Ptr{PetscCount}, Ptr{PetscCount}), + key, n, X, loc, + ) + + + return nothing +end + +""" + dups::PetscBool = PetscCheckDupsInt(petsclib::PetscLibType,n::PetscInt, X::Vector{PetscInt}) +Checks if an `PetscInt` array has duplicates + +Not Collective + +Input Parameters: +- `n` - number of values in the array +- `X` - array of `PetscInt` + +Output Parameter: +- `dups` - True if the array has dups, otherwise false + +Level: intermediate + +-seealso: `PetscSortRemoveDupsInt()`, `PetscSortedCheckDupsInt()` + +# External Links +$(_doc_external("Sys/PetscCheckDupsInt")) +""" +function PetscCheckDupsInt(petsclib::PetscLibType, n::PetscInt, X::Vector{PetscInt}) end + +@for_petsc function PetscCheckDupsInt(petsclib::$UnionPetscLib, n::$PetscInt, X::Vector{$PetscInt} ) + dups_ = Ref{PetscBool}() + + @chk ccall( + (:PetscCheckDupsInt, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscInt}, Ptr{PetscBool}), + n, X, dups_, + ) + + dups = dups_[] + + return dups +end + +""" + loc::PetscInt = PetscFindMPIInt(petsclib::PetscLibType,key::PetscMPIInt, n::PetscCount, X::Vector{PetscMPIInt}) +Finds `PetscMPIInt` in a sorted array of `PetscMPIInt` + +Not Collective + +Input Parameters: +- `key` - the integer to locate +- `n` - number of values in the array +- `X` - array of `PetscMPIInt` + +Output Parameter: +- `loc` - the location if found, otherwise -(slot+1) where slot is the place the value would go + +Level: intermediate + +-seealso: `PetscMPIIntSortSemiOrdered()`, `PetscSortInt()`, `PetscSortIntWithArray()`, `PetscSortRemoveDupsInt()` + +# External Links +$(_doc_external("Sys/PetscFindMPIInt")) +""" +function PetscFindMPIInt(petsclib::PetscLibType, key::PetscMPIInt, n::PetscCount, X::Vector{PetscMPIInt}) end + +@for_petsc function PetscFindMPIInt(petsclib::$UnionPetscLib, key::PetscMPIInt, n::PetscCount, X::Vector{PetscMPIInt} ) + loc_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscFindMPIInt, $petsc_library), + PetscErrorCode, + (PetscMPIInt, PetscCount, Ptr{PetscMPIInt}, Ptr{$PetscInt}), + key, n, X, loc_, + ) + + loc = loc_[] + + return loc +end + +""" + PetscSortIntWithArray(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscInt}) +Sorts an array of `PetscInt` in place in increasing order; +changes a second array of `PetscInt` to match the sorted first array. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt` +- `Y` - second array of `PetscInt` + +Level: intermediate + +-seealso: `PetscIntSortSemiOrderedWithArray()`, `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortIntWithCountArray()` + +# External Links +$(_doc_external("Sys/PetscSortIntWithArray")) +""" +function PetscSortIntWithArray(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscInt}) end + +@for_petsc function PetscSortIntWithArray(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt}, Y::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortIntWithArray, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}, Ptr{$PetscInt}), + n, X, Y, + ) + + + return nothing +end + +""" + PetscSortIntWithArrayPair(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscInt}, Z::Vector{PetscInt}) +Sorts an array of `PetscInt` in place in increasing order; +changes a pair of `PetscInt` arrays to match the sorted first array. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PestcInt` +- `Y` - second array of `PestcInt` (first array of the pair) +- `Z` - third array of `PestcInt` (second array of the pair) + +Level: intermediate + +-seealso: `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortIntWithArray()`, `PetscIntSortSemiOrdered()`, `PetscSortIntWithIntCountArrayPair()` + +# External Links +$(_doc_external("Sys/PetscSortIntWithArrayPair")) +""" +function PetscSortIntWithArrayPair(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscInt}, Z::Vector{PetscInt}) end + +@for_petsc function PetscSortIntWithArrayPair(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt}, Y::Vector{$PetscInt}, Z::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortIntWithArrayPair, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}), + n, X, Y, Z, + ) + + + return nothing +end + +""" + PetscSortIntWithMPIIntArray(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscMPIInt}) +Sorts an array of `PetscInt` in place in increasing order; +changes a second array of `PetscMPI` to match the sorted first array. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt` +- `Y` - second array of `PetscMPIInt` + +Level: intermediate + +-seealso: `PetscIntSortSemiOrderedWithArray()`, `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortIntWithArray()` + +# External Links +$(_doc_external("Sys/PetscSortIntWithMPIIntArray")) +""" +function PetscSortIntWithMPIIntArray(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscMPIInt}) end + +@for_petsc function PetscSortIntWithMPIIntArray(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt}, Y::Vector{PetscMPIInt} ) + + @chk ccall( + (:PetscSortIntWithMPIIntArray, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}, Ptr{PetscMPIInt}), + n, X, Y, + ) + + + return nothing +end + +""" + PetscSortIntWithCountArray(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscCount}) +Sorts an array of `PetscInt` in place in increasing order; +changes a second array of `PetscCount` to match the sorted first array. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt` +- `Y` - second array of `PetscCount` + +Level: intermediate + +-seealso: `PetscIntSortSemiOrderedWithArray()`, `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortIntWithArray()` + +# External Links +$(_doc_external("Sys/PetscSortIntWithCountArray")) +""" +function PetscSortIntWithCountArray(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscCount}) end + +@for_petsc function PetscSortIntWithCountArray(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt}, Y::Vector{PetscCount} ) + + @chk ccall( + (:PetscSortIntWithCountArray, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}, Ptr{PetscCount}), + n, X, Y, + ) + + + return nothing +end + +""" + PetscSortIntWithIntCountArrayPair(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscInt}, Z::Vector{PetscCount}) +Sorts an array of `PetscInt` in place in increasing order; +changes a `PetscInt` array and a `PetscCount` array to match the sorted first array. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt` +- `Y` - second array of `PetscInt` (first array of the pair) +- `Z` - third array of `PetscCount` (second array of the pair) + +Level: intermediate + +-seealso: `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortIntWithArray()`, `PetscIntSortSemiOrdered()`, `PetscSortIntWithArrayPair()` + +# External Links +$(_doc_external("Sys/PetscSortIntWithIntCountArrayPair")) +""" +function PetscSortIntWithIntCountArrayPair(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscInt}, Z::Vector{PetscCount}) end + +@for_petsc function PetscSortIntWithIntCountArrayPair(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt}, Y::Vector{$PetscInt}, Z::Vector{PetscCount} ) + + @chk ccall( + (:PetscSortIntWithIntCountArrayPair, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{PetscCount}), + n, X, Y, Z, + ) + + + return nothing +end + +""" + sorted::PetscBool = PetscSortedMPIInt(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscMPIInt}) +Determines whether the `PetscMPIInt` array is sorted. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscMPIInt` + +Output Parameter: +- `sorted` - flag whether the array is sorted + +Level: intermediate + +-seealso: `PetscMPIIntSortSemiOrdered()`, `PetscSortMPIInt()`, `PetscSortedInt()`, `PetscSortedReal()` + +# External Links +$(_doc_external("Sys/PetscSortedMPIInt")) +""" +function PetscSortedMPIInt(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscMPIInt}) end + +@for_petsc function PetscSortedMPIInt(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{PetscMPIInt} ) + sorted_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSortedMPIInt, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{PetscMPIInt}, Ptr{PetscBool}), + n, X, sorted_, + ) + + sorted = sorted_[] + + return sorted +end + +""" + PetscSortMPIInt(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscMPIInt}) +Sorts an array of `PetscMPIInt` in place in increasing order. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscMPIInt` + +Level: intermediate + +-seealso: `PetscMPIIntSortSemiOrdered()`, `PetscSortReal()`, `PetscSortIntWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscSortMPIInt")) +""" +function PetscSortMPIInt(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscMPIInt}) end + +@for_petsc function PetscSortMPIInt(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{PetscMPIInt} ) + + @chk ccall( + (:PetscSortMPIInt, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{PetscMPIInt}), + n, X, + ) + + + return nothing +end + +""" + PetscSortRemoveDupsMPIInt(petsclib::PetscLibType,n::PetscInt, X::Vector{PetscMPIInt}) +Sorts an array of `PetscMPIInt` in place in increasing order removes all duplicate entries + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscMPIInt` + +Output Parameter: +- `n` - number of non-redundant values + +Level: intermediate + +-seealso: `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()` + +# External Links +$(_doc_external("Sys/PetscSortRemoveDupsMPIInt")) +""" +function PetscSortRemoveDupsMPIInt(petsclib::PetscLibType, n::PetscInt, X::Vector{PetscMPIInt}) end + +@for_petsc function PetscSortRemoveDupsMPIInt(petsclib::$UnionPetscLib, n::$PetscInt, X::Vector{PetscMPIInt} ) + + @chk ccall( + (:PetscSortRemoveDupsMPIInt, $petsc_library), + PetscErrorCode, + (Ptr{$PetscInt}, Ptr{PetscMPIInt}), + n, X, + ) + + + return nothing +end + +""" + PetscSortMPIIntWithArray(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscMPIInt}, Y::Vector{PetscMPIInt}) +Sorts an array of `PetscMPIInt` in place in increasing order; +changes a second `PetscMPIInt` array to match the sorted first array. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscMPIInt` +- `Y` - second array of `PetscMPIInt` + +Level: intermediate + +-seealso: `PetscMPIIntSortSemiOrderedWithArray()`, `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()` + +# External Links +$(_doc_external("Sys/PetscSortMPIIntWithArray")) +""" +function PetscSortMPIIntWithArray(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscMPIInt}, Y::Vector{PetscMPIInt}) end + +@for_petsc function PetscSortMPIIntWithArray(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{PetscMPIInt}, Y::Vector{PetscMPIInt} ) + + @chk ccall( + (:PetscSortMPIIntWithArray, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{PetscMPIInt}, Ptr{PetscMPIInt}), + n, X, Y, + ) + + + return nothing +end + +""" + PetscSortMPIIntWithIntArray(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscMPIInt}, Y::Vector{PetscInt}) +Sorts an array of `PetscMPIInt` in place in increasing order; +changes a second array of `PetscInt` to match the sorted first array. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscMPIInt` +- `Y` - second array of `PetscInt` + +Level: intermediate + +-seealso: `PetscSortMPIIntWithArray()`, `PetscIntSortSemiOrderedWithArray()`, `PetscTimSortWithArray()` + +# External Links +$(_doc_external("Sys/PetscSortMPIIntWithIntArray")) +""" +function PetscSortMPIIntWithIntArray(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscMPIInt}, Y::Vector{PetscInt}) end + +@for_petsc function PetscSortMPIIntWithIntArray(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{PetscMPIInt}, Y::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortMPIIntWithIntArray, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{PetscMPIInt}, Ptr{$PetscInt}), + n, X, Y, + ) + + + return nothing +end + +""" + PetscSortIntWithScalarArray(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscScalar}) +Sorts an array of `PetscInt` in place in increasing order; +changes a second `PetscScalar` array to match the sorted first array. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt` +- `Y` - second array of `PetscScalar` + +Level: intermediate + +-seealso: `PetscTimSortWithArray()`, `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortIntWithArray()` + +# External Links +$(_doc_external("Sys/PetscSortIntWithScalarArray")) +""" +function PetscSortIntWithScalarArray(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}, Y::Vector{PetscScalar}) end + +@for_petsc function PetscSortIntWithScalarArray(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt}, Y::Vector{$PetscScalar} ) + + @chk ccall( + (:PetscSortIntWithScalarArray, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}, Ptr{$PetscScalar}), + n, X, Y, + ) + + + return nothing +end + +""" + PetscSortIntWithDataArray(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscInt}, Y::Cvoid, size::Csize_t, t2::Cvoid) +Sorts an array of `PetscInt` in place in increasing order; +changes a second array to match the sorted first INTEGER array. Unlike other sort routines, the user must +provide workspace (the size of an element in the data array) to use when sorting. + +Not Collective, No Fortran Support + +Input Parameters: +- `n` - number of values +- `X` - array of `PetscInt` +- `Y` - second array of data +- `size` - sizeof elements in the data array in bytes +- `t2` - workspace of "size" bytes used when sorting + +Level: intermediate + +-seealso: `PetscTimSortWithArray()`, `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortIntWithArray()` + +# External Links +$(_doc_external("Sys/PetscSortIntWithDataArray")) +""" +function PetscSortIntWithDataArray(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscInt}, Y::Cvoid, size::Csize_t, t2::Cvoid) end + +@for_petsc function PetscSortIntWithDataArray(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscInt}, Y::Cvoid, size::Csize_t, t2::Cvoid ) + + @chk ccall( + (:PetscSortIntWithDataArray, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscInt}, Ptr{Cvoid}, Csize_t, Ptr{Cvoid}), + n, X, Y, size, t2, + ) + + + return nothing +end + +""" + n::PetscInt,L::PetscInt = PetscMergeIntArray(petsclib::PetscLibType,an::PetscInt, aI::Vector{PetscInt}, bn::PetscInt, bI::Vector{PetscInt}) +Merges two SORTED `PetscInt` arrays, removes duplicate elements. + +Not Collective + +Input Parameters: +- `an` - number of values in the first array +- `aI` - first sorted array of `PetscInt` +- `bn` - number of values in the second array +- `bI` - second array of `PetscInt` + +Output Parameters: +- `n` - number of values in the merged array +- `L` - merged sorted array, this is allocated if an array is not provided + +Level: intermediate + +-seealso: `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortIntWithArray()` + +# External Links +$(_doc_external("Sys/PetscMergeIntArray")) +""" +function PetscMergeIntArray(petsclib::PetscLibType, an::PetscInt, aI::Vector{PetscInt}, bn::PetscInt, bI::Vector{PetscInt}) end + +@for_petsc function PetscMergeIntArray(petsclib::$UnionPetscLib, an::$PetscInt, aI::Vector{$PetscInt}, bn::$PetscInt, bI::Vector{$PetscInt} ) + n_ = Ref{$PetscInt}() + L_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscMergeIntArray, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt), + an, aI, bn, bI, n_, L_, + ) + + n = n_[] + L = L_[] + + return n,L +end + +""" + n::PetscInt,L::Vector{PetscInt},J::Vector{PetscInt} = PetscMergeIntArrayPair(petsclib::PetscLibType,an::PetscInt, aI::Vector{PetscInt}, aJ::Vector{PetscInt}, bn::PetscInt, bI::Vector{PetscInt}, bJ::Vector{PetscInt}) +Merges two SORTED `PetscInt` arrays that share NO common values along with an additional array of `PetscInt`. +The additional arrays are the same length as sorted arrays and are merged +in the order determined by the merging of the sorted pair. + +Not Collective + +Input Parameters: +- `an` - number of values in the first array +- `aI` - first sorted array of `PetscInt` +- `aJ` - first additional array of `PetscInt` +- `bn` - number of values in the second array +- `bI` - second array of `PetscInt` +- `bJ` - second additional of `PetscInt` + +Output Parameters: +- `n` - number of values in the merged array (== an + bn) +- `L` - merged sorted array +- `J` - merged additional array + +-seealso: `PetscIntSortSemiOrdered()`, `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortIntWithArray()` + +# External Links +$(_doc_external("Sys/PetscMergeIntArrayPair")) +""" +function PetscMergeIntArrayPair(petsclib::PetscLibType, an::PetscInt, aI::Vector{PetscInt}, aJ::Vector{PetscInt}, bn::PetscInt, bI::Vector{PetscInt}, bJ::Vector{PetscInt}) end + +@for_petsc function PetscMergeIntArrayPair(petsclib::$UnionPetscLib, an::$PetscInt, aI::Vector{$PetscInt}, aJ::Vector{$PetscInt}, bn::$PetscInt, bI::Vector{$PetscInt}, bJ::Vector{$PetscInt} ) + n_ = Ref{$PetscInt}() + L_ = Ref{Ptr{$PetscInt}}() + J_ = Ref{Ptr{$PetscInt}}() + + @chk ccall( + (:PetscMergeIntArrayPair, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{Ptr{$PetscInt}}, Ptr{Ptr{$PetscInt}}), + an, aI, aJ, bn, bI, bJ, n_, L_, J_, + ) + + n = n_[] + L = unsafe_wrap(Array, L_[], VecGetLocalSize(petsclib, x); own = false) + J = unsafe_wrap(Array, J_[], VecGetLocalSize(petsclib, x); own = false) + + return n,L,J +end + +""" + n::PetscInt = PetscMergeMPIIntArray(petsclib::PetscLibType,an::PetscInt, aI::Vector{PetscMPIInt}, bn::PetscInt, bI::Vector{PetscMPIInt}, L::PetscMPIInt) +Merges two SORTED `PetscMPIInt` arrays. + +Not Collective + +Input Parameters: +- `an` - number of values in the first array +- `aI` - first sorted array of `PetscMPIInt` +- `bn` - number of values in the second array +- `bI` - second array of `PetscMPIInt` + +Output Parameters: +- `n` - number of values in the merged array (<= an + bn) +- `L` - merged sorted array, allocated if address of NULL pointer is passed + +Level: intermediate + +-seealso: `PetscIntSortSemiOrdered()`, `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortIntWithArray()` + +# External Links +$(_doc_external("Sys/PetscMergeMPIIntArray")) +""" +function PetscMergeMPIIntArray(petsclib::PetscLibType, an::PetscInt, aI::Vector{PetscMPIInt}, bn::PetscInt, bI::Vector{PetscMPIInt}, L::PetscMPIInt) end + +@for_petsc function PetscMergeMPIIntArray(petsclib::$UnionPetscLib, an::$PetscInt, aI::Vector{PetscMPIInt}, bn::$PetscInt, bI::Vector{PetscMPIInt}, L::PetscMPIInt ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscMergeMPIIntArray, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{PetscMPIInt}, $PetscInt, Ptr{PetscMPIInt}, Ptr{$PetscInt}, PetscMPIInt), + an, aI, bn, bI, n_, L, + ) + + n = n_[] + + return n +end + +""" + Nlevels::PetscInt,Level::PetscInt,Levelcnt::PetscInt,Idbylevel::PetscInt,Column::PetscInt = PetscProcessTree(petsclib::PetscLibType,n::PetscInt, mask::Vector{PetscBool}, parentid::Vector{PetscInt}) +Prepares tree data to be displayed graphically + +Not Collective, No Fortran Support + +Input Parameters: +- `n` - number of values +- `mask` - indicates those entries in the tree, location 0 is always masked +- `parentid` - indicates the parent of each entry + +Output Parameters: +- `Nlevels` - the number of levels +- `Level` - for each node tells its level +- `Levelcnt` - the number of nodes on each level +- `Idbylevel` - a list of ids on each of the levels, first level followed by second etc +- `Column` - for each id tells its column index + +Level: developer + +-seealso: `PetscSortReal()`, `PetscSortIntWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscProcessTree")) +""" +function PetscProcessTree(petsclib::PetscLibType, n::PetscInt, mask::Vector{PetscBool}, parentid::Vector{PetscInt}) end + +@for_petsc function PetscProcessTree(petsclib::$UnionPetscLib, n::$PetscInt, mask::Vector{PetscBool}, parentid::Vector{$PetscInt} ) + Nlevels_ = Ref{$PetscInt}() + Level_ = Ref{$PetscInt}() + Levelcnt_ = Ref{$PetscInt}() + Idbylevel_ = Ref{$PetscInt}() + Column_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscProcessTree, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{PetscBool}, Ptr{$PetscInt}, Ptr{$PetscInt}, $PetscInt, $PetscInt, $PetscInt, $PetscInt), + n, mask, parentid, Nlevels_, Level_, Levelcnt_, Idbylevel_, Column_, + ) + + Nlevels = Nlevels_[] + Level = Level_[] + Levelcnt = Levelcnt_[] + Idbylevel = Idbylevel_[] + Column = Column_[] + + return Nlevels,Level,Levelcnt,Idbylevel,Column +end + +""" + is_sorted::PetscBool = PetscParallelSortedInt(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, keys::Vector{PetscInt}) +Check whether a `PetscInt` array, distributed over a communicator, is globally sorted. + +Collective + +Input Parameters: +- `comm` - the MPI communicator +- `n` - the local number of `PetscInt` +- `keys` - the local array of `PetscInt` + +Output Parameters: +- `is_sorted` - whether the array is globally sorted + +Level: developer + +-seealso: `PetscParallelSortInt()` + +# External Links +$(_doc_external("Sys/PetscParallelSortedInt")) +""" +function PetscParallelSortedInt(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, keys::Vector{PetscInt}) end + +@for_petsc function PetscParallelSortedInt(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, keys::Vector{$PetscInt} ) + is_sorted_ = Ref{PetscBool}() + + @chk ccall( + (:PetscParallelSortedInt, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{$PetscInt}, Ptr{PetscBool}), + comm, n, keys, is_sorted_, + ) + + is_sorted = is_sorted_[] + + return is_sorted +end + +""" + PetscCommBuildTwoSidedSetType(petsclib::PetscLibType,comm::MPI_Comm, twosided::PetscBuildTwoSidedType) +set algorithm to use when building two + +Logically Collective + +Input Parameters: +- `comm` - `PETSC_COMM_WORLD` +- `twosided` - algorithm to use in subsequent calls to `PetscCommBuildTwoSided()` + +Level: developer + +-seealso: `PetscCommBuildTwoSided()`, `PetscCommBuildTwoSidedGetType()`, `PetscBuildTwoSidedType` + +# External Links +$(_doc_external("Sys/PetscCommBuildTwoSidedSetType")) +""" +function PetscCommBuildTwoSidedSetType(petsclib::PetscLibType, comm::MPI_Comm, twosided::PetscBuildTwoSidedType) end + +@for_petsc function PetscCommBuildTwoSidedSetType(petsclib::$UnionPetscLib, comm::MPI_Comm, twosided::PetscBuildTwoSidedType ) + + @chk ccall( + (:PetscCommBuildTwoSidedSetType, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscBuildTwoSidedType), + comm, twosided, + ) + + + return nothing +end + +""" + comm::MPI_Comm,twosided::PetscBuildTwoSidedType = PetscCommBuildTwoSidedGetType(petsclib::PetscLibType) +get algorithm used when building two + +Logically Collective + +Output Parameters: +- `comm` - communicator on which to query algorithm +- `twosided` - algorithm to use for `PetscCommBuildTwoSided()` + +Level: developer + +-seealso: `PetscCommBuildTwoSided()`, `PetscCommBuildTwoSidedSetType()`, `PetscBuildTwoSidedType` + +# External Links +$(_doc_external("Sys/PetscCommBuildTwoSidedGetType")) +""" +function PetscCommBuildTwoSidedGetType(petsclib::PetscLibType) end + +@for_petsc function PetscCommBuildTwoSidedGetType(petsclib::$UnionPetscLib) + comm_ = Ref{MPI_Comm}() + twosided_ = Ref{PetscBuildTwoSidedType}() + + @chk ccall( + (:PetscCommBuildTwoSidedGetType, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscBuildTwoSidedType}), + comm_, twosided_, + ) + + comm = comm_[] + twosided = unsafe_string(twosided_[]) + + return comm,twosided +end + +""" + PetscSplitOwnershipBlock(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, n::PetscInt, N::PetscInt) +Given a global (or local) length determines a local +(or global) length via a simple formula. Splits so each processors local size +is divisible by the block size. + +Collective (if `N` is `PETSC_DECIDE`) + +Input Parameters: +- `comm` - MPI communicator that shares the object being divided +- `bs` - block size +- `n` - local length (or `PETSC_DECIDE` to have it set) +- `N` - global length (or `PETSC_DECIDE`) + +Level: developer + +-seealso: `PetscSplitOwnership()`, `PetscSplitOwnershipEqual()` + +# External Links +$(_doc_external("Sys/PetscSplitOwnershipBlock")) +""" +function PetscSplitOwnershipBlock(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, n::PetscInt, N::PetscInt) end + +@for_petsc function PetscSplitOwnershipBlock(petsclib::$UnionPetscLib, comm::MPI_Comm, bs::$PetscInt, n::$PetscInt, N::$PetscInt ) + + @chk ccall( + (:PetscSplitOwnershipBlock, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + comm, bs, n, N, + ) + + + return nothing +end + +""" + PetscSplitOwnership(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Given a global (or local) length determines a local +(or global) length via a simple formula + +Collective (if `n` or `N` is `PETSC_DECIDE` or `PETSC_DETERMINE`) + +Input Parameters: +- `comm` - MPI communicator that shares the object being divided +- `n` - local length (or `PETSC_DECIDE` to have it set) +- `N` - global length (or `PETSC_DETERMINE` to have it set) + +Level: developer + +-seealso: `PetscSplitOwnershipBlock()`, `PetscSplitOwnershipEqual()`, `PETSC_DECIDE`, `PETSC_DETERMINE` + +# External Links +$(_doc_external("Sys/PetscSplitOwnership")) +""" +function PetscSplitOwnership(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function PetscSplitOwnership(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + + @chk ccall( + (:PetscSplitOwnership, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{$PetscInt}, Ptr{$PetscInt}), + comm, n, N, + ) + + + return nothing +end + +""" + PetscSplitOwnershipEqual(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt) +Given a global (or local) length determines a local +(or global) length via a simple formula, trying to have all local lengths equal + +Collective (if `n` or `N` is `PETSC_DECIDE`) + +Input Parameters: +- `comm` - MPI communicator that shares the object being divided +- `n` - local length (or `PETSC_DECIDE` to have it set) +- `N` - global length (or `PETSC_DECIDE`) + +Level: developer + +-seealso: `PetscSplitOwnership()`, `PetscSplitOwnershipBlock()` + +# External Links +$(_doc_external("Sys/PetscSplitOwnershipEqual")) +""" +function PetscSplitOwnershipEqual(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, N::PetscInt) end + +@for_petsc function PetscSplitOwnershipEqual(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, N::$PetscInt ) + + @chk ccall( + (:PetscSplitOwnershipEqual, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{$PetscInt}, Ptr{$PetscInt}), + comm, n, N, + ) + + + return nothing +end + +""" + PetscStrToArray(petsclib::PetscLibType,s::Vector{Cchar}, sp::Cchar, argc::Cint, args::Cchar) +Separates a string by a character (for example ' ' or '\n') and creates an array of strings + +Not Collective; No Fortran Support + +Input Parameters: +- `s` - pointer to string +- `sp` - separator character + +Output Parameters: +- `argc` - the number of entries in `args` +- `args` - an array of the entries with a `NULL` at the end + +Level: intermediate + +-seealso: `PetscStrToArrayDestroy()`, `PetscToken`, `PetscTokenCreate()` + +# External Links +$(_doc_external("Sys/PetscStrToArray")) +""" +function PetscStrToArray(petsclib::PetscLibType, s::Vector{Cchar}, sp::Cchar, argc::Cint, args::Cchar) end + +@for_petsc function PetscStrToArray(petsclib::$UnionPetscLib, s::Vector{Cchar}, sp::Cchar, argc::Cint, args::Cchar ) + + @chk ccall( + (:PetscStrToArray, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cchar, Ptr{Cint}, Cchar), + s, sp, argc, args, + ) + + + return nothing +end + +""" + PetscStrToArrayDestroy(petsclib::PetscLibType,argc::Cint, args::Cchar) +Frees array created with `PetscStrToArray()`. + +Not Collective; No Fortran Support + +Output Parameters: +- `argc` - the number of arguments +- `args` - the array of arguments + +Level: intermediate + +-seealso: `PetscStrToArray()` + +# External Links +$(_doc_external("Sys/PetscStrToArrayDestroy")) +""" +function PetscStrToArrayDestroy(petsclib::PetscLibType, argc::Cint, args::Cchar) end + +@for_petsc function PetscStrToArrayDestroy(petsclib::$UnionPetscLib, argc::Cint, args::Cchar ) + + @chk ccall( + (:PetscStrToArrayDestroy, $petsc_library), + PetscErrorCode, + (Cint, Cchar), + argc, args, + ) + + + return nothing +end + +""" + PetscStrArrayallocpy(petsclib::PetscLibType,list::Cchar, t::Cchar) +Allocates space to hold a copy of an array of strings then copies the strings + +Not Collective; No Fortran Support + +Input Parameter: +- `list` - pointer to array of strings (final string is a `NULL`) + +Output Parameter: +- `t` - the copied array string + +Level: intermediate + +-seealso: `PetscStrallocpy()`, `PetscStrArrayDestroy()`, `PetscStrNArrayallocpy()` + +# External Links +$(_doc_external("Sys/PetscStrArrayallocpy")) +""" +function PetscStrArrayallocpy(petsclib::PetscLibType, list::Cchar, t::Cchar) end + +@for_petsc function PetscStrArrayallocpy(petsclib::$UnionPetscLib, list::Cchar, t::Cchar ) + + @chk ccall( + (:PetscStrArrayallocpy, $petsc_library), + PetscErrorCode, + (Cchar, Cchar), + list, t, + ) + + + return nothing +end + +""" + PetscStrArrayDestroy(petsclib::PetscLibType,list::Cchar) +Frees array of strings created with `PetscStrArrayallocpy()`. + +Not Collective; No Fortran Support + +Output Parameter: +- `list` - array of strings + +Level: intermediate + +-seealso: `PetscStrArrayallocpy()` + +# External Links +$(_doc_external("Sys/PetscStrArrayDestroy")) +""" +function PetscStrArrayDestroy(petsclib::PetscLibType, list::Cchar) end + +@for_petsc function PetscStrArrayDestroy(petsclib::$UnionPetscLib, list::Cchar ) + + @chk ccall( + (:PetscStrArrayDestroy, $petsc_library), + PetscErrorCode, + (Cchar,), + list, + ) + + + return nothing +end + +""" + PetscStrNArrayallocpy(petsclib::PetscLibType,n::PetscInt, list::Cchar, t::Cchar) +Allocates space to hold a copy of an array of strings then copies the strings + +Not Collective; No Fortran Support + +Input Parameters: +- `n` - the number of string entries +- `list` - pointer to array of strings + +Output Parameter: +- `t` - the copied array string + +Level: intermediate + +-seealso: `PetscStrallocpy()`, `PetscStrArrayallocpy()`, `PetscStrNArrayDestroy()` + +# External Links +$(_doc_external("Sys/PetscStrNArrayallocpy")) +""" +function PetscStrNArrayallocpy(petsclib::PetscLibType, n::PetscInt, list::Cchar, t::Cchar) end + +@for_petsc function PetscStrNArrayallocpy(petsclib::$UnionPetscLib, n::$PetscInt, list::Cchar, t::Cchar ) + + @chk ccall( + (:PetscStrNArrayallocpy, $petsc_library), + PetscErrorCode, + ($PetscInt, Cchar, Cchar), + n, list, t, + ) + + + return nothing +end + +""" + n::PetscInt = PetscStrNArrayDestroy(petsclib::PetscLibType,list::Cchar) +Frees array of strings created with `PetscStrNArrayallocpy()`. + +Not Collective; No Fortran Support + +Output Parameters: +- `n` - number of string entries +- `list` - array of strings + +Level: intermediate + +-seealso: `PetscStrNArrayallocpy()`, `PetscStrArrayallocpy()` + +# External Links +$(_doc_external("Sys/PetscStrNArrayDestroy")) +""" +function PetscStrNArrayDestroy(petsclib::PetscLibType, list::Cchar) end + +@for_petsc function PetscStrNArrayDestroy(petsclib::$UnionPetscLib, list::Cchar ) + n_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscStrNArrayDestroy, $petsc_library), + PetscErrorCode, + ($PetscInt, Cchar), + n_, list, + ) + + n = n_[] + + return n +end + +""" + t::PetscBool = PetscStrcasecmp(petsclib::PetscLibType,a::Vector{Cchar}, b::Vector{Cchar}) +Returns true if the two strings are the same +except possibly for case. + +Not Collective; No Fortran Support + +Input Parameters: +- `a` - pointer to first string +- `b` - pointer to second string + +Output Parameter: +- `t` - if the two strings are the same + +Level: intermediate + +-seealso: `PetscStrcmp()`, `PetscStrncmp()`, `PetscStrgrt()` + +# External Links +$(_doc_external("Sys/PetscStrcasecmp")) +""" +function PetscStrcasecmp(petsclib::PetscLibType, a::Vector{Cchar}, b::Vector{Cchar}) end + +@for_petsc function PetscStrcasecmp(petsclib::$UnionPetscLib, a::Vector{Cchar}, b::Vector{Cchar} ) + t_ = Ref{PetscBool}() + + @chk ccall( + (:PetscStrcasecmp, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}), + a, b, t_, + ) + + t = t_[] + + return t +end + +""" + cnt::PetscInt = PetscStrendswithwhich(petsclib::PetscLibType,a::Vector{Cchar}, bs::Cchar) +Determines if a string ends with one of several possible strings + +Not Collective; No Fortran Support + +Input Parameters: +- `a` - pointer to string +- `bs` - strings to end with (last entry must be `NULL`) + +Output Parameter: +- `cnt` - the index of the string it ends with or the index of `NULL` + +Level: intermediate + +-seealso: `PetscStrbeginswithwhich()`, `PetscStrendswith()`, `PetscStrtoupper`, `PetscStrtolower()`, `PetscStrrchr()`, `PetscStrchr()`, +`PetscStrncmp()`, `PetscStrlen()`, `PetscStrcmp()` + +# External Links +$(_doc_external("Sys/PetscStrendswithwhich")) +""" +function PetscStrendswithwhich(petsclib::PetscLibType, a::Vector{Cchar}, bs::Cchar) end + +@for_petsc function PetscStrendswithwhich(petsclib::$UnionPetscLib, a::Vector{Cchar}, bs::Cchar ) + cnt_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscStrendswithwhich, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cchar, Ptr{$PetscInt}), + a, bs, cnt_, + ) + + cnt = cnt_[] + + return cnt +end + +""" + found::PetscBool = PetscStrInList(petsclib::PetscLibType,str::Vector{Cchar}, list::Vector{Cchar}, sep::Cchar) +search for a string in character + +Not Collective; No Fortran Support + +Input Parameters: +- `str` - the string to look for +- `list` - the list to search in +- `sep` - the separator character + +Output Parameter: +- `found` - whether `str` is in `list` + +Level: intermediate + +-seealso: `PetscTokenCreate()`, `PetscTokenFind()`, `PetscStrcmp()` + +# External Links +$(_doc_external("Sys/PetscStrInList")) +""" +function PetscStrInList(petsclib::PetscLibType, str::Vector{Cchar}, list::Vector{Cchar}, sep::Cchar) end + +@for_petsc function PetscStrInList(petsclib::$UnionPetscLib, str::Vector{Cchar}, list::Vector{Cchar}, sep::Cchar ) + found_ = Ref{PetscBool}() + + @chk ccall( + (:PetscStrInList, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Cchar, Ptr{PetscBool}), + str, list, sep, found_, + ) + + found = found_[] + + return found +end + +""" + PetscGetPetscDir(petsclib::PetscLibType,dir::Vector{Cchar}) +Gets the directory PETSc is installed in + +Not Collective; No Fortran Support + +Output Parameter: +- `dir` - the directory + +Level: developer + +-seealso: `PetscGetArchType()` + +# External Links +$(_doc_external("Sys/PetscGetPetscDir")) +""" +function PetscGetPetscDir(petsclib::PetscLibType, dir::Vector{Cchar}) end + +@for_petsc function PetscGetPetscDir(petsclib::$UnionPetscLib, dir::Vector{Cchar} ) + dir_ = Ref(pointer(dir)) + + @chk ccall( + (:PetscGetPetscDir, $petsc_library), + PetscErrorCode, + (Ptr{Ptr{Cchar}},), + dir_, + ) + + + return nothing +end + +""" + PetscStrreplace(petsclib::PetscLibType,comm::MPI_Comm, aa::Vector{Cchar}, b::Vector{Cchar}, len::Csize_t) +Replaces substrings in string with other substrings + +Not Collective; No Fortran Support + +Input Parameters: +- `comm` - `MPI_Comm` of processors that are processing the string +- `aa` - the string to look in +- `b` - the resulting copy of a with replaced strings (`b` can be the same as `a`) +- `len` - the length of `b` + +Level: developer + +-seealso: `PetscStrcmp()` + +# External Links +$(_doc_external("Sys/PetscStrreplace")) +""" +function PetscStrreplace(petsclib::PetscLibType, comm::MPI_Comm, aa::Vector{Cchar}, b::Vector{Cchar}, len::Csize_t) end + +@for_petsc function PetscStrreplace(petsclib::$UnionPetscLib, comm::MPI_Comm, aa::Vector{Cchar}, b::Vector{Cchar}, len::Csize_t ) + + @chk ccall( + (:PetscStrreplace, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Csize_t), + comm, aa, b, len, + ) + + + return nothing +end + +""" + value::PetscInt,found::PetscBool = PetscEListFind(petsclib::PetscLibType,n::PetscInt, list::Cchar, str::Vector{Cchar}) +searches list of strings for given string, using case insensitive matching + +Not Collective; No Fortran Support + +Input Parameters: +- `n` - number of strings in +- `list` - list of strings to search +- `str` - string to look for, empty string "" accepts default (first entry in list) + +Output Parameters: +- `value` - index of matching string (if found) +- `found` - boolean indicating whether string was found (can be `NULL`) + +Level: developer + +-seealso: `PetscEnumFind()` + +# External Links +$(_doc_external("Sys/PetscEListFind")) +""" +function PetscEListFind(petsclib::PetscLibType, n::PetscInt, list::Cchar, str::Vector{Cchar}) end + +@for_petsc function PetscEListFind(petsclib::$UnionPetscLib, n::$PetscInt, list::Cchar, str::Vector{Cchar} ) + value_ = Ref{$PetscInt}() + found_ = Ref{PetscBool}() + + @chk ccall( + (:PetscEListFind, $petsc_library), + PetscErrorCode, + ($PetscInt, Cchar, Ptr{Cchar}, Ptr{$PetscInt}, Ptr{PetscBool}), + n, list, str, value_, found_, + ) + + value = value_[] + found = found_[] + + return value,found +end + +""" + found::PetscBool = PetscEnumFind(petsclib::PetscLibType,enumlist::Cchar, str::Vector{Cchar}, value::PetscEnum) +searches enum list of strings for given string, using case insensitive matching + +Not Collective; No Fortran Support + +Input Parameters: +- `enumlist` - list of strings to search, followed by enum name, then enum prefix, then `NULL` +- `str` - string to look for + +Output Parameters: +- `value` - index of matching string (if found) +- `found` - boolean indicating whether string was found (can be `NULL`) + +Level: advanced + +-seealso: `PetscEListFind()` + +# External Links +$(_doc_external("Sys/PetscEnumFind")) +""" +function PetscEnumFind(petsclib::PetscLibType, enumlist::Cchar, str::Vector{Cchar}, value::PetscEnum) end + +@for_petsc function PetscEnumFind(petsclib::$UnionPetscLib, enumlist::Cchar, str::Vector{Cchar}, value::PetscEnum ) + found_ = Ref{PetscBool}() + + @chk ccall( + (:PetscEnumFind, $petsc_library), + PetscErrorCode, + (Cchar, Ptr{Cchar}, Ptr{PetscEnum}, Ptr{PetscBool}), + enumlist, str, value, found_, + ) + + found = found_[] + + return found +end + +""" + PetscStrcat(petsclib::PetscLibType,s::Vector{Cchar}, t::Vector{Cchar}) +Concatenates a string onto a given string + +Not Collective, No Fortran Support + +Input Parameters: +- `s` - string to be added to +- `t` - pointer to string to be added to end + +Level: deprecated (since 3.18.5) + +-seealso: `PetscStrlcat()` + +# External Links +$(_doc_external("Sys/PetscStrcat")) +""" +function PetscStrcat(petsclib::PetscLibType, s::Vector{Cchar}, t::Vector{Cchar}) end + +@for_petsc function PetscStrcat(petsclib::$UnionPetscLib, s::Vector{Cchar}, t::Vector{Cchar} ) + + @chk ccall( + (:PetscStrcat, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}), + s, t, + ) + + + return nothing +end + +""" + PetscStrcpy(petsclib::PetscLibType,s::Vector{Cchar}, t::Vector{Cchar}) +Copies a string + +Not Collective, No Fortran Support + +Input Parameter: +- `t` - pointer to string + +Output Parameter: +- `s` - the copied string + +Level: deprecated (since 3.18.5) + +-seealso: `PetscStrncpy()` + +# External Links +$(_doc_external("Sys/PetscStrcpy")) +""" +function PetscStrcpy(petsclib::PetscLibType, s::Vector{Cchar}, t::Vector{Cchar}) end + +@for_petsc function PetscStrcpy(petsclib::$UnionPetscLib, s::Vector{Cchar}, t::Vector{Cchar} ) + + @chk ccall( + (:PetscStrcpy, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}), + s, t, + ) + + + return nothing +end + +""" + str::Vector{Cchar} = PetscGetArchType(petsclib::PetscLibType,slen::Csize_t) +Returns the PETSC_ARCH that was used for this configuration of PETSc + +Not Collective + +Input Parameter: +- `slen` - length of string buffer + +Output Parameter: +- `str` - string area to contain architecture name, should be at least 10 characters long. Name is truncated if string is not long enough. + +Level: developer + +-seealso: `PetscGetUserName()`, `PetscGetHostName()` + +# External Links +$(_doc_external("Sys/PetscGetArchType")) +""" +function PetscGetArchType(petsclib::PetscLibType, slen::Csize_t) end + +@for_petsc function PetscGetArchType(petsclib::$UnionPetscLib, slen::Csize_t ) + str = Vector{Cchar}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscGetArchType, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Csize_t), + str, slen, + ) + + + return str +end + +""" + PetscSetDisplay(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscSetDisplay")) +""" +function PetscSetDisplay(petsclib::PetscLibType) end + +@for_petsc function PetscSetDisplay(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscSetDisplay, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscGetDisplay(petsclib::PetscLibType,display::Vector{Cchar}, n::Csize_t) +Gets the X windows display variable for all processors. + +Input Parameter: +- `n` - length of string display + +Output Parameter: +- `display` - the display string + +Options Database Keys: +- `-display ` - sets the display to use +- `-x_virtual` - forces use of a X virtual display Xvfb that will not display anything but -draw_save will still work. Xvfb is automatically +started up in PetscSetDisplay() with this option + +Level: advanced + +-seealso: `PETSC_DRAW_X`, `PetscDrawOpenX()` + +# External Links +$(_doc_external("Sys/PetscGetDisplay")) +""" +function PetscGetDisplay(petsclib::PetscLibType, display::Vector{Cchar}, n::Csize_t) end + +@for_petsc function PetscGetDisplay(petsclib::$UnionPetscLib, display::Vector{Cchar}, n::Csize_t ) + + @chk ccall( + (:PetscGetDisplay, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Csize_t), + display, n, + ) + + + return nothing +end + +""" + PetscGetHostName(petsclib::PetscLibType,name::Vector{Cchar}, nlen::Csize_t) +Returns the name of the host. This attempts to +return the entire Internet name. It may not return the same name +as `MPI_Get_processor_name()`. + +Not Collective + +Input Parameter: +- `nlen` - length of name + +Output Parameter: +- `name` - contains host name. Must be long enough to hold the name +This is the fully qualified name, including the domain. + +Level: developer + +-seealso: `PetscGetUserName()`, `PetscGetArchType()` + +# External Links +$(_doc_external("Sys/PetscGetHostName")) +""" +function PetscGetHostName(petsclib::PetscLibType, name::Vector{Cchar}, nlen::Csize_t) end + +@for_petsc function PetscGetHostName(petsclib::$UnionPetscLib, name::Vector{Cchar}, nlen::Csize_t ) + + @chk ccall( + (:PetscGetHostName, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Csize_t), + name, nlen, + ) + + + return nothing +end + +""" + sorted::PetscBool = PetscSortedReal(petsclib::PetscLibType,n::PetscCount, X::Vector{PetscReal}) +Determines whether the array of `PetscReal` is sorted. + +Not Collective + +Input Parameters: +- `n` - number of values +- `X` - array of integers + +Output Parameter: +- `sorted` - flag whether the array is sorted + +Level: intermediate + +-seealso: `PetscSortReal()`, `PetscSortedInt()`, `PetscSortedMPIInt()` + +# External Links +$(_doc_external("Sys/PetscSortedReal")) +""" +function PetscSortedReal(petsclib::PetscLibType, n::PetscCount, X::Vector{PetscReal}) end + +@for_petsc function PetscSortedReal(petsclib::$UnionPetscLib, n::PetscCount, X::Vector{$PetscReal} ) + sorted_ = Ref{PetscBool}() + + @chk ccall( + (:PetscSortedReal, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscReal}, Ptr{PetscBool}), + n, X, sorted_, + ) + + sorted = sorted_[] + + return sorted +end + +""" + PetscSortReal(petsclib::PetscLibType,n::PetscCount, v::Vector{PetscReal}) +Sorts an array of `PetscReal` in place in increasing order. + +Not Collective + +Input Parameters: +- `n` - number of values +- `v` - array of doubles + +Level: intermediate + +-seealso: `PetscRealSortSemiOrdered()`, `PetscSortInt()`, `PetscSortRealWithPermutation()`, `PetscSortRealWithArrayInt()` + +# External Links +$(_doc_external("Sys/PetscSortReal")) +""" +function PetscSortReal(petsclib::PetscLibType, n::PetscCount, v::Vector{PetscReal}) end + +@for_petsc function PetscSortReal(petsclib::$UnionPetscLib, n::PetscCount, v::Vector{$PetscReal} ) + + @chk ccall( + (:PetscSortReal, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscReal}), + n, v, + ) + + + return nothing +end + +""" + PetscSortRealWithArrayInt(petsclib::PetscLibType,n::PetscCount, r::Vector{PetscReal}, Ii::Vector{PetscInt}) +Sorts an array of `PetscReal` in place in increasing order; +changes a second `PetscInt` array to match the sorted first array. + +Not Collective + +Input Parameters: +- `n` - number of values +- `Ii` - array of integers +- `r` - second array of integers + +Level: intermediate + +-seealso: `PetscSortReal()` + +# External Links +$(_doc_external("Sys/PetscSortRealWithArrayInt")) +""" +function PetscSortRealWithArrayInt(petsclib::PetscLibType, n::PetscCount, r::Vector{PetscReal}, Ii::Vector{PetscInt}) end + +@for_petsc function PetscSortRealWithArrayInt(petsclib::$UnionPetscLib, n::PetscCount, r::Vector{$PetscReal}, Ii::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortRealWithArrayInt, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{$PetscReal}, Ptr{$PetscInt}), + n, r, Ii, + ) + + + return nothing +end + +""" + loc::PetscInt = PetscFindReal(petsclib::PetscLibType,key::PetscReal, n::PetscCount, t::Vector{PetscReal}, eps::PetscReal) +Finds a `PetscReal` in a sorted array of `PetscReal`s + +Not Collective + +Input Parameters: +- `key` - the value to locate +- `n` - number of values in the array +- `t` - array of values +- `eps` - tolerance used to compare + +Output Parameter: +- `loc` - the location if found, otherwise -(slot+1) where slot is the place the value would go + +Level: intermediate + +-seealso: `PetscSortReal()`, `PetscSortRealWithArrayInt()` + +# External Links +$(_doc_external("Sys/PetscFindReal")) +""" +function PetscFindReal(petsclib::PetscLibType, key::PetscReal, n::PetscCount, t::Vector{PetscReal}, eps::PetscReal) end + +@for_petsc function PetscFindReal(petsclib::$UnionPetscLib, key::$PetscReal, n::PetscCount, t::Vector{$PetscReal}, eps::$PetscReal ) + loc_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscFindReal, $petsc_library), + PetscErrorCode, + ($PetscReal, PetscCount, Ptr{$PetscReal}, $PetscReal, Ptr{$PetscInt}), + key, n, t, eps, loc_, + ) + + loc = loc_[] + + return loc +end + +""" + PetscSortRemoveDupsReal(petsclib::PetscLibType,n::PetscInt, v::Vector{PetscReal}) +Sorts an array of `PetscReal` in place in increasing order and removes all duplicate entries + +Not Collective + +Input Parameters: +- `n` - initial number of values +- `v` - array of values + +-seealso: `PetscSortReal()`, `PetscSortRemoveDupsInt()` + +# External Links +$(_doc_external("Sys/PetscSortRemoveDupsReal")) +""" +function PetscSortRemoveDupsReal(petsclib::PetscLibType, n::PetscInt, v::Vector{PetscReal}) end + +@for_petsc function PetscSortRemoveDupsReal(petsclib::$UnionPetscLib, n::$PetscInt, v::Vector{$PetscReal} ) + + @chk ccall( + (:PetscSortRemoveDupsReal, $petsc_library), + PetscErrorCode, + (Ptr{$PetscInt}, Ptr{$PetscReal}), + n, v, + ) + + + return nothing +end + +""" + PetscSortSplit(petsclib::PetscLibType,ncut::PetscInt, n::PetscInt, a::Vector{PetscScalar}, idx::Vector{PetscInt}) +Quick + +Not Collective + +Input Parameters: +- `ncut` - splitting index +- `n` - number of values to sort + +Input/Output Parameters: +- `a` - array of values, on output the values are permuted such that its elements satisfy: +abs(a[i]) >= abs(a[ncut-1]) for i < ncut and +abs(a[i]) <= abs(a[ncut-1]) for i >= ncut +- `idx` - index for array a, on output permuted accordingly + +Level: intermediate + +-seealso: `PetscSortInt()`, `PetscSortRealWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscSortSplit")) +""" +function PetscSortSplit(petsclib::PetscLibType, ncut::PetscInt, n::PetscInt, a::Vector{PetscScalar}, idx::Vector{PetscInt}) end + +@for_petsc function PetscSortSplit(petsclib::$UnionPetscLib, ncut::$PetscInt, n::$PetscInt, a::Vector{$PetscScalar}, idx::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortSplit, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscScalar}, Ptr{$PetscInt}), + ncut, n, a, idx, + ) + + + return nothing +end + +""" + PetscSortSplitReal(petsclib::PetscLibType,ncut::PetscInt, n::PetscInt, a::Vector{PetscReal}, idx::Vector{PetscInt}) +Quick + +Not Collective + +Input Parameters: +- `ncut` - splitting index +- `n` - number of values to sort + +Input/Output Parameters: +- `a` - array of values, on output the values are permuted such that its elements satisfy: +abs(a[i]) >= abs(a[ncut-1]) for i < ncut and +abs(a[i]) <= abs(a[ncut-1]) for i >= ncut +- `idx` - index for array a, on output permuted accordingly + +Level: intermediate + +-seealso: `PetscSortInt()`, `PetscSortRealWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscSortSplitReal")) +""" +function PetscSortSplitReal(petsclib::PetscLibType, ncut::PetscInt, n::PetscInt, a::Vector{PetscReal}, idx::Vector{PetscInt}) end + +@for_petsc function PetscSortSplitReal(petsclib::$UnionPetscLib, ncut::$PetscInt, n::$PetscInt, a::Vector{$PetscReal}, idx::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortSplitReal, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscInt}), + ncut, n, a, idx, + ) + + + return nothing +end + +""" + PetscGatherNumberOfMessages(petsclib::PetscLibType,comm::MPI_Comm, iflags::Vector{PetscMPIInt}, ilengths::Vector{PetscMPIInt}, nrecvs::PetscMPIInt) +Computes the number of messages an MPI rank expects to receive during a neighbor communication + +Collective, No Fortran Support + +Input Parameters: +- `comm` - Communicator +- `iflags` - an array of integers of length sizeof(comm). A '1' in `ilengths`[i] represent a +message from current node to ith node. Optionally `NULL` +- `ilengths` - Non zero ilengths[i] represent a message to i of length `ilengths`[i]. +Optionally `NULL`. + +Output Parameter: +- `nrecvs` - number of messages received + +Level: developer + +-seealso: `PetscGatherMessageLengths()`, `PetscGatherMessageLengths2()`, `PetscCommBuildTwoSided()` + +# External Links +$(_doc_external("Sys/PetscGatherNumberOfMessages")) +""" +function PetscGatherNumberOfMessages(petsclib::PetscLibType, comm::MPI_Comm, iflags::Vector{PetscMPIInt}, ilengths::Vector{PetscMPIInt}, nrecvs::PetscMPIInt) end + +@for_petsc function PetscGatherNumberOfMessages(petsclib::$UnionPetscLib, comm::MPI_Comm, iflags::Vector{PetscMPIInt}, ilengths::Vector{PetscMPIInt}, nrecvs::PetscMPIInt ) + + @chk ccall( + (:PetscGatherNumberOfMessages, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{PetscMPIInt}, Ptr{PetscMPIInt}, Ptr{PetscMPIInt}), + comm, iflags, ilengths, nrecvs, + ) + + + return nothing +end + +""" + PetscGatherMessageLengths(petsclib::PetscLibType,comm::MPI_Comm, nsends::PetscMPIInt, nrecvs::PetscMPIInt, ilengths::Vector{PetscMPIInt}, onodes::PetscMPIInt, olengths::PetscMPIInt) +Computes information about messages that an MPI rank will receive, +including (from-id,length) pairs for each message. + +Collective, No Fortran Support + +Input Parameters: +- `comm` - Communicator +- `nsends` - number of messages that are to be sent. +- `nrecvs` - number of messages being received +- `ilengths` - an array of integers of length sizeof(comm) +a non zero `ilengths`[i] represent a message to i of length `ilengths`[i] + +Output Parameters: +- `onodes` - list of ranks from which messages are expected +- `olengths` - corresponding message lengths + +Level: developer + +-seealso: `PetscGatherNumberOfMessages()`, `PetscGatherMessageLengths2()`, `PetscCommBuildTwoSided()` + +# External Links +$(_doc_external("Sys/PetscGatherMessageLengths")) +""" +function PetscGatherMessageLengths(petsclib::PetscLibType, comm::MPI_Comm, nsends::PetscMPIInt, nrecvs::PetscMPIInt, ilengths::Vector{PetscMPIInt}, onodes::PetscMPIInt, olengths::PetscMPIInt) end + +@for_petsc function PetscGatherMessageLengths(petsclib::$UnionPetscLib, comm::MPI_Comm, nsends::PetscMPIInt, nrecvs::PetscMPIInt, ilengths::Vector{PetscMPIInt}, onodes::PetscMPIInt, olengths::PetscMPIInt ) + + @chk ccall( + (:PetscGatherMessageLengths, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscMPIInt, PetscMPIInt, Ptr{PetscMPIInt}, PetscMPIInt, PetscMPIInt), + comm, nsends, nrecvs, ilengths, onodes, olengths, + ) + + + return nothing +end + +""" + PetscGatherMessageLengths2(petsclib::PetscLibType,comm::MPI_Comm, nsends::PetscMPIInt, nrecvs::PetscMPIInt, ilengths1::Vector{PetscMPIInt}, ilengths2::Vector{PetscMPIInt}, onodes::PetscMPIInt, olengths1::PetscMPIInt, olengths2::PetscMPIInt) +Computes info about messages that a MPI rank will receive, +including (from-id,length) pairs for each message. Same functionality as `PetscGatherMessageLengths()` +except it takes TWO ilenths and output TWO olengths. + +Collective, No Fortran Support + +Input Parameters: +- `comm` - Communicator +- `nsends` - number of messages that are to be sent. +- `nrecvs` - number of messages being received +- `ilengths1` - first array of integers of length sizeof(comm) +- `ilengths2` - second array of integers of length sizeof(comm) + +Output Parameters: +- `onodes` - list of ranks from which messages are expected +- `olengths1` - first corresponding message lengths +- `olengths2` - second message lengths + +Level: developer + +-seealso: `PetscGatherMessageLengths()`, `PetscGatherNumberOfMessages()`, `PetscCommBuildTwoSided()` + +# External Links +$(_doc_external("Sys/PetscGatherMessageLengths2")) +""" +function PetscGatherMessageLengths2(petsclib::PetscLibType, comm::MPI_Comm, nsends::PetscMPIInt, nrecvs::PetscMPIInt, ilengths1::Vector{PetscMPIInt}, ilengths2::Vector{PetscMPIInt}, onodes::PetscMPIInt, olengths1::PetscMPIInt, olengths2::PetscMPIInt) end + +@for_petsc function PetscGatherMessageLengths2(petsclib::$UnionPetscLib, comm::MPI_Comm, nsends::PetscMPIInt, nrecvs::PetscMPIInt, ilengths1::Vector{PetscMPIInt}, ilengths2::Vector{PetscMPIInt}, onodes::PetscMPIInt, olengths1::PetscMPIInt, olengths2::PetscMPIInt ) + + @chk ccall( + (:PetscGatherMessageLengths2, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscMPIInt, PetscMPIInt, Ptr{PetscMPIInt}, Ptr{PetscMPIInt}, PetscMPIInt, PetscMPIInt, PetscMPIInt), + comm, nsends, nrecvs, ilengths1, ilengths2, onodes, olengths1, olengths2, + ) + + + return nothing +end + +""" + PetscPostIrecvInt(petsclib::PetscLibType,comm::MPI_Comm, tag::PetscMPIInt, nrecvs::PetscMPIInt, onodes::Vector{PetscMPIInt}, olengths::Vector{PetscMPIInt}, rbuf::PetscInt, r_waits::MPI_Request) + +# External Links +$(_doc_external("Sys/PetscPostIrecvInt")) +""" +function PetscPostIrecvInt(petsclib::PetscLibType, comm::MPI_Comm, tag::PetscMPIInt, nrecvs::PetscMPIInt, onodes::Vector{PetscMPIInt}, olengths::Vector{PetscMPIInt}, rbuf::PetscInt, r_waits::MPI_Request) end + +@for_petsc function PetscPostIrecvInt(petsclib::$UnionPetscLib, comm::MPI_Comm, tag::PetscMPIInt, nrecvs::PetscMPIInt, onodes::Vector{PetscMPIInt}, olengths::Vector{PetscMPIInt}, rbuf::$PetscInt, r_waits::MPI_Request ) + + @chk ccall( + (:PetscPostIrecvInt, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscMPIInt, PetscMPIInt, Ptr{PetscMPIInt}, Ptr{PetscMPIInt}, $PetscInt, MPI_Request), + comm, tag, nrecvs, onodes, olengths, rbuf, r_waits, + ) + + + return nothing +end + +""" + PetscPostIrecvScalar(petsclib::PetscLibType,comm::MPI_Comm, tag::PetscMPIInt, nrecvs::PetscMPIInt, onodes::Vector{PetscMPIInt}, olengths::Vector{PetscMPIInt}, rbuf::PetscScalar, r_waits::MPI_Request) + +# External Links +$(_doc_external("Sys/PetscPostIrecvScalar")) +""" +function PetscPostIrecvScalar(petsclib::PetscLibType, comm::MPI_Comm, tag::PetscMPIInt, nrecvs::PetscMPIInt, onodes::Vector{PetscMPIInt}, olengths::Vector{PetscMPIInt}, rbuf::PetscScalar, r_waits::MPI_Request) end + +@for_petsc function PetscPostIrecvScalar(petsclib::$UnionPetscLib, comm::MPI_Comm, tag::PetscMPIInt, nrecvs::PetscMPIInt, onodes::Vector{PetscMPIInt}, olengths::Vector{PetscMPIInt}, rbuf::$PetscScalar, r_waits::MPI_Request ) + + @chk ccall( + (:PetscPostIrecvScalar, $petsc_library), + PetscErrorCode, + (MPI_Comm, PetscMPIInt, PetscMPIInt, Ptr{PetscMPIInt}, Ptr{PetscMPIInt}, $PetscScalar, MPI_Request), + comm, tag, nrecvs, onodes, olengths, rbuf, r_waits, + ) + + + return nothing +end + +""" + PetscShmgetAddressesFinalize(petsclib::PetscLibType) +frees any shared memory that was allocated by `PetscShmgetAllocateArray()` but +not deallocated with `PetscShmgetDeallocateArray()` + +Level: developer + +-seealso: `PetscShmgetAllocateArray()`, `PetscShmgetDeallocateArray()`, `PetscShmgetUnmapAddresses()` + +# External Links +$(_doc_external("Sys/PetscShmgetAddressesFinalize")) +""" +function PetscShmgetAddressesFinalize(petsclib::PetscLibType) end + +@for_petsc function PetscShmgetAddressesFinalize(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscShmgetAddressesFinalize, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscShmgetMapAddresses(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, baseaddres::Cvoid, addres::Cvoid) +given shared address on the first MPI process determines the +addresses on the other MPI processes that map to the same physical memory + +Input Parameters: +- `comm` - the `MPI_Comm` to scatter the address +- `n` - the number of addresses, each obtained on MPI process zero by `PetscShmgetAllocateArray()` +- `baseaddres` - the addresses on the first MPI process, ignored on all but first process + +Output Parameter: +- `addres` - the addresses on each MPI process, the array of void * must already be allocated + +Level: developer + +-seealso: `PetscShmgetDeallocateArray()`, `PetscShmgetAllocateArray()`, `PetscShmgetUnmapAddresses()` + +# External Links +$(_doc_external("Sys/PetscShmgetMapAddresses")) +""" +function PetscShmgetMapAddresses(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, baseaddres::Cvoid, addres::Cvoid) end + +@for_petsc function PetscShmgetMapAddresses(petsclib::$UnionPetscLib, comm::MPI_Comm, n::$PetscInt, baseaddres::Cvoid, addres::Cvoid ) + + @chk ccall( + (:PetscShmgetMapAddresses, $petsc_library), + PetscErrorCode, + (MPI_Comm, $PetscInt, Cvoid, Cvoid), + comm, n, baseaddres, addres, + ) + + + return nothing +end + +""" + PetscShmgetUnmapAddresses(petsclib::PetscLibType,n::PetscInt, addres::Cvoid) +given shared addresses on a MPI process unlink it + +Input Parameters: +- `n` - the number of addresses, each obtained on MPI process zero by `PetscShmgetAllocateArray()` +- `addres` - the addresses + +Level: developer + +-seealso: `PetscShmgetDeallocateArray()`, `PetscShmgetAllocateArray()`, `PetscShmgetMapAddresses()` + +# External Links +$(_doc_external("Sys/PetscShmgetUnmapAddresses")) +""" +function PetscShmgetUnmapAddresses(petsclib::PetscLibType, n::PetscInt, addres::Cvoid) end + +@for_petsc function PetscShmgetUnmapAddresses(petsclib::$UnionPetscLib, n::$PetscInt, addres::Cvoid ) + + @chk ccall( + (:PetscShmgetUnmapAddresses, $petsc_library), + PetscErrorCode, + ($PetscInt, Cvoid), + n, addres, + ) + + + return nothing +end + +""" + PetscShmgetAllocateArray(petsclib::PetscLibType,sz::Csize_t, asz::Csize_t, addr::Vector{Cvoid}) +allocates shared memory accessible by all MPI processes in the server + +Not Collective, only called on the first MPI process + +Input Parameters: +- `sz` - the number of elements in the array +- `asz` - the size of an entry in the array, for example `sizeof(PetscScalar)` + +Output Parameters: +- `addr` - the address of the array + +Level: developer + +-seealso: [](sec_pcmpi), `PCMPIServerBegin()`, `PCMPI`, `KSPCheckPCMPI()`, `PetscShmgetDeallocateArray()` + +# External Links +$(_doc_external("Sys/PetscShmgetAllocateArray")) +""" +function PetscShmgetAllocateArray(petsclib::PetscLibType, sz::Csize_t, asz::Csize_t, addr::Vector{Cvoid}) end + +@for_petsc function PetscShmgetAllocateArray(petsclib::$UnionPetscLib, sz::Csize_t, asz::Csize_t, addr::Vector{Cvoid} ) + addr_ = Ref(pointer(addr)) + + @chk ccall( + (:PetscShmgetAllocateArray, $petsc_library), + PetscErrorCode, + (Csize_t, Csize_t, Ptr{Ptr{Cvoid}}), + sz, asz, addr_, + ) + + + return nothing +end + +""" + PetscShmgetDeallocateArray(petsclib::PetscLibType,addr::Vector{Cvoid}) +deallocates shared memory accessible by all MPI processes in the server + +Not Collective, only called on the first MPI process + +Input Parameter: +- `addr` - the address of array + +Level: developer + +-seealso: [](sec_pcmpi), `PCMPIServerBegin()`, `PCMPI`, `KSPCheckPCMPI()`, `PetscShmgetAllocateArray()` + +# External Links +$(_doc_external("Sys/PetscShmgetDeallocateArray")) +""" +function PetscShmgetDeallocateArray(petsclib::PetscLibType, addr::Vector{Cvoid}) end + +@for_petsc function PetscShmgetDeallocateArray(petsclib::$UnionPetscLib, addr::Vector{Cvoid} ) + addr_ = Ref(pointer(addr)) + + @chk ccall( + (:PetscShmgetDeallocateArray, $petsc_library), + PetscErrorCode, + (Ptr{Ptr{Cvoid}},), + addr_, + ) + + + return nothing +end + +""" + PetscMPIDump(petsclib::PetscLibType,fd::Libc.FILE) +Dumps a listing of incomplete MPI operations, such as sends that +have never been received, etc. + +Collective on `PETSC_COMM_WORLD` + +Input Parameter: +- `fd` - file pointer. If fp is `NULL`, `stdout` is assumed. + +Options Database Key: +- `-mpidump` - Dumps MPI incompleteness during call to PetscFinalize() + +Level: developer + +-seealso: `PetscMallocDump()` + +# External Links +$(_doc_external("Sys/PetscMPIDump")) +""" +function PetscMPIDump(petsclib::PetscLibType, fd::Libc.FILE) end + +@for_petsc function PetscMPIDump(petsclib::$UnionPetscLib, fd::Libc.FILE ) + + @chk ccall( + (:PetscMPIDump, $petsc_library), + PetscErrorCode, + (Ptr{Libc.FILE},), + fd, + ) + + + return nothing +end + +""" + PetscSortIntWithPermutation(petsclib::PetscLibType,n::PetscInt, i::Vector{PetscInt}, idx::Vector{PetscInt}) +Computes the permutation of `PetscInt` that gives +a sorted sequence. + +Not Collective + +Input Parameters: +- `n` - number of values to sort +- `i` - values to sort +- `idx` - permutation array. Must be initialized to 0:`n`-1 on input. + +Level: intermediate + +-seealso: `PetscSortInt()`, `PetscSortRealWithPermutation()`, `PetscSortIntWithArray()` + +# External Links +$(_doc_external("Sys/PetscSortIntWithPermutation")) +""" +function PetscSortIntWithPermutation(petsclib::PetscLibType, n::PetscInt, i::Vector{PetscInt}, idx::Vector{PetscInt}) end + +@for_petsc function PetscSortIntWithPermutation(petsclib::$UnionPetscLib, n::$PetscInt, i::Vector{$PetscInt}, idx::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortIntWithPermutation, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + n, i, idx, + ) + + + return nothing +end + +""" + PetscSortRealWithPermutation(petsclib::PetscLibType,n::PetscInt, i::Vector{PetscReal}, idx::Vector{PetscInt}) +Computes the permutation of `PetscReal` that gives +a sorted sequence. + +Not Collective + +Input Parameters: +- `n` - number of values to sort +- `i` - values to sort +- `idx` - permutation array. Must be initialized to 0:`n`-1 on input. + +Level: intermediate + +-seealso: `PetscSortReal()`, `PetscSortIntWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscSortRealWithPermutation")) +""" +function PetscSortRealWithPermutation(petsclib::PetscLibType, n::PetscInt, i::Vector{PetscReal}, idx::Vector{PetscInt}) end + +@for_petsc function PetscSortRealWithPermutation(petsclib::$UnionPetscLib, n::$PetscInt, i::Vector{$PetscReal}, idx::Vector{$PetscInt} ) + + @chk ccall( + (:PetscSortRealWithPermutation, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscInt}), + n, i, idx, + ) + + + return nothing +end + +""" + PetscSortStrWithPermutation(petsclib::PetscLibType,n::PetscInt, i::Vector{Cchar}, idx::Vector{PetscInt}) +Computes the permutation of strings that gives +a sorted sequence. + +Not Collective, No Fortran Support + +Input Parameters: +- `n` - number of values to sort +- `i` - values to sort +- `idx` - permutation array. Must be initialized to 0:`n`-1 on input. + +Level: intermediate + +-seealso: `PetscSortInt()`, `PetscSortRealWithPermutation()` + +# External Links +$(_doc_external("Sys/PetscSortStrWithPermutation")) +""" +function PetscSortStrWithPermutation(petsclib::PetscLibType, n::PetscInt, i::Vector{Cchar}, idx::Vector{PetscInt}) end + +@for_petsc function PetscSortStrWithPermutation(petsclib::$UnionPetscLib, n::$PetscInt, i::Vector{Cchar}, idx::Vector{$PetscInt} ) + i_ = Ref(pointer(i)) + + @chk ccall( + (:PetscSortStrWithPermutation, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Ptr{Cchar}}, Ptr{$PetscInt}), + n, i_, idx, + ) + + + return nothing +end + +""" + PetscSleep(petsclib::PetscLibType,s::PetscReal) +Sleeps some number of seconds. + +Not Collective + +Input Parameter: +- `s` - number of seconds to sleep + +Level: intermediate + +-seealso: `PetscTime()` + +# External Links +$(_doc_external("Sys/PetscSleep")) +""" +function PetscSleep(petsclib::PetscLibType, s::PetscReal) end + +@for_petsc function PetscSleep(petsclib::$UnionPetscLib, s::$PetscReal ) + + @chk ccall( + (:PetscSleep, $petsc_library), + PetscErrorCode, + ($PetscReal,), + s, + ) + + + return nothing +end + +""" + PetscBarrier(petsclib::PetscLibType,obj::PetscObject) +Blocks until this routine is executed by all processors owning the object `obj`. + +Input Parameter: +- `obj` - PETSc object (`Mat`, `Vec`, `IS`, `SNES` etc...) + +Level: intermediate + +-seealso: `PetscObject`, `MPI_Comm`, `MPI_Barrier` + +# External Links +$(_doc_external("Sys/PetscBarrier")) +""" +function PetscBarrier(petsclib::PetscLibType, obj::PetscObject) end + +@for_petsc function PetscBarrier(petsclib::$UnionPetscLib, obj::PetscObject ) + + @chk ccall( + (:PetscBarrier, $petsc_library), + PetscErrorCode, + (PetscObject,), + obj, + ) + + + return nothing +end + +""" + PetscSequentialPhaseBegin(petsclib::PetscLibType,comm::MPI_Comm, ng::Cint) +Begins a sequential section of code. + +Collective + +Input Parameters: +- `comm` - Communicator to sequentialize over +- `ng` - Number in processor group. This many processes are allowed to execute +at the same time (usually 1) + +Level: intermediate + +-seealso: `PetscSequentialPhaseEnd()`, `PetscSynchronizedPrintf()` + +# External Links +$(_doc_external("Sys/PetscSequentialPhaseBegin")) +""" +function PetscSequentialPhaseBegin(petsclib::PetscLibType, comm::MPI_Comm, ng::Cint) end + +@for_petsc function PetscSequentialPhaseBegin(petsclib::$UnionPetscLib, comm::MPI_Comm, ng::Cint ) + + @chk ccall( + (:PetscSequentialPhaseBegin, $petsc_library), + PetscErrorCode, + (MPI_Comm, Cint), + comm, ng, + ) + + + return nothing +end + +""" + PetscSequentialPhaseEnd(petsclib::PetscLibType,comm::MPI_Comm, ng::Cint) +Ends a sequential section of code. + +Collective + +Input Parameters: +- `comm` - Communicator to sequentialize. +- `ng` - Number in processor group. This many processes are allowed to execute +at the same time (usually 1) + +Level: intermediate + +-seealso: `PetscSequentialPhaseBegin()` + +# External Links +$(_doc_external("Sys/PetscSequentialPhaseEnd")) +""" +function PetscSequentialPhaseEnd(petsclib::PetscLibType, comm::MPI_Comm, ng::Cint) end + +@for_petsc function PetscSequentialPhaseEnd(petsclib::$UnionPetscLib, comm::MPI_Comm, ng::Cint ) + + @chk ccall( + (:PetscSequentialPhaseEnd, $petsc_library), + PetscErrorCode, + (MPI_Comm, Cint), + comm, ng, + ) + + + return nothing +end + +""" + minMaxValGlobal::Vector{PetscInt} = PetscGlobalMinMaxInt(petsclib::PetscLibType,comm::MPI_Comm, minMaxVal::Vector{PetscInt}) +Get the global min/max from local min/max input + +Collective + +Input Parameters: +- `comm` - The MPI communicator to reduce with +- `minMaxVal` - An array with the local min and max + +Output Parameter: +- `minMaxValGlobal` - An array with the global min and max + +Level: beginner + +-seealso: `PetscSplitOwnership()`, `PetscGlobalMinMaxReal()` + +# External Links +$(_doc_external("Sys/PetscGlobalMinMaxInt")) +""" +function PetscGlobalMinMaxInt(petsclib::PetscLibType, comm::MPI_Comm, minMaxVal::Vector{PetscInt}) end + +@for_petsc function PetscGlobalMinMaxInt(petsclib::$UnionPetscLib, comm::MPI_Comm, minMaxVal::Vector{$PetscInt} ) + minMaxValGlobal = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscGlobalMinMaxInt, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{$PetscInt}, Ptr{$PetscInt}), + comm, minMaxVal, minMaxValGlobal, + ) + + + return minMaxValGlobal +end + +""" + minMaxValGlobal::Vector{PetscReal} = PetscGlobalMinMaxReal(petsclib::PetscLibType,comm::MPI_Comm, minMaxVal::Vector{PetscReal}) +Get the global min/max from local min/max input + +Collective + +Input Parameters: +- `comm` - The MPI communicator to reduce with +- `minMaxVal` - An array with the local min and max + +Output Parameter: +- `minMaxValGlobal` - An array with the global min and max + +Level: beginner + +-seealso: `PetscSplitOwnership()`, `PetscGlobalMinMaxInt()` + +# External Links +$(_doc_external("Sys/PetscGlobalMinMaxReal")) +""" +function PetscGlobalMinMaxReal(petsclib::PetscLibType, comm::MPI_Comm, minMaxVal::Vector{PetscReal}) end + +@for_petsc function PetscGlobalMinMaxReal(petsclib::$UnionPetscLib, comm::MPI_Comm, minMaxVal::Vector{$PetscReal} ) + minMaxValGlobal = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscGlobalMinMaxReal, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{$PetscReal}, Ptr{$PetscReal}), + comm, minMaxVal, minMaxValGlobal, + ) + + + return minMaxValGlobal +end + +""" + e::PetscBool = PetscMemcmp(petsclib::PetscLibType,str1::Cvoid, str2::Cvoid, len::Csize_t) +Compares two byte streams in memory. + +Not Collective + +Input Parameters: +- `str1` - Pointer to the first byte stream +- `str2` - Pointer to the second byte stream +- `len` - The length of the byte stream +(both str1 and str2 are assumed to be of length len) + +Output Parameter: +- `e` - `PETSC_TRUE` if equal else `PETSC_FALSE`. + +Level: intermediate + +-seealso: `PetscMemcpy()`, `PetscArrayzero()`, `PetscMemzero()`, `PetscArraycmp()`, `PetscArraycpy()`, `PetscStrallocpy()`, +`PetscArraymove()` + +# External Links +$(_doc_external("Sys/PetscMemcmp")) +""" +function PetscMemcmp(petsclib::PetscLibType, str1::Cvoid, str2::Cvoid, len::Csize_t) end + +@for_petsc function PetscMemcmp(petsclib::$UnionPetscLib, str1::Cvoid, str2::Cvoid, len::Csize_t ) + e_ = Ref{PetscBool}() + + @chk ccall( + (:PetscMemcmp, $petsc_library), + PetscErrorCode, + (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t, Ptr{PetscBool}), + str1, str2, len, e_, + ) + + e = e_[] + + return e +end + +""" + PetscProcessPlacementView(petsclib::PetscLibType,viewer::PetscViewer) +display the MPI rank placement by core + +Input Parameter: +- `viewer` - `PETSCVIEWERASCII` to display the results on + +Level: intermediate + +-seealso: `PetscInitialize()` + +# External Links +$(_doc_external("Sys/PetscProcessPlacementView")) +""" +function PetscProcessPlacementView(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscProcessPlacementView(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscProcessPlacementView, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscGetUserName(petsclib::PetscLibType,name::Vector{Cchar}, nlen::Csize_t) +Returns the name of the user. + +Not Collective + +Input Parameter: +- `nlen` - length of name + +Output Parameter: +- `name` - contains user name. Must be long enough to hold the name + +Level: developer + +-seealso: `PetscGetHostName()` + +# External Links +$(_doc_external("Sys/PetscGetUserName")) +""" +function PetscGetUserName(petsclib::PetscLibType, name::Vector{Cchar}, nlen::Csize_t) end + +@for_petsc function PetscGetUserName(petsclib::$UnionPetscLib, name::Vector{Cchar}, nlen::Csize_t ) + + @chk ccall( + (:PetscGetUserName, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Csize_t), + name, nlen, + ) + + + return nothing +end + +""" + PetscGetDate(petsclib::PetscLibType,date::Vector{Cchar}, len::Csize_t) +Gets the current date. + +Not Collective + +Input Parameter: +- `len` - length of string to hold date + +Output Parameter: +- `date` - the date + +Level: beginner + +-seealso: `PetscGetHostName()` + +# External Links +$(_doc_external("Sys/PetscGetDate")) +""" +function PetscGetDate(petsclib::PetscLibType, date::Vector{Cchar}, len::Csize_t) end + +@for_petsc function PetscGetDate(petsclib::$UnionPetscLib, date::Vector{Cchar}, len::Csize_t ) + + @chk ccall( + (:PetscGetDate, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Csize_t), + date, len, + ) + + + return nothing +end + +""" + PetscGetCPUTime(petsclib::PetscLibType,t::PetscLogDouble) +Returns the CPU time in seconds used by the process. + +Not Collective + +Output Parameter: +- `t` - Time in seconds charged to the process. + +Example: +-seealso: `PetscTime()`, `PetscLogView()` + +# External Links +$(_doc_external("Sys/PetscGetCPUTime")) +""" +function PetscGetCPUTime(petsclib::PetscLibType, t::PetscLogDouble) end + +@for_petsc function PetscGetCPUTime(petsclib::$UnionPetscLib, t::PetscLogDouble ) + + @chk ccall( + (:PetscGetCPUTime, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble},), + t, + ) + + + return nothing +end + +""" + enabled::PetscBool = PetscInfoEnabled(petsclib::PetscLibType,classid::PetscClassId) +Checks whether a given `PetscClassid` is allowed to print using `PetscInfo()` + +Not Collective + +Input Parameter: +- `classid` - `PetscClassid` retrieved from a `PetscObject` e.g. `VEC_CLASSID` + +Output Parameter: +- `enabled` - `PetscBool` indicating whether this classid is allowed to print + +Level: advanced + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoAllow()`, `PetscInfoGetInfo()`, `PetscObjectGetClassid()` + +# External Links +$(_doc_external("Sys/PetscInfoEnabled")) +""" +function PetscInfoEnabled(petsclib::PetscLibType, classid::PetscClassId) end + +@for_petsc function PetscInfoEnabled(petsclib::$UnionPetscLib, classid::PetscClassId ) + enabled_ = Ref{PetscBool}() + + @chk ccall( + (:PetscInfoEnabled, $petsc_library), + PetscErrorCode, + (PetscClassId, Ptr{PetscBool}), + classid, enabled_, + ) + + enabled = enabled_[] + + return enabled +end + +""" + PetscInfoAllow(petsclib::PetscLibType,flag::PetscBool) +Enables/disables `PetscInfo()` messages + +Not Collective + +Input Parameter: +- `flag` - `PETSC_TRUE` or `PETSC_FALSE` + +Level: advanced + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoEnabled()`, `PetscInfoGetInfo()`, `PetscInfoSetFromOptions()` + +# External Links +$(_doc_external("Sys/PetscInfoAllow")) +""" +function PetscInfoAllow(petsclib::PetscLibType, flag::PetscBool) end + +@for_petsc function PetscInfoAllow(petsclib::$UnionPetscLib, flag::PetscBool ) + + @chk ccall( + (:PetscInfoAllow, $petsc_library), + PetscErrorCode, + (PetscBool,), + flag, + ) + + + return nothing +end + +""" + PetscInfoSetFile(petsclib::PetscLibType,filename::Vector{Cchar}, mode::Vector{Cchar}) +Sets the printing destination for all `PetscInfo()` calls + +Not Collective + +Input Parameters: +- `filename` - Name of the file where `PetscInfo()` will print to, use `NULL` to write to `PETSC_STDOUT`. +- `mode` - Write mode passed to `PetscFOpen()` + +Level: advanced + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoGetFile()`, `PetscInfoSetFromOptions()`, `PetscFOpen()` + +# External Links +$(_doc_external("Sys/PetscInfoSetFile")) +""" +function PetscInfoSetFile(petsclib::PetscLibType, filename::Vector{Cchar}, mode::Vector{Cchar}) end + +@for_petsc function PetscInfoSetFile(petsclib::$UnionPetscLib, filename::Vector{Cchar}, mode::Vector{Cchar} ) + + @chk ccall( + (:PetscInfoSetFile, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}), + filename, mode, + ) + + + return nothing +end + +""" + PetscInfoGetFile(petsclib::PetscLibType,filename::Vector{Cchar}, InfoFile::Libc.FILE) +Gets the `filename` and `FILE` pointer of the file where `PetscInfo()` prints to + +Not Collective; No Fortran Support + +Output Parameters: +- `filename` - The name of the output file +- `InfoFile` - The `FILE` pointer for the output file + +Level: advanced + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoSetFile()`, `PetscInfoSetFromOptions()`, `PetscInfoDestroy()` + +# External Links +$(_doc_external("Sys/PetscInfoGetFile")) +""" +function PetscInfoGetFile(petsclib::PetscLibType, filename::Vector{Cchar}, InfoFile::Libc.FILE) end + +@for_petsc function PetscInfoGetFile(petsclib::$UnionPetscLib, filename::Vector{Cchar}, InfoFile::Libc.FILE ) + filename_ = Ref(pointer(filename)) + + @chk ccall( + (:PetscInfoGetFile, $petsc_library), + PetscErrorCode, + (Ptr{Ptr{Cchar}}, Libc.FILE), + filename_, InfoFile, + ) + + + return nothing +end + +""" + PetscInfoSetClasses(petsclib::PetscLibType,exclude::PetscBool, n::PetscInt, classnames::Cchar) +Sets the classes which `PetscInfo()` is filtered for/against + +Not Collective; No Fortran Support + +Input Parameters: +- `exclude` - Whether or not to invert the filter, i.e. if exclude is true, `PetscInfo()` will print from every class that +is NOT one of the classes specified +- `n` - Number of classes to filter for (size of `classnames`) +- `classnames` - String array containing the names of classes to filter for, e.g. "vec" + +Level: developer + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoGetClass()`, `PetscInfoProcessClass()`, `PetscInfoSetFromOptions()`, `PetscStrToArray()`, `PetscObjectGetName()` + +# External Links +$(_doc_external("Sys/PetscInfoSetClasses")) +""" +function PetscInfoSetClasses(petsclib::PetscLibType, exclude::PetscBool, n::PetscInt, classnames::Cchar) end + +@for_petsc function PetscInfoSetClasses(petsclib::$UnionPetscLib, exclude::PetscBool, n::$PetscInt, classnames::Cchar ) + + @chk ccall( + (:PetscInfoSetClasses, $petsc_library), + PetscErrorCode, + (PetscBool, $PetscInt, Cchar), + exclude, n, classnames, + ) + + + return nothing +end + +""" + found::PetscBool = PetscInfoGetClass(petsclib::PetscLibType,classname::Vector{Cchar}) +Indicates whether the provided `classname` is marked as a filter in `PetscInfo()` as set by `PetscInfoSetClasses()` + +Not Collective + +Input Parameter: +- `classname` - Name of the class to search for + +Output Parameter: +- `found` - `PetscBool` indicating whether the classname was found + +Level: developer + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoSetClasses()`, `PetscInfoSetFromOptions()`, `PetscObjectGetName()` + +# External Links +$(_doc_external("Sys/PetscInfoGetClass")) +""" +function PetscInfoGetClass(petsclib::PetscLibType, classname::Vector{Cchar}) end + +@for_petsc function PetscInfoGetClass(petsclib::$UnionPetscLib, classname::Vector{Cchar} ) + found_ = Ref{PetscBool}() + + @chk ccall( + (:PetscInfoGetClass, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscBool}), + classname, found_, + ) + + found = found_[] + + return found +end + +""" + infoEnabled::PetscBool,classesSet::PetscBool,exclude::PetscBool,locked::PetscBool = PetscInfoGetInfo(petsclib::PetscLibType,commSelfFlag::PetscInfoCommFlag) +Returns the current state of several flags for `PetscInfo()` + +Not Collective + +Output Parameters: +- `infoEnabled` - `PETSC_TRUE` if `PetscInfoAllow`(`PETSC_TRUE`) has been called +- `classesSet` - `PETSC_TRUE` if the list of classes to filter for has been set +- `exclude` - `PETSC_TRUE` if the class filtering for `PetscInfo()` is inverted +- `locked` - `PETSC_TRUE` if the list of classes to filter for has been locked +- `commSelfFlag` - Enum indicating whether `PetscInfo()` will print for communicators of size 1, any size != 1, or all +communicators + +Level: developer + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoAllow()`, `PetscInfoSetFilterCommSelf`, `PetscInfoSetFromOptions()` + +# External Links +$(_doc_external("Sys/PetscInfoGetInfo")) +""" +function PetscInfoGetInfo(petsclib::PetscLibType, commSelfFlag::PetscInfoCommFlag) end + +@for_petsc function PetscInfoGetInfo(petsclib::$UnionPetscLib, commSelfFlag::PetscInfoCommFlag ) + infoEnabled_ = Ref{PetscBool}() + classesSet_ = Ref{PetscBool}() + exclude_ = Ref{PetscBool}() + locked_ = Ref{PetscBool}() + + @chk ccall( + (:PetscInfoGetInfo, $petsc_library), + PetscErrorCode, + (Ptr{PetscBool}, Ptr{PetscBool}, Ptr{PetscBool}, Ptr{PetscBool}, Ptr{PetscInfoCommFlag}), + infoEnabled_, classesSet_, exclude_, locked_, commSelfFlag, + ) + + infoEnabled = infoEnabled_[] + classesSet = classesSet_[] + exclude = exclude_[] + locked = locked_[] + + return infoEnabled,classesSet,exclude,locked +end + +""" + PetscInfoProcessClass(petsclib::PetscLibType,classname::Vector{Cchar}, numClassID::PetscInt, classIDs::Vector{PetscClassId}) +Activates or deactivates a class based on the filtering status of `PetscInfo()` + +Not Collective + +Input Parameters: +- `classname` - Name of the class to activate/deactivate `PetscInfo()` for +- `numClassID` - Number of entries in `classIDs` +- `classIDs` - Array containing all of the `PetscClassId`s associated with `classname` + +Options Database Key: +- `-info [filename][:[~][:[~]self]]` - specify which informative messages are printed, see `PetscInfo()`. + +Level: developer + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoActivateClass()`, `PetscInfoDeactivateClass()`, `PetscInfoSetFromOptions()` + +# External Links +$(_doc_external("Sys/PetscInfoProcessClass")) +""" +function PetscInfoProcessClass(petsclib::PetscLibType, classname::Vector{Cchar}, numClassID::PetscInt, classIDs::Vector{PetscClassId}) end + +@for_petsc function PetscInfoProcessClass(petsclib::$UnionPetscLib, classname::Vector{Cchar}, numClassID::$PetscInt, classIDs::Vector{PetscClassId} ) + + @chk ccall( + (:PetscInfoProcessClass, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, $PetscInt, Ptr{PetscClassId}), + classname, numClassID, classIDs, + ) + + + return nothing +end + +""" + PetscInfoSetFilterCommSelf(petsclib::PetscLibType,commSelfFlag::PetscInfoCommFlag) +Sets `PetscInfoCommFlag` enum to determine communicator filtering for `PetscInfo()` + +Not Collective + +Input Parameter: +- `commSelfFlag` - Enum value indicating method with which to filter `PetscInfo()` based on the size of the communicator of the object calling `PetscInfo()` + +Options Database Key: +- `-info [filename][:[~][:[~]self]]` - specify which informative messages are printed, See `PetscInfo()`. + +Level: advanced + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoGetInfo()` + +# External Links +$(_doc_external("Sys/PetscInfoSetFilterCommSelf")) +""" +function PetscInfoSetFilterCommSelf(petsclib::PetscLibType, commSelfFlag::PetscInfoCommFlag) end + +@for_petsc function PetscInfoSetFilterCommSelf(petsclib::$UnionPetscLib, commSelfFlag::PetscInfoCommFlag ) + + @chk ccall( + (:PetscInfoSetFilterCommSelf, $petsc_library), + PetscErrorCode, + (PetscInfoCommFlag,), + commSelfFlag, + ) + + + return nothing +end + +""" + PetscInfoSetFromOptions(petsclib::PetscLibType,options::PetscOptions) +Configure `PetscInfo()` using command line options, enabling or disabling various calls to `PetscInfo()` + +Not Collective + +Input Parameter: +- `options` - Options database, use `NULL` for default global database + +Options Database Key: +- `-info [filename][:[~][:[~]self]]` - specify which informative messages are printed, See `PetscInfo()`. + +Level: advanced + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoAllow()`, `PetscInfoSetFile()`, `PetscInfoSetClasses()`, `PetscInfoSetFilterCommSelf()`, `PetscInfoDestroy()` + +# External Links +$(_doc_external("Sys/PetscInfoSetFromOptions")) +""" +function PetscInfoSetFromOptions(petsclib::PetscLibType, options::PetscOptions) end + +@for_petsc function PetscInfoSetFromOptions(petsclib::$UnionPetscLib, options::PetscOptions ) + + @chk ccall( + (:PetscInfoSetFromOptions, $petsc_library), + PetscErrorCode, + (COptions,), + options, + ) + + return nothing +end + +""" + PetscInfoDestroy(petsclib::PetscLibType) +Destroys and resets internal `PetscInfo()` data structures. + +Not Collective + +Level: developer + +-seealso: [](sec_PetscInfo), `PetscInfo()`, `PetscInfoSetFromOptions()` + +# External Links +$(_doc_external("Sys/PetscInfoDestroy")) +""" +function PetscInfoDestroy(petsclib::PetscLibType) end + +@for_petsc function PetscInfoDestroy(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscInfoDestroy, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscInfoDeactivateClass(petsclib::PetscLibType,classid::PetscClassId) +Deactivates `PetscInfo()` messages for a PETSc object class. + +Not Collective + +Input Parameter: +- `classid` - The object class, e.g., `MAT_CLASSID`, `SNES_CLASSID`, etc. + +Options Database Key: +- `-info [filename][:[~][:[~]self]]` - specify which informative messages are printed, See `PetscInfo()`. + +Level: developer + +-seealso: [](sec_PetscInfo), `PetscInfoActivateClass()`, `PetscInfo()`, `PetscInfoAllow()`, `PetscInfoSetFromOptions()` + +# External Links +$(_doc_external("Sys/PetscInfoDeactivateClass")) +""" +function PetscInfoDeactivateClass(petsclib::PetscLibType, classid::PetscClassId) end + +@for_petsc function PetscInfoDeactivateClass(petsclib::$UnionPetscLib, classid::PetscClassId ) + + @chk ccall( + (:PetscInfoDeactivateClass, $petsc_library), + PetscErrorCode, + (PetscClassId,), + classid, + ) + + + return nothing +end + +""" + PetscInfoActivateClass(petsclib::PetscLibType,classid::PetscClassId) +Activates `PetscInfo()` messages for a PETSc object class. + +Not Collective + +Input Parameter: +- `classid` - The object class, e.g., `MAT_CLASSID`, `SNES_CLASSID`, etc. + +Options Database Key: +- `-info [filename][:[~][:[~]self]]` - specify which informative messages are printed, See `PetscInfo()`. + +Level: developer + +-seealso: [](sec_PetscInfo), `PetscInfoDeactivateClass()`, `PetscInfo()`, `PetscInfoAllow()`, `PetscInfoSetFromOptions()` + +# External Links +$(_doc_external("Sys/PetscInfoActivateClass")) +""" +function PetscInfoActivateClass(petsclib::PetscLibType, classid::PetscClassId) end + +@for_petsc function PetscInfoActivateClass(petsclib::$UnionPetscLib, classid::PetscClassId ) + + @chk ccall( + (:PetscInfoActivateClass, $petsc_library), + PetscErrorCode, + (PetscClassId,), + classid, + ) + + + return nothing +end + +""" + PetscDLOpen(petsclib::PetscLibType,name::Vector{Cchar}, mode::PetscDLMode, handle::PetscDLHandle) +opens a dynamic library + +Not Collective, No Fortran Support + +Input Parameters: +- `name` - name of library +- `mode` - options on how to open library + +Output Parameter: +- `handle` - opaque pointer to be used with `PetscDLSym()` + +Level: developer + +-seealso: `PetscDLClose()`, `PetscDLSym()`, `PetscDLAddr()`, `PetscDLLibrary`, `PetscLoadDynamicLibrary()`, `PetscDLLibraryAppend()`, +`PetscDLLibraryRetrieve()`, `PetscDLLibraryOpen()`, `PetscDLLibraryClose()`, `PetscDLLibrarySym()` + +# External Links +$(_doc_external("Sys/PetscDLOpen")) +""" +function PetscDLOpen(petsclib::PetscLibType, name::Vector{Cchar}, mode::PetscDLMode, handle::PetscDLHandle) end + +@for_petsc function PetscDLOpen(petsclib::$UnionPetscLib, name::Vector{Cchar}, mode::PetscDLMode, handle::PetscDLHandle ) + + @chk ccall( + (:PetscDLOpen, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, PetscDLMode, Ptr{PetscDLHandle}), + name, mode, handle, + ) + + + return nothing +end + +""" + PetscDLClose(petsclib::PetscLibType,handle::PetscDLHandle) +closes a dynamic library + +Not Collective, No Fortran Support + +Input Parameter: +- `handle` - the handle for the library obtained with `PetscDLOpen()` + +Level: developer + +-seealso: `PetscDLOpen()`, `PetscDLSym()`, `PetscDLAddr()` + +# External Links +$(_doc_external("Sys/PetscDLClose")) +""" +function PetscDLClose(petsclib::PetscLibType, handle::PetscDLHandle) end + +@for_petsc function PetscDLClose(petsclib::$UnionPetscLib, handle::PetscDLHandle ) + + @chk ccall( + (:PetscDLClose, $petsc_library), + PetscErrorCode, + (Ptr{PetscDLHandle},), + handle, + ) + + + return nothing +end + +""" + PetscDLSym(petsclib::PetscLibType,handle::PetscDLHandle, symbol::Vector{Cchar}, value::Cvoid) +finds a symbol in a dynamic library + +Not Collective, No Fortran Support + +Input Parameters: +- `handle` - obtained with `PetscDLOpen()` or `NULL` +- `symbol` - name of symbol + +Output Parameter: +- `value` - pointer to the function, `NULL` if not found + +Level: developer + +-seealso: `PetscDLClose()`, `PetscDLOpen()`, `PetscDLAddr()`, `PetscDLLibrary`, `PetscLoadDynamicLibrary()`, `PetscDLLibraryAppend()`, +`PetscDLLibraryRetrieve()`, `PetscDLLibraryOpen()`, `PetscDLLibraryClose()`, `PetscDLLibrarySym()` + +# External Links +$(_doc_external("Sys/PetscDLSym")) +""" +function PetscDLSym(petsclib::PetscLibType, handle::PetscDLHandle, symbol::Vector{Cchar}, value::Cvoid) end + +@for_petsc function PetscDLSym(petsclib::$UnionPetscLib, handle::PetscDLHandle, symbol::Vector{Cchar}, value::Cvoid ) + + @chk ccall( + (:PetscDLSym, $petsc_library), + PetscErrorCode, + (PetscDLHandle, Ptr{Cchar}, Cvoid), + handle, symbol, value, + ) + + + return nothing +end + +""" + PetscDLAddr(petsclib::PetscLibType,func::PetscVoidFn, name::Vector{Cchar}) +find the name of a symbol in a dynamic library + +Not Collective, No Fortran Support + +Input Parameters: +- `func` - pointer to the function, `NULL` if not found + +Output Parameter: +- `name` - name of symbol, or `NULL` if name lookup is not supported. + +Level: developer + +-seealso: `PetscDLClose()`, `PetscDLSym()`, `PetscDLOpen()`, `PetscDLLibrary`, `PetscLoadDynamicLibrary()`, `PetscDLLibraryAppend()`, +`PetscDLLibraryRetrieve()`, `PetscDLLibraryOpen()`, `PetscDLLibraryClose()`, `PetscDLLibrarySym()` + +# External Links +$(_doc_external("Sys/PetscDLAddr")) +""" +function PetscDLAddr(petsclib::PetscLibType, func::PetscVoidFn, name::Vector{Cchar}) end + +@for_petsc function PetscDLAddr(petsclib::$UnionPetscLib, func::PetscVoidFn, name::Vector{Cchar} ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PetscDLAddr, $petsc_library), + PetscErrorCode, + (Ptr{PetscVoidFn}, Ptr{Ptr{Cchar}}), + func, name_, + ) + + + return nothing +end + +""" + PetscDemangleSymbol(petsclib::PetscLibType,mangledName::Vector{Cchar}, name::Cchar) + +# External Links +$(_doc_external("Sys/PetscDemangleSymbol")) +""" +function PetscDemangleSymbol(petsclib::PetscLibType, mangledName::Vector{Cchar}, name::Cchar) end + +@for_petsc function PetscDemangleSymbol(petsclib::$UnionPetscLib, mangledName::Vector{Cchar}, name::Cchar ) + + @chk ccall( + (:PetscDemangleSymbol, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cchar), + mangledName, name, + ) + + + return nothing +end + +""" + PetscErrorPrintfInitialize(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscErrorPrintfInitialize")) +""" +function PetscErrorPrintfInitialize(petsclib::PetscLibType) end + +@for_petsc function PetscErrorPrintfInitialize(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscErrorPrintfInitialize, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscFPTrapPush(petsclib::PetscLibType,trap::PetscFPTrap) +push a floating point trapping mode, restored using `PetscFPTrapPop()` + +Not Collective + +Input Parameter: +- `trap` - `PETSC_FP_TRAP_ON` or `PETSC_FP_TRAP_OFF` or any of the values passable to `PetscSetFPTrap()` + +Level: advanced + +-seealso: `PetscFPTrapPop()`, `PetscSetFPTrap()`, `PetscDetermineInitialFPTrap()` + +# External Links +$(_doc_external("Sys/PetscFPTrapPush")) +""" +function PetscFPTrapPush(petsclib::PetscLibType, trap::PetscFPTrap) end + +@for_petsc function PetscFPTrapPush(petsclib::$UnionPetscLib, trap::PetscFPTrap ) + + @chk ccall( + (:PetscFPTrapPush, $petsc_library), + PetscErrorCode, + (PetscFPTrap,), + trap, + ) + + + return nothing +end + +""" + PetscFPTrapPop(petsclib::PetscLibType) +push a floating point trapping mode, to be restored using `PetscFPTrapPop()` + +Not Collective + +Level: advanced + +-seealso: `PetscFPTrapPush()`, `PetscSetFPTrap()`, `PetscDetermineInitialFPTrap()` + +# External Links +$(_doc_external("Sys/PetscFPTrapPop")) +""" +function PetscFPTrapPop(petsclib::PetscLibType) end + +@for_petsc function PetscFPTrapPop(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscFPTrapPop, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscSetFPTrap(petsclib::PetscLibType,flag::PetscFPTrap) +Enables traps/exceptions on common floating point errors. This option may not work on certain systems or only a +subset of exceptions may be trapable. + +Not Collective + +Input Parameter: +- `flag` - values are +-seealso: `PetscFPTrapPush()`, `PetscFPTrapPop()`, `PetscDetermineInitialFPTrap()` + +# External Links +$(_doc_external("Sys/PetscSetFPTrap")) +""" +function PetscSetFPTrap(petsclib::PetscLibType, flag::PetscFPTrap) end + +@for_petsc function PetscSetFPTrap(petsclib::$UnionPetscLib, flag::PetscFPTrap ) + + @chk ccall( + (:PetscSetFPTrap, $petsc_library), + PetscErrorCode, + (PetscFPTrap,), + flag, + ) + + + return nothing +end + +""" + PetscDetermineInitialFPTrap(petsclib::PetscLibType) +Attempts to determine the floating point trapping that exists when `PetscInitialize()` is called + +Not Collective + +-seealso: `PetscFPTrapPush()`, `PetscFPTrapPop()`, `PetscDetermineInitialFPTrap()` + +# External Links +$(_doc_external("Sys/PetscDetermineInitialFPTrap")) +""" +function PetscDetermineInitialFPTrap(petsclib::PetscLibType) end + +@for_petsc function PetscDetermineInitialFPTrap(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscDetermineInitialFPTrap, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscCheckPointerSetIntensity(petsclib::PetscLibType,intensity::PetscInt) +Set the intensity of debug pointer checks + +Not Collective + +Input Parameter: +- `intensity` - how much to check pointers for validity + +Options Database Key: +- `-check_pointer_intensity` - intensity (0, 1, or 2) + +Level: advanced + +-seealso: `PetscCheckPointer()`, `PetscFunctionBeginHot()` + +# External Links +$(_doc_external("Sys/PetscCheckPointerSetIntensity")) +""" +function PetscCheckPointerSetIntensity(petsclib::PetscLibType, intensity::PetscInt) end + +@for_petsc function PetscCheckPointerSetIntensity(petsclib::$UnionPetscLib, intensity::$PetscInt ) + + @chk ccall( + (:PetscCheckPointerSetIntensity, $petsc_library), + PetscErrorCode, + ($PetscInt,), + intensity, + ) + + + return nothing +end + +""" + PetscSetDebugTerminal(petsclib::PetscLibType,terminal::Vector{Cchar}) +Sets the terminal to use for debugging. + +Not Collective; No Fortran Support + +Input Parameter: +- `terminal` - name of terminal and any flags required to execute a program. +For example "xterm", "urxvt -e", "gnome-terminal -x". +On Apple macOS you can use "Terminal" (note the capital T) + +Options Database Key: +- `-debug_terminal terminal` - use this terminal instead of the default + +Level: developer + +-seealso: `PetscSetDebugger()`, `PetscAttachDebugger()` + +# External Links +$(_doc_external("Sys/PetscSetDebugTerminal")) +""" +function PetscSetDebugTerminal(petsclib::PetscLibType, terminal::Vector{Cchar}) end + +@for_petsc function PetscSetDebugTerminal(petsclib::$UnionPetscLib, terminal::Vector{Cchar} ) + + @chk ccall( + (:PetscSetDebugTerminal, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + terminal, + ) + + + return nothing +end + +""" + PetscSetDebugger(petsclib::PetscLibType,debugger::Vector{Cchar}, usedebugterminal::PetscBool) +Sets options associated with the debugger. + +Not Collective; No Fortran Support + +Input Parameters: +- `debugger` - name of debugger, which should be in your path, +usually "lldb", "dbx", "gdb", "cuda-gdb", "idb", "xxgdb", "kdgb" or "ddd". Also, HP-UX +supports "xdb", and IBM rs6000 supports "xldb". + +- `usedebugterminal` - flag to indicate debugger window, set to either `PETSC_TRUE` (to indicate +debugger should be started in a new terminal window) or `PETSC_FALSE` (to start debugger +in initial window (the option `PETSC_FALSE` makes no sense when using more +than one MPI process.) + +Level: developer + +-seealso: `PetscAttachDebugger()`, `PetscAttachDebuggerErrorHandler()`, `PetscSetDebugTerminal()` + +# External Links +$(_doc_external("Sys/PetscSetDebugger")) +""" +function PetscSetDebugger(petsclib::PetscLibType, debugger::Vector{Cchar}, usedebugterminal::PetscBool) end + +@for_petsc function PetscSetDebugger(petsclib::$UnionPetscLib, debugger::Vector{Cchar}, usedebugterminal::PetscBool ) + + @chk ccall( + (:PetscSetDebugger, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, PetscBool), + debugger, usedebugterminal, + ) + + + return nothing +end + +""" + PetscSetDefaultDebugger(petsclib::PetscLibType) +Causes PETSc to use its default debugger and output terminal + +Not Collective, No Fortran Support + +Level: developer + +-seealso: `PetscSetDebugger()`, `PetscSetDebuggerFromString()`, `PetscAttachDebugger()` + +# External Links +$(_doc_external("Sys/PetscSetDefaultDebugger")) +""" +function PetscSetDefaultDebugger(petsclib::PetscLibType) end + +@for_petsc function PetscSetDefaultDebugger(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscSetDefaultDebugger, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscSetDebuggerFromString(petsclib::PetscLibType,string::Vector{Cchar}) +Set the complete path for the +debugger for PETSc to use. + +Not Collective + +Input Parameter: +- `string` - the name of the debugger, for example "gdb" + +Level: developer + +-seealso: `PetscSetDebugger()`, `PetscSetDefaultDebugger()`, `PetscAttachDebugger()` + +# External Links +$(_doc_external("Sys/PetscSetDebuggerFromString")) +""" +function PetscSetDebuggerFromString(petsclib::PetscLibType, string::Vector{Cchar}) end + +@for_petsc function PetscSetDebuggerFromString(petsclib::$UnionPetscLib, string::Vector{Cchar} ) + + @chk ccall( + (:PetscSetDebuggerFromString, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + string, + ) + + + return nothing +end + +""" + PetscWaitOnError(petsclib::PetscLibType) +If an error is detected and the process would normally exit the main program with `MPI_Abort()` sleep instead +of exiting. + +Not Collective + +Level: advanced + +-seealso: `PetscSetDebugger()`, `PetscAttachDebugger()` + +# External Links +$(_doc_external("Sys/PetscWaitOnError")) +""" +function PetscWaitOnError(petsclib::PetscLibType) end + +@for_petsc function PetscWaitOnError(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscWaitOnError, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscAttachDebugger(petsclib::PetscLibType) +Attaches the debugger to the running process. + +Not Collective + +Options Database Keys: +- `-start_in_debugger [noxterm,lldb or gdb]` - Set debugger debug_terminal xterm or Terminal (for Apple) +- `-display name` - XDisplay to open xterm in +- `-debugger_ranks m,n` - Which MPI ranks on which to start the debugger, defaults to all +- `-stop_for_debugger` - Print a message on how to attach the process with a debugger and then wait for the user to attach +- `-debugger_pause ` - Wait before attaching the debugger. This is useful for slow connections +that take a long time for the Terminal window or xterm to start up. + +Level: advanced + +-seealso: `PetscSetDebugger()`, `PetscSetDefaultDebugger()`, `PetscSetDebugTerminal()`, `PetscAttachDebuggerErrorHandler()`, `PetscStopForDebugger()` + +# External Links +$(_doc_external("Sys/PetscAttachDebugger")) +""" +function PetscAttachDebugger(petsclib::PetscLibType) end + +@for_petsc function PetscAttachDebugger(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscAttachDebugger, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscStopForDebugger(petsclib::PetscLibType) +Prints a message to the screen indicating how to +attach to the process with the debugger and then waits for the +debugger to attach. + +Not Collective, No Fortran Support + +Options Database Key: +- `-stop_for_debugger` - will stop for you to attach the debugger when `PetscInitialize()` is called + +Level: developer + +-seealso: `PetscSetDebugger()`, `PetscAttachDebugger()` + +# External Links +$(_doc_external("Sys/PetscStopForDebugger")) +""" +function PetscStopForDebugger(petsclib::PetscLibType) end + +@for_petsc function PetscStopForDebugger(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscStopForDebugger, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscPushErrorHandler(petsclib::PetscLibType,handler::external, ctx::Cvoid) +Sets a routine to be called on detection of errors. + +Not Collective, No Fortran Support + +Input Parameters: +- `handler` - error handler routine +- `ctx` - optional handler context that contains information needed by the handler (for +example file pointers for error messages etc.) + +Calling sequence of `handler`: +- `comm` - communicator over which error occurred +- `line` - the line number of the error (usually indicated by `__LINE__` in the calling routine) +- `file` - the file in which the error was detected (usually indicated by `__FILE__` in the calling routine) +- `fun` - the function name of the calling routine +- `n` - the generic error number (see list defined in include/petscerror.h) +- `p` - `PETSC_ERROR_INITIAL` if error just detected, otherwise `PETSC_ERROR_REPEAT` +- `mess` - an error text string, usually just printed to the screen +- `ctx` - the error handler context + +Options Database Keys: +- `-on_error_attach_debugger ` - starts up the debugger if an error occurs +- `-on_error_abort` - aborts the program if an error occurs + +Level: intermediate + +-seealso: `PetscPopErrorHandler()`, `PetscAttachDebuggerErrorHandler()`, `PetscAbortErrorHandler()`, `PetscTraceBackErrorHandler()`, `PetscPushSignalHandler()`, +`PetscErrorType`, `PETSC_ERROR_INITIAL`, `PETSC_ERROR_REPEAT`, `PetscErrorCode` + +# External Links +$(_doc_external("Sys/PetscPushErrorHandler")) +""" +function PetscPushErrorHandler(petsclib::PetscLibType, handler::external, ctx::Cvoid) end + +@for_petsc function PetscPushErrorHandler(petsclib::$UnionPetscLib, handler::external, ctx::Cvoid ) + + @chk ccall( + (:PetscPushErrorHandler, $petsc_library), + PetscErrorCode, + (external, Ptr{Cvoid}), + handler, ctx, + ) + + + return nothing +end + +""" + PetscPopErrorHandler(petsclib::PetscLibType) +Removes the latest error handler that was +pushed with `PetscPushErrorHandler()`. + +Not Collective + +Level: intermediate + +-seealso: `PetscPushErrorHandler()` + +# External Links +$(_doc_external("Sys/PetscPopErrorHandler")) +""" +function PetscPopErrorHandler(petsclib::PetscLibType) end + +@for_petsc function PetscPopErrorHandler(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscPopErrorHandler, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscIntViewNumColumns(petsclib::PetscLibType,N::PetscInt, Ncol::PetscInt, idx::Vector{PetscInt}, viewer::PetscViewer) +Prints an array of integers; useful for debugging. + +Collective + +Input Parameters: +- `N` - number of integers in array +- `Ncol` - number of integers to print per row +- `idx` - array of integers +- `viewer` - location to print array, `PETSC_VIEWER_STDOUT_WORLD`, `PETSC_VIEWER_STDOUT_SELF` or 0 + +Level: intermediate + +-seealso: `PetscViewer`, `PetscIntView()`, `PetscRealView()` + +# External Links +$(_doc_external("Sys/PetscIntViewNumColumns")) +""" +function PetscIntViewNumColumns(petsclib::PetscLibType, N::PetscInt, Ncol::PetscInt, idx::Vector{PetscInt}, viewer::PetscViewer) end + +@for_petsc function PetscIntViewNumColumns(petsclib::$UnionPetscLib, N::$PetscInt, Ncol::$PetscInt, idx::Vector{$PetscInt}, viewer::PetscViewer ) + + @chk ccall( + (:PetscIntViewNumColumns, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscInt}, PetscViewer), + N, Ncol, idx, viewer, + ) + + + return nothing +end + +""" + PetscRealViewNumColumns(petsclib::PetscLibType,N::PetscInt, Ncol::PetscInt, idx::Vector{PetscReal}, viewer::PetscViewer) +Prints an array of doubles; useful for debugging. + +Collective + +Input Parameters: +- `N` - number of `PetscReal` in array +- `Ncol` - number of `PetscReal` to print per row +- `idx` - array of `PetscReal` +- `viewer` - location to print array, `PETSC_VIEWER_STDOUT_WORLD`, `PETSC_VIEWER_STDOUT_SELF` or 0 + +Level: intermediate + +-seealso: `PetscViewer`, `PetscRealView()`, `PetscIntView()` + +# External Links +$(_doc_external("Sys/PetscRealViewNumColumns")) +""" +function PetscRealViewNumColumns(petsclib::PetscLibType, N::PetscInt, Ncol::PetscInt, idx::Vector{PetscReal}, viewer::PetscViewer) end + +@for_petsc function PetscRealViewNumColumns(petsclib::$UnionPetscLib, N::$PetscInt, Ncol::$PetscInt, idx::Vector{$PetscReal}, viewer::PetscViewer ) + + @chk ccall( + (:PetscRealViewNumColumns, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, PetscViewer), + N, Ncol, idx, viewer, + ) + + + return nothing +end + +""" + PetscScalarViewNumColumns(petsclib::PetscLibType,N::PetscInt, Ncol::PetscInt, idx::Vector{PetscScalar}, viewer::PetscViewer) +Prints an array of doubles; useful for debugging. + +Collective + +Input Parameters: +- `N` - number of `PetscScalar` in array +- `Ncol` - number of `PetscScalar` to print per row +- `idx` - array of `PetscScalar` +- `viewer` - location to print array, `PETSC_VIEWER_STDOUT_WORLD`, `PETSC_VIEWER_STDOUT_SELF` or 0 + +Level: intermediate + +-seealso: `PetscViewer`, `PetscRealView()`, `PetscScalarView()`, `PetscIntView()` + +# External Links +$(_doc_external("Sys/PetscScalarViewNumColumns")) +""" +function PetscScalarViewNumColumns(petsclib::PetscLibType, N::PetscInt, Ncol::PetscInt, idx::Vector{PetscScalar}, viewer::PetscViewer) end + +@for_petsc function PetscScalarViewNumColumns(petsclib::$UnionPetscLib, N::$PetscInt, Ncol::$PetscInt, idx::Vector{$PetscScalar}, viewer::PetscViewer ) + + @chk ccall( + (:PetscScalarViewNumColumns, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscScalar}, PetscViewer), + N, Ncol, idx, viewer, + ) + + + return nothing +end + +""" + PetscIntView(petsclib::PetscLibType,N::PetscInt, idx::Vector{PetscInt}, viewer::PetscViewer) +Prints an array of integers; useful for debugging. + +Collective + +Input Parameters: +- `N` - number of integers in array +- `idx` - array of integers +- `viewer` - location to print array, `PETSC_VIEWER_STDOUT_WORLD`, `PETSC_VIEWER_STDOUT_SELF` or 0 + +Level: intermediate + +-seealso: `PetscViewer`, `PetscIntViewNumColumns()`, `PetscRealView()` + +# External Links +$(_doc_external("Sys/PetscIntView")) +""" +function PetscIntView(petsclib::PetscLibType, N::PetscInt, idx::Vector{PetscInt}, viewer::PetscViewer) end + +@for_petsc function PetscIntView(petsclib::$UnionPetscLib, N::$PetscInt, idx::Vector{$PetscInt}, viewer::PetscViewer ) + + @chk ccall( + (:PetscIntView, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscInt}, PetscViewer), + N, idx, viewer, + ) + + + return nothing +end + +""" + PetscRealView(petsclib::PetscLibType,N::PetscInt, idx::Vector{PetscReal}, viewer::PetscViewer) +Prints an array of doubles; useful for debugging. + +Collective + +Input Parameters: +- `N` - number of `PetscReal` in array +- `idx` - array of `PetscReal` +- `viewer` - location to print array, `PETSC_VIEWER_STDOUT_WORLD`, `PETSC_VIEWER_STDOUT_SELF` or 0 + +Level: intermediate + +-seealso: `PetscViewer`, `PetscIntView()` + +# External Links +$(_doc_external("Sys/PetscRealView")) +""" +function PetscRealView(petsclib::PetscLibType, N::PetscInt, idx::Vector{PetscReal}, viewer::PetscViewer) end + +@for_petsc function PetscRealView(petsclib::$UnionPetscLib, N::$PetscInt, idx::Vector{$PetscReal}, viewer::PetscViewer ) + + @chk ccall( + (:PetscRealView, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, PetscViewer), + N, idx, viewer, + ) + + + return nothing +end + +""" + PetscScalarView(petsclib::PetscLibType,N::PetscInt, idx::Vector{PetscScalar}, viewer::PetscViewer) +Prints an array of `PetscScalar`; useful for debugging. + +Collective + +Input Parameters: +- `N` - number of scalars in array +- `idx` - array of scalars +- `viewer` - location to print array, `PETSC_VIEWER_STDOUT_WORLD`, `PETSC_VIEWER_STDOUT_SELF` or 0 + +Level: intermediate + +-seealso: `PetscViewer`, `PetscIntView()`, `PetscRealView()` + +# External Links +$(_doc_external("Sys/PetscScalarView")) +""" +function PetscScalarView(petsclib::PetscLibType, N::PetscInt, idx::Vector{PetscScalar}, viewer::PetscViewer) end + +@for_petsc function PetscScalarView(petsclib::$UnionPetscLib, N::$PetscInt, idx::Vector{$PetscScalar}, viewer::PetscViewer ) + + @chk ccall( + (:PetscScalarView, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscScalar}, PetscViewer), + N, idx, viewer, + ) + + + return nothing +end + +""" + PetscSignalHandlerDefault(petsclib::PetscLibType,sig::Cint, ptr::Cvoid) +Default signal handler. + +Not Collective + +Input Parameters: +- `sig` - signal value +- `ptr` - unused pointer + +Level: advanced + +-seealso: [](sec_errors), `PetscPushSignalHandler()` + +# External Links +$(_doc_external("Sys/PetscSignalHandlerDefault")) +""" +function PetscSignalHandlerDefault(petsclib::PetscLibType, sig::Cint, ptr::Cvoid) end + +@for_petsc function PetscSignalHandlerDefault(petsclib::$UnionPetscLib, sig::Cint, ptr::Cvoid ) + + @chk ccall( + (:PetscSignalHandlerDefault, $petsc_library), + PetscErrorCode, + (Cint, Ptr{Cvoid}), + sig, ptr, + ) + + + return nothing +end + +""" + PetscPushSignalHandler(petsclib::PetscLibType,routine::external, ctx::Cvoid) +Catches the usual fatal errors and +calls a user-provided routine. + +Not Collective, No Fortran Support + +Input Parameters: +- `routine` - routine to call when a signal is received +- `ctx` - optional context needed by the routine + +Level: developer + +-seealso: [](sec_errors), `PetscPopSignalHandler()`, `PetscSignalHandlerDefault()`, `PetscPushErrorHandler()` + +# External Links +$(_doc_external("Sys/PetscPushSignalHandler")) +""" +function PetscPushSignalHandler(petsclib::PetscLibType, routine::external, ctx::Cvoid) end + +@for_petsc function PetscPushSignalHandler(petsclib::$UnionPetscLib, routine::external, ctx::Cvoid ) + + @chk ccall( + (:PetscPushSignalHandler, $petsc_library), + PetscErrorCode, + (external, Ptr{Cvoid}), + routine, ctx, + ) + + + return nothing +end + +""" + PetscPopSignalHandler(petsclib::PetscLibType) +Removes the last signal handler that was pushed. +If no signal handlers are left on the stack it will remove the PETSc signal handler. +(That is PETSc will no longer catch signals). + +Not Collective + +Level: developer + +-seealso: [](sec_errors), `PetscPushSignalHandler()` + +# External Links +$(_doc_external("Sys/PetscPopSignalHandler")) +""" +function PetscPopSignalHandler(petsclib::PetscLibType) end + +@for_petsc function PetscPopSignalHandler(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscPopSignalHandler, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscAddLogDouble(petsclib::PetscLibType,tot::PetscLogDouble, tot_th::PetscLogDouble, tmp::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscAddLogDouble")) +""" +function PetscAddLogDouble(petsclib::PetscLibType, tot::PetscLogDouble, tot_th::PetscLogDouble, tmp::PetscLogDouble) end + +@for_petsc function PetscAddLogDouble(petsclib::$UnionPetscLib, tot::PetscLogDouble, tot_th::PetscLogDouble, tmp::PetscLogDouble ) + + @chk ccall( + (:PetscAddLogDouble, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble}, Ptr{PetscLogDouble}, PetscLogDouble), + tot, tot_th, tmp, + ) + + + return nothing +end + +""" + PetscAddLogDoubleCnt(petsclib::PetscLibType,cnt::PetscLogDouble, tot::PetscLogDouble, cnt_th::PetscLogDouble, tot_th::PetscLogDouble, tmp::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscAddLogDoubleCnt")) +""" +function PetscAddLogDoubleCnt(petsclib::PetscLibType, cnt::PetscLogDouble, tot::PetscLogDouble, cnt_th::PetscLogDouble, tot_th::PetscLogDouble, tmp::PetscLogDouble) end + +@for_petsc function PetscAddLogDoubleCnt(petsclib::$UnionPetscLib, cnt::PetscLogDouble, tot::PetscLogDouble, cnt_th::PetscLogDouble, tot_th::PetscLogDouble, tmp::PetscLogDouble ) + + @chk ccall( + (:PetscAddLogDoubleCnt, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble}, Ptr{PetscLogDouble}, Ptr{PetscLogDouble}, Ptr{PetscLogDouble}, PetscLogDouble), + cnt, tot, cnt_th, tot_th, tmp, + ) + + + return nothing +end + +""" + PetscLogGetDefaultHandler(petsclib::PetscLibType,handler::PetscLogHandler) +Get the default log handler if it is running. + +Not collective + +Output Parameter: +- `handler` - the default `PetscLogHandler`, or `NULL` if it is not running. + +Level: developer + +-seealso: [](ch_profiling) + +# External Links +$(_doc_external("Sys/PetscLogGetDefaultHandler")) +""" +function PetscLogGetDefaultHandler(petsclib::PetscLibType, handler::PetscLogHandler) end + +@for_petsc function PetscLogGetDefaultHandler(petsclib::$UnionPetscLib, handler::PetscLogHandler ) + + @chk ccall( + (:PetscLogGetDefaultHandler, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogHandler},), + handler, + ) + + + return nothing +end + +""" + PetscLogGetState(petsclib::PetscLibType,state::PetscLogState) +Get the `PetscLogState` for PETSc's global logging, used +by all default log handlers (`PetscLogDefaultBegin()`, +`PetscLogNestedBegin()`, `PetscLogTraceBegin()`, `PetscLogMPEBegin()`, +`PetscLogPerfstubsBegin()`). + +Collective on `PETSC_COMM_WORLD` + +Output Parameter: +- `state` - The `PetscLogState` changed by registrations (such as +`PetscLogEventRegister()`) and actions (such as `PetscLogEventBegin()` or +`PetscLogStagePush()`), or `NULL` if logging is not active + +Level: developer + +-seealso: [](ch_profiling), `PetscLogState` + +# External Links +$(_doc_external("Sys/PetscLogGetState")) +""" +function PetscLogGetState(petsclib::PetscLibType, state::PetscLogState) end + +@for_petsc function PetscLogGetState(petsclib::$UnionPetscLib, state::PetscLogState ) + + @chk ccall( + (:PetscLogGetState, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogState},), + state, + ) + + + return nothing +end + +""" + isActive::PetscBool = PetscLogIsActive(petsclib::PetscLibType) +Check if logging (profiling) is currently in progress. + +Not Collective + +Output Parameter: +- `isActive` - `PETSC_TRUE` if logging is in progress, `PETSC_FALSE` otherwise + +Level: beginner + +-seealso: [](ch_profiling), `PetscLogDefaultBegin()` + +# External Links +$(_doc_external("Sys/PetscLogIsActive")) +""" +function PetscLogIsActive(petsclib::PetscLibType) end + +@for_petsc function PetscLogIsActive(petsclib::$UnionPetscLib) + isActive_ = Ref{PetscBool}() + + @chk ccall( + (:PetscLogIsActive, $petsc_library), + PetscErrorCode, + (Ptr{PetscBool},), + isActive_, + ) + + isActive = isActive_[] + + return isActive +end + +""" + PetscLogDefaultBegin(petsclib::PetscLibType) +Turns on logging (profiling) of PETSc code using the default log handler (profiler). This logs time, flop +rates, and object creation and should not slow programs down too much. + +Logically Collective on `PETSC_COMM_WORLD` + +Options Database Key: +- `-log_view [viewertype:filename:viewerformat]` - Prints summary of flop and timing (profiling) information to the +screen (for PETSc configured with `--with-log=1` (which is the default)). +This option must be provided before `PetscInitialize()`. + +-seealso: [](ch_profiling), `PetscLogDump()`, `PetscLogView()`, `PetscLogTraceBegin()` + +# External Links +$(_doc_external("Sys/PetscLogDefaultBegin")) +""" +function PetscLogDefaultBegin(petsclib::PetscLibType) end + +@for_petsc function PetscLogDefaultBegin(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogDefaultBegin, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscLogTraceBegin(petsclib::PetscLibType,file::Libc.FILE) +Begins trace logging. Every time a PETSc event +begins or ends, the event name is printed. + +Logically Collective on `PETSC_COMM_WORLD`, No Fortran Support + +Input Parameter: +- `file` - The file to print trace in (e.g. stdout) + +Options Database Key: +- `-log_trace [filename]` - Begins `PetscLogTraceBegin()` + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogDump()`, `PetscLogView()`, `PetscLogDefaultBegin()` + +# External Links +$(_doc_external("Sys/PetscLogTraceBegin")) +""" +function PetscLogTraceBegin(petsclib::PetscLibType, file::Libc.FILE) end + +@for_petsc function PetscLogTraceBegin(petsclib::$UnionPetscLib, file::Libc.FILE ) + + @chk ccall( + (:PetscLogTraceBegin, $petsc_library), + PetscErrorCode, + (Ptr{Libc.FILE},), + file, + ) + + + return nothing +end + +""" + PetscLogNestedBegin(petsclib::PetscLibType) +Turns on nested logging of objects and events. This logs flop +rates and object creation and should not slow programs down too much. + +Logically Collective on `PETSC_COMM_WORLD`, No Fortran Support + +Options Database Keys: +- `-log_view :filename.xml:ascii_xml` - Prints an XML summary of flop and timing information to the file + +-seealso: `PetscLogDump()`, `PetscLogView()`, `PetscLogTraceBegin()`, `PetscLogDefaultBegin()` + +# External Links +$(_doc_external("Sys/PetscLogNestedBegin")) +""" +function PetscLogNestedBegin(petsclib::PetscLibType) end + +@for_petsc function PetscLogNestedBegin(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogNestedBegin, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscLogLegacyCallbacksBegin(petsclib::PetscLibType,PetscLogPLB::external, PetscLogPLE::external, PetscLogPHC::external, PetscLogPHD::external) +Create and start a log handler from callbacks +matching the now deprecated function pointers `PetscLogPLB`, `PetscLogPLE`, +`PetscLogPHC`, `PetscLogPHD`. + +Logically Collective on `PETSC_COMM_WORLD` + +Input Parameters: +- `PetscLogPLB` - A callback that will be executed by `PetscLogEventBegin()` (or `NULL`) +- `PetscLogPLE` - A callback that will be executed by `PetscLogEventEnd()` (or `NULL`) +- `PetscLogPHC` - A callback that will be executed by `PetscLogObjectCreate()` (or `NULL`) +- `PetscLogPHD` - A callback that will be executed by `PetscLogObjectCreate()` (or `NULL`) + +Calling sequence of `PetscLogPLB`: +- `e` - a `PetscLogEvent` that is beginning +- `_i` - deprecated, unused +- `o1` - a `PetscObject` associated with `e` (or `NULL`) +- `o2` - a `PetscObject` associated with `e` (or `NULL`) +- `o3` - a `PetscObject` associated with `e` (or `NULL`) +- `o4` - a `PetscObject` associated with `e` (or `NULL`) + +Calling sequence of `PetscLogPLE`: +- `e` - a `PetscLogEvent` that is beginning +- `_i` - deprecated, unused +- `o1` - a `PetscObject` associated with `e` (or `NULL`) +- `o2` - a `PetscObject` associated with `e` (or `NULL`) +- `o3` - a `PetscObject` associated with `e` (or `NULL`) +- `o4` - a `PetscObject` associated with `e` (or `NULL`) + +Calling sequence of `PetscLogPHC`: +- `o` - a `PetscObject` that has just been created + +Calling sequence of `PetscLogPHD`: +- `o` - a `PetscObject` that is about to be destroyed + +Level: advanced + +-seealso: [](ch_profiling), `PetscLogHandler`, `PetscLogHandlerStart()`, `PetscLogState` + +# External Links +$(_doc_external("Sys/PetscLogLegacyCallbacksBegin")) +""" +function PetscLogLegacyCallbacksBegin(petsclib::PetscLibType, PetscLogPLB::external, PetscLogPLE::external, PetscLogPHC::external, PetscLogPHD::external) end + +@for_petsc function PetscLogLegacyCallbacksBegin(petsclib::$UnionPetscLib, PetscLogPLB::external, PetscLogPLE::external, PetscLogPHC::external, PetscLogPHD::external ) + + @chk ccall( + (:PetscLogLegacyCallbacksBegin, $petsc_library), + PetscErrorCode, + (external, external, external, external), + PetscLogPLB, PetscLogPLE, PetscLogPHC, PetscLogPHD, + ) + + + return nothing +end + +""" + PetscLogMPEBegin(petsclib::PetscLibType) +Turns on MPE logging of events. This creates large log files and slows the +program down. + +Collective on `PETSC_COMM_WORLD`, No Fortran Support + +Options Database Key: +- `-log_mpe` - Prints extensive log information + +Level: advanced + +-seealso: [](ch_profiling), `PetscLogDump()`, `PetscLogDefaultBegin()`, `PetscLogEventActivate()`, +`PetscLogEventDeactivate()` + +# External Links +$(_doc_external("Sys/PetscLogMPEBegin")) +""" +function PetscLogMPEBegin(petsclib::PetscLibType) end + +@for_petsc function PetscLogMPEBegin(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogMPEBegin, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscLogPerfstubsBegin(petsclib::PetscLibType) +Turns on logging of events using the perfstubs interface. + +Collective on `PETSC_COMM_WORLD`, No Fortran Support + +Options Database Key: +- `-log_perfstubs` - use an external log handler through the perfstubs interface + +Level: advanced + +-seealso: [](ch_profiling), `PetscLogDefaultBegin()`, `PetscLogEventActivate()` + +# External Links +$(_doc_external("Sys/PetscLogPerfstubsBegin")) +""" +function PetscLogPerfstubsBegin(petsclib::PetscLibType) end + +@for_petsc function PetscLogPerfstubsBegin(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogPerfstubsBegin, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscLogActions(petsclib::PetscLibType,flag::PetscBool) +Determines whether actions are logged for the default log handler. + +Not Collective + +Input Parameter: +- `flag` - `PETSC_TRUE` if actions are to be logged + +Options Database Key: +- `-log_exclude_actions` - (deprecated) Does nothing +- `-log_include_actions` - Turn on action logging + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogActions")) +""" +function PetscLogActions(petsclib::PetscLibType, flag::PetscBool) end + +@for_petsc function PetscLogActions(petsclib::$UnionPetscLib, flag::PetscBool ) + + @chk ccall( + (:PetscLogActions, $petsc_library), + PetscErrorCode, + (PetscBool,), + flag, + ) + + + return nothing +end + +""" + PetscLogObjects(petsclib::PetscLibType,flag::PetscBool) +Determines whether objects are logged for the graphical viewer. + +Not Collective + +Input Parameter: +- `flag` - `PETSC_TRUE` if objects are to be logged + +Options Database Key: +- `-log_exclude_objects` - (deprecated) Does nothing +- `-log_include_objects` - Turns on object logging + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogObjects")) +""" +function PetscLogObjects(petsclib::PetscLibType, flag::PetscBool) end + +@for_petsc function PetscLogObjects(petsclib::$UnionPetscLib, flag::PetscBool ) + + @chk ccall( + (:PetscLogObjects, $petsc_library), + PetscErrorCode, + (PetscBool,), + flag, + ) + + + return nothing +end + +""" + PetscLogStageRegister(petsclib::PetscLibType,sname::Vector{Cchar}, stage::PetscLogStage) +Attaches a character string name to a logging stage. + +Not Collective + +Input Parameter: +- `sname` - The name to associate with that stage + +Output Parameter: +- `stage` - The stage number or -1 if logging is not active (`PetscLogIsActive()`). + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogStagePush()`, `PetscLogStagePop()` + +# External Links +$(_doc_external("Sys/PetscLogStageRegister")) +""" +function PetscLogStageRegister(petsclib::PetscLibType, sname::Vector{Cchar}, stage::PetscLogStage) end + +@for_petsc function PetscLogStageRegister(petsclib::$UnionPetscLib, sname::Vector{Cchar}, stage::PetscLogStage ) + + @chk ccall( + (:PetscLogStageRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscLogStage}), + sname, stage, + ) + + + return nothing +end + +""" + PetscLogStagePush(petsclib::PetscLibType,stage::PetscLogStage) +This function pushes a stage on the logging stack. Events started and stopped until `PetscLogStagePop()` will be associated with the stage + +Not Collective + +Input Parameter: +- `stage` - The stage on which to log + +-seealso: [](ch_profiling), `PetscLogStagePop()`, `PetscLogStageRegister()`, `PetscBarrier()` + +# External Links +$(_doc_external("Sys/PetscLogStagePush")) +""" +function PetscLogStagePush(petsclib::PetscLibType, stage::PetscLogStage) end + +@for_petsc function PetscLogStagePush(petsclib::$UnionPetscLib, stage::PetscLogStage ) + + @chk ccall( + (:PetscLogStagePush, $petsc_library), + PetscErrorCode, + (PetscLogStage,), + stage, + ) + + + return nothing +end + +""" + PetscLogStagePop(petsclib::PetscLibType) +This function pops a stage from the logging stack that was pushed with `PetscLogStagePush()` + +Not Collective + +-seealso: [](ch_profiling), `PetscLogStagePush()`, `PetscLogStageRegister()`, `PetscBarrier()` + +# External Links +$(_doc_external("Sys/PetscLogStagePop")) +""" +function PetscLogStagePop(petsclib::PetscLibType) end + +@for_petsc function PetscLogStagePop(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogStagePop, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscLogStageSetActive(petsclib::PetscLibType,stage::PetscLogStage, isActive::PetscBool) +Sets if a stage is used for `PetscLogEventBegin()` and `PetscLogEventEnd()`. + +Not Collective + +Input Parameters: +- `stage` - The stage +- `isActive` - The activity flag, `PETSC_TRUE` for logging, else `PETSC_FALSE` (defaults to `PETSC_TRUE`) + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogStageRegister()`, `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscPreLoadBegin()`, `PetscPreLoadEnd()`, `PetscPreLoadStage()` + +# External Links +$(_doc_external("Sys/PetscLogStageSetActive")) +""" +function PetscLogStageSetActive(petsclib::PetscLibType, stage::PetscLogStage, isActive::PetscBool) end + +@for_petsc function PetscLogStageSetActive(petsclib::$UnionPetscLib, stage::PetscLogStage, isActive::PetscBool ) + + @chk ccall( + (:PetscLogStageSetActive, $petsc_library), + PetscErrorCode, + (PetscLogStage, PetscBool), + stage, isActive, + ) + + + return nothing +end + +""" + isActive::PetscBool = PetscLogStageGetActive(petsclib::PetscLibType,stage::PetscLogStage) +Checks if a stage is used for `PetscLogEventBegin()` and `PetscLogEventEnd()`. + +Not Collective + +Input Parameter: +- `stage` - The stage + +Output Parameter: +- `isActive` - The activity flag, `PETSC_TRUE` for logging, else `PETSC_FALSE` (defaults to `PETSC_TRUE`) + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogStageRegister()`, `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscPreLoadBegin()`, `PetscPreLoadEnd()`, `PetscPreLoadStage()` + +# External Links +$(_doc_external("Sys/PetscLogStageGetActive")) +""" +function PetscLogStageGetActive(petsclib::PetscLibType, stage::PetscLogStage) end + +@for_petsc function PetscLogStageGetActive(petsclib::$UnionPetscLib, stage::PetscLogStage ) + isActive_ = Ref{PetscBool}() + + @chk ccall( + (:PetscLogStageGetActive, $petsc_library), + PetscErrorCode, + (PetscLogStage, Ptr{PetscBool}), + stage, isActive_, + ) + + isActive = isActive_[] + + return isActive +end + +""" + PetscLogStageSetVisible(petsclib::PetscLibType,stage::PetscLogStage, isVisible::PetscBool) +Determines stage visibility in `PetscLogView()` + +Not Collective + +Input Parameters: +- `stage` - The stage +- `isVisible` - The visibility flag, `PETSC_TRUE` to print, else `PETSC_FALSE` (defaults to `PETSC_TRUE`) + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogStageGetVisible()`, `PetscLogStageRegister()`, `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscLogView()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogStageSetVisible")) +""" +function PetscLogStageSetVisible(petsclib::PetscLibType, stage::PetscLogStage, isVisible::PetscBool) end + +@for_petsc function PetscLogStageSetVisible(petsclib::$UnionPetscLib, stage::PetscLogStage, isVisible::PetscBool ) + + @chk ccall( + (:PetscLogStageSetVisible, $petsc_library), + PetscErrorCode, + (PetscLogStage, PetscBool), + stage, isVisible, + ) + + + return nothing +end + +""" + isVisible::PetscBool = PetscLogStageGetVisible(petsclib::PetscLibType,stage::PetscLogStage) +Returns stage visibility in `PetscLogView()` + +Not Collective + +Input Parameter: +- `stage` - The stage + +Output Parameter: +- `isVisible` - The visibility flag, `PETSC_TRUE` to print, else `PETSC_FALSE` (defaults to `PETSC_TRUE`) + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogStageSetVisible()`, `PetscLogStageRegister()`, `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscLogView()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogStageGetVisible")) +""" +function PetscLogStageGetVisible(petsclib::PetscLibType, stage::PetscLogStage) end + +@for_petsc function PetscLogStageGetVisible(petsclib::$UnionPetscLib, stage::PetscLogStage ) + isVisible_ = Ref{PetscBool}() + + @chk ccall( + (:PetscLogStageGetVisible, $petsc_library), + PetscErrorCode, + (PetscLogStage, Ptr{PetscBool}), + stage, isVisible_, + ) + + isVisible = isVisible_[] + + return isVisible +end + +""" + PetscLogStageGetId(petsclib::PetscLibType,name::Vector{Cchar}, stage::PetscLogStage) +Returns the stage id when given the stage name. + +Not Collective + +Input Parameter: +- `name` - The stage name + +Output Parameter: +- `stage` - The stage, , or -1 if no stage with that name exists + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogStageRegister()`, `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscPreLoadBegin()`, `PetscPreLoadEnd()`, `PetscPreLoadStage()` + +# External Links +$(_doc_external("Sys/PetscLogStageGetId")) +""" +function PetscLogStageGetId(petsclib::PetscLibType, name::Vector{Cchar}, stage::PetscLogStage) end + +@for_petsc function PetscLogStageGetId(petsclib::$UnionPetscLib, name::Vector{Cchar}, stage::PetscLogStage ) + + @chk ccall( + (:PetscLogStageGetId, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscLogStage}), + name, stage, + ) + + + return nothing +end + +""" + PetscLogStageGetName(petsclib::PetscLibType,stage::PetscLogStage, name::Vector{Cchar}) +Returns the stage name when given the stage id. + +Not Collective + +Input Parameter: +- `stage` - The stage + +Output Parameter: +- `name` - The stage name + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogStageRegister()`, `PetscLogStagePush()`, `PetscLogStagePop()`, `PetscPreLoadBegin()`, `PetscPreLoadEnd()`, `PetscPreLoadStage()` + +# External Links +$(_doc_external("Sys/PetscLogStageGetName")) +""" +function PetscLogStageGetName(petsclib::PetscLibType, stage::PetscLogStage, name::Vector{Cchar}) end + +@for_petsc function PetscLogStageGetName(petsclib::$UnionPetscLib, stage::PetscLogStage, name::Vector{Cchar} ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PetscLogStageGetName, $petsc_library), + PetscErrorCode, + (PetscLogStage, Ptr{Ptr{Cchar}}), + stage, name_, + ) + + + return nothing +end + +""" + PetscLogEventRegister(petsclib::PetscLibType,name::Vector{Cchar}, classid::PetscClassId, event::PetscLogEvent) +Registers an event name for logging operations + +Not Collective + +Input Parameters: +- `name` - The name associated with the event +- `classid` - The classid associated to the class for this event, obtain either with +`PetscClassIdRegister()` or use a predefined one such as `KSP_CLASSID`, `SNES_CLASSID`, the predefined ones +are only available in C code + +Output Parameter: +- `event` - The event id for use with `PetscLogEventBegin()` and `PetscLogEventEnd()`. + +-seealso: [](ch_profiling), `PetscLogStageRegister()`, `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscLogFlops()`, +`PetscLogEventActivate()`, `PetscLogEventDeactivate()`, `PetscClassIdRegister()` + +# External Links +$(_doc_external("Sys/PetscLogEventRegister")) +""" +function PetscLogEventRegister(petsclib::PetscLibType, name::Vector{Cchar}, classid::PetscClassId, event::PetscLogEvent) end + +@for_petsc function PetscLogEventRegister(petsclib::$UnionPetscLib, name::Vector{Cchar}, classid::PetscClassId, event::PetscLogEvent ) + + @chk ccall( + (:PetscLogEventRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, PetscClassId, Ptr{PetscLogEvent}), + name, classid, event, + ) + + + return nothing +end + +""" + PetscLogEventSetCollective(petsclib::PetscLibType,event::PetscLogEvent, collective::PetscBool) +Indicates that a particular event is collective. + +Logically Collective + +Input Parameters: +- `event` - The event id +- `collective` - `PetscBool` indicating whether a particular event is collective + +Level: developer + +-seealso: [](ch_profiling), `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscLogEventRegister()` + +# External Links +$(_doc_external("Sys/PetscLogEventSetCollective")) +""" +function PetscLogEventSetCollective(petsclib::PetscLibType, event::PetscLogEvent, collective::PetscBool) end + +@for_petsc function PetscLogEventSetCollective(petsclib::$UnionPetscLib, event::PetscLogEvent, collective::PetscBool ) + + @chk ccall( + (:PetscLogEventSetCollective, $petsc_library), + PetscErrorCode, + (PetscLogEvent, PetscBool), + event, collective, + ) + + + return nothing +end + +""" + PetscLogEventIncludeClass(petsclib::PetscLibType,classid::PetscClassId) +Activates event logging for a PETSc object class in every stage. + +Not Collective + +Input Parameter: +- `classid` - The object class, for example `MAT_CLASSID`, `SNES_CLASSID`, etc. + +Level: developer + +-seealso: [](ch_profiling), `PetscLogEventActivateClass()`, `PetscLogEventDeactivateClass()`, `PetscLogEventActivate()`, `PetscLogEventDeactivate()` + +# External Links +$(_doc_external("Sys/PetscLogEventIncludeClass")) +""" +function PetscLogEventIncludeClass(petsclib::PetscLibType, classid::PetscClassId) end + +@for_petsc function PetscLogEventIncludeClass(petsclib::$UnionPetscLib, classid::PetscClassId ) + + @chk ccall( + (:PetscLogEventIncludeClass, $petsc_library), + PetscErrorCode, + (PetscClassId,), + classid, + ) + + + return nothing +end + +""" + PetscLogEventExcludeClass(petsclib::PetscLibType,classid::PetscClassId) +Deactivates event logging for a PETSc object class in every stage. + +Not Collective + +Input Parameter: +- `classid` - The object class, for example `MAT_CLASSID`, `SNES_CLASSID`, etc. + +Level: developer + +-seealso: [](ch_profiling), `PetscLogEventDeactivateClass()`, `PetscLogEventActivateClass()`, `PetscLogEventDeactivate()`, `PetscLogEventActivate()` + +# External Links +$(_doc_external("Sys/PetscLogEventExcludeClass")) +""" +function PetscLogEventExcludeClass(petsclib::PetscLibType, classid::PetscClassId) end + +@for_petsc function PetscLogEventExcludeClass(petsclib::$UnionPetscLib, classid::PetscClassId ) + + @chk ccall( + (:PetscLogEventExcludeClass, $petsc_library), + PetscErrorCode, + (PetscClassId,), + classid, + ) + + + return nothing +end + +""" + PetscLogEventActivate(petsclib::PetscLibType,event::PetscLogEvent) +Indicates that a particular event should be logged. + +Not Collective + +Input Parameter: +- `event` - The event id + +-seealso: [](ch_profiling), `PetscLogEventDeactivate()`, `PetscLogEventDeactivatePush()`, `PetscLogEventDeactivatePop()` + +# External Links +$(_doc_external("Sys/PetscLogEventActivate")) +""" +function PetscLogEventActivate(petsclib::PetscLibType, event::PetscLogEvent) end + +@for_petsc function PetscLogEventActivate(petsclib::$UnionPetscLib, event::PetscLogEvent ) + + @chk ccall( + (:PetscLogEventActivate, $petsc_library), + PetscErrorCode, + (PetscLogEvent,), + event, + ) + + + return nothing +end + +""" + PetscLogEventDeactivate(petsclib::PetscLibType,event::PetscLogEvent) +Indicates that a particular event should not be logged. + +Not Collective + +Input Parameter: +- `event` - The event id + +-seealso: [](ch_profiling), `PetscLogEventActivate()`, `PetscLogEventDeactivatePush()`, `PetscLogEventDeactivatePop()` + +# External Links +$(_doc_external("Sys/PetscLogEventDeactivate")) +""" +function PetscLogEventDeactivate(petsclib::PetscLibType, event::PetscLogEvent) end + +@for_petsc function PetscLogEventDeactivate(petsclib::$UnionPetscLib, event::PetscLogEvent ) + + @chk ccall( + (:PetscLogEventDeactivate, $petsc_library), + PetscErrorCode, + (PetscLogEvent,), + event, + ) + + + return nothing +end + +""" + PetscLogEventDeactivatePush(petsclib::PetscLibType,event::PetscLogEvent) +Indicates that a particular event should not be logged until `PetscLogEventDeactivatePop()` is called + +Not Collective + +Input Parameter: +- `event` - The event id + +-seealso: [](ch_profiling), `PetscLogEventActivate()`, `PetscLogEventDeactivate()`, `PetscLogEventDeactivatePop()` + +# External Links +$(_doc_external("Sys/PetscLogEventDeactivatePush")) +""" +function PetscLogEventDeactivatePush(petsclib::PetscLibType, event::PetscLogEvent) end + +@for_petsc function PetscLogEventDeactivatePush(petsclib::$UnionPetscLib, event::PetscLogEvent ) + + @chk ccall( + (:PetscLogEventDeactivatePush, $petsc_library), + PetscErrorCode, + (PetscLogEvent,), + event, + ) + + + return nothing +end + +""" + PetscLogEventDeactivatePop(petsclib::PetscLibType,event::PetscLogEvent) +Indicates that a particular event should again be logged after the logging was turned off with `PetscLogEventDeactivatePush()` + +Not Collective + +Input Parameter: +- `event` - The event id + +-seealso: [](ch_profiling), `PetscLogEventActivate()`, `PetscLogEventDeactivatePush()` + +# External Links +$(_doc_external("Sys/PetscLogEventDeactivatePop")) +""" +function PetscLogEventDeactivatePop(petsclib::PetscLibType, event::PetscLogEvent) end + +@for_petsc function PetscLogEventDeactivatePop(petsclib::$UnionPetscLib, event::PetscLogEvent ) + + @chk ccall( + (:PetscLogEventDeactivatePop, $petsc_library), + PetscErrorCode, + (PetscLogEvent,), + event, + ) + + + return nothing +end + +""" + PetscLogEventSetActiveAll(petsclib::PetscLibType,event::PetscLogEvent, isActive::PetscBool) +Turns on logging of all events + +Not Collective + +Input Parameters: +- `event` - The event id +- `isActive` - The activity flag determining whether the event is logged + +Level: advanced + +-seealso: [](ch_profiling), `PetscLogEventActivate()`, `PetscLogEventDeactivate()` + +# External Links +$(_doc_external("Sys/PetscLogEventSetActiveAll")) +""" +function PetscLogEventSetActiveAll(petsclib::PetscLibType, event::PetscLogEvent, isActive::PetscBool) end + +@for_petsc function PetscLogEventSetActiveAll(petsclib::$UnionPetscLib, event::PetscLogEvent, isActive::PetscBool ) + + @chk ccall( + (:PetscLogEventSetActiveAll, $petsc_library), + PetscErrorCode, + (PetscLogEvent, PetscBool), + event, isActive, + ) + + + return nothing +end + +""" + PetscLogEventActivateClass(petsclib::PetscLibType,classid::PetscClassId) +Activates event logging for a PETSc object class for the current stage + +Not Collective + +Input Parameter: +- `classid` - The event class, for example `MAT_CLASSID`, `SNES_CLASSID`, etc. + +Level: developer + +-seealso: [](ch_profiling), `PetscLogEventIncludeClass()`, `PetscLogEventExcludeClass()`, `PetscLogEventDeactivateClass()`, `PetscLogEventActivate()`, `PetscLogEventDeactivate()` + +# External Links +$(_doc_external("Sys/PetscLogEventActivateClass")) +""" +function PetscLogEventActivateClass(petsclib::PetscLibType, classid::PetscClassId) end + +@for_petsc function PetscLogEventActivateClass(petsclib::$UnionPetscLib, classid::PetscClassId ) + + @chk ccall( + (:PetscLogEventActivateClass, $petsc_library), + PetscErrorCode, + (PetscClassId,), + classid, + ) + + + return nothing +end + +""" + PetscLogEventDeactivateClass(petsclib::PetscLibType,classid::PetscClassId) +Deactivates event logging for a PETSc object class for the current stage + +Not Collective + +Input Parameter: +- `classid` - The event class, for example `MAT_CLASSID`, `SNES_CLASSID`, etc. + +Level: developer + +-seealso: [](ch_profiling), `PetscLogEventIncludeClass()`, `PetscLogEventExcludeClass()`, `PetscLogEventActivateClass()`, `PetscLogEventActivate()`, `PetscLogEventDeactivate()` + +# External Links +$(_doc_external("Sys/PetscLogEventDeactivateClass")) +""" +function PetscLogEventDeactivateClass(petsclib::PetscLibType, classid::PetscClassId) end + +@for_petsc function PetscLogEventDeactivateClass(petsclib::$UnionPetscLib, classid::PetscClassId ) + + @chk ccall( + (:PetscLogEventDeactivateClass, $petsc_library), + PetscErrorCode, + (PetscClassId,), + classid, + ) + + + return nothing +end + +""" + PetscLogEventSync(petsclib::PetscLibType,e::PetscLogEvent, comm::MPI_Comm) + +# External Links +$(_doc_external("Sys/PetscLogEventSync")) +""" +function PetscLogEventSync(petsclib::PetscLibType, e::PetscLogEvent, comm::MPI_Comm) end + +@for_petsc function PetscLogEventSync(petsclib::$UnionPetscLib, e::PetscLogEvent, comm::MPI_Comm ) + + @chk ccall( + (:PetscLogEventSync, $petsc_library), + PetscErrorCode, + (PetscLogEvent, MPI_Comm), + e, comm, + ) + + + return nothing +end + +""" + PetscLogStageGetPerfInfo(petsclib::PetscLibType,stage::PetscLogStage, info::PetscEventPerfInfo) +Return the performance information about the given stage + +No Fortran Support + +Input Parameters: +- `stage` - The stage number or `PETSC_DETERMINE` for the current stage + +Output Parameter: +- `info` - This structure is filled with the performance information + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogEventRegister()`, `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogStageGetPerfInfo")) +""" +function PetscLogStageGetPerfInfo(petsclib::PetscLibType, stage::PetscLogStage, info::PetscEventPerfInfo) end + +@for_petsc function PetscLogStageGetPerfInfo(petsclib::$UnionPetscLib, stage::PetscLogStage, info::PetscEventPerfInfo ) + + @chk ccall( + (:PetscLogStageGetPerfInfo, $petsc_library), + PetscErrorCode, + (PetscLogStage, Ptr{PetscEventPerfInfo}), + stage, info, + ) + + + return nothing +end + +""" + PetscLogEventGetPerfInfo(petsclib::PetscLibType,stage::PetscLogStage, event::PetscLogEvent, info::PetscEventPerfInfo) +Return the performance information about the given event in the given stage + +No Fortran Support + +Input Parameters: +- `stage` - The stage number or `PETSC_DETERMINE` for the current stage +- `event` - The event number + +Output Parameter: +- `info` - This structure is filled with the performance information + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogEventRegister()`, `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogEventGetPerfInfo")) +""" +function PetscLogEventGetPerfInfo(petsclib::PetscLibType, stage::PetscLogStage, event::PetscLogEvent, info::PetscEventPerfInfo) end + +@for_petsc function PetscLogEventGetPerfInfo(petsclib::$UnionPetscLib, stage::PetscLogStage, event::PetscLogEvent, info::PetscEventPerfInfo ) + + @chk ccall( + (:PetscLogEventGetPerfInfo, $petsc_library), + PetscErrorCode, + (PetscLogStage, PetscLogEvent, Ptr{PetscEventPerfInfo}), + stage, event, info, + ) + + + return nothing +end + +""" + PetscLogEventSetDof(petsclib::PetscLibType,event::PetscLogEvent, n::PetscInt, dof::PetscLogDouble) +Set the nth number of degrees of freedom of a numerical problem associated with this event + +Not Collective + +Input Parameters: +- `event` - The event id to log +- `n` - The dof index, in [0, 8) +- `dof` - The number of dofs + +Options Database Key: +- `-log_view` - Activates log summary + +Level: developer + +-seealso: `PetscLogEventSetError()`, `PetscLogEventRegister()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogEventSetDof")) +""" +function PetscLogEventSetDof(petsclib::PetscLibType, event::PetscLogEvent, n::PetscInt, dof::PetscLogDouble) end + +@for_petsc function PetscLogEventSetDof(petsclib::$UnionPetscLib, event::PetscLogEvent, n::$PetscInt, dof::PetscLogDouble ) + + @chk ccall( + (:PetscLogEventSetDof, $petsc_library), + PetscErrorCode, + (PetscLogEvent, $PetscInt, PetscLogDouble), + event, n, dof, + ) + + + return nothing +end + +""" + PetscLogEventSetError(petsclib::PetscLibType,event::PetscLogEvent, n::PetscInt, error::PetscLogDouble) +Set the nth error associated with a numerical problem associated with this event + +Not Collective + +Input Parameters: +- `event` - The event id to log +- `n` - The error index, in [0, 8) +- `error` - The error + +Options Database Key: +- `-log_view` - Activates log summary + +Level: developer + +-seealso: `PetscLogEventSetDof()`, `PetscLogEventRegister()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogEventSetError")) +""" +function PetscLogEventSetError(petsclib::PetscLibType, event::PetscLogEvent, n::PetscInt, error::PetscLogDouble) end + +@for_petsc function PetscLogEventSetError(petsclib::$UnionPetscLib, event::PetscLogEvent, n::$PetscInt, error::PetscLogDouble ) + + @chk ccall( + (:PetscLogEventSetError, $petsc_library), + PetscErrorCode, + (PetscLogEvent, $PetscInt, PetscLogDouble), + event, n, error, + ) + + + return nothing +end + +""" + PetscLogEventGetId(petsclib::PetscLibType,name::Vector{Cchar}, event::PetscLogEvent) +Returns the event id when given the event name. + +Not Collective + +Input Parameter: +- `name` - The event name + +Output Parameter: +- `event` - The event, or -1 if no event with that name exists + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscLogStageGetId()` + +# External Links +$(_doc_external("Sys/PetscLogEventGetId")) +""" +function PetscLogEventGetId(petsclib::PetscLibType, name::Vector{Cchar}, event::PetscLogEvent) end + +@for_petsc function PetscLogEventGetId(petsclib::$UnionPetscLib, name::Vector{Cchar}, event::PetscLogEvent ) + + @chk ccall( + (:PetscLogEventGetId, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscLogEvent}), + name, event, + ) + + + return nothing +end + +""" + PetscLogEventGetName(petsclib::PetscLibType,event::PetscLogEvent, name::Vector{Cchar}) +Returns the event name when given the event id. + +Not Collective + +Input Parameter: +- `event` - The event + +Output Parameter: +- `name` - The event name + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogEventRegister()`, `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscPreLoadBegin()`, `PetscPreLoadEnd()`, `PetscPreLoadStage()` + +# External Links +$(_doc_external("Sys/PetscLogEventGetName")) +""" +function PetscLogEventGetName(petsclib::PetscLibType, event::PetscLogEvent, name::Vector{Cchar}) end + +@for_petsc function PetscLogEventGetName(petsclib::$UnionPetscLib, event::PetscLogEvent, name::Vector{Cchar} ) + name_ = Ref(pointer(name)) + + @chk ccall( + (:PetscLogEventGetName, $petsc_library), + PetscErrorCode, + (PetscLogEvent, Ptr{Ptr{Cchar}}), + event, name_, + ) + + + return nothing +end + +""" + PetscLogEventsPause(petsclib::PetscLibType) +Put event logging into "paused" mode: timers and counters for in + +Not collective + +Level: advanced + +-seealso: [](ch_profiling), `PetscLogEventDeactivatePush()`, `PetscLogEventDeactivatePop()`, `PetscLogEventsResume()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogEventsPause")) +""" +function PetscLogEventsPause(petsclib::PetscLibType) end + +@for_petsc function PetscLogEventsPause(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogEventsPause, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscLogEventsResume(petsclib::PetscLibType) +Return logging to normal behavior after it was paused with `PetscLogEventsPause()`. + +Not collective + +Level: advanced + +-seealso: [](ch_profiling), `PetscLogEventDeactivatePush()`, `PetscLogEventDeactivatePop()`, `PetscLogEventsPause()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogEventsResume")) +""" +function PetscLogEventsResume(petsclib::PetscLibType) end + +@for_petsc function PetscLogEventsResume(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogEventsResume, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscLogObjectCreate(petsclib::PetscLibType,h::PetscObject) + +# External Links +$(_doc_external("Sys/PetscLogObjectCreate")) +""" +function PetscLogObjectCreate(petsclib::PetscLibType, h::PetscObject) end + +@for_petsc function PetscLogObjectCreate(petsclib::$UnionPetscLib, h::PetscObject ) + + @chk ccall( + (:PetscLogObjectCreate, $petsc_library), + PetscErrorCode, + (PetscObject,), + h, + ) + + + return nothing +end + +""" + PetscLogObjectDestroy(petsclib::PetscLibType,h::PetscObject) + +# External Links +$(_doc_external("Sys/PetscLogObjectDestroy")) +""" +function PetscLogObjectDestroy(petsclib::PetscLibType, h::PetscObject) end + +@for_petsc function PetscLogObjectDestroy(petsclib::$UnionPetscLib, h::PetscObject ) + + @chk ccall( + (:PetscLogObjectDestroy, $petsc_library), + PetscErrorCode, + (PetscObject,), + h, + ) + + + return nothing +end + +""" + PetscLogClassGetClassId(petsclib::PetscLibType,name::Vector{Cchar}, classid::PetscClassId) +Returns the `PetscClassId` when given the class name. + +Not Collective + +Input Parameter: +- `name` - The class name + +Output Parameter: +- `classid` - The `PetscClassId` id, or -1 if no class with that name exists + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscLogStageGetId()` + +# External Links +$(_doc_external("Sys/PetscLogClassGetClassId")) +""" +function PetscLogClassGetClassId(petsclib::PetscLibType, name::Vector{Cchar}, classid::PetscClassId) end + +@for_petsc function PetscLogClassGetClassId(petsclib::$UnionPetscLib, name::Vector{Cchar}, classid::PetscClassId ) + + @chk ccall( + (:PetscLogClassGetClassId, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscClassId}), + name, classid, + ) + + + return nothing +end + +""" + PetscLogClassIdGetName(petsclib::PetscLibType,classid::PetscClassId, name::Cchar) +Returns a `PetscClassId`'s name. + +Not Collective + +Input Parameter: +- `classid` - A `PetscClassId` + +Output Parameter: +- `name` - The class name + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogClassRegister()`, `PetscLogClassBegin()`, `PetscLogClassEnd()`, `PetscPreLoadBegin()`, `PetscPreLoadEnd()`, `PetscPreLoadClass()` + +# External Links +$(_doc_external("Sys/PetscLogClassIdGetName")) +""" +function PetscLogClassIdGetName(petsclib::PetscLibType, classid::PetscClassId, name::Cchar) end + +@for_petsc function PetscLogClassIdGetName(petsclib::$UnionPetscLib, classid::PetscClassId, name::Cchar ) + + @chk ccall( + (:PetscLogClassIdGetName, $petsc_library), + PetscErrorCode, + (PetscClassId, Cchar), + classid, name, + ) + + + return nothing +end + +""" + PetscLogDump(petsclib::PetscLibType,sname::Vector{Cchar}) +Dumps logs of objects to a file. This file is intended to +be read by bin/petscview. This program no longer exists. + +Collective on `PETSC_COMM_WORLD` + +Input Parameter: +- `sname` - an optional file name + +-seealso: [](ch_profiling), `PetscLogDefaultBegin()`, `PetscLogView()`, `PetscLogGetDefaultHandler()` + +# External Links +$(_doc_external("Sys/PetscLogDump")) +""" +function PetscLogDump(petsclib::PetscLibType, sname::Vector{Cchar}) end + +@for_petsc function PetscLogDump(petsclib::$UnionPetscLib, sname::Vector{Cchar} ) + + @chk ccall( + (:PetscLogDump, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + sname, + ) + + + return nothing +end + +""" + PetscLogMPEDump(petsclib::PetscLibType,sname::Vector{Cchar}) +Dumps the MPE logging info to file for later use with Jumpshot. + +Collective on `PETSC_COMM_WORLD` + +Input Parameter: +- `sname` - filename for the MPE logfile + +Level: advanced + +-seealso: [](ch_profiling), `PetscLogDump()`, `PetscLogMPEBegin()` + +# External Links +$(_doc_external("Sys/PetscLogMPEDump")) +""" +function PetscLogMPEDump(petsclib::PetscLibType, sname::Vector{Cchar}) end + +@for_petsc function PetscLogMPEDump(petsclib::$UnionPetscLib, sname::Vector{Cchar} ) + + @chk ccall( + (:PetscLogMPEDump, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + sname, + ) + + + return nothing +end + +""" + PetscLogView(petsclib::PetscLibType,viewer::PetscViewer) +Prints a summary of the logging. + +Collective + +Input Parameter: +- `viewer` - an ASCII viewer + +Options Database Keys: +- `-log_view [:filename]` - Prints summary of log information +- `-log_view :filename.py:ascii_info_detail` - Saves logging information from each process as a Python file +- `-log_view :filename.xml:ascii_xml` - Saves a summary of the logging information in a nested format (see below for how to view it) +- `-log_view :filename.txt:ascii_flamegraph` - Saves logging information in a format suitable for visualising as a Flame Graph (see below for how to view it) +- `-log_view_memory` - Also display memory usage in each event +- `-log_view_gpu_time` - Also display time in each event for GPU kernels (Note this may slow the computation) +- `-log_all` - Saves a file Log.rank for each MPI rank with details of each step of the computation +- `-log_trace [filename]` - Displays a trace of what each process is doing + +Level: beginner + +-seealso: [](ch_profiling), `PetscLogDefaultBegin()`, `PetscLogDump()` + +# External Links +$(_doc_external("Sys/PetscLogView")) +""" +function PetscLogView(petsclib::PetscLibType, viewer::PetscViewer) end + +@for_petsc function PetscLogView(petsclib::$UnionPetscLib, viewer::PetscViewer ) + + @chk ccall( + (:PetscLogView, $petsc_library), + PetscErrorCode, + (PetscViewer,), + viewer, + ) + + + return nothing +end + +""" + PetscLogViewFromOptions(petsclib::PetscLibType) +Processes command line options to determine if/how a `PetscLog` is to be viewed. + +Collective on `PETSC_COMM_WORLD` + +Level: developer + +-seealso: [](ch_profiling), `PetscLogView()` + +# External Links +$(_doc_external("Sys/PetscLogViewFromOptions")) +""" +function PetscLogViewFromOptions(petsclib::PetscLibType) end + +@for_petsc function PetscLogViewFromOptions(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogViewFromOptions, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscLogSetThreshold(petsclib::PetscLibType,newThresh::PetscLogDouble, oldThresh::PetscLogDouble) +Set the threshold time for logging the events; this is a percentage out of 100, so 1. means any event +that takes 1 or more percent of the time. + +Logically Collective on `PETSC_COMM_WORLD` + +Input Parameter: +- `newThresh` - the threshold to use + +Output Parameter: +- `oldThresh` - the previously set threshold value + +Options Database Keys: +- `-log_view :filename.xml:ascii_xml` - Prints an XML summary of flop and timing information to the file + +-seealso: `PetscLogDump()`, `PetscLogView()`, `PetscLogTraceBegin()`, `PetscLogDefaultBegin()`, +`PetscLogNestedBegin()` + +# External Links +$(_doc_external("Sys/PetscLogSetThreshold")) +""" +function PetscLogSetThreshold(petsclib::PetscLibType, newThresh::PetscLogDouble, oldThresh::PetscLogDouble) end + +@for_petsc function PetscLogSetThreshold(petsclib::$UnionPetscLib, newThresh::PetscLogDouble, oldThresh::PetscLogDouble ) + + @chk ccall( + (:PetscLogSetThreshold, $petsc_library), + PetscErrorCode, + (PetscLogDouble, Ptr{PetscLogDouble}), + newThresh, oldThresh, + ) + + + return nothing +end + +""" + PetscGetFlops(petsclib::PetscLibType,flops::PetscLogDouble) +Returns the number of flops used on this processor +since the program began. + +Not Collective + +Output Parameter: +- `flops` - number of floating point operations + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogGpuFlops()`, `PetscTime()`, `PetscLogFlops()` + +# External Links +$(_doc_external("Sys/PetscGetFlops")) +""" +function PetscGetFlops(petsclib::PetscLibType, flops::PetscLogDouble) end + +@for_petsc function PetscGetFlops(petsclib::$UnionPetscLib, flops::PetscLogDouble ) + + @chk ccall( + (:PetscGetFlops, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble},), + flops, + ) + + + return nothing +end + +""" + PetscLogFlops(petsclib::PetscLibType,f::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscLogFlops")) +""" +function PetscLogFlops(petsclib::PetscLibType, f::PetscLogDouble) end + +@for_petsc function PetscLogFlops(petsclib::$UnionPetscLib, f::PetscLogDouble ) + + @chk ccall( + (:PetscLogFlops, $petsc_library), + PetscErrorCode, + (PetscLogDouble,), + f, + ) + + + return nothing +end + +""" + PetscLogGpuTime(petsclib::PetscLibType) +turn on the logging of GPU time for GPU kernels + +Options Database Key: +- `-log_view_gpu_time` - provide the GPU times for all events in the `-log_view` output + +Level: advanced + +-seealso: [](ch_profiling), `PetscLogView()`, `PetscLogGpuFlops()`, `PetscLogGpuTimeEnd()`, `PetscLogGpuTimeBegin()` + +# External Links +$(_doc_external("Sys/PetscLogGpuTime")) +""" +function PetscLogGpuTime(petsclib::PetscLibType) end + +@for_petsc function PetscLogGpuTime(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogGpuTime, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscLogGpuTimeBegin(petsclib::PetscLibType) +Start timer for device + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogView()`, `PetscLogGpuFlops()`, `PetscLogGpuTimeEnd()`, `PetscLogGpuTime()` + +# External Links +$(_doc_external("Sys/PetscLogGpuTimeBegin")) +""" +function PetscLogGpuTimeBegin(petsclib::PetscLibType) end + +@for_petsc function PetscLogGpuTimeBegin(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogGpuTimeBegin, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscLogGpuTimeEnd(petsclib::PetscLibType) +Stop timer for device + +Level: intermediate + +-seealso: [](ch_profiling), `PetscLogView()`, `PetscLogGpuFlops()`, `PetscLogGpuTimeBegin()` + +# External Links +$(_doc_external("Sys/PetscLogGpuTimeEnd")) +""" +function PetscLogGpuTimeEnd(petsclib::PetscLibType) end + +@for_petsc function PetscLogGpuTimeEnd(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscLogGpuTimeEnd, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + PetscClassIdRegister(petsclib::PetscLibType,name::Vector{Cchar}, oclass::PetscClassId) +Registers a new class name for objects and logging operations in an application code. + +Not Collective + +Input Parameter: +- `name` - The class name + +Output Parameter: +- `oclass` - The class id or classid + +Level: developer + +-seealso: [](ch_profiling), `PetscLogEventRegister()` + +# External Links +$(_doc_external("Sys/PetscClassIdRegister")) +""" +function PetscClassIdRegister(petsclib::PetscLibType, name::Vector{Cchar}, oclass::PetscClassId) end + +@for_petsc function PetscClassIdRegister(petsclib::$UnionPetscLib, name::Vector{Cchar}, oclass::PetscClassId ) + + @chk ccall( + (:PetscClassIdRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscClassId}), + name, oclass, + ) + + + return nothing +end + +""" + keysout::Vector{PetscInt} = PetscParallelSortInt(petsclib::PetscLibType,mapin::PetscLayout, mapout::PetscLayout, keysin::Vector{PetscInt}) +Globally sort a distributed array of integers + +Collective + +Input Parameters: +- `mapin` - `PetscLayout` describing the distribution of the input keys +- `mapout` - `PetscLayout` describing the desired distribution of the output keys +- `keysin` - the pre-sorted array of integers + +Output Parameter: +- `keysout` - the array in which the sorted integers will be stored. If `mapin` == `mapout`, then `keysin` may be equal to `keysout`. + +Level: developer + +-seealso: `PetscSortInt()`, `PetscParallelSortedInt()` + +# External Links +$(_doc_external("Vec/PetscParallelSortInt")) +""" +function PetscParallelSortInt(petsclib::PetscLibType, mapin::PetscLayout, mapout::PetscLayout, keysin::Vector{PetscInt}) end + +@for_petsc function PetscParallelSortInt(petsclib::$UnionPetscLib, mapin::PetscLayout, mapout::PetscLayout, keysin::Vector{$PetscInt} ) + keysout = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscParallelSortInt, $petsc_library), + PetscErrorCode, + (PetscLayout, PetscLayout, Ptr{$PetscInt}, Ptr{$PetscInt}), + mapin, mapout, keysin, keysout, + ) + + + return keysout +end + +""" + PetscCommSplitReductionBegin(petsclib::PetscLibType,comm::MPI_Comm) +Begin an asynchronous split + +Collective but not synchronizing + +Input Parameter: +- `comm` - communicator on which split reduction has been queued + +Level: advanced + +-seealso: `VecNormBegin()`, `VecNormEnd()`, `VecDotBegin()`, `VecDotEnd()`, `VecTDotBegin()`, `VecTDotEnd()`, `VecMDotBegin()`, `VecMDotEnd()`, `VecMTDotBegin()`, `VecMTDotEnd()` + +# External Links +$(_doc_external("Vec/PetscCommSplitReductionBegin")) +""" +function PetscCommSplitReductionBegin(petsclib::PetscLibType, comm::MPI_Comm) end + +@for_petsc function PetscCommSplitReductionBegin(petsclib::$UnionPetscLib, comm::MPI_Comm ) + + @chk ccall( + (:PetscCommSplitReductionBegin, $petsc_library), + PetscErrorCode, + (MPI_Comm,), + comm, + ) + + + return nothing +end + +""" + wv::PetscReal = PetscDTAltVApply(petsclib::PetscLibType,N::PetscInt, k::PetscInt, w::PetscReal, v::PetscReal) +Apply an a k + +Input Parameters: +- `N` - the dimension of the vector space, N >= 0 +- `k` - the degree k of the k-form w, 0 <= k <= N +- `w` - a k-form, size [N choose k] (each degree of freedom of a k-form is associated with a subset of k coordinates of the N-dimensional vectors. +The degrees of freedom are ordered lexicographically by their associated subsets) +- `v` - a set of k vectors of size N, size [k x N], each vector stored contiguously + +Output Parameter: +- `wv` + +Level: intermediate + +-seealso: `PetscDTAltV`, `PetscDTAltVPullback()`, `PetscDTAltVPullbackMatrix()` + +# External Links +$(_doc_external("DM/PetscDTAltVApply")) +""" +function PetscDTAltVApply(petsclib::PetscLibType, N::PetscInt, k::PetscInt, w::PetscReal, v::PetscReal) end + +@for_petsc function PetscDTAltVApply(petsclib::$UnionPetscLib, N::$PetscInt, k::$PetscInt, w::$PetscReal, v::$PetscReal ) + wv_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTAltVApply, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + N, k, w, v, wv_, + ) + + wv = wv_[] + + return wv +end + +""" + awedgeb::PetscReal = PetscDTAltVWedge(petsclib::PetscLibType,N::PetscInt, j::PetscInt, k::PetscInt, a::PetscReal, b::PetscReal) +Compute the wedge product of a j + +Input Parameters: +- `N` - the dimension of the vector space, N >= 0 +- `j` - the degree j of the j-form a, 0 <= j <= N +- `k` - the degree k of the k-form b, 0 <= k <= N and 0 <= j+k <= N +- `a` - a j-form, size [N choose j] +- `b` - a k-form, size [N choose k] + +Output Parameter: +- `awedgeb` - +Level: intermediate + +-seealso: `PetscDTAltV`, `PetscDTAltVWedgeMatrix()`, `PetscDTAltVPullback()`, `PetscDTAltVPullbackMatrix()` + +# External Links +$(_doc_external("DM/PetscDTAltVWedge")) +""" +function PetscDTAltVWedge(petsclib::PetscLibType, N::PetscInt, j::PetscInt, k::PetscInt, a::PetscReal, b::PetscReal) end + +@for_petsc function PetscDTAltVWedge(petsclib::$UnionPetscLib, N::$PetscInt, j::$PetscInt, k::$PetscInt, a::$PetscReal, b::$PetscReal ) + awedgeb_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTAltVWedge, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + N, j, k, a, b, awedgeb_, + ) + + awedgeb = awedgeb_[] + + return awedgeb +end + +""" + awedgeMat::PetscReal = PetscDTAltVWedgeMatrix(petsclib::PetscLibType,N::PetscInt, j::PetscInt, k::PetscInt, a::PetscReal) +Compute the matrix defined by the wedge product with a given j + +Input Parameters: +- `N` - the dimension of the vector space, N >= 0 +- `j` - the degree j of the j-form a, 0 <= j <= N +- `k` - the degree k of the k-forms that (a wedge) will be applied to, 0 <= k <= N and 0 <= j+k <= N +- `a` - a j-form, size [N choose j] + +Output Parameter: +- `awedgeMat` - (a wedge), an [(N choose j+k) x (N choose k)] matrix in row-major order, such that (a wedge) * b = a wedge b + +Level: intermediate + +-seealso: `PetscDTAltV`, `PetscDTAltVPullback()`, `PetscDTAltVPullbackMatrix()` + +# External Links +$(_doc_external("DM/PetscDTAltVWedgeMatrix")) +""" +function PetscDTAltVWedgeMatrix(petsclib::PetscLibType, N::PetscInt, j::PetscInt, k::PetscInt, a::PetscReal) end + +@for_petsc function PetscDTAltVWedgeMatrix(petsclib::$UnionPetscLib, N::$PetscInt, j::$PetscInt, k::$PetscInt, a::$PetscReal ) + awedgeMat_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTAltVWedgeMatrix, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}), + N, j, k, a, awedgeMat_, + ) + + awedgeMat = awedgeMat_[] + + return awedgeMat +end + +""" + Lstarw::PetscReal = PetscDTAltVPullback(petsclib::PetscLibType,N::PetscInt, M::PetscInt, L::PetscReal, k::PetscInt, w::PetscReal) +Compute the pullback of a k + +Input Parameters: +- `N` - the dimension of the origin vector space of the linear transformation, M >= 0 +- `M` - the dimension of the image vector space of the linear transformation, N >= 0 +- `L` - a linear transformation, an [M x N] matrix in row-major format +- `k` - the *signed* degree k of the |k|-form w, -(min(M,N)) <= k <= min(M,N). A negative form degree indicates that the pullback should be conjugated by +the Hodge star operator (see note). +- `w` - a |k|-form in the image space, size [M choose |k|] + +Output Parameter: +- `Lstarw` - the pullback of w to a |k|-form in the origin space, size [N choose |k|]: (Lstarw)(v_1,...v_k) = w(L*v_1,...,L*v_k). + +Level: intermediate + +-seealso: `PetscDTAltV`, `PetscDTAltVPullbackMatrix()`, `PetscDTAltVStar()` + +# External Links +$(_doc_external("DM/PetscDTAltVPullback")) +""" +function PetscDTAltVPullback(petsclib::PetscLibType, N::PetscInt, M::PetscInt, L::PetscReal, k::PetscInt, w::PetscReal) end + +@for_petsc function PetscDTAltVPullback(petsclib::$UnionPetscLib, N::$PetscInt, M::$PetscInt, L::$PetscReal, k::$PetscInt, w::$PetscReal ) + Lstarw_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTAltVPullback, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}), + N, M, L, k, w, Lstarw_, + ) + + Lstarw = Lstarw_[] + + return Lstarw +end + +""" + Lstar::PetscReal = PetscDTAltVPullbackMatrix(petsclib::PetscLibType,N::PetscInt, M::PetscInt, L::PetscReal, k::PetscInt) +Compute the pullback matrix for k + +Input Parameters: +- `N` - the dimension of the origin vector space of the linear transformation, N >= 0 +- `M` - the dimension of the image vector space of the linear transformation, M >= 0 +- `L` - a linear transformation, an [M x N] matrix in row-major format +- `k` - the *signed* degree k of the |k|-forms on which Lstar acts, -(min(M,N)) <= k <= min(M,N). +A negative form degree indicates that the pullback should be conjugated by the Hodge star operator (see note in `PetscDTAltvPullback()`) + +Output Parameter: +- `Lstar` - the pullback matrix, an [(N choose |k|) x (M choose |k|)] matrix in row-major format such that Lstar * w = L^* w + +Level: intermediate + +-seealso: `PetscDTAltV`, `PetscDTAltVPullback()`, `PetscDTAltVStar()` + +# External Links +$(_doc_external("DM/PetscDTAltVPullbackMatrix")) +""" +function PetscDTAltVPullbackMatrix(petsclib::PetscLibType, N::PetscInt, M::PetscInt, L::PetscReal, k::PetscInt) end + +@for_petsc function PetscDTAltVPullbackMatrix(petsclib::$UnionPetscLib, N::$PetscInt, M::$PetscInt, L::$PetscReal, k::$PetscInt ) + Lstar_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTAltVPullbackMatrix, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, $PetscInt, Ptr{$PetscReal}), + N, M, L, k, Lstar_, + ) + + Lstar = Lstar_[] + + return Lstar +end + +""" + wIntv::PetscReal = PetscDTAltVInterior(petsclib::PetscLibType,N::PetscInt, k::PetscInt, w::PetscReal, v::PetscReal) +Compute the interior product of a k + +Input Parameters: +- `N` - the dimension of the vector space, N >= 0 +- `k` - the degree k of the k-form w, 0 <= k <= N +- `w` - a k-form, size [N choose k] +- `v` - an N dimensional vector + +Output Parameter: +- `wIntv` - the (k-1)-form (w int v), size [N choose (k-1)]: (w int v) is defined by its action on (k-1) vectors {v_1, ..., v_{k-1}} as (w inv v)(v_1, ..., v_{k-1}) = w(v, v_1, ..., v_{k-1}). + +Level: intermediate + +-seealso: `PetscDTAltV`, `PetscDTAltVInteriorMatrix()`, `PetscDTAltVInteriorPattern()`, `PetscDTAltVPullback()`, `PetscDTAltVPullbackMatrix()` + +# External Links +$(_doc_external("DM/PetscDTAltVInterior")) +""" +function PetscDTAltVInterior(petsclib::PetscLibType, N::PetscInt, k::PetscInt, w::PetscReal, v::PetscReal) end + +@for_petsc function PetscDTAltVInterior(petsclib::$UnionPetscLib, N::$PetscInt, k::$PetscInt, w::$PetscReal, v::$PetscReal ) + wIntv_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTAltVInterior, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + N, k, w, v, wIntv_, + ) + + wIntv = wIntv_[] + + return wIntv +end + +""" + intvMat::PetscReal = PetscDTAltVInteriorMatrix(petsclib::PetscLibType,N::PetscInt, k::PetscInt, v::PetscReal) +Compute the matrix of the linear transformation induced on a k + +Input Parameters: +- `N` - the dimension of the vector space, N >= 0 +- `k` - the degree k of the k-forms on which intvMat acts, 0 <= k <= N +- `v` - an N dimensional vector + +Output Parameter: +- `intvMat` - an [(N choose (k-1)) x (N choose k)] matrix, row-major: (intvMat) * w = (w int v) + +Level: intermediate + +-seealso: `PetscDTAltV`, `PetscDTAltVInterior()`, `PetscDTAltVInteriorPattern()`, `PetscDTAltVPullback()`, `PetscDTAltVPullbackMatrix()` + +# External Links +$(_doc_external("DM/PetscDTAltVInteriorMatrix")) +""" +function PetscDTAltVInteriorMatrix(petsclib::PetscLibType, N::PetscInt, k::PetscInt, v::PetscReal) end + +@for_petsc function PetscDTAltVInteriorMatrix(petsclib::$UnionPetscLib, N::$PetscInt, k::$PetscInt, v::$PetscReal ) + intvMat_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTAltVInteriorMatrix, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}), + N, k, v, intvMat_, + ) + + intvMat = intvMat_[] + + return intvMat +end + +""" + PetscDTAltVInteriorPattern(petsclib::PetscLibType,N::PetscInt, k::PetscInt, ::PetscInt(indices) +compute the sparsity and sign pattern of the interior product matrix computed in `PetscDTAltVInteriorMatrix()` + +Input Parameters: +- `N` - the dimension of the vector space, N >= 0 +- `k` - the degree of the k-forms on which `intvMat` from `PetscDTAltVInteriorMatrix()` acts, 0 le k le N . + +Output Parameter: +- `indices` - The interior product matrix `intvMat` has dimensions [(N choose (k-1)) x (N choose k)] and has (N choose k) * k +non-zeros. indices[i][0] and indices[i][1] are the row and column of a non-zero, and its value is equal to the vector +coordinate v[j] if indices[i][2] = j, or -v[j] if indices[i][2] = -(j+1) + +Level: intermediate + +-seealso: `PetscDTAltV`, `PetscDTAltVInterior()`, `PetscDTAltVInteriorMatrix()`, `PetscDTAltVPullback()`, `PetscDTAltVPullbackMatrix()` + +# External Links +$(_doc_external("DM/PetscDTAltVInteriorPattern")) +""" +function PetscDTAltVInteriorPattern(petsclib::PetscLibType, N::PetscInt, k::PetscInt, indices::Vector{PetscInt}) end + +@for_petsc function PetscDTAltVInteriorPattern(petsclib::$UnionPetscLib, N::$PetscInt, k::$PetscInt, indices::Vector{PetscInt}) + + @chk ccall( + (:PetscDTAltVInteriorPattern, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscInt}), + N, k, indices, + ) + + + return nothing +end + +""" + starw::PetscReal = PetscDTAltVStar(petsclib::PetscLibType,N::PetscInt, k::PetscInt, pow::PetscInt, w::PetscReal) +Apply a power of the Hodge star operator, which maps k + +Input Parameters: +- `N` - the dimension of the vector space, N >= 0 +- `k` - the degree k of the k-form w, 0 <= k <= N +- `pow` - the number of times to apply the Hodge star operator: pow < 0 indicates that the inverse of the Hodge star operator should be applied |pow| times. +- `w` - a k-form, size [N choose k] + +Output Parameter: +- `starw` - (star)^pow w + +Level: intermediate + +-seealso: `PetscDTAltV`, `PetscDTAltVPullback()`, `PetscDTAltVPullbackMatrix()` + +# External Links +$(_doc_external("DM/PetscDTAltVStar")) +""" +function PetscDTAltVStar(petsclib::PetscLibType, N::PetscInt, k::PetscInt, pow::PetscInt, w::PetscReal) end + +@for_petsc function PetscDTAltVStar(petsclib::$UnionPetscLib, N::$PetscInt, k::$PetscInt, pow::$PetscInt, w::$PetscReal ) + starw_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTAltVStar, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}), + N, k, pow, w, starw_, + ) + + starw = starw_[] + + return starw +end + +""" + pdf::PetscProbFn,cdf::PetscProbFn,sampler::PetscProbFn = PetscProbCreateFromOptions(petsclib::PetscLibType,dim::PetscInt, prefix::Vector{Cchar}, name::Vector{Cchar}) +Return the probability distribution specified by the arguments and options + +Not Collective + +Input Parameters: +- `dim` - The dimension of sample points +- `prefix` - The options prefix, or `NULL` +- `name` - The options database name for the probability distribution type + +Output Parameters: +- `pdf` - The PDF of this type, or `NULL` +- `cdf` - The CDF of this type, or `NULL` +- `sampler` - The PDF sampler of this type, or `NULL` + +Level: intermediate + +-seealso: `PetscProbFn`, `PetscPDFMaxwellBoltzmann1D()`, `PetscPDFGaussian1D()`, `PetscPDFConstant1D()` + +# External Links +$(_doc_external("DM/PetscProbCreateFromOptions")) +""" +function PetscProbCreateFromOptions(petsclib::PetscLibType, dim::PetscInt, prefix::Vector{Cchar}, name::Vector{Cchar}) end + +@for_petsc function PetscProbCreateFromOptions(petsclib::$UnionPetscLib, dim::$PetscInt, prefix::Vector{Cchar}, name::Vector{Cchar} ) + pdf_ = Ref{PetscProbFn}() + cdf_ = Ref{PetscProbFn}() + sampler_ = Ref{PetscProbFn}() + + @chk ccall( + (:PetscProbCreateFromOptions, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{Cchar}, Ptr{Cchar}, PetscProbFn, PetscProbFn, PetscProbFn), + dim, prefix, name, pdf_, cdf_, sampler_, + ) + + pdf = pdf_[] + cdf = cdf_[] + sampler = sampler_[] + + return pdf,cdf,sampler +end + +""" + alpha::PetscReal = PetscProbComputeKSStatistic(petsclib::PetscLibType,v::PetscVec, cdf::PetscProbFn) +Compute the Kolmogorov + +Collective + +Input Parameters: +- `v` - The data vector, blocksize is the sample dimension +- `cdf` - The analytic CDF + +Output Parameter: +- `alpha` - The KS statistic + +Level: advanced + +-seealso: `PetscProbComputeKSStatisticWeighted()`, `PetscProbComputeKSStatisticMagnitude()`, `PetscProbFn` + +# External Links +$(_doc_external("DM/PetscProbComputeKSStatistic")) +""" +function PetscProbComputeKSStatistic(petsclib::PetscLibType, v::PetscVec, cdf::PetscProbFn) end + +@for_petsc function PetscProbComputeKSStatistic(petsclib::$UnionPetscLib, v::PetscVec, cdf::PetscProbFn ) + alpha_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscProbComputeKSStatistic, $petsc_library), + PetscErrorCode, + (CVec, Ptr{PetscProbFn}, Ptr{$PetscReal}), + v, cdf, alpha_, + ) + + alpha = alpha_[] + + return alpha +end + +""" + alpha::PetscReal = PetscProbComputeKSStatisticWeighted(petsclib::PetscLibType,v::PetscVec, w::PetscVec, cdf::PetscProbFn) +Compute the Kolmogorov + +Collective + +Input Parameters: +- `v` - The data vector, blocksize is the sample dimension +- `w` - The vector of weights for each sample, instead of the default 1/n +- `cdf` - The analytic CDF + +Output Parameter: +- `alpha` - The KS statistic + +Level: advanced + +-seealso: `PetscProbComputeKSStatistic()`, `PetscProbComputeKSStatisticMagnitude()`, `PetscProbFn` + +# External Links +$(_doc_external("DM/PetscProbComputeKSStatisticWeighted")) +""" +function PetscProbComputeKSStatisticWeighted(petsclib::PetscLibType, v::PetscVec, w::PetscVec, cdf::PetscProbFn) end + +@for_petsc function PetscProbComputeKSStatisticWeighted(petsclib::$UnionPetscLib, v::PetscVec, w::PetscVec, cdf::PetscProbFn ) + alpha_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscProbComputeKSStatisticWeighted, $petsc_library), + PetscErrorCode, + (CVec, CVec, Ptr{PetscProbFn}, Ptr{$PetscReal}), + v, w, cdf, alpha_, + ) + + alpha = alpha_[] + + return alpha +end + +""" + alpha::PetscReal = PetscProbComputeKSStatisticMagnitude(petsclib::PetscLibType,v::PetscVec, cdf::PetscProbFn) +Compute the Kolmogorov + +Collective + +Input Parameters: +- `v` - The data vector, blocksize is the sample dimension +- `cdf` - The analytic CDF + +Output Parameter: +- `alpha` - The KS statistic + +Level: advanced + +-seealso: `PetscProbComputeKSStatistic()`, `PetscProbComputeKSStatisticWeighted()`, `PetscProbFn` + +# External Links +$(_doc_external("DM/PetscProbComputeKSStatisticMagnitude")) +""" +function PetscProbComputeKSStatisticMagnitude(petsclib::PetscLibType, v::PetscVec, cdf::PetscProbFn) end + +@for_petsc function PetscProbComputeKSStatisticMagnitude(petsclib::$UnionPetscLib, v::PetscVec, cdf::PetscProbFn ) + alpha_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscProbComputeKSStatisticMagnitude, $petsc_library), + PetscErrorCode, + (CVec, Ptr{PetscProbFn}, Ptr{$PetscReal}), + v, cdf, alpha_, + ) + + alpha = alpha_[] + + return alpha +end + +""" + PetscFormKeySort(petsclib::PetscLibType,n::PetscInt, arr::Vector{PetscFormKey}) +Sorts an array of `PetscFormKey` in place in increasing order. + +Not Collective + +Input Parameters: +- `n` - number of values +- `arr` - array of `PetscFormKey` + +Level: intermediate + +-seealso: `PetscFormKey`, `PetscIntSortSemiOrdered()`, `PetscSortInt()` + +# External Links +$(_doc_external("DM/PetscFormKeySort")) +""" +function PetscFormKeySort(petsclib::PetscLibType, n::PetscInt, arr::Vector{PetscFormKey}) end + +@for_petsc function PetscFormKeySort(petsclib::$UnionPetscLib, n::$PetscInt, arr::Vector{PetscFormKey} ) + + @chk ccall( + (:PetscFormKeySort, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{PetscFormKey}), + n, arr, + ) + + + return nothing +end + +""" + norm::PetscReal = PetscDTJacobiNorm(petsclib::PetscLibType,alpha::PetscReal, beta::PetscReal, n::PetscInt) +Compute the weighted L2 norm of a Jacobi polynomial. + +Input Parameters: +- `alpha` - the left exponent > -1 +- `beta` - the right exponent > -1 +- `n` - the polynomial degree + +Output Parameter: +- `norm` - the weighted L2 norm + +Level: beginner + +-seealso: `PetscQuadrature`, `PetscDTJacobiEval()` + +# External Links +$(_doc_external("DM/PetscDTJacobiNorm")) +""" +function PetscDTJacobiNorm(petsclib::PetscLibType, alpha::PetscReal, beta::PetscReal, n::PetscInt) end + +@for_petsc function PetscDTJacobiNorm(petsclib::$UnionPetscLib, alpha::$PetscReal, beta::$PetscReal, n::$PetscInt ) + norm_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTJacobiNorm, $petsc_library), + PetscErrorCode, + ($PetscReal, $PetscReal, $PetscInt, Ptr{$PetscReal}), + alpha, beta, n, norm_, + ) + + norm = norm_[] + + return norm +end + +""" + p::Vector{PetscReal} = PetscDTJacobiEvalJet(petsclib::PetscLibType,alpha::PetscReal, beta::PetscReal, npoints::PetscInt, points::Vector{PetscReal}, degree::PetscInt, k::PetscInt) +Evaluate the jet (function and derivatives) of the Jacobi polynomials basis up to a given degree. + +Input Parameters: +- `alpha` - the left exponent of the weight +- `beta` - the right exponetn of the weight +- `npoints` - the number of points to evaluate the polynomials at +- `points` - [npoints] array of point coordinates +- `degree` - the maximm degree polynomial space to evaluate, (degree + 1) will be evaluated total. +- `k` - the maximum derivative to evaluate in the jet, (k + 1) will be evaluated total. + +Output Parameter: +- `p` - an array containing the evaluations of the Jacobi polynomials's jets on the points. the size is (degree + 1) x +(k + 1) x npoints, which also describes the order of the dimensions of this three-dimensional array: the first +(slowest varying) dimension is polynomial degree; the second dimension is derivative order; the third (fastest +varying) dimension is the index of the evaluation point. + +Level: advanced + +-seealso: `PetscDTJacobiEval()`, `PetscDTPKDEvalJet()` + +# External Links +$(_doc_external("DM/PetscDTJacobiEvalJet")) +""" +function PetscDTJacobiEvalJet(petsclib::PetscLibType, alpha::PetscReal, beta::PetscReal, npoints::PetscInt, points::Vector{PetscReal}, degree::PetscInt, k::PetscInt) end + +@for_petsc function PetscDTJacobiEvalJet(petsclib::$UnionPetscLib, alpha::$PetscReal, beta::$PetscReal, npoints::$PetscInt, points::Vector{$PetscReal}, degree::$PetscInt, k::$PetscInt ) + p = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTJacobiEvalJet, $petsc_library), + PetscErrorCode, + ($PetscReal, $PetscReal, $PetscInt, Ptr{$PetscReal}, $PetscInt, $PetscInt, Ptr{$PetscReal}), + alpha, beta, npoints, points, degree, k, p, + ) + + + return p +end + +""" + B::Vector{PetscReal},D::Vector{PetscReal},D2::Vector{PetscReal} = PetscDTJacobiEval(petsclib::PetscLibType,npoints::PetscInt, alpha::PetscReal, beta::PetscReal, points::PetscReal, ndegree::PetscInt, degrees::PetscInt) +evaluate Jacobi polynomials for the weight function (1.+x)^{\alpha} (1. +at points + +Not Collective + +Input Parameters: +- `npoints` - number of spatial points to evaluate at +- `alpha` - the left exponent > -1 +- `beta` - the right exponent > -1 +- `points` - array of locations to evaluate at +- `ndegree` - number of basis degrees to evaluate +- `degrees` - sorted array of degrees to evaluate + +Output Parameters: +- `B` - row-oriented basis evaluation matrix B[point*ndegree + degree] (dimension npoints*ndegrees, allocated by caller) (or `NULL`) +- `D` - row-oriented derivative evaluation matrix (or `NULL`) +- `D2` - row-oriented second derivative evaluation matrix (or `NULL`) + +Level: intermediate + +-seealso: `PetscDTGaussQuadrature()`, `PetscDTLegendreEval()` + +# External Links +$(_doc_external("DM/PetscDTJacobiEval")) +""" +function PetscDTJacobiEval(petsclib::PetscLibType, npoints::PetscInt, alpha::PetscReal, beta::PetscReal, points::PetscReal, ndegree::PetscInt, degrees::PetscInt) end + +@for_petsc function PetscDTJacobiEval(petsclib::$UnionPetscLib, npoints::$PetscInt, alpha::$PetscReal, beta::$PetscReal, points::$PetscReal, ndegree::$PetscInt, degrees::$PetscInt ) + B = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + D = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + D2 = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTJacobiEval, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscReal, $PetscReal, Ptr{$PetscReal}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + npoints, alpha, beta, points, ndegree, degrees, B, D, D2, + ) + + + return B,D,D2 +end + +""" + B::Vector{PetscReal},D::Vector{PetscReal},D2::Vector{PetscReal} = PetscDTLegendreEval(petsclib::PetscLibType,npoints::PetscInt, points::PetscReal, ndegree::PetscInt, degrees::PetscInt) +evaluate Legendre polynomials at points + +Not Collective + +Input Parameters: +- `npoints` - number of spatial points to evaluate at +- `points` - array of locations to evaluate at +- `ndegree` - number of basis degrees to evaluate +- `degrees` - sorted array of degrees to evaluate + +Output Parameters: +- `B` - row-oriented basis evaluation matrix B[point*ndegree + degree] (dimension `npoints`*`ndegrees`, allocated by caller) (or `NULL`) +- `D` - row-oriented derivative evaluation matrix (or `NULL`) +- `D2` - row-oriented second derivative evaluation matrix (or `NULL`) + +Level: intermediate + +-seealso: `PetscDTGaussQuadrature()` + +# External Links +$(_doc_external("DM/PetscDTLegendreEval")) +""" +function PetscDTLegendreEval(petsclib::PetscLibType, npoints::PetscInt, points::PetscReal, ndegree::PetscInt, degrees::PetscInt) end + +@for_petsc function PetscDTLegendreEval(petsclib::$UnionPetscLib, npoints::$PetscInt, points::$PetscReal, ndegree::$PetscInt, degrees::$PetscInt ) + B = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + D = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + D2 = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTLegendreEval, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + npoints, points, ndegree, degrees, B, D, D2, + ) + + + return B,D,D2 +end + +""" + degtup::Vector{PetscInt} = PetscDTIndexToGradedOrder(petsclib::PetscLibType,len::PetscInt, index::PetscInt) +convert an index into a tuple of monomial degrees in a graded order (that is, if the degree sum of tuple x is less than the degree sum of tuple y, +then the index of x is smaller than the index of y) + +Input Parameters: +- `len` - the desired length of the degree tuple +- `index` - the index to convert: should be >= 0 + +Output Parameter: +- `degtup` - filled with a tuple of degrees + +Level: beginner + +-seealso: `PetscDTGradedOrderToIndex()` + +# External Links +$(_doc_external("DM/PetscDTIndexToGradedOrder")) +""" +function PetscDTIndexToGradedOrder(petsclib::PetscLibType, len::PetscInt, index::PetscInt) end + +@for_petsc function PetscDTIndexToGradedOrder(petsclib::$UnionPetscLib, len::$PetscInt, index::$PetscInt ) + degtup = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTIndexToGradedOrder, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscInt}), + len, index, degtup, + ) + + + return degtup +end + +""" + index::PetscInt = PetscDTGradedOrderToIndex(petsclib::PetscLibType,len::PetscInt, degtup::Vector{PetscInt}) +convert a tuple into an index in a graded order, the inverse of `PetscDTIndexToGradedOrder()`. + +Input Parameters: +- `len` - the length of the degree tuple +- `degtup` - tuple with this length + +Output Parameter: +- `index` - index in graded order: >= 0 + +Level: beginner + +-seealso: `PetscDTIndexToGradedOrder()` + +# External Links +$(_doc_external("DM/PetscDTGradedOrderToIndex")) +""" +function PetscDTGradedOrderToIndex(petsclib::PetscLibType, len::PetscInt, degtup::Vector{PetscInt}) end + +@for_petsc function PetscDTGradedOrderToIndex(petsclib::$UnionPetscLib, len::$PetscInt, degtup::Vector{$PetscInt} ) + index_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDTGradedOrderToIndex, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + len, degtup, index_, + ) + + index = index_[] + + return index +end + +""" + p::Vector{PetscReal} = PetscDTPKDEvalJet(petsclib::PetscLibType,dim::PetscInt, npoints::PetscInt, points::Vector{PetscReal}, degree::PetscInt, k::PetscInt) +Evaluate the jet (function and derivatives) of the Proriol +the space of polynomials up to a given degree. + +Input Parameters: +- `dim` - the number of variables in the multivariate polynomials +- `npoints` - the number of points to evaluate the polynomials at +- `points` - [npoints x dim] array of point coordinates +- `degree` - the degree (sum of degrees on the variables in a monomial) of the polynomial space to evaluate. There are ((dim + degree) choose dim) polynomials in this space. +- `k` - the maximum order partial derivative to evaluate in the jet. There are (dim + k choose dim) partial derivatives +in the jet. Choosing k = 0 means to evaluate just the function and no derivatives + +Output Parameter: +- `p` - an array containing the evaluations of the PKD polynomials' jets on the points. The size is ((dim + degree) +choose dim) x ((dim + k) choose dim) x npoints, which also describes the order of the dimensions of this +three-dimensional array: the first (slowest varying) dimension is basis function index; the second dimension is jet +index; the third (fastest varying) dimension is the index of the evaluation point. + +Level: advanced + +-seealso: `PetscDTGradedOrderToIndex()`, `PetscDTIndexToGradedOrder()`, `PetscDTJacobiEvalJet()` + +# External Links +$(_doc_external("DM/PetscDTPKDEvalJet")) +""" +function PetscDTPKDEvalJet(petsclib::PetscLibType, dim::PetscInt, npoints::PetscInt, points::Vector{PetscReal}, degree::PetscInt, k::PetscInt) end + +@for_petsc function PetscDTPKDEvalJet(petsclib::$UnionPetscLib, dim::$PetscInt, npoints::$PetscInt, points::Vector{$PetscReal}, degree::$PetscInt, k::$PetscInt ) + p = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTPKDEvalJet, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, $PetscInt, $PetscInt, Ptr{$PetscReal}), + dim, npoints, points, degree, k, p, + ) + + + return p +end + +""" + size::PetscInt = PetscDTPTrimmedSize(petsclib::PetscLibType,dim::PetscInt, degree::PetscInt, formDegree::PetscInt) +The size of the trimmed polynomial space of k +which can be evaluated in `PetscDTPTrimmedEvalJet()`. + +Input Parameters: +- `dim` - the number of variables in the multivariate polynomials +- `degree` - the degree (sum of degrees on the variables in a monomial) of the trimmed polynomial space. +- `formDegree` - the degree of the form + +Output Parameter: +- `size` - The number ((`dim` + `degree`) choose (`dim` + `formDegree`)) x ((`degree` + `formDegree` - 1) choose (`formDegree`)) + +Level: advanced + +-seealso: `PetscDTPTrimmedEvalJet()` + +# External Links +$(_doc_external("DM/PetscDTPTrimmedSize")) +""" +function PetscDTPTrimmedSize(petsclib::PetscLibType, dim::PetscInt, degree::PetscInt, formDegree::PetscInt) end + +@for_petsc function PetscDTPTrimmedSize(petsclib::$UnionPetscLib, dim::$PetscInt, degree::$PetscInt, formDegree::$PetscInt ) + size_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDTPTrimmedSize, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}), + dim, degree, formDegree, size_, + ) + + size = size_[] + + return size +end + +""" + p::Vector{PetscReal} = PetscDTPTrimmedEvalJet(petsclib::PetscLibType,dim::PetscInt, npoints::PetscInt, points::Vector{PetscReal}, degree::PetscInt, formDegree::PetscInt, jetDegree::PetscInt) +Evaluate the jet (function and derivatives) of a basis of the trimmed polynomial k +a given degree. + +Input Parameters: +- `dim` - the number of variables in the multivariate polynomials +- `npoints` - the number of points to evaluate the polynomials at +- `points` - [npoints x dim] array of point coordinates +- `degree` - the degree (sum of degrees on the variables in a monomial) of the trimmed polynomial space to evaluate. +There are ((dim + degree) choose (dim + formDegree)) x ((degree + formDegree - 1) choose (formDegree)) polynomials in this space. +(You can use `PetscDTPTrimmedSize()` to compute this size.) +- `formDegree` - the degree of the form +- `jetDegree` - the maximum order partial derivative to evaluate in the jet. There are ((dim + jetDegree) choose dim) partial derivatives +in the jet. Choosing jetDegree = 0 means to evaluate just the function and no derivatives + +Output Parameter: +- `p` - an array containing the evaluations of the PKD polynomials' jets on the points. + +Level: advanced + +-seealso: `PetscDTPKDEvalJet()`, `PetscDTPTrimmedSize()` + +# External Links +$(_doc_external("DM/PetscDTPTrimmedEvalJet")) +""" +function PetscDTPTrimmedEvalJet(petsclib::PetscLibType, dim::PetscInt, npoints::PetscInt, points::Vector{PetscReal}, degree::PetscInt, formDegree::PetscInt, jetDegree::PetscInt) end + +@for_petsc function PetscDTPTrimmedEvalJet(petsclib::$UnionPetscLib, dim::$PetscInt, npoints::$PetscInt, points::Vector{$PetscReal}, degree::$PetscInt, formDegree::$PetscInt, jetDegree::$PetscInt ) + p = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTPTrimmedEvalJet, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, $PetscInt, $PetscInt, $PetscInt, Ptr{$PetscReal}), + dim, npoints, points, degree, formDegree, jetDegree, p, + ) + + + return p +end + +""" + x::Vector{PetscReal},w::Vector{PetscReal} = PetscDTGaussJacobiQuadrature(petsclib::PetscLibType,npoints::PetscInt, a::PetscReal, b::PetscReal, alpha::PetscReal, beta::PetscReal) +quadrature for the interval [a, b] with the weight function +(x-a)^\alpha (x-b)^\beta. + +Not Collective + +Input Parameters: +- `npoints` - the number of points in the quadrature rule +- `a` - the left endpoint of the interval +- `b` - the right endpoint of the interval +- `alpha` - the left exponent +- `beta` - the right exponent + +Output Parameters: +- `x` - array of length `npoints`, the locations of the quadrature points +- `w` - array of length `npoints`, the weights of the quadrature points + +Level: intermediate + +-seealso: `PetscDTGaussQuadrature()` + +# External Links +$(_doc_external("DM/PetscDTGaussJacobiQuadrature")) +""" +function PetscDTGaussJacobiQuadrature(petsclib::PetscLibType, npoints::PetscInt, a::PetscReal, b::PetscReal, alpha::PetscReal, beta::PetscReal) end + +@for_petsc function PetscDTGaussJacobiQuadrature(petsclib::$UnionPetscLib, npoints::$PetscInt, a::$PetscReal, b::$PetscReal, alpha::$PetscReal, beta::$PetscReal ) + x = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + w = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTGaussJacobiQuadrature, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscReal, $PetscReal, $PetscReal, $PetscReal, Ptr{$PetscReal}, Ptr{$PetscReal}), + npoints, a, b, alpha, beta, x, w, + ) + + + return x,w +end + +""" + x::Vector{PetscReal},w::Vector{PetscReal} = PetscDTGaussLobattoJacobiQuadrature(petsclib::PetscLibType,npoints::PetscInt, a::PetscReal, b::PetscReal, alpha::PetscReal, beta::PetscReal) +quadrature for the interval [a, b] with the weight function +(x-a)^\alpha (x-b)^\beta, with endpoints `a` and `b` included as quadrature points. + +Not Collective + +Input Parameters: +- `npoints` - the number of points in the quadrature rule +- `a` - the left endpoint of the interval +- `b` - the right endpoint of the interval +- `alpha` - the left exponent +- `beta` - the right exponent + +Output Parameters: +- `x` - array of length `npoints`, the locations of the quadrature points +- `w` - array of length `npoints`, the weights of the quadrature points + +Level: intermediate + +-seealso: `PetscDTGaussJacobiQuadrature()` + +# External Links +$(_doc_external("DM/PetscDTGaussLobattoJacobiQuadrature")) +""" +function PetscDTGaussLobattoJacobiQuadrature(petsclib::PetscLibType, npoints::PetscInt, a::PetscReal, b::PetscReal, alpha::PetscReal, beta::PetscReal) end + +@for_petsc function PetscDTGaussLobattoJacobiQuadrature(petsclib::$UnionPetscLib, npoints::$PetscInt, a::$PetscReal, b::$PetscReal, alpha::$PetscReal, beta::$PetscReal ) + x = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + w = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTGaussLobattoJacobiQuadrature, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscReal, $PetscReal, $PetscReal, $PetscReal, Ptr{$PetscReal}, Ptr{$PetscReal}), + npoints, a, b, alpha, beta, x, w, + ) + + + return x,w +end + +""" + x::Vector{PetscReal},w::Vector{PetscReal} = PetscDTGaussQuadrature(petsclib::PetscLibType,npoints::PetscInt, a::PetscReal, b::PetscReal) +create Gauss + +Not Collective + +Input Parameters: +- `npoints` - number of points +- `a` - left end of interval (often-1) +- `b` - right end of interval (often +1) + +Output Parameters: +- `x` - quadrature points +- `w` - quadrature weights + +Level: intermediate + +-seealso: `PetscDTLegendreEval()`, `PetscDTGaussJacobiQuadrature()` + +# External Links +$(_doc_external("DM/PetscDTGaussQuadrature")) +""" +function PetscDTGaussQuadrature(petsclib::PetscLibType, npoints::PetscInt, a::PetscReal, b::PetscReal) end + +@for_petsc function PetscDTGaussQuadrature(petsclib::$UnionPetscLib, npoints::$PetscInt, a::$PetscReal, b::$PetscReal ) + x = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + w = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTGaussQuadrature, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscReal, $PetscReal, Ptr{$PetscReal}, Ptr{$PetscReal}), + npoints, a, b, x, w, + ) + + + return x,w +end + +""" + x::Vector{PetscReal},w::Vector{PetscReal} = PetscDTGaussLobattoLegendreQuadrature(petsclib::PetscLibType,npoints::PetscInt, type::PetscGaussLobattoLegendreCreateType) +creates a set of the locations and weights of the Gauss +nodes of a given size on the domain [-1,1] + +Not Collective + +Input Parameters: +- `npoints` - number of grid nodes +- `type` - `PETSCGAUSSLOBATTOLEGENDRE_VIA_LINEAR_ALGEBRA` or `PETSCGAUSSLOBATTOLEGENDRE_VIA_NEWTON` + +Output Parameters: +- `x` - quadrature points, pass in an array of length `npoints` +- `w` - quadrature weights, pass in an array of length `npoints` + +Level: intermediate + +-seealso: `PetscDTGaussQuadrature()`, `PetscGaussLobattoLegendreCreateType` + + +# External Links +$(_doc_external("DM/PetscDTGaussLobattoLegendreQuadrature")) +""" +function PetscDTGaussLobattoLegendreQuadrature(petsclib::PetscLibType, npoints::PetscInt, type::PetscGaussLobattoLegendreCreateType) end + +@for_petsc function PetscDTGaussLobattoLegendreQuadrature(petsclib::$UnionPetscLib, npoints::$PetscInt, type::PetscGaussLobattoLegendreCreateType ) + x = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + w = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTGaussLobattoLegendreQuadrature, $petsc_library), + PetscErrorCode, + ($PetscInt, PetscGaussLobattoLegendreCreateType, Ptr{$PetscReal}, Ptr{$PetscReal}), + npoints, type, x, w, + ) + + + return x,w +end + +""" + PetscDTGaussTensorQuadrature(petsclib::PetscLibType,dim::PetscInt, Nc::PetscInt, npoints::PetscInt, a::PetscReal, b::PetscReal, q::PetscQuadrature) +creates a tensor + +Not Collective + +Input Parameters: +- `dim` - The spatial dimension +- `Nc` - The number of components +- `npoints` - number of points in one dimension +- `a` - left end of interval (often-1) +- `b` - right end of interval (often +1) + +Output Parameter: +- `q` - A `PetscQuadrature` object + +Level: intermediate + +-seealso: `PetscDTGaussQuadrature()`, `PetscDTLegendreEval()` + +# External Links +$(_doc_external("DM/PetscDTGaussTensorQuadrature")) +""" +function PetscDTGaussTensorQuadrature(petsclib::PetscLibType, dim::PetscInt, Nc::PetscInt, npoints::PetscInt, a::PetscReal, b::PetscReal, q::PetscQuadrature) end + +@for_petsc function PetscDTGaussTensorQuadrature(petsclib::$UnionPetscLib, dim::$PetscInt, Nc::$PetscInt, npoints::$PetscInt, a::$PetscReal, b::$PetscReal, q::PetscQuadrature ) + + @chk ccall( + (:PetscDTGaussTensorQuadrature, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, $PetscReal, $PetscReal, Ptr{PetscQuadrature}), + dim, Nc, npoints, a, b, q, + ) + + + return nothing +end + +""" + PetscDTStroudConicalQuadrature(petsclib::PetscLibType,dim::PetscInt, Nc::PetscInt, npoints::PetscInt, a::PetscReal, b::PetscReal, q::PetscQuadrature) +create Stroud conical quadrature for a simplex {cite}`karniadakis2005spectral` + +Not Collective + +Input Parameters: +- `dim` - The simplex dimension +- `Nc` - The number of components +- `npoints` - The number of points in one dimension +- `a` - left end of interval (often-1) +- `b` - right end of interval (often +1) + +Output Parameter: +- `q` - A `PetscQuadrature` object + +Level: intermediate + +-seealso: `PetscDTGaussTensorQuadrature()`, `PetscDTGaussQuadrature()` + +# External Links +$(_doc_external("DM/PetscDTStroudConicalQuadrature")) +""" +function PetscDTStroudConicalQuadrature(petsclib::PetscLibType, dim::PetscInt, Nc::PetscInt, npoints::PetscInt, a::PetscReal, b::PetscReal, q::PetscQuadrature) end + +@for_petsc function PetscDTStroudConicalQuadrature(petsclib::$UnionPetscLib, dim::$PetscInt, Nc::$PetscInt, npoints::$PetscInt, a::$PetscReal, b::$PetscReal, q::PetscQuadrature ) + + @chk ccall( + (:PetscDTStroudConicalQuadrature, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, $PetscReal, $PetscReal, Ptr{PetscQuadrature}), + dim, Nc, npoints, a, b, q, + ) + + + return nothing +end + +""" + PetscDTSimplexQuadrature(petsclib::PetscLibType,dim::PetscInt, degree::PetscInt, type::PetscDTSimplexQuadratureType, quad::PetscQuadrature) +Create a quadrature rule for a simplex that exactly integrates polynomials up to a given degree. + +Not Collective + +Input Parameters: +- `dim` - The spatial dimension of the simplex (1 = segment, 2 = triangle, 3 = tetrahedron) +- `degree` - The largest polynomial degree that is required to be integrated exactly +- `type` - `PetscDTSimplexQuadratureType` indicating the type of quadrature rule + +Output Parameter: +- `quad` - A `PetscQuadrature` object for integration over the biunit simplex + +Level: intermediate + +-seealso: `PetscDTSimplexQuadratureType`, `PetscDTGaussQuadrature()`, `PetscDTStroudCononicalQuadrature()`, `PetscQuadrature` + +# External Links +$(_doc_external("DM/PetscDTSimplexQuadrature")) +""" +function PetscDTSimplexQuadrature(petsclib::PetscLibType, dim::PetscInt, degree::PetscInt, type::PetscDTSimplexQuadratureType, quad::PetscQuadrature) end + +@for_petsc function PetscDTSimplexQuadrature(petsclib::$UnionPetscLib, dim::$PetscInt, degree::$PetscInt, type::PetscDTSimplexQuadratureType, quad::PetscQuadrature ) + + @chk ccall( + (:PetscDTSimplexQuadrature, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, PetscDTSimplexQuadratureType, Ptr{PetscQuadrature}), + dim, degree, type, quad, + ) + + + return nothing +end + +""" + PetscDTTanhSinhTensorQuadrature(petsclib::PetscLibType,dim::PetscInt, level::PetscInt, a::PetscReal, b::PetscReal, q::PetscQuadrature) +create tanh + +Not Collective + +Input Parameters: +- `dim` - The cell dimension +- `level` - The number of points in one dimension, 2^l +- `a` - left end of interval (often-1) +- `b` - right end of interval (often +1) + +Output Parameter: +- `q` - A `PetscQuadrature` object + +Level: intermediate + +-seealso: `PetscDTGaussTensorQuadrature()`, `PetscQuadrature` + +# External Links +$(_doc_external("DM/PetscDTTanhSinhTensorQuadrature")) +""" +function PetscDTTanhSinhTensorQuadrature(petsclib::PetscLibType, dim::PetscInt, level::PetscInt, a::PetscReal, b::PetscReal, q::PetscQuadrature) end + +@for_petsc function PetscDTTanhSinhTensorQuadrature(petsclib::$UnionPetscLib, dim::$PetscInt, level::$PetscInt, a::$PetscReal, b::$PetscReal, q::PetscQuadrature ) + + @chk ccall( + (:PetscDTTanhSinhTensorQuadrature, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscReal, $PetscReal, Ptr{PetscQuadrature}), + dim, level, a, b, q, + ) + + + return nothing +end + +""" + sol::PetscReal = PetscDTTanhSinhIntegrate(petsclib::PetscLibType,func::external, a::PetscReal, b::PetscReal, digits::PetscInt, ctx::Cvoid) + +# External Links +$(_doc_external("DM/PetscDTTanhSinhIntegrate")) +""" +function PetscDTTanhSinhIntegrate(petsclib::PetscLibType, func::external, a::PetscReal, b::PetscReal, digits::PetscInt, ctx::Cvoid) end + +@for_petsc function PetscDTTanhSinhIntegrate(petsclib::$UnionPetscLib, func::external, a::$PetscReal, b::$PetscReal, digits::$PetscInt, ctx::Cvoid ) + sol_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTTanhSinhIntegrate, $petsc_library), + PetscErrorCode, + (external, $PetscReal, $PetscReal, $PetscInt, Ptr{Cvoid}, Ptr{$PetscReal}), + func, a, b, digits, ctx, sol_, + ) + + sol = sol_[] + + return sol +end + +""" + sol::PetscReal = PetscDTTanhSinhIntegrateMPFR(petsclib::PetscLibType,func::external, a::PetscReal, b::PetscReal, digits::PetscInt, ctx::Cvoid) + +# External Links +$(_doc_external("DM/PetscDTTanhSinhIntegrateMPFR")) +""" +function PetscDTTanhSinhIntegrateMPFR(petsclib::PetscLibType, func::external, a::PetscReal, b::PetscReal, digits::PetscInt, ctx::Cvoid) end + +@for_petsc function PetscDTTanhSinhIntegrateMPFR(petsclib::$UnionPetscLib, func::external, a::$PetscReal, b::$PetscReal, digits::$PetscInt, ctx::Cvoid ) + sol_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTTanhSinhIntegrateMPFR, $petsc_library), + PetscErrorCode, + (external, $PetscReal, $PetscReal, $PetscInt, Ptr{Cvoid}, Ptr{$PetscReal}), + func, a, b, digits, ctx, sol_, + ) + + sol = sol_[] + + return sol +end + +""" + q::PetscQuadrature = PetscDTTensorQuadratureCreate(petsclib::PetscLibType,q1::PetscQuadrature, q2::PetscQuadrature) +create the tensor product quadrature from two lower + +Not Collective + +Input Parameters: +- `q1` - The first quadrature +- `q2` - The second quadrature + +Output Parameter: +- `q` - A `PetscQuadrature` object + +Level: intermediate + +-seealso: `PetscQuadrature`, `PetscDTGaussTensorQuadrature()` + +# External Links +$(_doc_external("DM/PetscDTTensorQuadratureCreate")) +""" +function PetscDTTensorQuadratureCreate(petsclib::PetscLibType, q1::PetscQuadrature, q2::PetscQuadrature) end + +@for_petsc function PetscDTTensorQuadratureCreate(petsclib::$UnionPetscLib, q1::PetscQuadrature, q2::PetscQuadrature ) + q_ = Ref{PetscQuadrature}() + + @chk ccall( + (:PetscDTTensorQuadratureCreate, $petsc_library), + PetscErrorCode, + (PetscQuadrature, PetscQuadrature, Ptr{PetscQuadrature}), + q1, q2, q_, + ) + + q = q_[] + + return q +end + +""" + R::Vector{PetscReal} = PetscDTReconstructPoly(petsclib::PetscLibType,degree::PetscInt, nsource::PetscInt, sourcex::Vector{PetscReal}, ntarget::PetscInt, targetx::Vector{PetscReal}) +create matrix representing polynomial reconstruction using cell intervals and evaluation at target intervals + +Not Collective + +Input Parameters: +- `degree` - degree of reconstruction polynomial +- `nsource` - number of source intervals +- `sourcex` - sorted coordinates of source cell boundaries (length `nsource`+1) +- `ntarget` - number of target intervals +- `targetx` - sorted coordinates of target cell boundaries (length `ntarget`+1) + +Output Parameter: +- `R` - reconstruction matrix, utarget = sum_s R[t*nsource+s] * usource[s] + +Level: advanced + +-seealso: `PetscDTLegendreEval()` + +# External Links +$(_doc_external("DM/PetscDTReconstructPoly")) +""" +function PetscDTReconstructPoly(petsclib::PetscLibType, degree::PetscInt, nsource::PetscInt, sourcex::Vector{PetscReal}, ntarget::PetscInt, targetx::Vector{PetscReal}) end + +@for_petsc function PetscDTReconstructPoly(petsclib::$UnionPetscLib, degree::$PetscInt, nsource::$PetscInt, sourcex::Vector{$PetscReal}, ntarget::$PetscInt, targetx::Vector{$PetscReal} ) + R = Vector{$PetscReal}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTReconstructPoly, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}, $PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}), + degree, nsource, sourcex, ntarget, targetx, R, + ) + + + return R +end + +""" + in::PetscReal = PetscGaussLobattoLegendreIntegrate(petsclib::PetscLibType,n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}, f::Vector{PetscReal}) +Compute the L2 integral of a function on the GLL points + +Not Collective + +Input Parameters: +- `n` - the number of GLL nodes +- `nodes` - the GLL nodes +- `weights` - the GLL weights +- `f` - the function values at the nodes + +Output Parameter: +- `in` - the value of the integral + +Level: beginner + +-seealso: `PetscDTGaussLobattoLegendreQuadrature()` + +# External Links +$(_doc_external("DM/PetscGaussLobattoLegendreIntegrate")) +""" +function PetscGaussLobattoLegendreIntegrate(petsclib::PetscLibType, n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}, f::Vector{PetscReal}) end + +@for_petsc function PetscGaussLobattoLegendreIntegrate(petsclib::$UnionPetscLib, n::$PetscInt, nodes::Vector{$PetscReal}, weights::Vector{$PetscReal}, f::Vector{$PetscReal} ) + in_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscGaussLobattoLegendreIntegrate, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}, Ptr{$PetscReal}), + n, nodes, weights, f, in_, + ) + + in = in_[] + + return in +end + +""" + AA::PetscReal = PetscGaussLobattoLegendreElementLaplacianCreate(petsclib::PetscLibType,n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}) +computes the Laplacian for a single 1d GLL element + +Not Collective + +Input Parameters: +- `n` - the number of GLL nodes +- `nodes` - the GLL nodes, of length `n` +- `weights` - the GLL weights, of length `n` + +Output Parameter: +- `AA` - the stiffness element, of size `n` by `n` + +Level: beginner + +-seealso: `PetscDTGaussLobattoLegendreQuadrature()`, `PetscGaussLobattoLegendreElementLaplacianDestroy()` + +# External Links +$(_doc_external("DM/PetscGaussLobattoLegendreElementLaplacianCreate")) +""" +function PetscGaussLobattoLegendreElementLaplacianCreate(petsclib::PetscLibType, n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}) end + +@for_petsc function PetscGaussLobattoLegendreElementLaplacianCreate(petsclib::$UnionPetscLib, n::$PetscInt, nodes::Vector{$PetscReal}, weights::Vector{$PetscReal} ) + AA_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscGaussLobattoLegendreElementLaplacianCreate, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscReal), + n, nodes, weights, AA_, + ) + + AA = AA_[] + + return AA +end + +""" + PetscGaussLobattoLegendreElementLaplacianDestroy(petsclib::PetscLibType,n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}, AA::PetscReal) +frees the Laplacian for a single 1d GLL element created with `PetscGaussLobattoLegendreElementLaplacianCreate()` + +Not Collective + +Input Parameters: +- `n` - the number of GLL nodes +- `nodes` - the GLL nodes, ignored +- `weights` - the GLL weightss, ignored +- `AA` - the stiffness element from `PetscGaussLobattoLegendreElementLaplacianCreate()` + +Level: beginner + +-seealso: `PetscDTGaussLobattoLegendreQuadrature()`, `PetscGaussLobattoLegendreElementLaplacianCreate()` + +# External Links +$(_doc_external("DM/PetscGaussLobattoLegendreElementLaplacianDestroy")) +""" +function PetscGaussLobattoLegendreElementLaplacianDestroy(petsclib::PetscLibType, n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}, AA::PetscReal) end + +@for_petsc function PetscGaussLobattoLegendreElementLaplacianDestroy(petsclib::$UnionPetscLib, n::$PetscInt, nodes::Vector{$PetscReal}, weights::Vector{$PetscReal}, AA::$PetscReal ) + + @chk ccall( + (:PetscGaussLobattoLegendreElementLaplacianDestroy, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscReal), + n, nodes, weights, AA, + ) + + + return nothing +end + +""" + AA::PetscReal,AAT::PetscReal = PetscGaussLobattoLegendreElementGradientCreate(petsclib::PetscLibType,n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}) +computes the gradient for a single 1d GLL element + +Not Collective + +Input Parameters: +- `n` - the number of GLL nodes +- `nodes` - the GLL nodes, of length `n` +- `weights` - the GLL weights, of length `n` + +Output Parameters: +- `AA` - the stiffness element, of dimension `n` by `n` +- `AAT` - the transpose of AA (pass in `NULL` if you do not need this array), of dimension `n` by `n` + +Level: beginner + +-seealso: `PetscDTGaussLobattoLegendreQuadrature()`, `PetscGaussLobattoLegendreElementLaplacianDestroy()`, `PetscGaussLobattoLegendreElementGradientDestroy()` + +# External Links +$(_doc_external("DM/PetscGaussLobattoLegendreElementGradientCreate")) +""" +function PetscGaussLobattoLegendreElementGradientCreate(petsclib::PetscLibType, n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}) end + +@for_petsc function PetscGaussLobattoLegendreElementGradientCreate(petsclib::$UnionPetscLib, n::$PetscInt, nodes::Vector{$PetscReal}, weights::Vector{$PetscReal} ) + AA_ = Ref{$PetscReal}() + AAT_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscGaussLobattoLegendreElementGradientCreate, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscReal, $PetscReal), + n, nodes, weights, AA_, AAT_, + ) + + AA = AA_[] + AAT = AAT_[] + + return AA,AAT +end + +""" + PetscGaussLobattoLegendreElementGradientDestroy(petsclib::PetscLibType,n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}, AA::PetscReal, AAT::PetscReal) +frees the gradient for a single 1d GLL element obtained with `PetscGaussLobattoLegendreElementGradientCreate()` + +Not Collective + +Input Parameters: +- `n` - the number of GLL nodes +- `nodes` - the GLL nodes, ignored +- `weights` - the GLL weights, ignored +- `AA` - the stiffness element obtained with `PetscGaussLobattoLegendreElementGradientCreate()` +- `AAT` - the transpose of the element obtained with `PetscGaussLobattoLegendreElementGradientCreate()` + +Level: beginner + +-seealso: `PetscDTGaussLobattoLegendreQuadrature()`, `PetscGaussLobattoLegendreElementLaplacianCreate()`, `PetscGaussLobattoLegendreElementAdvectionCreate()` + +# External Links +$(_doc_external("DM/PetscGaussLobattoLegendreElementGradientDestroy")) +""" +function PetscGaussLobattoLegendreElementGradientDestroy(petsclib::PetscLibType, n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}, AA::PetscReal, AAT::PetscReal) end + +@for_petsc function PetscGaussLobattoLegendreElementGradientDestroy(petsclib::$UnionPetscLib, n::$PetscInt, nodes::Vector{$PetscReal}, weights::Vector{$PetscReal}, AA::$PetscReal, AAT::$PetscReal ) + + @chk ccall( + (:PetscGaussLobattoLegendreElementGradientDestroy, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscReal, $PetscReal), + n, nodes, weights, AA, AAT, + ) + + + return nothing +end + +""" + AA::PetscReal = PetscGaussLobattoLegendreElementAdvectionCreate(petsclib::PetscLibType,n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}) +computes the advection operator for a single 1d GLL element + +Not Collective + +Input Parameters: +- `n` - the number of GLL nodes +- `nodes` - the GLL nodes, of length `n` +- `weights` - the GLL weights, of length `n` + +Output Parameter: +- `AA` - the stiffness element, of dimension `n` by `n` + +Level: beginner + +-seealso: `PetscDTGaussLobattoLegendreQuadrature()`, `PetscGaussLobattoLegendreElementLaplacianCreate()`, `PetscGaussLobattoLegendreElementAdvectionDestroy()` + +# External Links +$(_doc_external("DM/PetscGaussLobattoLegendreElementAdvectionCreate")) +""" +function PetscGaussLobattoLegendreElementAdvectionCreate(petsclib::PetscLibType, n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}) end + +@for_petsc function PetscGaussLobattoLegendreElementAdvectionCreate(petsclib::$UnionPetscLib, n::$PetscInt, nodes::Vector{$PetscReal}, weights::Vector{$PetscReal} ) + AA_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscGaussLobattoLegendreElementAdvectionCreate, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscReal), + n, nodes, weights, AA_, + ) + + AA = AA_[] + + return AA +end + +""" + PetscGaussLobattoLegendreElementAdvectionDestroy(petsclib::PetscLibType,n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}, AA::PetscReal) +frees the advection stiffness for a single 1d GLL element created with `PetscGaussLobattoLegendreElementAdvectionCreate()` + +Not Collective + +Input Parameters: +- `n` - the number of GLL nodes +- `nodes` - the GLL nodes, ignored +- `weights` - the GLL weights, ignored +- `AA` - advection obtained with `PetscGaussLobattoLegendreElementAdvectionCreate()` + +Level: beginner + +-seealso: `PetscDTGaussLobattoLegendreQuadrature()`, `PetscGaussLobattoLegendreElementAdvectionCreate()` + +# External Links +$(_doc_external("DM/PetscGaussLobattoLegendreElementAdvectionDestroy")) +""" +function PetscGaussLobattoLegendreElementAdvectionDestroy(petsclib::PetscLibType, n::PetscInt, nodes::Vector{PetscReal}, weights::Vector{PetscReal}, AA::PetscReal) end + +@for_petsc function PetscGaussLobattoLegendreElementAdvectionDestroy(petsclib::$UnionPetscLib, n::$PetscInt, nodes::Vector{$PetscReal}, weights::Vector{$PetscReal}, AA::$PetscReal ) + + @chk ccall( + (:PetscGaussLobattoLegendreElementAdvectionDestroy, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscReal), + n, nodes, weights, AA, + ) + + + return nothing +end + +""" + nodes::PetscReal,weights::PetscReal = PetscGaussLobattoLegendreElementMassCreate(petsclib::PetscLibType,n::PetscInt, AA::PetscReal) + +# External Links +$(_doc_external("DM/PetscGaussLobattoLegendreElementMassCreate")) +""" +function PetscGaussLobattoLegendreElementMassCreate(petsclib::PetscLibType, n::PetscInt, AA::PetscReal) end + +@for_petsc function PetscGaussLobattoLegendreElementMassCreate(petsclib::$UnionPetscLib, n::$PetscInt, AA::$PetscReal ) + nodes_ = Ref{$PetscReal}() + weights_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscGaussLobattoLegendreElementMassCreate, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscReal), + n, nodes_, weights_, AA, + ) + + nodes = nodes_[] + weights = weights_[] + + return nodes,weights +end + +""" + nodes::PetscReal,weights::PetscReal = PetscGaussLobattoLegendreElementMassDestroy(petsclib::PetscLibType,n::PetscInt, AA::PetscReal) + +# External Links +$(_doc_external("DM/PetscGaussLobattoLegendreElementMassDestroy")) +""" +function PetscGaussLobattoLegendreElementMassDestroy(petsclib::PetscLibType, n::PetscInt, AA::PetscReal) end + +@for_petsc function PetscGaussLobattoLegendreElementMassDestroy(petsclib::$UnionPetscLib, n::$PetscInt, AA::$PetscReal ) + nodes_ = Ref{$PetscReal}() + weights_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscGaussLobattoLegendreElementMassDestroy, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}, Ptr{$PetscReal}, $PetscReal), + n, nodes_, weights_, AA, + ) + + nodes = nodes_[] + weights = weights_[] + + return nodes,weights +end + +""" + coord::Vector{PetscInt} = PetscDTIndexToBary(petsclib::PetscLibType,len::PetscInt, sum::PetscInt, index::PetscInt) +convert an index into a barycentric coordinate. + +Input Parameters: +- `len` - the desired length of the barycentric tuple (usually 1 more than the dimension it represents, so a barycentric coordinate in a triangle has length 3) +- `sum` - the value that the sum of the barycentric coordinates (which will be non-negative integers) should sum to +- `index` - the index to convert: should be >= 0 and < Binomial(len - 1 + sum, sum) + +Output Parameter: +- `coord` - will be filled with the barycentric coordinate, of length `n` + +Level: beginner + +-seealso: `PetscDTBaryToIndex()` + +# External Links +$(_doc_external("DM/PetscDTIndexToBary")) +""" +function PetscDTIndexToBary(petsclib::PetscLibType, len::PetscInt, sum::PetscInt, index::PetscInt) end + +@for_petsc function PetscDTIndexToBary(petsclib::$UnionPetscLib, len::$PetscInt, sum::$PetscInt, index::$PetscInt ) + coord = Vector{$PetscInt}(undef, ni); # CHECK SIZE!! + + @chk ccall( + (:PetscDTIndexToBary, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}), + len, sum, index, coord, + ) + + + return coord +end + +""" + index::PetscInt = PetscDTBaryToIndex(petsclib::PetscLibType,len::PetscInt, sum::PetscInt, coord::Vector{PetscInt}) +convert a barycentric coordinate to an index + +Input Parameters: +- `len` - the desired length of the barycentric tuple (usually 1 more than the dimension it represents, so a barycentric coordinate in a triangle has length 3) +- `sum` - the value that the sum of the barycentric coordinates (which will be non-negative integers) should sum to +- `coord` - a barycentric coordinate with the given length `len` and `sum` + +Output Parameter: +- `index` - the unique index for the coordinate, >= 0 and < Binomial(len - 1 + sum, sum) + +Level: beginner + +-seealso: `PetscDTIndexToBary` + +# External Links +$(_doc_external("DM/PetscDTBaryToIndex")) +""" +function PetscDTBaryToIndex(petsclib::PetscLibType, len::PetscInt, sum::PetscInt, coord::Vector{PetscInt}) end + +@for_petsc function PetscDTBaryToIndex(petsclib::$UnionPetscLib, len::$PetscInt, sum::$PetscInt, coord::Vector{$PetscInt} ) + index_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDTBaryToIndex, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + len, sum, coord, index_, + ) + + index = index_[] + + return index +end + +""" + q::PetscQuadrature,fq::PetscQuadrature = PetscDTCreateQuadratureByCell(petsclib::PetscLibType,ct::DMPolytopeType, qorder::PetscInt, qtype::PetscDTSimplexQuadratureType) +Create default quadrature for a given cell + +Not collective + +Input Parameters: +- `ct` - The integration domain +- `qorder` - The desired quadrature order +- `qtype` - The type of simplex quadrature, or PETSCDTSIMPLEXQUAD_DEFAULT + +Output Parameters: +- `q` - The cell quadrature +- `fq` - The face quadrature + +Level: developer + +-seealso: `PetscDTCreateDefaultQuadrature()`, `PetscFECreateDefault()`, `PetscDTGaussTensorQuadrature()`, `PetscDTSimplexQuadrature()`, `PetscDTTensorQuadratureCreate()` + +# External Links +$(_doc_external("DM/PetscDTCreateQuadratureByCell")) +""" +function PetscDTCreateQuadratureByCell(petsclib::PetscLibType, ct::DMPolytopeType, qorder::PetscInt, qtype::PetscDTSimplexQuadratureType) end + +@for_petsc function PetscDTCreateQuadratureByCell(petsclib::$UnionPetscLib, ct::DMPolytopeType, qorder::$PetscInt, qtype::PetscDTSimplexQuadratureType ) + q_ = Ref{PetscQuadrature}() + fq_ = Ref{PetscQuadrature}() + + @chk ccall( + (:PetscDTCreateQuadratureByCell, $petsc_library), + PetscErrorCode, + (DMPolytopeType, $PetscInt, PetscDTSimplexQuadratureType, Ptr{PetscQuadrature}, Ptr{PetscQuadrature}), + ct, qorder, qtype, q_, fq_, + ) + + q = q_[] + fq = fq_[] + + return q,fq +end + +""" + q::PetscQuadrature,fq::PetscQuadrature = PetscDTCreateDefaultQuadrature(petsclib::PetscLibType,ct::DMPolytopeType, qorder::PetscInt) +Create default quadrature for a given cell + +Not collective + +Input Parameters: +- `ct` - The integration domain +- `qorder` - The desired quadrature order + +Output Parameters: +- `q` - The cell quadrature +- `fq` - The face quadrature + +Level: developer + +-seealso: `PetscDTCreateQuadratureByCell()`, `PetscFECreateDefault()`, `PetscDTGaussTensorQuadrature()`, `PetscDTSimplexQuadrature()`, `PetscDTTensorQuadratureCreate()` + +# External Links +$(_doc_external("DM/PetscDTCreateDefaultQuadrature")) +""" +function PetscDTCreateDefaultQuadrature(petsclib::PetscLibType, ct::DMPolytopeType, qorder::PetscInt) end + +@for_petsc function PetscDTCreateDefaultQuadrature(petsclib::$UnionPetscLib, ct::DMPolytopeType, qorder::$PetscInt ) + q_ = Ref{PetscQuadrature}() + fq_ = Ref{PetscQuadrature}() + + @chk ccall( + (:PetscDTCreateDefaultQuadrature, $petsc_library), + PetscErrorCode, + (DMPolytopeType, $PetscInt, Ptr{PetscQuadrature}, Ptr{PetscQuadrature}), + ct, qorder, q_, fq_, + ) + + q = q_[] + fq = fq_[] + + return q,fq +end + +""" + PetscHDF5IntCast(petsclib::PetscLibType,a::PetscInt, b::hCsize_t) + +# External Links +$(_doc_external("Viewer/PetscHDF5IntCast")) +""" +function PetscHDF5IntCast(petsclib::PetscLibType, a::PetscInt, b::hCsize_t) end + +@for_petsc function PetscHDF5IntCast(petsclib::$UnionPetscLib, a::$PetscInt, b::hCsize_t ) + + @chk ccall( + (:PetscHDF5IntCast, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{hCsize_t}), + a, b, + ) + + + return nothing +end + +""" + PetscStrtolower(petsclib::PetscLibType,a::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrtolower")) +""" +function PetscStrtolower(petsclib::PetscLibType, a::Vector{Cchar}) end + +@for_petsc function PetscStrtolower(petsclib::$UnionPetscLib, a::Vector{Cchar} ) + + @chk ccall( + (:PetscStrtolower, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + a, + ) + + + return nothing +end + +""" + PetscStrtoupper(petsclib::PetscLibType,a::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrtoupper")) +""" +function PetscStrtoupper(petsclib::PetscLibType, a::Vector{Cchar}) end + +@for_petsc function PetscStrtoupper(petsclib::$UnionPetscLib, a::Vector{Cchar} ) + + @chk ccall( + (:PetscStrtoupper, $petsc_library), + PetscErrorCode, + (Ptr{Cchar},), + a, + ) + + + return nothing +end + +""" + PetscStrlen(petsclib::PetscLibType,s::Vector{Cchar}, len::Csize_t) + +# External Links +$(_doc_external("Sys/PetscStrlen")) +""" +function PetscStrlen(petsclib::PetscLibType, s::Vector{Cchar}, len::Csize_t) end + +@for_petsc function PetscStrlen(petsclib::$UnionPetscLib, s::Vector{Cchar}, len::Csize_t ) + + @chk ccall( + (:PetscStrlen, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Csize_t}), + s, len, + ) + + + return nothing +end + +""" + PetscStrallocpy(petsclib::PetscLibType,s::Vector{Cchar}, t::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrallocpy")) +""" +function PetscStrallocpy(petsclib::PetscLibType, s::Vector{Cchar}, t::Vector{Cchar}) end + +@for_petsc function PetscStrallocpy(petsclib::$UnionPetscLib, s::Vector{Cchar}, t::Vector{Cchar} ) + t_ = Ref(pointer(t)) + + @chk ccall( + (:PetscStrallocpy, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Ptr{Cchar}}), + s, t_, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscStrcmp(petsclib::PetscLibType,a::Vector{Cchar}, b::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrcmp")) +""" +function PetscStrcmp(petsclib::PetscLibType, a::Vector{Cchar}, b::Vector{Cchar}) end + +@for_petsc function PetscStrcmp(petsclib::$UnionPetscLib, a::Vector{Cchar}, b::Vector{Cchar} ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscStrcmp, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}), + a, b, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscStrncpy(petsclib::PetscLibType,s::Vector{Cchar}, t::Vector{Cchar}, n::Csize_t) + +# External Links +$(_doc_external("Sys/PetscStrncpy")) +""" +function PetscStrncpy(petsclib::PetscLibType, s::Vector{Cchar}, t::Vector{Cchar}, n::Csize_t) end + +@for_petsc function PetscStrncpy(petsclib::$UnionPetscLib, s::Vector{Cchar}, t::Vector{Cchar}, n::Csize_t ) + + @chk ccall( + (:PetscStrncpy, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Csize_t), + s, t, n, + ) + + + return nothing +end + +""" + PetscStrlcat(petsclib::PetscLibType,s::Vector{Cchar}, t::Vector{Cchar}, n::Csize_t) + +# External Links +$(_doc_external("Sys/PetscStrlcat")) +""" +function PetscStrlcat(petsclib::PetscLibType, s::Vector{Cchar}, t::Vector{Cchar}, n::Csize_t) end + +@for_petsc function PetscStrlcat(petsclib::$UnionPetscLib, s::Vector{Cchar}, t::Vector{Cchar}, n::Csize_t ) + + @chk ccall( + (:PetscStrlcat, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Csize_t), + s, t, n, + ) + + + return nothing +end + +""" + t::PetscBool = PetscStrncmp(petsclib::PetscLibType,a::Vector{Cchar}, b::Vector{Cchar}, n::Csize_t) + +# External Links +$(_doc_external("Sys/PetscStrncmp")) +""" +function PetscStrncmp(petsclib::PetscLibType, a::Vector{Cchar}, b::Vector{Cchar}, n::Csize_t) end + +@for_petsc function PetscStrncmp(petsclib::$UnionPetscLib, a::Vector{Cchar}, b::Vector{Cchar}, n::Csize_t ) + t_ = Ref{PetscBool}() + + @chk ccall( + (:PetscStrncmp, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Csize_t, Ptr{PetscBool}), + a, b, n, t_, + ) + + t = t_[] + + return t +end + +""" + PetscStrrstr(petsclib::PetscLibType,a::Vector{Cchar}, b::Vector{Cchar}, tmp::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrrstr")) +""" +function PetscStrrstr(petsclib::PetscLibType, a::Vector{Cchar}, b::Vector{Cchar}, tmp::Vector{Cchar}) end + +@for_petsc function PetscStrrstr(petsclib::$UnionPetscLib, a::Vector{Cchar}, b::Vector{Cchar}, tmp::Vector{Cchar} ) + tmp_ = Ref(pointer(tmp)) + + @chk ccall( + (:PetscStrrstr, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Ptr{Cchar}}), + a, b, tmp_, + ) + + + return nothing +end + +""" + PetscStrstr(petsclib::PetscLibType,haystack::Vector{Cchar}, needle::Vector{Cchar}, tmp::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrstr")) +""" +function PetscStrstr(petsclib::PetscLibType, haystack::Vector{Cchar}, needle::Vector{Cchar}, tmp::Vector{Cchar}) end + +@for_petsc function PetscStrstr(petsclib::$UnionPetscLib, haystack::Vector{Cchar}, needle::Vector{Cchar}, tmp::Vector{Cchar} ) + tmp_ = Ref(pointer(tmp)) + + @chk ccall( + (:PetscStrstr, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Ptr{Cchar}}), + haystack, needle, tmp_, + ) + + + return nothing +end + +""" + t::PetscBool = PetscStrgrt(petsclib::PetscLibType,a::Vector{Cchar}, b::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrgrt")) +""" +function PetscStrgrt(petsclib::PetscLibType, a::Vector{Cchar}, b::Vector{Cchar}) end + +@for_petsc function PetscStrgrt(petsclib::$UnionPetscLib, a::Vector{Cchar}, b::Vector{Cchar} ) + t_ = Ref{PetscBool}() + + @chk ccall( + (:PetscStrgrt, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}), + a, b, t_, + ) + + t = t_[] + + return t +end + +""" + PetscStrchr(petsclib::PetscLibType,a::Vector{Cchar}, b::Cchar, c::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrchr")) +""" +function PetscStrchr(petsclib::PetscLibType, a::Vector{Cchar}, b::Cchar, c::Vector{Cchar}) end + +@for_petsc function PetscStrchr(petsclib::$UnionPetscLib, a::Vector{Cchar}, b::Cchar, c::Vector{Cchar} ) + c_ = Ref(pointer(c)) + + @chk ccall( + (:PetscStrchr, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cchar, Ptr{Ptr{Cchar}}), + a, b, c_, + ) + + + return nothing +end + +""" + PetscStrrchr(petsclib::PetscLibType,a::Vector{Cchar}, b::Cchar, c::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrrchr")) +""" +function PetscStrrchr(petsclib::PetscLibType, a::Vector{Cchar}, b::Cchar, c::Vector{Cchar}) end + +@for_petsc function PetscStrrchr(petsclib::$UnionPetscLib, a::Vector{Cchar}, b::Cchar, c::Vector{Cchar} ) + c_ = Ref(pointer(c)) + + @chk ccall( + (:PetscStrrchr, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Cchar, Ptr{Ptr{Cchar}}), + a, b, c_, + ) + + + return nothing +end + +""" + flg::PetscBool = PetscStrendswith(petsclib::PetscLibType,a::Vector{Cchar}, b::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrendswith")) +""" +function PetscStrendswith(petsclib::PetscLibType, a::Vector{Cchar}, b::Vector{Cchar}) end + +@for_petsc function PetscStrendswith(petsclib::$UnionPetscLib, a::Vector{Cchar}, b::Vector{Cchar} ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscStrendswith, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}), + a, b, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + flg::PetscBool = PetscStrbeginswith(petsclib::PetscLibType,a::Vector{Cchar}, b::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscStrbeginswith")) +""" +function PetscStrbeginswith(petsclib::PetscLibType, a::Vector{Cchar}, b::Vector{Cchar}) end + +@for_petsc function PetscStrbeginswith(petsclib::$UnionPetscLib, a::Vector{Cchar}, b::Vector{Cchar} ) + flg_ = Ref{PetscBool}() + + @chk ccall( + (:PetscStrbeginswith, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}), + a, b, flg_, + ) + + flg = flg_[] + + return flg +end + +""" + PetscMemmove(petsclib::PetscLibType,a::Cvoid, b::Cvoid, n::Csize_t) + +# External Links +$(_doc_external("Sys/PetscMemmove")) +""" +function PetscMemmove(petsclib::PetscLibType, a::Cvoid, b::Cvoid, n::Csize_t) end + +@for_petsc function PetscMemmove(petsclib::$UnionPetscLib, a::Cvoid, b::Cvoid, n::Csize_t ) + + @chk ccall( + (:PetscMemmove, $petsc_library), + PetscErrorCode, + (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), + a, b, n, + ) + + + return nothing +end + +""" + PetscMemcpy(petsclib::PetscLibType,a::Cvoid, b::Cvoid, n::Csize_t) + +# External Links +$(_doc_external("Sys/PetscMemcpy")) +""" +function PetscMemcpy(petsclib::PetscLibType, a::Cvoid, b::Cvoid, n::Csize_t) end + +@for_petsc function PetscMemcpy(petsclib::$UnionPetscLib, a::Cvoid, b::Cvoid, n::Csize_t ) + + @chk ccall( + (:PetscMemcpy, $petsc_library), + PetscErrorCode, + (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), + a, b, n, + ) + + + return nothing +end + +""" + PetscMemzero(petsclib::PetscLibType,a::Cvoid, n::Csize_t) + +# External Links +$(_doc_external("Sys/PetscMemzero")) +""" +function PetscMemzero(petsclib::PetscLibType, a::Cvoid, n::Csize_t) end + +@for_petsc function PetscMemzero(petsclib::$UnionPetscLib, a::Cvoid, n::Csize_t ) + + @chk ccall( + (:PetscMemzero, $petsc_library), + PetscErrorCode, + (Ptr{Cvoid}, Csize_t), + a, n, + ) + + + return nothing +end + +""" + PetscBTMemzero(petsclib::PetscLibType,m::PetscCount, array::PetscBT) + +# External Links +$(_doc_external("Sys/PetscBTMemzero")) +""" +function PetscBTMemzero(petsclib::PetscLibType, m::PetscCount, array::PetscBT) end + +@for_petsc function PetscBTMemzero(petsclib::$UnionPetscLib, m::PetscCount, array::PetscBT ) + + @chk ccall( + (:PetscBTMemzero, $petsc_library), + PetscErrorCode, + (PetscCount, PetscBT), + m, array, + ) + + + return nothing +end + +""" + PetscBTDestroy(petsclib::PetscLibType,array::PetscBT) + +# External Links +$(_doc_external("Sys/PetscBTDestroy")) +""" +function PetscBTDestroy(petsclib::PetscLibType, array::PetscBT) end + +@for_petsc function PetscBTDestroy(petsclib::$UnionPetscLib, array::PetscBT ) + + @chk ccall( + (:PetscBTDestroy, $petsc_library), + PetscErrorCode, + (Ptr{PetscBT},), + array, + ) + + + return nothing +end + +""" + array::PetscBT = PetscBTCreate(petsclib::PetscLibType,m::PetscCount) + +# External Links +$(_doc_external("Sys/PetscBTCreate")) +""" +function PetscBTCreate(petsclib::PetscLibType, m::PetscCount) end + +@for_petsc function PetscBTCreate(petsclib::$UnionPetscLib, m::PetscCount ) + array_ = Ref{PetscBT}() + + @chk ccall( + (:PetscBTCreate, $petsc_library), + PetscErrorCode, + (PetscCount, Ptr{PetscBT}), + m, array_, + ) + + array = array_[] + + return array +end + +""" + PetscBTCopy(petsclib::PetscLibType,dest::PetscBT, m::PetscCount, source::PetscBT) + +# External Links +$(_doc_external("Sys/PetscBTCopy")) +""" +function PetscBTCopy(petsclib::PetscLibType, dest::PetscBT, m::PetscCount, source::PetscBT) end + +@for_petsc function PetscBTCopy(petsclib::$UnionPetscLib, dest::PetscBT, m::PetscCount, source::PetscBT ) + + @chk ccall( + (:PetscBTCopy, $petsc_library), + PetscErrorCode, + (PetscBT, PetscCount, PetscBT), + dest, m, source, + ) + + + return nothing +end + +""" + PetscBTSet(petsclib::PetscLibType,array::PetscBT, index::PetscCount) + +# External Links +$(_doc_external("Sys/PetscBTSet")) +""" +function PetscBTSet(petsclib::PetscLibType, array::PetscBT, index::PetscCount) end + +@for_petsc function PetscBTSet(petsclib::$UnionPetscLib, array::PetscBT, index::PetscCount ) + + @chk ccall( + (:PetscBTSet, $petsc_library), + PetscErrorCode, + (PetscBT, PetscCount), + array, index, + ) + + + return nothing +end + +""" + PetscBTNegate(petsclib::PetscLibType,array::PetscBT, index::PetscCount) + +# External Links +$(_doc_external("Sys/PetscBTNegate")) +""" +function PetscBTNegate(petsclib::PetscLibType, array::PetscBT, index::PetscCount) end + +@for_petsc function PetscBTNegate(petsclib::$UnionPetscLib, array::PetscBT, index::PetscCount ) + + @chk ccall( + (:PetscBTNegate, $petsc_library), + PetscErrorCode, + (PetscBT, PetscCount), + array, index, + ) + + + return nothing +end + +""" + PetscBTClear(petsclib::PetscLibType,array::PetscBT, index::PetscCount) + +# External Links +$(_doc_external("Sys/PetscBTClear")) +""" +function PetscBTClear(petsclib::PetscLibType, array::PetscBT, index::PetscCount) end + +@for_petsc function PetscBTClear(petsclib::$UnionPetscLib, array::PetscBT, index::PetscCount ) + + @chk ccall( + (:PetscBTClear, $petsc_library), + PetscErrorCode, + (PetscBT, PetscCount), + array, index, + ) + + + return nothing +end + +""" + PetscLogGpuFlops(petsclib::PetscLibType,n::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscLogGpuFlops")) +""" +function PetscLogGpuFlops(petsclib::PetscLibType, n::PetscLogDouble) end + +@for_petsc function PetscLogGpuFlops(petsclib::$UnionPetscLib, n::PetscLogDouble ) + + @chk ccall( + (:PetscLogGpuFlops, $petsc_library), + PetscErrorCode, + (PetscLogDouble,), + n, + ) + + + return nothing +end + +""" + PetscLogGpuTimeAdd(petsclib::PetscLibType,t::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscLogGpuTimeAdd")) +""" +function PetscLogGpuTimeAdd(petsclib::PetscLibType, t::PetscLogDouble) end + +@for_petsc function PetscLogGpuTimeAdd(petsclib::$UnionPetscLib, t::PetscLogDouble ) + + @chk ccall( + (:PetscLogGpuTimeAdd, $petsc_library), + PetscErrorCode, + (PetscLogDouble,), + t, + ) + + + return nothing +end + +""" + PetscLogCpuToGpu(petsclib::PetscLibType,size::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscLogCpuToGpu")) +""" +function PetscLogCpuToGpu(petsclib::PetscLibType, size::PetscLogDouble) end + +@for_petsc function PetscLogCpuToGpu(petsclib::$UnionPetscLib, size::PetscLogDouble ) + + @chk ccall( + (:PetscLogCpuToGpu, $petsc_library), + PetscErrorCode, + (PetscLogDouble,), + size, + ) + + + return nothing +end + +""" + PetscLogGpuToCpu(petsclib::PetscLibType,size::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscLogGpuToCpu")) +""" +function PetscLogGpuToCpu(petsclib::PetscLibType, size::PetscLogDouble) end + +@for_petsc function PetscLogGpuToCpu(petsclib::$UnionPetscLib, size::PetscLogDouble ) + + @chk ccall( + (:PetscLogGpuToCpu, $petsc_library), + PetscErrorCode, + (PetscLogDouble,), + size, + ) + + + return nothing +end + +""" + PetscLogCpuToGpuScalar(petsclib::PetscLibType,size::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscLogCpuToGpuScalar")) +""" +function PetscLogCpuToGpuScalar(petsclib::PetscLibType, size::PetscLogDouble) end + +@for_petsc function PetscLogCpuToGpuScalar(petsclib::$UnionPetscLib, size::PetscLogDouble ) + + @chk ccall( + (:PetscLogCpuToGpuScalar, $petsc_library), + PetscErrorCode, + (PetscLogDouble,), + size, + ) + + + return nothing +end + +""" + PetscLogGpuToCpuScalar(petsclib::PetscLibType,size::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscLogGpuToCpuScalar")) +""" +function PetscLogGpuToCpuScalar(petsclib::PetscLibType, size::PetscLogDouble) end + +@for_petsc function PetscLogGpuToCpuScalar(petsclib::$UnionPetscLib, size::PetscLogDouble ) + + @chk ccall( + (:PetscLogGpuToCpuScalar, $petsc_library), + PetscErrorCode, + (PetscLogDouble,), + size, + ) + + + return nothing +end + +""" + b::PetscInt = PetscIntCast(petsclib::PetscLibType,a::MPIU_Count) + +# External Links +$(_doc_external("Sys/PetscIntCast")) +""" +function PetscIntCast(petsclib::PetscLibType, a::MPIU_Count) end + +@for_petsc function PetscIntCast(petsclib::$UnionPetscLib, a::MPIU_Count ) + b_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscIntCast, $petsc_library), + PetscErrorCode, + (MPIU_Count, Ptr{$PetscInt}), + a, b_, + ) + + b = b_[] + + return b +end + +""" + PetscBLASIntCast(petsclib::PetscLibType,a::MPIU_Count, b::PetscBLASInt) + +# External Links +$(_doc_external("Sys/PetscBLASIntCast")) +""" +function PetscBLASIntCast(petsclib::PetscLibType, a::MPIU_Count, b::PetscBLASInt) end + +@for_petsc function PetscBLASIntCast(petsclib::$UnionPetscLib, a::MPIU_Count, b::PetscBLASInt ) + + @chk ccall( + (:PetscBLASIntCast, $petsc_library), + PetscErrorCode, + (MPIU_Count, Ptr{PetscBLASInt}), + a, b, + ) + + + return nothing +end + +""" + PetscCuBLASIntCast(petsclib::PetscLibType,a::MPIU_Count, b::PetscCuBLASInt) + +# External Links +$(_doc_external("Sys/PetscCuBLASIntCast")) +""" +function PetscCuBLASIntCast(petsclib::PetscLibType, a::MPIU_Count, b::PetscCuBLASInt) end + +@for_petsc function PetscCuBLASIntCast(petsclib::$UnionPetscLib, a::MPIU_Count, b::PetscCuBLASInt ) + + @chk ccall( + (:PetscCuBLASIntCast, $petsc_library), + PetscErrorCode, + (MPIU_Count, Ptr{PetscCuBLASInt}), + a, b, + ) + + + return nothing +end + +""" + PetscHipBLASIntCast(petsclib::PetscLibType,a::MPIU_Count, b::PetscHipBLASInt) + +# External Links +$(_doc_external("Sys/PetscHipBLASIntCast")) +""" +function PetscHipBLASIntCast(petsclib::PetscLibType, a::MPIU_Count, b::PetscHipBLASInt) end + +@for_petsc function PetscHipBLASIntCast(petsclib::$UnionPetscLib, a::MPIU_Count, b::PetscHipBLASInt ) + + @chk ccall( + (:PetscHipBLASIntCast, $petsc_library), + PetscErrorCode, + (MPIU_Count, Ptr{PetscHipBLASInt}), + a, b, + ) + + + return nothing +end + +""" + PetscMPIIntCast(petsclib::PetscLibType,a::MPIU_Count, b::PetscMPIInt) + +# External Links +$(_doc_external("Sys/PetscMPIIntCast")) +""" +function PetscMPIIntCast(petsclib::PetscLibType, a::MPIU_Count, b::PetscMPIInt) end + +@for_petsc function PetscMPIIntCast(petsclib::$UnionPetscLib, a::MPIU_Count, b::PetscMPIInt ) + + @chk ccall( + (:PetscMPIIntCast, $petsc_library), + PetscErrorCode, + (MPIU_Count, Ptr{PetscMPIInt}), + a, b, + ) + + + return nothing +end + +""" + PetscCIntCast(petsclib::PetscLibType,a::MPIU_Count, b::Cint) + +# External Links +$(_doc_external("Sys/PetscCIntCast")) +""" +function PetscCIntCast(petsclib::PetscLibType, a::MPIU_Count, b::Cint) end + +@for_petsc function PetscCIntCast(petsclib::$UnionPetscLib, a::MPIU_Count, b::Cint ) + + @chk ccall( + (:PetscCIntCast, $petsc_library), + PetscErrorCode, + (MPIU_Count, Ptr{Cint}), + a, b, + ) + + + return nothing +end + +""" + result::PetscInt = PetscIntMultError(petsclib::PetscLibType,a::PetscInt, b::PetscInt) + +# External Links +$(_doc_external("Sys/PetscIntMultError")) +""" +function PetscIntMultError(petsclib::PetscLibType, a::PetscInt, b::PetscInt) end + +@for_petsc function PetscIntMultError(petsclib::$UnionPetscLib, a::$PetscInt, b::$PetscInt ) + result_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscIntMultError, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscInt}), + a, b, result_, + ) + + result = result_[] + + return result +end + +""" + result::PetscInt = PetscIntSumError(petsclib::PetscLibType,a::PetscInt, b::PetscInt) + +# External Links +$(_doc_external("Sys/PetscIntSumError")) +""" +function PetscIntSumError(petsclib::PetscLibType, a::PetscInt, b::PetscInt) end + +@for_petsc function PetscIntSumError(petsclib::$UnionPetscLib, a::$PetscInt, b::$PetscInt ) + result_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscIntSumError, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscInt}), + a, b, result_, + ) + + result = result_[] + + return result +end + +""" + set::PetscBool = PetscCitationsRegister(petsclib::PetscLibType,cit::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscCitationsRegister")) +""" +function PetscCitationsRegister(petsclib::PetscLibType, cit::Vector{Cchar}) end + +@for_petsc function PetscCitationsRegister(petsclib::$UnionPetscLib, cit::Vector{Cchar} ) + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscCitationsRegister, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{PetscBool}), + cit, set_, + ) + + set = set_[] + + return set +end + +""" + factorial::PetscReal = PetscDTFactorial(petsclib::PetscLibType,n::PetscInt) + +# External Links +$(_doc_external("DM/PetscDTFactorial")) +""" +function PetscDTFactorial(petsclib::PetscLibType, n::PetscInt) end + +@for_petsc function PetscDTFactorial(petsclib::$UnionPetscLib, n::$PetscInt ) + factorial_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTFactorial, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscReal}), + n, factorial_, + ) + + factorial = factorial_[] + + return factorial +end + +""" + factorial::PetscInt = PetscDTFactorialInt(petsclib::PetscLibType,n::PetscInt) + +# External Links +$(_doc_external("DM/PetscDTFactorialInt")) +""" +function PetscDTFactorialInt(petsclib::PetscLibType, n::PetscInt) end + +@for_petsc function PetscDTFactorialInt(petsclib::$UnionPetscLib, n::$PetscInt ) + factorial_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDTFactorialInt, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscInt}), + n, factorial_, + ) + + factorial = factorial_[] + + return factorial +end + +""" + binomial::PetscReal = PetscDTBinomial(petsclib::PetscLibType,n::PetscInt, k::PetscInt) + +# External Links +$(_doc_external("DM/PetscDTBinomial")) +""" +function PetscDTBinomial(petsclib::PetscLibType, n::PetscInt, k::PetscInt) end + +@for_petsc function PetscDTBinomial(petsclib::$UnionPetscLib, n::$PetscInt, k::$PetscInt ) + binomial_ = Ref{$PetscReal}() + + @chk ccall( + (:PetscDTBinomial, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscReal}), + n, k, binomial_, + ) + + binomial = binomial_[] + + return binomial +end + +""" + binomial::PetscInt = PetscDTBinomialInt(petsclib::PetscLibType,n::PetscInt, k::PetscInt) + +# External Links +$(_doc_external("DM/PetscDTBinomialInt")) +""" +function PetscDTBinomialInt(petsclib::PetscLibType, n::PetscInt, k::PetscInt) end + +@for_petsc function PetscDTBinomialInt(petsclib::$UnionPetscLib, n::$PetscInt, k::$PetscInt ) + binomial_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDTBinomialInt, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscInt}), + n, k, binomial_, + ) + + binomial = binomial_[] + + return binomial +end + +""" + perm::PetscInt,isOdd::PetscBool = PetscDTEnumPerm(petsclib::PetscLibType,n::PetscInt, k::PetscInt) + +# External Links +$(_doc_external("DM/PetscDTEnumPerm")) +""" +function PetscDTEnumPerm(petsclib::PetscLibType, n::PetscInt, k::PetscInt) end + +@for_petsc function PetscDTEnumPerm(petsclib::$UnionPetscLib, n::$PetscInt, k::$PetscInt ) + perm_ = Ref{$PetscInt}() + isOdd_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDTEnumPerm, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{PetscBool}), + n, k, perm_, isOdd_, + ) + + perm = perm_[] + isOdd = isOdd_[] + + return perm,isOdd +end + +""" + perm::PetscInt,k::PetscInt,isOdd::PetscBool = PetscDTPermIndex(petsclib::PetscLibType,n::PetscInt) + +# External Links +$(_doc_external("DM/PetscDTPermIndex")) +""" +function PetscDTPermIndex(petsclib::PetscLibType, n::PetscInt) end + +@for_petsc function PetscDTPermIndex(petsclib::$UnionPetscLib, n::$PetscInt ) + perm_ = Ref{$PetscInt}() + k_ = Ref{$PetscInt}() + isOdd_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDTPermIndex, $petsc_library), + PetscErrorCode, + ($PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{PetscBool}), + n, perm_, k_, isOdd_, + ) + + perm = perm_[] + k = k_[] + isOdd = isOdd_[] + + return perm,k,isOdd +end + +""" + subset::PetscInt = PetscDTEnumSubset(petsclib::PetscLibType,n::PetscInt, k::PetscInt, j::PetscInt) + +# External Links +$(_doc_external("DM/PetscDTEnumSubset")) +""" +function PetscDTEnumSubset(petsclib::PetscLibType, n::PetscInt, k::PetscInt, j::PetscInt) end + +@for_petsc function PetscDTEnumSubset(petsclib::$UnionPetscLib, n::$PetscInt, k::$PetscInt, j::$PetscInt ) + subset_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDTEnumSubset, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}), + n, k, j, subset_, + ) + + subset = subset_[] + + return subset +end + +""" + subset::PetscInt,index::PetscInt = PetscDTSubsetIndex(petsclib::PetscLibType,n::PetscInt, k::PetscInt) + +# External Links +$(_doc_external("DM/PetscDTSubsetIndex")) +""" +function PetscDTSubsetIndex(petsclib::PetscLibType, n::PetscInt, k::PetscInt) end + +@for_petsc function PetscDTSubsetIndex(petsclib::$UnionPetscLib, n::$PetscInt, k::$PetscInt ) + subset_ = Ref{$PetscInt}() + index_ = Ref{$PetscInt}() + + @chk ccall( + (:PetscDTSubsetIndex, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{$PetscInt}), + n, k, subset_, index_, + ) + + subset = subset_[] + index = index_[] + + return subset,index +end + +""" + perm::PetscInt,isOdd::PetscBool = PetscDTEnumSplit(petsclib::PetscLibType,n::PetscInt, k::PetscInt, j::PetscInt) + +# External Links +$(_doc_external("DM/PetscDTEnumSplit")) +""" +function PetscDTEnumSplit(petsclib::PetscLibType, n::PetscInt, k::PetscInt, j::PetscInt) end + +@for_petsc function PetscDTEnumSplit(petsclib::$UnionPetscLib, n::$PetscInt, k::$PetscInt, j::$PetscInt ) + perm_ = Ref{$PetscInt}() + isOdd_ = Ref{PetscBool}() + + @chk ccall( + (:PetscDTEnumSplit, $petsc_library), + PetscErrorCode, + ($PetscInt, $PetscInt, $PetscInt, Ptr{$PetscInt}, Ptr{PetscBool}), + n, k, j, perm_, isOdd_, + ) + + perm = perm_[] + isOdd = isOdd_[] + + return perm,isOdd +end + +""" + PetscTime(petsclib::PetscLibType,v::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscTime")) +""" +function PetscTime(petsclib::PetscLibType, v::PetscLogDouble) end + +@for_petsc function PetscTime(petsclib::$UnionPetscLib, v::PetscLogDouble ) + + @chk ccall( + (:PetscTime, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble},), + v, + ) + + + return nothing +end + +""" + PetscTimeSubtract(petsclib::PetscLibType,v::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscTimeSubtract")) +""" +function PetscTimeSubtract(petsclib::PetscLibType, v::PetscLogDouble) end + +@for_petsc function PetscTimeSubtract(petsclib::$UnionPetscLib, v::PetscLogDouble ) + + @chk ccall( + (:PetscTimeSubtract, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble},), + v, + ) + + + return nothing +end + +""" + PetscTimeAdd(petsclib::PetscLibType,v::PetscLogDouble) + +# External Links +$(_doc_external("Sys/PetscTimeAdd")) +""" +function PetscTimeAdd(petsclib::PetscLibType, v::PetscLogDouble) end + +@for_petsc function PetscTimeAdd(petsclib::$UnionPetscLib, v::PetscLogDouble ) + + @chk ccall( + (:PetscTimeAdd, $petsc_library), + PetscErrorCode, + (Ptr{PetscLogDouble},), + v, + ) + + + return nothing +end + +""" + PetscOptionsBegin(petsclib::PetscLibType,comm::MPI_Comm, prefix::Vector{Cchar}, mess::Vector{Cchar}, sec::Vector{Cchar}) + +# External Links +$(_doc_external("Sys/PetscOptionsBegin")) +""" +function PetscOptionsBegin(petsclib::PetscLibType, comm::MPI_Comm, prefix::Vector{Cchar}, mess::Vector{Cchar}, sec::Vector{Cchar}) end + +@for_petsc function PetscOptionsBegin(petsclib::$UnionPetscLib, comm::MPI_Comm, prefix::Vector{Cchar}, mess::Vector{Cchar}, sec::Vector{Cchar} ) + + @chk ccall( + (:PetscOptionsBegin, $petsc_library), + PetscErrorCode, + (MPI_Comm, Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}), + comm, prefix, mess, sec, + ) + + + return nothing +end + +""" + PetscOptionsEnd(petsclib::PetscLibType) + +# External Links +$(_doc_external("Sys/PetscOptionsEnd")) +""" +function PetscOptionsEnd(petsclib::PetscLibType) end + +@for_petsc function PetscOptionsEnd(petsclib::$UnionPetscLib) + + @chk ccall( + (:PetscOptionsEnd, $petsc_library), + PetscErrorCode, + (), + ) + + + return nothing +end + +""" + value::PetscBool,set::PetscBool = PetscOptionsBool(petsclib::PetscLibType,opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscBool) + +# External Links +$(_doc_external("Sys/PetscOptionsBool")) +""" +function PetscOptionsBool(petsclib::PetscLibType, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscBool) end + +@for_petsc function PetscOptionsBool(petsclib::$UnionPetscLib, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscBool ) + value_ = Ref{PetscBool}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsBool, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, PetscBool, Ptr{PetscBool}, Ptr{PetscBool}), + opt, text, man, currentvalue, value_, set_, + ) + + value = value_[] + set = set_[] + + return value,set +end + +""" + PetscOptionsBool3(petsclib::PetscLibType,opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscBool3, value::PetscBool3, set::PetscBool3) + +# External Links +$(_doc_external("Sys/PetscOptionsBool3")) +""" +function PetscOptionsBool3(petsclib::PetscLibType, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscBool3, value::PetscBool3, set::PetscBool3) end + +@for_petsc function PetscOptionsBool3(petsclib::$UnionPetscLib, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscBool3, value::PetscBool3, set::PetscBool3 ) + + @chk ccall( + (:PetscOptionsBool3, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, PetscBool3, Ptr{PetscBool3}, Ptr{PetscBool3}), + opt, text, man, currentvalue, value, set, + ) + + + return nothing +end + +""" + value::PetscInt,set::PetscBool = PetscOptionsInt(petsclib::PetscLibType,opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscInt) + +# External Links +$(_doc_external("Sys/PetscOptionsInt")) +""" +function PetscOptionsInt(petsclib::PetscLibType, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscInt) end + +@for_petsc function PetscOptionsInt(petsclib::$UnionPetscLib, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::$PetscInt ) + value_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsInt, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, $PetscInt, Ptr{$PetscInt}, Ptr{PetscBool}), + opt, text, man, currentvalue, value_, set_, + ) + + value = value_[] + set = set_[] + + return value,set +end + +""" + value::PetscReal,set::PetscBool = PetscOptionsReal(petsclib::PetscLibType,opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscReal) + +# External Links +$(_doc_external("Sys/PetscOptionsReal")) +""" +function PetscOptionsReal(petsclib::PetscLibType, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscReal) end + +@for_petsc function PetscOptionsReal(petsclib::$UnionPetscLib, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::$PetscReal ) + value_ = Ref{$PetscReal}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsReal, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, $PetscReal, Ptr{$PetscReal}, Ptr{PetscBool}), + opt, text, man, currentvalue, value_, set_, + ) + + value = value_[] + set = set_[] + + return value,set +end + +""" + value::PetscScalar,set::PetscBool = PetscOptionsScalar(petsclib::PetscLibType,opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscScalar) + +# External Links +$(_doc_external("Sys/PetscOptionsScalar")) +""" +function PetscOptionsScalar(petsclib::PetscLibType, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::PetscScalar) end + +@for_petsc function PetscOptionsScalar(petsclib::$UnionPetscLib, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, currentvalue::$PetscScalar ) + value_ = Ref{$PetscScalar}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsScalar, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, $PetscScalar, Ptr{$PetscScalar}, Ptr{PetscBool}), + opt, text, man, currentvalue, value_, set_, + ) + + value = value_[] + set = set_[] + + return value,set +end + +""" + n::PetscInt,set::PetscBool = PetscOptionsScalarArray(petsclib::PetscLibType,opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{PetscScalar}) + +# External Links +$(_doc_external("Sys/PetscOptionsScalarArray")) +""" +function PetscOptionsScalarArray(petsclib::PetscLibType, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{PetscScalar}) end + +@for_petsc function PetscOptionsScalarArray(petsclib::$UnionPetscLib, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{$PetscScalar} ) + n_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsScalarArray, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscScalar}, Ptr{$PetscInt}, Ptr{PetscBool}), + opt, text, man, value, n_, set_, + ) + + n = n_[] + set = set_[] + + return n,set +end + +""" + n::PetscInt,set::PetscBool = PetscOptionsIntArray(petsclib::PetscLibType,opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{PetscInt}) + +# External Links +$(_doc_external("Sys/PetscOptionsIntArray")) +""" +function PetscOptionsIntArray(petsclib::PetscLibType, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{PetscInt}) end + +@for_petsc function PetscOptionsIntArray(petsclib::$UnionPetscLib, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{$PetscInt} ) + n_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsIntArray, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscInt}, Ptr{$PetscInt}, Ptr{PetscBool}), + opt, text, man, value, n_, set_, + ) + + n = n_[] + set = set_[] + + return n,set +end + +""" + n::PetscInt,set::PetscBool = PetscOptionsRealArray(petsclib::PetscLibType,opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{PetscReal}) + +# External Links +$(_doc_external("Sys/PetscOptionsRealArray")) +""" +function PetscOptionsRealArray(petsclib::PetscLibType, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{PetscReal}) end + +@for_petsc function PetscOptionsRealArray(petsclib::$UnionPetscLib, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{$PetscReal} ) + n_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsRealArray, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Ptr{$PetscReal}, Ptr{$PetscInt}, Ptr{PetscBool}), + opt, text, man, value, n_, set_, + ) + + n = n_[] + set = set_[] + + return n,set +end + +""" + n::PetscInt,set::PetscBool = PetscOptionsBoolArray(petsclib::PetscLibType,opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{PetscBool}) + +# External Links +$(_doc_external("Sys/PetscOptionsBoolArray")) +""" +function PetscOptionsBoolArray(petsclib::PetscLibType, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{PetscBool}) end + +@for_petsc function PetscOptionsBoolArray(petsclib::$UnionPetscLib, opt::Vector{Cchar}, text::Vector{Cchar}, man::Vector{Cchar}, value::Vector{PetscBool} ) + n_ = Ref{$PetscInt}() + set_ = Ref{PetscBool}() + + @chk ccall( + (:PetscOptionsBoolArray, $petsc_library), + PetscErrorCode, + (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}, Ptr{PetscBool}, Ptr{$PetscInt}, Ptr{PetscBool}), + opt, text, man, value, n_, set_, + ) + + n = n_[] + set = set_[] + + return n,set +end + diff --git a/src/autowrapped/TS_wrappers.jl b/src/autowrapped/TS_wrappers.jl new file mode 100644 index 00000000..b97fcab1 --- /dev/null +++ b/src/autowrapped/TS_wrappers.jl @@ -0,0 +1,12606 @@ +# autodefined type arguments for class ------ +mutable struct _n_TSTrajectory end +const TSTrajectory = Ptr{_n_TSTrajectory} + +mutable struct _n_TSAdapt end +const TSAdapt = Ptr{_n_TSAdapt} + +mutable struct _n_TSMonitorVTKCtx end +const TSMonitorVTKCtx = Ptr{_n_TSMonitorVTKCtx} + +mutable struct TSRHSJacobianPFn end + +mutable struct _n_TSGLLEAdapt end +const TSGLLEAdapt = Ptr{_n_TSGLLEAdapt} + +mutable struct TSGLLEAcceptFn end + +mutable struct TSAlpha2PredictorFn end + +#mutable struct TSRHSFunctionFn end +#mutable struct TSSolutionFn end +#mutable struct TSForcingFn end +#mutable struct TSRHSJacobianFn end +#mutable struct TSIFunctionFn end +#mutable struct TSIJacobianFn end +#mutable struct TSI2FunctionFn end +#mutable struct TSI2JacobianFn end +#mutable struct TSTransientVariableFn end +# ------------------------------------------------------- +""" + TSSetFromOptions(petsclib::PetscLibType,ts::TS) +Sets various `TS` parameters from the options database + +Collective + +Input Parameter: +- `ts` - the `TS` context obtained from `TSCreate()` + +Options Database Keys: +- `-ts_type ` - EULER, BEULER, SUNDIALS, PSEUDO, CN, RK, THETA, ALPHA, GLLE, SSP, GLEE, BSYMP, IRK, see `TSType` +- `-ts_save_trajectory` - checkpoint the solution at each time-step +- `-ts_max_time