Esempio n. 1
0
        /// <summary>
        /// Creates a 3D plan.
        /// </summary>
        /// <param name="fftType">Type of FFT.</param>
        /// <param name="dataType">Data type.</param>
        /// <param name="nx">The number of samples in x dimension.</param>
        /// <param name="ny">The number of samples in y dimension.</param>
        /// <param name="nz">The number of samples in z dimension.</param>
        /// <param name="batchSize">Size of batch.</param>
        /// <returns>Plan.</returns>
        public override FFTPlan3D Plan3D(eFFTType fftType, eDataType dataType, int nx, int ny, int nz, int batchSize)
        {
            int         insize, outsize;
            CUFFTType   cuFFTType = VerifyTypes(fftType, dataType, out insize, out outsize);
            cufftHandle handle    = new cufftHandle();

            CUFFTResult res;

            if (batchSize <= 1)
            {
                res = _driver.cufftPlan3d(ref handle, nx, ny, nz, cuFFTType);
            }
            else
            {
                res = _driver.cufftPlanMany(ref handle, 3, new int[] { nx, ny, nz }, null, 1, 0, null, 1, 0, cuFFTType, batchSize);
            }

            if (res != CUFFTResult.Success)
            {
                throw new CudafyHostException(res.ToString());
            }
            FFTPlan3D   plan   = new FFTPlan3D(nx, ny, nz, batchSize, this);
            FFTPlan3DEx planEx = new FFTPlan3DEx(plan)
            {
                CudaFFTHandle = handle, CudaFFTType = cuFFTType, DataType = dataType
            };

            Plans.Add(plan, planEx);
            return(plan);
        }
