IgANet
IGAnets - Isogeometric Analysis Networks
Loading...
Searching...
No Matches
iganet::MultiPatch< Patch > Class Template Reference

Multi-patch container class. More...

#include </home/runner/work/iganet/iganet/include/iganet/splines/multipatch.hpp>

Public Types

using interface_type = PatchInterface< Patch >
 Interface type.
 

Public Member Functions

 MultiPatch ()=default
 Default constructor.
 
 MultiPatch (const MultiPatch &other)
 Copy constructor.
 
 MultiPatch (MultiPatch &&other) noexcept
 Move constructor.
 
std::size_t addInterface (interface_type patchInterface)
 Adds an interface object.
 
std::size_t addInterface (std::shared_ptr< Patch > firstPatch, enum side firstSide, std::shared_ptr< Patch > secondPatch, enum side secondSide)
 Adds an interface between two patches.
 
std::size_t addInterface (std::size_t firstPatch, enum side firstSide, std::size_t secondPatch, enum side secondSide)
 Adds an interface between two patches identified by index.
 
auto begin ()
 Returns an iterator to the patches.
 
void clear ()
 Removes all patches.
 
auto end ()
 Returns an iterator to the end of the patches.
 
template<typename P = Patch>
requires requires { typename P::value_type; }
MultiPatchfrom_json (const nlohmann::json &json, Options< typename P::value_type > options=Options< typename P::value_type >{})
 Updates the multi-patch object from a JSON object.
 
template<typename P = Patch>
requires requires { typename P::value_type; }
MultiPatchfrom_xml (const pugi::xml_document &doc, int id=0, const std::string &label="", int index=-1, Options< typename P::value_type > options=Options< typename P::value_type >{})
 Updates the multi-patch object from an XML document.
 
template<typename P = Patch>
requires requires { typename P::value_type; }
MultiPatchfrom_xml (const pugi::xml_node &root, int id=0, const std::string &label="", int index=-1, Options< typename P::value_type > options=Options< typename P::value_type >{})
 Updates the multi-patch object from an XML node.
 
interface_typeinterface (std::size_t index)
 Returns a non-constant reference to a single interface.
 
const interface_typeinterface (std::size_t index) const
 Returns a constant reference to a single interface.
 
template<typename P = Patch>
requires requires { typename P::value_type; }
bool isclose (const MultiPatch &other, typename P::value_type rtol=typename P::value_type{1e-5}, typename P::value_type atol=typename P::value_type{1e-8}) const
 Returns true if patches and topology are close up to tolerances.
 
template<typename P = Patch>
requires requires { typename P::value_type; }
void load (const std::string &filename, const std::string &key="multipatch", Options< typename P::value_type > options=Options< typename P::value_type >{})
 Loads the multi-patch object from a Torch archive file.
 
std::size_t nboundaries () const
 Returns the number of outer boundaries.
 
std::size_t ninterfaces () const
 Returns the number of interfaces.
 
std::size_t npatches () const
 Returns the number of patches.
 
bool operator!= (const MultiPatch &other) const
 Returns true if patches or topology differ.
 
bool operator== (const MultiPatch &other) const
 Returns true if patches and topology are exactly equal.
 
Patch & patch (std::size_t index)
 Returns a non-constant reference to a single patch.
 
const Patch & patch (std::size_t index) const
 Returns a constant reference to a single patch.
 
void pretty_print (std::ostream &os) const noexcept
 Prints a human-readable representation of the multi-patch object.
 
auto rbegin ()
 Returns a reverse iterator to the patches.
 
template<typename P = Patch>
requires requires { typename P::value_type; }
torch::serialize::InputArchive & read (torch::serialize::InputArchive &archive, const std::string &key="multipatch", Options< typename P::value_type > options=Options< typename P::value_type >{})
 Reads the multi-patch object from a Torch input archive.
 
void removeInterface (std::size_t index)
 Removes a single interface.
 
auto rend ()
 Returns a reverse iterator to the end of the patches.
 
