Exemplo n.º 1
0
Real
RndSmoothCircleIC::value(const Point & p)
{
  Real value = 0.0;

  Real rad = 0.0;

  for(unsigned int i=0; i<LIBMESH_DIM; i++)
    rad += (p(i)-_center(i)) * (p(i)-_center(i));

  rad = sqrt(rad);

  //Random number between 0 and 1
  Real rand_num = MooseRandom::rand();

  if (rad <= _radius)
    value = _mn_invalue + rand_num*(_range_invalue);
  else if (rad < 1.5*_radius)
  {
    Real av_invalue = (_mn_invalue + _mx_invalue)/2.0;
    Real av_outvalue = (_mn_outvalue + _mx_outvalue)/2.0;
    value = av_outvalue + (av_invalue-av_outvalue)*(1+cos((rad-_radius)/_radius*2.0*3.14159))/2.0;
  }
  else
    value = _mx_outvalue + rand_num*(_range_outvalue);

  return value;

}
Exemplo n.º 2
0
Point TriangleInterface::PolygonHole::point(const unsigned int n) const
{
  // The nth point lies at the angle theta = 2 * pi * n / _n_points
  const Real theta = static_cast<Real>(n) * 2.0 * libMesh::pi / static_cast<Real>(_n_points);

  return Point(_center(0) + _radius*std::cos(theta), // x=r*cos(theta)
               _center(1) + _radius*std::sin(theta), // y=r*sin(theta)
               0.);
}
Exemplo n.º 3
0
int main(){
	Fossilizid::center::center _center("test.config", "center");

	_center.run();

	return 0;
}
Exemplo n.º 4
0
bool
XFEMGeometricCut3D::intersectWithEdge(const Point & p1, const Point & p2, Point & pint)
{
  bool has_intersection = false;
  double plane_point[3] = {_center(0), _center(1), _center(2)};
  double plane_normal[3] = {_normal(0), _normal(1), _normal(2)};
  double edge_point1[3] = {p1(0), p1(1), p1(2)};
  double edge_point2[3] = {p2(0), p2(1), p2(2)};
  double cut_point[3] = {0.0,0.0,0.0};

  if (Xfem::plane_normal_line_exp_int_3d(plane_point, plane_normal, edge_point1, edge_point2, cut_point) == 1) {
    Point temp_p(cut_point[0], cut_point[1], cut_point[2]);
    if ( isInsideCutPlane(temp_p) && isInsideEdge(p1, p2, temp_p) )
    {
      pint = temp_p;
      has_intersection = true;
    }
  }
  return has_intersection;
}
Exemplo n.º 5
0
void BiotSavart::setVolume()
{
   _meas.setSize(_theMesh->getNbElements());
   _center.setSize(_theMesh->getNbElements());
   size_t k=1;
   MeshElements(*_theMesh) {
      Tetra4 t(theElement);
      _meas(k) = t.getVolume();
      _center(k++) = t.getCenter();
   }
}
Exemplo n.º 6
0
    void SubMalla::center()
    {
     Eigen::Vector3d _center(0, 0, 0);

      Eigen::Vector3d min, max, half;
      min = this->getMin();
      max = this->getMax();
      half = (max - min) * 0.5;

      this->translate(_center - (min + half));
    }
Exemplo n.º 7
0
void BiotSavart::setLine()
{
   _meas.setSize(_theMesh->getNbEdges());
   _center.setSize(_theMesh->getNbEdges());
   size_t k=1;
   MeshEdges(*_theMesh) {
      Line2 l(theEdge);
      if (theEdge->getCode()==_code) {
         _meas(k) = l.getLength();
         _center(k++) = l.getCenter();
      }
   }
}
Exemplo n.º 8
0
void BiotSavart::setSurface()
{
   _meas.setSize(_theMesh->getNbSides());
   _center.setSize(_theMesh->getNbSides());
   size_t k=1;
   MeshSides(*_theMesh) {
      Triang3 t(theSide);
      if (theSide->getCode()==_code) {
         _meas(k) = t.getArea();
         _center(k++) = t.getCenter();
      }
   }
}
Exemplo n.º 9
0
void peano::geometry::builtin::configurations::SphereConfiguration::toXML(std::ostream& result) const {
  result << "<" << TAG << "\n";

  result << "  " << ATTRIBUTE_CENTER << "=\"";
  for (int i=0; i<DIMENSIONS; i++ ) {
    result << " " << _center(i);
  }
  result << "\"\n";

  result << "  " << ATTRIBUTE_RADIUS << " " << "=\"" << _radius << "\"\n";

  result << "/>\n";
}
Exemplo n.º 10
0
RH_C_FUNCTION bool ON_RadialDimension2_CreateFromPoints(ON_RadialDimension2* pRadialDimension, ON_3DPOINT_STRUCT center, ON_3DPOINT_STRUCT arrowTip,
                                                        ON_3DVECTOR_STRUCT xaxis, ON_3DVECTOR_STRUCT normal, double offset_distance)
{
  bool rc = false;
  if( pRadialDimension )
  {
    ON_3dPoint _center(center.val);
    ON_3dPoint _arrowtip(arrowTip.val);
    ON_3dVector _xaxis(xaxis.val);
    ON_3dVector _normal(normal.val);
    rc = pRadialDimension->CreateFromPoints(_center, _arrowtip, _xaxis, _normal, offset_distance);
  }
  return rc;
}
Exemplo n.º 11
0
RealGradient
LevelSetOlssonBubble::gradient(Real /*t*/, const Point & p)
{
  Real norm = (p - _center).size();
  Real g = (norm - _radius) / _epsilon;
  RealGradient output;

  Real g_prime;
  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
  {
    g_prime = (p(i) - _center(i)) / (_epsilon * norm);
    output(i) = (g_prime * std::exp(g)) / ((std::exp(g) + 1) * (std::exp(g) + 1));
  }
  return output;
}
Exemplo n.º 12
0
CameraManager::CameraManager() : Singleton<CameraManager>(),
								 m_AllCameras(),
								 m_AllWinCameras()
{
	m_AllCameras[DEFAULT_PERSPECRIVE_CAMERA_KEY]	 = new PerspectiveCamera(DEFAULT_PERSPECRIVE_CAMERA_KEY);
	m_AllCameras[DEFAULT_ORTHOGRAPHIC_CAMERA_KEY]	 = new OrthoCamera(DEFAULT_ORTHOGRAPHIC_CAMERA_KEY);
	m_AllWinCameras[DEFAULT_PERSPECRIVE_CAMERA_KEY]  = m_AllCameras[DEFAULT_PERSPECRIVE_CAMERA_KEY];
	m_AllWinCameras[DEFAULT_ORTHOGRAPHIC_CAMERA_KEY] = m_AllCameras[DEFAULT_ORTHOGRAPHIC_CAMERA_KEY];

	vec4 _eye(0.0f, 0.0f, 5.0f, 1.0f);
	vec4 _center(0.0f, 0.0f, 0.0f, 1.0f);
	vec3 _up(0.0f, 1.0f, 0.0f);

	m_AllCameras[DEFAULT_PERSPECRIVE_CAMERA_KEY]->LookAt(_eye, _center, _up);
	m_AllCameras[DEFAULT_ORTHOGRAPHIC_CAMERA_KEY]->LookAt(_eye, _center, _up);
}