ModalPRefineableQElement< DIM > Class Template Reference
+ Inheritance diagram for ModalPRefineableQElement< DIM >:

Public Member Functions

 ModalPRefineableQElement ()
 
void initial_setup (Tree *const &adopted_father_pt=0, const unsigned &initial_p_order=0)
 
void pre_build (Mesh *&, Vector< Node * > &)
 
void further_build ()
 
void p_refine (const int &inc, Mesh *const &mesh_pt, GeneralisedElement *const &clone_pt)
 
void shape (const Vector< double > &s, Shape &psi) const
 
void basis (const Vector< double > &s, Shape &basis) const
 
void dshape_local (const Vector< double > &s, Shape &psi, DShape &dpsi) const
 
void dbasis_local (const Vector< double > &s, Shape &basis, DShape &dbasis) const
 
void d2shape_local (const Vector< double > &s, Shape &psi, DShape &dpsids, DShape &d2psids) const
 
void d2basis_local (const Vector< double > &s, Shape &basis, DShape &dbasisds, DShape &d2basisds) const
 
void initial_setup (Tree *const &adopted_father_pt, const unsigned &initial_p_order)
 
void pre_build (Mesh *&, Vector< Node * > &)
 
void p_refine (const int &inc, Mesh *const &mesh_pt, GeneralisedElement *const &clone_pt)
 
- Public Member Functions inherited from oomph::PRefineableQElement< DIM, 2 >
 PRefineableQElement ()
 Empty constuctor. More...
 

Constructor & Destructor Documentation

◆ ModalPRefineableQElement()

Member Function Documentation

◆ basis()

