-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement getHostBasis() in newer Basis subclasses #8811
Changes from all commits
7937403
7306e06
6127bc6
2251f3e
5234926
6ebf006
4f35a98
1c6fd95
1d5acb1
2f56e4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,9 +67,7 @@ namespace Intrepid2 | |
{ | ||
template<class HGRAD_LINE, class HVOL_LINE> | ||
class Basis_Derived_HCURL_Family1_HEX | ||
: public Basis_TensorBasis3<HVOL_LINE, | ||
HGRAD_LINE, | ||
HGRAD_LINE> | ||
: public Basis_TensorBasis3<typename HGRAD_LINE::BasisBase> | ||
{ | ||
public: | ||
using OutputViewType = typename HGRAD_LINE::OutputViewType; | ||
|
@@ -79,7 +77,7 @@ namespace Intrepid2 | |
using LineGradBasis = HGRAD_LINE; | ||
using LineVolBasis = HVOL_LINE; | ||
|
||
using TensorBasis3 = Basis_TensorBasis3<LineVolBasis, LineGradBasis, LineGradBasis>; | ||
using TensorBasis3 = Basis_TensorBasis3<typename HGRAD_LINE::BasisBase>; | ||
public: | ||
/** \brief Constructor. | ||
\param [in] polyOrder_x - the polynomial order in the x dimension. | ||
|
@@ -224,9 +222,7 @@ namespace Intrepid2 | |
|
||
template<class HGRAD_LINE, class HVOL_LINE> | ||
class Basis_Derived_HCURL_Family2_HEX | ||
: public Basis_TensorBasis3<HGRAD_LINE, | ||
HVOL_LINE, | ||
HGRAD_LINE> | ||
: public Basis_TensorBasis3<typename HGRAD_LINE::BasisBase> | ||
{ | ||
public: | ||
using OutputViewType = typename HGRAD_LINE::OutputViewType; | ||
|
@@ -236,7 +232,7 @@ namespace Intrepid2 | |
using LineGradBasis = HGRAD_LINE; | ||
using LineVolBasis = HVOL_LINE; | ||
|
||
using TensorBasis3 = Basis_TensorBasis3<LineGradBasis, LineVolBasis, LineGradBasis>; | ||
using TensorBasis3 = Basis_TensorBasis3<typename HGRAD_LINE::BasisBase>; | ||
public: | ||
/** \brief Constructor. | ||
\param [in] polyOrder_x - the polynomial order in the x dimension. | ||
|
@@ -388,9 +384,7 @@ namespace Intrepid2 | |
|
||
template<class HGRAD_LINE, class HVOL_LINE> | ||
class Basis_Derived_HCURL_Family3_HEX | ||
: public Basis_TensorBasis3<HGRAD_LINE, | ||
HGRAD_LINE, | ||
HVOL_LINE> | ||
: public Basis_TensorBasis3<typename HGRAD_LINE::BasisBase> | ||
{ | ||
using OutputViewType = typename HGRAD_LINE::OutputViewType; | ||
using PointViewType = typename HGRAD_LINE::PointViewType ; | ||
|
@@ -399,7 +393,7 @@ namespace Intrepid2 | |
using LineGradBasis = HGRAD_LINE; | ||
using LineVolBasis = HVOL_LINE; | ||
|
||
using TensorBasis3 = Basis_TensorBasis3<LineGradBasis, LineGradBasis, LineVolBasis>; | ||
using TensorBasis3 = Basis_TensorBasis3<typename HGRAD_LINE::BasisBase>; | ||
public: | ||
/** \brief Constructor. | ||
\param [in] polyOrder_x - the polynomial order in the x dimension. | ||
|
@@ -540,11 +534,11 @@ namespace Intrepid2 | |
|
||
template<class HGRAD_LINE, class HVOL_LINE> | ||
class Basis_Derived_HCURL_Family1_Family2_HEX | ||
: public Basis_DirectSumBasis <typename HGRAD_LINE::ExecutionSpace, typename HGRAD_LINE::OutputValueType, typename HGRAD_LINE::PointValueType> | ||
: public Basis_DirectSumBasis <typename HGRAD_LINE::BasisBase> | ||
{ | ||
using Family1 = Basis_Derived_HCURL_Family1_HEX<HGRAD_LINE, HVOL_LINE>; | ||
using Family2 = Basis_Derived_HCURL_Family2_HEX<HGRAD_LINE, HVOL_LINE>; | ||
using DirectSumBasis = Basis_DirectSumBasis <typename HGRAD_LINE::ExecutionSpace, typename HGRAD_LINE::OutputValueType, typename HGRAD_LINE::PointValueType>; | ||
using DirectSumBasis = Basis_DirectSumBasis <typename HGRAD_LINE::BasisBase>; | ||
public: | ||
/** \brief Constructor. | ||
\param [in] polyOrder_x - the polynomial order in the x dimension. | ||
|
@@ -560,11 +554,11 @@ namespace Intrepid2 | |
|
||
template<class HGRAD_LINE, class HVOL_LINE> | ||
class Basis_Derived_HCURL_HEX | ||
: public Basis_DirectSumBasis <typename HGRAD_LINE::ExecutionSpace, typename HGRAD_LINE::OutputValueType, typename HGRAD_LINE::PointValueType> | ||
: public Basis_DirectSumBasis <typename HGRAD_LINE::BasisBase> | ||
{ | ||
using Family12 = Basis_Derived_HCURL_Family1_Family2_HEX<HGRAD_LINE, HVOL_LINE>; | ||
using Family3 = Basis_Derived_HCURL_Family3_HEX <HGRAD_LINE, HVOL_LINE>; | ||
using DirectSumBasis = Basis_DirectSumBasis <typename HGRAD_LINE::ExecutionSpace, typename HGRAD_LINE::OutputValueType, typename HGRAD_LINE::PointValueType>; | ||
using DirectSumBasis = Basis_DirectSumBasis <typename HGRAD_LINE::BasisBase>; | ||
|
||
std::string name_; | ||
ordinal_type order_x_; | ||
|
@@ -577,6 +571,8 @@ namespace Intrepid2 | |
using ExecutionSpace = typename HGRAD_LINE::ExecutionSpace; | ||
using OutputValueType = typename HGRAD_LINE::OutputValueType; | ||
using PointValueType = typename HGRAD_LINE::PointValueType; | ||
|
||
using BasisBase = typename HGRAD_LINE::BasisBase; | ||
|
||
/** \brief Constructor. | ||
\param [in] polyOrder_x - the polynomial order in the x dimension. | ||
|
@@ -631,7 +627,7 @@ namespace Intrepid2 | |
\param [in] subCellOrd - position of the subCell among of the subCells having the same dimension | ||
\return pointer to the subCell basis of dimension subCellDim and position subCellOrd | ||
*/ | ||
BasisPtr<ExecutionSpace, OutputValueType, PointValueType> | ||
Teuchos::RCP<BasisBase> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change meaningful ? This means that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it is meaningful. BasisBase may have as its first template argument a DeviceType that is distinct from the ExecutionSpace. If so, then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this work in the virtual override context if you change ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not entirely sure what you are asking. If you are asking whether things compile if I don't make this change, the answer is no, they do not compile. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean that both returns teuchos rcp and the compiler may consider this class is overriding function. If they consider this function is different, the compiler may redirect the function to its super class interface. Previously, it probably does not compile because it uses execution space template argument instead of device argument. As you mentioned, it compiles but does it override the function correctly when the object is casted to its super class (in other words, does this make sure that it has the same function signature to override) ? Unit test will tell this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kyungjoo-kim, the method is marked as override. If the compiler considered this to be a different function from that in the base class, it would refuse to compile it. |
||
getSubCellRefBasis(const ordinal_type subCellDim, const ordinal_type subCellOrd) const override{ | ||
|
||
using LineBasis = HVOL_LINE; | ||
|
@@ -674,7 +670,18 @@ namespace Intrepid2 | |
|
||
INTREPID2_TEST_FOR_EXCEPTION(true,std::invalid_argument,"Input parameters out of bounds"); | ||
} | ||
|
||
/** \brief Creates and returns a Basis object whose DeviceType template argument is Kokkos::HostSpace::device_type, but is otherwise identical to this. | ||
\return Pointer to the new Basis object. | ||
*/ | ||
virtual HostBasisPtr<OutputValueType, PointValueType> | ||
getHostBasis() const override { | ||
using HostBasis = Basis_Derived_HCURL_HEX<typename HGRAD_LINE::HostBasis, typename HVOL_LINE::HostBasis>; | ||
|
||
auto hostBasis = Teuchos::rcp(new HostBasis(order_x_, order_y_, order_z_, pointType_)); | ||
|
||
return hostBasis; | ||
} | ||
}; | ||
} // end namespace Intrepid2 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you do defaulting for the output type and point type ? This should match to this output type and point type. It does not need to default with double.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyungjoo-kim, I followed the pattern of the BasisPtr typedef that is immediately above this typedef. It's true it doesn't need to default to double, but I think it's good to be consistent between the two typedefs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is internal typedef of the basis. Defaulting the template arguments here and in the above does not make sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyungjoo-kim, ah, I see the confusion. Actually, these typedefs are not internal to the Basis class.