Beispiel #1
0
 public bool Check(DomainTypes domainType, string name, string cryptedPassword)
 {
     PasswordEntry entry = _entries.FirstOrDefault(x => x.DomainType == domainType && x.Name == name);
     if (entry == null)
         return CheckSucceedIfNotFound;
     return entry.CryptedPassword == cryptedPassword;
 }
Beispiel #2
0
        /// <summary>
        /// Creates the appropriate instance of <see cref="CNSFieldSet"/>
        /// depending on the given <paramref name="domainType"/>
        /// </summary>
        /// <param name="domainType"></param>
        /// <param name="gridData"></param>
        /// <param name="control"></param>
        /// <returns></returns>
        public static CNSFieldSet CreateWorkingSet(this DomainTypes domainType, IGridData gridData, CNSControl control)
        {
            switch (domainType)
            {
            case DomainTypes.Standard:
                return(new CNSFieldSet(gridData, control));

            case DomainTypes.StaticImmersedBoundary:
            case DomainTypes.MovingImmersedBoundary:
                // Make level set gradient exists in list of derived fields
                for (int d = 0; d < CompressibleEnvironment.NumberOfDimensions; d++)
                {
                    if (!control.FieldOptions.ContainsKey(IBMVariables.LevelSetGradient[d]))
                    {
                        control.AddVariable(
                            IBMVariables.LevelSetGradient[d],
                            control.VariableToDegreeMap[IBMVariables.LevelSet] - 1);
                    }
                }
                return(new IBMFieldSet(gridData, (IBMControl)control));

            default:
                throw new Exception();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Creates an <see cref="OperatorFactory"/> with appropriate terms
        /// (convective/diffusive) for the selected <paramref name="formulation"/>.
        /// </summary>
        /// <param name="formulation">
        /// The chosen equation system
        /// </param>
        /// <param name="control"></param>
        /// <param name="gridData"></param>
        /// <param name="speciesMap"></param>
        /// <param name="workingSet"></param>
        /// <param name="boundaryMap">
        /// Boundary information
        /// </param>
        /// <returns>
        /// An instance of <see cref="OperatorFactory"/> that has been
        /// configured with the fluxes defined by
        /// <see cref="CNSControl.ConvectiveFluxType"/> and/or
        /// <see cref="CNSControl.DiffusiveFluxType"/>.
        /// </returns>
        public static OperatorFactory GetOperatorFactory(
            this DomainTypes formulation, CNSControl control, IGridData gridData, BoundaryConditionMap boundaryMap, CNSFieldSet workingSet, ISpeciesMap speciesMap)
        {
            switch (formulation)
            {
            case DomainTypes.Standard:
                return(new OperatorFactory(
                           control, gridData, workingSet, speciesMap, boundaryMap));

            case DomainTypes.StaticImmersedBoundary:
            case DomainTypes.MovingImmersedBoundary:
                FluxBuilder convectiveBuilder = control.ConvectiveFluxType.GetBuilder(
                    control, boundaryMap, speciesMap);
                return(new IBMOperatorFactory(
                           (IBMControl)control,
                           gridData,
                           workingSet,
                           speciesMap,
                           boundaryMap));

            default:
                throw new Exception(
                          "Unknown formulation \"" + control.DomainType + "\"");
            }
        }
Beispiel #4
0
 public bool Remove(DomainTypes domainType, string name)
 {
     PasswordEntry entry = _entries.FirstOrDefault(x => x.DomainType == domainType && x.Name == name);
     if (entry == null)
         return false;
     _entries.Remove(entry);
     return true;
 }
Beispiel #5
0
 public bool Add(DomainTypes domainType, string name, string cryptedPassword)
 {
     if (_entries.Any(x => x.DomainType == domainType && x.Name == name))
         return false;
     _entries.Add(new PasswordEntry
         {
             DomainType = domainType,
             Name = name,
             CryptedPassword = cryptedPassword
         });
     return true;
 }
Beispiel #6
0
        /// <summary>
        /// Returns the correct species map for the current domain type
        /// </summary>
        /// <param name="domainType">
        /// The considered domain type
        /// </param>
        /// <param name="workingSet"></param>
        /// <param name="control"></param>
        /// <param name="gridData"></param>
        /// <returns>
        /// A species map that is suitable for the current application.
        /// </returns>
        public static ISpeciesMap CreateSpeciesMap(this DomainTypes domainType, CNSFieldSet workingSet, CNSControl control, IGridData gridData)
        {
            Material material = new Material(control.EquationOfState, control.ViscosityLaw, control.MachNumber, control.ReynoldsNumber, control.PrandtlNumber, control.FroudeNumber, control.ViscosityRatio);

            switch (domainType)
            {
            case DomainTypes.Standard:
                return(new SingleSpeciesMap(gridData, material));

            case DomainTypes.StaticImmersedBoundary:
            case DomainTypes.MovingImmersedBoundary:
                IBMFieldSet ibmWorkingSet = workingSet as IBMFieldSet;
                return(new ImmersedSpeciesMap(
                           (IBMControl)control, ibmWorkingSet.LevelSet, material));

            default:
                throw new Exception();
            }
        }
Beispiel #7
0
        /// <summary>
        /// Returns the correct species map for the current domain type
        /// </summary>
        /// <param name="domainType">
        /// The considered domain type
        /// </param>
        /// <param name="workingSet"></param>
        /// <param name="control"></param>
        /// <param name="gridData"></param>
        /// <returns>
        /// A species map that is suitable for the current application.
        /// </returns>
        public static ISpeciesMap CreateSpeciesMap(this DomainTypes domainType, CNSFieldSet workingSet, CNSControl control, GridData gridData)
        {
            Material material = new Material(control);

            switch (domainType)
            {
            case DomainTypes.Standard:
                return(new SingleSpeciesMap(gridData, material));

            case DomainTypes.StaticImmersedBoundary:
            case DomainTypes.MovingImmersedBoundary:
                IBMFieldSet ibmWorkingSet = workingSet as IBMFieldSet;
                return(new ImmersedSpeciesMap(
                           (IBMControl)control, ibmWorkingSet.LevelSet, material));

            default:
                throw new Exception();
            }
        }
Beispiel #8
0
 public IDomainType GetDomainType(Guid typeId)
 {
     return(DomainTypes.SingleOrDefault(type => type.GetTypeId() == typeId));
 }
Beispiel #9
0
 public IDomainType GetDomainType(Guid typeId)
 {
     return(DomainTypes.SingleOrDefault(type => type.BuildInID == typeId || type.Id == typeId));
 }