Esempio n. 1
0
// Sets element order without updating the enumeration of dofs. For internal use.
void HcurlSpace::set_element_order_internal(int id, int order)
{
  assert_msg(mesh->get_element(id)->is_quad() || H2D_GET_V_ORDER(order) == 0, "Element #%d is triangle but vertical order is not zero", id);
  if (id < 0 || id >= mesh->get_max_element_id())
    error("Invalid element id.");
  H2D_CHECK_ORDER(order);

  resize_tables();
  edata[id].order = order;
  seq++;
}
Esempio n. 2
0
// just sets the element order without enumerating dof
void Space::set_element_order_internal(int id, int order)
{
  //NOTE: We need to take into account that L2 and Hcurl may use zero orders. The latter has its own version of this method, however.
  assert_msg(mesh->get_element(id)->is_triangle() || get_type() == 3 || H2D_GET_V_ORDER(order) != 0, "Element #%d is quad but given vertical order is zero", id);
  assert_msg(mesh->get_element(id)->is_quad() || H2D_GET_V_ORDER(order) == 0, "Element #%d is triangle but vertical is not zero", id);
  if (id < 0 || id >= mesh->get_max_element_id())
    error("Invalid element id.");
  H2D_CHECK_ORDER(order);

  resize_tables();
  if (mesh->get_element(id)->is_quad() && get_type() != 3 && H2D_GET_V_ORDER(order) == 0) 
     order = H2D_MAKE_QUAD_ORDER(order, order);
  edata[id].order = order;
  seq++;
}
Esempio n. 3
0
void Space::set_element_orders(int* elem_orders_)
{
  resize_tables();
  
  Element* e;
  int counter = 0;
  for_all_elements(e, mesh)
  {
    H2D_CHECK_ORDER(elem_orders_[counter]);
    ElementData* ed = &edata[e->id];
    if (e->is_triangle())
      ed->order = elem_orders_[counter];
    else
      ed->order = H2D_MAKE_QUAD_ORDER(elem_orders_[counter], elem_orders_[counter]);
    counter++;
  }
Esempio n. 4
0
void Space::set_uniform_order_internal(int order, int marker)
{
  resize_tables();
  H2D_CHECK_ORDER(order);
  int quad_order = H2D_MAKE_QUAD_ORDER(order, order);

  Element* e;
  for_all_active_elements(e, mesh)
  {
    if (marker == H2D_ANY || e->marker == marker)
    {
      ElementData* ed = &edata[e->id];
      if (e->is_triangle())
        ed->order = order;
      else
        ed->order = quad_order;
    }
  }
  seq++;
}
Esempio n. 5
0
void PrecalcShapeset::precalculate(int order, int mask)
{
  int i, j, k;

  // initialization
  Quad2D* quad = get_quad_2d();
  quad->set_mode(mode);
  H2D_CHECK_ORDER(quad, order);
  int np = quad->get_num_points(order);
  double3* pt = quad->get_points(order);

  int oldmask = (cur_node != NULL) ? cur_node->mask : 0;
  int newmask = mask | oldmask;
  Node* node = new_node(newmask, np);

  // precalculate all required tables
  for (j = 0; j < num_components; j++)
  {
    for (k = 0; k < 6; k++)
    {
      if (newmask & idx2mask[k][j]) {
        if (oldmask & idx2mask[k][j])
          memcpy(node->values[j][k], cur_node->values[j][k], np * sizeof(double));
        else
          for (i = 0; i < np; i++)
            node->values[j][k][i] = shapeset->get_value(k, index, ctm->m[0] * pt[i][0] + ctm->t[0],
                                                                  ctm->m[1] * pt[i][1] + ctm->t[1], j);
      }
    }
  }
  if(nodes->present(order)) {
    assert(nodes->get(order) == cur_node);
    ::free(nodes->get(order));
  }
  nodes->add(node, order);
  cur_node = node;
}