예제 #1
0
        ///<summary>
        /// Returns  first repetition of DSP (Display Data) - creates it if necessary
        ///</summary>
        public DSP GetDSP()
        {
            DSP ret = null;

            try {
                ret = (DSP)this.GetStructure("DSP");
            } catch (HL7Exception e) {
                HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
                throw new System.Exception("An unexpected error ocurred", e);
            }
            return(ret);
        }
예제 #2
0
		/// <summary> Returns  first repetition of DSP (DSP - display data segment) - creates it if necessary</summary>
		public virtual DSP getDSP()
		{
			DSP ret = null;
			try
			{
				ret = (DSP) this.get_Renamed("DSP");
			}
			catch (NuGenHL7Exception)
			{
				throw new Exception();
			}
			return ret;
		}
예제 #3
0
 private EqualizerBand(DSP dspParamEq, float centerValue, float gainValue, bool active)
 {
     this.dspEQ = dspParamEq;
     if (centerValue >= 1000)
     {
         this.BandCaption = string.Format("{0}K", (centerValue / 1000));
     }
     else
     {
         this.BandCaption = centerValue.ToString(CultureInfo.InvariantCulture);
     }
     this.gain     = gainValue;
     this.IsActive = active;
 }
예제 #4
0
    public AudioClip AutoTrim(AudioClip clip, float min)
    {
        float[] data = new float[clip.samples * clip.channels];
        clip.GetData(data, 0);
        float[] output = DSP.AutoTrim(data, min);

        //reaffectation
        //clip.SetData(output, 0);
        AudioClip c = AudioClip.Create("trim", data.Length, 1, samplerate, false, false);

        c.SetData(output, 0);
        data = null;
        return(c);
    }
예제 #5
0
        public void ActivateDSP(int index)
        {
            _dspIndex = index;
            var channel = new Channel();

            _dsp = new DSP();

            var dspc = new DSPConnection();

            CheckFMODErrors(_fmodSystem.getChannel(index, ref channel));
            CheckFMODErrors(_fmodSystem.createDSPByType(DSP_TYPE.PARAMEQ, ref _dsp));
            _dsp.setParameter((int)DSP_PARAMEQ.CENTER, 70);
            _dsp.setParameter((int)DSP_PARAMEQ.BANDWIDTH, 1.5f);
            CheckFMODErrors(channel.addDSP(_dsp, ref dspc));
        }
예제 #6
0
            public EqualizerBand(SoundSystem system, EqualizerParam param)
            {
                _dsp = system.CreateDspByType(Type.ParameQ);
                system.AddDSP(_dsp);

                Center    = param.Center;
                BandWidth = param.Bandwidth;
                Gain      = param.Gain;

                _dsp.Active = Active = true;

                Caption = param.Center < 1000
                    ? param.Center.ToString(CultureInfo.InvariantCulture)
                    : string.Format("{0}K", (param.Center / 1000));
            }
예제 #7
0
        public void PlayDSP(DSP dsp, bool paused, Channel.Channel chn)
        {
            IntPtr channel = chn.DangerousGetHandle();

            Code returnCode = PlayDSP(DangerousGetHandle(), Index.Reuse, dsp.DangerousGetHandle(), paused, ref channel);

            Errors.ThrowError(returnCode);

            //This can't really happend.
            //Check just in case...
            if (chn.DangerousGetHandle() != channel)
            {
                throw new Exception("Channel handle got changed by Fmod.");
            }
        }
예제 #8
0
        private void button_addFromDSP_Click(object sender, EventArgs e)
        {
            //DGV 0=BUTTON, 1=DRUG_ID, 2=DRUG_NAME, 3=DOSAGE, 4=UNIT
            PermissibleValueObjWithDelFlag subDrug = DSP.getSelectedSubDrug();
            DrugObj drug = DSP.getSelectedDrug();

            if (subDrug == null || subDrug.getValue().Split(new String[] { "||" }, StringSplitOptions.None)[1] == "0")
            {
                addDrugToDGV(drug);
            }
            else
            {
                addDrugToDGV(subDrug);
            }
        }
예제 #9
0
 public async Task <JsonResult> DspAwb([FromBody] DSP bin)
 {
     try
     {
         DataTable dt = _dspLogic.DspAwb(bin);
         if (dt.Rows.Count > 0)
         {
             return(new JsonResult(dt));
         }
         return(await _dspLogic.SendRespose("False", "No barcode Found").ConfigureAwait(false));
     }
     catch (Exception ee)
     {
         return(await _dspLogic.SendRespose("False", ee.Message).ConfigureAwait(false));
     }
 }
예제 #10
0
    public static void Main()
    {
        int[,] graph = new int[, ] {
            { 0, 4, 0, 0, 0, 0, 0, 8, 0 },
            { 4, 0, 8, 0, 0, 0, 0, 11, 0 },
            { 0, 8, 0, 7, 0, 4, 0, 0, 2 },
            { 0, 0, 7, 0, 9, 14, 0, 0, 0 },
            { 0, 0, 0, 9, 0, 10, 0, 0, 0 },
            { 0, 0, 4, 14, 10, 0, 2, 0, 0 },
            { 0, 0, 0, 0, 0, 2, 0, 1, 6 },
            { 8, 11, 0, 0, 0, 0, 1, 0, 7 },
            { 0, 0, 2, 0, 0, 0, 6, 7, 0 }
        };
        DSP t = new DSP();

        t.dijkstra(graph, 0);
    }
예제 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filePath"></param>
        public static DSP FromFile(string filePath)
        {
            var format = Path.GetExtension(filePath);

            format = format.Replace(".", "").ToLower();

            var dsp = new DSP();

            switch (format)
            {
            case "dsp":
            case "hps":
            case "wav":
                dsp = new DSP(filePath);
                break;

            case "brstm":
                dsp.FromBRSTM(filePath);
                break;

            case "mp3":
                dsp.FromMP3(File.ReadAllBytes(filePath));
                break;

            case "aiff":
                dsp.FromAIFF(File.ReadAllBytes(filePath));
                break;

            case "wma":
                dsp.FromWMA(File.ReadAllBytes(filePath));
                break;

            case "m4a":
                dsp.FromM4A(File.ReadAllBytes(filePath));
                break;
            }

            using (var d = new SoundEditorDialog())
            {
                d.SetSound(dsp);

                d.ShowDialog();
            }

            return(dsp);
        }
예제 #12
0
 public PrescriptionPanel()
 {
     InitializeComponent();
     DSP.setSubDrugEnabled(true);
     DSP.setShowDeletedItemCB(false);
     DSP.setShowDeletedItem(false);
     DSP.setSubDrugInclNotSpecified(true);
     DSP.setSubDrugSelectionEnabled(true);
     DSP.refresh();
     units   = drugMgr.getDosageUnitForDrug();
     methods = drugMgr.getPrepMethod();
     drugMgr.setPredefPresCB(comboBox_existingPredefPres, isInclDeletedPredefPres);
     if (comboBox_existingPredefPres.Items.Count > 0)
     {
         comboBox_existingPredefPres.SelectedIndex = 0;
     }
 }
        public static void Init()
        {
            _fmodSystem = Fmod.CreateSystem();
            _fmodSystem.Init(32);

            _basePlugin = _fmodSystem.LoadPlugin("resonanceaudio.dll");

            _listenerPlugin = _fmodSystem.GetNestedPlugin(_basePlugin, 0);
            _listenerDSP = _fmodSystem.CreateDSPByPlugin(_listenerPlugin);
            _soundFieldPlugin = _fmodSystem.GetNestedPlugin(_basePlugin, 1);
            _sourcePlugin = _fmodSystem.GetNestedPlugin(_basePlugin, 2);

            _masterChannelGroup = _fmodSystem.MasterChannelGroup;
            _spatialChannelGroup = _fmodSystem.CreateChannelGroup("spatial");
            _masterChannelGroup.AddGroup(_spatialChannelGroup, false);

            _masterChannelGroup.AddDSP(ChannelControlDSPIndex.DspHead, _listenerDSP);
        }