void save (const std::string &filename, const std::string &key="multipatch") const
 Saves the multi-patch object to a Torch archive file.
 
nlohmann::json to_json () const
 Returns the multi-patch object as a JSON object.
 
pugi::xml_document to_xml (int id=0, const std::string &label="", int index=-1) const
 Returns the multi-patch object as an XML document.
 
pugi::xml_node & to_xml (pugi::xml_node &root, int id=0, const std::string &label="", int index=-1) const
 Appends the multi-patch object to an XML node.
 
torch::serialize::OutputArchive & write (torch::serialize::OutputArchive &archive, const std::string &key="multipatch") const
 Writes the multi-patch object into a Torch output archive.
 

Static Private Member Functions

template<typename real_t >
static bool jsonIsClose (const nlohmann::json &first, const nlohmann::json &second, real_t rtol, real_t atol)
 

Private Attributes

std::vector< interface_typeinterfaces_
 Vector of patch-interface objects.
 
std::vector< std::shared_ptr< Patch > > patches_
 Vector of single-patch objects.
 

Detailed Description

template<typename Patch>
class iganet::MultiPatch< Patch >

Multi-patch container class.

This class implements a container for a set of patches and their topology, that is, the interface connections and outer boundary faces.

Member Typedef Documentation

◆ interface_type

template<typename Patch >
using iganet::MultiPatch< Patch >::interface_type = PatchInterface<Patch>

Interface type.

Constructor & Destructor Documentation

◆ MultiPatch() [1/3]

template<typename Patch >
iganet::MultiPatch< Patch >::MultiPatch ( )
default

Default constructor.

◆ MultiPatch() [2/3]

template<typename Patch >
iganet::MultiPatch< Patch >::MultiPatch ( const MultiPatch< Patch > &  other)
inline

Copy constructor.

Parameters
otherSecond input value.

◆ MultiPatch() [3/3]

template<typename Patch >
iganet::MultiPatch< Patch >::MultiPatch ( MultiPatch< Patch > &&  other)
inlinenoexcept

Move constructor.

Parameters
otherSecond input value.

Member Function Documentation

◆ addInterface() [1/3]

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::addInterface ( interface_type  patchInterface)
inline

Adds an interface object.

Parameters
patchInterfaceValue of patchInterface.
Returns
Result of the operation.

◆ addInterface() [2/3]

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::addInterface ( std::shared_ptr< Patch >  firstPatch,
enum side  firstSide,
std::shared_ptr< Patch >  secondPatch,
enum side  secondSide 
)
inline

Adds an interface between two patches.

Parameters
firstPatchValue of firstPatch.
firstSideValue of firstSide.
secondPatchValue of secondPatch.
secondSideValue of secondSide.
Returns
Result of the operation.

◆ addInterface() [3/3]

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::addInterface ( std::size_t  firstPatch,
enum side  firstSide,
std::size_t  secondPatch,
enum side  secondSide 
)
inline

Adds an interface between two patches identified by index.

Parameters
firstPatchValue of firstPatch.
firstSideValue of firstSide.
secondPatchValue of secondPatch.
secondSideValue of secondSide.
Returns
Result of the operation.

◆ addPatch() [1/2]

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::addPatch ( std::shared_ptr< Patch >  patch)
inline

Adds a single patch.

Parameters
patchPatch to process.
Returns
Result of the operation.

◆ addPatch() [2/2]

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::addPatch ( std::unique_ptr< Patch >  patch)
inline

Provides the addPatch operation.

Parameters
patchPatch to process.
Returns
Result of the operation.

◆ begin() [1/2]

template<typename Patch >
auto iganet::MultiPatch< Patch >::begin ( )
inline

Returns an iterator to the patches.

Returns
Result of the operation.

◆ begin() [2/2]

template<typename Patch >
auto iganet::MultiPatch< Patch >::begin ( ) const
inline

Returns a const-iterator to the patches.

Returns
Result of the operation.

◆ cbegin()