Esempio n. 2
0
        private async Task Init()
        {
            IsEnabled = false;
            await Task.Factory.StartNew(() =>
            {
                lock (mLockObject)
                {
                    Plans.Clear();
                    var books = mBookService.GetBooks();
                    var plans = mPlanService.GetReviewPlanDatas(mUser);
                    foreach (var book in books)
                    {
                        var points = mDocumentService.GetBookPoints(book.Name);
                        var plan   = new UIPlan
                        {
                            Book        = book.Name,
                            BookTitle   = book.Title,
                            PointsCount = points.Count
                        };
                        Plans.Add(plan);
                        var savedPlan = plans.FirstOrDefault(a => a.Book.Equals(plan.Book));
                        if (savedPlan != null)
                        {
                            plan.Days      = savedPlan.Days;
                            plan.StartDate = savedPlan.StartDate;
                        }
                    }
                }
            });

            IsEnabled = true;
        }
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Plans.Clear();
                var plans = await PlanStore.GetDatasAsync(true);

                foreach (var item in plans)
                {
                    Plans.Add(item);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 4
0
        public MsSqlService()
        {
            Id          = ServiceId.ToString();
            Name        = "ms-sql";
            Description = "Microsoft SQL Server Service";
            Bindable    = true;
            Requires    = new string[0];
            Tags        = new string[0];
            Metadata    = new ServiceMetadata();

            Plans.Add(new MsSqlPlan
            {
                Id           = FreePlanId.ToString(),
                Name         = "free",
                Description  = "Free plan",
                DatabaseSize = 1024,
                Metadata     = new PlanMetadata
                {
                    DisplayName = "1 gig",
                    Bullets     = new[] { "1 gig database size" },
                    Costs       = new[] { new Cost {
                                              Unit = "Monthly", Amount = new Amount {
                                                  Denomination = "USD", Value = 0
                                              }
                                          } }
                }
            });
        }
Esempio n. 5
0
 public Plan CreatePlan(Plan plan)
 {
     plan.Id = _nextPlanId;
     _nextPlanId++;
     Plans.Add(plan.Id, plan);
     return(plan);
 }
 private void SetPlans()
 {
     SelectedPlan = null;
     Plans.Clear();
     foreach (var plan in SelectedCourse.PlanSetups)
     {
         Plans.Add(plan);
     }
 }
Esempio n. 7
0
        public void AddPlanningItem(PlanSetup ps)
        {
            string planType   = (ps is BrachyPlanSetup) ? "Brachytherapy" : "External Beam";
            string doseFormat = "0.00 " + ps.TotalDose.UnitAsString;
            string technique  = GetTechnique(ps);

            if (planType == "Brachytherapy" && technique != "HDR")
            {
                string message;
                if (technique.Length < 1)
                {
                    message = "This script does not support this type of plans.";
                }
                else
                {
                    message = string.Format("This script does not support {0} plans.", technique);
                }
                throw new ApplicationException(message);
            }

            double defaultAB = 10;
            double eqd2Dose  = CalculateEQ2Dose(ps, defaultAB);

            Table.Add(new Columns()
            {
                CourseID          = ps.Course.Id,
                PlanID            = ps.Id,
                PlanType          = planType,
                TargetVolumeID    = ps.TargetVolumeID,
                TargetAB          = defaultAB.ToString("0.00"),
                PrescPercentage   = (ps.TreatmentPercentage * 100).ToString() + "%",
                DosePerFraction   = ps.DosePerFraction.Dose.ToString(doseFormat),
                NumberOfFractions = ps.NumberOfFractions.ToString(),
                TotalDosePlanned  = ps.TotalDose.Dose.ToString(doseFormat),
                EQD2DosePlanned   = eqd2Dose.ToString(doseFormat)
            });
            Details.Add(new PlanDetails()
            {
                CourseID          = ps.Course.Id,
                PlanID            = "Plan ID: " + ps.Id,
                PlanType          = planType,
                TargetVolumeID    = ps.TargetVolumeID,
                TargetAB          = defaultAB.ToString(),
                PrescPercentage   = (ps.TreatmentPercentage * 100).ToString() + "%",
                DosePerFraction   = ps.DosePerFraction.Dose.ToString(doseFormat),
                NumberOfFractions = ps.NumberOfFractions.ToString(),
                TotalDosePlanned  = ps.TotalDose.Dose.ToString(doseFormat),
                EQD2DosePlanned   = eqd2Dose.ToString(doseFormat),
                Technique         = technique,
                Status            = ps.ApprovalStatus.ToString(),
                Modified          = ps.HistoryUserName,
                Date = ps.HistoryDateTime.ToString()
            });
            Plans.Add(new KeyValuePair <PlanSetup, double>(ps, defaultAB));

            TotalEQD2Dose = SumTotal().ToString(doseFormat);
        }
Esempio n. 8
0
        /// <summary>
        /// Creates a 3D plan.
        /// </summary>
        /// <param name="fftType">Type of FFT.</param>
        /// <param name="dataType">The data type.</param>
        /// <param name="nx">The x length in samples.</param>
        /// <param name="ny">The y length in samples.</param>
        /// <param name="nz">The z length in samples.</param>
        /// <param name="batch">The number of FFTs in batch.</param>
        /// <returns>
        /// Plan.
        /// </returns>
        public override FFTPlan3D Plan3D(eFFTType fftType, eDataType dataType, int nx, int ny, int nz, int batch = 1)
        {
            int       insize, outsize;
            int       totalSize = nx * ny * nz;
            CUFFTType cuFFTType = VerifyTypes(fftType, dataType, out insize, out outsize);
            //Console.WriteLine(size);
            IntPtr pin  = fftwf.malloc(totalSize * insize * batch);
            IntPtr pout = fftwf.malloc(totalSize * outsize * batch);

            Ifftw_plan fwdPlan;
            Ifftw_plan invPlan;

            if (dataType == eDataType.Single)
            {
                if (batch == 1)
                {
                    fwdPlan = fftwf_plan.dft_3d(fftType, nx, ny, nz, pin, pout, fftw_direction.Forward, fftw_flags.Estimate);
                    invPlan = fftwf_plan.dft_3d(fftType, nx, ny, nz, pin, pout, fftw_direction.Backward, fftw_flags.Estimate);
                }
                else
                {
                    fwdPlan = fftwf_plan.dft_many(fftType, 3, new int[] { nx, ny, nz }, batch,
                                                  pin, null, 1, nx * ny * nz,
                                                  pout, null, 1, nx * ny * nz, fftw_direction.Forward, fftw_flags.Estimate);
                    invPlan = fftwf_plan.dft_many(fftType, 3, new int[] { nx, ny, nz }, batch,
                                                  pin, null, 1, nx * ny * nz,
                                                  pout, null, 1, nx * ny * nz, fftw_direction.Backward, fftw_flags.Estimate);
                }
            }
            else
            {
                if (batch == 1)
                {
                    fwdPlan = fftw_plan.dft_3d(fftType, nx, ny, nz, pin, pout, fftw_direction.Forward, fftw_flags.Estimate);
                    invPlan = fftw_plan.dft_3d(fftType, nx, ny, nz, pin, pout, fftw_direction.Backward, fftw_flags.Estimate);
                }
                else
                {
                    fwdPlan = fftw_plan.dft_many(fftType, 3, new int[] { nx, ny, nz }, batch,
                                                 pin, null, 1, nx * ny * nz,
                                                 pout, null, 1, nx * ny * nz, fftw_direction.Forward, fftw_flags.Estimate);
                    invPlan = fftw_plan.dft_many(fftType, 3, new int[] { nx, ny, nz }, batch,
                                                 pin, null, 1, nx * ny * nz,
                                                 pout, null, 1, nx * ny * nz, fftw_direction.Backward, fftw_flags.Estimate);
                }
            }

            FFTPlan3D   plan   = new FFTPlan3D(nx, ny, nz, batch, this);
            FFTPlan3DEx planEx = new FFTPlan3DEx(plan)
            {
                FFTWFwdPlan = fwdPlan, FFTWInvPlan = invPlan, N = totalSize, DataType = dataType
            };

            Plans.Add(plan, planEx);
            return(plan);
        }
 private void ShowPlanInLabel(Plan plan)
 {
     if (Plans.Contains(plan))
     {
     }
     else
     {
         Plans.Add(plan);
     }
 }
Esempio n. 10
0
 private void GetPlans()
 {
     Plans.Clear();
     if (SelectedCourse != null)
     {
         foreach (var plan in SelectedCourse.PlanSetups)
         {
             Plans.Add(plan);
         }
     }
 }
Esempio n. 11
0
 private void FillPlans()
 {
     //Fills the list with plan Ids
     if (_ctx.PlansInScope == null)
     {
         return;
     }
     Plans.Clear();
     foreach (var plan in _ctx.PlansInScope)
     {
         Plans.Add(plan.Id);
     }
 }
        private async Task LoadPlansAsync()
        {
            try
            {
                GraphServiceClient graphClient = await GraphServiceHelper.GetGraphServiceClientAsync();

                if (graphClient != null)
                {
                    IPlannerUserPlansCollectionPage plans = await graphClient.Me.Planner.Plans.Request().GetAsync();

                    Plans.Clear();
                    while (true)
                    {
                        foreach (PlannerPlan plan in plans)
                        {
                            Plans.Add(plan);
                        }

                        if (plans.NextPageRequest == null)
                        {
                            break;
                        }

                        plans = await plans.NextPageRequest.GetAsync();
                    }

                    if (!string.Equals(InternalPlanId, PlanId))
                    {
                        InternalPlanId = PlanId;
                    }

                    if (Plans.Count > 0 &&
                        string.IsNullOrWhiteSpace(PlanId))
                    {
                        PlanId = Plans[0].Id;
                    }
                }
            }
            catch (Exception exception)
            {
                MessageDialog messageDialog = new MessageDialog(exception.Message);
                await messageDialog.ShowAsync();
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Creates a 1D plan.
        /// </summary>
        /// <param name="fftType">Type of FFT.</param>
        /// <param name="dataType">The data type.</param>
        /// <param name="nx">The length in samples.</param>
        /// <param name="batch">The number of FFTs in batch.</param>
        /// <param name="istride">The istride.</param>
        /// <param name="idist">The idist.</param>
        /// <param name="ostride">The ostride.</param>
        /// <param name="odist">The odist.</param>
        /// <returns>Plan.</returns>
        public override FFTPlan1D Plan1D(eFFTType fftType, eDataType dataType, int nx, int batch, int istride, int idist, int ostride, int odist)
        {
            int       insize, outsize;
            CUFFTType cuFFTType = VerifyTypes(fftType, dataType, out insize, out outsize);
            //Console.WriteLine(size);
            IntPtr pin  = fftwf.malloc(nx * insize * batch);
            IntPtr pout = fftwf.malloc(nx * outsize * batch);

            Ifftw_plan fwdPlan;
            Ifftw_plan invPlan;

            if (dataType == eDataType.Single)
            {
                fwdPlan = fftwf_plan.dft_many(fftType, 1, new int[] { nx }, batch,
                                              pin, null, istride, idist,
                                              pout, null, ostride, odist, fftw_direction.Forward, fftw_flags.Estimate);
                invPlan = fftwf_plan.dft_many(fftType, 1, new int[] { nx }, batch,
                                              pin, null, istride, idist,
                                              pout, null, ostride, odist, fftw_direction.Backward, fftw_flags.Estimate);
            }
            else
            {
                fwdPlan = fftw_plan.dft_many(fftType, 1, new int[] { nx }, batch,
                                             pin, null, istride, idist,
                                             pout, null, ostride, odist, fftw_direction.Forward, fftw_flags.Estimate);
                invPlan = fftw_plan.dft_many(fftType, 1, new int[] { nx }, batch,
                                             pin, null, istride, idist,
                                             pout, null, ostride, odist, fftw_direction.Backward, fftw_flags.Estimate);
            }

            FFTPlan1D   plan   = new FFTPlan1D(nx, batch, this);
            FFTPlan1DEx planEx = new FFTPlan1DEx(plan)
            {
                FFTWFwdPlan = fwdPlan, FFTWInvPlan = invPlan, N = nx, DataType = dataType
            };

            Plans.Add(plan, planEx);
            return(plan);
        }
Esempio n. 14
0
        public override FFTPlan1D Plan1D(eFFTType fftType, eDataType dataType, int nx, int batchSize, int istride, int idist, int ostride, int odist)
        {
            int         insize, outsize;
            CUFFTType   cuFFTType = VerifyTypes(fftType, dataType, out insize, out outsize);
            cufftHandle handle    = new cufftHandle();
            CUFFTResult res;

            if (batchSize <= 1)
            {
                res = _driver.cufftPlan1d(ref handle, nx, cuFFTType, batchSize);
            }
            else
            {
                res = _driver.cufftPlanMany(ref handle, 1, new int[] { nx },
                                            new int[] { idist }, //inembed
                                            istride,             //istride
                                            idist,               //idist
                                            new int[] { odist }, //onembed
                                            ostride,             //ostride
                                            odist,               //odist
                                            cuFFTType,
                                            batchSize);
            }

            if (res != CUFFTResult.Success)
            {
                throw new CudafyHostException(res.ToString());
            }
            FFTPlan1D   plan   = new FFTPlan1D(nx, batchSize, this);
            FFTPlan1DEx planEx = new FFTPlan1DEx(plan)
            {
                CudaFFTHandle = handle, CudaFFTType = cuFFTType, DataType = dataType
            };

            Plans.Add(plan, planEx);
            return(plan);
        }
Esempio n. 15
0
        public Plans GetPlans()
        {
            Plans plans = new Plans();

            try
            {
                using (SqlConnection conn = new SqlConnection(connString))
                    using (SqlCommand comm = new SqlCommand("usp_GetInstalmentSchedules", conn))
                    {
                        comm.CommandType = CommandType.StoredProcedure;

                        conn.Open();

                        using (SqlDataReader dr = comm.ExecuteReader())
                        {
                            while (dr.Read())
                            {
                                Plan p = new Plan();
                                p.PlanID               = dr["Plan ID"].ToString();
                                p.Description          = dr["Description"].ToString();
                                p.NoOfPayments         = Convert.ToInt32(dr["Number of Payments"].ToString());
                                p.DaysFromFirstPayment = Convert.ToInt32(dr["Days from first payment"].ToString());
                                p.Cadence              = Convert.ToInt32(dr["Cadence"].ToString());

                                plans.Add(p);
                            }
                        }
                    }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw;
            }
            return(plans);
        }
Esempio n. 16
0
 public void Add(Plan plan)
 {
     plan.Id = Plans.GetNewId();
     Plans.Add(plan);
     SortPlans();
 }
Esempio n. 17
0
        protected void FillSearchCriterias()
        {
            SortAscending = false;
            Countries.Clear();
            Groups.Clear();
            Genders.Clear();
            CalendarPrivacy.Clear();
            MeasurementPrivacy.Clear();
            Photos.Clear();
            Plans.Clear();
            SearchStatus = string.Empty;
            SortOrders.Clear();

            foreach (var test in Country.Countries)
            {
                CheckListItem <Country> item = new CheckListItem <Country>(test.DisplayName, test);
                Countries.Add(item);
            }

            foreach (UserSearchGroup test in Enum.GetValues(typeof(UserSearchGroup)))
            {
                var item = new CheckListItem <UserSearchGroup>(EnumLocalizer.Default.Translate(test), test);
                Groups.Add(item);
            }

            foreach (Gender test in Enum.GetValues(typeof(Gender)))
            {
                var item = new CheckListItem <Gender>(EnumLocalizer.Default.Translate(test), test);
                Genders.Add(item);
            }

            foreach (PrivacyCriteria test in Enum.GetValues(typeof(PrivacyCriteria)))
            {
                var item = new CheckListItem <PrivacyCriteria>(EnumLocalizer.Default.Translate(test), test);
                CalendarPrivacy.Add(item);
            }
            foreach (PrivacyCriteria test in Enum.GetValues(typeof(PrivacyCriteria)))
            {
                var item = new CheckListItem <PrivacyCriteria>(EnumLocalizer.Default.Translate(test), test);
                MeasurementPrivacy.Add(item);
            }

            foreach (UsersSortOrder test in Enum.GetValues(typeof(UsersSortOrder)))
            {
                var item = new CheckListItem <UsersSortOrder>(EnumLocalizer.Default.Translate(test), test);
                SortOrders.Add(item);
            }

            foreach (PictureCriteria test in Enum.GetValues(typeof(PictureCriteria)))
            {
                var item = new CheckListItem <PictureCriteria>(EnumLocalizer.Default.Translate(test), test);
                Photos.Add(item);
            }
            foreach (UserPlanCriteria test in Enum.GetValues(typeof(UserPlanCriteria)))
            {
                var item = new CheckListItem <UserPlanCriteria>(EnumLocalizer.Default.Translate(test), test);
                Plans.Add(item);
            }


            SelectedCalendarPrivacy    = PrivacyCriteria.All;
            SelectedMeasurementPrivacy = PrivacyCriteria.All;
            SelectedPhoto     = PictureCriteria.All;
            SelectedPlan      = UserPlanCriteria.All;
            SelectedSortOrder = UsersSortOrder.ByLastLoginDate;
        }
Esempio n. 18
0
 private void CreatePlan()
 {
     Plans.Add(new Plan("Unnamed Plan"));
 }
Esempio n. 19
0
 public void Create(Plan plan)
 {
     Plans.Add(plan);
     SaveChanges();
 }
Esempio n. 20
0
        public override void Update(PlanSnapshot.Changes changes)
        {
            foreach (var planNodeDo in changes.Delete)
            {
                PlanNodes.Remove(planNodeDo);

                if (planNodeDo is ActivityDO)
                {
                    ActivityRepository.Remove((ActivityDO)planNodeDo);
                }
                else if (planNodeDo is PlanDO)
                {
                    Plans.Remove((PlanDO)planNodeDo);
                }
                else if (planNodeDo is SubplanDO)
                {
                    SubPlans.Remove((SubplanDO)planNodeDo);
                }
            }

            foreach (var planNodeDo in changes.Insert)
            {
                var entity = planNodeDo.Clone();

                ClearNavigationProperties(entity);

                if (entity is ActivityDO)
                {
                    EncryptActivityCrateStorage((ActivityDO)entity);
                    ActivityRepository.Add((ActivityDO)entity);
                }
                else if (entity is PlanDO)
                {
                    Plans.Add((PlanDO)entity);
                }
                else if (entity is SubplanDO)
                {
                    SubPlans.Add((SubplanDO)entity);
                }
                else
                {
                    PlanNodes.Add(entity);
                }
            }

            foreach (var changedObject in changes.Update)
            {
                var    planNodeDo = changedObject.Node.Clone();
                object entity     = null;

                if (planNodeDo is ActivityDO)
                {
                    entity = ActivityRepository.GetByKey(planNodeDo.Id);
                    UpdateEncryptedActivityCrateStorage((ActivityDO)planNodeDo, changedObject);
                }
                else if (planNodeDo is PlanDO)
                {
                    entity = Plans.GetByKey(planNodeDo.Id);
                }
                else if (planNodeDo is SubplanDO)
                {
                    entity = SubPlans.GetByKey(planNodeDo.Id);
                }

                foreach (var changedProperty in changedObject.ChangedProperties)
                {
                    changedProperty.SetValue(entity, changedProperty.GetValue(planNodeDo));
                }
            }
        }