예제 #14
0
 public ConfigWindow CreateConfigWindow(DSP parent)
 {
     switch(parent.Type)
     {
         case DSPType.PitchShiftPV:
             return new ConfigPitchShiftPV((PitchShiftPV)parent);
         case DSPType.PitchShiftTDSOLA:
             return new ConfigPitchShiftTDSOLA((PitchShiftTDSOLA)parent);
         case DSPType.HighPassFilter:
             return new ConfigHighPassFilter((HighPassFilter)parent);
         case DSPType.BandPassFilter:
             return new ConfigBandPassFilter((BandPassFilter)parent);
         case DSPType.Butterworth1stLPF:
             return new ConfigButterworth1stLPF((Butterworth1stLPF)parent);
         default:
             return new ConfigWindow(parent);
     }
 }
예제 #15
0
        public void Update(object sender, DSP.FFTCalculatedEventArgs e)
        {
            if (!ValidateTimer())
                return;

            double[] values = new double[e.Data.Length];
            for (int i = 0; i < e.Data.Length; i++)
            {
                values[i] = e.Data[i].CalculateFFTPercentage();
            }

            Dispatcher.BeginInvoke(new Action(() =>
            {
                if (_mutex.WaitOne(10) == false)
                    return;
                OnUpdate(values);
                _mutex.ReleaseMutex();
            })/*, System.Windows.Threading.DispatcherPriority.Render*/);
        }
