diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..13c63f7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.[oa]
+*.mod
+*~
+html
+auto
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..03300f2
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,151 @@
+/**
+ * @file CMakeLists.txt
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ * @author Trach-Minh Tran
+ */
+cmake_minimum_required (VERSION 2.8.8)
+#cmake_policy(SET CMP0053 NEW)
+
+project(bsplines_root Fortran C)
+
+#enable_language(Fortran)
+enable_testing()
+
+option(BSPLINES_USE_MUMPS "Activate the mumps interface" ON)
+if(NOT DEFINED BSPLINES_EXAMPLES)
+ option(BSPLINES_EXAMPLES "Compiles the examples" ON)
+endif()
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
+
+# Assume we are on CRAY if ftn is the Fortran compiler
+if (${CMAKE_Fortran_COMPILER} MATCHES "ftn$")
+ set(CRAY TRUE)
+ if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Cray")
+ set(cray_suffix cray)
+ elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI")
+ set(cray_suffix pgi)
+ elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
+ set(cray_suffix intel)
+ elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
+ set(cray_suffix gnu)
+ endif()
+else()
+ set(CRAY FALSE)
+endif()
+
+if(POLICY CMP0074)
+ cmake_policy(SET CMP0074 NEW)
+endif()
+
+
+include(CMakeFlagsHandling)
+# Compiler flags for debug/optimization
+if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Cray")
+elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
+ set(CMAKE_AR ${XIAR})
+ add_flags(LANG Fortran TYPE DEBUG -traceback "-check bounds" "-warn unused")
+ add_flags(LANG Fortran TYPE RELEASE -xHost)
+elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
+ add_flags(LANG Fortran TYPE DEBUG -fbounds-check -fbacktrace)
+endif()
+
+if(NOT MUMPS)
+ set(MUMPS $ENV{MUMPS_ROOT})
+endif()
+
+# Installation root directory
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(PREFIX $ENV{PREFIX})
+ if(PREFIX)
+ set(${CMAKE_INSTALL_PREFIX} ${PREFIX})
+ else()
+ set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "..." FORCE)
+ endif()
+ message(STATUS "CMAKE_INSTALL_PREFIX is " ${CMAKE_INSTALL_PREFIX})
+endif()
+
+# Search and load the FUTILS configuration file
+if(NOT TARGET futils)
+ find_package(futils PATHS ${FUTILS}/lib/cmake REQUIRED)
+endif()
+
+if(BSPLINES_USE_MUMPS)
+ find_package(Mumps REQUIRED)
+ set(HAS_MUMPS ${MUMPS_FOUND})
+else()
+ set(HAS_MUMPS FALSE)
+endif()
+
+# Find lapack/blas. Skip it if on CRAY!
+if(CRAY)
+ set(BSPLINES_USE_PARDISO OFF)
+endif()
+include(blas)
+
+if(NOT BSPLINES_EXPORT_TARGETS)
+ set(BSPLINES_EXPORT_TARGETS bsplines-targets)
+endif()
+
+find_package(MPI COMPONENTS Fortran REQUIRED)
+
+include(GNUInstallDirs)
+
+add_subdirectory(pppack)
+add_subdirectory(pputils2)
+add_subdirectory(fft)
+add_subdirectory(src)
+
+if(HAS_MUMPS AND BSPLINES_EXAMPLES)
+ add_subdirectory(multigrid)
+endif()
+
+if(BSPLINES_EXAMPLES)
+ add_subdirectory(examples)
+ add_subdirectory(wk)
+endif()
+
+export(TARGETS pppack pputils2 bsplines fft
+ FILE "${CMAKE_BINARY_DIR}/bsplinesLibraryDepends.cmake")
+export(PACKAGE bsplines)
+
+# install configuration files
+if(BSPLINES_EXPORT_TARGETS MATCHES "bsplines-targets")
+ install(EXPORT bsplines-targets
+ DESTINATION lib/cmake
+ )
+
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/bsplines-config.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake/bsplines-config.cmake @ONLY
+ )
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake/bsplines-config.cmake
+ DESTINATION lib/cmake
+ )
+endif()
+
+# enable packaging with CPack
+include(CPack)
+
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/COPYING.lesser b/COPYING.lesser
new file mode 100644
index 0000000..0a04128
--- /dev/null
+++ b/COPYING.lesser
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/cmake/CMakeFlagsHandling.cmake b/cmake/CMakeFlagsHandling.cmake
new file mode 100644
index 0000000..56b5fae
--- /dev/null
+++ b/cmake/CMakeFlagsHandling.cmake
@@ -0,0 +1,100 @@
+/**
+ * @file CMakeFlagsHandling.cmake
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ */
+if(_CMAKE_FLAGS_HANDLING)
+ return()
+endif()
+set(_CMAKE_FLAGS_HANDLING TRUE)
+
+#===============================================================================
+# Compilation options handling
+#===============================================================================
+macro(_get_flags_message lang type desc)
+ if(${lang} MATCHES "C.." OR ${lang} MATCHES "Fortran")
+ set(${desc} "Flags used by the compiler")
+ elseif(${lang} MATCHES ".*_LINKER")
+ set(${desc} "Flags used by the linker")
+ endif()
+
+ if(${lang} MATCHES "SHARED_LINKER")
+ set(${desc} "${desc} during the creation of shared libraries")
+ elseif(${lang} MATCHES "MODULE_LINKER")
+ set(${desc} "${desc} during the creation of modules")
+ elseif(${lang} MATCHES "STATIC_LINKER")
+ set(${desc} "${desc} linker during the creation of static libraries")
+ endif()
+
+ if(${type} MATCHES "ALL")
+ set(${desc} "${desc} during all build types")
+ else()
+ set(${desc} "${desc} during ${type} builds")
+ endif()
+endmacro()
+
+#===============================================================================
+
+function(handle_flags)
+ include(CMakeParseArguments)
+ cmake_parse_arguments(_flags
+ "ADD;REMOVE" "LANG;TYPE" ""
+ ${ARGN}
+ )
+
+ if(NOT _flags_LANG)
+ set(_flags_LANG ${FLAGS_HANDLING_DEFAULT_LANGUAGE})
+ endif()
+
+ set(_variable CMAKE_${_flags_LANG}_FLAGS)
+
+ if (_flags_TYPE)
+ set(_variable ${_variable}_${_flags_TYPE})
+ else()
+ set(_flags_TYPE "ALL")
+ endif()
+
+ _get_flags_message(${_flags_LANG} ${_flags_TYPE} _desc)
+ foreach(flag ${_flags_UNPARSED_ARGUMENTS})
+ if (_flags_ADD)
+ string(REPLACE "${flag}" "match" _temp_var "${${_variable}}")
+ if(NOT _temp_var MATCHES "match")
+ set(${_variable} "${flag} ${${_variable}}" CACHE STRING ${_desc} FORCE)
+ endif()
+ elseif(_flags_REMOVE)
+ string(REPLACE "${flag} " "" ${_variable} "${${_variable}}")
+ set(${_variable} "${${_variable}}" CACHE STRING ${_desc} FORCE)
+ endif()
+ endforeach()
+endfunction()
+
+#===============================================================================
+function(add_flags)
+ handle_flags(ADD ${ARGN})
+endfunction()
+
+#===============================================================================
+function(remove_flags)
+ handle_flags(REMOVE ${ARGN})
+endfunction()
+#===============================================================================
diff --git a/cmake/CheckFindMumps.c b/cmake/CheckFindMumps.c
new file mode 100644
index 0000000..3b006f7
--- /dev/null
+++ b/cmake/CheckFindMumps.c
@@ -0,0 +1,105 @@
+/**
+ * @file CheckFindMumps.c
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ */
+#include
+
+#if !defined(MUMPS_SEQ)
+# include
+#endif
+
+#define JOB_INIT -1
+#define JOB_END -2
+#define JOB_COMPLETE 6
+#define USE_COMM_WORLD -987654
+
+#define icntl(n) id.icntl[n - 1]
+
+int main(int argc, char **argv) {
+ int n = 2;
+ int nz = 2;
+
+ int irn[2] = {1, 2};
+ int jcn[2] = {1, 2};
+ Real a[2];
+ Real rhs[2];
+
+#if !defined(MUMPS_SEQ)
+ MPI_Init(&argc, &argv);
+#endif
+
+ rhs[0] = 1.0; rhs[1]=4.0;
+ a[0] = 1.0; a[1] = 2.0;
+
+ id.job = JOB_INIT;
+ id.par = 1;
+ id.sym = 0;
+
+#if !defined(MUMPS_SEQ)
+ id.comm_fortran = USE_COMM_WORLD;
+#endif
+
+ mumps_c(&id);
+
+ // Default Scaling
+ icntl(8) = 77;
+
+ // Assembled matrix
+ icntl(5) = 0;
+
+ /// Default centralized dense second member
+ icntl(20) = 0;
+ icntl(21) = 0;
+
+ // automatic choice for analysis analysis
+ icntl(28) = 0;
+
+ // fully distributed
+ icntl(18) = 3;
+
+ id.n = n;
+
+ id.nz_loc = nz;
+ id.irn_loc = irn;
+ id.jcn_loc = jcn;
+
+ id.a_loc = a;
+ id.rhs = rhs;
+
+ icntl(1) = -1;
+ icntl(2) = -1;
+ icntl(3) = -1;
+ icntl(4) = 0;
+
+
+ id.job = JOB_COMPLETE;
+ mumps_c(&id);
+
+ id.job=JOB_END;
+ mumps_c(&id);
+
+ printf("Solution is : (%8.2f %8.2f)\n", rhs[0], rhs[1]);
+
+ return 0;
+}
diff --git a/cmake/FindFFTW.cmake b/cmake/FindFFTW.cmake
new file mode 100644
index 0000000..1fba7ca
--- /dev/null
+++ b/cmake/FindFFTW.cmake
@@ -0,0 +1,46 @@
+/**
+ * @file FindFFTW.cmake
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ */
+if(CMAKE_C_COMPILER_ID MATCHES "Cray")
+ set(_cray TRUE)
+endif()
+
+# Find FFTW2
+if (${_cray})
+# set(FFTW_LIBRARY "-ldfftw")
+ set(FFTW_LIBRARY "${FFTW_DIR}/libdfftw.a")
+else()
+ find_library(FFTW_LIBRARY NAMES fftw PATHS ${FFTW}/lib)
+ find_library(FFTW_LIBRARY NAMES fftw3 PATHS ${FFTW}/lib)
+ find_path(FFTW_INCLUDES fftw_f77.h ${FFTW}/include)
+ find_path(FFTW_INCLUDES fftw_f77.i ${FFTW}/include)
+ find_path(FFTW_INCLUDES fftw.h ${FFTW}/include)
+ find_path(FFTW_INCLUDES fftw3.h ${FFTW}/include)
+endif()
+
+mark_as_advanced(FFTW_LIBRARY FFTW_INCLUDES)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FFTW DEFAULT_MSG FFTW_LIBRARY)
diff --git a/cmake/FindMETIS.cmake b/cmake/FindMETIS.cmake
new file mode 100644
index 0000000..2207580
--- /dev/null
+++ b/cmake/FindMETIS.cmake
@@ -0,0 +1,62 @@
+/**
+ * @file FindMETIS.cmake
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ */
+find_path(METIS_INCLUDE_DIR metis.h
+ PATHS "${METIS_DIR}"
+ ENV METIS_DIR
+ PATH_SUFFIXES include
+ )
+
+find_library(METIS_LIBRARY NAMES metis
+ PATHS "${METIS_DIR}"
+ ENV METIS_DIR
+ PATH_SUFFIXES lib
+ )
+
+mark_as_advanced(METIS_LIBRARY METIS_INCLUDE_DIR)
+
+#===============================================================================
+include(FindPackageHandleStandardArgs)
+if(CMAKE_VERSION VERSION_GREATER 2.8.12)
+ if(METIS_INCLUDE_DIR)
+ file(STRINGS ${METIS_INCLUDE_DIR}/metis.h _versions
+ REGEX "^#define\ +METIS_VER_(MAJOR|MINOR|SUBMINOR) .*")
+ foreach(_ver ${_versions})
+ string(REGEX MATCH "METIS_VER_(MAJOR|MINOR|SUBMINOR) *([0-9.]+)" _tmp "${_ver}")
+ set(_metis_${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
+ endforeach()
+ set(METIS_VERSION "${_metis_MAJOR}.${_metis_MINOR}" CACHE INTERNAL "")
+ endif()
+
+ find_package_handle_standard_args(METIS
+ REQUIRED_VARS
+ METIS_LIBRARY
+ METIS_INCLUDE_DIR
+ VERSION_VAR
+ METIS_VERSION)
+else()
+ find_package_handle_standard_args(METIS DEFAULT_MSG
+ METIS_LIBRARY METIS_INCLUDE_DIR)
+endif()
diff --git a/cmake/FindMumps.cmake b/cmake/FindMumps.cmake
new file mode 100644
index 0000000..8d8e76d
--- /dev/null
+++ b/cmake/FindMumps.cmake
@@ -0,0 +1,314 @@
+/**
+ * @file FindMumps.cmake
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ */
+#===============================================================================
+# @file FindMumps.cmake
+#
+# @author Nicolas Richart
+#
+# @date creation: Fri Oct 24 2014
+# @date last modification: Wed Jan 13 2016
+#
+# @brief The find_package file for the Mumps solver
+#
+# @section LICENSE
+#
+# Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory
+# (LSMS - Laboratoire de Simulation en Mécanique des Solides)
+#
+# Akantu is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# Akantu is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Akantu. If not, see .
+#
+#===============================================================================
+set(_MUMPS_COMPONENTS "sequential" "parallel" "double" "float" "complex_double" "complex_float")
+
+if(NOT Mumps_FIND_COMPONENTS)
+ set(Mumps_FIND_COMPONENTS "parallel" "double" "float" "complex_double" "complex_float")
+endif()
+#===============================================================================
+enable_language(Fortran)
+
+set(MUMPS_PRECISIONS)
+set(MUMPS_PLAT)
+foreach(_comp ${Mumps_FIND_COMPONENTS})
+ if("${_comp}" STREQUAL "sequential")
+ set(MUMPS_PLAT _seq) #default plat on debian based distribution
+ endif()
+
+ if("${_comp}" STREQUAL "float")
+ list(APPEND MUMPS_PRECISIONS s)
+ endif()
+ if("${_comp}" STREQUAL "double")
+ list(APPEND MUMPS_PRECISIONS d)
+ endif()
+ if("${_comp}" STREQUAL "complex_float")
+ list(APPEND MUMPS_PRECISIONS c)
+ endif()
+ if("${_comp}" STREQUAL "complex_double")
+ list(APPEND MUMPS_PRECISIONS z)
+ endif()
+endforeach()
+
+if(NOT MUMPS_PRECISIONS)
+ set(MUMPS_PRECISIONS s d c z)
+endif()
+
+list(GET MUMPS_PRECISIONS 0 _first_precision)
+
+string(TOUPPER "${_first_precision}" _u_first_precision)
+
+find_path(MUMPS_INCLUDE_DIR ${_first_precision}mumps_c.h
+ PATHS "${MUMPS_DIR}"
+ ENV MUMPS_DIR
+ PATH_SUFFIXES include
+ )
+mark_as_advanced(MUMPS_INCLUDE_DIR)
+
+set(_mumps_required_vars)
+foreach(_precision ${MUMPS_PRECISIONS})
+ string(TOUPPER "${_precision}" _u_precision)
+ find_library(MUMPS_LIBRARY_${_u_precision}MUMPS NAMES ${_precision}mumps${MUMPS_PREFIX}
+ PATHS "${MUMPS_DIR}"
+ ENV MUMPS_DIR
+ PATH_SUFFIXES lib
+ )
+ mark_as_advanced(MUMPS_LIBRARY_${_u_precision}MUMPS)
+ list(APPEND _mumps_required_vars MUMPS_LIBRARY_${_u_precision}MUMPS)
+
+ list(APPEND MUMPS_LIBRARIES_ALL ${MUMPS_LIBRARY_${_u_precision}MUMPS})
+endforeach()
+
+
+if(MUMPS_LIBRARY_${_u_first_precision}MUMPS MATCHES ".*${_first_precision}mumps.*${CMAKE_STATIC_LIBRARY_SUFFIX}")
+ # Assuming mumps was compiled as a static library
+ set(MUMPS_LIBRARY_TYPE STATIC CACHE INTERNAL "" FORCE)
+
+ if (CMAKE_Fortran_COMPILER MATCHES ".*gfortran")
+ set(_compiler_specific gfortran)
+ elseif (CMAKE_Fortran_COMPILER MATCHES ".*ifort")
+ set(_compiler_specific ifcore)
+ else()
+ message("Compiler ${CMAKE_Fortran_COMPILER} is not known, you will probably "
+ "have to add semething instead of this message to be able to test mumps "
+ "install")
+ endif()
+else()
+ set(MUMPS_LIBRARY_TYPE SHARED CACHE INTERNAL "" FORCE)
+endif()
+
+
+function(mumps_add_dependency _pdep _libs)
+ string(TOUPPER ${_pdep} _u_pdep)
+ if(_pdep STREQUAL "mumps_common")
+ find_library(MUMPS_LIBRARY_COMMON mumps_common${MUMPS_PREFIX}
+ PATHS "${MUMPS_DIR}"
+ ENV MUMPS_DIR
+ PATH_SUFFIXES lib
+ )
+ set(${_libs} ${MUMPS_LIBRARY_COMMON} PARENT_SCOPE)
+ mark_as_advanced(MUMPS_LIBRARY_COMMON)
+ elseif(_pdep STREQUAL "pord")
+ find_library(MUMPS_LIBRARY_PORD pord${MUMPS_PREFIX}
+ PATHS "${MUMPS_DIR}"
+ ENV MUMPS_DIR
+ PATH_SUFFIXES lib
+ )
+ set(${_libs} ${MUMPS_LIBRARY_PORD} PARENT_SCOPE)
+ mark_as_advanced(MUMPS_LIBRARY_PORD)
+ elseif(_pdep MATCHES "Scotch")
+ find_package(Scotch REQUIRED ${ARGN} QUIET)
+ if(ARGN)
+ list(GET ARGN 1 _comp)
+ string(TOUPPER ${_comp} _u_comp)
+ set(${_libs} ${SCOTCH_LIBRARY_${_u_comp}} PARENT_SCOPE)
+ else()
+ set(${_libs} ${${_u_pdep}_LIBRARIES} PARENT_SCOPE)
+ endif()
+ elseif(_pdep MATCHES "MPI")
+ if(MUMPS_PLAT STREQUAL "_seq")
+ find_library(MUMPS_LIBRARY_MPISEQ mpiseq${MUMPS_PREFIX}
+ PATHS "${MUMPS_DIR}"
+ ENV MUMPS_DIR
+ PATH_SUFFIXES lib
+ )
+ set(${_libs} ${MUMPS_LIBRARY_MPISEQ} PARENT_SCOPE)
+ mark_as_advanced(MUMPS_LIBRARY_MPISEQ)
+ else()
+ find_package(MPI REQUIRED C Fortran QUIET)
+ set(${_libs} ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} PARENT_SCOPE)
+ endif()
+ else()
+ find_package(${_pdep} REQUIRED QUIET)
+ set(${_libs} ${${_u_pdep}_LIBRARIES} ${${_u_pdep}_LIBRARY} PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(mumps_find_dependencies)
+ set(_libraries_all ${MUMPS_LIBRARIES_ALL})
+ set(_include_dirs ${MUMPS_INCLUDE_DIR})
+
+ set(_mumps_test_dir "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}")
+ file(READ ${CMAKE_CURRENT_LIST_DIR}/CheckFindMumps.c _output)
+ file(WRITE "${_mumps_test_dir}/mumps_test_code.c"
+ "#include <${_first_precision}mumps_c.h>
+${_u_first_precision}MUMPS_STRUC_C id;
+
+#define mumps_c ${_first_precision}mumps_c
+#define Real ${_u_first_precision}MUMPS_REAL
+")
+
+ if(MUMPS_PLAT STREQUAL _seq)
+ file(APPEND "${_mumps_test_dir}/mumps_test_code.c"
+ "#define MUMPS_SEQ
+")
+ else()
+ file(APPEND "${_mumps_test_dir}/mumps_test_code.c"
+ "// #undef MUMPS_SEQ
+")
+ find_package(MPI REQUIRED)
+ list(APPEND _compiler_specific ${MPI_C_LIBRARIES})
+ list(APPEND _include_dirs ${MPI_C_INCLUDE_PATH} ${MPI_INCLUDE_DIR})
+ endif()
+
+ file(APPEND "${_mumps_test_dir}/mumps_test_code.c" "${_output}")
+
+ #===============================================================================
+ set(_mumps_dep_symbol_BLAS ${_first_precision}gemm)
+ set(_mumps_dep_symbol_ScaLAPACK numroc)
+ set(_mumps_dep_symbol_MPI mpi_send)
+ set(_mumps_dep_symbol_Scotch SCOTCH_graphInit)
+ set(_mumps_dep_symbol_Scotch_ptscotch scotchfdgraphexit)
+ set(_mumps_dep_symbol_Scotch_esmumps esmumps)
+ set(_mumps_dep_symbol_mumps_common mumps_abort)
+ set(_mumps_dep_symbol_pord SPACE_ordering)
+ set(_mumps_dep_symbol_METIS metis_nodend)
+ set(_mumps_dep_symbol_ParMETIS ParMETIS_V3_NodeND)
+
+ # added for fucking macosx that cannot fail at link
+ set(_mumps_run_dep_symbol_mumps_common mumps_fac_descband)
+ set(_mumps_run_dep_symbol_MPI mpi_bcast)
+ set(_mumps_run_dep_symbol_ScaLAPACK idamax)
+
+ set(_mumps_dep_comp_Scotch_ptscotch COMPONENTS ptscotch)
+ set(_mumps_dep_comp_Scotch_esmumps COMPONENTS esmumps)
+
+ set(_mumps_potential_dependencies mumps_common pord BLAS ScaLAPACK MPI
+ Scotch Scotch_ptscotch Scotch_esmumps METIS ParMETIS)
+ #===============================================================================
+
+ set(_retry_try_run TRUE)
+ set(_retry_count 0)
+
+ # trying only as long as we add dependencies to avoid inifinte loop in case of an unkown dependency
+ while (_retry_try_run AND _retry_count LESS 100)
+ try_run(_mumps_run _mumps_compiles "${_mumps_test_dir}" "${_mumps_test_dir}/mumps_test_code.c"
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${_include_dirs}"
+ LINK_LIBRARIES ${_libraries_all} ${_libraries_all} ${_compiler_specific}
+ RUN_OUTPUT_VARIABLE _run
+ COMPILE_OUTPUT_VARIABLE _out)
+
+ set(_retry_compile FALSE)
+ #message("COMPILATION outputs: \n${_out} \n RUN OUTPUT \n${_run}")
+ if(_mumps_compiles AND NOT (_mumps_run STREQUAL "FAILED_TO_RUN"))
+ break()
+ endif()
+
+ foreach(_pdep ${_mumps_potential_dependencies})
+ #message("CHECKING ${_pdep}")
+ set(_add_pdep FALSE)
+ if (NOT _mumps_compiles AND
+ _out MATCHES "undefined reference.*${_mumps_dep_symbol_${_pdep}}")
+ set(_add_pdep TRUE)
+ #message("NEED COMPILE ${_pdep}")
+ elseif(_mumps_run STREQUAL "FAILED_TO_RUN" AND
+ DEFINED _mumps_run_dep_symbol_${_pdep} AND
+ _run MATCHES "${_mumps_run_dep_symbol_${_pdep}}")
+ set(_add_pdep TRUE)
+ #message("NEED RUN ${_pdep}")
+ endif()
+
+ if(_add_pdep)
+ mumps_add_dependency(${_pdep} _libs ${_mumps_dep_comp_${_pdep}})
+ #message("ADDING ${_libs}")
+ if(NOT _libs)
+ message(FATAL_ERROR "MUMPS depends on ${_pdep} but no libraries where found")
+ endif()
+ list(APPEND _libraries_all ${_libs})
+ set(_retry_try_run TRUE)
+ endif()
+ endforeach()
+
+ math(EXPR _retry_count "${_retry_count} + 1")
+ endwhile()
+
+ if(_retry_count GREATER 10)
+ message(FATAL_ERROR "Do not know what to do to link with mumps on your system, I give up!")
+ endif()
+
+ if(APPLE)
+ # in doubt add some stuff because mumps was perhaps badly compiled
+ mumps_add_dependency(pord _libs)
+ list(APPEND _libraries_all ${_libs})
+ endif()
+
+ set(MUMPS_LIBRARIES_ALL ${_libraries_all} PARENT_SCOPE)
+endfunction()
+
+mumps_find_dependencies()
+
+set(MUMPS_LIBRARIES ${MUMPS_LIBRARIES_ALL} CACHE INTERNAL "" FORCE)
+
+#===============================================================================
+include(FindPackageHandleStandardArgs)
+if(CMAKE_VERSION VERSION_GREATER 2.8.12)
+ if(MUMPS_INCLUDE_DIR)
+ file(STRINGS ${MUMPS_INCLUDE_DIR}/dmumps_c.h _versions
+ REGEX "^#define MUMPS_VERSION .*")
+ foreach(_ver ${_versions})
+ string(REGEX MATCH "MUMPS_VERSION *\"([0-9.]+)\"" _tmp "${_ver}")
+ set(_mumps_VERSION ${CMAKE_MATCH_1})
+ endforeach()
+ set(MUMPS_VERSION "${_mumps_VERSION}" CACHE INTERNAL "")
+ endif()
+
+ find_package_handle_standard_args(Mumps
+ REQUIRED_VARS ${_mumps_required_vars}
+ MUMPS_INCLUDE_DIR
+ VERSION_VAR MUMPS_VERSION
+ )
+else()
+ find_package_handle_standard_args(Mumps DEFAULT_MSG
+ ${_mumps_required_vars} MUMPS_INCLUDE_DIR)
+endif()
diff --git a/cmake/FindPETSc.cmake b/cmake/FindPETSc.cmake
new file mode 100644
index 0000000..04ad8d1
--- /dev/null
+++ b/cmake/FindPETSc.cmake
@@ -0,0 +1,92 @@
+/**
+ * @file FindPETSc.cmake
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ */
+# - Try to find PETSc
+# PETSC_FOUND - system has PETSc
+# PETSC_INCLUDE_DIRS - the PETSc include directories
+# PETSC_LIBRARIES - Link these to use PETSc
+# PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR)
+
+if(PETSc_FIND_REQUIRED)
+ find_package(PkgConfig REQUIRED)
+else()
+ find_package(PkgConfig QUIET)
+ if(NOT PKG_CONFIG_FOUND)
+ return()
+ endif()
+endif()
+
+pkg_search_module(_petsc PETSc)
+
+# Some debug code
+#get_property(_vars DIRECTORY PROPERTY VARIABLES)
+#foreach(_var ${_vars})
+# if ("${_var}" MATCHES "^_petsc")
+# message("${_var} -> ${${_var}}")
+# endif()
+#endforeach()
+
+if(_petsc_FOUND AND _petsc_VERSION)
+ set(PETSC_VERSION ${_petsc_VERSION})
+endif()
+
+if(_petsc_FOUND)
+ set(_petsc_libs)
+ foreach(_lib ${_petsc_LIBRARIES})
+ string(TOUPPER "${_lib}" _u_lib)
+ find_library(PETSC_LIBRARY_${_u_lib} ${_lib} PATHS ${_petsc_LIBRARY_DIRS})
+ list(APPEND _petsc_libs ${PETSC_LIBRARY_${_u_lib}})
+ mark_as_advanced(PETSC_LIBRARY_${_u_lib})
+ endforeach()
+
+ if (NOT _petsc_INCLUDE_DIRS)
+ pkg_get_variable(_petsc_INCLUDE_DIRS ${_petsc_MODULE_NAME} includedir)
+ #message(${_petsc_INCLUDE_DIRS})
+ endif()
+
+ find_path(PETSC_Fortran_INCLUDE_DIRS "finclude/petsc.h"
+ PATHS ${_petsc_INCLUDE_DIRS}/petsc
+ NO_CMAKE_PATH
+ NO_DEFAULT_PATH
+ )
+
+ set(PETSC_LIBRARIES ${_petsc_libs} CACHE FILEPATH "")
+ set(PETSC_INCLUDE_DIRS ${_petsc_INCLUDE_DIRS} CACHE PATH "")
+
+
+ add_library(petsc::petsc INTERFACE IMPORTED)
+ set_property(TARGET petsc::petsc PROPERTY INTERFACE_LINK_LIBRARIES ${PETSC_LIBRARIES})
+ set_property(TARGET petsc::petsc PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PETSC_INCLUDE_DIRS})
+
+ add_library(petsc::petscf INTERFACE IMPORTED)
+ target_link_libraries(petsc::petscf INTERFACE petsc::petsc)
+ set_property(TARGET petsc::petscf PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PETSC_Fortran_INCLUDE_DIRS})
+
+endif()
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PETSc
+ REQUIRED_VARS PETSC_LIBRARIES PETSC_INCLUDE_DIRS
+ VERSION_VAR PETSC_VERSION)
diff --git a/cmake/FindParMETIS.cmake b/cmake/FindParMETIS.cmake
new file mode 100644
index 0000000..6a927e1
--- /dev/null
+++ b/cmake/FindParMETIS.cmake
@@ -0,0 +1,62 @@
+/**
+ * @file FindParMETIS.cmake
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ */
+find_path(PARMETIS_INCLUDE_DIR parmetis.h
+ PATHS "${PARMETIS_DIR}"
+ ENV PARMETIS_DIR
+ PATH_SUFFIXES include
+ )
+
+find_library(PARMETIS_LIBRARY NAMES parmetis
+ PATHS "${PARMETIS_DIR}"
+ ENV PARMETIS_DIR
+ PATH_SUFFIXES lib
+ )
+
+mark_as_advanced(PARMETIS_LIBRARY PARMETIS_INCLUDE_DIR)
+
+#===============================================================================
+include(FindPackageHandleStandardArgs)
+if(CMAKE_VERSION VERSION_GREATER 2.8.12)
+ if(PARMETIS_INCLUDE_DIR)
+ file(STRINGS ${PARMETIS_INCLUDE_DIR}/parmetis.h _versions
+ REGEX "^#define\ +PARMETIS_(MAJOR|MINOR|SUBMINOR)_VERSION .*")
+ foreach(_ver ${_versions})
+ string(REGEX MATCH "PARMETIS_(MAJOR|MINOR|SUBMINOR)_VERSION *([0-9.]+)" _tmp "${_ver}")
+ set(_parmetis_${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
+ endforeach()
+ set(PARMETIS_VERSION "${_parmetis_MAJOR}.${_parmetis_MINOR}" CACHE INTERNAL "")
+ endif()
+
+ find_package_handle_standard_args(ParMETIS
+ REQUIRED_VARS
+ PARMETIS_LIBRARY
+ PARMETIS_INCLUDE_DIR
+ VERSION_VAR
+ PARMETIS_VERSION)
+else()
+ find_package_handle_standard_args(ParMETIS DEFAULT_MSG
+ PARMETIS_LIBRARY PARMETIS_INCLUDE_DIR)
+endif()
diff --git a/cmake/FindScaLAPACK.cmake b/cmake/FindScaLAPACK.cmake
new file mode 100644
index 0000000..b3ef5ad
--- /dev/null
+++ b/cmake/FindScaLAPACK.cmake
@@ -0,0 +1,181 @@
+/**
+ * @file FindScaLAPACK.cmake
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ */
+#===============================================================================
+# @file FindScaLAPACK.cmake
+#
+# @author Nicolas Richart
+#
+# @date creation: Tue Mar 31 2015
+# @date last modification: Wed Jan 13 2016
+#
+# @brief The find_package file for the Mumps solver
+#
+# @section LICENSE
+#
+# Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory
+# (LSMS - Laboratoire de Simulation en Mécanique des Solides)
+#
+# Akantu is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# Akantu is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Akantu. If not, see .
+#
+#===============================================================================
+set(SCALAPACK_VENDOR "Auto" CACHE
+ STRING "Vendor for scalapack (Auto, Netlib, Intel_(i?)lp64_(openmpi|intelmpi|sgimpt)")
+mark_as_advanced(SCALAPACK_VENDOR)
+set_property(CACHE SCALAPACK_VENDOR PROPERTY STRINGS
+ Auto Netlib
+ Intel_lp64_openmpi Intel_lp64_intelmpi Intel_lp64_sgimpt
+ Intel_ilp64_openmpi Intel_ilp64_intelmpi Intel_ilp64_sgimpt)
+
+
+macro(scalapack_find_library prefix target name list_libraries list_headers)
+ foreach(_lib ${list_libraries})
+ find_library(${prefix}_${_lib}_LIBRARY NAMES ${_lib}
+ PATHS ${prefix}_DIR
+ )
+ mark_as_advanced(${prefix}_${_lib}_LIBRARY)
+
+ if(${prefix}_${_lib}_LIBRARY)
+ list(APPEND ${prefix}_libraries ${${prefix}_${_lib}_LIBRARY})
+
+ get_filename_component(_ext ${${prefix}_${_lib}_LIBRARY} EXT)
+ if(NOT TARGET ${target})
+ if("${_ext}" STREQUAL "${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ add_library(${target} SHARED IMPORTED)
+ get_filename_component(_soname ${${prefix}_${_lib}_LIBRARY} NAME)
+ set_property(TARGET ${target} PROPERTY IMPORTED_SONAME ${_soname})
+ else()
+ add_library(${target}_${name} STATIC IMPORTED)
+ endif()
+ set_property(TARGET ${target} PROPERTY
+ IMPORTED_LOCATION ${${prefix}_${_lib}_LIBRARY})
+ else()
+ if("${_ext}" STREQUAL "${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ set_property(TARGET ${target} APPEND PROPERTY
+ IMPORTED_LINK_DEPENDENT_LIBRARIES ${${prefix}_${_lib}_LIBRARY}
+ )
+ else()
+ set_property(TARGET ${target} APPEND PROPERTY
+ IMPORTED_LINK_INTERFACE_LIBRARIES ${${prefix}_${_lib}_LIBRARY}
+ )
+ endif()
+ endif()
+ else()
+ unset(${prefix}_${_lib}_LIBRARY CACHE)
+ endif()
+ endforeach()
+
+ if(${prefix}_libraries)
+ foreach(_hdr ${list_headers})
+ get_filename_component(_hdr_name ${_hdr} NAME_WE)
+ find_path(${prefix}_${_hdr_name}_INCLUDE_DIR NAMES ${_hdr}
+ PATHS ${prefix}_DIR)
+ mark_as_advanced(${prefix}_${_hdr_name}_INCLUDE_DIR)
+
+ if(${prefix}_${_hdr_name}_INCLUDE_DIR)
+ list(APPEND ${prefix}_include_dir ${${prefix}_${_hdr_name}_INCLUDE_DIR})
+ set_property(TARGET ${target} APPEND PROPERTY
+ INTERFACE_INCLUDE_DIRECTORIES ${${prefix}_${_lib}_INCLUDE_DIR}
+ )
+ else()
+ unset(${prefix}_${_lib}_INCLUDE_DIR CACHE)
+ endif()
+ endforeach()
+ endif()
+endmacro()
+
+set(SCALAPACK_libraries)
+set(SCALAPACK_INCLUDE_DIR)
+
+if(SCALAPACK_VENDOR STREQUAL "Auto" OR SCALAPACK_VENDOR STREQUAL "Netlib")
+ if(NOT SCALAPACK_libraries)
+ scalapack_find_library(
+ SCALAPACK
+ ScaLAPACK
+ "netlib"
+ "scalapack;blacsC;blacsF77;blacs"
+ ""
+ )
+ endif()
+endif()
+
+foreach(_precision lp64 ilp64)
+ foreach(_mpi intelmpi openmpi sgimpt)
+ if(NOT SCALAPACK_libraries)
+ if(SCALAPACK_VENDOR STREQUAL "Auto" OR SCALAPACK_VENDOR STREQUAL "Intel_${_precision}_${_mpi}")
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
+ set(_mkl_common "mkl_intel_${_precision}")
+
+ else()
+ set(_mkl_common "mkl_gf_${_precision}")
+ endif()
+ scalapack_find_library(
+ SCALAPACK
+ ScaLAPACK
+ "intel_${_precision}_${_mpi}"
+ "mkl_scalapack_${_precision};${_mkl_common};mkl_sequential;mkl_core;mkl_blacs_${_mpi}_${_precision}"
+ "mkl_scalapack.h"
+ )
+
+ if(SCALAPACK_libraries AND _precision STREQUAL "ilp64")
+ set_property(TARGET ${target} APPEND PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS MKL_ILP64}
+ )
+ endif()
+
+ if(EXISTS ${SCALAPACK_include_dir}/mkl_version.h)
+ file(STRINGS ${SCALAPACK_include_dir}/mkl_version.h _versions
+ REGEX "^#define\ +__INTEL_MKL(_MINOR|_UPDATE)?__ .*")
+ foreach(_ver ${_versions})
+ string(REGEX MATCH "__INTEL_MKL(_MINOR|_UPDATE)?__ *([0-9.]+)" _tmp "${_ver}")
+ set(_mkl${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
+ endforeach()
+ set(SCALAPACK_VERSION "mkl:${_mkl}.${_mkl_MINOR}.${_mkl_UPDATE}" CACHE INTERNAL "")
+ endif()
+
+ endif()
+ endif()
+ endforeach()
+endforeach()
+
+set(SCALAPACK_LIBRARIES ${SCALAPACK_libraries} CACHE INTERNAL "")
+set(SCALAPACK_INCLUDE_DIR ${SCALAPACK_include_dir} CACHE INTERNAL "")
+
+#===============================================================================
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ScaLAPACK
+ REQUIRED_VARS SCALAPACK_LIBRARIES
+ VERSION_VAR SCALAPACK_VERSION)
diff --git a/cmake/FindScotch.cmake b/cmake/FindScotch.cmake
new file mode 100644
index 0000000..bc7829e
--- /dev/null
+++ b/cmake/FindScotch.cmake
@@ -0,0 +1,270 @@
+/**
+ * @file FindScotch.cmake
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ */
+#===============================================================================
+# @file FindScotch.cmake
+#
+# @author Nicolas Richart
+#
+# @date creation: Fri Oct 24 2014
+# @date last modification: Wed Jan 13 2016
+#
+# @brief The find_package file for Scotch
+#
+# @section LICENSE
+#
+# Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory
+# (LSMS - Laboratoire de Simulation en Mécanique des Solides)
+#
+# Akantu is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# Akantu is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Akantu. If not, see .
+#
+#===============================================================================
+
+set(_SCOTCH_COMPONENTS "metis" "parmetis" "esmumps" "ptscotch")
+
+if(NOT Scotch_FIND_COMPONENTS)
+ set(Scotch_FIND_COMPONENTS)
+endif()
+
+find_path(SCOTCH_INCLUDE_DIR scotch.h PATHS "${SCOTCH_DIR}" ENV SCOTCH_DIR
+ PATH_SUFFIXES include include/scotch
+ )
+
+
+find_library(SCOTCH_LIBRARY scotch PATHS "${SCOTCH_DIR}" ENV SCOTCH_DIR PATH_SUFFIXES lib)
+
+set(_scotch_test_dir "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}")
+file(WRITE "${_scotch_test_dir}/scotch_test_code.c"
+ "#include
+#include
+#include
+
+int main() {
+ SCOTCH_Graph graph;
+ SCOTCH_graphInit(&graph);
+ return 0;
+}
+")
+
+#===============================================================================
+include(FindPackageHandleStandardArgs)
+if(CMAKE_VERSION VERSION_GREATER 2.8.12)
+ if(SCOTCH_INCLUDE_DIR)
+ file(STRINGS ${SCOTCH_INCLUDE_DIR}/scotch.h _versions
+ REGEX "^#define\ +SCOTCH_(VERSION|RELEASE|PATCHLEVEL) .*")
+ foreach(_ver ${_versions})
+ string(REGEX MATCH "SCOTCH_(VERSION|RELEASE|PATCHLEVEL) *([0-9.]+)" _tmp "${_ver}")
+ set(_scotch_${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
+ endforeach()
+ set(SCOTCH_VERSION "${_scotch_VERSION}.${_scotch_RELEASE}.${_scotch_PATCHLEVEL}" CACHE INTERNAL "")
+ endif()
+ find_package_handle_standard_args(Scotch
+ REQUIRED_VARS SCOTCH_LIBRARY SCOTCH_INCLUDE_DIR
+ VERSION_VAR SCOTCH_VERSION)
+else()
+ find_package_handle_standard_args(Scotch DEFAULT_MSG
+ SCOTCH_LIBRARY SCOTCH_INCLUDE_DIR)
+endif()
+
+set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY})
+
+try_compile(_scotch_compiles "${_scotch_test_dir}" SOURCES "${_scotch_test_dir}/scotch_test_code.c"
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${SCOTCH_INCLUDE_DIR}"
+ LINK_LIBRARIES ${SCOTCH_LIBRARY}
+ OUTPUT_VARIABLE _out)
+
+get_filename_component(_scotch_hint "${SCOTCH_LIBRARY}" DIRECTORY)
+
+if(SCOTCH_LIBRARY MATCHES ".*scotch.*${CMAKE_STATIC_LIBRARY_SUFFIX}")
+ # Assuming scotch was compiled as a static library
+ set(SCOTCH_LIBRARY_TYPE STATIC CACHE INTERNAL "" FORCE)
+else()
+ set(SCOTCH_LIBRARY_TYPE SHARED CACHE INTERNAL "" FORCE)
+endif()
+
+if(NOT _scotch_compiles)
+ if(_out MATCHES "SCOTCH_errorPrint")
+ find_library(SCOTCH_LIBRARY_ERR scotcherr
+ HINTS ${_scotch_hint})
+ find_library(SCOTCH_LIBRARY_ERREXIT scotcherrexit
+ HINTS ${_scotch_hint})
+
+ if(NOT TARGET Scotch::err)
+ add_library(Scotch::err ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL)
+ endif()
+ if(NOT TARGET Scotch::errexit)
+ add_library(Scotch::errexit ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL)
+ endif()
+
+ set_target_properties(Scotch::errexit PROPERTIES
+ IMPORTED_LOCATION "${SCOTCH_LIBRARY_ERREXIT}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C")
+
+ set_target_properties(Scotch::err PROPERTIES
+ IMPORTED_LOCATION "${SCOTCH_LIBRARY_ERR}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ INTERFACE_LINK_LIBRARIES "Scotch::errexit")
+
+ mark_as_advanced(SCOTCH_LIBRARY_ERR
+ SCOTCH_LIBRARY_ERREXIT)
+
+ list(APPEND SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY_ERR} ${SCOTCH_LIBRARY_ERREXIT})
+
+ set(_scotch_link_lib INTERFACE_LINK_LIBRARIES "Scotch::err")
+ endif()
+endif()
+
+if(NOT TARGET Scotch::scotch)
+ add_library(Scotch::scotch ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL)
+endif()
+set_target_properties(Scotch::scotch PROPERTIES
+ IMPORTED_LOCATION "${SCOTCH_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ ${_scotch_link_lib})
+
+set(SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for Scotch" FORCE)
+
+mark_as_advanced(SCOTCH_LIBRARY
+ SCOTCH_INCLUDE_DIR
+ SCOTCH_LIBRARIES)
+
+
+if("${Scotch_FIND_COMPONENTS}" MATCHES "esmumps")
+ find_library(SCOTCH_LIBRARY_ESMUMPS esmumps HINTS ${_scotch_hint})
+
+ if(NOT TARGET Scotch::esmumps)
+ add_library(Scotch::esmumps ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL)
+ endif()
+ set_target_properties(Scotch::esmumps PROPERTIES
+ IMPORTED_LOCATION "${SCOTCH_LIBRARY_ESMUMPS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C")
+
+
+ mark_as_advanced(SCOTCH_LIBRARY_ESMUMPS)
+endif()
+
+if("${Scotch_FIND_COMPONENTS}" MATCHES "metis")
+ find_library(SCOTCH_LIBRARY_METIS scotchmetis HINTS ${_scotch_hint})
+
+ if(NOT TARGET Scotch::metis)
+ add_library(Scotch::metis ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL)
+ endif()
+ set_target_properties(Scotch::metis PROPERTIES
+ IMPORTED_LOCATION "${SCOTCH_LIBRARY_METIS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C")
+
+ mark_as_advanced(SCOTCH_LIBRARY_METIS)
+endif()
+
+if("${Scotch_FIND_COMPONENTS}" MATCHES "parmetis")
+ find_library(SCOTCH_LIBRARY_PARMETIS scotchparmetis HINTS ${_scotch_hint})
+
+ if(NOT TARGET Scotch::parmetis)
+ add_library(Scotch::parmetis ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL)
+ endif()
+ set_target_properties(Scotch::parmetis PROPERTIES
+ IMPORTED_LOCATION "${SCOTCH_LIBRARY_PARMETIS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ INTERFACE_INCLUDE_DIRECTORIES "Scotch::metis")
+ mark_as_advanced(SCOTCH_LIBRARY_PARMETIS)
+endif()
+
+#
+##===============================================================================
+if("${Scotch_FIND_COMPONENTS}" MATCHES "ptscotch")
+ file(WRITE "${_scotch_test_dir}/ptscotch_test_code.c"
+ "#include
+#include
+#include
+#include
+
+int main() {
+ SCOTCH_Dgraph graph;
+ SCOTCH_dgraphInit(&graph, MPI_COMM_WORLD);
+ return 0;
+}
+")
+
+ find_package(MPI REQUIRED)
+
+ find_library(SCOTCH_LIBRARY_PTSCOTCH ptscotch HINTS ${_scotch_hint})
+
+ try_compile(_scotch_compiles "${_scotch_test_dir}" SOURCES "${_scotch_test_dir}/ptscotch_test_code.c"
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${SCOTCH_INCLUDE_DIR};${MPI_C_INCLUDE_PATH}"
+ LINK_LIBRARIES ${SCOTCH_LIBRARY_PTSCOTCH} ${MPI_C_LIBRARIES}
+ OUTPUT_VARIABLE _out)
+
+ if(NOT _scotch_compiles)
+ if(_out MATCHES "SCOTCH_archExit")
+ set(_scotch_link_lib INTERFACE_LINK_LIBRARIES "Scotch::scotch")
+ endif()
+ endif()
+
+ if(NOT TARGET Scotch::ptscotch)
+ add_library(Scotch::ptscotch ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL)
+ endif()
+ set_target_properties(Scotch::ptscotch PROPERTIES
+ IMPORTED_LOCATION "${SCOTCH_LIBRARY_PTSCOTCH}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ ${_scotch_link_lib})
+
+ set(PTSCOTCH_LIBRARIES ${SCOTCH_LIBRARY_PTSCOTCH} ${SCOTCH_LIBRARIES} CACHE INTERNAL "Libraries for PT-Scotch" FORCE)
+
+ mark_as_advanced(SCOTCH_LIBRARY_PTSCOTCH
+ PTSCOTCH_LIBRARIES)
+
+ if("${Scotch_FIND_COMPONENTS}" MATCHES "esmumps")
+ find_library(SCOTCH_LIBRARY_PTESMUMPS ptesmumps
+ HINTS ${_scotch_hint} PATH_SUFFIXES lib .)
+
+ if(NOT TARGET Scotch::ptesmumps)
+ add_library(Scotch::ptesmumps ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL)
+ endif()
+ set_target_properties(Scotch::ptesmumps PROPERTIES
+ IMPORTED_LOCATION "${SCOTCH_LIBRARY_ESMUMPS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C")
+
+ mark_as_advanced(SCOTCH_LIBRARY_PTESMUMPS)
+ endif()
+endif()
diff --git a/cmake/blas.cmake b/cmake/blas.cmake
new file mode 100644
index 0000000..9648874
--- /dev/null
+++ b/cmake/blas.cmake
@@ -0,0 +1,63 @@
+/**
+ * @file blas.cmake
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Nicolas Richart
+ */
+set(_default_blas $ENV{BLA_VENDOR})
+if(NOT _default_blas)
+ set(_default_blas All)
+endif()
+set(BSPLINES_USE_BLAS_VENDOR "${_default_blas}" CACHE STRING "Version of blas to use")
+mark_as_advanced(BSPLINES_USE_BLAS_VENDOR)
+set_property(CACHE BSPLINES_USE_BLAS_VENDOR PROPERTY STRINGS
+ All
+ ACML
+ ACML_GPU
+ ACML_MP
+ ATLAS
+ Apple
+ CXML
+ DXML
+ Generic
+ Goto
+ IBMESSL
+ Intel
+ Intel10_32
+ Intel10_64lp
+ Intel10_64lp_seq
+ NAS
+ OpenBLAS
+ PhiPACK
+ SCSL
+ SGIMATH
+ SunPerf
+ )
+
+if(BSPLINES_USE_PARDISO)
+ set(BSPLINES_USE_BLAS_VENDOR Intel10_64lp CACHE STRING "" INTERNAL)
+endif()
+
+set(ENV{BLA_VENDOR} ${BSPLINES_USE_BLAS_VENDOR})
+
+find_package(BLAS REQUIRED)
+find_package(LAPACK REQUIRED)
diff --git a/cmake/bsplines-config.cmake.in b/cmake/bsplines-config.cmake.in
new file mode 100644
index 0000000..bd85d31
--- /dev/null
+++ b/cmake/bsplines-config.cmake.in
@@ -0,0 +1,54 @@
+/**
+ * @file bsplines-config.cmake.in
+ *
+ * @brief
+ *
+ * @copyright
+ * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * SPC (Swiss Plasma Center)
+ *
+ * spclibs is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * @authors
+ * (in alphabetical order)
+ * @author Trach-Minh Tran
+ */
+# - Config file for the BSPLINES package
+# It defines the target the following variables:
+# FFLAGS - Fortran compile flags
+# BSPLINES_MODS - include directories for bsplines modules
+# BSPLINES_LIBS - bsplines library
+# BSPLINES_EXTRA_INCS - additional include directories
+# BSPLINES_EXTRA_LIBS - additional libraries
+# HAS_PARDISO - BSPLINES built with PARDISO
+# HAS_MUMPS - BSPLINES built with MUMPS
+# MPIEXEC - MPI launcher
+# MPIEXEC_NUMPROC_FLAG - Number of MPI processes flag
+
+# Compute paths
+get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
+get_filename_component(_prefix "${_dir}/../.." ABSOLUTE)
+
+# Import the targets
+include("${_prefix}/lib/cmake/bsplines-targets.cmake")
+
+# Report other information
+set(FFLAGS "@CMAKE_Fortran_FLAGS@")
+set(BSPLINES_MODS "${_prefix}/include")
+set(BSPLINES_LIBS fft bsplines pppack pputils2)
+set(BSPLINES_EXTRA_INCS "@EXTRA_INCS@")
+set(BSPLINES_EXTRA_LIBS "@EXTRA_LIBS@")
+set(HAS_PARDISO "@HAS_PARDISO@")
+set(HAS_MUMPS "@HAS_MUMPS@")
+set(MPIEXEC "@MPIEXEC@")
+set(MPIEXEC_NUMPROC_FLAG "@MPIEXEC_NUMPROC_FLAG@")
diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile
new file mode 100644
index 0000000..bc32a3b
--- /dev/null
+++ b/docs/doxygen/Doxyfile
@@ -0,0 +1,75 @@
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+PROJECT_NAME = "SPClibs"
+PROJECT_BRIEF = ""
+PROJECT_LOGO = img/epfl_logo.png
+OUTPUT_DIRECTORY = ./
+OPTIMIZE_FOR_FORTRAN = YES
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+INPUT = ../../src/
+INPUT += ../../pppack/
+INPUT += ../../pputils2/
+INPUT += ../../fft/
+FILE_PATTERNS = *.f90 *.F90 *.tpl *.c
+RECURSIVE = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+SOURCE_BROWSER = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_DYNAMIC_SECTIONS = YES
+USE_MATHJAX = YES
+MATHJAX_RELPATH = https://cdn.mathjax.org/mathjax/latest
+GENERATE_TREEVIEW = YES
+HTML_FOOTER = customfooter.html
+HTML_EXTRA_STYLESHEET = doxygen-awesome-css/doxygen-awesome.css custom.css
+HTML_COLORSTYLE_HUE = 209
+HTML_COLORSTYLE_SAT = 255
+HTML_COLORSTYLE_GAMMA = 113
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+GENERATE_LATEX = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+CLASS_DIAGRAMS = YES
+HAVE_DOT = YES
+CALL_GRAPH = YES
+CALLER_GRAPH = YES
+DOT_GRAPH_MAX_NODES = 60
+DOT_IMAGE_FORMAT = svg
+
+#---------------------------------------------------------------------------
+# List of user-defined commands
+#---------------------------------------------------------------------------
+ALIASES += "merge=\xrefitem merge \"Merge comments\" \"Merge comments\""
+
+DISTRIBUTE_GROUP_DOC = YES
diff --git a/docs/doxygen/custom.css b/docs/doxygen/custom.css
new file mode 100644
index 0000000..815563f
--- /dev/null
+++ b/docs/doxygen/custom.css
@@ -0,0 +1,3 @@
+:root {
+ --content-maxwidth: 1200px;
+}
diff --git a/docs/doxygen/customfooter.html b/docs/doxygen/customfooter.html
new file mode 100644
index 0000000..cde195a
--- /dev/null
+++ b/docs/doxygen/customfooter.html
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+