Exemple #1
0
InputParameters
validParams<ConservedAction>()
{
  InputParameters params = validParams<Action>();
  params.addClassDescription(
      "Set up the variable(s) and the kernels needed for a conserved phase field variable."
      " Note that for a direct solve, the element family and order are overwritten with hermite "
      "and third.");
  MooseEnum solves("DIRECT REVERSE_SPLIT FORWARD_SPLIT");
  params.addRequiredParam<MooseEnum>("solve_type", solves, "Split or direct solve?");
  // Get MooseEnums for the possible order/family options for this variable
  MooseEnum families(AddVariableAction::getNonlinearVariableFamilies());
  MooseEnum orders(AddVariableAction::getNonlinearVariableOrders());
  params.addParam<MooseEnum>("family",
                             families,
                             "Specifies the family of FE "
                             "shape functions to use for this variable");
  params.addParam<MooseEnum>("order",
                             orders,
                             "Specifies the order of the FE "
                             "shape function to use for this variable");
  params.addParam<Real>("scaling", 1.0, "Specifies a scaling factor to apply to this variable");
  params.addParam<bool>("implicit", true, "Whether kernels are implicit or not");
  params.addParam<bool>(
      "use_displaced_mesh", false, "Whether to use displaced mesh in the kernels");
  params.addParamNamesToGroup("scaling implicit use_displaced_mesh", "Advanced");
  params.addRequiredParam<MaterialPropertyName>("mobility", "The mobility used with the kernel");
  params.addParam<std::vector<VariableName>>("args",
                                             "Vector of variable arguments this kernel depends on");
  params.addRequiredParam<MaterialPropertyName>(
      "free_energy", "Base name of the free energy function F defined in a free energy material");
  params.addRequiredParam<MaterialPropertyName>("kappa", "The kappa used with the kernel");

  return params;
}
Exemple #2
0
InputParameters validParams<AddLotsOfDiffusion>()
{
  MooseEnum families(AddVariableAction::getNonlinearVariableFamilies());
  MooseEnum orders(AddVariableAction::getNonlinearVariableOrders());

  InputParameters params = validParams<AddVariableAction>();
  params.addRequiredParam<unsigned int>("number", "The number of variables to add");

  return params;
}
Exemple #3
0
InputParameters validParams<AddAuxVariableAction>()
{
  MooseEnum families(AddAuxVariableAction::getAuxVariableFamilies());
  MooseEnum orders(AddAuxVariableAction::getAuxVariableOrders());

  InputParameters params = validParams<Action>();
  params.addParam<MooseEnum>("family", families, "Specifies the family of FE shape functions to use for this variable");
  params.addParam<MooseEnum>("order", orders,  "Specifies the order of the FE shape function to use for this variable (additional orders not listed are allowed)");
  params.addParam<Real>("initial_condition", 0.0, "Specifies the initial condition for this variable");
  params.addParam<std::vector<SubdomainName> >("block", "The block id where this variable lives");

  return params;
}
InputParameters validParams<AddLotsOfAuxVariablesAction>()
{
  MooseEnum families(AddVariableAction::getNonlinearVariableFamilies());
  MooseEnum orders(AddVariableAction::getNonlinearVariableOrders());

  InputParameters params = validParams<Action>();
  params.addRequiredParam<unsigned int>("number", "The number of variables to add");
  params.addParam<MooseEnum>("family", families, "Specifies the family of FE shape functions to use for this variable");
  params.addParam<MooseEnum>("order", orders,  "Specifies the order of the FE shape function to use for this variable");
  params.addParam<Real>("initial_condition", 0.0, "Specifies the initial condition for this variable");
  params.addParam<std::vector<SubdomainName> >("block", "The block id where this variable lives");

  return params;
}
InputParameters
validParams<AddLotsOfCoeffDiffusion>()
{
  MooseEnum families(AddVariableAction::getNonlinearVariableFamilies());
  MooseEnum orders(AddVariableAction::getNonlinearVariableOrders());

  InputParameters params = validParams<AddVariableAction>();
  //  params.addRequiredParam<unsigned int>("number", "The number of variables to add");
  params.addRequiredParam<std::vector<NonlinearVariableName>>(
      "variables", "The names of the variables for which CoeffDiffusion kernels should be added");
  // params.addRequiredParam<std::vector<std::string> >("diffusion_coeffs", "The names of the
  // diffusion coefficients used in the kernels.");

  return params;
}
InputParameters validParams<MultiAppProjectionTransfer>()
{
  InputParameters params = validParams<MultiAppTransfer>();
  params.addRequiredParam<AuxVariableName>("variable", "The auxiliary variable to store the transferred values in.");
  params.addRequiredParam<VariableName>("source_variable", "The variable to transfer from.");

  MooseEnum proj_type("l2", "l2");
  params.addParam<MooseEnum>("proj_type", proj_type, "The type of the projection.");

  MooseEnum families(AddVariableAction::getNonlinearVariableFamilies());
  params.addParam<MooseEnum>("family", families, "Specifies the family of FE shape functions to use for this variable");
  MooseEnum orders(AddVariableAction::getNonlinearVariableOrders());
  params.addParam<MooseEnum>("order", orders,  "Specifies the order of the FE shape function to use for this variable (additional orders not listed are allowed)");

  return params;
}
InputParameters
validParams<AddLotsOfPotentialDrivenArtificialDiff>()
{
  MooseEnum families(AddVariableAction::getNonlinearVariableFamilies());
  MooseEnum orders(AddVariableAction::getNonlinearVariableOrders());

  InputParameters params = validParams<AddVariableAction>();
  params.addRequiredParam<std::vector<NonlinearVariableName>>(
      "variables",
      "The names of the variables for which PotentialDrivenArtificialDiff kernels should be added");
  params.addRequiredParam<std::vector<VariableName>>(
      "potential", "A dummy vector that holds the potential to couple in for advection");
  params.addParam<Real>(
      "delta", 0.5, "Used for determining the amount of artificial diffusion to add.");
  return params;
}
/*******************************************************
 * ARP-FONT-CONTROL
 *******************************************************/