template<typename Patch >
auto iganet::MultiPatch< Patch >::cbegin ( ) const
inlinenoexcept

Provides the cbegin operation.

Returns
Result of the operation.

◆ cend()

template<typename Patch >
auto iganet::MultiPatch< Patch >::cend ( ) const
inlinenoexcept

Provides the cend operation.

Returns
Result of the operation.

◆ clear()

template<typename Patch >
void iganet::MultiPatch< Patch >::clear ( )
inline

Removes all patches.

◆ crbegin()

template<typename Patch >
auto iganet::MultiPatch< Patch >::crbegin ( ) const
inlinenoexcept

Provides the crbegin operation.

Returns
Result of the operation.

◆ crend()

template<typename Patch >
auto iganet::MultiPatch< Patch >::crend ( ) const
inlinenoexcept

Provides the crend operation.

Returns
Result of the operation.

◆ end() [1/2]

template<typename Patch >
auto iganet::MultiPatch< Patch >::end ( )
inline

Returns an iterator to the end of the patches.

Returns
Result of the operation.

◆ end() [2/2]

template<typename Patch >
auto iganet::MultiPatch< Patch >::end ( ) const
inline

Returns a const-iterator to the end of the patches.

Returns
Result of the operation.

◆ findInterfaceIndex() [1/2]

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::findInterfaceIndex ( const interface_type patchInterface) const
inline

Returns the index of a given patch interface.

Parameters
patchInterfaceValue of patchInterface.
Returns
Result of the operation.

◆ findInterfaceIndex() [2/2]

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::findInterfaceIndex ( const interface_type patchInterface) const
inline

Provides the findInterfaceIndex operation.

Parameters
patchInterfaceValue of patchInterface.
Returns
Result of the operation.

◆ findPatchIndex() [1/2]

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::findPatchIndex ( const Patch &  patch) const
inline

Returns the index of a given single patch.

Parameters
patchPatch to process.
Returns
Result of the operation.

◆ findPatchIndex() [2/2]

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::findPatchIndex ( const Patch *  patch) const
inline

Provides the findPatchIndex operation.

Parameters
patchPatch to process.
Returns
Result of the operation.

◆ from_json()

template<typename Patch >
template<typename P = Patch>
requires requires { typename P::value_type; }
MultiPatch & iganet::MultiPatch< Patch >::from_json ( const nlohmann::json &  json,
Options< typename P::value_type >  options = Options<typename P::value_type>{} 
)
inline

Updates the multi-patch object from a JSON object.

Template Parameters
PTemplate parameter P.
Parameters
jsonJSON value to process.
optionsConfiguration options.
Returns
Result of the operation.

◆ from_xml() [1/2]

template<typename Patch >
template<typename P = Patch>
requires requires { typename P::value_type; }
MultiPatch & iganet::MultiPatch< Patch >::from_xml ( const pugi::xml_document &  doc,
int  id = 0,
const std::string &  label = "",
int  index = -1,
Options< typename P::value_type >  options = Options<typename P::value_type>{} 
)
inline

Updates the multi-patch object from an XML document.

Template Parameters
PTemplate parameter P.
Parameters
docValue of doc.
idObject identifier.
labelObject label.
indexObject index.
optionsConfiguration options.
Returns
Result of the operation.

◆ from_xml() [2/2]

template<typename Patch >
template<typename P = Patch>
requires requires { typename P::value_type; }
MultiPatch & iganet::MultiPatch< Patch >::from_xml ( const pugi::xml_node &  root,
int  id = 0,
const std::string &  label = "",
int  index = -1,
Options< typename P::value_type >  options = Options<typename P::value_type>{} 
)
inline

Updates the multi-patch object from an XML node.

Template Parameters
PTemplate parameter P.
Parameters
rootRoot XML node.
idObject identifier.
labelObject label.
indexObject index.
optionsConfiguration options.
Returns
Result of the operation.

◆ interface() [1/2]

template<typename Patch >
interface_type & iganet::MultiPatch< Patch >::interface ( std::size_t  index)
inline