template<unsigned DIM>
void ModalPRefineableQElement< DIM >::basis ( const Vector< double > &  s,
Shape basis 
) const
1274 {
1275  // Get nnode-1d and p-order
1276  unsigned p_order = this->p_order();
1277 
1278  //Call the shape functions
1279  OneDimensionalModalShape psi1(p_order, s[0]);
1280 
1281  // Loop over shapes and copy across
1282  for(unsigned i=0;i<p_order;i++)
1283  {
1284  basis(i) = psi1[i];
1285  }
1286 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
void basis(const Vector< double > &s, Shape &basis) const
Definition: one_d_poisson_hp_adapt.cc:1273
Definition: shape.h:1349
RealScalar s
Definition: level1_cplx_impl.h:130

References i, and s.

Referenced by ModalPRefineableQPoissonElement< DIM >::basis().

◆ d2basis_local()

template<unsigned DIM>
void ModalPRefineableQElement< DIM >::d2basis_local ( const Vector< double > &  s,
Shape basis,
DShape dbasisds,
DShape d2basisds 
) const
1333 {
1334  std::ostringstream error_message;
1335  error_message <<"\nd2basis_local currently not implemented for this element\n";
1336  throw OomphLibError(error_message.str(),
1339 }
Definition: oomph_definitions.h:222
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

Referenced by ModalPRefineableQPoissonElement< DIM >::d2basis_local().

◆ d2shape_local()

template<unsigned DIM>
void ModalPRefineableQElement< DIM >::d2shape_local ( const Vector< double > &  s,
Shape psi,
DShape dpsids,
DShape d2psids 
) const
1322 {
1323  std::ostringstream error_message;
1324  error_message <<"\nd2shape_local currently not implemented for this element\n";
1325  throw OomphLibError(error_message.str(),
1328 }

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ dbasis_local()

template<unsigned DIM>
void ModalPRefineableQElement< DIM >::dbasis_local ( const Vector< double > &  s,
Shape basis,
DShape dbasis 
) const
1302 {
1303  // Get nnode-1d and p-order
1304  unsigned p_order = this->p_order();
1305 
1306  //Call the shape functions and derivatives
1307  OneDimensionalModalShape psi1(p_order, s[0]);
1308  OneDimensionalModalDShape dpsi1ds(p_order, s[0]);
1309 
1310  // Loop over shapes and copy across
1311  for(unsigned i=0;i<p_order;i++)
1312  {
1313  basis(i) = psi1[i];
1314  dbasis(i,0) = dpsi1ds[i];
1315  }
1316 
1317 }
Definition: shape.h:1367

References i, and s.

Referenced by ModalPRefineableQPoissonElement< DIM >::dbasis_local().

◆ dshape_local()

template<unsigned DIM>
void ModalPRefineableQElement< DIM >::dshape_local ( const Vector< double > &  s,
Shape psi,
DShape dpsi 
) const
1290 {
1291  // Shape functions
1292  psi(0) = 0.5*(1.0 - s[0]);
1293  psi(1) = 0.5*(1.0 + s[0]);
1294 
1295  // dShape/dlocal
1296  dpsi(0,0) = -0.5;
1297  dpsi(1,0) = 0.5;
1298 }

References s.

◆ further_build()

template<unsigned DIM>
void ModalPRefineableQElement< DIM >::further_build ( )
inline

◆ initial_setup() [1/2]

void ModalPRefineableQElement< 1 >::initial_setup ( Tree *const &  adopted_father_pt,
const unsigned initial_p_order 
)

/ How to interpolate for the initial guess?

1101 {
1102  // Create storage for internal data
1103  if (this->ninternal_data()==0)
1104  {
1105  this->add_internal_data(new Data(0));
1106  }
1107 
1108  //Storage for pointer to my father (in binarytree impersonation)
1109  BinaryTree* father_pt;
1110 
1111  // Check if an adopted father has been specified
1112  if (adopted_father_pt!=0)
1113  {
1114  //Get pointer to my father (in binarytree impersonation)
1115  father_pt = dynamic_cast<BinaryTree*>(adopted_father_pt);
1116  }
1117  // Check if element is in a tree
1118  else if (Tree_pt!=0)
1119  {
1120  //Get pointer to my father (in binarytree impersonation)
1121  father_pt = dynamic_cast<BinaryTree*>(binary_tree_pt()->father_pt());
1122  }
1123  else
1124  {
1125  throw OomphLibError(
1126  "Element not in a tree, and no adopted father has been specified!",
1129  }
1130 
1131  // Check if element has father
1132  if (father_pt!=0)
1133  {
1134  if (PRefineableQElement<1,2>* father_el_pt =
1135  dynamic_cast<PRefineableQElement<1,2>*>
1136  (father_pt->object_pt()))
1137  {
1138  unsigned father_p_order = father_el_pt->p_order();
1139  // Set the correct p-order of the element
1140  this->p_order() = father_p_order;
1141 
1142  // Now sort out the element...
1143 
1144  // Set integration scheme
1145  delete this->integral_pt();
1146  switch(this->p_order())
1147  {
1148  case 2:
1149  this->set_integration_scheme(new GaussLobattoLegendre<1,2>);
1150  break;
1151  case 3:
1152  this->set_integration_scheme(new GaussLobattoLegendre<1,3>);
1153  break;
1154  case 4:
1155  this->set_integration_scheme(new GaussLobattoLegendre<1,4>);
1156  break;
1157  case 5:
1158  this->set_integration_scheme(new GaussLobattoLegendre<1,5>);
1159  break;
1160  case 6:
1161  this->set_integration_scheme(new GaussLobattoLegendre<1,6>);
1162  break;
1163  case 7:
1164  this->set_integration_scheme(new GaussLobattoLegendre<1,7>);
1165  break;
1166  default:
1167  oomph_info << "\n ERROR: Exceeded maximum polynomial order for";
1168  oomph_info << "\n integration scheme." << std::endl;
1169  break;
1170  }
1171 
1172  // Set the size of the internal data
1173  if (this->internal_data_pt(0)->nvalue() <= this->p_order()-this->nnode())
1174  {
1175  this->internal_data_pt(0)->resize(this->p_order()-this->nnode());
1176  }
1177  else
1178  {
1179  Data* new_data_pt = new Data(this->p_order()-this->nnode());
1180  delete internal_data_pt(0);
1181  internal_data_pt(0) = new_data_pt;
1182  }
1183  if(this->ninternal_data()==0) delete this->internal_data_pt(0);
1184  // Interpolate initial guess from father to modes
1186  // Set to zero for now, don't do projection problem
1187  for (unsigned i=0; i<this->p_order()-this->nnode_1d(); i++)
1188  {
1189  this->internal_data_pt(0)->set_value(i, 0.0);
1190  }
1191  }
1192  else
1193  {
1194  oomph_info << "Dynamic cast FAILURE :-(" << endl;
1195  }
1196  }
1197 }
Definition: binary_tree.h:92
Definition: nodes.h:86
Definition: integral.h:1281
RefineableElement * object_pt() const
Definition: tree.h:88
OomphInfo oomph_info
Definition: oomph_definitions.cc:319

References i, oomph::Tree::object_pt(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::oomph_info.

◆ initial_setup() [2/2]

template<unsigned DIM>
void ModalPRefineableQElement< DIM >::initial_setup ( Tree *const &  adopted_father_pt = 0,
const unsigned initial_p_order = 0 
)

◆ p_refine() [1/2]

template<unsigned DIM>
void ModalPRefineableQElement< DIM >::p_refine ( const int inc,
Mesh *const &  mesh_pt,
GeneralisedElement *const &  clone_pt 
)

◆ p_refine() [2/2]

void ModalPRefineableQElement< 1 >::p_refine ( const int inc,
Mesh *const &  mesh_pt,
GeneralisedElement *const &  clone_pt 
)
1207 {
1208  // BENFLAG: In this case we do not need the pointer to a clone of the
1209  // element, or to the mesh, but they are required in the
1210  // interface because we are overloading this function from
1211  // the class PRefineableElement in which they are present.
1212 
1213  // Create storage for modes if none exists
1214  if (this->ninternal_data()==0)
1215  {
1216  this->add_internal_data(new Data(0));
1217  }
1218 
1219  // Increment p-order of the element
1220  this->p_order() += inc;
1221 
1222  // Change integration scheme
1223  delete this->integral_pt();
1224  switch(this->p_order())
1225  {
1226  case 2:
1227  this->set_integration_scheme(new GaussLobattoLegendre<1,2>);
1228  break;
1229  case 3:
1230  this->set_integration_scheme(new GaussLobattoLegendre<1,3>);
1231  break;
1232  case 4:
1233  this->set_integration_scheme(new GaussLobattoLegendre<1,4>);
1234  break;
1235  case 5:
1236  this->set_integration_scheme(new GaussLobattoLegendre<1,5>);
1237  break;
1238  case 6:
1239  this->set_integration_scheme(new GaussLobattoLegendre<1,6>);
1240  break;
1241  case 7:
1242  this->set_integration_scheme(new GaussLobattoLegendre<1,7>);
1243  break;
1244  default:
1245  oomph_info << "\n ERROR: Exceeded maximum polynomial order for";
1246  oomph_info << "\n integration scheme." << std::endl;
1247  break;
1248  }
1249 
1250  // Add/remove new modes
1251  if (this->internal_data_pt(0)->nvalue() <= this->p_order()-this->nnode())
1252  {
1253  this->internal_data_pt(0)->resize(this->p_order()-this->nnode());
1254  }
1255  else
1256  {
1257  Data* new_data_pt = new Data(this->p_order()-this->nnode());
1258  delete internal_data_pt(0);
1259  internal_data_pt(0) = new_data_pt;
1260  }
1261  if(this->ninternal_data()==0) delete this->internal_data_pt(0);
1262 }

References oomph::oomph_info.

◆ pre_build() [1/2]

template<unsigned DIM>
void ModalPRefineableQElement< DIM >::pre_build ( Mesh *&  ,
Vector< Node * > &   
)

◆ pre_build() [2/2]

void ModalPRefineableQElement< 1 >::pre_build ( Mesh *&  ,
Vector< Node * > &   
)
1200 {}

◆ shape()

template<unsigned DIM>
void ModalPRefineableQElement< DIM >::shape ( const Vector< double > &  s,
Shape psi 
) const
1266 {
1267  // Shape functions
1268  psi(0) = 0.5*(1.0 - s[0]);
1269  psi(1) = 0.5*(1.0 + s[0]);
1270 }

References s.


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