ArpFontControl::ArpFontControl(	BRect frame,
								const char* name,
								const BString16* label,
								uint32 message,
								float divider)
		: inherited(frame, name, 0, new BMessage(message),
					B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW),
		  mFontCtrl(0), mSizeCtrl(0), mMsgWhat(message)
{
	if (label) {
		if (divider <= 0) divider = StringWidth(label);
		BRect			f(0, 0, divider, frame.Height());
		BStringView*	sv = new BStringView(f, "sv", label);
		if (sv) AddChild(sv);
	}

	float				sizeW = StringWidth("000") + 5;
	float				sizeL = frame.Width() - sizeW;
	BRect				f(divider + 1, 0, sizeL - 1, frame.Height());
	mFontCtrl = new BMenuField(f, "fonts", 0, new BMenu("font"), true,
								B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	if (!mFontCtrl) return;

	mFontCtrl->SetDivider(0);
	BMenu*		m = mFontCtrl->Menu();
	if (m) {
		m->SetLabelFromMarked(true);
		_ArpFontControlFamilies		families(m);
		families.ForEach();
	}
	AddChild(mFontCtrl);

	float		iH = float(Prefs().GetInt32(ARP_INTCTRL_Y));
	float		iT = 0, iB = frame.Height();
	if (iH < frame.Height()) {
		iT = (frame.Height() - iH) / 2;
		iB = iT + iH;
	}
	f.Set(sizeL, iT, sizeL + sizeW, iB);
	mSizeCtrl = new ArpIntControl(	f, "size", 0, new BMessage(SIZE_IMSG),
									B_FOLLOW_RIGHT | B_FOLLOW_TOP);
	if (mSizeCtrl) {
		mSizeCtrl->SetLimits(1, 512);
		AddChild(mSizeCtrl);
	}

}
Exemple #9
0
			bool VkContext::GetQueueFamilies() {
				u32 familyCount = 0;
				vkGetPhysicalDeviceQueueFamilyProperties(physDev, &familyCount, nullptr);

				if (familyCount == 0) {
					std::cout << "Vulkan GPU does not support any queue family" << std::endl;
					return false;
				}

				std::vector<VkQueueFamilyProperties> families(familyCount);
				vkGetPhysicalDeviceQueueFamilyProperties(physDev, &familyCount, families.data());

				// Get a queue with support for both graphics and present
				u32 graphicsQueueIndex = UINT32_MAX;
				u32 presentQueueIndex = UINT32_MAX;
				for (u32 i = 0; i < familyCount; i++) {
					VkBool32 presentSupport = VK_FALSE;
					vkGetPhysicalDeviceSurfaceSupportKHR(physDev, i, surf, &presentSupport);

					if (families[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
						if (graphicsQueueIndex == UINT32_MAX) {
							graphicsQueueIndex = i;
						}
						if (presentSupport) {
							graphicsQueueIndex = i;
							presentQueueIndex = i;
							break;
						}
					}
				}

				if (graphicsQueueIndex == UINT32_MAX || presentQueueIndex == UINT32_MAX) {
					std::cout
						<< "Present or graphics queue not found" << std::endl;
					return false;
				}

				if (graphicsQueueIndex != presentQueueIndex) {
					std::cout << "Unable to find queue which supports both present and graphics" << std::endl;
					return false;
				}

				queueIndex = graphicsQueueIndex;

				return true;
			}
Exemple #10
0
BeOSFont::BeOSFont( string& oName, string& oFace, string& oFile,
                    string& oDefault )
:   Font( oName, oFace, oFile, oDefault )
{
    CHECK_POINT;
    PRINT(( "%s, %s, %s\n", oName.c_str(), oFace.c_str(), oDefault.c_str() ));

    BString families( oFace.c_str() );
    bool found = false;

    while ( families.Length() > 0 && !found )
    {
        BString familyToFind;
        int32 del = families.FindFirst( ',' );
        if ( del != B_ERROR )
        {
            families.MoveInto( familyToFind, 0, del );
            families.Remove( 0, 1 ); // remove first char ','
        }
        else
        {
            families.MoveInto( familyToFind, 0, families.Length() );
        }

        // find if it's installed
        int32 numFamilies = count_font_families();
        for ( int32 i = 0; i < numFamilies; i++ )
        {
            font_family family;
            uint32 flags;
            if ( get_font_family( i, &family, &flags ) == B_OK )
            {
                if ( oName == family )
                {
                    found = true;
                    break;
                }
            }
        }
    }

    // map the well known font names
    CHECK_POINT;
}
void aether::export_knowledgebase(hades::connection& conn)
{
    styx::list families(kb::family::get_collection(conn));
    for(styx::element& e : families)
    {
        styx::object& family = boost::get<styx::object>(e);
        family.get_list("varieties") = kb::variety::get_collection(
            conn,
            hades::where(
                "aether_kb_variety.kb_family_id = ?",
                hades::row<styx::int_type>(family.get_int("kb_family_id"))
            )
        );
        for(styx::element& e : family.get_list("varieties"))
        {
            styx::object& v = boost::get<styx::object>(e);
            styx::int_type variety_id = v.get_int(attr::kb_variety_id);

            v.get_list("harvest_mon") = kb::variety_harvest_mon::get_collection(
                conn,
                hades::where(
                    "aether_kb_variety_harvest_mon.kb_variety_id = ?",
                    hades::row<styx::int_type>(variety_id)
                )
            );
            v.get_list("plant_mon") = kb::variety_plant_mon::get_collection(
                conn,
                hades::where(
                    "aether_kb_variety_plant_mon.kb_variety_id = ?",
                    hades::row<styx::int_type>(variety_id)
                )
            );
            v.get_list("sow_mon") = kb::variety_sow_mon::get_collection(
                conn,
                hades::where(
                    "aether_kb_variety_sow_mon.kb_variety_id = ?",
                    hades::row<styx::int_type>(variety_id)
                )
            );
        }
    }
    std::cout << styx::serialise_json(families) << std::endl;
}
Exemple #12
0
InputParameters validParams<AddVariableAction>()
{
  // Get MooseEnums for the possible order/family options for this variable
  MooseEnum families(AddVariableAction::getNonlinearVariableFamilies());
  MooseEnum orders(AddVariableAction::getNonlinearVariableOrders());

  // Define the general input options
  InputParameters params = validParams<Action>();
  params.addParam<MooseEnum>("family", families, "Specifies the family of FE shape functions to use for this variable");
  params.addParam<MooseEnum>("order", orders,  "Specifies the order of the FE shape function to use for this variable (additional orders not listed are allowed)");
  params.addParam<Real>("initial_condition", 0.0, "Specifies the initial condition for this variable");
  params.addParam<std::vector<SubdomainName> >("block", "The block id where this variable lives");
  params.addParam<bool>("eigen", false, "True to make this variable an eigen variable");

  // Advanced input options
  params.addParam<Real>("scaling", 1.0, "Specifies a scaling factor to apply to this variable");
  params.addParamNamesToGroup("scaling", "Advanced");

  return params;
}
void VineCopulaStructureSelect(double *bounds, int type, double *Structure, double *Families, double *Rotations, std::vector<double>& Thetas, double *U, int d, unsigned int n, int StructuringRule, double *familyset, int m)
{
    std::vector<int> families((d-1)*d/2);
    std::vector<int> rotations((d-1)*d/2);
    std::vector<double> thetas;
    
    int i,j,k,I;
    
    switch (type)
    {
        case 0: // C-Vine
        {
            std::vector<int> structure(d);
            
            for (i=0;i<d;i++)
            {
                structure[i] = i;
            }
            
            switch (StructuringRule)
            {
                case 0: // Maximizing the sum of absolute Kendall's tau in every tree
                {
                    I = UpdateStructure(structure, 0, U, d, d, n);
                    
                    std::vector<double> V(n*d);
                    
                    for (i=0;i<(int)n;i++)
                    {
                        V[i] = U[I*n+i];
                    }
                    
                    for (j=0;j<I;j++)
                    {
                        for (i=0;i<(int)n;i++)
                        {
                            V[(j+1)*n+i] = U[j*n+i];
                        }
                    }
                    
                    for (j=I+1;j<d;j++)
                    {
                        for (i=0;i<(int)n;i++)
                        {
                            V[j*n+i] = U[j*n+i];
                        }
                    }
                    
                    TreeSelect(bounds,type, &families[0], thetas, &rotations[0], &V[0], d, n, familyset, m);
                    
                    GetPseudoObs(&families[0], thetas, &rotations[0], &V[0], d, n);
                    
                    for (k=1;k<d-2;k++)
                    {
                        I = UpdateStructure(structure, 0, &V[n], d, d-k, n);
                        
                        for (i=0;i<(int)n;i++)
                        {
                            V[i] = V[(I+1)*n+i];
                        }
                        
                        for (j=I+1;j<d-k;j++)
                        {
                            for (i=0;i<(int)n;i++)
                            {
                                V[j*n+i] = V[(j+1)*n+i];
                            }
                        }
                        
                        TreeSelect(bounds,type, &families[d*k-k*(k+1)/2], thetas, &rotations[d*k-k*(k+1)/2], &V[0], d-k, n, familyset, m);
                        
                        GetPseudoObs(&families[d*k-k*(k+1)/2], thetas, &rotations[d*k-k*(k+1)/2], &V[0], d-k, n);
                    }
                    
                    TreeSelect(bounds,type, &families[d*(d-1)/2-1], thetas, &rotations[d*(d-1)/2-1], &V[n], 2, n, familyset, m);
                    break;
                }
// case 2: Choose the most dependent variable as the root node and list the other variables by their dependence to the root node in increasing order (Nikoloulopoulos et al. 2012, p.3665)
// case 3: Choose the most dependent variable as the root node and list the other variables sequentially by choosing the variable which is least dependent with the previously selcted one (Nikoloulopoulos et al. 2012, p.3665)
// case 1: Choose the most dependent variable as the root node and list the other variables by their dependence to the root node in decreasing order (Nikoloulopoulos et al. 2012, p.3665)
                default:
                {
                    I = UpdateStructure(structure, StructuringRule, U, d, d, n);
                    
                    std::vector<double> V(n*d);
                    
                    for (j=0;j<d;j++)
                    {
                        for (i=0;i<(int)n;i++)
                        {
                            V[j*n+i] = U[structure[j]*n+i];
                        }
                    }
                    
                    TreeSelect(bounds,type, &families[0], thetas, &rotations[0], &V[0], d, n, familyset, m);
                    
                    GetPseudoObs(&families[0], thetas, &rotations[0], &V[0], d, n);
                    
                    
                    for (k=1;k<d-2;k++)
                    {
                        TreeSelect(bounds,type, &families[d*k-k*(k+1)/2], thetas, &rotations[d*k-k*(k+1)/2], &V[k*n], d-k, n, familyset, m);
                        
                        GetPseudoObs(&families[d*k-k*(k+1)/2], thetas, &rotations[d*k-k*(k+1)/2], &V[k*n], d-k, n);
                    }
                    
                    TreeSelect(bounds,type, &families[d*(d-1)/2-1], thetas, &rotations[d*(d-1)/2-1], &V[(d-2)*n], 2, n, familyset, m);
                }
            }
            
            
            Thetas.resize(thetas.size());
            
            switch (StructuringRule)
            {
                case 0:
                {
                    std::vector<int> NumbParams((d-1)*d/2+1);
                    int J=0;
                    
                    for (i=0;i<(d-1)*d/2;i++)
                    {
                        switch((int) families[i]){
                            case 0:
                            {
                                NumbParams[i+1] = NumbParams[i];
                                break;
                            }
                            case 18:
                            {
                                NumbParams[i+1] = NumbParams[i] +3;
                                break;
                            }
                            case 3: case 4: case 5: case 6: case 12: case 16: case 17: case 19:
                            {
                                NumbParams[i+1] = NumbParams[i] +2;
                                break;
                            }
                            default:
                            {
                                NumbParams[i+1] = NumbParams[i] +1;
                            }
                            
                        }
                    }
                    std::vector<std::pair<int, int> > R(d-1);
                    std::vector<int> Ranks(d-1);
                    
                    for (k=0;k<d-1;k++)
                    {
                        // Computing ranks
                        for (i=0;i<d-k-1;i++)
                        {
                            R[i] = std::make_pair(structure[i+1+k],i);
                        }
                        
                        std::sort(&R[0],&R[d-k-1]);
                        
                        for (i=0;i<d-k-1;i++)
                        {
                            Ranks[R[i].second] = i;
                        }
                        
                        for (i=0;i<d-k-1;i++)
                        {
                            Families[d*k-k*(k+1)/2+i] = (double) families[d*k-k*(k+1)/2+Ranks[i]];
                            Rotations[d*k-k*(k+1)/2+i] = (double) rotations[d*k-k*(k+1)/2+Ranks[i]];
                            switch(NumbParams[d*k-k*(k+1)/2+Ranks[i]+1]-NumbParams[d*k-k*(k+1)/2+Ranks[i]]){
                                case 0:
                                {
                                    break;
                                }
                                case 1:
                                {
                                    Thetas[J] = thetas[NumbParams[d*k-k*(k+1)/2+Ranks[i]]];
                                    J++;
                                    break;
                                }
                                case 2:
                                {
                                    Thetas[J] = thetas[NumbParams[d*k-k*(k+1)/2+Ranks[i]]];
                                    Thetas[J+1] = thetas[NumbParams[d*k-k*(k+1)/2+Ranks[i]]+1];
                                    J = J+2;
                                    break;
                                }
                                default:
                                {
                                    Thetas[J] = thetas[NumbParams[d*k-k*(k+1)/2+Ranks[i]]];
                                    Thetas[J+1] = thetas[NumbParams[d*k-k*(k+1)/2+Ranks[i]]+1];
                                    Thetas[J+2] = thetas[NumbParams[d*k-k*(k+1)/2+Ranks[i]]+2];
                                    J = J+3;
                                }
                            }
                        }
                    }
                    break;
                }
                default:
                {
                    for (i=0;i<(d-1)*d/2;i++)
                    {
                        Families[i] = (double) families[i];
                        Rotations[i] = (double) rotations[i];
                    }
                    
                    for (i=0;i<(int) thetas.size();i++)
                    {
                        Thetas[i] = thetas[i];
                    }
                    
                }
            }
            
            for (i=0;i<d;i++)
            {
                Structure[i] = (double) structure[i];
            }
            break;
        }
        case 1: // D-Vine
        {
            std::vector<double> V((d-2)*n);
            std::vector<double> H((d-2)*n);
            std::vector<double> U1(n),V1(n);
            
            TreeSelect(bounds,type, &families[0], thetas, &rotations[0], &U[0], d, n, familyset, m);
            
            int J =0;
            
            for (i=0;i<d-1;i++)
            {
                if (rotations[i]>0)
                {
                    Rotate_Obs(&U[i*n],&U[(i+1)*n],&U1[0],&V1[0],rotations[i],n);
                    if (i<d-2) {
                        PairCopulaHfun_Rotated_Obs(families[i], rotations[i], &thetas[J], &U1[0], &V1[0], &H[i*n], n);
                    }
                    if (i>0) {
                        PairCopulaVfun_Rotated_Obs(families[i], rotations[i], &thetas[J], &U1[0], &V1[0], &V[(i-1)*n], n);
                    }
                }
                else
                {
                    if (i<d-2) {
                        PairCopulaHfun(families[i], &thetas[J], &U[i*n], &U[(i+1)*n], &H[i*n], n);
                    }
                    if (i>0) {
                        PairCopulaVfun(families[i], &thetas[J], &U[i*n], &U[(i+1)*n], &V[(i-1)*n], n);
                    }
                }
                switch(families[i]){
                    case 0:
                    {
                        break;
                    }
                    case 18:
                    {
                        J += 3;
                        break;
                    }
                    case 3: case 4: case 5: case 6: case 12: case 16: case 17: case 19:
                    {
                        J += 2;
                        break;
                    }
                    default:
                    {
                        J += 1;
                    }
                }
            }

            
            for (k=1;k<d-2;k++)
            {
                TreeSelect(bounds,type, &families[d*k-k*(k+1)/2], thetas, &rotations[d*k-k*(k+1)/2], &H[0], &V[0], d-k, n, familyset, m);
                
                for (i=0;i<d-k-1;i++)
                {
                    if (rotations[d*k-k*(k+1)/2+i]>0)
                    {
                        Rotate_Obs(&H[i*n],&V[i*n],&U1[0],&V1[0],rotations[d*k-k*(k+1)/2+i],n);
                        if (i>0) {
                            PairCopulaVfun_Rotated_Obs(families[d*k-k*(k+1)/2+i], rotations[d*k-k*(k+1)/2+i], &thetas[J], &U1[0], &V1[0], &V[(i-1)*n], n);
                        }
                        if (i<d-k-2) {
                            PairCopulaHfun_Rotated_Obs(families[d*k-k*(k+1)/2+i], rotations[d*k-k*(k+1)/2+i], &thetas[J], &U1[0], &V1[0], &H[i*n], n);
                        }
                    }
                    else
                    {
                        if (i>0) {
                            PairCopulaVfun(families[d*k-k*(k+1)/2+i], &thetas[J], &H[i*n], &V[i*n], &V[(i-1)*n], n);
                        }
                        if (i<d-k-2) {
                            PairCopulaHfun(families[d*k-k*(k+1)/2+i], &thetas[J], &H[i*n], &V[i*n], &H[i*n], n);
                        }
                    }
                    switch(families[d*k-k*(k+1)/2+i]){
                        case 0:
                        {
                            break;
                        }
                        case 18:
                        {
                            J += 3;
                            break;
                        }
                        case 3: case 4: case 5: case 6: case 12: case 16: case 17: case 19:
                        {
                            J += 2;
                            break;
                        }
                        default:
                        {
                            J += 1;
                        }
                    }
                }
            }

            TreeSelect(bounds,type, &families[d*(d-1)/2-1], thetas, &rotations[d*(d-1)/2-1], &H[0], &V[0], 2, n, familyset, m);
            
            Thetas.resize(thetas.size());
            
            for (i=0;i<(d-1)*d/2;i++)
            {
                Families[i] = (double) families[i];
                Rotations[i] = (double) rotations[i];
            }
            
            for (i=0;i<(int) thetas.size();i++)
            {
                Thetas[i] = thetas[i];
            }
        }
    }
    
    return;
}