Returns a non-constant reference to a single interface.

Parameters
indexObject index.
Returns
Result of the operation.

◆ interface() [2/2]

template<typename Patch >
const interface_type & iganet::MultiPatch< Patch >::interface ( std::size_t  index) const
inline

Returns a constant reference to a single interface.

Parameters
indexObject index.
Returns
Result of the operation.

◆ interfaces() [1/2]

template<typename Patch >
std::vector< interface_type > & iganet::MultiPatch< Patch >::interfaces ( )
inline

Returns the interfaces for range-based iteration.

Returns
Result of the operation.

◆ interfaces() [2/2]

template<typename Patch >
const std::vector< interface_type > & iganet::MultiPatch< Patch >::interfaces ( ) const
inline

Provides the interfaces operation.

Returns
Result of the operation.

◆ isclose()

template<typename Patch >
template<typename P = Patch>
requires requires { typename P::value_type; }
bool iganet::MultiPatch< Patch >::isclose ( const MultiPatch< Patch > &  other,
typename P::value_type  rtol = typename P::value_type{1e-5},
typename P::value_type  atol = typename P::value_type{1e-8} 
) const
inline

Returns true if patches and topology are close up to tolerances.

Template Parameters
PTemplate parameter P.
Parameters
otherSecond input value.
rtolValue of rtol.
atolValue of atol.
Returns
Result of the operation.

◆ jsonIsClose()

template<typename Patch >
template<typename real_t >
static bool iganet::MultiPatch< Patch >::jsonIsClose ( const nlohmann::json &  first,
const nlohmann::json &  second,
real_t  rtol,
real_t  atol 
)
inlinestaticprivate

◆ load()

template<typename Patch >
template<typename P = Patch>
requires requires { typename P::value_type; }
void iganet::MultiPatch< Patch >::load ( const std::string &  filename,
const std::string &  key = "multipatch",
Options< typename P::value_type >  options = Options<typename P::value_type>{} 
)
inline

Loads the multi-patch object from a Torch archive file.

Template Parameters
PTemplate parameter P.
Parameters
filenamePath of the file to process.
keySerialization key.
optionsConfiguration options.

◆ nboundaries()

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::nboundaries ( ) const
inline

Returns the number of outer boundaries.

Returns
Result of the operation.

◆ ninterfaces()

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::ninterfaces ( ) const
inline

Returns the number of interfaces.

Returns
Result of the operation.

◆ npatches()

template<typename Patch >
std::size_t iganet::MultiPatch< Patch >::npatches ( ) const
inline

Returns the number of patches.

Returns
Result of the operation.

◆ operator!=()

template<typename Patch >
bool iganet::MultiPatch< Patch >::operator!= ( const MultiPatch< Patch > &  other) const
inline

Returns true if patches or topology differ.

Parameters
otherSecond input value.
Returns
Result of the operation.

◆ operator==()

template<typename Patch >
bool iganet::MultiPatch< Patch >::operator== ( const MultiPatch< Patch > &  other) const
inline

Returns true if patches and topology are exactly equal.

Parameters
otherSecond input value.
Returns
Result of the operation.

◆ patch() [1/2]

template<typename Patch >
Patch & iganet::MultiPatch< Patch >::patch ( std::size_t  index)
inline

Returns a non-constant reference to a single patch.

Parameters
indexObject index.
Returns
Result of the operation.

◆ patch() [2/2]

template<typename Patch >
const Patch & iganet::MultiPatch< Patch >::patch ( std::size_t  index) const
inline

Returns a constant reference to a single patch.

Parameters
indexObject index.
Returns
Result of the operation.

◆ patches() [1/2]

template<typename Patch >
std::vector< std::shared_ptr< Patch > > & iganet::MultiPatch< Patch >::patches ( )
inline

Returns a reference to the vector of patches.

Returns
Result of the operation.

◆ patches() [2/2]

template<typename Patch >
const std::vector< std::shared_ptr< Patch > > & iganet::MultiPatch< Patch >::patches ( ) const
inline