예제 #16
0
        internal async Task <JsonResult> CreateUpdateDSP(DSP dsp)
        {
            SqlConnection cn = null;

            try
            {
                cn = Connection.GetConnection();
                SqlCommand smd = new SqlCommand("dsp_create_or_update", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };
                smd.Parameters.AddWithValue("@address", dsp.Address);
                smd.Parameters.AddWithValue("@api_url", dsp.APIUrl);
                smd.Parameters.AddWithValue("@country", dsp.Country);
                smd.Parameters.AddWithValue("@description", dsp.Description);
                smd.Parameters.AddWithValue("@dsp_code", dsp.DSPCode);
                smd.Parameters.AddWithValue("@flag", dsp.Flag);
                smd.Parameters.AddWithValue("@gst_no", dsp.GSTNo);
                smd.Parameters.AddWithValue("@location_id", dsp.LocationId);
                smd.Parameters.AddWithValue("@state", dsp.State);
                smd.Parameters.Add("@jsonOutput", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output;

                // Execute the command
                await smd.ExecuteNonQueryAsync().ConfigureAwait(false);

                // Get the values
                string json = smd.Parameters["@jsonOutput"].Value.ToString();
                smd.Dispose();

                JArray arr = JArray.Parse(json);

                return(new JsonResult(arr));
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Connection.CloseConnection(ref cn);
            }
        }
예제 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceButton_Click(object sender, System.EventArgs e)
        {
            if (mxListBox1.SelectedItem is MEXMusic music)
            {
                using (OpenFileDialog d = new OpenFileDialog())
                {
                    d.Filter = DSP.SupportedImportFilter;

                    if (d.ShowDialog() == DialogResult.OK)
                    {
                        var temp = Path.GetTempFileName();

                        var dsp = new DSP(d.FileName);
                        HPS.SaveDSPAsHPS(dsp, temp);

                        MEX.ImageResource.AddFile("audio\\" + music.FileName, temp);
                    }
                }
            }
        }
예제 #18
0
    // Use this for initialization
    void Awake()
    {
        AudioSource audio = GetComponent <AudioSource>();

        if (audio)
        {
            int samplecount = (int)(samplerate * duration);
            if (audio.clip == null)
            {
                audio.clip = AudioClip.Create("NAAudioSynthNoise", samplecount, 1, samplerate, false);
            }
            float[] data = new float[samplecount];
            audio.clip.GetData(data, 0);
            DSP.GenerateNoise(data);
            audio.clip.SetData(data, 0);
            audio.Play();
        }

        Debug.Log("Generate noise");
    }
    public void Generate()
    {
        AudioSource audio = target;        //GetComponent<AudioSource>();

        if (audio && audioClip1 && audioClip2)
        {
            pos1 = Mathf.Clamp(pos1, 0, 1);
            pos2 = Mathf.Clamp(pos2, 0, 1);
            float[] data1 = DSP.Extract(audioClip1, pos1, duration1);
            float[] data2 = DSP.Extract(audioClip2, pos2, duration2);
            //convolve
            //float[] convolved = DSP.Convolve(data1, data2);
            float[] convolved = DSP.Add(data1, data2);

            int source_samplerate = audioClip1.frequency;
            audio.clip = AudioClip.Create("NAAudioSynthConvolutionLooper", convolved.Length, 1, source_samplerate, false);
            audio.clip.SetData(convolved, 0);
            audio.loop = true;
            audio.Play();
        }
    }
예제 #20
0
파일: DSP.cs 프로젝트: asophy/MyMusic
    public Vector4[] Read(List <Note> ptn, float stepLength, Vector4[] bd, AudioContext ac)
    {
        Vector4[] data = new Vector4[ac.length];
        //float[] beatphase = beatPh.Read(ac.clock.BPM/60.0,ac);
        //float[] oscphase = oscPh.Read((double)freq, ac);



        for (int n = 0; n < data.Length; n += ac.channels)
        {
            float barpos = (float)ac.clock.readCache(n);

            float loopphase = (float)Clock.Phase(barpos, 2.0);



            var ptnphase = Pattern.Read(ptn, barpos);
            var trigP    = ptnphase.phase;
            var note     = ptnphase.note;
            var scale    = Note.NotenumToScale(note.noteNum, ac);
            var pitch    = Note.ScaleToFreq(scale, ac);

            float envA = (float)DSP.Env(0.001f, 0.999f, 1, trigP, ac);
            float envF = (float)DSP.Env(0.001f, 0.4f, 2, trigP, ac) * 0.7f + 0.01f;
            envA *= (1 - bd[n].z); //side chain

            var osc = Read((float)pitch, ac);
            var fed = filter.read(osc, envF, 0.8, ac);
            // float s = Sine(oscPh.read(freq, ac), ac) * amp * sawsq;
            float o = ((float)fed) * envA;

            for (int i = 0; i < ac.channels; i++)
            {
                data[n + i] = new Vector4(o, envA, (float)scale, loopphase);
            }
        }
        return(data);
    }
예제 #21
0
        public ConfigWindow CreateConfigWindow(DSP parent)
        {
            switch (parent.Type)
            {
            case DSPType.PitchShiftPV:
                return(new ConfigPitchShiftPV((PitchShiftPV)parent));

            case DSPType.PitchShiftTDSOLA:
                return(new ConfigPitchShiftTDSOLA((PitchShiftTDSOLA)parent));

            case DSPType.HighPassFilter:
                return(new ConfigHighPassFilter((HighPassFilter)parent));

            case DSPType.BandPassFilter:
                return(new ConfigBandPassFilter((BandPassFilter)parent));

            case DSPType.Butterworth1stLPF:
                return(new ConfigButterworth1stLPF((Butterworth1stLPF)parent));

            default:
                return(new ConfigWindow(parent));
            }
        }
예제 #22
0
        internal async Task <JsonResult> UploadAWB(DSP dspawbno)
        {
            SqlConnection cn = null;

            try
            {
                cn = Connection.GetConnection();
                SqlCommand smd = new SqlCommand("dsp_awb_upload", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };
                smd.Parameters.AddWithValue("@dsp_code", dspawbno.DSPCode);
                smd.Parameters.AddWithValue("@location_id", dspawbno.LocationId);
                smd.Parameters.AddWithValue("@payment_type", dspawbno.PaymentType);
                smd.Parameters.AddWithValue("@awb_no", ToDataTable(dspawbno.AWBNo));
                smd.Parameters.Add("@jsonOutput", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output;

                // Execute the command
                await smd.ExecuteNonQueryAsync().ConfigureAwait(false);

                // Get the values
                string json = smd.Parameters["@jsonOutput"].Value.ToString();
                smd.Dispose();

                JArray arr = JArray.Parse(json);

                return(new JsonResult(arr));
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Connection.CloseConnection(ref cn);
            }
        }
예제 #23
0
        /// <summary>
        /// Constructs an HL7 segment for the specified Segments enum object
        /// </summary>
        /// <param name="seg">The Segments enum object to construct for</param>
        public Segment(Segments seg)
        {
            switch (seg)
            {
            case Segments.ABS:
                ABS abs = new ABS();
                Name        = abs.Name;
                Description = abs.Description;
                Fields      = abs.Fields;
                break;

            case Segments.ACC:
                ACC acc = new ACC();
                Name        = acc.Name;
                Description = acc.Description;
                Fields      = acc.Fields;
                break;

            case Segments.ADD:
                ADD add = new ADD();
                Name        = add.Name;
                Description = add.Description;
                Fields      = add.Fields;
                break;

            case Segments.AFF:
                AFF aff = new AFF();
                Name        = aff.Name;
                Description = aff.Description;
                Fields      = aff.Fields;
                break;

            case Segments.AIG:
                AIG aig = new AIG();
                Name        = aig.Name;
                Description = aig.Description;
                Fields      = aig.Fields;
                break;

            case Segments.AIL:
                AIL ail = new AIL();
                Name        = ail.Name;
                Description = ail.Description;
                Fields      = ail.Fields;
                break;

            case Segments.AIP:
                AIP aip = new AIP();
                Name        = aip.Name;
                Description = aip.Description;
                Fields      = aip.Fields;
                break;

            case Segments.AIS:
                AIS ais = new AIS();
                Name        = ais.Name;
                Description = ais.Description;
                Fields      = ais.Fields;
                break;

            case Segments.AL1:
                AL1 al1 = new AL1();
                Name        = al1.Name;
                Description = al1.Description;
                Fields      = al1.Fields;
                break;

            case Segments.APR:
                APR apr = new APR();
                Name        = apr.Name;
                Description = apr.Description;
                Fields      = apr.Fields;
                break;

            case Segments.ARQ:
                ARQ arq = new ARQ();
                Name        = arq.Name;
                Description = arq.Description;
                Fields      = arq.Fields;
                break;

            case Segments.AUT:
                AUT aut = new AUT();
                Name        = aut.Name;
                Description = aut.Description;
                Fields      = aut.Fields;
                break;

            case Segments.BHS:
                BHS bhs = new BHS();
                Name        = bhs.Name;
                Description = bhs.Description;
                Fields      = bhs.Fields;
                break;

            case Segments.BLC:
                BLC blc = new BLC();
                Name        = blc.Name;
                Description = blc.Description;
                Fields      = blc.Fields;
                break;

            case Segments.BLG:
                BLG blg = new BLG();
                Name        = blg.Name;
                Description = blg.Description;
                Fields      = blg.Fields;
                break;

            case Segments.BPO:
                BPO bpo = new BPO();
                Name        = bpo.Name;
                Description = bpo.Description;
                Fields      = bpo.Fields;
                break;

            case Segments.BPX:
                BPX bpx = new BPX();
                Name        = bpx.Name;
                Description = bpx.Description;
                Fields      = bpx.Fields;
                break;

            case Segments.BTS:
                BTS bts = new BTS();
                Name        = bts.Name;
                Description = bts.Description;
                Fields      = bts.Fields;
                break;

            case Segments.BTX:
                BTX btx = new BTX();
                Name        = btx.Name;
                Description = btx.Description;
                Fields      = btx.Fields;
                break;

            case Segments.CDM:
                CDM cdm = new CDM();
                Name        = cdm.Name;
                Description = cdm.Description;
                Fields      = cdm.Fields;
                break;

            case Segments.CER:
                CER cer = new CER();
                Name        = cer.Name;
                Description = cer.Description;
                Fields      = cer.Fields;
                break;

            case Segments.CM0:
                CM0 cm0 = new CM0();
                Name        = cm0.Name;
                Description = cm0.Description;
                Fields      = cm0.Fields;
                break;

            case Segments.CM1:
                CM1 cm1 = new CM1();
                Name        = cm1.Name;
                Description = cm1.Description;
                Fields      = cm1.Fields;
                break;

            case Segments.CM2:
                CM2 cm2 = new CM2();
                Name        = cm2.Name;
                Description = cm2.Description;
                Fields      = cm2.Fields;
                break;

            case Segments.CNS:
                CNS cns = new CNS();
                Name        = cns.Name;
                Description = cns.Description;
                Fields      = cns.Fields;
                break;

            case Segments.CON:
                CON con = new CON();
                Name        = con.Name;
                Description = con.Description;
                Fields      = con.Fields;
                break;

            case Segments.CSP:
                CSP csp = new CSP();
                Name        = csp.Name;
                Description = csp.Description;
                Fields      = csp.Fields;
                break;

            case Segments.CSR:
                CSR csr = new CSR();
                Name        = csr.Name;
                Description = csr.Description;
                Fields      = csr.Fields;
                break;

            case Segments.CSS:
                CSS css = new CSS();
                Name        = css.Name;
                Description = css.Description;
                Fields      = css.Fields;
                break;

            case Segments.CTD:
                CTD ctd = new CTD();
                Name        = ctd.Name;
                Description = ctd.Description;
                Fields      = ctd.Fields;
                break;

            case Segments.CTI:
                CTI cti = new CTI();
                Name        = cti.Name;
                Description = cti.Description;
                Fields      = cti.Fields;
                break;

            case Segments.DB1:
                DB1 db1 = new DB1();
                Name        = db1.Name;
                Description = db1.Description;
                Fields      = db1.Fields;
                break;

            case Segments.DG1:
                DG1 dg1 = new DG1();
                Name        = dg1.Name;
                Description = dg1.Description;
                Fields      = dg1.Fields;
                break;

            case Segments.DRG:
                DRG drg = new DRG();
                Name        = drg.Name;
                Description = drg.Description;
                Fields      = drg.Fields;
                break;

            case Segments.DSC:
                DSC dsc = new DSC();
                Name        = dsc.Name;
                Description = dsc.Description;
                Fields      = dsc.Fields;
                break;

            case Segments.DSP:
                DSP dsp = new DSP();
                Name        = dsp.Name;
                Description = dsp.Description;
                Fields      = dsp.Fields;
                break;

            case Segments.ECD:
                ECD ecd = new ECD();
                Name        = ecd.Name;
                Description = ecd.Description;
                Fields      = ecd.Fields;
                break;

            case Segments.ECR:
                ECR ecr = new ECR();
                Name        = ecr.Name;
                Description = ecr.Description;
                Fields      = ecr.Fields;
                break;

            case Segments.EDU:
                EDU edu = new EDU();
                Name        = edu.Name;
                Description = edu.Description;
                Fields      = edu.Fields;
                break;

            case Segments.EQL:
                EQL eql = new EQL();
                Name        = eql.Name;
                Description = eql.Description;
                Fields      = eql.Fields;
                break;

            case Segments.EQP:
                EQP eqp = new EQP();
                Name        = eqp.Name;
                Description = eqp.Description;
                Fields      = eqp.Fields;
                break;

            case Segments.EQU:
                EQU equ = new EQU();
                Name        = equ.Name;
                Description = equ.Description;
                Fields      = equ.Fields;
                break;

            case Segments.ERQ:
                ERQ erq = new ERQ();
                Name        = erq.Name;
                Description = erq.Description;
                Fields      = erq.Fields;
                break;

            case Segments.ERR:
                ERR err = new ERR();
                Name        = err.Name;
                Description = err.Description;
                Fields      = err.Fields;
                break;

            case Segments.EVN:
                EVN evn = new EVN();
                Name        = evn.Name;
                Description = evn.Description;
                Fields      = evn.Fields;
                break;

            case Segments.FAC:
                FAC fac = new FAC();
                Name        = fac.Name;
                Description = fac.Description;
                Fields      = fac.Fields;
                break;

            case Segments.FHS:
                FHS fhs = new FHS();
                Name        = fhs.Name;
                Description = fhs.Description;
                Fields      = fhs.Fields;
                break;

            case Segments.FT1:
                FT1 ft1 = new FT1();
                Name        = ft1.Name;
                Description = ft1.Description;
                Fields      = ft1.Fields;
                break;

            case Segments.FTS:
                FTS fts = new FTS();
                Name        = fts.Name;
                Description = fts.Description;
                Fields      = fts.Fields;
                break;

            case Segments.GOL:
                GOL gol = new GOL();
                Name        = gol.Name;
                Description = gol.Description;
                Fields      = gol.Fields;
                break;

            case Segments.GP1:
                GP1 gp1 = new GP1();
                Name        = gp1.Name;
                Description = gp1.Description;
                Fields      = gp1.Fields;
                break;

            case Segments.GP2:
                GP2 gp2 = new GP2();
                Name        = gp2.Name;
                Description = gp2.Description;
                Fields      = gp2.Fields;
                break;

            case Segments.GT1:
                GT1 gt1 = new GT1();
                Name        = gt1.Name;
                Description = gt1.Description;
                Fields      = gt1.Fields;
                break;

            case Segments.IAM:
                IAM iam = new IAM();
                Name        = iam.Name;
                Description = iam.Description;
                Fields      = iam.Fields;
                break;

            case Segments.IIM:
                IIM iim = new IIM();
                Name        = iim.Name;
                Description = iim.Description;
                Fields      = iim.Fields;
                break;

            case Segments.IN1:
                IN1 in1 = new IN1();
                Name        = in1.Name;
                Description = in1.Description;
                Fields      = in1.Fields;
                break;

            case Segments.IN2:
                IN2 in2 = new IN2();
                Name        = in2.Name;
                Description = in2.Description;
                Fields      = in2.Fields;
                break;

            case Segments.IN3:
                IN3 in3 = new IN3();
                Name        = in3.Name;
                Description = in3.Description;
                Fields      = in3.Fields;
                break;

            case Segments.INV:
                INV inv = new INV();
                Name        = inv.Name;
                Description = inv.Description;
                Fields      = inv.Fields;
                break;

            case Segments.IPC:
                IPC ipc = new IPC();
                Name        = ipc.Name;
                Description = ipc.Description;
                Fields      = ipc.Fields;
                break;

            case Segments.ISD:
                ISD isd = new ISD();
                Name        = isd.Name;
                Description = isd.Description;
                Fields      = isd.Fields;
                break;

            case Segments.LAN:
                LAN lan = new LAN();
                Name        = lan.Name;
                Description = lan.Description;
                Fields      = lan.Fields;
                break;

            case Segments.LCC:
                LCC lcc = new LCC();
                Name        = lcc.Name;
                Description = lcc.Description;
                Fields      = lcc.Fields;
                break;

            case Segments.LCH:
                LCH lch = new LCH();
                Name        = lch.Name;
                Description = lch.Description;
                Fields      = lch.Fields;
                break;

            case Segments.LDP:
                LDP ldp = new LDP();
                Name        = ldp.Name;
                Description = ldp.Description;
                Fields      = ldp.Fields;
                break;

            case Segments.LOC:
                LOC loc = new LOC();
                Name        = loc.Name;
                Description = loc.Description;
                Fields      = loc.Fields;
                break;

            case Segments.LRL:
                LRL lrl = new LRL();
                Name        = lrl.Name;
                Description = lrl.Description;
                Fields      = lrl.Fields;
                break;

            case Segments.MFA:
                MFA mfa = new MFA();
                Name        = mfa.Name;
                Description = mfa.Description;
                Fields      = mfa.Fields;
                break;

            case Segments.MFE:
                MFE mfe = new MFE();
                Name        = mfe.Name;
                Description = mfe.Description;
                Fields      = mfe.Fields;
                break;

            case Segments.MFI:
                MFI mfi = new MFI();
                Name        = mfi.Name;
                Description = mfi.Description;
                Fields      = mfi.Fields;
                break;

            case Segments.MRG:
                MRG mrg = new MRG();
                Name        = mrg.Name;
                Description = mrg.Description;
                Fields      = mrg.Fields;
                break;

            case Segments.MSA:
                MSA msa = new MSA();
                Name        = msa.Name;
                Description = msa.Description;
                Fields      = msa.Fields;
                break;

            case Segments.MSH:
                MSH msh = new MSH();
                Name        = msh.Name;
                Description = msh.Description;
                Fields      = msh.Fields;
                break;

            case Segments.NCK:
                NCK nck = new NCK();
                Name        = nck.Name;
                Description = nck.Description;
                Fields      = nck.Fields;
                break;

            case Segments.NDS:
                NDS nds = new NDS();
                Name        = nds.Name;
                Description = nds.Description;
                Fields      = nds.Fields;
                break;

            case Segments.NK1:
                NK1 nk1 = new NK1();
                Name        = nk1.Name;
                Description = nk1.Description;
                Fields      = nk1.Fields;
                break;

            case Segments.NPU:
                NPU npu = new NPU();
                Name        = npu.Name;
                Description = npu.Description;
                Fields      = npu.Fields;
                break;

            case Segments.NSC:
                NSC nsc = new NSC();
                Name        = nsc.Name;
                Description = nsc.Description;
                Fields      = nsc.Fields;
                break;

            case Segments.NST:
                NST nst = new NST();
                Name        = nst.Name;
                Description = nst.Description;
                Fields      = nst.Fields;
                break;

            case Segments.NTE:
                NTE nte = new NTE();
                Name        = nte.Name;
                Description = nte.Description;
                Fields      = nte.Fields;
                break;

            case Segments.OBR:
                OBR obr = new OBR();
                Name        = obr.Name;
                Description = obr.Description;
                Fields      = obr.Fields;
                break;

            case Segments.OBX:
                OBX obx = new OBX();
                Name        = obx.Name;
                Description = obx.Description;
                Fields      = obx.Fields;
                break;

            case Segments.ODS:
                ODS ods = new ODS();
                Name        = ods.Name;
                Description = ods.Description;
                Fields      = ods.Fields;
                break;

            case Segments.ODT:
                ODT odt = new ODT();
                Name        = odt.Name;
                Description = odt.Description;
                Fields      = odt.Fields;
                break;

            case Segments.OM1:
                OM1 om1 = new OM1();
                Name        = om1.Name;
                Description = om1.Description;
                Fields      = om1.Fields;
                break;

            case Segments.OM2:
                OM2 om2 = new OM2();
                Name        = om2.Name;
                Description = om2.Description;
                Fields      = om2.Fields;
                break;

            case Segments.OM3:
                OM3 om3 = new OM3();
                Name        = om3.Name;
                Description = om3.Description;
                Fields      = om3.Fields;
                break;

            case Segments.OM4:
                OM4 om4 = new OM4();
                Name        = om4.Name;
                Description = om4.Description;
                Fields      = om4.Fields;
                break;

            case Segments.OM5:
                OM5 om5 = new OM5();
                Name        = om5.Name;
                Description = om5.Description;
                Fields      = om5.Fields;
                break;

            case Segments.OM6:
                OM6 om6 = new OM6();
                Name        = om6.Name;
                Description = om6.Description;
                Fields      = om6.Fields;
                break;

            case Segments.OM7:
                OM7 om7 = new OM7();
                Name        = om7.Name;
                Description = om7.Description;
                Fields      = om7.Fields;
                break;

            case Segments.ORC:
                ORC orc = new ORC();
                Name        = orc.Name;
                Description = orc.Description;
                Fields      = orc.Fields;
                break;

            case Segments.ORG:
                ORG org = new ORG();
                Name        = org.Name;
                Description = org.Description;
                Fields      = org.Fields;
                break;

            case Segments.OVR:
                OVR ovr = new OVR();
                Name        = ovr.Name;
                Description = ovr.Description;
                Fields      = ovr.Fields;
                break;

            case Segments.PCR:
                PCR pcr = new PCR();
                Name        = pcr.Name;
                Description = pcr.Description;
                Fields      = pcr.Fields;
                break;

            case Segments.PD1:
                PD1 pd1 = new PD1();
                Name        = pd1.Name;
                Description = pd1.Description;
                Fields      = pd1.Fields;
                break;

            case Segments.PDA:
                PDA pda = new PDA();
                Name        = pda.Name;
                Description = pda.Description;
                Fields      = pda.Fields;
                break;

            case Segments.PDC:
                PDC pdc = new PDC();
                Name        = pdc.Name;
                Description = pdc.Description;
                Fields      = pdc.Fields;
                break;

            case Segments.PEO:
                PEO peo = new PEO();
                Name        = peo.Name;
                Description = peo.Description;
                Fields      = peo.Fields;
                break;

            case Segments.PES:
                PES pes = new PES();
                Name        = pes.Name;
                Description = pes.Description;
                Fields      = pes.Fields;
                break;

            case Segments.PID:
                PID pid = new PID();
                Name        = pid.Name;
                Description = pid.Description;
                Fields      = pid.Fields;
                break;

            case Segments.PR1:
                PR1 pr1 = new PR1();
                Name        = pr1.Name;
                Description = pr1.Description;
                Fields      = pr1.Fields;
                break;

            case Segments.PRA:
                PRA pra = new PRA();
                Name        = pra.Name;
                Description = pra.Description;
                Fields      = pra.Fields;
                break;

            case Segments.PRB:
                PRB prb = new PRB();
                Name        = prb.Name;
                Description = prb.Description;
                Fields      = prb.Fields;
                break;

            case Segments.PRC:
                PRC prc = new PRC();
                Name        = prc.Name;
                Description = prc.Description;
                Fields      = prc.Fields;
                break;

            case Segments.PRD:
                PRD prd = new PRD();
                Name        = prd.Name;
                Description = prd.Description;
                Fields      = prd.Fields;
                break;

            case Segments.PSH:
                PSH psh = new PSH();
                Name        = psh.Name;
                Description = psh.Description;
                Fields      = psh.Fields;
                break;

            case Segments.PTH:
                PTH pth = new PTH();
                Name        = pth.Name;
                Description = pth.Description;
                Fields      = pth.Fields;
                break;

            case Segments.PV1:
                PV1 pv1 = new PV1();
                Name        = pv1.Name;
                Description = pv1.Description;
                Fields      = pv1.Fields;
                break;

            case Segments.PV2:
                PV2 pv2 = new PV2();
                Name        = pv2.Name;
                Description = pv2.Description;
                Fields      = pv2.Fields;
                break;

            case Segments.QAK:
                QAK qak = new QAK();
                Name        = qak.Name;
                Description = qak.Description;
                Fields      = qak.Fields;
                break;

            case Segments.QID:
                QID qid = new QID();
                Name        = qid.Name;
                Description = qid.Description;
                Fields      = qid.Fields;
                break;

            case Segments.QPD:
                QPD qpd = new QPD();
                Name        = qpd.Name;
                Description = qpd.Description;
                Fields      = qpd.Fields;
                break;

            case Segments.QRD:
                QRD qrd = new QRD();
                Name        = qrd.Name;
                Description = qrd.Description;
                Fields      = qrd.Fields;
                break;

            case Segments.QRF:
                QRF qrf = new QRF();
                Name        = qrf.Name;
                Description = qrf.Description;
                Fields      = qrf.Fields;
                break;

            case Segments.QRI:
                QRI qri = new QRI();
                Name        = qri.Name;
                Description = qri.Description;
                Fields      = qri.Fields;
                break;

            case Segments.RCP:
                RCP rcp = new RCP();
                Name        = rcp.Name;
                Description = rcp.Description;
                Fields      = rcp.Fields;
                break;

            case Segments.RDF:
                RDF rdf = new RDF();
                Name        = rdf.Name;
                Description = rdf.Description;
                Fields      = rdf.Fields;
                break;

            case Segments.RF1:
                RF1 rf1 = new RF1();
                Name        = rf1.Name;
                Description = rf1.Description;
                Fields      = rf1.Fields;
                break;

            case Segments.RGS:
                RGS rgs = new RGS();
                Name        = rgs.Name;
                Description = rgs.Description;
                Fields      = rgs.Fields;
                break;

            case Segments.RMI:
                RMI rmi = new RMI();
                Name        = rmi.Name;
                Description = rmi.Description;
                Fields      = rmi.Fields;
                break;

            case Segments.ROL:
                ROL rol = new ROL();
                Name        = rol.Name;
                Description = rol.Description;
                Fields      = rol.Fields;
                break;

            case Segments.RQ1:
                RQ1 rq1 = new RQ1();
                Name        = rq1.Name;
                Description = rq1.Description;
                Fields      = rq1.Fields;
                break;

            case Segments.RQD:
                RQD rqd = new RQD();
                Name        = rqd.Name;
                Description = rqd.Description;
                Fields      = rqd.Fields;
                break;

            case Segments.RXA:
                RXA rxa = new RXA();
                Name        = rxa.Name;
                Description = rxa.Description;
                Fields      = rxa.Fields;
                break;

            case Segments.RXC:
                RXC rxc = new RXC();
                Name        = rxc.Name;
                Description = rxc.Description;
                Fields      = rxc.Fields;
                break;

            case Segments.RXD:
                RXD rxd = new RXD();
                Name        = rxd.Name;
                Description = rxd.Description;
                Fields      = rxd.Fields;
                break;

            case Segments.RXE:
                RXE rxe = new RXE();
                Name        = rxe.Name;
                Description = rxe.Description;
                Fields      = rxe.Fields;
                break;

            case Segments.RXG:
                RXG rxg = new RXG();
                Name        = rxg.Name;
                Description = rxg.Description;
                Fields      = rxg.Fields;
                break;

            case Segments.RXO:
                RXO rxo = new RXO();
                Name        = rxo.Name;
                Description = rxo.Description;
                Fields      = rxo.Fields;
                break;

            case Segments.RXR:
                RXR rxr = new RXR();
                Name        = rxr.Name;
                Description = rxr.Description;
                Fields      = rxr.Fields;
                break;

            case Segments.SAC:
                SAC sac = new SAC();
                Name        = sac.Name;
                Description = sac.Description;
                Fields      = sac.Fields;
                break;

            case Segments.SCH:
                SCH sch = new SCH();
                Name        = sch.Name;
                Description = sch.Description;
                Fields      = sch.Fields;
                break;

            case Segments.SFT:
                SFT sft = new SFT();
                Name        = sft.Name;
                Description = sft.Description;
                Fields      = sft.Fields;
                break;

            case Segments.SID:
                SID sid = new SID();
                Name        = sid.Name;
                Description = sid.Description;
                Fields      = sid.Fields;
                break;

            case Segments.SPM:
                SPM spm = new SPM();
                Name        = spm.Name;
                Description = spm.Description;
                Fields      = spm.Fields;
                break;

            case Segments.SPR:
                SPR spr = new SPR();
                Name        = spr.Name;
                Description = spr.Description;
                Fields      = spr.Fields;
                break;

            case Segments.STF:
                STF stf = new STF();
                Name        = stf.Name;
                Description = stf.Description;
                Fields      = stf.Fields;
                break;

            case Segments.TCC:
                TCC tcc = new TCC();
                Name        = tcc.Name;
                Description = tcc.Description;
                Fields      = tcc.Fields;
                break;

            case Segments.TCD:
                TCD tcd = new TCD();
                Name        = tcd.Name;
                Description = tcd.Description;
                Fields      = tcd.Fields;
                break;

            case Segments.TQ1:
                TQ1 tq1 = new TQ1();
                Name        = tq1.Name;
                Description = tq1.Description;
                Fields      = tq1.Fields;
                break;

            case Segments.TQ2:
                TQ2 tq2 = new TQ2();
                Name        = tq2.Name;
                Description = tq2.Description;
                Fields      = tq2.Fields;
                break;

            case Segments.TXA:
                TXA txa = new TXA();
                Name        = txa.Name;
                Description = txa.Description;
                Fields      = txa.Fields;
                break;

            case Segments.UB1:
                UB1 ub1 = new UB1();
                Name        = ub1.Name;
                Description = ub1.Description;
                Fields      = ub1.Fields;
                break;

            case Segments.UB2:
                UB2 ub2 = new UB2();
                Name        = ub2.Name;
                Description = ub2.Description;
                Fields      = ub2.Fields;
                break;

            case Segments.URD:
                URD urd = new URD();
                Name        = urd.Name;
                Description = urd.Description;
                Fields      = urd.Fields;
                break;

            case Segments.URS:
                URS urs = new URS();
                Name        = urs.Name;
                Description = urs.Description;
                Fields      = urs.Fields;
                break;

            case Segments.VAR:
                VAR var = new VAR();
                Name        = var.Name;
                Description = var.Description;
                Fields      = var.Fields;
                break;

            case Segments.VTQ:
                VTQ vtq = new VTQ();
                Name        = vtq.Name;
                Description = vtq.Description;
                Fields      = vtq.Fields;
                break;
            }
        }
예제 #24
0
 public ConfigHighPassFilter(DSP dsp)
     : base(dsp)
 {
     myDSP = (HighPassFilter)dsp;
     Initialize();
 }
예제 #25
0
 public ConfigBandPassFilter(DSP dsp)
     : base(dsp)
 {
     myDSP = (BandPassFilter)dsp;
     Initialize();
 }
예제 #26
0
 public virtual double[] ProcessFFT(double[] samples, DSP dsp, int dspLength)
 {
     return(samples);
 }
예제 #27
0
 public ConfigWindow(DSP parent)
 {
     myDSP = parent;
 }
예제 #28
0
    private static void Main(string[] args)
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    MAIN is the main program for FEM2D_POISSON_CG.
    //
    //  Discussion:
    //
    //    This program is a variant of FEM2D_POISSON.  That program is
    //    particularly limited because of its use of banded matrix storage and
    //    solving routines.
    //
    //    This program discards the banded approach.  Instead, it uses a
    //    sparse matrix storage format and a conjugate gradient solver,
    //    which allow this program to solve larger problems faster.
    //
    //    This program solves the Poisson equation
    //
    //      -DEL H(X,Y) DEL U(X,Y) + K(X,Y) * U(X,Y) = F(X,Y)
    //
    //    in a triangulated region in the plane.
    //
    //    Along the boundary of the region, Dirichlet conditions
    //    are imposed:
    //
    //      U(X,Y) = G(X,Y)
    //
    //    The code uses continuous piecewise linear basis functions on
    //    triangles.
    //
    //  Problem specification:
    //
    //    The user defines the geometry by supplying two data files
    //    which list the node coordinates, and list the nodes that make up
    //    each element.
    //
    //    The user specifies the right hand side of the Dirichlet boundary
    //    conditions by supplying a function
    //
    //      void dirichlet_condition ( int node_num, double node_xy[2*node_num],
    //        double node_bc[node_num] )
    //
    //    The user specifies the coefficient function H(X,Y) of the Poisson
    //    equation by supplying a routine of the form
    //
    //      void h_coef ( int node_num, double node_xy[2*node_num],
    //        double node_h[node_num] )
    //
    //    The user specifies the coefficient function K(X,Y) of the Poisson
    //    equation by supplying a routine of the form
    //
    //      void k_coef ( int node_num, double node_xy[2*node_num],
    //        double node_k[node_num] )
    //
    //    The user specifies the right hand side of the Poisson equation
    //    by supplying a routine of the form
    //
    //      void rhs ( int node_num, double node_xy[2*node_num],
    //        double node_f[node_num] )
    //
    //  Usage:
    //
    //    fem2d_poisson_cg prefix
    //
    //    where 'prefix' is the common filename prefix so that:
    //
    //    * prefix_nodes.txt contains the coordinates of the nodes;
    //    * prefix_elements.txt contains the indices of nodes forming each element.
    //
    //    Files created include:
    //
    //    * prefix_nodes.eps, an image of the nodes;
    //    * prefix_elements.eps, an image of the elements;
    //    * prefix_values.txt, the value of the solution at every node.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    25 January 2013
    //
    //  Author:
    //
    //    John Burkardt
    //
    //  Local parameters:
    //
    //    Local, double A[NZ_NUM], the coefficient matrix.
    //
    //    Local, int ELEMENT_NODE[3*ELEMENT_NUM];
    //    ELEMENT_NODE(I,J) is the global index of local node I in element J.
    //
    //    Local, int ELEMENT_NUM, the number of elements.
    //
    //    Local, integer ELEMENT_ORDER, the element order.
    //
    //    Local, double F[NODE_NUM], the right hand side.
    //
    //    Local, int IA[NZ_NUM], the row indices of the nonzero entries
    //    of the coefficient matrix.
    //
    //    Local, int JA[NZ_NUM], the column indices of the nonzero entries
    //    of the coefficient matrix.
    //
    //    Local, bool NODE_BOUNDARY[NODE_NUM], is TRUE if the node is
    //    found to lie on the boundary of the region.
    //
    //    Local, int NODE_CONDITION[NODE_NUM],
    //    indicates the condition used to determine the variable at a node.
    //    0, there is no condition (and no variable) at this node.
    //    1, a finite element equation is used;
    //    2, a Dirichlet condition is used.
    //    3, a Neumann condition is used.
    //
    //    Local, int NODE_NUM, the number of nodes.
    //
    //    Local, double NODE_U[NODE_NUM], the finite element coefficients.
    //
    //    Local, double NODE_XY[2*NODE_NUM], the coordinates of nodes.
    //
    //    Local, int NZ_NUM, the number of nonzero entries
    //    in the coefficient matrix.
    //
    //    Local, integer QUAD_NUM, the number of quadrature points used for
    //    assembly.  This is currently set to 3, the lowest reasonable value.
    //    Legal values are 1, 3, 4, 6, 7, 9, 13, and for some problems, a value
    //    of QUAD_NUM greater than 3 may be appropriate.
    //
    {
        const bool debug = false;
        int        node;
        string     prefix;
        const int  quad_num = 3;

        Console.WriteLine("");
        Console.WriteLine("FEM2D_POISSON_CG:");
        Console.WriteLine("");
        Console.WriteLine("  A version of FEM2D_POISSON using sparse storage");
        Console.WriteLine("  and a conjugate gradient solver.");
        Console.WriteLine("");
        Console.WriteLine("  Solution of the Poisson equation in an arbitrary region");
        Console.WriteLine("  in 2 dimensions.");
        Console.WriteLine("");
        Console.WriteLine("  - DEL H(x,y) DEL U(x,y) + K(x,y) * U(x,y) = F(x,y) in the region");
        Console.WriteLine("");
        Console.WriteLine("                                     U(x,y) = G(x,y) on the boundary.");
        Console.WriteLine("");
        Console.WriteLine("  The finite element method is used,");
        Console.WriteLine("  with triangular elements,");
        Console.WriteLine("  which must be a 3 node linear triangle.");
        //
        //  Get the filename prefix.
        //
        try
        {
            prefix = args[0];
        }
        catch
        {
            Console.WriteLine("");
            Console.WriteLine("  Please enter the filename prefix:");

            prefix = Console.ReadLine();
        }

        if (prefix != "baffle" && prefix != "ell" && prefix != "lake")
        {
            Console.WriteLine("Supported prefix value in this test is one of : baffle, ell, lake");
            return;
        }

        //
        //  Create the file names.
        //
        string node_filename     = prefix + "_nodes.txt";
        string element_filename  = prefix + "_elements.txt";
        string solution_filename = prefix + "_values.txt";

        Console.WriteLine("");
        Console.WriteLine("  Node file is \"" + node_filename + "\".");
        Console.WriteLine("  Element file is \"" + element_filename + "\".");
        //
        //  Read the node coordinate file.
        //
        TableHeader h        = typeMethods.r8mat_header_read(node_filename);
        int         dim_num  = h.m;
        int         node_num = h.n;

        Console.WriteLine("  Number of nodes =          " + node_num + "");

        int[] node_condition = new int[node_num];

        double[] node_xy = typeMethods.r8mat_data_read(node_filename, dim_num, node_num);

        typeMethods.r8mat_transpose_print_some(dim_num, node_num, node_xy, 1, 1, 2, 10,
                                               "  First 10 nodes");
        //
        //  Read the triangle description file.
        //
        h = typeMethods.i4mat_header_read(element_filename);
        int element_order = h.m;
        int element_num   = h.n;

        Console.WriteLine("");
        Console.WriteLine("  Element order =            " + element_order + "");
        Console.WriteLine("  Number of elements =       " + element_num + "");

        if (element_order != 3)
        {
            Console.WriteLine("");
            Console.WriteLine("FEM2D_POISSON_CG - Fatal error!");
            Console.WriteLine("  The input triangulation has order " + element_order + "");
            Console.WriteLine("  However, a triangulation of order 3 is required.");
            return;
        }

        int[] element_node = typeMethods.i4mat_data_read(element_filename, element_order,
                                                         element_num);

        typeMethods.i4mat_transpose_print_some(3, element_num,
                                               element_node, 1, 1, 3, 10, "  First 10 elements");

        Console.WriteLine("");
        Console.WriteLine("  Quadrature order =          " + quad_num + "");
        //
        //  Determine which nodes are boundary nodes and which have a
        //  finite element unknown.  Then set the boundary values.
        //
        bool[] node_boundary = Boundary.triangulation_order3_boundary_node(node_num, element_num,
                                                                           element_node);
        //
        //  Determine the node conditions.
        //  For now, we'll just assume all boundary nodes are Dirichlet.
        //
        for (node = 0; node < node_num; node++)
        {
            node_condition[node] = node_boundary[node] switch
            {
                true => 2,
                _ => 1
            };
        }

        //
        //  Determine the element neighbor array, just so we can estimate
        //  the nonzeros.
        //
        int[] element_neighbor = Neighbor.triangulation_order3_neighbor_triangles(element_num, element_node);
        //
        //  Count the number of nonzeros.
        //
        int[] adj_col = new int[node_num + 1];

        int nz_num = Adjacency.triangulation_order3_adj_count(node_num, element_num,
                                                              element_node, element_neighbor, adj_col);

        Console.WriteLine("");
        Console.WriteLine("  Number of nonzero coefficients NZ_NUM = " + nz_num + "");
        //
        //  Set up the sparse row and column index vectors.
        //
        int[] ia = new int[nz_num];
        int[] ja = new int [nz_num];

        Adjacency.triangulation_order3_adj_set2(node_num, element_num, element_node,
                                                element_neighbor, nz_num, adj_col, ia, ja);

        switch (debug)
        {
        case true:
            typeMethods.i4vec2_print(nz_num, ia, ja, "  Adjacency pairs:");
            break;
        }

        //
        //  Index the diagonal elements for use by the CG solver.
        //
        int[] diag = Diagonal.diag_index(nz_num, ia, ja, node_num);

        switch (debug)
        {
        case true:
            typeMethods.i4vec_print(node_num, diag, "  Diagonal adjacency vector:");
            break;
        }

        //
        //  Allocate space for the coefficient matrix A and right hand side F.
        //
        double[] a      = new double[nz_num];
        double[] f      = new double[node_num];
        double[] node_u = new double[node_num];
        //
        //  Assemble the finite element coefficient matrix A and the right-hand side F.
        //

        switch (prefix)
        {
        case "baffle":
            DSP.assemble_poisson_dsp(node_num, node_xy, element_num,
                                     element_node, quad_num, nz_num, ia, ja, ref a, ref f, baffle.rhs, baffle.h_coef, baffle.k_coef);
            break;

        case "ell":
            DSP.assemble_poisson_dsp(node_num, node_xy, element_num,
                                     element_node, quad_num, nz_num, ia, ja, ref a, ref f, ell.rhs, ell.h_coef, ell.k_coef);
            break;

        case "lake":
            DSP.assemble_poisson_dsp(node_num, node_xy, element_num,
                                     element_node, quad_num, nz_num, ia, ja, ref a, ref f, lake.rhs, lake.h_coef, lake.k_coef);
            break;
        }

        switch (debug)
        {
        //
        //  Print a portion of the matrix.
        //
        case true:
            DSP.dsp_print_some(node_num, node_num, nz_num, ia, ja, a, 1, 1, 10, 10,
                               "  Part of Finite Element matrix A:");

            typeMethods.r8vec_print_some(node_num, f, 1, 10,
                                         "  Part of right hand side vector F:");
            break;
        }

        //
        //  Adjust the linear system to account for Dirichlet boundary conditions.
        //
        switch (prefix)
        {
        case "baffle":
            DSP.dirichlet_apply_dsp(node_num, node_xy, node_condition, nz_num, ia, ja,
                                    ref a, ref f, baffle.dirichlet_condition);
            break;

        case "ell":
            DSP.dirichlet_apply_dsp(node_num, node_xy, node_condition, nz_num, ia, ja,
                                    ref a, ref f, ell.dirichlet_condition);
            break;

        case "lake":
            DSP.dirichlet_apply_dsp(node_num, node_xy, node_condition, nz_num, ia, ja,
                                    ref a, ref f, lake.dirichlet_condition);
            break;
        }

        switch (debug)
        {
        case true:
            DSP.dsp_print_some(node_num, node_num, nz_num, ia, ja, a, 1, 1, 10, 10,
                               "  Part of finite Element matrix A after boundary adjustments:");

            typeMethods.r8vec_print_some(node_num, f, 1, 10,
                                         "  Part of right hand side vector F:");
            break;
        }

        //
        //  Solve the linear system using the conjugate gradient method.
        //
        node_u = ConjugateGradient.solve_cg(node_num, diag, nz_num, ia, ja, a, f);

        typeMethods.r8vec_print_some(node_num, node_u, 1, 10,
                                     "  Part of the solution vector vector U:");
        //
        //  Write an ASCII file that can be read into MATLAB.
        //
        typeMethods.r8mat_write(solution_filename, 1, node_num, node_u);

        Console.WriteLine("");
        Console.WriteLine("  Wrote an ASCII file");
        Console.WriteLine("    \"" + solution_filename + "\".");
        Console.WriteLine("  of the form");
        Console.WriteLine("    U ( X(I), Y(I) )");
        Console.WriteLine("  which can be used for plotting.");

        switch (debug)
        {
        case true:
            typeMethods.r8vec_print_some(node_num, node_u, 1, 10,
                                         "  Part of the solution vector:");
            break;
        }

        Console.WriteLine("");
        Console.WriteLine("FEM2D_POISSON_CG:");
        Console.WriteLine("  Normal end of execution.");

        Console.WriteLine("");
    }
}
예제 #29
0
 public ConfigWindow(DSP parent)
 {
     myDSP = parent;
 }
예제 #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pack"></param>
        /// <param name="fighter"></param>
        /// <param name="editor"></param>
        /// <returns>Dictionary to maps old sound id values to new values</returns>
        private void ImportSoundData(ZipFile pack, MEXFighterEntry fighter, string semFile)
        {
            Console.WriteLine($"Importing Sound Data...");

            var root = Path.GetDirectoryName(MainForm.Instance.FilePath);

            // Load SEM File
            SemEntries = SEM.ReadSEMFile(semFile, true, editor._data);

            // narrator call-----------------------------------------------
            var narratorScript = @".SFXID : (id)
.REVERB : 48
.PRIORITY : 15
.UNKNOWN06 : 229
.END : 0";
            var narr           = pack["Sound/narrator.dsp"];

            var nameBank = SemEntries.Find(e => e.SoundBank?.Name == "nr_name.ssm");

            if (narr != null && nameBank != null)
            {
                var narsound = new DSP();
                narsound.FromFormat(GetBytes(narr), "dsp");
                var index = nameBank.SoundBank.Sounds.Length;
                nameBank.SoundBank.AddSound(narsound);

                var script = new SEMScript();
                SEM.CompileSEMScript(narratorScript.Replace("(id)", index.ToString()), out script.CommandData);
                var scriptIndex = nameBank.Scripts.Length;
                nameBank.AddScript(script);

                fighter.AnnouncerCall = scriptIndex + SemEntries.IndexOf(nameBank) * 10000;

                Console.WriteLine("Imported Announcer Call");
            }

            // Create and import SSM-----------------------------------------------

            var semYAML = pack["Sound/sem.yaml"];
            var ssmFile = pack["Sound/sound.ssm"];

            if (semYAML != null)
            {
                using (MemoryStream zos = new MemoryStream())
                {
                    semYAML.Extract(zos);
                    zos.Position = 0;
                    using (StreamReader r = new StreamReader(zos))
                    {
                        var semEntry = SEMEntry.Deserialize(r.ReadToEnd());

                        if (ssmFile != null)
                        {
                            var ssmName = fighter.NameText.ToLower() + ".ssm";
                            semEntry.SoundBank = new SSM();
                            using (MemoryStream ssmStream = new MemoryStream())
                            {
                                ssmFile.Extract(ssmStream);
                                ssmStream.Position = 0;
                                semEntry.SoundBank.Open(ssmName, ssmStream);
                            }
                            var ssmFilePath = Path.Combine(root, "audio\\us\\" + ssmName);
                            File.WriteAllBytes(ssmFilePath, GetBytes(ssmFile));
                        }

                        fighter.SSMIndex = SemEntries.Count;
                        SemEntries.Add(semEntry);
                    }
                }
            }


            // Import Victory Theme
            var victory = pack["Sound/victory.hps"];

            if (victory != null)
            {
                var ffname = $"ff_{fighter.NameText.ToLower()}.hps";
                fighter.VictoryThemeID = editor.MusicControl.AddMusic(new HSD_String()
                {
                    Value = ffname
                });

                var fffilePath = Path.Combine(root, "audio\\" + ffname);
                File.WriteAllBytes(fffilePath, GetBytes(victory));
            }
        }
예제 #31
0
 public ConfigButterworth1stLPF(DSP dsp)
     : base(dsp)
 {
     myDSP = (Butterworth1stLPF)dsp;
     Initialize();
 }
예제 #32
0
 public static RESULT CreateDSP(ref DSP_DESCRIPTION dspDescription, out DSP dsp)
 {
     return(m_FMODSystem.createDSP(ref dspDescription, out dsp));
 }
예제 #33
0
 public static RESULT CreateDSP(DSP_TYPE dspType, out DSP dsp)
 {
     return(m_FMODSystem.createDSPByType(dspType, out dsp));
 }
예제 #34
0
파일: DSR_Q03.cs 프로젝트: nHapiNET/nHapi
 ///<summary>
 ///Removes the given DSP
 ///</summary>
 public void RemoveDSP(DSP toRemove)
 {
     this.RemoveStructure("DSP", toRemove);
 }
예제 #35
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="dsp"></param>
 public void SetSound(DSP dsp)
 {
     editor.SetSound(dsp);
 }