Provides the patches operation.

Returns
Result of the operation.

◆ pretty_print()

template<typename Patch >
void iganet::MultiPatch< Patch >::pretty_print ( std::ostream &  os) const
inlinenoexcept

Prints a human-readable representation of the multi-patch object.

Parameters
osOutput stream.

◆ rbegin() [1/2]

template<typename Patch >
auto iganet::MultiPatch< Patch >::rbegin ( )
inline

Returns a reverse iterator to the patches.

Returns
Result of the operation.

◆ rbegin() [2/2]

template<typename Patch >
auto iganet::MultiPatch< Patch >::rbegin ( ) const
inline

Returns a reverse const-iterator to the patches.

Returns
Result of the operation.

◆ read()

template<typename Patch >
template<typename P = Patch>
requires requires { typename P::value_type; }
torch::serialize::InputArchive & iganet::MultiPatch< Patch >::read ( torch::serialize::InputArchive &  archive,
const std::string &  key = "multipatch",
Options< typename P::value_type >  options = Options<typename P::value_type>{} 
)
inline

Reads the multi-patch object from a Torch input archive.

Template Parameters
PTemplate parameter P.
Parameters
archiveSerialization archive.
keySerialization key.
optionsConfiguration options.
Returns
Result of the operation.

◆ removeInterface()

template<typename Patch >
void iganet::MultiPatch< Patch >::removeInterface ( std::size_t  index)
inline

Removes a single interface.

Parameters
indexObject index.

◆ rend() [1/2]

template<typename Patch >
auto iganet::MultiPatch< Patch >::rend ( )
inline

Returns a reverse iterator to the end of the patches.

Returns
Result of the operation.

◆ rend() [2/2]

template<typename Patch >
auto iganet::MultiPatch< Patch >::rend ( ) const
inline

Returns a reverse const-iterator to the end of the patches.

Returns
Result of the operation.

◆ save()

template<typename Patch >
void iganet::MultiPatch< Patch >::save ( const std::string &  filename,
const std::string &  key = "multipatch" 
) const
inline

Saves the multi-patch object to a Torch archive file.

Parameters
filenamePath of the file to process.
keySerialization key.

◆ to_json()

template<typename Patch >
nlohmann::json iganet::MultiPatch< Patch >::to_json ( ) const
inline

Returns the multi-patch object as a JSON object.

Returns
Result of the operation.

◆ to_xml() [1/2]

template<typename Patch >
pugi::xml_document iganet::MultiPatch< Patch >::to_xml ( int  id = 0,
const std::string &  label = "",
int  index = -1 
) const
inline

Returns the multi-patch object as an XML document.

Parameters
idObject identifier.
labelObject label.
indexObject index.
Returns
Result of the operation.

◆ to_xml() [2/2]

template<typename Patch >
pugi::xml_node & iganet::MultiPatch< Patch >::to_xml ( pugi::xml_node &  root,
int  id = 0,
const std::string &  label = "",
int  index = -1 
) const
inline

Appends the multi-patch object to an XML node.

Parameters
rootRoot XML node.
idObject identifier.
labelObject label.
indexObject index.
Returns
Result of the operation.

◆ write()

template<typename Patch >
torch::serialize::OutputArchive & iganet::MultiPatch< Patch >::write ( torch::serialize::OutputArchive &  archive,
const std::string &  key = "multipatch" 
) const
inline

Writes the multi-patch object into a Torch output archive.

Parameters
archiveSerialization archive.
keySerialization key.
Returns
Result of the operation.

Member Data Documentation

◆ interfaces_

template<typename Patch >
std::vector<interface_type> iganet::MultiPatch< Patch >::interfaces_
private

Vector of patch-interface objects.

◆ patches_

template<typename Patch >
std::vector<std::shared_ptr<Patch> > iganet::MultiPatch< Patch >::patches_
private

Vector of single-patch objects.


The documentation for this class was generated from the following file: